Update STLPort and compile the library
Turn on most features of stl and compile the source for streams.
diff --git a/Android.mk b/Android.mk
new file mode 100755
index 0000000..6f746fd
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,53 @@
+# We cannot use stlport on the simulator because it conficts with the host stl
+# library. Android's port also relies on bionic which is not built for the
+# simulator either.
+ifneq ($(TARGET_SIMULATOR),true)
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES += \
+ src/dll_main.cpp \
+ src/fstream.cpp \
+ src/strstream.cpp \
+ src/sstream.cpp \
+ src/ios.cpp \
+ src/stdio_streambuf.cpp \
+ src/istream.cpp \
+ src/ostream.cpp \
+ src/iostream.cpp \
+ src/codecvt.cpp \
+ src/collate.cpp \
+ src/ctype.cpp \
+ src/monetary.cpp \
+ src/num_get.cpp \
+ src/num_put.cpp \
+ src/num_get_float.cpp \
+ src/num_put_float.cpp \
+ src/numpunct.cpp \
+ src/time_facets.cpp \
+ src/messages.cpp \
+ src/locale.cpp \
+ src/locale_impl.cpp \
+ src/locale_catalog.cpp \
+ src/facets_byname.cpp \
+ src/complex.cpp \
+ src/complex_io.cpp \
+ src/complex_trig.cpp \
+ src/string.cpp \
+ src/bitset.cpp \
+ src/allocators.cpp \
+ src/c_locale.c \
+ src/cxa.c \
+
+LOCAL_MODULE := libstlport
+
+LOCAL_PRELINK_MODULE := false
+
+LOCAL_CFLAGS := -D_GNU_SOURCE
+LOCAL_CPPFLAGS := -fuse-cxa-atexit
+
+include $(LOCAL_PATH)/libstlport.mk
+
+include $(BUILD_SHARED_LIBRARY)
+endif
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..8617ef9
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,166 @@
+**********************************************************************
+* INSTALL file for STLport *
+* *
+**********************************************************************
+
+STLport is a full ANSI C++ Standard library.
+
+This distribution contains STLport sources only, no binaries.
+To use STLport iostreams, locale and complex numbers, you have to build STLport
+library from sources in "build/lib" directory and link your programs with it.
+
+Starting with 5.0 the 'wrapper' mode is not supported anymore. You cannot use native
+compiler iostreams implementation with STLport STL (see doc/FAQ for explanations).
+Now you have to choose between STLport iostreams or no iostreams.
+
+==== Unpacking and installing STLport ==========
+
+1) Unpack STLport archive to a directory accessible during compilation.
+ NOTE: DO NOT overwrite header files coming with the compiler, even if you made
+ a backup - this won't work! Most probably, you've already unpacked the archive before
+ reading this file though ;)
+
+2) Make sure "stlport" directory of this distribution comes before compiler's one
+ in your include paths when you compile the project.
+
+ Note: for SunPro CC 5.0 and higher, there used to be special directory "stlport/SC5"
+ this is now obsolete, please make sure you do not use it anymore.
+
+3) Make sure you do not rename this "stlport" subdirectory -
+ that may result in compilation errors.
+
+ NOTE: Your compiler should be recognized by STLport source code with no configuring.
+ Please edit appropriate configuration header for your compiler
+ directly if you have to make compiler-specific configuration changes
+ (see stlport/stl/config).
+
+4) Run:
+
+ configure --help
+
+ Depending on your environment, Windows command shell or Unix like shell,
+ configure.bat or configure script will be run respectively. For Windows users
+ running configure script is mandatory in order to declare the compiler you are
+ going to use.
+
+5) Go to "build/lib" subdirectory. It contains various makefiles for different
+ compilers and 'make' utilities (GNU Make and Microsoft's nmake supported).
+
+ Verify you can do command line compiles. IDE users may have to do something
+ special, like add environment variables (for Microsoft) or install
+ additional compiler components (for Metrowerks), before they can use their
+ command line compilers (see doc/README.xxxx for additionnal information).
+
+ configure script should have already created a Makefile file so that you only
+ have to call 'make' or 'nmake' (for some platforms GNU make might be hidden
+ behind 'gmake').
+
+ IMPORTANT:
+
+ If you DO NOT plan to use STLport iostreams and/or locale implementation but just
+ the STL, you do not have to build the library.
+
+ If you have decided to disable STLport iostreams and locale using _STLP_NO_IOSTREAMS
+ configuration macro in stlport/stl/config/user_config.h, you may stop reading here.
+
+
+==== Building STLport iostreams library ==========
+
+Below are step-by-step instructions to build STLport streams library. This is a general
+build process description, for a more detailed one check README files in the doc folder:
+
+5) Using appropriate make command (make or nmake), do
+
+ make clean install
+
+ to build the STLport libraries. Make files are set up to build several different
+ flavors - debug/nondebug, static/dynamic versions. But not all flavors will be build
+ by default. See build/lib/README for other make targets.
+
+ Note: 'install' target work slightly different than usual - it installs libraries into
+ <STLport root dir>/lib and bin catalogs, NOT IN SYSTEM CATALOG. You can do the system
+ install by just copying stlport and lib folder to the destination of your choise. For
+ example on UNIX-like platforms this can be done with the following commands:
+
+ su
+ tar cf - stlport | (cd /usr/local/include; tar xf -)
+ chmod -R a+r /usr/local/include/stlport
+ chown -R root:root /usr/local/include/stlport
+ (cd lib; tar cf - --exclude=CVS --exclude=.cvsignore .) | (cd /usr/local/lib; tar xf -)
+ chown -R root:root /usr/local/lib/libstlport*
+ exit
+
+ Note: System install is optional, most of compilers/linkers support searching for includes
+ and libs throught out the whole filesystem, just check your documentation on how to achieve
+ this.
+
+ If you use cross-compiler, you can find libraries in the <STLport root dir>/lib/<target platform>
+ catalog.
+
+6) If build fails, you may choose to :
+ - try fixing the build ;)
+ - wait until somebody else will submit corresponding changes to be incorporated in next STLport
+ release/snapshot.
+
+ In case you do patch STLport, please submit your patches to
+ https://sourceforge.net/tracker/?atid=766246&group_id=146814&func=browse
+
+==== Linking your application with STLport library ==========
+
+7) Check the build:
+
+ Example:
+
+ - under Linux and other Unixes:
+
+ cd build/test/unit
+ make install
+ ../../../bin/stl_unit_test
+ ../../../bin-g/stl_unit_test
+
+ - under Windows:
+
+ cd build\test\unit
+ nmake install
+ cd ..\..\..\bin
+ stl_unit_test
+ stl_unit_testd
+ stl_unit_teststld
+
+8) Supply the "lib" subdirectory to the library search path and add desired
+ library to the list of libraries to link with.
+ Examples (imagine you have mytest.cpp in the same directory as this file is):
+ With GCC : g++ -pthread -I./stlport mytest.cpp -L./lib/ -lstlport
+ With DEC CC : cxx -I./stlport mytest.cpp -L./lib/ -lstlport
+ With SUN CC : CC -mt -I./stlport mytest.cpp -L./lib/ -lstlport
+ .....
+ For several compilers supporting auto linking feature (VC++, Borland, DMC),
+ you do not have to specify "stlport.M.m.lib" explicitly, as it is being choosen
+ and forced to link automatically by "#pragma"'s in compiler config files
+ Appropriate version is being selected based on compiler options and _STLP_DEBUG
+ setting. All you have to do is to set library search path for the linker.
+
+ Example :
+ cl.exe /I.\stlport mytest.cpp /link /libpath:.\lib /MD
+
+9) If you linked your application with shared STLport library (.so or .dll), please
+ make suze that your .so or .dll can be found by the dynamic linker.
+ Under Windows, the paths searched depend on the particular flavor, see the MSDN
+ documentation for LoadLibrary at http://msdn.microsoft.com. The easiest ways are to
+ either modify the PATH environment variable or copy all .dll's next to the
+ executable like it is done per default when unit tests executable are put next
+ to dlls.
+ Under Linux, the environment variable LD_LIBRARY_PATH can be adjusted to point
+ to the dir containing .so. See the manpage for ld.so for more info.
+
+10) STLport builds only multithreaded libraries, so your application should be compiled
+ as multithreaded, too. Use -pthread (or -pthreads on Solaris) option for GCC, -mt for SunPro,
+ /MT for VC, and so on. Sometimes you should define _REENTRANT or something else, depends
+ upon platform/compiler. See compiler's and linker's options on command line when you build
+ unit tests (build/test/unit) for reference. The last is useful for ANY platform.
+
+11) Don't hesitate to read READMEs (doc/README*, build/lib/README*, build/test/unit/README*)
+ and doc/FAQ.
+
+12) Have fun!
+
diff --git a/INSTALL.unixes b/INSTALL.unixes
new file mode 100644
index 0000000..f9b2e21
--- /dev/null
+++ b/INSTALL.unixes
@@ -0,0 +1,120 @@
+**********************************************************************
+* INSTALL file for STLport 5.2 *
+* *
+**********************************************************************
+
+STLport is a full ANSI C++ Standard library.
+
+This distribution contains STLport sources only, no binaries.
+To use STLport iostreams, locale and complex numbers, you have
+to build STLport library from sources and link your programs with it.
+
+Starting with 5.0 the 'wrapper' mode is not supported anymore.
+You cannot use native compiler iostreams implementation with STLport STL
+(see doc/FAQ for explanations).
+
+==== Installing STLport ==========
+
+0) DO NOT overwrite/move/rename header files coming with the compiler,
+ even if you made a backup---STLport need this headers and don't
+ override ones.
+
+1) Run
+
+ ./configure --help
+
+ read options description; if you use compiler
+ different from gcc, pay attention to --use-compiler-family= option.
+
+2) Run
+
+ ./configure <option>
+
+ Options here more-or-less traditional.
+
+ Note: ./configure give hints only for library build, it dosen't
+ create/edit any headers, check you system etc. This is simple way
+ to store custom options, not more. If you want to change default
+ behaviour of STLport, see stlport/stl/config/user_config.h and
+ stlport/stl/config/host.h; read the comments in this files!
+ Not all combinations of options healthy, you should understand
+ what you do. If not, keep all unchanged.
+
+ Note: you can find all recognised 'settings' in the file
+ build/Makefiles/gmake/config.mak
+
+ This is generated file, but only ./configure will rewrite one.
+
+3) Run
+
+ make && make check
+
+ Only GNU Make supported! Preferred verion of GNU Make >= 3.81;
+ never use GNU Make before 3.79 --- build not work properly;
+ GNU makes >= 3.79 and < 3.81 may fail to build library/tests
+ properly, due to bugs; but the real results depends upon
+ platform.
+
+4) If build fine, become superuser and run
+
+ make install
+
+ Note: you can use --prefix= to change installation path
+ (or macro DESTDIR, as usual), or even skip installation and use
+ STLport in-place.
+
+==== Usage STLport ==========
+
+1) The best way to understand how to use it, is to see on compilation,
+ linking, running unit tests, i.e. see on options when you do
+
+ (cd build/test/unit; make check)
+
+2) Make sure "stlport" directory of this distribution comes before
+ compiler's one in your include paths (something like
+ -I<base install path>/stlport); never rename 'stlport' part of path!
+
+ Compilation:
+
+ c++ -pthread -fexceptions -O2 -I/usr/local/include/stlport -c -o test.o test.cc
+
+ In case of gcc, libstlport replace libstdc++ (not in all cases!)
+
+ Link, variant 1:
+
+ c++ -pthread -fexceptions -O2 -I/usr/local/include/stlport -nostdlib -o mytest \
+ /usr/lib/gcc/i686-pc-linux-gnu/4.2.4/../../../crt1.o \
+ /usr/lib/gcc/i686-pc-linux-gnu/4.2.4/../../../crti.o \
+ /usr/lib/gcc/i686-pc-linux-gnu/4.2.4/crtbegin.o \
+ test.o \
+ -lstlport \
+ -lgcc_s -lpthread -lc -lm \
+ /usr/lib/gcc/i686-pc-linux-gnu/4.2.4/crtend.o \
+ /usr/lib/gcc/i686-pc-linux-gnu/4.2.4/../../../crtn.o
+
+ Of cause, names of start/stop files not hardcoded, you can locate it with
+
+ c++ -print-file-name=crt1.o
+
+ Link, variant 2:
+
+ gcc -pthread -fexceptions -O2 -I/usr/local/include/stlport -o mytest \
+ test.o -lstlport
+
+ If you use gcc before 3.3, you must link with libstdc++, because
+ language-support library (libsupc++.a) don't contain necessary
+ functions.
+
+3) STLport builds only multithreaded libraries (by default), so your
+ application should be compiled as multithreaded, too. Use -pthread
+ (or -pthreads on Solaris) option for GCC, -mt for SunPro and so on.
+ Sometimes you should define _REENTRANT or something else, depends
+ upon platform/compiler. See compiler's and linker's options
+ on command line when you build unit tests (build/test/unit)
+ for reference. The last is useful for ANY platform (special
+ attention for Windows users).
+
+4) Don't hesitate to read READMEs (doc/README*, build/lib/README*,
+ build/test/unit/README*) and doc/FAQ.
+
+5) Have fun!
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..6846270
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,27 @@
+Boris Fomitchev grants Licensee a non-exclusive, non-transferable, royalty-free license to use STLport and its documentation without fee.
+
+By downloading, using, or copying STLport or any portion thereof, Licensee agrees to abide by the intellectual property laws and all other applicable laws of the United States of America, and to all of the terms and conditions of this Agreement.
+
+Licensee shall maintain the following copyright and permission notices on STLport sources and its documentation unchanged :
+
+Copyright 1999,2000 Boris Fomitchev
+
+This material is provided "as is", with absolutely no warranty expressed or implied. Any use is at your own risk.
+Permission to use or copy this software for any purpose is hereby granted without fee, provided the above notices are retained on all copies. Permission to modify the code and to distribute modified code is granted, provided the above notices are retained, and a notice that the code was modified is included with the above copyright notice.
+The Licensee may distribute binaries compiled with STLport (whether original or modified) without any royalties or restrictions.
+
+The Licensee may distribute original or modified STLport sources, provided that:
+
+The conditions indicated in the above permission notice are met;
+The following copyright notices are retained when present, and conditions provided in accompanying permission notices are met :
+Copyright 1994 Hewlett-Packard Company
+
+Copyright 1996,97 Silicon Graphics Computer Systems, Inc.
+
+Copyright 1997 Moscow Center for SPARC Technology.
+
+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. Hewlett-Packard Company makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
+
+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.
+
+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. Moscow Center for SPARC Technology makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
diff --git a/MODULE_LICENSE_BSD_LIKE b/MODULE_LICENSE_BSD_LIKE
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_BSD_LIKE
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..61cefb6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+# Time-stamp: <08/06/12 14:28:42 ptr>
+#
+# Copyright (c) 2004-2008
+# Petr Ovtchenkov
+#
+# Licensed under the Academic Free License version 3.0
+#
+
+SRCROOT := build
+SUBDIRS := build/lib
+
+include ${SRCROOT}/Makefiles/gmake/subdirs.mak
+
+all install depend clean clobber distclean check::
+ +$(call doinsubdirs,${SUBDIRS})
+
+distclean clean depend clobber::
+ +$(call doinsubdirs,build/test/unit)
+
+release-shared install-release-shared:
+ +$(call doinsubdirs,${SUBDIRS})
+
+install::
+ ${MAKE} -C build/lib install-headers
+
+.PHONY: all install depend clean clobber distclean check release-shared install-release-shared
diff --git a/README b/README
index 018051b..a759495 100644
--- a/README
+++ b/README
@@ -1 +1,64 @@
-STLPort was copied with minor edits from the Android port of gears.
+**********************************************************************
+* README file for STLport 5.0 *
+* *
+**********************************************************************
+
+This directory contains the STLport-5.0 release.
+
+What's inside :
+
+README - this file
+INSTALL - installation instructions
+
+bin - installation directory for STLport unit tests;
+ it may contain more subdirs, if you use
+ crosscompilation
+build/lib - build directory for STLport library (if you use
+ STLport iostreams and/or locale only)
+build/test/unit - build directory for regression (unit) tests
+build/test/eh - build directory for exception handling tests
+stlport - main STLport include directory
+src - source for iostreams implementation and other parts
+ that aren't pure template code
+lib - installation directory for STLport library (if you
+ use STLport iostreams and/or locale only);
+ it may contain more subdirs, if you use
+ crosscompilation
+test/unit - unit (regression) tests
+test/eh - exception handling test using STLport iostreams
+etc - miscellanous files (ChangeLog, TODO, scripts, etc.)
+
+GETTING STLPORT
+
+To download the latest version of STLport, please be sure to visit
+https://sourceforge.net/project/showfiles.php?group_id=146814
+
+LEGALESE
+
+This software is being distributed under the following terms:
+
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999-2003
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+
+**********************************************************************
diff --git a/README.google b/README.google
new file mode 100644
index 0000000..a35c955
--- /dev/null
+++ b/README.google
@@ -0,0 +1,9 @@
+Version: 5.2.1
+
+Changes:
+ * Added _android.h included by _system.h
+ * Do not use linux float functions in num_get_float.cpp as Android does not
+ have them.
+ * _mbstate_t.h cannot define its own mbstate_t as bionic already defines
+ it.
+ * _pair.h needs to define bionic's (sgi's) internal pair header guard.
diff --git a/algorithm b/algorithm
deleted file mode 100644
index 1695735..0000000
--- a/algorithm
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_ALGORITHM
-#define _STLP_ALGORITHM
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x1
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#ifndef _STLP_INTERNAL_CSTDIO
-// remove() conflicts, <cstdio> should always go first
-# include <stl/_cstdio.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALGO_H
-# include <stl/_algo.h>
-#endif
-
-#if defined (_STLP_IMPORT_VENDOR_STD)
-# include _STLP_NATIVE_HEADER(algorithm)
-#endif /* _STLP_IMPORT_VENDOR_STD */
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x1 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_ALGORITHM */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/assert.h b/assert.h
deleted file mode 100644
index 28d0109..0000000
--- a/assert.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x202
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x202) && ! defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-/* evc3 doesn't have assert.h; macro assert() is defined in stl_evc.h */
-#ifndef _STLP_WCE_EVC3
-# include _STLP_NATIVE_C_HEADER(assert.h)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x202)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-# undef _STLP_DONT_POP_HEADER_ID
-#endif
-
-/* Local Variables:
- * mode:C++
- * End:
- */
diff --git a/bitset b/bitset
deleted file mode 100644
index 15466e5..0000000
--- a/bitset
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_BITSET
-#define _STLP_BITSET
-
-// This implementation of bitset<> has a second template parameter,
-// _WordT, which defaults to unsigned long. *YOU SHOULD NOT USE
-// THIS FEATURE*. It is experimental, and it may be removed in
-// future releases.
-
-// A bitset of size N, using words of type _WordT, will have
-// N % (sizeof(_WordT) * CHAR_BIT) unused bits. (They are the high-
-// order bits in the highest word.) It is a class invariant
-// of class bitset<> that those unused bits are always zero.
-
-// Most of the actual code isn't contained in bitset<> itself, but in the
-// base class _Base_bitset. The base class works with whole words, not with
-// individual bits. This allows us to specialize _Base_bitset for the
-// important special case where the bitset is only a single word.
-
-// The C++ standard does not define the precise semantics of operator[].
-// In this implementation the const version of operator[] is equivalent
-// to test(), except that it does no range checking. The non-const version
-// returns a reference to a bit, again without doing any range checking.
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x2
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#include <stl/_bitset.h>
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x2 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_BITSET */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/cassert b/cassert
deleted file mode 100644
index 51757de..0000000
--- a/cassert
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x103
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x103) && ! defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-#if !defined (_STLP_WCE_EVC3)
-# if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(cassert)
-# else
-# include <assert.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x103 )
-# if !defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-#endif
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/cctype b/cctype
deleted file mode 100644
index 646c686..0000000
--- a/cctype
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CCTYPE
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x104
-# define _STLP_CCTYPE
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x104 )
-# include _STLP_NATIVE_CPP_C_HEADER(cctype)
-#else
-# ifndef _STLP_INTERNAL_CCTYPE
-# include <stl/_cctype.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x104 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CCTYPE */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/cerrno b/cerrno
deleted file mode 100644
index 83b3960..0000000
--- a/cerrno
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CERRNO
-# define _STLP_CERRNO
-
-# ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x105
-# include <stl/_prolog.h>
-# endif
-
-# ifndef _STLP_WCE
-# if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(cerrno)
-# else
-# include <errno.h>
-# endif
-# endif
-
-#ifndef errno
-
-# if defined (_STLP_IMPORT_VENDOR_CSTD) && \
- ! defined (__IBMCPP__) && ! defined(__hpux) && ! defined(__MWERKS__) && !defined(_STLP_WCE)
-_STLP_BEGIN_NAMESPACE
-using _STLP_VENDOR_CSTD::errno;
-_STLP_END_NAMESPACE
-# endif /* _STLP_IMPORT_VENDOR_CSTD */
-
-#endif
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x105 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-
-#endif /* _STLP_CERRNO */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/cfloat b/cfloat
deleted file mode 100644
index 8a76a10..0000000
--- a/cfloat
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CFLOAT
-#define _STLP_CFLOAT
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x106
-# include <stl/_prolog.h>
-#endif
-
-// Borland defines some implementation constants in std:: namespace,
-// we do not want to import them.
-#if defined (_STLP_USE_NEW_C_HEADERS) && !defined (__BORLANDC__)
-# include _STLP_NATIVE_CPP_C_HEADER(cfloat)
-#else
-# include <float.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x106 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CFLOAT */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/ciso646 b/ciso646
deleted file mode 100644
index 901f36f..0000000
--- a/ciso646
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CISO646
-#define _STLP_CISO646
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x107
-# include <stl/_prolog.h>
-#endif
-
-#if !defined(_STLP_WCE_EVC3) && !defined (N_PLAT_NLM) && !defined (__BORLANDC__)
-# if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(ciso646)
-# else
-# include <iso646.h>
-# endif /* _STLP_USE_NEW_C_HEADERS */
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x107 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CISO646 */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/climits b/climits
deleted file mode 100644
index bdd4ab4..0000000
--- a/climits
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CLIMITS
-# define _STLP_CLIMITS
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x108
-# include <stl/_prolog.h>
-#endif
-
-#if defined (__SUNPRO_CC) && ((__SUNPRO_CC == 0x500) && (__SUNPRO_CC_COMPAT > 4))
-# include </usr/include/limits.h>
-#elif defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(climits)
-#else
-# if defined (__BORLANDC__)
-# include _STLP_NATIVE_C_HEADER(limits.h)
-# else
-# include <limits.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x108 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CLIMITS */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/clocale b/clocale
deleted file mode 100644
index 4e9ff7a..0000000
--- a/clocale
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CLOCALE
-#define _STLP_CLOCALE
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x109
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x109 )
-# include _STLP_NATIVE_CPP_C_HEADER(clocale)
-#else
-# ifndef _STLP_INTERNAL_CLOCALE
-# include <stl/_clocale.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x109 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CLOCALE */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/cmath b/cmath
deleted file mode 100644
index ec319b0..0000000
--- a/cmath
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CMATH
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x110
-# define _STLP_CMATH
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x110)
-# include _STLP_NATIVE_CPP_C_HEADER(cmath)
-#else
-# ifndef _STLP_INTERNAL_CMATH
-# include <stl/_cmath.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x110 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CMATH */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/complex b/complex
deleted file mode 100644
index d373824..0000000
--- a/complex
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_COMPLEX
-#define _STLP_COMPLEX
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x10
-# include <stl/_prolog.h>
-#endif
-
-// This header declares the template class complex, as described in
-// in the draft C++ standard. Single-precision complex numbers
-// are complex<float>, double-precision are complex<double>, and
-// quad precision are complex<long double>.
-
-// Note that the template class complex is declared within namespace
-// std, as called for by the draft C++ standard
-
-#ifndef _STLP_INTERNAL_COMPLEX
-# include <stl/_complex.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x10 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_COMPLEX */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/configure b/configure
new file mode 100755
index 0000000..2f48511
--- /dev/null
+++ b/configure
@@ -0,0 +1,333 @@
+#!/bin/sh
+
+# Time-stamp: <08/06/07 15:22:19 yeti>
+
+base=`cd \`dirname $0\`; echo $PWD`
+
+configmak=$base/build/Makefiles/gmake/config.mak
+
+write_option() {
+ target=`echo $1 | sed -e 's/^[^=]*=//'`
+ echo $2 := $3$target >> ${configmak}
+}
+
+write_over_option() {
+ target=`echo $1 | sed -e 's/^[^=]*=//'`
+ echo $2 ?= $target >> ${configmak}
+}
+
+print_help() {
+ cat <<EOF
+Configuration utility.
+
+Usage:
+
+ configure [options]
+
+Available options:
+
+ --prefix=<dir> base install path (/usr/local/)
+ --bindir=<dir> install path for executables (PREFIX/bin)
+ --libdir=<dir> install path for libraries (PREFIX/lib)
+ --includedir=<dir> install path for headers (PREFIX/include)
+
+ --target=<target> target platform (cross-compiling)
+
+ --help print this help message and exit
+
+ --with-stlport=<dir> use STLport in catalog <dir>
+ --without-stlport compile without STLport
+ --with-boost=<dir> use boost headers in catalog <dir>
+ --with-system-boost use boost installed on this system
+ --with-msvc=<dir> use MS VC from this catalog
+ --with-mssdk=<dir> use MS SDK from this catalog
+ --with-extra-cxxflags=<options>
+ pass extra options to C++ compiler
+ --with-extra-cflags=<options>
+ pass extra options to C compiler
+ --with-extra-ldflags=<options>
+ pass extra options to linker (via C/C++)
+ --use-static-gcc use static gcc libs instead of shared libgcc_s (useful for gcc compiler,
+ that was builded with --enable-shared [default]; if compiler was builded
+ with --disable-shared, static libraries will be used in any case)
+ --clean remove custom settings (file ${configmak})
+ and use default values
+ --with-cxx=<name> use <name> as C++ compiler (use --target= for cross-compilation)
+ --with-cc=<name> use <name> as C compiler (use --target= for cross-compilation)
+ --use-compiler-family=<name> use compiler family; one of:
+ gcc GNU compilers (default)
+ icc Intel compilers
+ aCC HP's aCC compilers
+ CC SunPro's CC compilers
+ bcc Borland's compilers
+ --without-debug don't build debug variant
+ --without-stldebug don't build STLport's STLP_DEBUG mode
+ --enable-static build static
+ --disable-shared don't build shared
+ --with-lib-motif=<motif>
+ Use this option to customize the generated library name.
+ The motif will be used in the last place before version information,
+ separated by an underscore, ex:
+ stlportd_MOTIF.5.0.lib
+ stlportstld_static_MOTIF.5.1.lib
+ --without-thread Per default STLport libraries are built in order to be usable
+ in a multithreaded context. If you don't need this you can ask
+ for a not thread safe version with this option.
+ --without-rtti Disable RTTI when building libraries.
+ --with-static-rtl
+ --with-dynamic-rtl
+ Enables usage of static (libc.lib family) or dynamic (msvcrt.lib family)
+ C/C++ runtime library when linking with STLport. If you want your appli/dll
+ to link statically with STLport but using the dynamic C runtime use
+ --with-dynamic-rtl; if you want to link dynamicaly with STLport but using the
+ static C runtime use --with-static-rtl. See README.options for details.
+ Don't forget to signal the link method when building your appli or dll, in
+ stlport/stl/config/host.h set the following macro depending on the configure
+ option:
+ --with-static-rtl -> _STLP_USE_DYNAMIC_LIB"
+ --with-dynamic-rtl -> _STLP_USE_STATIC_LIB"
+ --windows-platform=<name>
+ Targetted OS when building for Windows; one of:
+ win95 Windows 95
+ win98 Windows 98
+ winxp Windows XP and later (default)
+
+Environment variables:
+
+ \$CXX C++ compiler name (use --target= for cross-compilation)
+ \$CC C compiler name (use --target= for cross-compilation)
+ \$CXXFLAGS pass extra options to C++ compiler
+ \$CFLAGS pass extra options to C compiler
+ \$LDFLAGS pass extra options to linker (via C/C++)
+
+ Options has preference over environment variables.
+
+EOF
+}
+
+default_settings () {
+ # if [ "$boost_set" = "" ]; then
+ # write_option "${PWD}/external/boost" BOOST_DIR
+ # fi
+
+ # if [ -z "${stlport_set}" ]; then
+ # write_over_option "$base" STLPORT_DIR
+ # fi
+
+ # Set in Makefiles/gmake/top.mak
+ if [ -z "${compiler_family_set}" ]; then
+ # write_option gcc COMPILER_NAME
+ echo include gcc.mak > ${base}/build/lib/Makefile
+ echo include gcc.mak > ${base}/build/test/unit/Makefile
+ echo include gcc.mak > ${base}/build/test/eh/Makefile
+ fi
+
+ # Set in Makefiles/gmake/targetdirs.mak
+ # if [ -z "${prefix_set}" ]; then
+ # write_option "/usr/local" BASE_INSTALL_DIR '${DESTDIR}'
+ # fi
+}
+
+[ $# -eq 0 ] && { >${configmak}; default_settings; exit 0; }
+
+for a in $@ ; do
+ case $a in
+ --help)
+ print_help
+ exit 0
+ ;;
+ --clean)
+ rm -f ${configmak}
+ exit 0
+ ;;
+ esac
+done
+
+>${configmak}
+
+while :
+do
+ case $# in
+ 0)
+ break
+ ;;
+ esac
+ option="$1"
+ shift
+ case $option in
+ --target=*)
+ write_option "$option" TARGET_OS
+ target_set=y
+ ;;
+ --with-stlport=*)
+ write_option "$option" STLPORT_DIR
+ stlport_set=y
+ ;;
+ --without-stlport)
+ write_option 1 WITHOUT_STLPORT
+ stlport_set=y
+ ;;
+ --with-boost=*)
+ write_option "$option" BOOST_DIR
+ ;;
+ --with-system-boost)
+ write_option 1 USE_SYSTEM_BOOST
+ ;;
+ --with-msvc=*)
+ write_option "$option" MSVC_DIR
+ ;;
+ --with-mssdk=*)
+ write_option "$option" MSSDK_DIR
+ ;;
+ --with-extra-cxxflags=*)
+ write_option "$option" EXTRA_CXXFLAGS
+ cxxflags_set=y
+ ;;
+ --with-extra-cflags=*)
+ write_option "$option" EXTRA_CFLAGS
+ cflags_set=y
+ ;;
+ --with-extra-ldflags=*)
+ write_option "$option" EXTRA_LDFLAGS
+ ldflags_set=y
+ ;;
+ --with-lib-motif=*)
+ echo "Using $option in generated library names"
+ write_option "$option" LIB_MOTIF
+ ;;
+ --without-thread)
+ write_option 1 WITHOUT_THREAD
+ ;;
+ --without-rtti)
+ write_option 1 WITHOUT_RTTI
+ ;;
+ --with-dynamic-rtl)
+ write_option 1 WITH_DYNAMIC_RTL
+ ;;
+ --with-static-rtl)
+ write_option 1 WITH_STATIC_RTL
+ ;;
+ --use-static-gcc)
+ write_option 1 USE_STATIC_LIBGCC
+ ;;
+ --without-debug)
+ write_option 1 _NO_DBG_BUILD
+ ;;
+ --without-stldebug)
+ write_option 1 _NO_STLDBG_BUILD
+ ;;
+ --enable-static)
+ write_option 1 _STATIC_BUILD
+ ;;
+ --disable-shared)
+ write_option 1 _NO_SHARED_BUILD
+ ;;
+ --with-cxx=*)
+ write_option "$option" _FORCE_CXX
+ cxx_set=y
+ ;;
+ --with-cc=*)
+ write_option "$option" _FORCE_CC
+ cc_set=y
+ ;;
+ --use-compiler-family=*)
+ case `echo $option | sed -e 's/^[^=]*=//'` in
+ gcc|icc|aCC|CC|bcc|dmc)
+ target=`echo $option | sed -e 's/^[^=]*=//'`
+ echo COMPILER_NAME := $target >> ${configmak}
+ echo include $target.mak > ${base}/build/lib/Makefile
+ echo include $target.mak > ${base}/build/test/unit/Makefile
+ echo include $target.mak > ${base}/build/test/eh/Makefile
+ ;;
+ *)
+ echo "Not supported compilers family"
+ exit -1
+ ;;
+ esac
+ compiler_family_set=y
+ ;;
+ --prefix=*)
+ write_option "$option" BASE_INSTALL_DIR '${DESTDIR}'
+ prefix_set=y
+ ;;
+ --bindir=*)
+ write_option "$option" INSTALL_BIN_DIR '${DESTDIR}'
+ ;;
+ --libdir=*)
+ write_option "$option" INSTALL_LIB_DIR '${DESTDIR}'
+ ;;
+ --includedir=*)
+ write_option "$option" INSTALL_HDR_DIR '${DESTDIR}'
+ ;;
+ --windows-platform=*)
+ case `echo $option | sed -e 's/^[^=]*=//'` in
+ win95)
+ write_option 0x0400 WINVER
+ ;;
+ win98)
+ write_option 0x0410 WINVER
+ ;;
+ winxp)
+ write_option 0x0501 WINVER
+ ;;
+ *)
+ echo "Not supported windows platform"
+ exit -1
+ ;;
+ esac
+ ;;
+ *)
+ echo "Unknown configuration option '$option'"
+ exit -1
+ ;;
+ esac
+done
+
+if [ -n "${CXX}" ]; then
+ if [ -n "${cxx_set}" ]; then
+ echo "Both --with-cxx and \$CXX set, using the first"
+ elif [ -z "${target_set}" ]; then
+ write_option "${CXX}" _FORCE_CXX
+ else
+ echo "For cross-compilation with gcc use --target option only"
+ fi
+ if [ -z "${CC}" -a -z "${cc_set}" ]; then
+ echo "\$CXX set, but I don't see \$CC!"
+ fi
+fi
+
+if [ -n "${CC}" ]; then
+ if [ -n "${cxx_set}" ]; then
+ echo "Both --with-cc and \$CC set, using the first"
+ else
+ write_option "${CC}" _FORCE_CC
+ fi
+fi
+
+if [ -n "${CXXFLAGS}" ]; then
+ if [ -z "${cxxflags_set}" ]; then
+ write_option "${CXXFLAGS}" EXTRA_CXXFLAGS
+ else
+ echo "Both --with-extra-cxxflags and \$CXXFLAGS set, using the first"
+ fi
+fi
+
+if [ -n "${CFLAGS}" ]; then
+ if [ -z "${cflags_set}" ]; then
+ write_option "${CFLAGS}" EXTRA_CFLAGS
+ else
+ echo "Both --with-extra-cflags and \$CFLAGS set, using the first"
+ fi
+fi
+
+if [ -n "${LDFLAGS}" ]; then
+ if [ -z "${ldflags_set}" ]; then
+ write_option "${LDFLAGS}" EXTRA_LDFLAGS
+ else
+ echo "Both --with-extra-ldflags and \$LDFLAGS set, using the first"
+ fi
+fi
+
+# default settings
+
+default_settings
diff --git a/configure.bat b/configure.bat
new file mode 100644
index 0000000..4f33f3d
--- /dev/null
+++ b/configure.bat
@@ -0,0 +1,632 @@
+@ECHO OFF
+REM **************************************************************************
+REM *
+REM * configure.bat for setting up compiling STLport under Windows
+REM * to see available options, call with option --help
+REM *
+REM * Copyright (C) 2004,2005 Michael Fink
+REM *
+REM **************************************************************************
+
+REM Attention! Batch file labels only have 8 significant characters!
+
+echo STLport Configuration Tool for Windows
+echo.
+
+REM no options at all?
+if NOT "%1xyz123" == "xyz123" goto init
+
+echo Please specify at least the compiler you are going to use,
+echo use "configure --help" to see the available ones.
+goto skp_comp
+
+:init
+
+REM initially create/overwrite config.mak
+echo # STLport Configuration Tool for Windows > build\Makefiles\nmake\config.mak
+echo # >> build\Makefiles\nmake\config.mak
+echo # config.mak generated with command line: >> build\Makefiles\nmake\config.mak
+echo # configure %1 %2 %3 %4 %5 %6 %7 %8 %9 >> build\Makefiles\nmake\config.mak
+echo # >> build\Makefiles\nmake\config.mak
+
+REM First parameter can only be help or compiler
+REM help option
+if "%1" == "-?" goto opt_help
+if "%1" == "-h" goto opt_help
+if "%1" == "/?" goto opt_help
+if "%1" == "/h" goto opt_help
+if "%1" == "--help" goto opt_help
+
+REM This is necessarily a compiler
+goto opt_comp
+
+REM
+REM option loop
+REM
+:loop
+
+REM platform option
+if "%1" == "-p" goto opt_plat
+if "%1" == "/p" goto opt_plat
+if "%1" == "--platform" goto opt_plat
+
+REM cross compiling
+if "%1" == "-x" goto opt_x
+if "%1" == "/x" goto opt_x
+if "%1" == "--cross" goto opt_x
+
+REM C runtime library
+if "%1" == "--with-static-rtl" goto opt_srtl
+if "%1" == "--with-dynamic-rtl" goto opt_drtl
+if "%1" == "--rtl-static" goto opt_srtl
+if "%1" == "--rtl-dynamic" goto opt_drtl
+
+REM boost support
+if "%1" == "--use-boost" goto opt_bst
+
+REM multithreading support
+if "%1" == "--not-thread-safe" goto opt_st
+if "%1" == "--without-thread" goto opt_st
+
+REM rtti support
+if "%1" == "--no-rtti" goto opt_rtti
+if "%1" == "--without-rtti" goto opt_rtti
+
+REM additional compiler options
+if "%1" == "--extra-cxxflag" goto opt_xtra
+
+REM library name customization
+if "%1" == "--lib-motif" goto opt_motf
+if "%1" == "--with-lib-motif" goto opt_motf
+
+REM build without STLport
+if "%1" == "--without-stlport" goto no_sport
+
+REM clean rule
+if "%1" == "--clean" goto opt_cln
+
+echo Unknown option: %1
+
+:cont_lp
+echo.
+shift
+
+REM no more options?
+if "%1xyz123" == "xyz123" goto end_loop
+
+goto loop
+
+
+REM **************************************************************************
+REM *
+REM * Help
+REM *
+REM **************************************************************************
+:opt_help
+echo The first parameter must be the compiler name, here are the available
+echo keywords:
+echo.
+echo msvc6 Microsoft Visual C++ 6.0
+echo msvc7 Microsoft Visual C++ .NET 2002
+echo msvc71 Microsoft Visual C++ .NET 2003
+echo msvc8 Microsoft Visual C++ 2005
+echo msvc9 Microsoft Visual C++ 2008
+echo icl Intel C++ Compiler
+echo evc3 Microsoft eMbedded Visual C++ 3 (*)
+echo evc4 Microsoft eMbedded Visual C++ .NET (*)
+echo evc8 Microsoft Visual C++ 2005 compiling for CE
+echo evc9 Microsoft Visual C++ 2008 compiling for CE
+echo.
+echo (*) For these compilers the target processor is determined automatically.
+echo You must run the WCE*.BAT file you wish to build STLport for before
+echo running configure.
+echo.
+echo Then the following options are available:
+echo.
+echo "-p <platform>" or "--platform <platform>"
+echo Build STLport for the specified platform. Not all existing platforms are
+echo available, only the ones that make a difference when building STLport are.
+echo The following keywords are available:
+echo win95 Windows 95 compatible
+echo win98 Windows 98 and up to Windows XP excluded
+echo winxp Windows XP or later (default)
+echo.
+echo "-x"
+echo Enables cross-compiling; the result is that all built files that are
+echo normally put under "bin" and "lib" get extra subfolders depending on
+echo the compiler name.
+echo.
+echo "--with-static-rtl"
+echo "--with-dynamic-rtl"
+echo Enables usage of static (libc.lib family) or dynamic (msvcrt.lib family)
+echo C/C++ runtime library when linking with STLport. If you want your appli/dll
+echo to link statically with STLport but using the dynamic C runtime use
+echo --with-dynamic-rtl; if you want to link dynamicaly with STLport but using the
+echo static C runtime use --with-static-rtl. See README.options for details.
+echo Don't forget to signal the link method when building your appli or dll, in
+echo stlport/stl/config/host.h set the following macro depending on the configure
+echo option:
+echo "--with-static-rtl -> _STLP_USE_DYNAMIC_LIB"
+echo "--with-dynamic-rtl -> _STLP_USE_STATIC_LIB"
+echo.
+echo "--use-boost <boost install path>"
+echo Request use of boost support (www.boost.org). For the moment only the boost
+echo type_traits library is used to get type information and to implement some
+echo specific workaround not directly implemented by STLport. To use the same
+echo support when using STLport for your application don't forget to define
+echo _STLP_USE_BOOST_SUPPORT in stlport/stl/config/user_config.h file.
+echo.
+echo "--without-thread"
+echo Per default STLport libraries are built in order to be usable in a multithreaded
+echo context. If you don't need this you can ask for a not thread safe version with
+echo this option.
+echo.
+echo "--without-rtti"
+echo Remove rtti (run time type information) support if available.
+echo.
+echo "--extra-cxxflag <additional compilation options>"
+echo Use this option to add any compilation flag to the build system. For instance
+echo it can be used to activate a specific processor optimization depending on your
+echo processor. For Visual C++ .Net 2003, to activate pentium 3 optim you will use:
+echo --extra-cxxflag /G7
+echo If you have several options use several --extra-cxxflag options. For instance
+echo to also force use of wchar_t as an intrinsic type:
+echo --extra-cxxflag /G7 --extra-cxxflag /Zc:wchar_t
+echo.
+echo "--with-lib-motif <motif>"
+echo Use this option to customize the generated library name. The motif will be used
+echo in the last place before version information, separated by an underscore, ex:
+echo stlportd_MOTIF.5.0.lib
+echo stlportstld_static_MOTIF.5.1.lib
+echo Do not forget to define _STLP_LIB_NAME_MOTIF macro in STLport configuration file
+echo to the same value if you want to keep the auto link feature supported by some
+echo compilers.
+echo.
+echo "--without-stlport"
+echo Option specially targetting build of the unit tests project without STLport. This
+echo is a good way to challenge the C++ Standard library implementation comming with
+echo your compiler with STLport.
+echo.
+echo "--clean"
+echo Removes the build configuration file.
+goto skp_comp
+
+REM **************************************************************************
+REM *
+REM * Compiler configuration
+REM *
+REM **************************************************************************
+:opt_comp
+
+if "%1" == "msvc6" goto oc_msvc6
+if "%1" == "msvc71" goto oc_msv71
+if "%1" == "msvc7" goto oc_msvc7
+if "%1" == "msvc8" goto oc_msvc8
+if "%1" == "msvc9" goto oc_msvc9
+if "%1" == "icl" goto oc_icl
+
+if "%1" == "evc3" goto oc_evc3
+if "%1" == "evc4" goto oc_evc4
+if "%1" == "evc8" goto oc_evc8
+if "%1" == "evc9" goto oc_evc9
+
+if "%1" == "watcom" goto oc_wtm
+
+echo Unknown compiler: %1
+goto oc_end
+
+:oc_msvc6
+:oc_wtm
+echo Setting compiler: Microsoft Visual C++ 6.0
+echo COMPILER_NAME=vc6 >> build\Makefiles\nmake\config.mak
+set SELECTED_COMPILER_VERSION=60
+goto oc_msvc
+
+:oc_msvc7
+echo Setting compiler: Microsoft Visual C++ .NET 2002
+echo COMPILER_NAME=vc70 >> build\Makefiles\nmake\config.mak
+set SELECTED_COMPILER_VERSION=70
+goto oc_msvc
+
+:oc_msv71
+echo Setting compiler: Microsoft Visual C++ .NET 2003
+echo COMPILER_NAME=vc71 >> build\Makefiles\nmake\config.mak
+set SELECTED_COMPILER_VERSION=71
+goto oc_msvc
+
+:oc_msvc8
+echo Setting compiler: Microsoft Visual C++ 2005
+echo COMPILER_NAME=vc8 >> build\Makefiles\nmake\config.mak
+set SELECTED_COMPILER_VERSION=80
+goto oc_msvc
+
+:oc_msvc9
+echo Setting compiler: Microsoft Visual C++ 2008
+echo COMPILER_NAME=vc9 >> build\Makefiles\nmake\config.mak
+set SELECTED_COMPILER_VERSION=90
+goto oc_msvc
+
+:oc_msvc
+echo TARGET_OS=x86 >> build\Makefiles\nmake\config.mak
+set SELECTED_COMPILER=msvc
+echo !include msvc.mak > .\build\lib\Makefile
+echo !include msvc.mak > .\build\test\unit\Makefile
+echo !include msvc.mak > .\build\test\eh\Makefile
+goto oc_end
+
+:oc_icl
+echo Setting compiler: Intel C++ Compiler
+echo COMPILER_NAME=icl >> build\Makefiles\nmake\config.mak
+echo TARGET_OS=x86 >> build\Makefiles\nmake\config.mak
+set SELECTED_COMPILER=icl
+echo !include icl.mak > .\build\lib\Makefile
+echo !include icl.mak > .\build\test\unit\Makefile
+echo !include icl.mak > .\build\test\eh\Makefile
+goto oc_end
+
+:oc_evc3
+echo Setting compiler: Microsoft eMbedded Visual C++ 3
+echo COMPILER_NAME=evc3 >> build\Makefiles\nmake\config.mak
+rem TODO: branch on OSVERSION like below?
+echo CEVERSION=300 >> build\Makefiles\nmake\config.mak
+set SELECTED_COMPILER_VERSION=3
+goto oc_evc
+
+:oc_evc4
+echo Setting compiler: Microsoft eMbedded Visual C++ .NET
+echo COMPILER_NAME=evc4 >> build\Makefiles\nmake\config.mak
+if "%OSVERSION%"=="" (
+ echo OSVERSION not set, assuming target is CE 4.2
+ echo CEVERSION=420 >> build\Makefiles\nmake\config.mak
+) else if "%OSVERSION%"=="WCE400" (
+ echo CEVERSION=400 >> build\Makefiles\nmake\config.mak
+) else if "%OSVERSION%"=="WCE420" (
+ echo CEVERSION=420 >> build\Makefiles\nmake\config.mak
+) else if "%OSVERSION%"=="WCE500" (
+ echo CEVERSION=500 >> build\Makefiles\nmake\config.mak
+) else (
+ echo Unknown value for OSVERSION.
+ exit /b 1
+)
+set SELECTED_COMPILER_VERSION=4
+goto oc_evc
+
+:oc_evc8
+echo Setting compiler: Microsoft Visual C++ .NET 2005 for Windows CE
+echo COMPILER_NAME=evc8 >> build\Makefiles\nmake\config.mak
+set SELECTED_COMPILER_VERSION=80
+if "%OSVERSION%"=="" (
+ echo OSVERSION not set, assuming target is CE 5.0
+ echo CEVERSION=500 >> build\Makefiles\nmake\config.mak
+) else if "%OSVERSION%"=="WCE400" (
+ echo CEVERSION=400 >> build\Makefiles\nmake\config.mak
+) else if "%OSVERSION%"=="WCE420" (
+ echo CEVERSION=420 >> build\Makefiles\nmake\config.mak
+) else if "%OSVERSION%"=="WCE500" (
+ echo CEVERSION=500 >> build\Makefiles\nmake\config.mak
+) else (
+ echo Unknown value for OSVERSION.
+ exit /b 1
+)
+set PLATFORM_SPECIFIED=1
+set SELECTED_COMPILER=msvc
+echo !include evc.mak > .\build\lib\Makefile
+echo !include evc.mak > .\build\test\unit\Makefile
+echo !include evc.mak > .\build\test\eh\Makefile
+goto proc
+
+:oc_evc9
+echo Setting compiler: Microsoft Visual C++ .NET 2008 for Windows CE
+echo COMPILER_NAME=evc9 >> build\Makefiles\nmake\config.mak
+set SELECTED_COMPILER_VERSION=90
+if "%OSVERSION%"=="" (
+ echo OSVERSION not set, assuming target is CE 5.0
+ echo CEVERSION=500 >> build\Makefiles\nmake\config.mak
+) else if "%OSVERSION%"=="WCE400" (
+ echo CEVERSION=400 >> build\Makefiles\nmake\config.mak
+) else if "%OSVERSION%"=="WCE420" (
+ echo CEVERSION=420 >> build\Makefiles\nmake\config.mak
+) else if "%OSVERSION%"=="WCE500" (
+ echo CEVERSION=500 >> build\Makefiles\nmake\config.mak
+) else (
+ echo Unknown value for OSVERSION.
+ exit /b 1
+)
+set PLATFORM_SPECIFIED=1
+set SELECTED_COMPILER=msvc
+echo !include evc.mak > .\build\lib\Makefile
+echo !include evc.mak > .\build\test\unit\Makefile
+echo !include evc.mak > .\build\test\eh\Makefile
+goto proc
+
+:oc_evc
+set PLATFORM_SPECIFIED=1
+set SELECTED_COMPILER=evc
+echo !include evc.mak > .\build\lib\Makefile
+echo !include evc.mak > .\build\test\unit\Makefile
+echo !include evc.mak > .\build\test\eh\Makefile
+goto proc
+
+:oc_end
+goto cont_lp
+
+
+REM **************************************************************************
+REM *
+REM * Target processor configuration (automatic)
+REM *
+REM **************************************************************************
+:proc
+
+if "%TARGETCPU%" == "ARM" goto pr_arm
+if "%TARGETCPU%" == "ARMV4" goto pr_arm
+if "%TARGETCPU%" == "ARMV4I" goto pr_arm
+if "%TARGETCPU%" == "ARMV4T" goto pr_arm
+
+if "%TARGETCPU%" == "X86" goto pr_x86
+REM Type from evc3 and/or PocketPC 2002 SDK reported here
+REM to correctly check the platform:
+if "%TARGETCPU%" == "X86EMnset CFG=none" goto pr_emul
+if "%TARGETCPU%" == "x86" goto pr_x86
+if "%TARGETCPU%" == "emulator" goto pr_emul
+
+if "%TARGETCPU%" == "R4100" goto pr_mips
+if "%TARGETCPU%" == "R4111" goto pr_mips
+if "%TARGETCPU%" == "R4300" goto pr_mips
+if "%TARGETCPU%" == "MIPS16" goto pr_mips
+if "%TARGETCPU%" == "MIPSII" goto pr_mips
+if "%TARGETCPU%" == "MIPSII_FP" goto pr_mips
+if "%TARGETCPU%" == "MIPSIV" goto pr_mips
+if "%TARGETCPU%" == "MIPSIV_FP" goto pr_mips
+
+if "%TARGETCPU%" == "SH3" goto pr_sh3
+if "%TARGETCPU%" == "SH4" goto pr_sh4
+
+:pr_err
+echo Unknown target CPU: %TARGETCPU%
+goto pr_end
+
+:pr_arm
+echo Target processor: ARM
+echo TARGET_PROC=arm >> build\Makefiles\nmake\config.mak
+echo TARGET_PROC_SUBTYPE=%TARGETCPU% >> build\Makefiles\nmake\config.mak
+goto pr_end
+
+:pr_x86
+echo Target processor: x86
+echo TARGET_PROC=x86 >> build\Makefiles\nmake\config.mak
+goto pr_end
+
+:pr_emul
+echo Target processor: Emulator
+echo TARGET_PROC=x86 >> build\Makefiles\nmake\config.mak
+echo TARGET_PROC_SUBTYPE=emulator >> build\Makefiles\nmake\config.mak
+goto pr_end
+
+:pr_mips
+echo Target processor: MIPS
+echo TARGET_PROC=mips >> build\Makefiles\nmake\config.mak
+echo TARGET_PROC_SUBTYPE=%TARGETCPU% >> build\Makefiles\nmake\config.mak
+
+goto pr_end
+
+:pr_sh3
+echo Target processor: %TARGETCPU%
+echo TARGET_PROC=sh3 >> build\Makefiles\nmake\config.mak
+goto pr_end
+
+:pr_sh4
+echo Target processor: %TARGETCPU%
+echo TARGET_PROC=sh4 >> build\Makefiles\nmake\config.mak
+goto pr_end
+
+:pr_end
+goto oc_end
+
+
+REM **************************************************************************
+REM *
+REM * Platform configuration
+REM *
+REM **************************************************************************
+:opt_plat
+
+if "%2" == "win95" goto op_win95
+if "%2" == "win98" goto op_win98
+if "%2" == "winxp" goto op_winxp
+
+echo Unknown platform: %2
+goto op_end
+
+:op_win95
+echo Setting platform: Windows 95
+echo WINVER=0x0400 >> build\Makefiles\nmake\config.mak
+set PLATFORM_SPECIFIED=1
+goto op_end
+
+:op_win98
+echo Setting platform: Windows 98
+echo WINVER=0x0410 >> build\Makefiles\nmake\config.mak
+set PLATFORM_SPECIFIED=1
+goto op_end
+
+:op_winxp
+echo Setting platform: Windows XP
+echo WINVER=0x0501 >> build\Makefiles\nmake\config.mak
+set PLATFORM_SPECIFIED=1
+goto op_end
+
+:op_end
+shift
+
+goto cont_lp
+
+
+REM **************************************************************************
+REM *
+REM * Cross Compiling option
+REM *
+REM **************************************************************************
+
+:opt_x
+echo Setting up for cross compiling.
+echo CROSS_COMPILING=1 >> build\Makefiles\nmake\config.mak
+goto cont_lp
+
+
+REM **************************************************************************
+REM *
+REM * C runtime library selection
+REM *
+REM **************************************************************************
+
+:opt_srtl
+if "%SELECTED_COMPILER%" == "msvc" goto or_sok
+goto or_err
+
+:opt_drtl
+if "%SELECTED_COMPILER%" == "msvc" goto or_dok
+goto or_err
+
+:or_err
+echo Error: Setting C runtime library for compiler other than microsoft ones!
+goto or_end
+
+:or_sok
+echo Selecting static C runtime library for STLport
+echo WITH_STATIC_RTL=1 >> build\Makefiles\nmake\config.mak
+goto or_end
+
+:or_dok
+echo Selecting dynamic C runtime library for STLport
+echo WITH_DYNAMIC_RTL=1 >> build\Makefiles\nmake\config.mak
+goto or_end
+
+:or_end
+goto cont_lp
+
+REM **************************************************************************
+REM *
+REM * boost support
+REM *
+REM **************************************************************************
+:opt_bst
+REM if (Exists("%2")) goto ob_ok
+REM if !("%2" == "") goto ob_ok
+goto ob_ok
+
+echo Error: Invalid boost intallation folder ("%2").
+goto ob_end
+
+:ob_ok
+echo Activating boost support using "%2" path
+echo STLP_BUILD_BOOST_PATH="%2" >> build\Makefiles\nmake\config.mak
+
+:ob_end
+shift
+
+goto cont_lp
+
+REM **************************************************************************
+REM *
+REM * Multithreading support
+REM *
+REM **************************************************************************
+:opt_st
+echo Removing thread safety support
+echo WITHOUT_THREAD=1 >> build\Makefiles\nmake\config.mak
+goto cont_lp
+
+REM **************************************************************************
+REM *
+REM * rtti support
+REM *
+REM **************************************************************************
+:opt_rtti
+echo Removing rtti support
+echo WITHOUT_RTTI=1 >> build\Makefiles\nmake\config.mak
+goto cont_lp
+
+REM **************************************************************************
+REM *
+REM * Extra compilation flags
+REM *
+REM **************************************************************************
+:opt_xtra
+echo Adding '%2' compilation option
+if "%ONE_OPTION_ADDED%" == "1" goto ox_n
+
+echo DEFS = %2 >> build\Makefiles\nmake\config.mak
+set ONE_OPTION_ADDED=1
+goto ox_end
+
+:ox_n
+echo DEFS = $(DEFS) %2 >> build\Makefiles\nmake\config.mak
+
+:ox_end
+shift
+goto cont_lp
+
+REM **************************************************************************
+REM *
+REM * Library name configuration
+REM *
+REM **************************************************************************
+:opt_motf
+echo Using '%2' in generated library names
+
+echo LIB_MOTIF = %2 >> build\Makefiles\nmake\config.mak
+
+shift
+goto cont_lp
+
+REM **************************************************************************
+REM *
+REM * Build without STLport
+REM *
+REM **************************************************************************
+:no_sport
+echo Configured to build without STLport
+
+echo WITHOUT_STLPORT=1 >> build\Makefiles\nmake\config.mak
+
+shift
+goto cont_lp
+
+REM **************************************************************************
+REM *
+REM * Clean
+REM *
+REM **************************************************************************
+:opt_cln
+del build\Makefiles\nmake\config.mak
+echo STLport configuration file removed.
+goto skp_comp
+
+REM **************************************************************************
+REM *
+REM * End loop
+REM *
+REM **************************************************************************
+
+:end_loop
+
+if "%PLATFORM_SPECIFIED%" == "1" goto comp
+echo Setting platform: Windows XP
+echo.
+echo WINVER=0x0501 >> build\Makefiles\nmake\config.mak
+
+:comp
+echo Done configuring STLport.
+echo.
+echo Go to build/lib folder and type "nmake clean install" to build and
+echo install STLport to the "lib" and "bin" folders.
+echo Go to build/test/unit folder and type nmake clean install to
+echo build unit tests and install them in bin folder.
+echo.
+
+:skp_comp
+set SELECTED_COMPILER=
+set SELECTED_COMPILER_VERSION=
+set ONE_OPTION_ADDED=
+set PLATFORM_SPECIFIED=
diff --git a/csetjmp b/csetjmp
deleted file mode 100644
index 068d0b3..0000000
--- a/csetjmp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CSETJMP
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x111
-# define _STLP_CSETJMP
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x111)
-# include _STLP_NATIVE_CPP_C_HEADER(csetjmp)
-#else
-# ifndef _STLP_INTERNAL_CSETJMP
-# include <stl/_csetjmp.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x111 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CSETJMP */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/csignal b/csignal
deleted file mode 100644
index 9142648..0000000
--- a/csignal
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CSIGNAL
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x112
-# define _STLP_CSIGNAL
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x112)
-# include _STLP_NATIVE_CPP_C_HEADER(csignal)
-#else
-# ifndef _STLP_INTERNAL_CSIGNAL
-# include <stl/_csignal.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x112 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CSIGNAL */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/cstdarg b/cstdarg
deleted file mode 100644
index 20141ec..0000000
--- a/cstdarg
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-#ifndef _STLP_CSTDARG
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x113
-# define _STLP_CSTDARG
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x113)
-# include _STLP_NATIVE_CPP_C_HEADER(cstdarg)
-#else
-# ifndef _STLP_INTERNAL_CSTDARG
-# include <stl/_cstdarg.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x113 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CSTDARG */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/cstddef b/cstddef
deleted file mode 100644
index 24d1527..0000000
--- a/cstddef
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CSTDDEF
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x114
-# define _STLP_CSTDDEF
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x114)
-# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
-#else
-# ifndef _STLP_INTERNAL_CSTDDEF
-# include <stl/_cstddef.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x114 )
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CSTDDEF */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/cstdio b/cstdio
deleted file mode 100644
index 83eff86..0000000
--- a/cstdio
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CSTDIO
-#define _STLP_CSTDIO
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x15
-# define _STLP_CSTDIO
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x15)
-# include _STLP_NATIVE_CPP_C_HEADER(cstdio)
-#else
-# ifndef _STLP_INTERNAL_CSTDIO
-# include <stl/_cstdio.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x15)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/cstdlib b/cstdlib
deleted file mode 100644
index 4718fbb..0000000
--- a/cstdlib
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CSTDLIB
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x116
-# define _STLP_CSTDLIB
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x116)
-# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
-#else
-# ifndef _STLP_INTERNAL_CSTDLIB
-# include <stl/_cstdlib.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x116)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CSTDLIB */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/cstring b/cstring
deleted file mode 100644
index 34d3bdb..0000000
--- a/cstring
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CSTRING
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x117
-# define _STLP_CSTRING
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x117)
-# include _STLP_NATIVE_CPP_C_HEADER(cstring)
-#else
-# ifndef _STLP_INTERNAL_CSTRING
-# include <stl/_cstring.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x117)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CSTRING */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/ctime b/ctime
deleted file mode 100644
index 0f9c37b..0000000
--- a/ctime
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-#ifndef _STLP_CTIME
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x118
-# define _STLP_CTIME
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x118)
-# include _STLP_NATIVE_CPP_C_HEADER(ctime)
-#else
-# ifndef _STLP_INTERNAL_CTIME
-# include <stl/_ctime.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x118)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CTIME */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/ctype.h b/ctype.h
deleted file mode 100644
index a3a8032..0000000
--- a/ctype.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CTYPE_H
-
-/* Workaround for a "misbehaviour" when compiling resource scripts using
- * eMbedded Visual C++. The standard .rc file includes windows header files,
- * which in turn include ctype.h, which results in warnings and errors
- */
-#if !defined(RC_INVOKED)
-
-# if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x219
-# include <stl/_prolog.h>
-# elif (_STLP_OUTERMOST_HEADER_ID == 0x219)
-# define _STLP_DONT_POP_HEADER_ID
-# define _STLP_CTYPE_H
-# endif
-
-# if defined(_STLP_WCE_EVC3)
-struct _exception;
-# endif
-
-# include _STLP_NATIVE_C_HEADER(ctype.h)
-
-/* on evc4 including ctype.h also defines setjmp macro */
-# if defined (_STLP_WCE)
-# define _STLP_NATIVE_SETJMP_H_INCLUDED
-# endif
-
-# ifndef _STLP_CTYPE_H_SEEN
-# define _STLP_CTYPE_H_SEEN
-
-/* Undef convenience interfaces */
-# undef isspace
-# undef isprint
-# undef iscntrl
-# undef isupper
-# undef islower
-# undef isalpha
-# undef isdigit
-# undef ispunct
-# undef isxdigit
-# undef isalnum
-# undef isgraph
-# undef toupper
-# undef tolower
-
-# if defined (UNDER_CE)
-
-# if (_WIN32_WCE < 300) /* Only wide chars for older versions */
-# define _isctype iswctype
-# endif
-
-__inline int (isalpha)(int c) { return _isctype(c, _ALPHA); }
-__inline int (isupper)(int c) { return _isctype(c, _UPPER); }
-__inline int (islower)(int c) { return _isctype(c, _LOWER); }
-__inline int (isdigit)(int c) { return _isctype(c, _DIGIT); }
-__inline int (isxdigit)(int c) { return _isctype(c, _HEX); }
-__inline int (isspace)(int c) { return _isctype(c, _SPACE); }
-__inline int (ispunct)(int c) { return _isctype(c, _PUNCT); }
-__inline int (isalnum)(int c) { return _isctype(c, _ALPHA|_DIGIT); }
-__inline int (isprint)(int c) { return _isctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); }
-__inline int (isgraph)(int c) { return _isctype(c, _PUNCT|_ALPHA|_DIGIT); }
-__inline int (iscntrl)(int c) { return _isctype(c, _CONTROL); }
-__inline int (isascii)(int c) { return ((unsigned)(c) < 0x80); }
-
-# undef _isctype
-
-__inline int (iswalpha)(int c) { return iswctype(c, _ALPHA); }
-__inline int (iswupper)(int c) { return iswctype(c, _UPPER); }
-__inline int (iswlower)(int c) { return iswctype(c, _LOWER); }
-__inline int (iswdigit)(int c) { return iswctype(c, _DIGIT); }
-__inline int (iswxdigit)(int c) { return iswctype(c, _HEX); }
-__inline int (iswspace)(int c) { return iswctype(c, _SPACE); }
-__inline int (iswpunct)(int c) { return iswctype(c, _PUNCT); }
-__inline int (iswalnum)(int c) { return iswctype(c, _ALPHA|_DIGIT); }
-__inline int (iswprint)(int c) { return iswctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); }
-__inline int (iswgraph)(int c) { return iswctype(c, _PUNCT|_ALPHA|_DIGIT); }
-__inline int (iswcntrl)(int c) { return iswctype(c, _CONTROL); }
-__inline int (iswascii)(int c) { return ((unsigned)(c) < 0x80); }
-
-# endif /* UNDER_CE */
-
-# endif /* _STLP_CTYPE_H_SEEN */
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x219)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-# endif
-
-#endif /* RC_INVOKED */
-
-#endif /* _STLP_CTYPE_H */
diff --git a/cwchar b/cwchar
deleted file mode 100644
index 85b99f8..0000000
--- a/cwchar
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CWCHAR
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x120
-# define _STLP_CWCHAR
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x120)
-# include _STLP_NATIVE_CPP_C_HEADER(cwchar)
-#else
-# ifndef _STLP_INTERNAL_CWCHAR
-# include <stl/_cwchar.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x120)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CWCHAR */
-
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/cwctype b/cwctype
deleted file mode 100644
index 29f0859..0000000
--- a/cwctype
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CWCTYPE
-#define _STLP_CWCTYPE
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x121
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x121)
-# include _STLP_NATIVE_CPP_C_HEADER(cwctype)
-#else
-# ifndef _STLP_INTERNAL_CWCTYPE
-# include <stl/_cwctype.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x121)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_CWCTYPE */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/deque b/deque
deleted file mode 100644
index 8fdf513..0000000
--- a/deque
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_DEQUE
-#define _STLP_DEQUE
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x22
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#ifndef _STLP_INTERNAL_DEQUE_H
-# include <stl/_deque.h>
-#endif
-
-#if defined (_STLP_IMPORT_VENDOR_STD)
-# include _STLP_NATIVE_HEADER(deque)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x22)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_DEQUE */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/doc/FAQ b/doc/FAQ
new file mode 100644
index 0000000..5dfe072
--- /dev/null
+++ b/doc/FAQ
@@ -0,0 +1,554 @@
+ Content
+
+Q1 About STLport and availability
+
+Q1.0 What is STLport?
+Q1.1 What are the benefits from using STLport?
+Q1.2 What versions of STLport are available?
+Q1.3 Where is the documentation or user guide?
+Q1.4 What is the version policy?
+
+Q2 General
+
+Q2.0 Do I need a C++ compiler?
+Q2.1 Do I need runtime libraries from C++ compiler?
+Q2.2 Can I use containers and algorithms from STLport and iostreams from
+library that ship with my compiler?
+Q2.3 Can I mix STL implementations in my project?
+Q2.4 When I switch to STLport in my application, I get errors. Is STLport
+so bad?
+
+Q3 Building
+
+Q3.0 On my XXXX Linux n.n g++ headers are in /usr/include/g++, but they
+are looked for in /usr/include/3.3.1. Is it a STLport bug?
+Q3.1 Do I need to build library to use STLport?
+Q3.2 During library compilation with MS VC++ 6.0 I see following error report:...
+Q3.3 Has anybody succeeded building STLport on OS Y with compiler K n.n?
+Q3.4 Does STLport support cross-compilation?
+
+Q4 Installation
+
+Q4.1 I tried "make -f gcc.mak install", but it install nothing into
+/usr/local/. How I can install headers into /usr/local/include and
+libs into /usr/local/lib?
+
+Q5 Bug report
+
+Q5.0 I found a bug, how can I report about it?
+
+Q6 Design
+
+Q6.0 In STLport, files like locale.h, setjmp.h, stdlib.h, etc.,
+do nothing except include native headers. Why are these files present in STLport?
+Q6.1 Is STLport a replacement for headers and libraries that shipout
+with compiler?
+Q6.2 My tool detects memory leaks in applications with STLport. Is this leak
+from STLport?
+Q6.3 When running unit tests, I have errors in LocaleTest test fixture, how bad
+is it?
+Q6.4 set or multiset iterators are immutable like const_iterators, why ?
+
+ Answers
+
+========================================================================
+
+Q1.0 What is STLport?
+A1.0 STLport is an implementation of the C++ Standard Library, as described
+in the INTERNATIONAL STANDARD ISO/IEC 14882:1998(E) and latest
+ISO/IEC 14882:2003(E).
+
+========================================================================
+
+Q1.1 What are the benefits from using STLport?
+
+A1.1
+ - For multiplatform/multicompilers project a coherent Standard Library
+implementation.
+ - An easy to use STL safe mode detecting bad use of containers and
+iterators.
+ - Some original optimizations: template expression for string
+concatenation, short string optimization, move semantic for STL containers
+combination like vector of vector, an efficient std::allocator.
+
+========================================================================
+
+Q1.2 What versions of STLport are available?
+
+A1.2
+
+========================================================================
+
+Q1.3 Where is the user guide?
+
+A1.3 There is no real user guide for the moment. You can find some information
+in README files in doc folder. As STLport is a C++ Standard library
+implementation you might find information you need at the following
+locations:
+ - The ISO/IEC 14882:2003 document you can buy for a very cheap price.
+ - For STL containers you can use SGI documentation (http://www.sgi.com/tech/stl/).
+ Beware however, STL described in this document is not identical to the
+ Standardized version described in ISO/IEC. This documentation can be very
+ useful for STLport extensions like hash containers (hash_map, hash_set...)
+ - You can also use the documentation coming with your compiler as most
+ of the information will also apply to STLport. Take care to description
+ reported as 'implementation specific'.
+
+========================================================================
+
+Q1.4 What is the version policy?
+
+A1.4 STLport version information contains three numbers like '5.1.0'. '5'
+is the major version number, '1' is the minor and '0' is the patch level.
+Policy for this numbers are:
+ - changes in major version number: radical modification, new era.
+ - changes in minor version number: significant changes, new features,
+ changes in interface part; switching to an STLport library with a different
+ minor version require recompilation of all modules depending on it.
+ - changes in patch level: bugfixes; we keep in mind binary compatibility,
+ but really can't strongly guarantee it; switching to an STLport library
+ with different patch level do not require rebuild of modules---rebuilding and
+ installing the STLport libraries should work; however, as STLport contains
+ a lot of template code, you should pay attention to fact that all you modules
+ was build with SAME STLport headers---otherwise problems possible;
+ recompilation of one part with only rebuilding STLport might not be enough
+ to get all the fixes in your application so even in this case rebuilding
+ your modules is advised.
+
+========================================================================
+
+
+Q2.0 Do I need a C++ compiler?
+
+A2.0 STLport is a C++ library. So the answer is 'yes, you do'.
+
+========================================================================
+
+Q2.1 Do I need runtime libraries from C++ compiler?
+
+A2.1 In any case, the C++ language support from compiler is required
+for STLport (operators new, delete, RTTI, exceptions support). That's why
+in most cases you need some runtime libraries from the C++ compiler.
+
+========================================================================
+
+Q2.2 Can I use containers and algorithms from STLport and iostreams from
+the library that ships with my compiler?
+
+A2.2 The short answer is 'No'.
+
+Indeed co-existence of two implementations possible, but this required
+a lot of knowledge as about both implementations, as about compiler and
+linkage. This issues should be taken into account both within STL library and
+during library usage. In common you can't use both implementation
+in the same namespace. So you should separate STL implementations into
+different namespaces. But due to absent of compilers that has full-featured
+support of Argument Dependent Lookup (ADL) (aka Koenig Lookup), you have no
+possibilty to select one or another implementation.
+
+ADL problem.
+
+In wrapper mode, all std references are replaced, thanks a simple macro,
+by the stlp_std namespace. Everything from the native compiler std namespace
+is injected to the stlp_std namespace with many using std::* directives.
+
+The problem arise when you specialized a standard class for one of your
+user types. You do it within the std namespace that, in wrapper mode
+becomes the stlp_std namespace. Then this specialization is just invisible
+from the native std namespace and won't be used.
+
+Things are somewhat worse: the problem arises even without any explicit
+specializations. It is not a bug, but the fact that old compilers just
+did not tried to find functions in the namespaces where arguments' classes
+are defined (indeed no compilers with full-featured support of ADL yet).
+
+Mix implementation via library.
+
+Let's reduce all the complexity of STLport to some very simple example:
+
+namespace std {
+
+class string
+{
+ public:
+ class iterator { };
+
+ iterator begin();
+ iterator end();
+};
+
+template<class I, class T>
+void find(I begin, I end, T value);
+
+} // namespace std
+
+
+namespace stlport {
+
+using std::string;
+
+template<class I, class T>
+void find(I begin, I end, T value);
+
+void gee()
+{
+ string s;
+ find(s.begin(), s.end(), 10);
+}
+
+} // namespace stlport
+
+
+When a compiler supporting ADL finds the call to `find' within gee() function
+it should examine both namespace `stlport' and namespace `std' for
+the presence of `find'. It is caused by the fact that s.begin() returns
+object of type `std::string::iterator' which obviously defined in namespace
+`std' and the heart of ADL is finding functions not only within namespaces
+where the call is being made but also in the namespaces where the classes
+of arguments are defined...
+
+So, in our example compiler ends with two templates satisfying the call
+`find(s.begin(), s.end(), 10)': `std::find' and `stlport::find'.
+Since compiler can not choose any one of them it reports ambiguity.
+
+There is another aspect of mix implementations.
+Let's consider following code:
+
+a.h:
+
+#include <string>
+
+class A {
+ public:
+ A() {}
+
+ void push( const string s );
+
+ string _str;
+};
+
+a.cpp:
+
+#include "a.h"
+
+void A::push( const string s )
+{
+ _str = s;
+}
+
+
+b.cpp:
+
+#include "a.h"
+
+string s;
+A a;
+
+void gee()
+{
+ a.push( s );
+}
+
+Now build library from a.cpp with string implementation Impl1;
+then build application with b.cpp that use string implementation Impl2,
+and link with mentioned above library. Compiler will pass. Linker may
+pass too. But your application will crash (or randomly crash) either on
+call a.push, or on assignment _str = s. This is evident here, but not
+evident in real applications.
+
+The conclusion is: "Using Wrapper mode is very hard and we removed support
+for it".
+
+========================================================================
+
+Q2.3 Can I mix STL implementations in my project?
+
+A2.3 Yes you can but each implementations will rely in its own namespace
+with no direct interaction between them. You will first need to correctly
+configure STLport thanks to 2 macros in user_config.h file.
+- _STLP_DONT_REDEFINE_STD tells STLport not to define the std macro that is
+used to replace std reference in your code with STLport namespace.
+- _STLP_WHOLE_NATIVE_STD tells STLport to always include native header each
+time a Standard header is included in your code.
+
+Here is a small code sample that do not require any modification in STLport
+install:
+
+#define _STLP_DONT_REDEFINE_STD
+#define _STLP_WHOLE_NATIVE_STD
+
+#include <string>
+
+void foo()
+{
+ std::string std_str("std");
+ stlport::string stlport_str("stlport");
+ stlport_str.append(std_str.begin(), std_str.end());
+ // Following is wrong because there is no assignment
+ // operator for stlport::string on std::string.
+ //std_str = stlport_str;
+}
+
+Note: You can use 'std' iterators from native implementation in STLport
+template methods like in the 'stlport_str.append' method call above because
+STLport is adding the necessary code to interpret native iterators like
+STLport iterators. You won't be able however to do the opposite as native
+implementation do not know anything about STLport iterators.
+
+
+========================================================================
+
+Q2.4 When I switch to STLport in my application, I get errors. Is STLport
+so bad?
+
+A2.4 Before you post such message, please, check STLport WHITHOUT YOUR code:
+ - build STLport library
+ - build STLport unit tests
+ - run STLport unit tests
+If any of above steps fail, please, make sure that you carefully followed
+build instructions (in most cases you definitely should reread
+instructions and check that you correctly unpack archive in case you see
+'file not found' message). Build instructions you can found in files
+INSTALL, doc/README.*, build/README*, build/test/unit/README*.
+If you are sure, submit bug report here:
+https://sourceforge.net/projects/stlport
+Don't forget to describe your operational environment, compiler version and
+STLport version.
+
+========================================================================
+
+Q3.0 On my XXXX Linux n.n g++ headers are in /usr/include/g++, but they
+are looked for in /usr/include/3.3.1. Is it a STLport bug?
+
+A3.0 Path to native compiler headers for GCC correspond to default path
+after build/install compiler (i.e. paths from compiler origo).
+Package maintainers can use any path by own taste---we can't satisfy
+variety of distributions/packages.
+
+So you can:
+ - fix path in stlport administration config file stlport/stl/config/host.h,
+ see _STLP_NATIVE_INCLUDE_PATH macro and related.
+ - create a link to the native compiler headers like expected by STLport
+ - make request to package maintainer
+ - build and install compiler
+
+Note: Starting with version 5.2, STLport uses the include_next preprocessing
+command to access native headers so you shouldn't experiment this problem
+anymore when this feature is supported by your compiler preprocessor.
+
+========================================================================
+
+Q3.1 Do I need to build a library to use STLport?
+
+A3.1 You may omit usage (and, thus building) STLport library, but in this
+case you can't use iostreams, locale, complex.
+
+========================================================================
+
+Q3.2 During library compilation with MS VC++ 6.0 I see following error report:
+
+C:\Program Files\Microsoft SDK\Include\.\winbase.h(1123) : error C2733: second C linkage of overloaded function 'InterlockedIncrement' not allowed
+ C:\Program Files\Microsoft SDK\Include\.\winbase.h(1121) : see declaration of 'InterlockedIncrement'
+C:\Program Files\Microsoft SDK\Include\.\winbase.h(1130) : error C2733: second C linkage of overloaded function 'InterlockedDecrement' not allowed
+ C:\Program Files\Microsoft SDK\Include\.\winbase.h(1128) : see declaration of 'InterlockedDecrement'
+C:\Program Files\Microsoft SDK\Include\.\winbase.h(1138) : error C2733: second C linkage of overloaded function 'InterlockedExchange' not allowed
+ C:\Program Files\Microsoft SDK\Include\.\winbase.h(1135) : see declaration of 'InterlockedExchange'
+
+A3.2 You have a Platform SDK installed. Uncomment line
+#define _STLP_NEW_PLATFORM_SDK 1
+in the file stlport/stl/config/user_config.h. There is no way to detect SDK
+presence during preprocessor stage, which is why you have to make this
+change manually.
+
+========================================================================
+
+Q3.3 Has anybody succeeded building STLport on OS S with compiler K n.n?
+
+A3.3 See report about results of regression tests here: build/test/unit/STATUS.
+
+========================================================================
+
+Q3.4 Does STLport support cross-compilation?
+
+A3.4 In case of GCC, use something like following sequence:
+
+ (./configure --target=${CROSSTARGET}; cd build/lib; \
+ export PATH=${BASECROSS}/bin:${PATH}; make -f gcc.mak install-release-shared)
+
+where CROSSTARGET is GCC's cross prefix (something like 'i586-pc-linux-gnu',
+if C++ cross compiler named as 'i586-pc-linux-gnu-c++'), BASECROSS is base of
+cross-compiler's location (i.e. ${BASECROSS}/bin in case above is a location
+of 'i586-pc-linux-gnu-c++').
+
+In case of non-GCC crossecompilers, we need hands-made target system identification.
+The sample of such compiler (supported by STLport) is MetroWerks Codewarrior
+for Novell Netware (mwccnlm).
+
+========================================================================
+
+Q4.1 I tried "make -f gcc.mak install", but it installs nothing into
+/usr/local/. How I can install headers into /usr/local/include and
+libs into /usr/local/lib?
+
+A4.1 Installation in any system-wide place is issue of either 'package builder'
+or system administrator. He/she should be familiar with building package
+procedure and/or understand where headers and libraries should be situated.
+The place choice not issue of STLport.
+
+You can just use
+
+(cd ${STLPORT_SRC}/lib; tar cf - . ) | (cd ${TARGET_LIB_DIR}; tar xf - ); \
+ (cd ${STLPORT_SRC}; tar cf - stlport) | (cd ${TARGET_INCLUDE_DIR}; tar xf - )
+
+Sometimes we will think about 'make install', but not now.
+
+
+========================================================================
+
+Q5.0 I found a bug, how I can report about it?
+
+A5.0
+ 0. Ensure that this is really a bug (standard violation, incorrect
+ behaviour with correct usage).
+ 1. Ensure that bug is in STLport, not in your code (you can use _STLP_DEBUG
+ for that, see stlport/stl/config/user_config.h).
+ 2. Ensure that you correctly built STLport---build and run unit tests
+ (build/test/unit) first with default settings, then with your settings
+ (if you changed any).
+ 3. Write a short test that demonstrates the bug.
+ 4. Make sure that this test case is really new, i.e. not covered by unit
+ tests (test/unit/*).
+ 5. Compare your results with reported runs of unit tests (build/test/unit/STATUS).
+ 6. Write bug description and test here
+
+ https://sourceforge.net/projects/stlport
+
+ DON'T FORGET TO DESCRIBE:
+
+ - OPERATIONAL ENVIRONMENT
+ - COMPILER VERSION
+ - STLPORT VERSION
+ - RESULT OF UNIT TESTS
+
+ Keep in mind, that your bug MUST be reproduced by other people, so give
+ enough information (but compactly, give only essential information).
+
+========================================================================
+
+Q6.0 In STLport files like locale.h, setjmp.h, stdlib.h, etc., do
+nothing except include native headers. Why are these files present in STLport?
+
+A6.0 Sometimes native C headers are using C++ ones or are refering
+to the std namespace. That's why, if stddef was absent in STLport, then
+
+#include <string>
+#include <stddef.h>
+
+may cause problem in following code, because std redefined in the end of
+<string> header, and std may be used in stddef.h:
+
+__BEGIN_NAMESPACE_STD
+....
+__END_NAMESPACE_STD
+
+where __BEGIN_NAMESPACE_STD is defined as 'namespace std {'.
+To avoid this, STLport has stddef.h header and provide correct masquerade
+for std.
+
+========================================================================
+
+Q6.1 Is STLport a replacement for headers and libraries that shipout
+with compiler?
+
+A6.1 In general no. In any case C++ language support from compiler is required
+for STLport (operators new, delete, RTTI, exceptions support). STLport also
+uses 'native' headers and libraries to take interface to system functions and
+variables.
+
+========================================================================
+
+Q6.2 My tool detects memory leaks in application with STLport. Is this leak
+from STLport?
+
+A6.2 In most cases these are 'pseudo memory leaks' that some tools
+wrongly detect.
+
+In the default compile of STLport, the node allocator is used to allocate
+internal memory. The node allocator works by pre-allocating a large chunk of
+memory and handing out small memory blocks. The memory chunk is not freed
+during running an application that uses STLport (i.e. it is not returned to
+the system, but reused inside application).
+See also http://www.sgi.com/tech/stl/alloc.html
+
+There are tools like BoundsChecker, Purify or Valgrind that check for memory
+leaks, for memory that isn't freed when no longer used. These tools may report
+false memory leaks when one uses STLport's node allocator. The memory chunk is
+normally freed at application end, but the memory checkers usually report memory
+leaks before that point. Another memory problem might be reported when you use
+shared libraries (e.g. DLL, this problem specific for Windows DLL model) that
+uses STLport internally and are statically link to it. If memory is allocated in
+a dll and released in an other then the STLport node allocator will keep the
+released memory for a future use. If you do not use this memory then your
+application global memory consumption will grow until the app crash even if there
+is no real memory leak. This is why you should always use a coherent configuration
+everything in dll or everything in static lib.
+
+There are ways to remove the pseudo memory leaks (since the memory is properly
+freed at the end of the program, the leaks are just pseudo-ones). You could use
+another allocator that is used in STLport. Open the file
+"./stlport/stl/config/host.h" and uncomment either one of the following:
+
+
+ _STLP_USE_NEWALLOC enables a simple allocator that uses "new/delete"
+ _STLP_USE_MALLOC enables a simple allocator that uses "malloc/free"
+
+The new/delete allocator has the advantage of giving an entry point to track
+memory starvation, see set_new_handler in your compiler doc or the C++ Standard
+for more information.
+
+Alternatively you can define the following symbol, just uncomment it in
+"./stlport/stl/config/host.h".
+
+ _STLP_LEAKS_PEDANTIC
+
+The symbol forces freeing all memory chunks. Also see the comments around the
+symbol in the config file.
+
+Note that you have to recompile STLport AND your application and all of your
+dependent libraries if you make any change to the file!
+
+There are also some defines that help in debugging memory problems in STLport.
+In _STLP_DEBUG mode, just also define the following symbols, either in
+"./stlport/stl/config/user_config.h" or in your project settings:
+
+ _STLP_DEBUG_ALLOC
+ _STLP_DEBUG_UNINITIALIZED
+
+You don't need to rebuild STLport for these options, but you have to rebuild
+your application and all of your dependent libraries if you make any change to
+the file.
+
+========================================================================
+
+Q6.3 When running unit tests, I have errors in LocaleTest test fixture, how bad
+is it?
+
+A6.3 Failures in LocaleTest tests do not mean that your platform/compiler is not
+fully supported by STLport. Platform independant localization tests are very hard
+to write as Standard localization API has not been design to make unit test easy.
+In STLport unit tests suite we have hard coded some expected values. Those values
+depends on your OS configuration explaining why sometimes the tests are failing.
+
+========================================================================
+
+Q6.4 set or multiset iterators are immutable like const_iterators, why ?
+
+A6.4 With set or multiset associative containers or even newly introduced
+tr1::unordered_set and tr1::unordered_multiset key is confuse with data. It
+means that modifying the data is also modifying the key. Modifying the key
+might corrupt the container internal data structure so STLport prefer to
+make this problem obvious and only return a const access to the key with
+immutable iterators. Your solutions are:
+- prefer map/multimap and split the key and the data
+- use const_cast when you want to change a set/multiset element.
+
diff --git a/doc/README.borland b/doc/README.borland
new file mode 100644
index 0000000..50f16e5
--- /dev/null
+++ b/doc/README.borland
@@ -0,0 +1,154 @@
+
+==================================================
+STLport README for Borland C++ compilers.
+==================================================
+
+by: Francois Dumont, dums@stlport.com, last edited 20 May 2006
+
+============
+Introduction
+============
+This document describes how STLport can be compiled and used with
+Borland compilers.
+
+For any further comments or questions visit STLport mailing lists
+http://stlport.sourceforge.net/Maillists.shtml or forums
+https://sourceforge.net/forum/?group_id=146814
+
+=============
+Prerequisites
+=============
+To build and use STLport you will need following tools and libraries:
+ - Borland C++ compiler package 5.5.1 or higher version.
+
+ In order to build STLport the Borland compiler and linker have to
+ be correctly configurated too. That is to say:
+
+ * For the Borland compiler bcc32:
+
+ In Borland's 'bin' directory (same directory as bcc32.exe), create a
+ bcc32.cfg file containing the compiler option giving it the path to
+ native Borland headers:
+
+ -I%BORLAND_PATH%\BCC55\include
+
+ * For the resource compiler brcc32:
+
+ Create an environment variable INCLUDE containing path to native Borland
+ headers and especially the windows.h file
+
+ set INCLUDE=%BORLAND_PATH%\BCC55\include
+
+ * For the Borland linker ilink32:
+
+ You need to give path to both the Borland libs and Borland PSDK libs.
+ For that you have to create, in the same directory as ilink32.exe, a
+ configuration file, ilink32.cfg, that contains:
+
+ -L%BORLAND_PATH%\BCC55\lib;%BORLAND_PATH%\BCC55\lib\PSDK
+
+ - A GNU make tool. You can get one from www.mingw.org or www.cygwin.com.
+ See README.mingw or README.cygwin for additional informations.
+
+===================
+Configuring STLport
+===================
+ This is intended to be an optional step, if you want to use default
+configuration simply jump to next chapter 'Building STLport'. Open a console
+and go to the STLport build/lib folder. Run
+
+ configure --help
+
+ This command will present you the different available build options. Just follow
+the instructions to set STLport configuration according your needs. For example,
+to set the typical configuration for most Borland compilers, run
+
+ configure -c bcc
+
+================
+Building STLport
+================
+ This is a step by step description of the actions to take in order to build
+and install the STLport libraries:
+
+1. Open a console, you can use a Msys, Cygwin or Windows console.
+
+2. Go to the STLport build/lib folder:
+ cd C:\STLport\build\lib
+
+3. Run the following command:
+ make -fbcc.mak install
+
+ Where 'make' is the GNU make utility you have installed. The name of
+GNU make utility may differ, such as 'mingw32-make'. -f is a make option
+telling it which makefile to use. You have of course to choose the
+appropriate makefile for your compiler, 'bcc.mak' in our case.
+
+ Once the command returns you will have all the necessary import libraries
+in STLport's 'lib' folder and DLLs in STLport's 'bin' folder. For a
+description of the generated libraries check the FAQ file in the 'doc' folder.
+For a quick start guide to the STLport make system, see the README file in the
+'build/lib' folder.
+
+===============
+Testing STLport
+===============
+You can use the unit tests to verify STLport behaves correctly. Change into
+STLport's 'build/test/unit' folder and type:
+
+ make -fbcc.mak install
+
+This will build and install the unit tests with STLport dynamic libraries.
+Once the unit tests are built you just need to run them. They can be found
+in STLport's bin, bin-g or bin-stlg folders. To rebuild the unit tests
+with STLport static libraries, type:
+
+ make -fbcc.mak clean
+ make -fbcc.mak install-static
+
+=============
+Using STLport
+=============
+Adjust your include and link paths in Borland IDE or in the command line config
+files. In the include files add the path to STLport's 'stlport' folder. Make sure
+it is the first directory listed there. Add STLport's 'lib' folder for the library
+files (order of paths doesn't matter here).
+
+Now you should be ready to use STLport.
+
+============
+Known limitations
+============
+
+1. If you extend a locale facet based on a Standard facet definition you will
+have to grant your own facet id defition. Ex extracted from
+test/unit/fstream_test.cpp:
+
+#include <locale>
+
+using namespace std;
+
+struct my_state {
+ char dummy;
+};
+
+struct my_traits : public char_traits<char> {
+ typedef my_state state_type;
+ typedef fpos<state_type> pos_type;
+};
+
+class my_codecvt : public codecvt<char, char, my_state>
+{};
+
+// Mandatory locale facet id definition:
+template <>
+locale::id codecvt<char, char, my_state>::id;
+
+2. If you get a linker memory error, e.g. LME351, it probably means that full
+source debugging is enabled and Borland's .TDS file has exceeded the memory
+capacity of Borland's linker (ilink32.exe). To resolve this error, check
+Borland's website for the latest patch for ilink32.exe. In the alternative,
+disable full source debugging in build\Makefiles\gmake\bcc.mak by deleting
+the -v option in the OPT settings.
+
+3. For "'uname' is not recognized . . .", see "Configuring STLport" above.
diff --git a/doc/README.cygwin b/doc/README.cygwin
new file mode 100644
index 0000000..44ad449
--- /dev/null
+++ b/doc/README.cygwin
@@ -0,0 +1,43 @@
+The cygwin platform is used to build STLport with different compilers.
+
+- gcc (native compiler):
+
+ Makefile : gcc.mak
+
+ Notes:
+
+ 1. Static builds (archive)
+
+ If you use the static version of the STLport libraries you have
+ to define the _STLP_USE_STATIC_LIB macro in order to have your
+ executable linked correctly.
+
+ 2. Link
+
+ Under this platform STLport is complete replacement for libstdc++.
+ It means that when you were linking with libstdc++ (-lstdc++) you only
+ have to replace it with STLport (-lstlport.5.2 for instance). However
+ default gcc behavior is to automatically link libstdc++ and a number of
+ other system libs. To avoid this behavior you have to use the -nodefaultlibs
+ compiler option and explicitely give all libraries by yourself. See build of
+ unit tests to see what library you might need, here is the list when this
+ note was written:
+
+ without -mnocygwin option:
+
+ -lstlportg.5.2 -lgcc -lm -lc -lpthread -lkernel32
+
+ with -mno-cygwin option:
+
+ -lstlportg.5.2 -lgcc -lmingw32 -lmingwex -lmsvcrt -lm -lmoldname
+ -lcoldname -lkernel32
+
+ 3. No cygwin
+
+ To build STLport libraries that do not depend on cygwin1.dll
+ making them freely redistributable pass the following option to
+ the configure script:
+
+ ./configure --with-extra-cflags=-mno-cygwin --with-extra-cxxflags=-mno-cygwin
+
+- Borland C++ compiler
diff --git a/doc/README.dmc b/doc/README.dmc
new file mode 100644
index 0000000..ce6062f
--- /dev/null
+++ b/doc/README.dmc
@@ -0,0 +1,81 @@
+==================================================
+STLport README for Digital Mars C++ compilers.
+==================================================
+
+Build of STLport with Digital Mars C++ compiler is very similar
+to the one for Microsoft Visual Studio compiler (see README.msvc).
+
+Below are some additional hints. [DMC users are encouraged to
+contribute additional information.]
+
+=============
+Prerequisites
+=============
+
+ - Digital Mars C++ 8.49 or above
+
+ - A GNU environment with make tool. Prefer MinGW/MSys to Cygwin because the
+ latter contains a link command that is also the name of the Digital Mars linker
+ and you might experiment collision between both commands.
+ See README.mingw for additional information.
+
+===================
+Installing STLport
+===================
+
+ - STLport directory can be almost anywhere EXCEPT native dm\include directory.
+
+===================
+Configuring STLport
+===================
+
+ - In a console window go to the STLport build\lib folder. Run
+
+ configure -c dmc
+
+================
+Building STLport
+================
+
+ - To build STLport libraries:
+
+ cd [STLport dir]\build\lib
+ [mingw32-make] -f dmc.mak install
+
+ - To build STLport (dynamic) unit tests:
+
+ cd [STLport dir]\build\test\unit
+ [mingw32-make] -f dmc.mak install
+
+============
+Known issues
+============
+
+1. typeinfo.h
+
+ DMC forces inclusion of typeinfo.h header at the begining of any
+translation unit. This breaks the STLport include schema, especially
+when building the library. As a workaround STLport typeinfo.h simply
+include native DMC header not performing any internal STLport work as
+importing things to STLport namespace. As a result typeinfo.h should
+never be reference in user code, as it is neither a C nor a C++ header
+this is not considered as a major limitation. The C++ Standard header
+is typeinfo.
+
+2. link.exe and lib.exe
+
+ STLport makefiles for DMC use dm_link and dm_lib instead of link and lib to
+avoid conflicts with other vendors' linkers and archivers. To build STLport
+with DMC, please copy or rename the following files:
+
+ copy dm\bin\link.exe dm\bin\dm_link.exe
+ copy dm\bin\lib.exe dm\bin\dm_lib.exe
+
+3. Free online version.
+
+ If DMC's free online version reports compiler or linker errors, the
+solution may be in a free online CD update. Download and unzip all free
+CD patches for versions 8.30 and above, in consecutive order, overwriting
+previous files. Then install free online version 8.49 or above, overwriting
+previous files.
+
diff --git a/doc/README.evc3 b/doc/README.evc3
new file mode 100644
index 0000000..7d2cd2b
--- /dev/null
+++ b/doc/README.evc3
@@ -0,0 +1,157 @@
+
+========================================
+STLport README for eMbedded Visual C++ 3
+========================================
+
+by: Michael Fink, vividos@users.sourceforge.net, last edited 2005-11-15
+
+============
+Introduction
+============
+This document describes how STLport can be compiled and used with Microsoft
+eMbedded Visual C++ 3.
+
+For any further comments or questsion visit STLport mailing lists
+http://stlport.sourceforge.net/Maillists.shtml or forums
+https://sourceforge.net/forum/?group_id=146814
+
+
+=============
+Prerequisites
+=============
+To build and use STLport you will need following tools and libraries:
+ - eMbedded Visual C++ 3.0
+ - latest CVS version of STLport, use info from page
+ 'http://stlport.sourceforge.net/CVS.shtml' to get it.
+ Note that you may have to get a different branch, please check out the
+ STLport forum "Announcements" which sourcecode is being worked on.
+
+================
+Building STLport
+================
+Note: if you don't plan to use the iostreams part of STLport (via the define
+_STLP_NO_IOSTREAMS), you don't have to build the library. You can skip straight
+to the "Using STLport" section.
+
+If you want to compile for the Pocket PC 2002 SDK (which in most cases you want)
+be sure to set the PLATFORM environment variable to "Pocket PC 2002", e.g. with
+this command:
+
+ set PLATFORM=Pocket PC 2002
+
+Open a command line prompt and execute the batch file that sets up compiling
+for ARM or x86 processors. These files usually are in a folder like
+'C:\Program Files\Windows CE eMbedded Tools\EVC\WCE300\BIN\' and are called
+WCEARM.bat and WCEx86.bat. Check if the environment variables are set up
+properly after that call. You can also adjust the batch files to have the
+PLATFORM variable set automatically.
+
+Go into STLport's 'build\lib' folder and type:
+
+ configure.bat -c evc3
+
+The makefiles are configured with the given settings. Call configure.bat with
+the --help option to see all options. The program automatically tells you which
+command line to use. If you want to install the libraries, add the "install"
+target as follows:
+
+ nmake /fmsvc.mak install
+
+All libraries (debug, stldebug, release) are now built, static and shared
+ones. Import libraries (.lib files) are put in the 'lib\evc3-arm' folder, DLLs
+are put in the 'bin\evc3-arm' folder. If you use another target platform, the
+name of the folder is changed accordingly, e.g. evc3-x86 for emulator files.
+
+Once STLport is built you can decrease the size of the STLport folder by
+removing intermediate build files. This is done with the following command:
+
+ nmake /fmsvc.mak clobber
+
+Note: MIPS platform is also available for build, but it may not compile or work
+ properly. Use with caution!
+
+===============
+Testing STLport
+===============
+You can use the unit tests to verify STLport behaves correctly. Change into
+STLports 'build\test\unit' folder and type:
+
+ nmake /fmsvc.mak install
+
+If you want to build the unit tests for the emulator, you have to reconfigure
+STLport with the configure.bat, as described above.
+
+Once the unit tests are built, upload the binary (found in the 'bin\evc3-arm'
+folder) to your device or emulator and start it (the test runs for about 30
+seconds, depending on the speed of the device). The file 'stlp_test.txt' is
+created in the root folder of the device, which contains the unit test
+results. It should report no errors.
+
+=============
+Using STLport
+=============
+Adjust your include and link paths in eVC3 in 'Tools -> Options -> Directories'
+and add the paths for all platforms and CPUs on which you want to use STLport.
+In the include files add the path to STLport's 'stlport' folder. Make sure it
+is the first directory listed there. Add STLport's 'lib\evc3-arm' or
+'lib\evc3-x86' (depending on what target you use) folder for the library files
+(order of paths doesn't matter here).
+
+There are some preprocessor defines that control usage of the STLport in evc3
+projects:
+
+Define the symbol _STLP_USE_STATIC_LIB when you want to statically link against
+STLport. The linker will remove unused classes and methods then, saving some
+space in the executable.
+
+If you don't want to use the iostreams part of the library, you can specify the
+define _STLP_NO_IOSTREAMS. In this mode there is no need to link against the
+library.
+
+STLport uses automatic linking to find the proper .lib file. If you want to see
+what import library STLport is going to use, define _STLP_VERBOSE_AUTO_LINK.
+When not using automatic linking (by specifying _STLP_DONT_USE_AUTO_LINK), you
+have to specify the proper .lib file in the Project Settings, on the "link" tab.
+The .lib names have the following syntax:
+
+ stlport(d|stld)[_static].<STLport-Version>.lib
+
+Examples:
+
+ stlport_static.5.0.lib - static release version, Version 5.0.0
+ stlportd_50.lib - dll debug version, Version 5.0.0
+
+Note that usage of the _STLP_DEBUG mode is currently not recommended for
+eMbedded Visual C++ builds using the ARM compiler, due to a compiler bug.
+
+When using STLport together with MFC, be sure to include the MFC headers first,
+then include STLport headers, e.g. in your Stdafx.h. This way STLport correctly
+recognizes MFC usage. You also can define the macro _STLP_USE_MFC, either in
+your project settings or in stlport/stl/config/user_config.h.
+
+Now you should be ready to use STLport.
+
+============
+Known issues
+============
+ - Unit Tests in _STLP_DEBUG mode (target 'stldbg-shared') fails in
+ __stl_debug_engine::_M_detach() for several tests due to unknown reasons.
+ A compiler bug in the ARM compiler is suspected.
+ There is currently no workaround for this bug. It is recommended to not use
+ _STLP_DEBUG mode.
+
+ - Resource compiler issue:
+
+ The resource compiler is not a C++ compiler, it is a compiler that translates
+ resource files, i.e. files that describe dialogs, strings, version information
+ and other parts of the GUI on MS Windows systems.
+
+ The problem is that it includes files from the C/C++ include path, and
+ STLport uses mechanisms the resource compiler can't handle, e.g. using macro
+ names longer than 31 characters.
+
+ The workaround is to guard all affected headers (stdio.h, string.h, stdarg.h,
+ stdlib.h, ctype.h) against this. The resource compiler is detected by the
+ macro RC_INVOKED.
+
+ - See also README.evc4 issues.
diff --git a/doc/README.evc4 b/doc/README.evc4
new file mode 100644
index 0000000..2b3d27e
--- /dev/null
+++ b/doc/README.evc4
@@ -0,0 +1,126 @@
+
+========================================
+STLport README for eMbedded Visual C++ 4
+========================================
+
+by: Zdenek Nemec, zero@mapfactor.com, last edited 2005-10-17
+
+============
+Introduction
+============
+This document should provide step-by-step guidance for installing, testing and using the STLport library under Windows CE .NET 4.x
+(aka Windows Mobile 2003 aka Pocket PC 2003).
+For any further comments or questions visit the STLport mailing lists
+http://stlport.sourceforge.net/Maillists.shtml or forums
+https://sourceforge.net/forum/?group_id=146814
+
+=============
+Prerequisites
+=============
+To build and use the STLport you will need following tools and libraries:
+ - eMbedded Visual C++ 4.0 SP4
+ - an SDK for your target platform with RTTI support
+
+================
+Building STLport
+================
+First, make sure that RTTI is available. Not all SDKs that come with eVC4 also include
+the necessary libs, but there is a patch for the PPC2003 SDK, available at
+http://support.microsoft.com/default.aspx?scid=kb;[LN];830482.
+
+Second, open command line and set proper system variables.
+This can be done by using batch files under your 'eMbedded Visual C++' directory(use either WCEemulator.BAT if you want to build STLport for the emulator or WCEARMV4.BAT if you intend to aim an ARM device).
+NOTE: If you are using Microsoft's batch files to set system variables check if both WCEROOT and SDKROOT vars are set to correct locations. example:
+WCEROOT=C:\Program Files\Microsoft eMbedded C++ 4.0
+SDKROOT=C:\Program Files\Windows CE Tools
+
+Third, when you are 100percent sure you've set correctly systems variables go to the STLport/build/lib dir and run the configure.bat with
+proper -c option (ie. "-c evc4"),
+then invoke following command: 'nmake /fmsvc.mak install' to build the library.
+
+If anything goes wrong check if you met all prerequisities and if you set system vars accordingly to the makfile you are using.
+At the end of build process you should have some libs installed in STLport/lib/evc4-arm or STLport/lib/evc4-x86 and dynamic libs in STLport/bin directory.
+
+You might want to repeat all those steps if you would like to have
+e.g. both ARM and x86 emulator binaries, just don't forget to do
+'nmake /fmsvc.mak clobber' before new build.
+
+Note: MIPS platform is also available for build, but it may not compile or work properly. Use with caution!
+
+===============
+Testing STLport
+===============
+When you successfuly build STLport libs, you should go to STLport/test/unit directory build and run the STLP test suite.
+Use 'nmake /fmsvc.mak' and keep in mind that you still have to have proper system variables set!
+Once test build has finished upload and run stlp_unit_test.exe to your emulator or device.
+Wait for a while (aprox. 2mins) until all tests are done.
+You should see two files next to your binary now.
+Check stlp_test.txt for any errors. If all tests passed you are ready to deploy STLport.
+If some test fails don't worry and check the STLport forum if it's already reported bug or you have found a new one.
+
+=============
+Using STLport
+=============
+Setting up the IDE:
+Before you start using STLport you have to set proper include and libraries search paths.
+Go to 'Tools'>'Options' menu in your eVC 4.0 and then to 'Directories' tab.
+For every platform you want to use STLport add STLport/stlport directory to the FIRST place in 'Include Files'
+and STLport/lib directory in 'Library files' section.
+
+Setting up projects:
+When using STLport together with MFC, you have to define _STLP_USE_MFC to properly include and use STLport.
+
+By default, exception support is not activated. You can detect this via _CPPUNWIND and activate this via /GX.
+Without exception support, e.g. std::bad_alloc is not available, causing compile errors for some code.
+
+Also, there is only one runtime available but the IDE doesn't add the corresponding switch to the command line.
+The right switch (selecting a dynamically linked runtime) is IMHO /MD or /MDd. This then also switches STLport to dynamic linking.
+Alternatively, you can #define _DLL for your project, which achieves the same but, again IMHO, is a less clean solution.
+
+============
+Known issues
+============
+- The compilers that come with eVC4 are almost bug-to-bug compatible with
+the one from VC6, so most workarounds for that compiler apply here, too.
+
+- There is a bug in the MIPS compiler that comes with eVC4 which only surfaces
+under certain conditions:
+ * in release mode with global optimizations on (#pragma optimize("g", on))
+ * a baseclass has (at least) two pointer members
+ * a derived class adds no data members
+ * the derived class' cctor defers to the basclass' compiler-generated cctor
+ * it is passed as template parameter to a function
+The smallest testcase I could come up with is this:
+ struct base {
+ void* ptr1;
+ void* ptr2;
+ };
+ struct derived: public base {
+ derived() {}
+ derived(const derived& __x): base(__x) {}
+ };
+
+ template<typename SomeType> void function( SomeType st1, SomeType st2) {}
+
+ struct test {
+ derived tmp;
+ ~test() { function(tmp, tmp); }
+ };
+ test test;
+..which causes an internal compiler error. Removing the base::ptr1, adding data
+to derived, making function() a normal function, or turning off optimization
+(#pragma optimize("g", off)) all causes the code to compile. This bug affects
+iterators of deque and vector<bool>.
+
+- Because of interdependancy between STLport and native Standard library headers
+STLport headers should always be included first in your translation unit (.cpp
+file). That is to say that:
+
+//Wrong headers order:
+#include <windows.h>
+#include <cstdlib>
+
+// Correct headers order
+#include <cstdlib>
+#include <windows.h>
+
diff --git a/doc/README.evc8 b/doc/README.evc8
new file mode 100644
index 0000000..cfef4c0
--- /dev/null
+++ b/doc/README.evc8
@@ -0,0 +1,99 @@
+setup VC8 for CE:
+------------------
+
+- VC8 doesn't have any setup batchfiles that prepare the environment for compiling
+with CE. You can take those from eVC4 and adapt them or write your own. This snippet
+should get you going:
+
+ rem you need to adapt at least these three
+ set OSVERSION=WCE500
+ set PLATFORM=MY_OWN_PLATFORM
+ set TARGETCPU=MIPSII
+
+ rem the compiler is always cl.exe, different compilers are in different paths
+ set CC=cl.exe
+ rem obviously, these need to be adjusted to where you installed VS2005 and the SDKs
+ set VSINSTALLDIR=C:\Programme\Microsoft Visual Studio 8
+ set SDKROOT=C:\Programme\Windows CE Tools
+
+ set PATH=%VSINSTALLDIR%\VC\ce\bin\x86_mips;%VSINSTALLDIR%\VC\bin;%VSINSTALLDIR%\Common7\IDE;%PATH%
+ set PLATFORMROOT=%SDKROOT%\%OSVERSION%\%PLATFORM%
+
+ rem add libs and includes from the SDK
+ set INCLUDE=%PLATFORMROOT%\include\%TARGETCPU%;%PLATFORMROOT%\MFC\include;%PLATFORMROOT%\ATL\include
+ set LIB=%PLATFORMROOT%\lib\%TARGETCPU%;%PLATFORMROOT%\MFC\lib\%TARGETCPU%;%PLATFORMROOT%\ATL\lib\%TARGETCPU%
+
+ rem add libs that came with VC8
+ rem Note: there are more libs and includes under ce\atlmfc, not sure if these are needed.
+ set LIB=%LIB%;%VSINSTALLDIR%\VC\ce\lib\%TARGETCPU%
+
+
+- The snippet below can be used to build STLport for Pocket PC 2003 (using the
+ Pocket PC 2003 SDK shipped with Visual Studio 2005, this is the SDK used when
+ compiling programs from within the IDE):
+
+ set OSVERSION=WCE420
+ set PLATFORM=POCKET PC 2003
+ set TARGETCPU=ARMV4
+
+ rem the compiler is always cl.exe, different compilers are in different paths
+ set CC=cl.exe
+
+ rem obviously, these need to be adjusted to where you installed VS2005
+ set VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8
+ set SDKROOT=%VSINSTALLDIR%\SmartDevices\SDK
+
+ set PATH=%VSINSTALLDIR%\VC\ce\bin\x86_arm;%VSINSTALLDIR%\VC\bin;%VSINSTALLDIR%\Common7\IDE;%PATH%
+ set PLATFORMROOT=%SDKROOT%\PocketPC2003
+
+ rem add libs and includes from the SDK
+ set INCLUDE=%PLATFORMROOT%\include
+ set LIB=%PLATFORMROOT%\lib\%TARGETCPU%
+
+ rem add libs that came with VC8
+ set INCLUDE=%INCLUDE%;%VSINSTALLDIR%\VC\ce\atlmfc\include
+ set LIB=%LIB%;%VSINSTALLDIR%\VC\ce\lib\%TARGETCPU%;%VSINSTALLDIR%\VC\ce\atlmfc\lib\%TARGETCPU%
+
+
+You should now be able to run cl.exe for the target you expected.
+
+- The cross compilers of VC8 are the same version as for the native target, i.e. MSC14.
+
+- The cross compiler for MIPS has the same bug as mentioned in doc/README.evc4 and
+the same workaround applies. However, using 'whole program optimization', it results
+in an error in the link phase.
+
+- In order for STLport to recognize which target you are compiling for, you need to have
+some macros defined, e.g. for the target architecture. The compilers do that partially on
+their own, but not sufficiently. Therefore, STLport requires these defines:
+
+ -- These are generally set for CE:
+ _UNICODE;UNICODE;_WIN32;WIN32;UNDER_CE;WINCE;
+ -- This one uses an environment variable to set the CE version:
+ _WIN32_WCE=$(CEVER);
+ -- These are used to help STLport recognise the target architecture:
+ $(ARCHFAM);$(_ARCHFAM_);$(INSTRUCTIONSET)
+ Note that the instructionset is not strictly needed for x86 but definitely for ARM. It
+ doesn't hurt for x86 though, so I'd always set these in any new project.
+ -- For release builds:
+ NDEBUG;
+ -- For debug builds:
+ DEBUG;_DEBUG;
+ -- For debug builds with additional STLport diagnostics:
+ DEBUG;_DEBUG;_STLP_DEBUG;
+ -- For MFC applications:
+ _AFXDLL;
+
+- Further settings:
+ Code generation: Multithreaded [Debug] DLL
+ Language: enable RTTI
+ Optimization: maximise speed and enable whole program optimization for release builds
+
+- Linker settings:
+ Ignore specific libraries: libc.lib;libcd.lib
+ Commandline: /SUBSYSTEM:WINDOWSCE
+ Optimisation: /LTCG for release builds
+
+- Resource compiler:
+ Define: UNDER_CE;WINCE;_WIN32_WCE=$(CEVER)
+
diff --git a/doc/README.evc9 b/doc/README.evc9
new file mode 100644
index 0000000..2ead948
--- /dev/null
+++ b/doc/README.evc9
@@ -0,0 +1,95 @@
+setup VC9 for CE:
+------------------
+
+- VC9 doesn't have any setup batchfiles that prepare the environment for compiling
+with CE. You can take those from eVC4 and adapt them or write your own. This snippet
+should get you going:
+
+ rem you need to adapt at least these three
+ set OSVERSION=WCE500
+ set PLATFORM=MY_OWN_PLATFORM
+ set TARGETCPU=MIPSII
+
+ rem the compiler is always cl.exe, different compilers are in different paths
+ set CC=cl.exe
+ rem obviously, these need to be adjusted to where you installed VS2008 and the SDKs
+ set VSINSTALLDIR=C:\Programme\Microsoft Visual Studio 9.0
+ set SDKROOT=C:\Programme\Windows CE Tools
+
+ set PATH=%VSINSTALLDIR%\VC\ce\bin\x86_mips;%VSINSTALLDIR%\VC\bin;%VSINSTALLDIR%\Common7\IDE;%PATH%
+ set PLATFORMROOT=%SDKROOT%\%OSVERSION%\%PLATFORM%
+
+ rem add libs and includes from the SDK
+ set INCLUDE=%PLATFORMROOT%\include\%TARGETCPU%;%PLATFORMROOT%\MFC\include;%PLATFORMROOT%\ATL\include
+ set LIB=%PLATFORMROOT%\lib\%TARGETCPU%;%PLATFORMROOT%\MFC\lib\%TARGETCPU%;%PLATFORMROOT%\ATL\lib\%TARGETCPU%
+
+ rem add libs that came with VC9
+ rem Note: there are more libs and includes under ce\atlmfc, you need to add these
+ rem instead of the ones in the SDK if you want to use the newer version of ATL/MFC.
+ set LIB=%LIB%;%VSINSTALLDIR%\VC\ce\lib\%TARGETCPU%
+
+
+- The snippet below can be used to build STLport for Pocket PC 2003 (using the
+ Pocket PC 2003 SDK shipped with Visual Studio 2008, this is the SDK used when
+ compiling programs from within the IDE):
+
+ set OSVERSION=WCE420
+ set PLATFORM=POCKET PC 2003
+ set TARGETCPU=ARMV4
+
+ rem the compiler is always cl.exe, different compilers are in different paths
+ set CC=cl.exe
+
+ rem obviously, these need to be adjusted to where you installed VS2008
+ set VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0
+ set SDKROOT=%VSINSTALLDIR%\SmartDevices\SDK
+
+ set PATH=%VSINSTALLDIR%\VC\ce\bin\x86_arm;%VSINSTALLDIR%\VC\bin;%VSINSTALLDIR%\Common7\IDE;%PATH%
+ set PLATFORMROOT=%SDKROOT%\PocketPC2003
+
+ rem add libs and includes from the SDK
+ set INCLUDE=%PLATFORMROOT%\include
+ set LIB=%PLATFORMROOT%\lib\%TARGETCPU%
+
+ rem add libs that came with VC9
+ set INCLUDE=%INCLUDE%;%VSINSTALLDIR%\VC\ce\atlmfc\include
+ set LIB=%LIB%;%VSINSTALLDIR%\VC\ce\lib\%TARGETCPU%;%VSINSTALLDIR%\VC\ce\atlmfc\lib\%TARGETCPU%
+
+
+You should now be able to run cl.exe for the target you expected.
+
+- The cross compilers of VC9 are the same version as for the native target, i.e. MSC15.
+
+- In order for STLport to recognize which target you are compiling for, you need to have
+some macros defined, e.g. for the target architecture. The compilers do that partially on
+their own, but not sufficiently. Therefore, STLport requires these defines:
+
+ -- These are generally set for CE:
+ _UNICODE;UNICODE;_WIN32;WIN32;UNDER_CE;WINCE;
+ -- This one uses an environment variable to set the CE version:
+ _WIN32_WCE=$(CEVER);
+ -- These are used to help STLport recognise the target architecture:
+ $(ARCHFAM);$(_ARCHFAM_);$(INSTRUCTIONSET)
+ Note that the instructionset is not strictly needed for x86 but definitely for ARM. It
+ doesn't hurt for x86 though, so I'd always set these in any new project.
+ -- For release builds:
+ NDEBUG;
+ -- For debug builds:
+ DEBUG;_DEBUG;
+ -- For debug builds with additional STLport diagnostics:
+ DEBUG;_DEBUG;_STLP_DEBUG;
+ -- For MFC applications:
+ _AFXDLL;
+
+- Further settings:
+ Code generation: Multithreaded [Debug] DLL
+ Language: enable RTTI
+ Optimization: maximise speed and enable whole program optimization for release builds
+
+- Linker settings:
+ Ignore specific libraries: libc.lib;libcd.lib
+ Commandline: /SUBSYSTEM:WINDOWSCE
+ Optimisation: /LTCG for release builds
+
+- Resource compiler:
+ Define: UNDER_CE;WINCE;_WIN32_WCE=$(CEVER)
diff --git a/doc/README.intel b/doc/README.intel
new file mode 100644
index 0000000..72c6453
--- /dev/null
+++ b/doc/README.intel
@@ -0,0 +1,19 @@
+Build of STLport with Intel C++ compiler for Windows is identical
+to the one for Microsoft Visual Studio compiler (see README.msvc).
+
+Known issues:
+
+1. If you have bind your Intel C++ compiler to the Visual Studio 6
+install and build your application without the -Qvc6 option you might
+experiement linking issue concerning 'std::unexpected' missing symbol.
+The reason of this problem is that without -Qvc6, ICL adds necessary
+code to invoke std::unexpected function when a raised exception is
+different to the one specified in a function prototype. As VC6 library
+do not contain this symbol ICL cannot find it anywhere.
+
+ As a workaround, STLport has its own std::unexpected implementation
+that you will find in src/dll_main.cpp. ICL is looking for a static
+symbol so if you use STLport static lib ICL will use its std::unexpected
+implementation but if you use STLport dynamic lib then ICL won't find
+it. You only need then to copy/paste the STLport implementation somewhere
+in your implementation and ICL will be happy.
diff --git a/doc/README.mingw b/doc/README.mingw
new file mode 100644
index 0000000..aaf40c2
--- /dev/null
+++ b/doc/README.mingw
@@ -0,0 +1,55 @@
+ The MinGW GNU make command can be used to build STLport with different
+compilers
+
+- gcc (native compiler):
+
+ Makefile : gcc.mak
+
+ Notes:
+
+ 1. Static library (archive)
+
+ If you use the static version of the STLport libraries
+ you have to define the _STLP_USE_STATIC_LIB macro in order
+ to have your executable linked correctly.
+
+ 2. Shell
+
+ You will need MSys in order to build STLport.
+
+ Be carefull about what make command you are using. STLport comes with a
+ GNU make build system design for unix like platforms, make files have not
+ been adapted for the Windows platform. So you have to use the make command
+ coming with the MinGW package 'mingw32-make' and not the one coming with MSys
+ that is a portage of the GNU make for Windows.
+
+ 3. Threading configuration
+
+ STLport libraries are built per default in order to be used in a
+ multithreaded environment. Under MinGW it means that we use the '-mthread'
+ compiler option. Don't forget to add it to your compiler command line too
+ if you want to use STLport libraries. You can also ask for not thread
+ safe libraries using the --no-thread configure script option.
+
+ 4. Linking
+
+ In this environment STLport is almost complete replacement for libstdc++.
+ It means that when you were linking with libstdc++ (-lstdc++) you only have
+ to replace it with STLport (-lstlport.5.2 for instance) and with libsupc++
+ containing language compiler support (lsupc++). However default gcc
+ behavior is to automatically link libstdc++ and a number of other system libs.
+ To avoid this behavior you have to use the -nodefaultlibs compiler option and
+ explicitely give all libraries by yourself. See build of unit tests to see what
+ library you might need, here is the list when this note was written:
+
+ -lstlportg.5.2 -lsupc++ -lgcc_s -lmingw32 -lmingwex -lmsvcrt -lm -lmoldname
+ -lcoldname -lkernel32
+
+- Borland C++ compiler:
+
+ Makefile : bcc.mak
+
+- Digital Mars C++ compiler:
+
+ Makefile : dmc.mak
+
diff --git a/doc/README.msvc b/doc/README.msvc
new file mode 100644
index 0000000..a47abac
--- /dev/null
+++ b/doc/README.msvc
@@ -0,0 +1,186 @@
+
+==================================================
+STLport README for Microsoft Visual C++ compilers.
+==================================================
+
+by: Francois Dumont, dums@stlport.com, last edited 08/02/2005
+
+============
+Introduction
+============
+This document describes how STLport can be compiled and used with Microsoft
+Visual C++ 6 SP5. It can also be used for the MSVC++ family.
+
+For any further comments or questsion visit STLport mailing lists
+http://stlport.sourceforge.net/Maillists.shtml or forums
+https://sourceforge.net/forum/?group_id=146814
+
+=============
+Prerequisites
+=============
+To build and use STLport you will need following tools and libraries:
+ - Microsoft Visual C++ 6.0 with at least Service Pack 5 or any higher
+ version.
+
+===================
+Configuring STLport
+===================
+In a console window go to the STLport build/lib folder. Run
+
+ configure --help
+
+This command will present you the different available build options. Just follow
+the instructions to set STLport configuration according your needs. The only
+mandatory configuration is to declare what is the compiler you are going to
+use, for MSVC 6 it is:
+
+ configure -c msvc6
+
+================
+Building STLport
+================
+This is a step by step description of the actions to take in order to have
+the STLport library built:
+
+1. Open a console window. You can get it executing cmd or command depending
+on your Windows OS.
+
+2. Go to MSVC++ Bin directory with a default MSVC6 install it is
+ cd "C:\Program Files\Microsoft Visual Studio\VC98\Bin"
+
+3. Run the vcvars32.bat script. This sets the environment variables required
+to have the MSVC++ compiler run during the build process. The most important
+one is the PATH variable so that you can call the cl.exe command which is the
+MSVC++ command line compiler. [You may omit this step, if you chose 'Install paths
+to access command-line tools' during Microsoft Visual Studio installation procedure.]
+
+4. Go to the STLport build/lib folder:
+ cd C:\STLport\build\lib
+
+5. Run the following command:
+ nmake /fmsvc.mak install
+
+ nmake is the make utility from Microsoft. /f is an nmake option
+telling it which make file script to use. You have of course to grant the
+closer make file to your effective compiler, msvc.mak in our case.
+
+ Once the command returns, you will have all the necessary libraries within
+the STLport lib folder. For a description of the generated libraries check the README
+file within the src folder.
+
+===============
+Testing STLport
+===============
+You can use the unit tests to verify STLport behaves correctly. Change into
+STLports 'build/test/unit' folder and type:
+
+ nmake /fmsvc.mak install
+
+Once the unit test is built you just need to run it. They can be found
+within the STLport bin folder.
+
+=============
+Using STLport
+=============
+Adjust your include and link paths in MSVC IDE (in 'Tools -> Options -> Directories'
+for MSVC6 IDE). In the include files add the path to STLport's 'stlport' folder.
+Make sure it is the first directory listed there. Add STLport's 'lib' folder for
+the library files (order of paths doesn't matter here).
+
+There are some preprocessor defines that control usage of the STLport in msvc
+projects:
+
+If you don't want to use the iostreams part of the library, you can specify the
+define _STLP_NO_IOSTREAMS. In this mode there is no need to link against the
+library.
+
+STLport uses automatic linking to find the proper .lib file. If you want to see
+what import library STLport is going to use, define _STLP_VERBOSE_AUTO_LINK.
+When not using automatic linking (by specifying _STLP_DONT_USE_AUTO_LINK), you
+have to specify the proper .lib file in the Project Settings, on the "link" tab.
+The .lib names have the following syntax:
+
+ stlport[d|stld][_x,_static,_statix].<STLport-Version>.lib
+
+ d : debug build
+ stld: debug build with _STLP_DEBUG (STL safe) mode
+ _x: Build of STLport as a dll but statically link to the native runtime.
+ _static : build of a static library
+ _statix : build of a static library link dynamically to the native runtime.
+
+Examples:
+
+ stlport_static.5.0.lib - static release version, Version 5.0.0
+ stlportd.5.0.lib - dll debug version, Version 5.0.0
+
+When using STLport together with MFC, be sure to include the MFC headers first,
+then include STLport headers, e.g. in your Stdafx.h. This way STLport correctly
+recognizes MFC usage. You also can define the macro _STLP_USE_MFC, either in
+your project settings or in stlport/stl/config/user_config.h.
+
+In order to enhance debugging with STLport you can optionally add the content of
+the etc/autoexp.dat file in the autoexp.dat file coming with your Visual Studio
+install.
+
+Now you should be ready to use STLport.
+
+============
+Known issues
+============
+
+1. InterlockedIncrement
+
+ If you experiment trouble with the InterlockedIncrement Win32 API function
+like the following message:
+
+C:\Program Files\Microsoft SDK\Include\.\winbase.h(1392) : error C2733: second C
+linkage of overloaded function 'InterlockedIncrement' not allowed
+C:\Program Files\Microsoft SDK\Include\.\winbase.h(1390) : see declaration of
+'InterlockedIncrement'
+
+ It means that you are using the new Microsoft platform SDK. There is no
+way to known it from STLport code so you have to signal it in the
+stlport/stl/config/user_config.h file (uncomment _STLP_NEW_PLATFORM_SDK in this file).
+
+2. Native C/C++ library headers location
+
+ If you experiment trouble with location of ctime and other Standard headers
+while building or using STLport you might be using the compiler coming with a
+platform SDK. If so please uncomment _STLP_USING_PLATFORM_SDK_COMPILER in
+stlport/stl/config/user_config.h. If it still do not find native headers you will
+perhaps need to change native headers relative path used by STLport. In this case use
+_STLP_NATIVE_INCLUDE_PATH and associated macro in stlport/stl/config/host.h.
+
+4. C symbols in std namespace
+
+The compiler of MSVC++ 6 has a bug when dealing with symbols existant in both
+the global namespace and symbols imported by a using-directive or a
+using-declaration - it will report an ambiguous call to an overloaded
+function (error C2668). Example:
+
+void function();
+namespace ns {
+ void function();
+ // or:
+ // using ::function;
+}
+
+using ns::function;
+// or:
+// using namespace ns;
+
+void call() {
+ function();
+}
+
+Since we anticipate that using-declarations or even using-directives are common
+use, STLport by default doesn't import or wrap functions that exist in both the
+global namespace and namespace std, in particular those are functions with C
+origin like fopen() or abs(). Also, it defines additional overloads for
+functions like abs() (overloaded for int, long, float, double, long double) in
+the global namespace.
+
+In order to make STLport include them in the std namespace, you can define the
+_STLP_DO_IMPORT_CSTD_FUNCTIONS macro. Doing so, you will have to explicitely
+scope all your functions calls like std::abs() though - otherwise you only get
+the global abs(int) from the C library.
diff --git a/doc/README.utf8 b/doc/README.utf8
new file mode 100644
index 0000000..7547fe9
--- /dev/null
+++ b/doc/README.utf8
@@ -0,0 +1,51 @@
+ Here is a description of how you can use STLport to read/write utf8 files.
+utf8 is a way of encoding wide characters. As so, management of encoding in
+the C++ Standard library is handle by the codecvt locale facet which is part
+of the ctype category. However utf8 only describe how encoding must be
+performed, it cannot be used to classify characters so it is not enough info
+to know how to generate the whole ctype category facets of a locale
+instance.
+
+In C++ it means that the following code will throw an exception to
+signal that creation failed:
+
+#include <locale>
+// Will throw a std::runtime_error exception.
+std::locale loc(".utf8");
+
+For the same reason building a locale with the ctype facets based on
+UTF8 is also wrong:
+
+// Will throw a std::runtime_error exception:
+std::locale loc(locale::classic(), ".utf8", std::locale::ctype);
+
+The only solution to get a locale instance that will handle utf8 encoding
+is to specifically signal that the codecvt facet should be based on utf8
+encoding:
+
+// Will succeed if there is necessary platform support.
+locale loc(locale::classic(), new codecvt_byname<wchar_t, char, mbstate_t>(".utf8"));
+
+ Once you have obtain a locale instance you can inject it in a file stream to
+read/write utf8 files:
+
+std::fstream fstr("file.utf8");
+fstr.imbue(loc);
+
+You can also access the facet directly to perform utf8 encoding/decoding operations:
+
+typedef std::codecvt<wchar_t, char, mbstate_t> codecvt_t;
+const codecvt_t& encoding = use_facet<codecvt_t>(loc);
+
+Notes:
+
+1. The dot ('.') is mandatory in front of utf8. This is a POSIX convention, locale
+names have the following format:
+language[_country[.encoding]]
+
+Ex: 'fr_FR'
+ 'french'
+ 'ru_RU.koi8r'
+
+2. utf8 encoding is only supported for the moment under Windows. The less common
+utf7 encoding is also supported.
diff --git a/doc/README.wince b/doc/README.wince
new file mode 100644
index 0000000..9feb5a9
--- /dev/null
+++ b/doc/README.wince
@@ -0,0 +1,94 @@
+Programming under MS Windows CE with STLport
+=============================================
+
+This is supposed to give an overview for programming on MS Windows CE, with and
+partially without STLport, what tools are available and what common pitfalls
+exist. Note that for every supported compiler there is another readme file which
+explains the specifics of that compiler.
+
+
+
+Available compilers:
+---------------------
+
+- Embedded Visual C++ 3 (eVC3): this IDE/compiler is for the CE3 target platforms.
+The included compiler is MSC12, the same as for VC6, so many workarounds for its
+'features' apply here, too. STLport works out of the box with this.
+
+- Embedded Visual C++ 4 (eVC4): basically the same as eVC3, but it can compile for
+CE4.x and 5. Note that currently (2007-03-06) I haven't tested this with CE5,
+because you can use a better compiler using VC8/VS2005. This compiler can be
+downloaded for free from the MS website, including a product activation key.
+STLport works out of the box with this.
+
+- Visual C++ 8 (VC8) aka Visual Studio 2005 (VS2005): with this version (and
+partially already version 7) the embedded and desktop IDEs have been merged again,
+so it supports compiling for MS Windows CE, versions 5 and later. Note that the
+freely downloadable express edition does not(!) allow compiling for CE. This IDE
+uses MSC14 as compiler. STLport works out of the box with CE5.
+
+- Platform Builders (PB): this tool is used to create a CE image. You can select the
+modules (e.g. Explorer, but also C++ RTTI) you include in the image. These IDEs use
+several different compilers (MSC12-14). STLport hasn't been tested with this
+IDE, AFAIK.
+
+- There used to be an addon for VC6(?) that allowed compiling for CE. This plugin
+has been superceeded by eVC3/4 and support for it has been removed from STLport in
+version 5.
+
+- Others: some vendors (e.g. Intel) provide compilers that are able to generate
+CE executables. I'm not aware of an attempt to compile STLport with them.
+
+
+
+Environment specialties:
+-------------------------
+
+- In order to develop for a platform, the first thing you need is a so-called SDK.
+This package includes headers and libraries that (more or less) resemble the APIs
+available on the device. The IDEs come with a basic selection of SDKs, but in
+general you need to retrieve an according SDK from the vendor. If you are the
+vendor, you can generate an SDK for a platform with Platform Builder.
+
+- The provided API is typically a subset of the 'normal' win32 API. Often, some
+features are simply not supported, like security descriptors when opening files.
+Also, these APIs are only supported for wchar_t strings, e.g. only CreateFileW()
+and not CreateFileA().
+
+- CE doesn't have a current directory, hence no relative paths to that dir. You can
+have relative parts in global paths though.
+
+- CE doesn't have environment variables, thus STLport can't support e.g.
+setenv/getenv. It also doesn't attempt to provide workarounds.
+
+- Since many features are optional (see the description of Platform Builder), it
+is possible that you don't have e.g. a console that std::cout could write to. The
+same applies to exceptions (see e.g. the add-on lib for RTTI for eVC4). Other
+features might go amiss, too. This makes it hard for STLport to adapt to, in
+particular because this information is not available outside PB, a header might
+declare a function that in fact is not present. Keep this in mind when you get
+linker errors.
+
+- The supplied C++ standard library is extremely cut down, e.g. iostreams and
+locales are missing completely.
+
+- The supplied standard C API is at best rudimentary. Functions like e.g. time() or
+clock() are declared but not defined. STLport doesn't include any workarounds for
+these missing functions at present.
+
+- All compilers are cross-compilers, i.e. you run them on a win32 host and they
+produce executable code for the target platform. The same applies to the debugger,
+which is connected via serial, USB or ethernet. Alternatively, there are emulators
+that run on the host machine and simulate the target platform.
+
+- The entrypoint for executables is generally WinMain. Normally, you would have
+switched to a normal main() using /SUBSYSTEM:CONSOLE on the linker commandline.
+The linkers for at least CE4 and 5 don't understand this switch, they claim it
+conflicts with CE targets. Instead, set the entrypoint directly to
+mainACRTStartup.
+
+- The name of a DLL loaded via an import library can't be longer than 32 chars. If
+this is not the case, the application will behave as if the DLL was not present or
+couldn't be loaded for whatever other reason. This limitation applies to at least
+CE 4 and 5.
+
diff --git a/doc/README.windows b/doc/README.windows
new file mode 100644
index 0000000..fd23b6d
--- /dev/null
+++ b/doc/README.windows
@@ -0,0 +1,55 @@
+Note for Windows users:
+
+ It is highly recommended to declare the Windows OS version you are
+targetting when building the library as well as when using it. You can do so
+thanks to the well known Microsoft macros WINVER, _WIN32_WINDOWS or
+_WIN32_WINNT, see your platform SDK documentation for a description
+of those macros and how to use them. To define it when building the
+library, use the configure script --extra-cxxflag option. Here is the
+configuration to build STLport using Visual Studio 2005 and targetting
+Windows XP:
+
+configure -c msvc8 --extra-cxxflag "/D_WIN32_WINNT=0x0501"
+
+ If you do not declare it at build time STLport will adapt to the PSDK in
+use, windows.h gives a default value to WINVER. However, when using the
+library, windows.h is not necessarily included, at least not by STLport
+internally, so none of the macros are defined which will result in an
+inconsistency in the build process which most of time will generate undefined
+behavior at runtime.
+
+ Here is the main reason for following this advise, the Windows 95
+compatibility issue:
+
+ Because of a modification in the behavior of the Win32 API functions
+InterlockedIncrement and InterlockedDecrement after Windows 95, STLport
+libraries built for Windows 95 cannot be used to generate an application
+built for Windows XP for instance. So, if you build STLport with a Windows
+95 PSDK, STLport will be ready for Windows 95. If you then use it without
+defining _WIN32_WINDOWS to signal Windows 95 compatibility, STLport will
+consider that it can use latest Windows OS features like the new
+InterlockedIncrement and InterlockedDecrement functions which change the
+memory footprint of some internal STLport objects making it incompatible
+with the libraries built for Windows 95.
+
+ Normally, doing so wouldn't generate any compilation or link error, you
+would only experiment undefined behavior at runtime. In order to make this
+problem more obvious STLport forces a link time error in debug mode (_DEBUG
+macro defined).
+
+Unresolved symbol will be:
+ - 'building_for_at_least_windows98_but_library_built_for_windows95'
+ if you are trying to use STLport libraries built for Windows 98 or later
+ to generate an application targetting the Windows 95 platform.
+ - 'building_for_windows95_but_library_built_for_at_least_windows98'
+ if you are trying to use STLport libraries built for Windows 95 to generate
+ an appliation targetting the
+
+ Windows XP platform for instance.
+
+ Of course, targetting the latest Windows OS versions will give you the best
+performance from STLport. This is why when none of the platform macros are
+defined STLport consider that there is no minimum OS requirement and will
+use the latest API functions. There is only one exception to this behavior,
+the SwitchToThread function that is used only if you define _WIN32_WINNT to a
+value higher or equal to 0X0400.
diff --git a/doc/build_system.txt b/doc/build_system.txt
new file mode 100644
index 0000000..8d39b0d
--- /dev/null
+++ b/doc/build_system.txt
@@ -0,0 +1,82 @@
+The STLport build system
+========================
+
+This is a basic overview of the STLport build system. At the moment, I'm only familiar
+with the working of the nmake variant, i.e. for MSVC, eVC and ICC/win32, other variants
+may differ.
+
+Overview:
+----------
+
+
+There are three basic classes to consider while building:
+1. The used make tool (currently that is make (GNU make) an nmake (Microsoft)).
+2. The used compiler
+3. The target type, either application or library
+
+Other than that, there are three different settings corresponding to the three different
+STLport modes, 'release', 'debug' and 'STLdebug' and each one has two modes for either
+static or dynamic linking.
+
+The whole build system lies under the build/ dir of the source tree. There, it first
+branches to Makefiles/ (which contains the base of the build system) and to lib/ (which
+contains files to build the STLport library) and test/ (which contains files to build
+tests) (TODO: what is the misc/ folder for?).
+
+Under Makefiles/, you see the initially mentioned branching according to the build tool.
+Here is also where the configure.bat file puts the generated config.mak file. (TODO:
+what are the other files in that folder?)
+
+nmake:
+-------
+
+Under nmake/, you then find the common support files for the different compilers and
+files that define generic rules. Here, it then splits into app/ and lib/, which are
+structured similar to each other and to the common nmake/ dir. In each dir you have
+files for the different compilers that are used to make application specific or library
+specific settings.
+
+The branching in the three STLport modes and the static/dynamic linking is not visible
+in the file structure but only in the used nmake variables.
+
+In order to make clear which file includes which other file, here an example when
+compiling the STLport library for eVC4. The call issued is 'nmake /f evc4.mak' in the
+build/lib folder. From there, the following include tree is created:
+
+build/lib/evc.mak
+ build/Makefiles/config.mak ; generated by configure.bat
+ build/Makefiles/nmake/top.mak
+ build/Makefiles/config.mak
+ build/Makefiles/nmake/sysid.mak
+ build/Makefiles/nmake/sys.mak
+ build/Makefiles/nmake/evc4.mak ; evc4 from config
+ build/Makefiles/nmake/evc-common.mak
+ build/Makefiles/nmake/targetdirs.mak
+ build/Makefiles/nmake/extern.mak
+ build/Makefiles/nmake/targets.mak
+ build/Makefiles/nmake/rules-o.mak
+ build/Makefiles/nmake/clean.mak
+ build/Makefiles/nmake/lib/top.mak ; would be app/top.mak when building an application
+ build/Makefiles/nmake/lib/macro.mak
+ build/Makefiles/nmake/lib/evc4.mak ; evc4 from config
+ build/Makefiles/nmake/lib/evc-common.mak
+ build/Makefiles/nmake/lib/rules-so.mak
+ build/Makefiles/nmake/lib/rules-a.mak
+ build/Makefiles/nmake/lib/rules-install-so.mak
+ build/Makefiles/nmake/lib/rules-install-a.mak
+ build/Makefiles/nmake/lib/clean.mak
+
+TODO: build/Makefiles/config.mak is included both by build/lib/evc.mak and by
+build/Makefiles/nmake/top.mak.
+
+Known issues:
+--------------
+
+- nmake: MSC doesn't support generating dependency information for makefiles. So, unless
+you modify the direct source file for an object file, no recompilation is triggered! You
+need to either delete all object files that need to be recompiled or 'make clean'
+
+- There are targets to only install e.g. the shared STLdebug version but there is no
+such thing for making clean. This would be useful in the context of above issue for
+making a selective clean only.
+
diff --git a/doc/pointer_specialization.txt b/doc/pointer_specialization.txt
new file mode 100644
index 0000000..570c506
--- /dev/null
+++ b/doc/pointer_specialization.txt
@@ -0,0 +1,90 @@
+********************************************************************
+* This document describe the STLport container pointer *
+* specialization feature. *
+********************************************************************
+
+ What is it for:
+
+ The major problem of template code is the potentialy huge binary
+ size that can result from the compilation. Each template type
+ instanciation is a new type from the compiler point of view even if
+ the generated binaries are identicals. To avoid this binary duplication
+ STLport grant the partial pointer specialization for 4 containers:
+ - vector
+ - deque
+ - list
+ - slist
+
+ How does it work:
+
+ The pointer specialization consists in using a void* container
+ instanciation for any container of pointers, including pointers
+ to cv qualified types. So the container pointer specializations
+ are only bridges that forward all the method calls to the
+ underlying void* container instanciation. The bridge job is to
+ cast the pointer type to and from the void* type.
+
+ Why only those 4 containers:
+
+ Some of you might wonder why none of the associative containers
+ or hash containers has been specialized. Lets take the set container
+ as an example. Its declaration is
+
+ template <class _Tp,
+ class _Compare = less<_Tp>,
+ class _Alloc = allocator<_Tp> >
+ class set;
+
+ In a first thought you can imagine a partial specialization like
+ the following:
+
+ template <class _Tp, class _Compare, class _Alloc>
+ class set<_Tp*, _Compare, _Alloc>
+
+ What would be the underlying container for such a partial
+ specialization? The _Alloc type is supposed to have a rebind member
+ method so you can easily find the _VoidAlloc type. The _Compare type,
+ on the other hand, do not have this kind of Standard requirements.
+ So you need to wrap the _Compare type within a _WrapCompare type
+ that will take care of all the cast work. The underlying container
+ type will be:
+
+ set<void*, _WrapCompare<_Tp, _Compare>, _VoidAlloc>
+
+ The problem of such a type is that it is still dependent on the
+ original _Tp type for the _WrapCompare instanciation. So each set
+ instanciation will have a distinct underlying void* container and
+ we fall back on a binary duplication trouble.
+
+ On a second thought a possible solution is to limit the partial
+ specialization like that:
+
+ template <class _Tp, class _Alloc>
+ class set<_Tp*, less<_Tp*>, _Alloc>
+
+ We only specialized the set container if the comparison functor
+ is the Standard less struct. The underlying container would be:
+
+ set<void*, less<void*>, _VoidAlloc>
+
+ It looks fine but it is wrong. Actually a STL user is free to
+ specialized the less struct for any pointer type even the basic one.
+ In such a situation the client would think that the set is ordered
+ according its own functor but will finally have a set ordered according
+ the less<void*> functor. The less specialization issue also show that
+ the underlying cannot be a
+
+ set<void*, less<void*>, _VoidAlloc>
+
+ but will have to be a
+
+ set<void*, __less<void*>, _VoidAlloc>
+
+ where __less would be equivalent to the standard less functor but
+ would not be specializable because unreachable from the client code.
+
+ There is of course a solution for this specialization issue. We
+ need to be able to detect the less specialization. The partial set
+ specialization would have to be used only if the less functor is
+ the default STLport implementation based on the strict ordering operator.
+ No doubt that a solution to this problem will be soon found.
diff --git a/doc/stlport_namespaces.txt b/doc/stlport_namespaces.txt
new file mode 100644
index 0000000..d243b03
--- /dev/null
+++ b/doc/stlport_namespaces.txt
@@ -0,0 +1,133 @@
+This document present the STLport namespace schema and give additionnal
+information about how STLport replace the native C++ Standard library
+coming with your compiler.
+
+1. What is the STLport namespace ?
+
+ As STLport is a C++ Standard library implementation the STLport namespace
+is 'std'. In normal use this is all you need to know and you can stop reading
+here.
+
+2. How does STLport replace native C++ Standard library ?
+
+ STLport defines a macro 'std' that replaces all references of std in the
+user code by a different name. This technique has has some drawback but also
+advantages. The drawback is that you cannot declared Standard component like
+that:
+
+
+//foo.h
+namespace std
+{
+ template <class _Tp>
+ class allocator;
+}
+
+void f1(const std::allocator<int>&);
+
+
+//foo.cpp
+#include "foo.h"
+#include <memory>
+
+void f1(const std::allocator<int>& alloc)
+{
+ //implementation
+}
+
+//bar.cpp
+#include "foo.h"
+#include <memory>
+
+int main(int, char**)
+{
+ std::allocator<int> alloc;
+ f1(alloc);
+}
+
+ If you build this code you will surely have a compilation error as f1 is declared
+as taking a std::allocator parameter but you are calling it using an STLport allocator
+instance that is not in the std namespace. The good news is that this drawback is easy
+to detect as it will generate compilation error or at least link time error. The only
+workaround is to include an arbitrary Standard header before the allocator declaration.
+Good candidates for that are <utility> or <cerrno> as they are small headers. Including
+those headers will replace std with the STLport namespace.
+
+ The advantage of this macro replacement is that we can customize the STLport namespace
+depending on the compilation options. For instance the STLport safe mode you can use by
+defining _STLP_DEBUG is not binary compatible with a normal debug build. To ensure that
+no one will ever build code without _STLP_DEBUG and link with STLport library built with
+this option the namespace is different so that it will generate link time error rather
+than random crashes during application execution.
+
+3. Why not having use namespace injection ?
+
+ An other way to replace native Standard C++ library implementation would have been to
+use namespace injection:
+
+namespace std
+{
+ using namespace stlport;
+}
+
+ This solution has a first major drawback which is that STLport would be much more sensible
+to native headers. If you include a C++ native headers that indirectly define for instance
+the vector class it is going to conflict with the STLport vector definition.
+
+ Moreover this solution just does not work for a very simple reason. The C++ Standard
+allows users to specialized some of the Standard algorithms. This specialization has to
+be done in the same namespace as the main template declaration:
+
+//In an STLport header:
+namespace stlport
+{
+ template <class _Tp>
+ struct less
+ {
+ bool operator () (const _Tp& x, const _Tp& y) const;
+ };
+}
+
+//User code:
+
+struct MyStruct;
+
+namespace std
+{
+ template <>
+ struct less<MyStruct>
+ {
+ };
+}
+
+As you can see the specialization is not in the STLport less namespace and it
+won't be used in associative containers for instance.
+
+4. What is the STLport specific namespace ?
+
+ The official STLport namespace is: stlport. Once again this is not the real namespace
+where all the Standard stuff are. As the real STLport namespace change depending on compilation
+options you cannot use it directly. So stlport is an alias of the real STLport namespace.
+
+5. What are the other STLport namespaces ?
+
+ Those names are given for information purpose and should never be used in any user code. The
+default STLport namespace is: stlp_std. Here is the list of the customized namespaces:
+
+ - stlpd_std : when _STLP_DEBUG is defined
+ - stlpx_std : when you use STLport as a shared library linked to the static version of the native
+ runtime or when you build the static STLport library linked with the dynamic version. This option
+ is only supported by a limited number of compilers.
+ - stlpmtx_std : when building STLport as not thread safe.
+
+ You can also have combination of those extension like stlpdxmtx_std or stlpdmtx_std...
+
+ There is also an other STLport namespace for STLport internal functions or struct/class: priv.
+
+namespace stlport
+{
+ namespace priv
+ {
+ }
+}
+
diff --git a/errno.h b/errno.h
deleted file mode 100644
index 27037ea..0000000
--- a/errno.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x205
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x205) && !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-#ifdef _STLP_WCE
-// only show message when directly including this file in a non-library build
-# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x205)
-# pragma message("eMbedded Visual C++ 3 and .NET don't have a errno.h header; STLport won't include native errno.h here")
-# endif
-#else
-# ifndef errno
-/* We define the following macro first to guaranty the header reentrancy: */
-# define _STLP_NATIVE_ERRNO_H_INCLUDED
-# include _STLP_NATIVE_C_HEADER(errno.h)
-# endif /* errno */
-
-# if !defined (_STLP_NATIVE_ERRNO_H_INCLUDED)
-/* If errno has been defined before inclusion of native errno.h including it from STLport errno.h
- * becomes impossible because if:
- * #define errno foo
- * then
- * #include _STLP_NATIVE_C_HEADER(errno.h)
- * becomes:
- * #include _STLP_NATIVE_C_HEADER(foo.h)
- *
- * To fix this problem you have to find where this definition comes from and include errno.h before it.
- */
-# error errno has been defined before inclusion of errno.h header.
-# endif
-
-# ifdef __cplusplus
-# ifndef errno /* errno still not defined */
-_STLP_BEGIN_NAMESPACE
-# if !defined (__BORLANDC__)
-using ::errno;
-# else
-using _STLP_VENDOR_CSTD::errno;
-# endif
-_STLP_END_NAMESPACE
-# endif /* errno */
-# endif /* __cplusplus */
-
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x205)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-# undef _STLP_DONT_POP_HEADER_ID
-#endif
-
-/* Local Variables:
- * mode:C++
- * End:
- */
diff --git a/etc/ChangeLog b/etc/ChangeLog
new file mode 100644
index 0000000..44a7ea4
--- /dev/null
+++ b/etc/ChangeLog
@@ -0,0 +1,3088 @@
+2008-12-10 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * Repository: STLport release 5.2.1
+
+2008-12-03 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build: HP-UX/ia64 with aC++ compiler; verified on HP-UX 11.23
+ and 11.31 with aC++ A.06.17; [4 of 436 tests, 4 ignored (2 explicit),
+ and 4 of 360 tests, 2 ignored]; submitted by Boris Gubenko.
+
+2008-11-27 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build: EVC9 (Visual Studio 2008) by Johan Andersson.
+
+2008-11-19 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * Repository: STLport release 5.2.0
+
+2008-08-26 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * Repository: branch for STLport 5.2, r3618
+
+2008-07-21 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/type_traits: decay, conditional, ebable_if added.
+
+2008-07-18 Francois Dumont <dums@users.sourceforge.net>
+
+ * configure.bat: Specifying the compiler is now mandatory and
+ must be first.
+
+2008-07-17 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stdlib.h, cstdlib: Fix errno workaround for gcc MinGW.
+ Latest gcc version (4.3.0) includes stdlib.h in cstdlib using
+ include_next so skipping workaround in STLport stdlib.h. So errno.h
+ must also be included from cstdlib.
+
+2008-07-17 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ src/details/fstream_unistd.cpp: fix bug #2001222, opening with
+ ios_base::app should rewind write pointer to the end of the file;
+ fix treatment of ios_base::ate (it should rewind pointer
+ to the end of the file once) and ios_base::app (offset will be set
+ to the end of the file prior to each write); references ---
+ http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2008/n2691.pdf
+ 27.8.1.4; http://www.opengroup.org/onlinepubs/7990989775/xsh/fopen.html;
+ http://www.opengroup.org/onlinepubs/7990989775/xsh/open.html
+
+ test/unit/fstream_test.cpp: add sample with fopen as reference point.
+
+2008-07-14 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/Makefiles/gmake: Build system updated for gcc under Cygwin,
+ MinGW. Under Cygwin, with or without -mno-cygwin option, STLport
+ is now a full replacement for libstdc++, building an application
+ with it do not require -lsupc++ anymore as it is completely
+ integrated in STLport. Under MinGW it didn't work resulting in a
+ crash when starting an application using STLport so -lsupc++ is
+ necessary both when linking STLport _and_ when linking the
+ application using it.
+
+2008-07-10 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/num_put_float.cpp: Use an union based technique to find out
+ the sign of floating point values. It will maybe replace use of
+ platform specific functions in a future version.
+
+ * src/stdio_streambuf.cpp, test/unit/iostream_test.cpp: Change
+ behavior of stdio_istreambuf implementation that now always return 0 on
+ showmanyc call. Returning -1 means that reading attempt will
+ necessarily fail which is not the case, 0 is prefered as it means that
+ we don't know. It is also similar to other std implementations like
+ libstdc++.
+
+2008-07-02 Francois Dumont <dums@users.sourceforge.net>
+
+ * configure.bat: After a very interesting debate the consesus
+ is to put configure scripts in root folder.
+
+ * stlport/stl/_string_sum_methods.h: Bug report #2003308,
+ compilation error with _STLP_USE_TEMPLATE_EXPRESSION.
+ Regression due to remove of POD type support in basic_string
+ implementation.
+
+2008-06-26 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_fstream.c: Consider read file failure in
+ _M_underflow_aux method to avoid infinite looping on some
+ platforms. Thanks Pawel Sikora.
+
+2008-06-26 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/unix/rules-install-so.mak: do
+ install-headers tags when make install or install-release-shared.
+
+2008-06-24 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/Makefiles/gmake: Cygwin/MinGW upgrade, now build
+ without referencing libstdc++.
+
+ * stlport/stl/_threads.h: Move definition of __stl_atomic_t next
+ to definition of atomic operations to guaranty coherency.
+
+2008-06-18 Francois Dumont <dums@users.sourceforge.net>
+
+ * build: configure.bat moved to build folder. lib/Makefile,
+ test/unit/Makefile removed from SVN, now generated by configure
+ scripts. Under GNU make use include rather than link to
+ reference the right make file, link seems not supported by
+ Cygwin/MinGW make. Remove default value of STLPORT_DIR,
+ already set in internal make files and moreover the absolute
+ path generated in the script leads to trouble under Cygwin/MinGW.
+
+ * src/num_get_float.cpp: Use an union to generate double value
+ from 64 bits int to avoid gcc type-punned pointer warning.
+
+2008-06-16 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/test/unit/gcc.mak: pass runtime pathes as absolute;
+ removed LDSEARCH macro, use LDFLAGS instead;
+
+ * Makefile: clean in test/unit too.
+
+2008-06-13 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_iterator_base.h: Add a funny feature, when
+ using both STLport and native STLs it was not possible
+ to use std iterators in STLport containers because of the
+ missing iterator category that is defined in std:: and
+ not in stlport::. So now STLport map std iterator categories
+ in stlport ones. Now it is possible to write something like
+ that:
+ std::string stdstr("std");
+ stlport::string stlportstr("stlport and ");
+ stlportstr.append(stdstr.begin(), stdstr.end());
+ However the other side is not supported except when STLport
+ iterators are simply pointers.
+
+2008-06-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/num_get_float.cpp: Remove useless skip of white
+ space at begining of buffer in _Stl_string_to_double function.
+ __read_float, the function that generate that buffer do not
+ put white space at the first place.
+
+ * stlport/stl/_new.h, _range_errors.c: Remove unused
+ _STLP_RTTI_BUG macro. Moreover __stl_new was not correctly
+ implemented with this macro, there was no check for failed
+ allocation.
+
+ * test/unit/limits_test.cpp: Remove code supposed to hide
+ numeric_limits::max value to MSVC 8 compiler, this code was
+ introducing a test regression. If it is producing a warning
+ a #pragma warning should be use to hide it.
+
+ * test/unit/num_put_get_test.cpp: Add test showing problem
+ with code that used to be in limits test. Those tests will be
+ activated for 5.3 to check that there is really nothing wrong
+ with it.
+
+2008-06-07 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * configure: don't duplicate options in config.mak, that
+ has default values in makefiles.
+
+2008-06-06 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * configure: put it on common place for ./configure;
+
+ * build/Makefiles/gmake/targetdirs.mak: use $(DESTDIR)
+ as in common practice (change root of installation, but
+ don't change run paths);
+
+ * build: by default use make for gcc;
+
+ * Makefile: top makefile for common project task;
+
+ * build/Makefiles/gmake/depend.mak: fix options for ctags
+ and etags;
+
+ * configure, build/Makefiles/gmake/top.mak: take into account
+ extra flags for linker.
+
+2008-06-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_function_adaptors.h: Fix instantiation of
+ unary_function and binary_function as base type of _Mem_fun0_ref,
+ _Mem_fun1_ref, _Const_mem_fun0_ref, _Const_mem_fun1_ref,
+ _Void_mem_fun0_ref, _Void_mem_fun1_ref, _Void_const_mem_fun0_ref,
+ _Void_const_mem_fun1_ref. Those classes are use as a workaround for
+ compiler missing class partial template specialization or that don't
+ support return of void. Instantiation is now done without reference
+ qualifier as specified by the Standard and as done in the
+ implementation used when workaround is not necessary.
+
+2008-06-03 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/ios.cpp, stlport/stl/_complex.c, _ios.c, _ios.h, _ios_base.h,
+ _istream.c, _num_get.c, _num_put.c: Remove invalid cached facet
+ pointers in ios_base class. This class can be used in a char or
+ wchar_t instantiation context making cast to ctype<char> or
+ ctype<wchar_t> invalid resulting in an application crashed. The
+ only safe access to facet instances from a ios_base instance is through
+ the use_facet<Facet>(getloc()) function. Only _M_cached_ctype has been
+ kept in basic_ios class even if small bench hasn't show real
+ enhancement compared to using use_facet.
+
+ * stlport/stl/_time_facets.c: In addition to above modifications
+ time_get implementation has been simplified as localized info are
+ now stored as wchar_t for wide char instantiation. We do not need
+ to use ctype.widen method anymore.
+
+ * test/unit/time_facets_test.cpp: Add test for time_get wchar_t
+ instantiation.
+
+ * test/unit/cppunit/cppunit_mini.h: Fix report of ignored/explicit
+ tests.
+
+2008-05-27 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_alloc.h: Code simplification, clean up null
+ pointer checks as allocators should never return it but rather
+ throw a bad_alloc exception.
+
+2008-05-27 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/cppunit/cppunit_mini.h, file_reporter.h: Fix
+ counting of failed test, won't report more failures than tests
+ anymore. Now also report explicit tests.
+
+2008-05-15 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/allocators.cpp, locale_catalog.cpp, num_put_float.cpp:
+ Use static method returning static instance to mutex rather than
+ direct access to a static mutex instance to control initialization
+ order of static variables thanks Peter Hrenka report.
+
+2008-04-26 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_function.h, type_traits.h: Adoption of Defect Report 109
+ Missing binders for non-const sequence elements.
+
+ * test/unit/bind_test.cpp: Test for DR above.
+
+2008-05-11 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_string.c: from formal (ISO/IEC 14882:2003) point of view
+ string s; string::size_type p = s.find( "", 0, 0 ); should return 0 in p,
+ i.e. position out-of-bound of string; people near Standard commete has
+ opinion that Standard correct in this point and not require clarification
+ (opposite to my opinion); even if it looks like bogus behavior for me,
+ it fixed to conform standard; see bugreport #1872656;
+
+ * test/unit/string_test.cpp: test for issue above.
+
+2008-05-10 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_istream.c, stlport/stl/_ostream.h: ISO/IEC 14882:2003
+ (and 1998 too) assume change as get as put positions with
+ seekg and seekp (27.6.1.3, par 38; 27.6.2.4 par 2), but this
+ contradict to common practice and proposed draft N2588
+ (27.6.1.3, par 41; 27.6.2.5, par 4); now STLport implement
+ (i.e. change present behavior) the draft's point of view;
+ this reflect patch #1650657 by Jan Echternach;
+
+ * test/unit/sstream_test.cpp: test for issue above.
+
+2008-04-26 Francois Dumont <dums@users.sourceforge.net>
+
+ * Patches #1940126, #1941267, #1941814 from Johan Andersson for evc8
+ Pocket PC support and build of tests without warnings.
+
+2008-04-24 Francois Dumont <dums@users.sourceforge.net>
+
+ * Patch 1937823 from Johan Andersson to add Microsoft Visual
+ Studio 2008 support.
+
+ * stlport/stl/_algobase.h: Patch 1935497 from Andrey Semashev to
+ apply a common optimization in STLport algos for random access
+ iterators to fill and fill_n algos.
+
+2008-04-23 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/num_put.cpp: remove ambiguity of char to int conversion
+ (comparison with integers, check for negative value); remove
+ ambiguity with postfix increment in index in conditional
+ expression.
+
+2008-04-22 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/gcc.mak, build/lib/configure: take
+ into account CFLAGS, EXTRA_CFLAGS, because of C compiler in use too.
+
+2008-04-17 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_string.h: Remove support for non POD type in basic_string
+ implementation.
+
+2008-04-08 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/lib/gcc.mak: try to create $(PRE_OUTPUT_DIR) before
+ run lipo; impact only MacOS;
+
+ * build/Makefiles/gmake/sysid.mak: uname -m on MacOS return
+ power-macintosh, but identify architechture as ppc.
+
+2008-03-28 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/assert.h: Bug #1894882: Apply a technique similar to the
+ one used in errno.h to detect when assert has been defined before
+ including assert.h.
+
+2008-03-21 Francois Dumont <dums@users.sourceforge.net>
+
+ * Patch 1876529 from Johan Andersson to add support for VS 2005
+ bundled Pocket PC 2003 SDK.
+
+2008-03-18 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_string.c: derived from patch #1914475, wrong
+ replace for selfreferencing string; thanks Farid Zaripov;
+
+ * test/unit/string_test.cpp: test for problem above.
+
+2008-03-17 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_stdexcept_base.h, _stdexcept_base.c,
+ type_manips.h, src/num_put_float.cpp,
+ test/unit/num_put_get_test.cpp: Borland patch from Eric Sanford.
+ No need for a __Named_exception workaround anymore. Force
+ floating point control word when testing special floating point
+ operations. Change implementation _Copyable and add a workaround
+ to correctly render long double max value that is consider as
+ equal to double max value.
+
+2008-03-10 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/Makefiles: Normalization of --with-static-rtl and
+ --with-dynamic-rtl extended to configure script for Borland
+ and DMC compilers.
+
+2008-03-08 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/cppunit/cppunit_mini.h: New mini cppunit framework
+ feature, the explicit tests that have to be explicitly tested
+ thanks to the -t option to run.
+
+ * test/unit/unordered_test.cpp: benchmark1 and benchmark2 tests
+ are now explicit.
+
+ * stlport/stl/_stdexcept_base.h, _stdexcept_base.c:
+ __Named_exception that contains dynamically allocated memory
+ require a copy constructor and assignment operator. Thanks bug
+ report #1908626 from Ilya Dogadaev.
+
+ * build/Makefiles: Normalized some configure options:
+ --without-thread, --without-rtti, --with-lib-motif.
+
+2008-03-06 Francois Dumont <dums@users.sourceforge.net>
+
+ * Fix rtti management:
+ - no rtti support do not imply no type_info struct definition.
+ - #error message in typeinfo to signal missing rtti support
+ has been removed.
+ - locale implementation do not use typeid anymore to enhance
+ runtime_error message thrown by combine message when we cannot
+ find the combined facet. It was introducing an annoying dependency
+ making use of the lib without rtti support impossible.
+
+2008-03-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_range_errors.h: Signal function responsible
+ for throwing excepions as not returning to the DMC compiler.
+
+2008-03-03 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/Makefiles/gmake: Eric Sanford patch to make generation
+ of debug symbols optional when using Borland compiler to build
+ unit tests.
+
+ * stlport/stl/config: Normalization of verbose mode used to get
+ feedback about build context when using STLport.
+ _STLP_VERBOSE_AUTO_LINK has been renamed in _STLP_VERBOSE and
+ report additional information like rtti, exception support,
+ mono/multi threaded, static/dynamic library.
+
+ * stlport/stl/_check_config.h: Unused, removed.
+
+ * stlport/typeinfo: Report use of this header when there is no
+ RTTI support, only when we can detect it of course.
+
+2008-02-29 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/Makefiles/gmake: Several modif for Digital Mars support.
+
+ * stlport/stl/_function_base.h: Hide protected constructor not
+ supported by Borland compiler.
+
+ * stlport/stl/config/_bc.h: Now detect Rtti support.
+
+2008-02-28 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/gcc.mak: use more convenient option
+ -dumpversion to detect compiler's revision; check that
+ -fuse-cxa-atexit really required; remove -fident option;
+
+ * build/Makefiles/gmake/targetdirs.mak: take into account DESTDIR;
+
+ * build/lib/configure: write DESTDIR as prefix for installation pathes;
+
+ * stlport/type_traits: type traits, close to JTC1/SC22/WG21
+ C++ 0x working draft
+ [http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2008/n2521.pdf]
+
+2008-02-26 Francois Dumont <dums@users.sourceforge.net>
+
+ * Rationalization in detection of real localization implementation.
+ _STLP_REAL_LOCALE_IMPLEMENTED removed, the whole detection mecanism
+ is now in c_locale.h/c_locale.c and is based on API specific macros.
+ For the moment real localization is used for windows platforms
+ (_STLP_WIN32 except Windows CE) and when Glibc 2.2 or newer with
+ GNU extensions (_GNU_SOURCE) is detected.
+
+2008-02-25 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/type_traits.h: Generalize technique used by Borland
+ compiler to detect pointer types const or volatile qualified and
+ avoid trivial copy in this case.
+
+ * Eric Sanford patch for Borland compiler for Linux.
+
+2008-02-22 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/c_locale.h, src/c_locale.h,
+ c_locale_win32/c_locale_win32.c, c_wlocale_win32.c: Major code
+ simplification. Definition of _Locale_UPPER, _Locale_LOWER, etc...
+ used to be platform dependant requiring a lot of macro checks and
+ additionnaly exposing STLport to wrong definitions. When for
+ instance _Locale_PRINT was defined as
+ _Locale_UPPER|_Locale_LOWER|..., marking a character as printable
+ was also making it a upper and lower character!
+ In fact those masks have to be platform specific only when
+ STLport directly expose platform masks which is only the case when
+ using GlibC. So now those mask are hard coded in STLport using
+ values defined in the C++ Standard 22.2.1. Under Windows the
+ localisation implementation has been adapted to map Win32 mask values
+ to the STLport ones. A number of now useless workaround has been
+ removed.
+
+ * src/c_locale_dummy/c_locale_dummy.c, ctype.cpp,
+ test/unit/ctype_facets_test.cpp: Removed the hard coded table of
+ character types that was duplicating the one in src/ctype.cpp. Now
+ a table is build during library initialisation using C functions
+ isspace, isalpha... Doing so and adding a test in
+ LocaleTest::ctype_by_name will show if STLport and the C runtime
+ agree on character classification.
+
+2008-02-20 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/allocators.cpp: Change management of _S_heap_size, now bit
+ translation is done on the value used to increment it rather than
+ when using _S_heap_size. Thanks to this modif, when _S_heap_size is only a 32
+ bits value it won't roll before 16Go has been allocated. Thanks to
+ an additional unsigned cast the effect won't be notice before 32 Go
+ are allocated.
+
+2008-02-19 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale_dummy/c_locale_dummy.c: Fix implementation of
+ _WLocale_toupper/_WLocale_tolower, call to respectively
+ towupper/towlower was inverted.
+
+ * src/allocators.cpp: __stlp_chunk_malloc/__stlp_chunck_free
+ renamed respectively in __stlp_new_chunk/__stlp_delete_chunck as
+ those functions behavior are closer to the new operator behavior
+ rather than to malloc. __stlp_new_chunk implementation fixed, it
+ was using _STLP_CHECK_NULL_ALLOC reserved to check allocations
+ performed through new operator. Fix code to correctly take into account
+ bad_alloc exceptions.
+
+2008-02-18 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_algobase.h: Removed namespace specification on
+ swap invocation in iter_swap implemenation because it was breaking
+ template function resolution for gcc. Whether this is a gcc bug
+ or simply correct Standard C++ is not clear yet so namespace has
+ been removed independant of compiler in use.
+
+ * stlport/stl/_alloc.h, _new.h, src/locale.cpp, locale_impl.cp:
+ Generalize use of _STLP_THROW_BAD_ALLOC macro to throw the
+ bad_alloc exception. Definition of this macro is now in _new.h
+ header.
+
+ * stlport/stl/_valarray.h: Use __stl_new rather than malloc to get
+ exception management without additional code. It also gives users
+ a Standard way to detect memory starvation through the new handler.
+
+2008-02-16 Francois Dumont <dums@users.sourceforge.net>
+
+ * Removed anachronous and unmaintained raw SGI allocator mode.
+
+2008-02-15 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/details/fstream_win32io.cpp: Fix wrong use of Win32 API.
+ SetFilePointer do not take SEEK_CUR macro but FILE_CURRENT.
+
+ * src/allocators.cpp, stlport/stl/_alloc.h, _alloc_old.h,
+ _construct.h, _new.h, _pthread_alloc.h, _rope.h, config/_evc.h,
+ features.h: Code cleanup; __THROW_BAD_ALLOC normalized in
+ _STLP_THROW_BAD_ALLOC; _STLP_NEW, _STLP_PLACEMENT_NEW and
+ _STLP_BROKEN_BAD_ALLOC_CLASS macros removed.
+
+2008-02-14 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale_glibc/c_locale_glibc2.c: Manualy handle the "C" locale
+ to guaranty consistency with the default "C" facet implementations in
+ the lib.
+
+ * * test/unit/time_facets_test.cpp, num_facets_test.cpp,
+ monetary_facets_test.cpp, ctype_facets_test.cpp: Enhance tests by using
+ a third way of generating locale instance from names.
+
+2008-02-13 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/fstream_impl.h, details/fstream_win32io.cpp,
+ fstream_unitstd.cpp, fstream_stdio.cpp, stdio_streambuf.cpp: __stdin_size
+ function revomed making fstream_impl.h useless.
+
+2008-02-12 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/type_manips.h, type_traits.h: Borland patch from Eric
+ Sanford to fix regressions introduced with recent modifications of
+ some helper struct used to detect potential optimizations.
+
+ * config/_bc.h, features.h: New configuration, Borland do not support
+ following syntax:
+ typename std::iterator_traits<>::value_type. It breaks on association
+ of typename keyword with namespace specification. As Borland do not
+ require typename keyword in this case it is now possible avoid it
+ thanks to the _STLP_NO_TYPENAME_BEFORE_NAMESPACE macro.
+
+ * stlport/stl/_limits.c: Borland, like gcc 4, prefer additional brackets
+ in initialization of struct associated to computation of numeric limits
+ values.
+
+2008-02-01 Francois Dumont <dums@users.sourceforge.net>
+
+ * General code review to look for Standard or internal functions
+ called with namespace scope in order to avoid ambiguous calls
+ when compiler implement Argument Dependant Lookup. See ListTest::adl
+ test case to see what it means.
+
+ * stlport/stl/config/features.h: _STLP_PRIV now contains full
+ namespace path starting at global namespace that is to say
+ ::stlport::priv:: when private namespace is in use and ::stlport::
+ when it is not. Idem for _STLP_TR1 that now contains ::stlport::tr1::.
+
+ * stlport/stl/debug/_string.h: Call to std::distance removed to avoid
+ reading input iterators before reading their contents. Now all
+ basic_string::assign methods invalidate all iterators like other
+ containers.
+
+ * stlport/stl/_iterator_base.h: Remove implementation of __value_type
+ __distance_type and __iterator_category when compiler support partial
+ template specialization. In this case we directly use iterator_traits,
+ we do not need those functions. Removed special __distance implementations
+ use in an anachronous implementation of distance taking an initial value
+ to start counting. Now this function use __distance functions already
+ used by the std::distance function. The MSVC _Distance function is also
+ considered as anachronous.
+
+2008-01-31 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_string.h, test/unit/string_test.cpp: Add swap
+ implementation when there is no support for template function
+ partial ordering.
+
+2008-01-30 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/fstream_impl.h, details/fstream_stdio.cpp, fstream_unistd.cpp,
+ fstream_win32io.cpp, stdio_streambuf.h, stdio_streambuf.cpp: Hide
+ __is_regular_file only used in fsteam implementation specific files.
+ Rename __file_size in __stdin_size as this function is only used
+ to get stdin FILE* size. Under Win32 this function now always returns
+ 0 as it looks like Windows do not consider FILE* as allowing
+ position operations. Move platform specific code from stdio_streambuf
+ implementation to associated fstream_*.cpp file.
+
+2008-01-29 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/test/unit/gcc.mak: option for run-time path to libstlport
+ on HP-UX;
+
+ * build/Makefiles/gmake/hp-ux/targetsys.mak: HP-UX IA64 use so
+ as shared object extention, while PA-RISC use sl;
+
+ * build/Makefiles/gmake/gcc.mak: use -fno-reorder-blocks for PA-RISC;
+
+ * src/cxa.c: use cxa_atexit fix similar to trick on Solaris and FreeBSD;
+
+ * src/num_get_float.cpp: stdint.h on HP-UX;
+
+ * stlport/wctype.h, stlport/stl/_cwctype.h: HP-UX has problems with
+ wchars; changes suggested by KBac.
+
+2008-01-28 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/_cygwin.h: Cygwin do not define _STLP_USE_GLIBC
+ anymore, platform API is closer to a Standard C lib than to the Gnu
+ lib C.
+
+2008-01-26 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/fstream_stdio.cpp, fstream_win32io.cpp, fstream_unistd.cpp:
+ Removed unused uint64.h include and definition of ULL macro.
+
+ * src/uin64.h: Removed, _compound_int class defined in it is simply
+ not used anymore.
+
+ * src/_stdio_file.h: Major cleanup, only _FILE_fd is still in use.
+
+ * src/locale.cpp, locale_impl.cpp, build/lib/Makefile.inc: Restore
+ independency between those 2 translation units, code duplication is
+ very limited. This is a 1st step to make build of STLport easier by
+ having all sources in src folder buildable.
+
+ * src/locale_impl.h, locale_impl.cpp: _copy_Locale_impl removed,
+ only use to create initial global locale that can simply reference
+ classic locale incrementing its reference counter by one.
+
+ * stlport/stl/_locale.h: Fix locale implementation when MSVC6 workaround
+ is used. The base class _NoMem_loc do not have to have a virtual
+ destructor, it only need a protected one. Moreover fix constructor
+ taking an other locale instance and a facet instance, _M_impl was
+ not released before being assigned resulting in a memory leak.
+
+ * src/fstream_stdio.cpp, fstream_unistd.cpp, fstream_win32io.cpp:
+ Moved to details sub-folder. Now building STLport means build all
+ .cpp, .c and optionnaly .rc files from src folder.
+
+2008-01-22 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/test/unit/gcc.mak: check confguration and set
+ ALL_TAGS before inclusion top.mak, to correctly set
+ targets for 'all'.
+
+2008-01-21 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/test/unit/icl.mak: Add /fp:strict option to build unit tests
+ as we need strict floating point number operations respect to have
+ numeric limits to work correctly.
+
+ * stlport/stl/config/_intel.h: Looks like ICL since version 9 support
+ static constant correctly.
+
+ * stlport/stl/config/features.h, src/c_locale_win32/c_locale_win32.c:
+ New macro _STLP_MARK_PARAMETER_AS_UNUSED to offer a compiler specific
+ way of marking parameters as unused. Default behavior is to cast the
+ parameter to void*.
+
+ * src/c_locale_win32/c_wlocale_win32.c: Fix _WLocale_strxfrm function
+ implementation thanks Kai Khcyt. Despite taking a pointer to wchar_t*
+ LCMapStringW writes bytes to it.
+
+ * build/Makefiles/gmake/bcc.mak, lib/bcc.mak, app/bcc.mak, stlport/cerrno,
+ errno.h, stl/type_manips.h, type_traits.h: Borland patch from Eric
+ Sanford to build Borland libs with GNU make build system.
+
+2008-01-18 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/locale_test.cpp, ctype_facets_test.cpp,
+ money_facets_test.cpp, num_facets_test.cpp, time_facets_test.cpp:
+ test_supported_locale function do not have to be template, might
+ avoid ICL wring code generation.
+
+ * stlport/stl/_function_base.h: Based on an idea from Herb Sutter in
+ his excellent book "Exceptional C++ Style", derived class destructor
+ should be protected non virtual or public virtual. unary_function
+ and binary_function struct are intended to be derived but they
+ are not polymorphic so destructor should be protected non virtual.
+ According the book it is even not breaking library Standard conformity
+ in doing so. What is sure is that it will help users detect bad
+ code.
+
+2008-01-17 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/debug/_list.h: Remove use of std::distance in STL
+ safe mode, it is invalid for pure input iterators. Now assign
+ invalidate all iterators which make the code simpler.
+
+ * Remove the difficult to implement and maintain _AreSameUnCVTypes,
+ doing so has a number of impact on the lib:
+ - Remove usage of it in debug/_string.h and debug/_deque.h, we
+ rather use function specialization to detect self reference. In string
+ implementation it is almost impossible to detect self referencing in
+ insert and assign method even with use of _AreSameUnCVTypes, so
+ we systematically creation an intermediate string instance.
+ - Creation of _AreCopyable helper class to detect when it is safe
+ to do a memcpy or memmove between 2 types. This class returns false
+ when any type is volatile qualified or when trying to copy to a const
+ qualified type.
+ - Creation of _AreSameTypes only really implemented thanks to partial
+ template specialization, only used in _IsOkToSwap struct.
+
+ * test/unit/copy_test.cpp: Add test showing bug 1806558.
+
+2008-01-17 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/lib/configure: Don't override COMPILER_NAME, if already
+ defined;
+
+ * stlport/stl/config/_prolog.h: remove suspicious comments.
+
+2008-01-15 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/config/_hpux.h: define _POSIX_C_SOURCE 199506;
+ suggested by KBac, patch #1869229.
+
+2008-01-14 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_string.h, _string.c: Restore code to support non-POD
+ types in basic_string implementation as specified in basic_string
+ comments.
+
+ * stlport/stl/_limits.c: Use double numeric limits for long double
+ when sizeof(double) == sizeof(long double).
+
+ * stlport/stl/debug/_debug.h, _deque.h, _list.h, _vector.h: Prefer to
+ use overloading of member method to activate additional check of
+ 23.1.1 table 67 Standard conformity rather than using metaprogrammng
+ technique.
+
+2008-01-12 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/lib/gcc.mak: gcc 3.3 has useful
+ libsupc++, but some builds not; prefer normal situation,
+ not marginal; see record 2007-10-10;
+
+ * build/Makefiles/gmake/gcc.mak: fix reference to _FORCE_CXX macro;
+
+ * build/Makefiles/gmake/CC.mak: ditto;
+
+ * build/Makefiles/gmake/aCC.mak: ditto;
+
+ * build/lib/configure: keep compiler and default compiler --- gcc
+ is most common defualt and plans to switch to default makefile.
+
+2008-01-11 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_limits.c: Adapt long double numeric limits for
+ Intel C++ compiler 9 for Windows.
+
+ * test/unit/cppunit/test_main.cpp: Add command usage output when
+ option is not recognise.
+
+ * build/lib/configure: Remove specification of COMPILER_NAME default
+ value gcc. COMPILER_NAME is already set in all root make scripts like
+ gcc.mak, aCC.mak, dmc.mak ... Doing so forces users to specify their
+ compiler family using configure script which is redundant.
+
+2008-01-10 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_prolog.h: Remove code duplication by including
+ _cprolog.h.
+
+ * stlport/errno.h, cerrno: Move import of errno from errno.h to
+ cerrno.
+
+ * src/ctype.cpp, facets_byname.cpp, time_facets.cpp,
+ test/unit/codecvt_test.cpp: Several small modifications to make
+ Intel C++ compiler happier. Mostly avoid warnings and use
+ unary_function to avoid some typedef.
+
+2008-01-09 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_uninitialized.h: Fix implementation of
+ __uninitialized_copy_copy in order to make the function exception
+ safe. Detected thanks to the EH test suite.
+
+2008-01-08 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_ios_base.h: _S_was_synced renamed in _S_is_synced
+ because it reflects what the sync state is and not what it was.
+
+ * src/iostream.cpp: Use auto_ptr to avoid use of the catch(...)
+ blocks. Changed management of the _STLP_REDIRECT_STDSTREAMS macro.
+ cout, cerr and clog streams are not ofstream anymore but classic
+ ostream instances, only streambuf is a filebuf when the macro is
+ defined. Improve _S_initialize robustness to exceptions, now
+ exceptions like bad_alloc are not silently eaten. _S_initialize
+ guaranty that on exception, Standard streams will be valid, it do
+ not offer however strong guaranty, global state might still have
+ been modified. Idem for sync_with_stdio. Moreover this method is
+ now Standard compliant, it returns the new sync state and not the
+ old one.
+
+2008-01-07 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale_dummy/c_locale_dummy.c: Upgrade to take into account
+ recent localization Api modifications.
+
+2008-01-04 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/fstream_win32.cpp: Change detection of regular file, only reject
+ handlers identified as folders.
+
+ * stlport/stl/_codecvt.h: Add assertion to check buffer ranges pass to
+ the codecvt facet.
+
+ * src/fstream.cpp, stlport/stl/_fstream.c: Complete bug #1854345 fix,
+ get buffer was not reset at the right place.
+
+ * stlport/stl/_fstream.h, _fstream.c: Several modifications in the
+ seekoff method:
+ - Remove limitation of positioning to binary file stream, setting
+ position in a text file stream is not a problem.
+ - Fix mbstate_t instance returned in the file_pos instance when
+ getting position in a file stream with variable encoding.
+ - Move all the sanity check code to the debug mode.
+
+2008-01-02 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/fstream_test.cpp: Change FstreamTest::seek test to reveal
+ bug #1854345.
+
+ * src/fstream.cpp: #1854345 bug fixed.
+
+2008-01-01 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_time_facets.h, _time_facets.c, src/time_facet.cpp,
+ c_locale_glibc/c_locale_glibc2.c: Restore GlibC++ support after
+ 2007-12-27 modifications.
+
+2007-12-29 Francois Dumont <dums@users.sourceforge.net>
+
+ * Borland patch from Eric Sanford mainly to enable move constructor.
+
+ * stlport/stl/_string_base.h, _string.h, _string.c,
+ _string_sum_methods.h: Attempt to make string implementation more
+ clear: _M_allocated renamed in _M_start_of_storage,
+ _M_Buffers._M_dynamic_buffer renamed in _M_Buffers._M_end_of_storage,
+ _M_end_block renamed in _M_end_of_storage too. To respect current
+ naming convention _capacity has been renamed in _M_capacity and
+ _rest in _M_rest.
+
+ * stlport/stl/_string_workaround.h: Updated to take into account recent
+ modification in string data model.
+
+ * etc/autoexp.dat: Updated to take into account string data model
+ modifications, new model is really simpler to map to.
+
+2007-12-27 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale.h, c_locale_dummy/c_locale_dummy.c,
+ c_locale_glibc/c_locale_glibc.c, c_locale_glibc2.c,
+ c_locale_win32/c_locale_win32.c, facets_byname.cpp, time_facets.cpp,
+ stlport/stl/_codecvt.h, _ctype.h, _numpunct.h, _time_facets.c,
+ _time_facets.h: Major internal localization API modification. Add
+ several _WLocale_* functions to allow native support of access to
+ wide char representation of localization information. The time facet
+ support has been the most impacted. GlibC based implementation
+ still have to be updated.
+
+2007-12-23 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/Makefiles/nmake/evc8.mak, targets.mak, src/_stdio_file.h,
+ fstream_win32io.cpp, iostream.cpp, locale_catalog.cpp: Patch from
+ Johan Anderson for Evc 3/4/8 to:
+ - fix the opening console issue on this platform.
+ - add EVC8 SH4 support.
+
+ * test/unit: Add CPPUNIT_FAIL macro to force failure without
+ using a constant conditional expression. Many tests updated to
+ use this new macro.
+
+ * stlport/stl/config/_evc.h, debug/_debug.h, _debug.c: Patch
+ from Michael Fink to allow _STLP_DEBUG mode when using WCE ARM
+ platform.
+
+2007-12-20 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_monetary.c: Remove test of existing space at end of
+ stream when last pattern field is none because on ouput stream
+ space are only added optionaly. Small code duplication removed.
+
+ * build/lib/configure.bat, evc.mak, msvc.mak, test/unit/evc.mak,
+ msvc.mak: Config file moved to Makefiles/nmake folder. Add
+ --without-stlport option to build unit tests without STLport.
+
+ * test/unit/money_facets_test.cpp: Add validation that moneypunct
+ "C" facet is identical to the one contained in locale::classic().
+
+ * src/c_locale_dummy/c_locale_dummy.c,
+ c_locale_win32/c_locale_win32.c, facets_byname.cpp: Fix to have
+ moneypunct by name facet build from "C" similar to locale::classic()
+ one. Now default format in _Init_monetary_formats is the C++ default
+ one.
+
+2007-12-20 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/fstream_test.cpp: test for seek, inspired by Soren
+ (stsoe, #1854345); report not confirmed.
+
+2007-12-17 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_limits.c: Add brackets on union initialization for gcc
+ starting with version 4.
+
+2007-12-17 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/config/_linux.h: if not explicitly specified another,
+ use threads.
+
+2007-12-14 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale_win32/c_locale_win32.c: Fix implementation of
+ _Locale_mbtowc and _Locale_wctomb functions. Reveal limitation of
+ the MultiByteToWideChar function that cannot be used to implement
+ more complicated encodings that have a real shift state like the
+ JIS one. Add support for UTF7 and UTF8 encodings.
+
+ * test/unit/codecvt_test.cpp: New test case to check support for
+ 2 encodings, the Windows specific code page 936 and the UTF8 one.
+ Those tests are coming from chinese test samples proposed by Victor
+ Xie.
+
+2007-12-14 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_string_base.h, stlport/stl/_string.h, stlport/stl/_string.c:
+ experimental string buffer---start of buffer in _M_allocated._M_data now,
+ end of buffer either end of local short buffer, or stored in pointer
+ within local short buffer; this potentially reduce amount of pointer
+ arithmetic; prefer Traits::assign to uninitialized fill, it more
+ optimized for POD types, such as chars [experimental too].
+
+2007-12-13 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale.h, c_locale_dummy/c_locale_dummy.c,
+ c_locale_glibc/c_locale_glibc.c, c_locale_glibc2.c,
+ c_locale_win32/c_locale_win32.c: Remove unused _Locale_wctob and
+ _Locale_btowc localization API functions.
+
+2007-12-13 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/test/unit/gcc.mak, test/unit/...: allow build unit tests
+ with libstdc++, without STLport; useful for reference and comparison.
+
+2007-12-12 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/unix/rules-install-so.mak, build/lib/gcc.mak:
+ install-headers usable; it use user-defined macro HEADERS_BASE
+ [catalog and all files, keeping directory structure] and HEADERS
+ [for single files]; target catalog is INSTALL_HDR_DIR, by default
+ it is ${BASE_INSTALL_DIR}/include.
+
+2007-12-07 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_uninitialized.h: comment unused parameter;
+
+ * stlport/stl/_limits.c: 64-bits systems may has [and really has]
+ size of long double 16, not 12; but IEEE 854 still in force, and
+ only 10 bytes of long double taken into account. This should fix
+ limits<long double> on 64-bits systems. Thanks joebishop
+ [aka Denis Cheremisov] for granted access to 64-bit linux.
+
+2007-12-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale_glibc/c_locale_glibc2.c: Fix a one byte memory overrun
+ when passing a very locale name.
+
+ * src/c_locale_win32/c_locale_win32.c: Simplified Win32 localization
+ code. Remove useless calls to strcpy. Remove useless call to the
+ __Extract_locale_name once in the _Locale_*_create functions as
+ name has already been extracted at this moment.
+
+2007-12-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale_glibc/c_locale_glibc2.c: Removed many checks useless
+ as the C functions are called in a well defined and safe context. Also
+ remove useless strcpy calls when it is safe to return the internal
+ string.
+
+2007-12-04 Francois Dumont <dums@users.sourceforge.net>
+
+ * Add the _Locale_codecvt localization data structure for 2 purposes:
+ - in the win32 implementation it simplify _Locale_ctype data structure.
+ - in the glibc implementation it helps making clear that this
+ implementation do not support the codecvt facet for the moment.
+
+2007-12-03 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/fstream_win32io.cpp: Fix management of Ctrl-Z when reading
+ text file stream thanks Hector Chu patch.
+
+2007-11-30 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/acquire_release.h, facets_byname.cpp, locale.cpp,
+ locale_impl.cpp, locale_impl.h, messages.cpp, time_facets.cpp:
+ Localization code modification, now locale instances will adopt
+ a normalized name rather than the name used to create them. This
+ way identical locale instances will compare equals even if created
+ from name aliases like 'french' and 'fr_FR'. Moreover default
+ locale built from an empty string won't have an empty name.
+
+ * test/unit/locale_test.cpp, ctype_facets_test.cpp,
+ money_facets_test.cpp, num_facets_test.cpp, time_facets_test.cpp:
+ Enhance localization tests, add test of default locale when possible.
+ Add test for the locale instances built from a mix of the
+ locale::classic instance and a named category.
+
+2007-11-27 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_ios_base.h, _ios.c: Add qualification on the cached
+ ctype and numpunct facets, we can keep them as const pointers.
+ Moreover, prefer to use the use_facet function rather than _M_get_facet
+ to access those instances to avoid direct reference to the facet::id
+ static instance.
+
+ * Some evolution in the localization code:
+ - Hide _Locale_name_hint in internal implementation, facets *_byname
+ constructor are now respecting the C++ Standard signature.
+ - numpunct facet: Remove unused _M_grouping field, move hard coded
+ values of the "C" facet in the sources. Only the numpunct_byname<wchar_t>
+ keeps internal wstring representation of true and false names.
+ - time facets: Use the non template time_base class for initialization
+ of the _Time_Info instance, it is more coherent with other facets
+ implementations. Many functions like __acquire_time and __release_time
+ are now hidden in the library.
+
+2007-11-26 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/char_traits.h, _stdexcept_base.c: Borland patch
+ from Eric Sanford, add a missing header and change
+ __Named_exception implementation because of a Borland compiler
+ bug.
+
+ * src/c_locale_win32/c_locale_win32.c: Add LANG_INVARIANT
+ definition when SDK are missing it.
+
+2007-11-24 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_monetary.h: Add missing explicit keyword on
+ money_get and money_put constructors.
+
+ * stlport/stl/_numpunct.h: Removed friend relation between
+ numpunct and num_get, looks like it is useless with current
+ implementation.
+
+ * stlport/stl/config/stl_mycomp.h, features.h, _watcom.h, _sunprocc.h,
+ _mwerks.h, _msvc.h, _ibm.h, _dec_vms.h, _dec.h, _as400.h: Removed
+ _STLP_NO_FRIEND_TEMPLATES, _STLP_FRIEND_TEMPLATES macros unused
+ since fix above regarding numpunct/num_get friend relation.
+
+ * test/unit/collate_facets_test.cpp: Fix "C" facet by name test,
+ Standard do not define any special behavior for the "C" transform
+ method so transformed result should simply follow the normal transform
+ behavior.
+
+ * src/locale_impl.cpp: Removed useless holes in locale facets table.
+ Now the table contains 26 non null entries rather than 38 entries with
+ some begin null.
+
+2007-11-23 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/locale.cpp, locale_impl.h, locale_impl.cpp: Some small
+ modifications to limit necessary friend class _Locale_impl
+ declaration in several facet classes. Moreover, num_get, num_put,
+ money_get, money_put facets that do not depend on any name are
+ not allocated anymore in the functions responsible for generating
+ facets for a given category.
+
+ * stlport/stl/_codecvt.h, _collate.h, _ctype.h, _messages_facets.h,
+ _monetary.h, _num_get.h, _num_put.h, _numpunct.h, _time_facets.h:
+ Removed many useless friend class _Locale_impl declarations.
+
+2007-11-23 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/lib/configure: make configuration suitable for installation
+ procedure and package building.
+
+2007-11-22 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale_dummy/c_locale_dummy.c: Now implements the "C" locale
+ to respect the C++ Standard.
+
+ * test/unit/collate_facets_test.cpp: Fix test checking that collate
+ facet build from the "C" name behave like the one coming from the
+ locale::classic() locale.
+
+ * src/c_locale.h, locale.cpp, c_locale_glibc/c_locale_glibc.c,
+ c_locale_glic2.c, c_locale_win32/c_locale_win32.c, locale.cpp: Removed
+ _Locale_compose_name from the STLport internal localization API.
+ Composition of locale names will now be the responsibility of STLport
+ itself and not of the platform localization implementations one.
+
+2007-11-20 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_iterator_base.h, _ptrs_specialize.h: Avoid inclusion
+ of _ptrs_specialize.h while still in stlport namespace scope thanks
+ Christof Meerwald report.
+
+2007-11-17 Francois Dumont <dums@users.sourceforge.net>
+
+ * _STLP_STATIC_MEMBER_DECLSPEC workaround removed. Thanks to
+ _GetFacetId other workaround it should now be useless. There
+ are still some tests to confirm especially testing the
+ gcc visibility feature.
+
+2007-11-16 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_fstream.c: Fix implementation of
+ basic_filebuf<_CharT, _Traits>::_M_underflow_aux() to take
+ into consideration already read external buffer even if
+ reading from file failed. Thanks Hector Chu report and patch.
+
+ * test/unit/codecvt_test.cpp: New test for problem above,
+ CodecvtTest::imbue_while_reading thanks Hector Chu.
+
+ * test/unit/fstream_test.cpp: Remove useless
+ FstreamTest::special_encoding test replaced by new test in
+ CodecvtTest. Fix FstreamTest::custom_facet test that is now using
+ a specialization of codecvt rather than a class inheriting from
+ codecvt.
+
+2007-11-14 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale_win32/c_locale_win32.c: Fix to support creation
+ of locale facet from the 'C' name.
+
+ * test/unit/collate_facets_test.cpp, locale_test.cpp,
+ money_facets_test.cpp, num_facets_test.cpp, time_facets_test.cpp:
+ Add test to check build from names "" or "C", on platform without
+ real localization support, "" should result in "C". Also check
+ for some facets that the one build from "C" name is similar to
+ the one taken from locale::classic() locale.
+
+2007-11-12 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/fstream_test.cpp: testcase for bug #1830513;
+ __read_unbuffered wrongly process valid streamsize 0;
+ [was derived from original report of Anton Samokhvalov and Oleg Obolenskiy]
+
+ * stlport/stl/_istream.c: fix for bug #1830513 above;
+ check boundary condition in the beginning of loop.
+
+2007-11-09 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/Makefiles/gmake: Add missing cygming folder comming
+ from task branch, required for Cygwin/MinGW builds.
+
+ * stlport/stl/_bvector.h, _deque.h, _hashtable.h, _list.h,
+ _rope.h, _slist.h, _string_base.h, _tree.h, _vector.h: Removed
+ useless instantiation of _Alloc_traits to define nested
+ allocator_type in several containers. STLport users will simply
+ have to correctly instantiate containers when they specify
+ the allocator to use.
+
+2007-10-30 Francois Dumont <dums@users.sourceforge.net>
+
+ * etc/autoexp.dat: New file containing description of STLport
+ data structures in the Visual Studio C++ debugger language.
+
+2007-10-21 Francois Dumont <dums@users.sourceforge.net>
+
+ * Merged with STLPORT_5_1 up to revision 3229.
+
+2007-10-20 Francois Dumont <dums@users.sourceforge.net>
+
+ * _STLP_NO_MBSTATE_T removed, STLport cannot really live without
+ any mbstate_t definition. Moreover we were already defining our own
+ definition when _STLP_NO_MBSTATE_T is defined, we now simply generalize
+ this behavior. So definition of _STLP_NO_MBSTATE_T has been replaced
+ with _STLP_NO_NATIVE_MBSTATE_T.
+
+2007-10-14 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/bitset.cpp: Add const qualifier on static arrays used in
+ bitset implementation. Thanks a Andrey Semachev remark.
+
+2007-10-12 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_hash_map.h, _hash_set.h, _unordered_set.h,
+ _unordered_map.h: Because of the hashtable data model, number
+ of bucket should not be to high compare to the number of
+ elements. For this reason, default constructor of all hash
+ containers is now passing 0 as the initial size rather than 100.
+
+ * stlport/stl/_hashtable.h, _hashtable.c: For the same reason exposed
+ above, the hashtable number of buckets is decrease when removing
+ elements from the container. All is done in the newly introduce
+ _M_reduce method that should be called each time elements are
+ removed.
+
+ * test/unit/unordered_test.cpp: Two new test in UnorderedTest test
+ fixture, benchmark1 and benchmark2. Those tests are rather, as indicated
+ by their name, bench to compare performance of hashed containers.
+ It can be used with the -m unit test console option that display
+ timing of tests. For instance, thanks to the reduction policy exposed
+ above, benchmark1 is running 20 times faster while benchmark2 is
+ almost identical.
+
+ * stlport/stl/_hashtable.h: Container might now be rehash when user
+ modified max load factor in order to respect
+ load_factor() <= max_load_factor() rule. hashtable::resize fixed,
+ according SGI doc it should behave as Standard unordered_*::rehash that
+ is to say it gives number of buckets and not number of elements.
+
+ * stlport/stl/_hashtable.c: Fix Code warrior workaround that was only
+ showing a limited number of prime numbers.
+
+2007-10-10 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles: merge r2883:3223 from tasks/STLport-Makefiles;
+ revision of build system, from 'complement' project, adopted for
+ STLport requirements; support build of static lib and build unit
+ tests with this lib; gmake-specific files moved into gmake catalog;
+ top.mak (gmake-specific) moved into gmake catalog; add include
+ option for boost's headers, if STLP_BUILD_BOOST_PATH defined;
+ config.mak has make-dependent features, so it moved to gmake or
+ nmake catalog; settings from gmake/windows/sysid.mak should
+ be present in common gmake/sysid.mak file; gcc 3.3 has bad or
+ absent libsupc++, at least in debian; don't use -lstlport, when
+ build it; removed windows platform support that used to represent
+ the environment given by the cmd shell with MinGW additional commands
+ i.e. MinGW require not only gmake, but other POSIX file utils too;
+ install target by default install to /usr/local/lib on POSIX-like
+ platforms; added distclean target; added install-headers target;
+
+ * build/test/unit: top.mak (gmake-specific) moved into gmake catalog;
+
+ * build/test/unit/gcc.mak: see just build stlport libs, not
+ installation path [default install path is /usr/local/lib on POSIX-like
+ platforms].
+
+2007-10-07 Francois Dumont <dums@users.sourceforge.net>
+
+ * 5.1.4 released, trunk merged with STLPORT_5_1 branch up to
+ revision 3221.
+
+2007-10-04 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_codecvt.h, _fstream.c, src/codecvt.cpp: Fix non
+ Standard conformity in codecvt::length and associated
+ codecvt::do_length methods. Those methods was taking const reference
+ to mbstate_t but the Standard specify that it must be a simple
+ reference.
+
+ * src/facets_byname.cpp: Add a real implementation of
+ codecvt<wchar_t, char, mbstate_t>::do_length based on the
+ _Locale_mbtowc locale API function.
+
+ * test/unit/codecvt_test.cpp: Add a test for codecvt::length.
+
+ * test/unit/fstream_test.cpp: Add a test that indirectly test
+ codecvt facet and integration of it in the basic_filebuf
+ implementation.
+
+2007-10-02 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/deque_test.cpp, hash_test.cpp, list_test.cpp, map_test.cpp,
+ set_test.cpp, slist_test.cpp, unordered_test.cpp, vector_test.cpp:
+ Allow test on incomplete types even when pointer specialization is
+ activated as long as partial template specialization is supported.
+
+ * stlport/stl/_fstream.c, src/facets_byname.cpp,
+ test/unit/codecvt_test.cpp:
+ Fixed codecvt_byname<wchar_t, char, mbstate_t>::do_in and do_out
+ methods. They now both correctly take into account to_end pointer.
+ Thanks Vistor (finalvistory) report on sourceforge Developer forum.
+
+2007-09-28 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/num_put_float.cpp: Modification in _Stl_ecvtR and _Stl_fcvtR
+ long double overloads, if value can be converted to double without
+ precision loss we can rely on the double overload. Moreover _Stl_fcvtR
+ has been fixed.
+
+ * stlport/stl/pointer/_tools.h: Use class partial specialization to
+ enhance usability of the container pointer specialization feature.
+ Thanks to it, container can be instanciated with incomplete types.
+ Modification based on bug report 1799048 from Andrey Semashev.
+
+ * trunk merged with STLPORT_5_1 up to revision 3211.
+
+2007-09-27 Francois Dumont <dums@users.sourceforge.net>
+
+ * src: Modification in the internal localization API.
+ _Locale_errno removed, now an int pointer is passed to all
+ _Locale_*_create and all _Locale_extract_*_name functions so
+ that they can return an error code. This method avoid multithreaded
+ issues.
+
+ * src/locale_catalog.cpp: Modification in __acquire_category
+ function. If create_obj return null, the null pointer is not
+ stored anymore in cached as creation failure reason might be
+ temporary like in case of memory starvation.
+
+ * stlport/stl/_locale.h: Error reporting enhancement. In combine
+ method we use a typeid call to report the unknown facet type. In other
+ situation we report both the facet category being built and the name
+ used to build it.
+
+ * test/unit/locale_test.cpp, collate_facets_test.cpp,
+ messages_facet_test.cpp, money_facets_test.cpp, num_facets_test.cpp,
+ time_facets_test.cpp: Add checks for construction of facets from
+ very long facet name.
+
+2007-09-27 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/find_test.cpp: array initialization missed.
+
+2007-09-19 Francois Dumont <dums@users.sourceforge.net>
+
+ * trunk merged with STLPORT_5_1 up to revision 3193.
+
+2007-09-11 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_algobase.c: keep check for symmetry in
+ lexicographical compare---algorithm assume symmetry comparator;
+ remove check for symmetrical comparator in search and find,
+ due to double checks not better then single (the same check
+ done in algorithm, and algorithm not require symmetrical
+ comparator);
+
+ * stlport/stl/debug/_hashtable.h: idem;
+
+ * stlport/stl/debug/_tree.h: idem;
+
+ * stlport/stl/debug/_debug.h: __symetrical_strict_weak_call
+ and __symetrical_equal_call not used anyware.
+
+2007-09-10 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_algo.c: Add check for symetrical functor
+ in max_element and min_element algo.
+
+ * stlport/stl/_algobase.c: Restore symetrical functor checks.
+ Sometimes simply because the algo was already considering the
+ functor as symetrical as in lexicographical_compare. Sometimes
+ using specific helpers functions (see below).
+
+ * stlport/stl/debug/_debug.h: Add __symetrical_strict_weak_call
+ and __symetrical_equal_call helper functions to check for
+ symetric functors only when invocating the symetrical functor
+ is valid that is to say when both parameters are of the same
+ type.
+
+ * stlport/stl/debug/_hashtable.h: Make use of
+ __symetrical_equal_call to check that equivalence functor used
+ in hashtable instanciation is correctly implemented.
+
+ * stlport/stl/debug/_tree.h: Make use of
+ __symetrical_strict_weak_call to check that functor predicate
+ use in tree instanciation is correctly implemented.
+
+2007-09-10 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_string.c: fix bugs in string rfind, find_last_of,
+ find_last_not_of [bug #1788700, position 0 was wrongly excluded];
+
+ * test/unit/string_test.cpp: test for problems above. Thanks
+ to Bred Bored for bug report and initial test.
+
+2007-09-09 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/rope_test.cpp, stlport/stl/_rope.h: test for
+ bug #1788615 [bug during copy of rope's iterator] and fix;
+ suggested by John Maddock.
+
+2007-09-07 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/alg_test.cpp: add #include <string>, required for
+ comparator symmetry test;
+
+ * test/unit/string_test.cpp: test for bug in find_last_of,
+ bug #1788700, submitted by Bred Bored.
+
+2007-09-05 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_algobase.c: symmetry not required for
+ comparator in case of two different sequences comparison or
+ searching; symmetrical comparator just may not exist;
+
+ * stlport/stl/debug/_hashtable.h: symmetry not required for
+ comparator in hashtable in case of containers extention;
+ symmetrical comparator just may not exist;
+
+ * test/unit/alg_test.cpp: test for problem above, thanks
+ Oleg Obolenskiy.
+
+2007-09-03 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/dll_main.cpp, stlport/stl/debug/_debug.c: removed
+ macro _STLP_STATIC_TEMPLATE_DATA, __PUT_STATIC_DATA_MEMBERS_HERE,
+ _STLP_NO_STATIC_TEMPLATE_DATA; only few old compilers
+ require this and are good enough to work with STL;
+
+ * test/eh/test_rope.cpp, stlport/stl/_num_get.c: idem;
+
+ * stlport/stl/_time_facets.c, stlport/stl/_codecvt.h: idem;
+
+ * stlport/stl/_monetary.c, stlport/stl/_num_put.c: idem;
+
+ * stlport/stl/_rope.c, stlport/stl/_rope.h: idem;
+
+ * stlport/stl/config/user_config.h: idem;
+
+ * stlport/stl/config/stl_mycomp.h: idem;
+
+ * stlport/stl/config/_gcc.h: idem;
+
+ * stlport/stl/_threads.c: idem.
+
+2007-09-02 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_algobase.c: Small optimization, add an
+ intermediate __eq function to detect when both iterator types
+ are identicals. Thanks Jim Xochellis idear.
+
+ * stlport/stl/_threads.h, _threads.c: Fully apply modification
+ of _S_nsec_sleep implementation for Win32 platforms contained
+ in bug report 1720635 from Taras Overchuck. It is an optimization
+ of the spin lock mutex specifically targetting the multiprocessor
+ platforms.
+
+2007-08-29 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_algobase.c, _string.c: Some modification in
+ __find_first_of_aux2 implementation to reduce number of iterator
+ dereferencements.
+
+2007-08-26 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/user_config.h, host.h: Moved administrative
+ _STLP_USE_UNIX_IO, _STLP_USE_STDIO_IO, _STLP_USE_WIN32_IO
+ macros to host.h.
+
+ * Merged with STLPORT_5_1 branch up to revision 3151.
+
+2007-08-23 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/debug/_vector.h: only random access iterators
+ allow operations 'less-then' and distance; for bidirectional
+ iterators removed usage of 'less-then', and for others
+ [like forward and input iterators] removed as usage of 'less-then'
+ as distance; thanks Oleg Obolenskiy for bug report;
+
+ * test/unit/ioiter_test.cpp: test for problem above.
+
+2007-08-18 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/host.h: Removed _STLP_NO_CYGWIN macro
+ unused since we are using include_next.
+
+2007-08-16 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/_gcc.h: Avoid conflict in link model, gcc
+ visibility for many platforms or dllimport/dllexport for
+ Cygwin/MinGW.
+
+ * build/Makefiles/gmake/gcc.mak: Looks like Cygwin/MinGW won't
+ support visibility for the moment.
+
+2007-08-15 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/char_traits.h, src/fstream_unistd.cpp: use 64-bits
+ file operations calls, if available on system; streamoff is
+ always off64_t, if _LARGEFILE_SOURCE or _LARGEFILE64_SOURCE
+ defined, i.e. if 64-bits file operations present;
+
+ * src/fstream_stdio.cpp, src/stdio_streambuf.cpp: ditto;
+
+ * stlport/stl/config/user_config.h: add _STLP_USE_DEFAULT_FILE_OFFSET,
+ force use off_t for streamoff and appropriate file operations calls;
+ note, that this may lead to problems, for example if _FILE_OFFSET_BITS
+ defined as 64 somewhere in user's code;
+
+ * test/unit/fstream_test.cpp: test 64 bits type for filesize and
+ file offset.
+
+2007-08-13 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/memory_test.cpp: MSVC6 do not support this test,
+ ignored.
+
+ * stlport/stl/_string.h: Internal _String_reserve_t moved to
+ private namespace.
+
+ * stlport/stl/_algobase.c, _string.c, char_traits.h: Adoption of
+ the find_first_of trick below in string::find_first_of, find_last_of,
+ find_first_not_of and find_last_not_of.
+
+2007-08-12 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_algo.h, _algobase.h, _algobase.c: find_first_of
+ algorithm enhancement based on the Jim Xochellis analysis that you
+ can find here:
+ http://www.codeproject.com/vcpp/stl/find_first_of.asp.
+
+ * test/unit/alg_test.cpp: Add several tests to challenge the above
+ enhancement.
+
+2007-08-08 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/feature.h: Removed useless workaround, there
+ is no more platform using Win32 threading API and missing bool
+ type.
+
+ * src/num_put_float.cpp, num_get_float.cpp: Fixes for DMC, DMC has
+ real long double so it now uses ieee854_long_double Glibc type. DMC
+ do not use anymore the sprintf workaround to write floating point
+ numbers.
+
+ * stlport/stl/_auto_ptr.h, test/unit/memory_test.cpp: Fix auto_ptr
+ implementation, removed a useless const_cast and change a reinterpret_cast
+ in static_cast. Add support for instanciation with the volatile qualifier.
+ Thanks Ulrich Eckhardt report.
+
+2007-08-03 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale_win32/c_locale_win32.c: Fix some static buffer size
+ to always have a free place for the trailing zero.
+
+ * test/unit/locale_test.cpp: Add a test when passing a very long name
+ as the LC_CTYPE facet name to the locale constructor.
+
+ * src/system_api.h, system_api.c, build/lib/Makefile.inc,
+ src/num_put_float.cpp: Removed system_api workaround to access
+ isinfinite, isnan, isinf C functions used with gcc under Hp unix.
+ Now __format_nan_or_inf has an implementation entirely based on
+ numeric_limits values that avoids access to platform functions.
+
+2007-07-30 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_facets_fwd.h, _num_put.h, _num_get.h, _monetary.h,
+ _time_facets.h, _locale.h: Fix _GetFacetId workaround for compilers
+ like gcc since 3.4 that consider only the context at point on template
+ definition and not at the point of instantiation when resolving
+ _GetFacetId calls in has_facet or use_facets template functions.
+
+2007-07-20 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_mbstate_t.h: We have to define mbstate_t ourself
+ on platforms having mbstate_t in cwchar when we want to only use
+ C headers.
+
+2007-07-22 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/fstream_unistd.cpp: force use lseek64/mmap64 for HP-UX,
+ if _LARGEFILE64_SOURCE defined; thanks for Michael Klein.
+
+2007-07-20 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/_gcc.h, stl_mycomp.h: Removed unused
+ _STLP_WEAK_ATTRIBUTE macro.
+
+ * stlport/stl/config/_msvc.h, _intel.h, _gcc.h, features.h: Some
+ cleanup concerning _STLP_STATIC_TEMPLATE_DATA macro.
+
+2007-07-18 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_num_put.h: Removed __string_to_float declarations only
+ used in a num_get context.
+
+ * src/num_get_float.cpp:
+ - Import Glibc ieee854_long_double union for compilers having a real
+ long double type but no runtime support to correctly generate it. This
+ union is used by gcc under Cygwin and MinGW and by Borland compiler.
+ - _Stl_string_to_long_double removed, it was so similar to
+ _Stl_string_to_double that everything is done with this function now.
+ - Removed check on exponent value while parsing it from buffer, check is
+ only done when combining this value with the digits read.
+
+ * src/num_get_float.cpp:
+ - Generalize synchronization code arround the ecvt/fcvt functions when
+ the platform do not grant reentrant functions.
+ - In __format_float_scientific, removed useless rz temporary variable, removed
+ limitation in the number of appended trailing zeros.
+ - In __format_float_fixed, removed limitation of number of trailing zeros
+ added after decimal point, it is only limited by precision.
+ - __format_float: Code to detect infinity or NaN has been moved before call
+ to platform specific ecvt/fcvt functions. Thanks to this modification, this
+ function is not template anymore.
+ - Add _Stl_ecvt/_Stl_fcvt emulation functions when platform do not grant
+ the necessary ecvt/fcvt functions for long double. Emulation is based on
+ sprintf function using 'L' modifier.
+ - In __write_floatT function, fix size of static buffer used by _Stl_ecvt/fcvt
+ functions. Fix number of digits in calls to _Stl_fcvt/ecvt in both modes,
+ fixed or scientific.
+
+ * test/unit/num_put_get_test.cpp: Add some tests, somes with a really high
+ precision that show problem with static buffer size.
+
+2007-07-17 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_algo.c, stlport/stl/_algobase.c: search, the __tmp and
+ __p1 iterators always point at the same position, hence one of them
+ is redundant;
+
+ * stlport/stl/_algobase.c: in the main-loop of search there are two
+ successive while-loops doing exactly the same thing; one of them is
+ redundant and, since it is inside the main-loop, it slows down
+ the algorithm significantly;
+
+ * stlport/stl/_algo.c, stlport/stl/_algobase.c: in the search the main-loop
+ condition "while (__first1 != __last1)" is always true and consequently
+ redundant; this is because the initial adn in-loop conditions virtually
+ act as guards and will never let the main-loop condition to fail; since
+ this condition is evaluated in every main-loop iteration, its removal
+ will also improve the performance of the algorithm; thanks for
+ Jim Xochellis for this suggestions.
+
+2007-07-15 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/strstream.cpp: "get end" pointer should be initialized
+ to the "begin of get + N" in obsolete strstream; bug #1536503,
+ thanks for Jean-Eric Cuendet;
+
+ * test/unit/strstream_buffer_read_test.cpp, build/test/unit/Makefile.inc:
+ test for bug above; [submitted by Jean-Eric Cuendet].
+
+2007-07-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/Makefiles/nmake/vc8.mak: Removed _CRT_SECURE_NO_DEPRECATE
+ when building STLport. Not secured version of functions _ecvt and
+ _fcvt functions used for floating point numbers output are not
+ reentrant.
+
+2007-07-04 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/num_get_float.cpp: reorder code, one condition go away.
+
+2007-07-03 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/num_put_float.cpp: _Stl_ecvtR, _Stl_fcvtR, _Stl_qecvtR,
+ _Stl_qfcvtR functions, pass buffer size as a parameter when the
+ platform functions need it rather than duplicating the size
+ definition. This modification has been applied to the DECC platforms
+ and when the GLibC is in use.
+ Removed useless islong __format_float_scientific parameter. Removed
+ useless x __format_float_fixed parameter, islong parameter
+ replaced with direct specification of the maxfsig value.
+ In __format_float function, first attempt in detection of NaN or
+ infinity is done thanks to the std::numeric_limits and compiler
+ support, _Stl_is_nan_or_inf do not correctly handled long double
+ values. long double values larger than max double values were always
+ displayed as Inf.
+
+ * src/num_get_float.cpp: Removed useless null buffer checks in
+ _Stl_atod functions, we know how this function is called. Replaced
+ some hard coded constant with numeric_limits values. Add check that
+ there is less than 64 digits before hiding hidden bits in vv.i64, for
+ long double it was generating wrong long double value.
+
+ * test/unit/num_put_get_test.cpp: Add numerous tests to check both
+ long double input and output.
+
+2007-06-29 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/memory: more forward declarations; fix typo;
+
+ * stlport/functional: more tricks to compile with boost
+ and tr1;
+
+ * test/unit/boost_check.cpp: problems trace; set 1 in
+ appropriate places to check presence of problem, but only
+ use one case at a time.
+
+2007-06-28 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/locale.cpp, locale_impl.h, stlport/stl/_locale.h,
+ config/features.h: Runtime check system do not fully use the
+ MSVC6 workaround anymore, it only use the locale workaround,
+ not the basic_string one.
+
+ * src/string.cpp: Fix wrong explicit instanciation.
+
+ * test/unit/cppunit/cppunit_mini.h, file_reporter.h: Fix
+ computation of test failure when both CPPUNIT_CHECK and
+ CPPUNIT_ASSERT are used.
+
+2007-06-28 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/boost_type_traits.h: reread boost/config.h
+ to force usage of stlport in boost and force read essential
+ macros from boost/config/suffix.hpp; this is because boost
+ included within stlport from one side, and stlport included
+ within boost from another side; this make sense with
+ _STLP_USE_BOOST_SUPPORT defined in user_config.h;
+ checked for boost 1.34;
+
+ * test/unit/boost_check.cpp, build/test/unit/Makefile.inc:
+ test for problem above; this simulate problem when boost's
+ header was included before any stlport's one;
+
+ * stlport/stl/config/features.h: remove definition of
+ BOOST_STDLIB_CONFIG, due to it unconditionally defined
+ in boost.
+
+ * stlport/memory: forward declarations for boost required,
+ by the same reasons as described above.
+
+2007-06-24 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_function.h, stlport/functional: fix import
+ of boost::shared_ptr---moved from _function.h to functional;
+ import mem_fn, bind, bad_function_call, function, swap from
+ boost to std::tr1.
+
+2007-06-23 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_string.h, _string_workaround.h: Some fix for gcc
+ that is now expose to the VC6 workaround because of the runtime
+ check mechanism under MinGW.
+
+2007-06-21 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/cstring_test.cpp, limits_test.cpp: Small modif to avoid
+ MSVC compiler warning in release build.
+
+ * stlport/stl/_cwchar.h: Replace a _STLP_MSVC check with a _STLP_MSVC_LIB
+ check as WCHAR_MIN and WCHAR_MAX macros definition depends on library
+ and not on compiler.
+
+2007-06-20 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/memory: import shared_ptr from boost to std::tr1 namespace,
+ if no _STLP_NO_EXTENSIONS and present _STLP_USE_BOOST_SUPPORT;
+ see ISO/IEC DTR 19768,
+ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf
+
+ * test/unit/shared_ptr_test.cpp: test for shared_ptr.
+
+2007-06-19 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/debug/_debug.h, _debug.c: Replace __in_range with
+ stlp_in_range, __in_range is a macro in the Windows Vista PSDK.
+
+ * src/locale.cpp, stlport_prefix.h, warning_disable.h,
+ stlport/stl/_locale.h, _string.h, config/features.h: Fix some
+ regression introduce with the improvment of the runtime compatibility
+ check mecanism.
+
+ * src/c_locale_glibc/c_locale_glibc2.c: Fix implementation of
+ _Locale_strcmp and _Locale_strwcmp functions.
+
+ * stlport/stl/_limits.c: Change technique used to generate NaN or
+ infinity floating point numbers. No more reinterpret_cast of a buffer,
+ we now use an union based technique. gcc prefer this cleaner method
+ especially in release mode.
+
+ * test/unit/limits_test.cpp: Small test modification as gcc was still
+ performing some weird optimization in release mode resulting in
+ unexpected behavior.
+
+2007-06-19 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_function.h: import reference_wrapper from boost to
+ std::tr1 namespace, if no _STLP_NO_EXTENSIONS and present
+ _STLP_USE_BOOST_SUPPORT; see ISO/IEC DTR 19768,
+ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf
+
+ * test/unit/reference_wrapper_test.cpp: test for reference_wrapper.
+
+2007-06-15 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/test/unit/Makefile.inc: macro_checks.cpp instead of cwchar.cpp.
+
+2007-06-14 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/dll_main.cpp, locale.cpp, locale_impl.h, locale_impl.cpp,
+ stlport/stl/_locale.h, _rope.h, config/_windows.h, features.h:
+ Enhance the runtime compatibility mecanism used to detect build
+ inconsistency under Windows. We now use the locale class with the
+ VC6 workaround coming with it to force a call to the compatibility
+ check function. Inconsistency detection is activated if _DEBUG
+ or _STLP_DEBUG is defined. If an inconsistency is detected it is
+ reported by the linker thanks to an unresolved symbol
+ building_for_up_to_windows95_but_library_built_for_at_least_windows98
+ or
+ building_for_at_least_windows98_but_library_built_for_up_to_windows95
+ that are self describing.
+
+ * test/unit/cwchar.cpp: Renamed in macro_checks.cpp, add many tests for
+ all C Standard macros like CHAR_MIN, CHAR_MAX, INT_MIN, INT_MAX...
+
+ * stlport/stl/_cwchar.h: Add MSVC compilers before Visual Studio 2005
+ as not defining WCHAR_MAX correctly.
+
+2007-06-11 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/lock_free_list.h: Fix check of _WIN32_WINNT rather than _WIN32_WINDOWS.
+
+ * stlport/stl/_threads.c: In the Win32 implementation, add a call to
+ the SwitchToThread function to potentially avoid a costly call to
+ Sleep(1) that can take more time than expected. If SwitchToThread fail
+ we call Sleep(1) again. Based on Taras Overchuk bug report 1720635.
+
+2007-06-11 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/fstream.cpp: integration file; code clean, three implementations
+ sublimated, unix-emulation approach removed; this is reorganization
+ changeset, functionality was not changed;
+
+ * src/fstream_win32io.cpp: win32io-based implementation of _Filebuf_base,
+ i.e. based on Windows calls CreateFile/CloseHandle/ReadFile/WriteFile +
+ CreateFileMapping, MapViewOfFile;
+
+ * src/fstream_unistd.cpp: unistdio-based implementation of _Filebuf_base,
+ based on unistd open/close/read/write + mmap;
+
+ * src/fstream_stdio.cpp: stdio-based implementation of _Filebuf_base,
+ based on stdio fopen/flose/fread/fwrite;
+
+ * stlport/stl/_fstream.h: detect of _Filebuf_base implementation moved
+ into stlport/stl/config files;
+
+ * stlport/stl/config/*.h: iostreams underline technique depends upon
+ OE or user's preferences;
+
+ * stlport/stl/config/features.h: some system-specific macro moved to
+ system- or compiler-specific files;
+
+ * stlport/stl/_rope.h: rewritten suspicion code, functionality not changed.
+
+2007-06-08 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_complex.h: Clean unused _STLP_NO_COMPLEX_SPECIALIZATIONS
+ macro and code coming with it.
+
+ * build/lib/configure, configure.bat: Removed --windows95 option, it is
+ useless now that STLport includes windows.h when building the libraries.
+
+ * build/Makefiles/gmake/bcc.mak, dmc.mak, gcc.mak, nmake/vc-common.mak:
+ Removed references to Windows 95 build, if STLport users want to target
+ a specific Windows OS they will only have to use --extra-cxxflags to
+ give WINVER, _WIN32_WINDOWS or _WIN32_WINNT values.
+
+2007-06-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/features.h: Removed unused _STLP_LDOUBLE_* macros giving
+ real long double size.
+
+ * stlport/stl/_limits.h, _limits.c: Major code upgrade, now computation
+ of infinity and NaN is done thanks to some code extracted from the boost
+ library (www.boost.org). This code is more portable as it adapts to compiler
+ representation of float, double and long double and do not require many
+ compiler macro checks. Additionaly STLport numeric_limits now handle real
+ denorm_min values.
+
+ * test/unit/limit_test.cpp: Add many test on dernomalized float and
+ some other values of numeric_limits.
+
+ * stlport/stl/config/_cray.h, _gcc.h, _msvc.h, stl_mycomp.h: Removed
+ _STLP_NO_IEC559_SUPPORT macro, meaning was not clear and impact was
+ localized to the _limits.h file so use of a global macro was rather
+ useless.
+
+2007-05-29 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_num_get_.c: Small refactoring, all num_get::do_get for
+ float, double and long double are now calling the same __do_get_float
+ function. Moreover, when __read_float failed, __sring_to_float is not
+ called anymore.
+
+2007-05-28 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/limits_test.cpp: Add test checking that numeric_limits
+ min is really min and max really max.
+
+ * src/allocators.cpp, locales.cpp, stlport/stl/_threads.h,
+ config/_windows.h: Fix detection of Windows OS having limited
+ implementation of Interlocked[Increment,Decrement] Win32 API
+ functions. _STLP_WIN95 macro has been rename _STLP_WIN95_LIKE
+ as it do not only signal Windows 95 build context but also former
+ OS versions.
+
+2007-05-22 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale_win32/c_locale_win32.c: gcc MinGW has no thread
+ locale storage intrisinc support so for this compiler, locale
+ creation failure will always be reported with runtime_error
+ exception.
+
+ * stlport/stl/config/_msvc.h: Configuration fix, check that _STLP_MSVC
+ is defined before activating MSVC6 workaround
+ (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND macro).
+
+2007-05-21 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale.h, locale.cpp, locale_impl.cpp,
+ c_locale_dummy/c_locale_dummy.c, c_locale_win32/c_locale_win32.c,
+ c_locale_glic/c_locale_glibc.c, c_locale_glibc2.c: Add a _Locale_errno
+ function to the small localization framework in order to report more
+ accurate locale creation failure. For the moment there are 3 possible
+ failure reasons, no more memory, unsupported locale, no platform support.
+ In case of memory starvation, we throw a bad_alloc exception.
+
+2007-05-19 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_valarray.h, _valarray.c: Add many assertion checks to
+ track potential undefined behaviors mostly regarding invalid argument
+ size.
+
+2007-05-17 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_prolog.h: Hide _debug.h when including C standard
+ headers. Some platforms (Win32) include C headers in an 'extern "C"'
+ scope that do not accept templates exposed in _debug.h.
+
+2007-05-16 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/_auto_link.h, build/Makefiles/gmake/cygming/lib.mak,
+ build/Makefiles/nmake/lib/macro.mak: Removed version information
+ from static libs name for consistency among all supported compilers/
+ platform.
+
+2007-05-15 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_range_errors.c, _stdexcept_base.c: New files
+ containing codes that used to be duplicated in dll_main.cpp.
+
+ * src/dll_main.cpp: Include _range_errors.c and _stdexcept_base.c
+ when necessary.
+
+ * stlport/stl/_stdexcept_base.h, _stdexcept_base.c: __Names_exception
+ do not truncate anymore exception message when longer than internal
+ static buffer, a dynamic buffer is allocated through malloc in this
+ case. I haven't use __iostring class in this case as it would
+ have introduce a cyclic dependency between classes.
+
+2007-05-11 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale.h, c_locale_glibc/c_locale_glibc2.c: Some fixes to
+ avoid gcc warnings when compiled with -Wall -Wmissing_prototypes.
+
+ * stlport/stl/_num_put.c: Fix a cast to avoid a signed/unsigned
+ comparison warning.
+
+ * c_locale_glibc/c_locale_glibc2.c: Use __locale_t __names field
+ rather than __locales to access to category names. Thanks to this
+ modification we do not need the Glib internal locale_data struct
+ definition anymore.
+
+ * test/unit/fstream_test.cpp: Port the FstreamTest::null_stream for
+ unixes platforms that use /dev/null, the test is not ignored anymore.
+
+ * src/fstream.cpp: Under Windows, check that the file we are
+ opening is a real file before trying to truncate it or move to
+ the end. Allow use of special file like "NUL" with C++ fstream.
+
+2007-05-10 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/stdio_streambuf.cpp: Add checks of error codes returned
+ by ftell and fseek functions in stdio_istreambuf::showmanyc
+ Windows CE special implementation.
+
+ * test/unit/fstream_test.cpp: Add new test case to check file streams
+ built from platform dependent null pipe (NUL under Windows, /dev/null
+ under unixes). Ignored for the moment.
+
+2007-05-04 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/locale.cpp, allocators.cpp, stlport/stl/_threads.h,
+ config/_windows.h: Change macro checks to detect Windows 95 platform.
+ Windows 95 and NT4 has both WINVER == 0x0400 but only Windows 95 has
+ limitation impacting STLport code. Distinction between both platforms
+ is done thanks to the _WIN32_WINNT macro only defined for NT4. New
+ _STLP_WIN95 macro signals Windows 95 platform, it replaces
+ _STLP_WIN32_VERSION. Thanks Jan Echternach patch 1707963.
+
+ * src/c_locale_win32/c_locale_win32.c: Remove all code concerning the
+ messages facet, Windows platform do not support it.
+
+ * src/fstream.cpp: Fix use of fseek in _Filebuf_base::_M_seek in
+ _STLP_USE_STDIO_IO mode. fseek do not return the position in file
+ but a boolean value indicating if call has succeeded or not, and
+ call to ftell to get file position. Thanks Marco Jez bug report
+ 1704843. I have also integrated a number of small fixes to use
+ _STLP_USE_STDIO_IO mode under MSVC or GCC MinGW, it shouldn't be
+ really nececarry but it costs nothing and help testing this mode.
+
+2007-05-03 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_numpunct.h, _time_facets.h, _ctype.h, _monetary.h,
+ _messages_facets.h: Remove friend _Locale_extract_hint function
+ declaration replace by the more simple friend class
+ _Locale_impl expression.
+
+ * src/locale_impl.cpp: Change implementation of
+ _Locale_impl::insert_*_facets methods. Now only facets used internally
+ for iostreams implementation are considered as mandatory when
+ instanciating a locale from a name. Other facets like collate or
+ messages won't generate a runtime_error exception if the platform is
+ not able to grant an implementation. This will make STLport more
+ flexible in regards of platform possibilities.
+
+ * stlport/stl/_messages_facets.h, src/facets_byname.cpp, messages.cpp:
+ Simplification of the messages facet implementation. _Messages class
+ has no virtual method anymore, _Messages_Impl has been removed. Now
+ messages class implementation is a dummy implementation that do not
+ allow access to platform messages, real messages implementation is
+ available thanks to the messages_byname class.
+
+ * stlport/stl/_time_facets.h: _Locale_time instance is not kept
+ anymore in the facet implementation, it is only used on construction
+ to initiliaze _Time_Info struct instance.
+
+2007-05-02 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/codecvt_test.cpp: Fixed comparison with char_traits::eof
+ to use eq_int_type in order to be compatible with platform having
+ a default unsigned char built-in type. Thanks Marco Jez report.
+
+2007-04-19 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_valarray.h: Integrate C++ Standard defect 253
+ signaling that slice_array, gslice_array, mask_array and
+ indirect_array copy constructor cannot be private.
+
+ * test/unit/valarray_test.cpp: Add compilation test to check that
+ valarray operator[] taking a slice, gslice, valarray<bool> and
+ valarray<size_t> can be called.
+
+2007-04-16 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/locale.cpp: Simplified locale::_M_throw_runtime_error
+ implementation using std::string rather than C string functions.
+ Also change exception message generation to make failure reason
+ more obvious.
+
+ * src/facets_byname.cpp: As, according Standard, *_byname facet
+ constructor should behave as locale constructor taking a name
+ STLport now throws a runtime_error instance when building
+ a facet from a null name.
+
+ * src/messages.cpp: Now contains all classes implementation involved
+ in messages facet support.
+
+ * stlport/stl/_messages_facets.h, src/messages_facets.h, messages.cpp:
+ Simplification of the messages facet implementation. Major modification
+ is that the C messages facet has now only one representation which is
+ the one given by the _Message class. There used to be an other one
+ based on _Messages_impl class using __acquire_messages("C").
+
+ * src/messages_facets.h: Internal classes _Messages and _Messages_impl
+ are not exported anymore.
+
+ * test/unit/locale_test.cpp: Facet tests has been moved to facet
+ category test files.
+
+ * test/unit/collate_facets_test.cpp, ctype_facets_test.cpp,
+ messages_facets_test.cpp, money_facets_test.cpp, num_facets_test.cpp,
+ time_facets_test.cpp, build/test/unit/Makefile.inc: New test cases for
+ each facet category.
+
+ * stlport/stl/config/features.h: Define _STLP_NO_TYPEINFO when _STLP_NO_RTTI
+ is defined.
+
+2007-04-15 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/dll_main.cpp: Removed useless _Atomic_swap_struct export
+ that has already been removed from _threads.h and that was generating
+ compilation error with MSVC 2005.
+
+2007-04-10 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/pointers/_deque.h, _list.h, _set.h, _slist.h:
+ Eric Sanford DMC patch to allow pointer specialization feature.
+
+ * test/unit/map_test.cpp, set_test.cpp, slist_test.cpp,
+ unordered_test.cpp: Remove DMC check hiding pointer specialization
+ tests.
+
+ * build/Makefiles/gmake/dmc.mak, app/dmc.mak: Additional fixes from
+ Eric Sanford.
+
+2007-04-09 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_pair.h, _vector.h, config/_bc.h: Borland patch
+ from Eric Sanford, remove move semantic for free compiler.
+
+ * test/unit/mvctor_test.h: Eric Sanford patch to restore 2 tests
+ that has been lost in a previous test modification,
+ movable_declaration_assoc and movable_declaration_hash.
+
+ * test/unit/mvctor_traits_test.cpp: Add some _STLP_NO_MOVE_SEMANTIC
+ checks when using __move_traits.
+
+2007-04-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/_gcc.h: Removed undef of _STLP_NEW_PLATFORM_SDK,
+ under MinGW, MinGW can use a new SDK and not the one coming with
+ MinGW.
+
+ * Merged with STLPORT_5_1 branch up to revision 2994.
+
+2007-04-05 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/ctype.cpp: move declaration from loop;
+
+ * stlport/stl/debug/_debug.c: stl/_cstdlib.h already included;
+
+ * stlport/stl/_cprolog.h: prolog for C headers can't include
+ files with C++ constructions;
+
+ * stlport/*.h: C headers use prolog that don't include C++
+ constructions;
+
+ * test/unit/stldbg_include.cpp, build/test/unit/Makefile.inc:
+ test for problem with inclusion C++ constructions from
+ C header.
+
+2007-04-04 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/lib/configure.bat: Change advise command to build
+ STLport after configuration, it is now 'clean all' rather
+ than default build command.
+
+2007-03-22 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale_dummy/c_locale_dummy.c: Fixed dummy definition
+ for a number of localization functions that are now type safe.
+
+2007-03-20 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_prolog.h, config/features.h, debug/_debug.h:
+ Normalize the way STLport debug mode macros are defined. All
+ debug macro definition are now coming from _debug.h and not
+ anymore partially from features.h. _debug.h is now included from
+ _prolog.h after all configuration has been completed.
+
+ * stlport/stl/_alloc.h, _iterator_base.h, _valarray.h: Removed
+ _debug.h references now fully integrated in STLport configuration
+ phase.
+
+ * stlport/stl/config/_windows.h: Add some Windows macro before
+ inclusion of windows.h when building library to limit Windows
+ pollution (NOMINMAX, STRICT). Moreover add definition of
+ _STLP_OUTERMOST_HEADER_ID macro before windows.h inclusion to
+ avoid indirect include of STLport stuff throught C Standard headers
+ included in windows.h as at this moment STLport is not yet completely
+ configured.
+
+ * stlport/stl/config/_evc.h: Removed unjustified macro definition to
+ limit inclusion from windows.h, it is a user decision not an STLport one.
+
+ * build/Makefiles/nmake/vc8.mak: Fix definition of DEFS in this file
+ to keep current DEFS value that might exist if configure --extra-cxxflag
+ option has been used.
+
+ * src/allocators.cpp: Add _STLP_NEW_PLATFORM_SDK macro check to
+ perform necessary const_cast in _STLP_ATOMIC_ADD macro definition.
+
+2007-03-17 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/Makefiles/gmake/bcc.mak, dmc.mak, gcc.mak, nmake/vc-common.mak:
+ Add WINVER definition when building libraries to signal required OS
+ compatibility, per default it is Windows 98 and later ones.
+
+ * build/lib/configure, configure.bat: Add new configuration option
+ --windows95 to signal that we want Windows 95 compatibility.
+
+ * stlport/stl/_threads.h, config/_windows.h, src/allocators.cpp:
+ Move _STLP_ATOMIC_ADD macro definition in source files where it is
+ used.
+
+ * stlport/stl/config/_windows.h:
+ - When building the libraries we always include windows.h, when using
+ the library we always use own function declaration to avoid windows.h
+ inclusion.
+ - InterlockedExchangeAdd is not declared anymore.
+ - InterlockedExchangePointer is only used when detecting 64 bits
+ platform thanks to the _WIN64 macro, otherwise InterlockedExchange
+ is used.
+
+2007-03-15 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/Makefiles/nmake/vc8.mak: Default MSVC 2005 build is now done
+ without safe string functions for performance reasons.
+
+ * stlport/stl/_locale.h, _alloc.h, _rope.h: Moved
+ _STLP_CHECK_RUNTIME_COMPATIBILITY_AT_LINK_TIME invocation where problem
+ might happen which is in the rope implementation for current use. A future
+ use will need to guess where this function has to be invoked.
+
+ * stlport/stl/config/feature.h: Fixed _STLP_USE_NO_IOSTREAMS check to undef
+ _STLP_CHECK_RUNTIME_COMPATIBILITY_AT_LINK_TIME macro.
+
+ * stlport/stl/config/_windows.h: For performance reason
+ _STLP_CHECK_RUNTIME_COMPATIBILITY_AT_LINK_TIME system is only used in debug
+ mode (detected thanks to _DEBUG macro).
+
+2007-03-13 Francois Dumont <dums@users.sourceforge.net>
+
+ * Merged with STLPORT_5_1 branch revision 2963.
+
+ * src/locale_catalog.cpp: Use C cast for C struct like _Locale_ctype,
+ it makes Borland compiler happier.
+
+ * stlport/stl/_string.h: Made inheritance relation between basic_string
+ and _String_base class public for DMC.
+
+ * src/dll_main.cpp, stlport/stl/config/features.h,
+ stlport/stl/_locale.h, _alloc.h: Add a new mecanism to detect library
+ build/use inconsisteny at link time.
+ _STLP_CHECK_RUNTIME_COMPATIBILITY_AT_LINK_TIME macro contains a
+ function name declared in features.h and defined in dll_main.cpp.
+ This function name depends on the build context. If, when using the
+ library, this macro contains an other function name because of a
+ different configuration context an unresolved symbol will appear at
+ link time showing the missing function symbol. Function name should
+ be chosen carefully to make problem as explicit as possible. For the
+ moment function is called in arbitrary places, in std::use_facet
+ function and std::allocator constructor.
+
+ * stlport/stl/config/_windows.h: Use
+ _STLP_CHECK_RUNTIME_COMPATIBILITY_AT_LINK_TIME macro to detect
+ inconsistency when building STLport for Windows 95 and using it
+ in Windows XP or opposite. Depending on targetted platform,
+ _Refcount_Base has a different sizeof which lead to undefined
+ behavior at runtime if we do not use this trick.
+
+2007-03-13 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/string_test.cpp: add test for trivial compare with plain
+ char array;
+
+ * test/unit/exception_test.cpp: add test for what().
+
+2007-03-10 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/_windows.h: Major modification, when building
+ STLport libs windows.h or afx.h, when _STLP_USE_MFC is defined, is
+ systematically included in order to detect the SDK version used to
+ the libraries. _windows.h is now the only place is the library where
+ windows.h is included.
+
+ * src/dll_main.cpp, fstream.cpp, lock_free_slist.h,
+ c_locale_win32/c_locale_win32.c: Removed references to windows.h now
+ included from _windows.h.
+
+ * stlport/stl/_istream.c: Add parenthesis on a use_facet call to make
+ VC6 happy when building the library.
+
+ * test/unit: Disable tests checking instanciation and use of
+ containers with an incomplete type when pointer specialization is
+ enable.
+
+ * stlport/stl/config/user_config.h: Add comment about limitation
+ of pointer specialization.
+
+ * stlport/stl/_string.h, _string_workaround.h: Now that _STLP_DEBUG
+ mode do not use inheritance anymore, use private rather than
+ protected members in basic_string implementation. Only exception
+ is when using VC6 workaround, this is what _STLP_PRIVATE macro is
+ for.
+
+ * src/allocators.cpp, stlport/stl/config/features.h: Removed
+ unjustified _STLP_PRIVATE macro.
+
+2007-03-09 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/config/_msvc.h: use MS's safe string functions only
+ if _CRT_SECURE_NO_DEPRECATE not defined (see bug #1674974).
+ Thanks Bronek Kozicki.
+
+2007-03-08 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/num_get_float.cpp: experimental support of correct input
+ of long doubles on Linuxes.
+
+ * test/unit/num_put_get_test.cpp: test for correct input of float,
+ double and long double, including values out of type range.
+
+ * stlport/stl/config/_linux.h: mark that Alpha, PowerPC,
+ 32-bit SPARC, 32-bit MIPS, ARM, SH4 has no long double.
+
+2007-03-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * Synchronization with STLPORT_5_1 branch revision 2945.
+
+2007-02-19 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl: swap workaround review, now when swap implementation
+ detect that a STLport class is being swapped it calls the
+ _M_swap_workaround member method. We do not use the swap method
+ anymore because the way the workaround is implemented would have
+ forces us to add a swap method to queue, priority_queue and stack
+ containers that do not have a swap method according the C++ Standard.
+
+2007-02-15 Francois Dumont <dums@users.sourceforge.net>
+
+ * Synchronization with STLPORT_5_1 branch up to revision 2918.
+
+2007-02-13 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/features.h, _msvc.h, stl_mycomp.h: Removed
+ _STLP_USING_NAMESPACE_BUG macro config. STLport private namespace
+ is now always nested in stlport one. Makes namespace management
+ easier.
+
+ * stlport/stl/_algobase.h: Restore workaround for compilers
+ not supporting template function partial ordering feature, was
+ resulting in regression for a number of compilers, VC6, Borlands.
+ A template class like _SwapImplemented do not have to be specialized
+ to be useful, this class is used to detect types having a swap
+ method. Detection is based on the class being flagged as STLport
+ class thanks to the __stlport_class inheritance.
+
+ * test/unit/swap_test.cpp: Add macro checks to ignore test for
+ compilers we know not being able to support it.
+
+2007-02-12 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/features.h: Add necessary macro to work
+ with tr1 namespace of the C++ technical report.
+
+ * stlport/stl/_unordered_set.h, _unordered_map.h: Put unordered
+ containers in tr1 namespace.
+
+ * test/unit/unordered_test.cpp, mvctor_test.cpp,
+ mvctor_declaration_test.cpp: Add necessary using directive
+ to access tr1 namespace.
+
+2007-02-12 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * Repository: revert back r2908;
+
+ * test/unit/swap_test.cpp: test that swap( a, b ) has specialization
+ a.swap( b ), when required;
+
+ * stlport/stl/_algobase.h: _SwapImplemented useless, because it never
+ specialized elsewhere---remove swap specialization here, use instead
+ swap specialization from _relops_cont.h, when required.
+
+2007-02-07 Francois Dumont <dums@users.sourceforge.net>
+
+ * locale_impl.cpp, monetary.cpp, num_get.cpp, num_put.cpp,
+ time_facets.cpp: Moved all _GetFacetId implementations in
+ the same translation unit as the one where id are initialized.
+
+2007-02-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_alloc.h, allocators.cpp: Moved _ALIGN and
+ _ALIGN_SHIFT constant definition in source file where it is used
+ _MAX_BYTES is used in deque implementation. Moreover those
+ constant value now depends on sizeof(void*) to avoid preprocessor
+ check like _WIN64.
+
+ * stlport/stl/_vector.h, _vector.c: Moved __type_traits
+ instanciations in methods that need it in order to be able to
+ access nested types like iterator even if type used to instanciate
+ the vector is not yet completely defined.
+
+ * stlport/stl/_deque.h, _deque.c: Removed useless __type_traits
+ instanciations. For the same reason than above, __buffer_size
+ constant has been replaced by a function computing deque buffer
+ size at runtime.
+
+ * stlport/stl/_hashtable.h, _hashtable.c: For the same reason than
+ above, hashtable do not contains anymore an instance of the _ExK type
+ which is used to extract the key part from a value instance. This
+ instance was not returned in any method of the hashtable type. An
+ unused constructor taking an instance of this type has been removed.
+
+ * test/unit/vector_test.cpp, deque_test.cpp, list_test.cpp,
+ slist_test.cpp, map_test.cpp, set_test.cpp, hash_test.cpp,
+ unordered_test.cpp: Add compilation tests to check that the container
+ iterator nested type is accessible even if type used to instanciate
+ the container is not yet completely defined.
+
+2007-02-02 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale.h: Add type information for the following functions
+ of the localization support API:
+ - _Locale_*_create
+ - _Locale_*_destroy
+ - _Locale_*_name
+ Also add some variable name to make associated documentation more
+ explicit.
+
+ * src/c_locale_win32/c_locale_win32.c,
+ src/c_locale_glibc/c_locale_glibc.c, c_locale_glibc2.c: Adapted to
+ conform to new localization API functions prototypes. Adaptation
+ in glibc before 2.2 has been updated but compilation hasn't been
+ completed because of the lack of the glibc required version.
+
+ * src/locale_catalog.cpp: Now wrapper functions are used to
+ offer a homogeneous prototype to type safe localization API
+ functions.
+
+2007-02-02 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/hash_test.cpp: add test for hash_multimap, equivalent
+ keys problem on some data sets [this is regression test, suggested
+ by tef for 5.0.2, bug report #1606308].
+
+2007-01-29 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/debug/_deque.h: typename required.
+
+ * test/unit/sstream_test.cpp: test for seekp added.
+
+2007-01-28 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/Makefiles/gmake: Borland patch from Eric Sanford to install
+ .tds file for Borland debugger.
+
+ * trunk synchronized with STLPORT_5_1 branch up to revision 2895.
+
+ * stlport/stl/_threads.h: Changed way of including headers for
+ _STLP_UITHREADS platform. We now include internal STLport headers
+ rather than Standard ones. It was especially important for Sun
+ Studio compiler that natively include Standard headers only once.
+
+2007-01-25 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/facets_byname.cpp: we search within scope, specified by mask,
+ so _Locale_wchar_ctype return can't be beyond of this mask.
+
+ * src/c_locale_glibc/c_locale_glibc2.c: _Locale_wchar_ctype
+ implemented.
+
+ * test/unit/locale_test.cpp: test for ctype facet for wchar_t added.
+
+2007-01-23 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_locale.h: Introduction of the _GetFacetId function
+ to isolate access to facet id instance in one place. It guaranty that
+ the facet id instances initialized in _Stl_loc_assign_ids function
+ are the same as the ones used by streams to format output. Many compilers
+ have problem with template class static variable and duplicate them
+ arround the different shared library depending on STLport.
+
+ * stlport/stl/_monetary.h, _num_get.h, _num_put.h, _time_facets.h:
+ Add _GetFacetId overloads for money_get, money_put, num_get, num_put,
+ time_get, time_put facets that are exposed as template facets. Other
+ facets are fully specialized template classes whose id should be
+ correctly handle by compilers like for any static variable in a non
+ template class.
+
+ * src/monetary.cpp, num_get.cpp, num_put.cpp, time_facets.cpp: Add
+ _GetFacetId implementation.
+
+ * stlport/stl/_collate.h: Use _GetFacetId in __locale_do_operator_call
+ implementation, not required but more consistent.
+
+ * stlport/stl/_monetary.c, _num_put.c, _num_get.c, _time_facets.c,
+ src/locale_impl.cpp: Removed now useless gcc Cygwin or MinGW and
+ Borland workarounds.
+
+ * test/unit/locale_test.cpp: Removed facet_id test case, facet id
+ indexes are STLport internal stuff that shouldn't be part of a unit
+ test. Wrong facet id management will be shown by other tests. Moreover
+ this test was failing for compilers duplicating template class
+ static instances.
+
+2007-01-20 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_cmath.h, _cstdlib.h, config/_watcom.h: Small
+ evolution for Open Watcom support.
+
+ * Synchronization of trunk from STLPORT_5_1 branch from revision
+ 2750 to revision 2871.
+
+ * stlport/stl/config/features.h, _gcc.h, _intel.h, _msvc.h, _sgi.h:
+ Major exception policy modification, _STLP_NOTHROW default value
+ is now throw() when exception support is activated. Compilers not
+ supporting is should define this macro as empty. Configuration files
+ of compilers already managing this feature have been updated.
+
+2007-01-19 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/config/host.h: define one of __SunOS_5_x macro
+ for gcc (during installation?) on Solaris; note, that Solaris
+ system may has patch with MATH_F and MATH_L functions.
+
+ * stlport/stl/config/_solaris.h: reminder for __SunOS_5_x
+ macro definition for gcc; turn on/off MATH_F/MATH_L functions
+ present: see beacon that depends upon Solaris version and patch present,
+ as defined by SunPro compilers or in host.h. Thanks to Graham Reed.
+
+ * stlport/stl/config/_sunprocc.h: if use new-c-headers, SunPro
+ include iso/stdlib_iso.h instead of stdlib.h; note, that this exclude
+ usage of long double, long long, etc. functions, even when ones present
+ in OS. Thanks to Graham Reed. Bugreport 1630943.
+
+2007-01-18 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_num_put.c: Add cast to avoid gcc warning.
+
+ * stlport/stl/_pair.h, _construct.h: Add _STLP_NO_MOVE_SEMANTIC
+ before inclusion of _move_construct_fwk.h.
+
+ * stlport/stl/_istream.c: Removed useless cast to num_get facet.
+
+ * src/system_api.c: Move macro check to at least include math.h
+ in order to avoid an empty translation unit which can generate
+ compilation warning.
+
+2007-01-17 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_cmath.h: move hypot in global namespace for SunSoft;
+ suggested by Graham Reed.
+
+2007-01-15 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/locale_test.cpp: Upgrade Russian currency abbreviation
+ 'RUR' to 'RUB'. Thanks Tiziano Muller, bug report 1634886.
+
+ * test/unit/cstring_test.cpp: Fix test to avoid some gcc warnings.
+
+ * stlport/stl/config/_gcc.h: Add _STLP_NOTHROW definition for
+ this compiler for C++ Standard compliancy. It might also help the
+ compiler not to emit false warning about potential use of
+ uninitialized variable (-Wall mode).
+
+ * build/lib/Makefile.inc, src/system_api.h, system_api.c: New source
+ file used for platform exposing some features only to C compiler. for
+ the moment used under Hp Unix for GNU compiler access to platform
+ isfinite, isnan and isinf functions.
+
+ * src/num_put_float.cpp: Replace a lot of unofficial Hp Unix specific
+ code to access functions isfinite, isinf or isnan. Replaced by
+ system_api.h.
+
+ * build/Makefiles/gmake/hp-ux/sys.mak: Looks like install command
+ on this platform is rather exotic, use cp instead.
+
+2007-01-14 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/_system.h: Add __SUNPRO_C macro check to
+ detect Sun Pro C compiler. Thanks Graham Reed bug report 1630916.
+
+ * stlport/stl/_cstdlib.h: Add __SUNPRO_CC macro check before
+ defining abs(long) and div(long, long) as Sun pro already
+ defined them. Thanks Graham Reed bug report 1630972.
+
+2007-01-07 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl: Add _STLP_NO_MOVE_SEMANTIC macro checks to
+ completely hide move semantic framework when not necessary.
+
+2007-01-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/bitset_test.cpp: Check _STLP_NON_TYPE_TMPL_PARAM_BUG
+ macro before doing tests that depends on it.
+
+ * stlport/stl/_list.h: Add assertion to signal potential stack
+ overflow in recurssive calls to list::insert and list::splice thanks
+ Aleksey Sanin idear.
+
+ * build/Makefiles/gmake/lib/gcc.mak: Removed obsolete -C ld option
+ on Hp Unix platform.
+
+ * stlport/stl/_mbstate_t.h: Attempt to fix STLport config for compilers
+ coming with a native lib defining mbstate_t only for C++ compilers.
+ For those compilers native mbstate_t definition won't be used for
+ the moment, STLport simply grant a dummy definition in C. Test
+ under Hp Unix has shown that it works.
+
+2006-12-29 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/iostream.cpp, stlport/stdio.h, stl/_cstdio.h: Eric Sanford
+ patch to move a Borland workaround from cstdio to stdio.h.
+
+ * stlport/stl/debug: Generalize _STLP_NO_MOVE_SEMANTIC check
+ to hide move constructors like already done in non debug
+ implementation.
+
+ * stlport/stl/config/_msvc.h: Restore move semantic for MSVC6. AFAIR
+ only MSVC .Net 2002 had problem with it.
+
+ * test/unit/strstream_test.cpp: Made the tests for _STLP_LONG_LONG
+ a little bit more portable.
+
+2006-12-20 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/strstream_test.cpp: New test case for sourceforge
+ bug report 1615554. Not confirm for the moment.
+
+ * test/unit/math_aux.h, mvctor_test.h, string_test.cpp: Fixes
+ to correctly take into account _STLP_USE_NAMESPACES.
+
+2006-12-19 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/bvector_test.cpp: Fix macro check for namespace
+ support.
+
+ * test/unit/num_put_get_test.cpp: disable warning about float
+ overflow for MSVC.
+
+2006-12-17 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit: One more cleanup for compilers not supporting the
+ namespace feature. This time we avoid namespace specification when
+ doing template specialisation of Standard functor like less or
+ allocator.
+
+2006-12-15 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/_dm.h, test/unit/map_test.cpp: Eric Sanford
+ patch for DMC.
+
+2006-12-13 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/test_main.cpp: Clean up use of namespace feature.
+
+ * test/unit: Clean up use of std namespace or ignore tests if
+ necessary.
+
+2006-12-13 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport, src: Orphan code removed [Symantec without maintainance a long time;
+ gcc prior 2.95 and 2.96 can't work with current code in any case;
+ NetWare unsupported too]
+
+2006-12-13 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/feature.h: Fix and generalize the mutable
+ workaround for compilers missing this feature. Replace
+ _STLP_ASSIGN_MUTABLE with _STLP_MUTABLE macro that is more flexible
+ as not limited to assignment.
+
+ * stlport/stl/_istreambuf_iterator.h, _stream_iterator.h, _string_sum.h:
+ Use _STLP_MUTABLE rather than manually handle _STLP_NEED_MUTABLE macro.
+
+ * stlport/stl/_sstream.h: Removed useless mutable qualifier for
+ basic_stringbuf _M_str member.
+
+ * test/unit/bind_test.cpp: Use STLport mutable workaround.
+
+ * src/message_facets.h, facets_byname.cpp: Limit use of the mutable
+ qualified to one member in _Message_Impl class and use _STLP_MUTABLE
+ in class implementation.
+
+2006-12-11 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/mvctor_test.cpp: Split in 2 other translation unit
+ mvctor_declaration_test.cpp and mvctor_traits_test.cpp without
+ impacting number of test case. It helps DMC to perform a correct
+ link.
+
+ * stlport/stl/type_manips.h: Check _STLP_DONT_USE_PRIV_NAMESPACE before
+ importing __true_type and __false_type in private namespace.
+
+ * stlport/stl/config/_dec.h, _apcc.h: Removed references to unused
+ _STLP_HAS_NO_NEW_IOSTREAMS macro.
+
+2006-12-11 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/fstream.cpp, stlport/stl/_fstream.h: non-template friend function
+ of template class isn't good idea. Fixed.
+
+2006-12-09 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_range_errors.h: To complete 2006-12-04 modification
+ fix inclusion to access to string definition. In normal mode we include
+ stlport/stl/_string.h rather than string header. There is a special case
+ however if cumulating _STLP_NO_IOSTREAMS, _STLP_DONT_REDEFINE_STD and
+ _STLP_WHOLE_NATIVE_STD then functions defined in _range_errors.h will
+ throw exception from std namespace rather than from stlport.
+
+ * stlport/stl/config/user_config.h: Documented above modification.
+
+ * stlport/stl/config/features.h: Modify _STLP_VENDOR_STD definition. This
+ internal macro do not have to use __std_alias, within STLport code std is
+ not a macro and can be used as the vendor namespace.
+
+2006-12-07 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_algobase.c, config/features.h: Removed unused
+ _STLP_MPW_EXTRA_CONST macro.
+
+ * stlport/stl/config/_watcom.h, _dm.h, feature.h: Add new
+ _STLP_NO_CONST_IN_PAIR macro config to avoid instanciation of
+ pair with a const qualified type. _STLP_CONST is defined based
+ on _STLP_NO_CONST_IN_PAIR.
+
+ * stlport/stl/_map.h, _hash_map.h, _unordered_map.h: Add use of
+ _STLP_CONST.
+
+ * stlport/stl/_num_put.c: Introduce __do_put_bool function containing
+ all codes to render bool values. We do not use anymore
+ __copy_integer_and_fill function that was difficult to instanciate for
+ Open Watcom compiler. Moreover this function was not really adapted for
+ being use in this context, code duplication is very limitated and
+ absolute number of lines of code hasn't been modified.
+
+ * stlport/stl/_fstream.h, src/fstream.cpp: Removed useless declaration
+ of template specialization for _Noconv_input _Noconv_output and _Underflow.
+ _Underflow template specialization now use a function __Underflow_doit
+ to avoid the complex syntax of the implementation of a member method of
+ a template class specialization in fstream.cpp.
+
+ * src/message_facets.h: Add missing allocator parameter in hash_map
+ instanciation, required for compiler lacking default template parameters
+ support.
+
+ * src/num_get_float.cpp: Add unsigned 64 bits support for Open Watcom.
+
+ * stlport/stl/_cmath.h, _cstdlib.h: Signal that Open Watcom has already
+ all math functions C++ overloads in global namespace.
+
+ * Cleanup of all workarounds for MSVC before version 6.
+
+ * build/Makefiles/gmake/gcc.mak: Hide -fvisibility option for windows as
+ in this context we are not able to correctly detect gcc version in use.
+
+ * stlport/stl/_fstream.h: Reorder member variables in _Filebuf_base
+ to avoid gcc warning.
+
+2006-12-06 Francois Dumont <dums@users.sourceforge.net>
+
+ * STLport 5.1.0 released based on STLPORT_5_1 branch revision 2750.
+
+ * Merge STLPORT_5_1 branch from revision 2711 to 2749.
+
+ * stlport/stl/config/_hpux.h: Specify that Hp Unix is a unix platform
+ _STLP_UNIX. This platform was already recognise as a unix platform
+ but it is more clear to put it in Hp Unix configuration file.
+
+ * src/num_put_float.cpp: Limit Hp Unix workaround to access isfinite
+ isnan and some other system functions to the gcc compiler, aCC has
+ natively access to it. Tests done by Boris Gubenko.
+
+2006-12-04 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/fstream, iomanip, ios, iosfwd, iostream, istream, locale,
+ ostream, sstream, streambuf, strstream: Allow use of iostream headers
+ even when _STLP_NO_IOSTREAMS is defined if using _STLP_WHOLE_NATIVE_STD.
+
+2006-12-02 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_string.c: Use find_end algo rather than internal
+ __find_end function, find_end contains workaround for limited
+ compilers.
+
+ * stlport/stl/_algo.c: Avoid a useless default value for last
+ parameter of __stable_partition_aux_aux function.
+
+ * src/num_put.cpp: In __insert_grouping_aux, use template parameter
+ Str to get iterator definition rather than getting definition from
+ basic_string.
+
+ * stlport/stl/_num_get.c, _num_put.c: Complete basic_string
+ definition for compiler not supporting default template parameters.
+
+ * stlport/cmath, cstdio, typeinfo: Modified to be reentrant once.
+
+ * stlport/stl/_alloc.h, _bvector.h, _construct.h, _deque.h,
+ _hash_map.h, _hash_set.h, _hashtable.h, _list.h, _map.h, _pair.h,
+ _queue.h, _rope.h, _set.h, _slist.h, _stack.h, _string.h,
+ _string_base.h, _string_workaround.h, _tree.h, _unordered_map.h,
+ _unordered_set.h, _vector.h: Now _STLP_NO_MOVE_SEMANTIC hide all
+ calls to _AsMoveSource function.
+
+2006-11-30 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/stack_allocator.h: Fixed StackAllocator implementation
+ for Borland and DMC that required a workaround.
+
+ * stlport/stl/config/_gcc.h: Starting with gcc 4, use visibility
+ feature.
+
+ * build/Makefiles/gmake/gcc.mak: Starting with gcc 4, add
+ -fvisibility=hidden compilation option.
+
+2006-11-28 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_alloc.h: Avoid explicit instanciation of template
+ function _AsMoveSource. Replace internal allocator::allocate function
+ with _M_allocate to avoid use of overloading.
+
+ * stlport/utility: Fix header reentrancy.
+
+ * stlport/stl/_ptrs_specialize.h: Fixed instanciation of
+ __type_traits_aux.
+
+2006-11-25 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/climits, iosfwd, mem.h, string.h, typeinfo.h, wchar.h,
+ stl/char_traits:
+ Eric Sanford patch to complete use of include_next with Borland
+ compilers.
+
+ * stlport/using/cstring: Fix macro check for Borland compiler.
+
+ * test/unit/locale_test.cpp: Add test for Borland _fpclass.
+
+ * src/num_put_float.cpp: Fix potential error in _Stl_is_neg_nan
+ for Borland compiler after 0x581.
+
+2006-11-24 Francois Dumont <dums@users.sourceforge.net>
+
+ * Eric Sanford patch for DMC compiler, allow access to associative
+ containers extension.
+
+ * stlport/typeinfo.h, exception: Workaround for DMC that force
+ inclusion of typeinfo.h at the begining of all translation units.
+
+2006-11-23 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/cstring_test.cpp: New test case to check import of all
+ C functions from string.h in STLport namespace.
+
+ * stlport/using/cstring: Fix import of strcmp and strcpy for Borland.
+
+2006-11-20 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/iosfwd, stl/type_manips.h, config/_bc.h, pointers/_tools.h:
+ Patch from Eric Sanford to remove useless Borland workaround for
+ pointer specialisation and use include_next feature for versions after
+ 0x580.
+
+2006-11-20 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/monetary.cpp: template header not allowed in member definition
+ of explicitly specialized class
+
+2006-11-19 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_ios_base.h: Replace wrong external utility inclusion
+ with internal _pair.h header.
+
+2006-11-17 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/features.h: Modification of the static constant
+ workaround implementation to use something similar to the boost
+ workaround. _STLP_STATIC_CONST_INIT_BUG macro change definition of
+ newly introduce _STLP_STATIC_CONSTANT macro which use an enum or a
+ real static const variable. Moreover the new
+ _STLP_NO_STATIC_CONST_DEFINITION will hide static constant definition
+ when defined.
+
+ * src/ctype.cpp, ios.cpp, locale.cpp: Add check for
+ _STLP_NO_STATIC_CONST_DEFITION.
+
+ * src/monetary.cpp: Add intl static constant definitions.
+
+ * stlport/stl/_ctype.h, _ios_base.h, _limits.h, _monetary.h: Use
+ _STLP_STATIC_CONSTANT.
+
+ * stlport/stl/_limits.h: Limits a workaround for long long and unsigned
+ long long types that used to be applied for gcc after 2.96 up to version
+ 3.0.
+
+ * stlport/stl/_limits.c: Clean all static constant values duplicated from
+ _limits.h that was not used in this file. Add static constant definition
+ necessary for long long and unsigned long long types for gcc between 2.96
+ and 3.0 (see above).
+
+ * stlport/stl/debug/_string.h: Removed npos static constant definition
+ that is only necessary in stlport/stl/_string.c.
+
+ * stlport/stl/config/_msvc.h: Use real static constant starting with
+ VS .Net 2003 (_MSC_VER >= 1310).
+
+ * test/unit/limits_test.cpp: Modified test to reveal potentially missing
+ static constant definitions.
+
+2006-11-13 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/stl_confix.h: Add some STLport config options based
+ on EDG version information using boost common_edg.hpp content.
+
+ * stlport/stl/: Patch from Eric Sanford for Borland compiler. Allow
+ associative container extension (member methods) and use of pointer
+ specialization.
+
+2006-11-07 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/_hpacc.h, stl_confix.h: Thanks to additional info
+ from Boris Gubenko STLport now check __EDG_VERSION__ to detect EDG based
+ compilers. It use this macro to activate include_next feature. Moreover
+ a workaround has been added for aCC6 that was not defining __EDG_VERSION__
+ as expected. _hpacc.h has also been cleaned of obsolete config.
+
+2006-11-07 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport: All C++ Standard headers are now using the same schema. If
+ included from outside (_STLP_OUTERMOST_HEADER_ID not defined) it first
+ included internal header (in stl folder) and then, if _STLP_WHOLE_NATIVE
+ is defined, include the equivalent native Standard header. If included
+ from inside, simply forward to native header include. This schema has
+ several advantages:
+ - Less dependancy on native library headers interdependancy.
+ - Less code included as STLport code is only exposed if headers are
+ included from the outside.
+ - Restore _STLP_WHOLE_NATIVE_STD configuration (tested with gcc, msvc, bcc)
+ The condition for this schema to work is that STLport never include Standard
+ headers internaly when it wants to access some STLport code.
+
+ * stlport/stl/_iomanip.h: New file containing all STLport code that used
+ to be in stlport/iomanip.
+
+ * stlport/stl/_complex.h, _rope.h, _stream_iterator.h, _string_fwd.h: Use
+ stl/_iomanip.h rather than iomanip.
+
+ * stlport/stl/_rope.c: Use stl/_ostream.h and stl/_istream.h rather than
+ iostream.
+
+ * stlport/stl/config/_kai.h, _msvc.h, feature.h: _STLP_MINIMUM_IMPORT_STD
+ macro removed, it was only used in vector header to avoid include of
+ native vector header even when _STLP_IMPORT_VENDOR_STD was defined. MSVC6
+ used to define it but removing it hasn't make compilation failed when
+ importing all native std stuff. Looks like it was a workaround necessary
+ when STLport was not as clean as it is now or for the former wrapper mode
+ that has been removed.
+
+ * stlport/stl/config/features.h: Add a #error to signal that
+ _STLP_WHOLE_NATIVE_STD and _STLP_NO_OWN_NAMESPACE are incompatible
+ options.
+
+ * stlport/stl/config/stl_confix.h
+
+2006-11-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_sstream.h, _sstream.c: Add 2 helper functions _S_start and
+ _S_finish to hide complexity of code required to have read access to the
+ aggregated string instance internal buffer. Those 2 functions help keeping
+ basic_stringbuf implementation simple without requiring a friend
+ declaration in basic_string class and use of inheritance in _STLP_DEBUG
+ mode between the debug string and the non debug one.
+
+ * stlport/stl/_string.h, debug/_string.h, _string_sum_methods.h: Removed
+ friend declaration and inheritance (see above). This also avoids to restore
+ some workarounds that used to be necessary when _STLP_DEBUG mode was using
+ inheritance in all the debug containers.
+
+2006-11-04 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/num_put_float.cpp: According C Standard number of digits in the
+ exponent part of scientific output should be at least 2, C99 even says
+ that we shouldn't add zeros if there are more than 3 significant digits.
+
+ * test/unit/complete_digits.h: Modified according to above rules.
+
+2006-11-02 Francois Dumont <dums@users.sourceforge.net>
+
+ * Repository: Merged STLPORT_5_1_RC3 tag changes up to r2771 into the trunk.
+ Now trunk is really in sync with STLPORT_5_1 branch.
+
+ * etc/ChangeLog: Now contains only trunk modif, 5.1 changes are in
+ ChangeLog-5.1.
+
+2006-11-02 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * Repository: merged from 5.1 branch.
+
+2006-11-01 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_stdexcept_base.h: Patch from Uli to simplify
+ __Named_Exception implementation.
+
+2006-10-31 Francois Dumont <dums@users.sourceforge.net>
+
+ * build/test/unit/Makefile.inc: Restore STLport version information that
+ had mysteriously disappeared in a previous modification.
+
+ * stlport/stl/_num_put.c: Disable warning for MSVC that signal problem in
+ cast from pointer to unsigned long.
+
+ * src/num_put_float.cpp: Fix buffer overflow introduce by a previous
+ modification. Now STLport appends '0' so that floating point scientific
+ output has a constant size. MAXESIZ renamed in MAXEDIGITS to make macro
+ signification more obvious.
+
+ * test/unit/complete_digits.h: New file containing the function giving
+ platform dependant number of digits in STLport scientific output of
+ floating point types.
+
+ * test/unit/num_put_get_test.cpp, locale_test.cpp: Adapt tests to latest
+ STLport modifications.
+
+2006-10-30 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_stlport_version.h: Upgrade STLport version information
+ to reflect built libraries.
+
+2006-10-24 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/config/host.h, _linux.h: force usage malloc_alloc as default
+ allocator on systems with glibc 2.3.x and later due to better performance.
+
+ * stlport/stl/_alloc.h: remove _STLP_MALLOC_USABLE_SIZE dependant
+ code---not really used.
+
+ * stlport/stl/_alloc.c: remove recalculation of __n [Francois was right];
+ remove _STLP_MALLOC_USABLE_SIZE dependant code---not really used.
+
+ * src/allocators.cpp: remove additional __malloc_alloc_impl class---not
+ required; add mutex lock for custom __malloc_alloc oom handler change/use
+ [in multi-threaded environment].
+
+2006-10-16 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/c_locale.h, _mbstate_t.h, src/c_locale.h, c_locale.c:
+ merge changes from STLPORT_5_1 branch, see 2006-10-12 [Francois Dumont];
+ may be problems on Solaris, and FreeBSD---more check required.
+
+2006-10-13 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * Repository: merge changes [not all] 2006-10-12 from STLPORT_5_1 branch
+
+2006-10-12 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * Repository: merge changes from STLPORT_5_1 branch (records
+ from 2006-10-06 to 2006-10-04).
+
+ * stlport/stl/_alloc.c: Hmm, looks like deallocation size in
+ 2006-10-06 is wrong.
+
+ * stlport/stl/_num_put.c: print pointer as in fix width form, and
+ with base 0x, independent, zero pointer or not.
+
+ * test/unit/num_put_get_test.cpp: test for issue above.
+
+ * test/unit/string_test.cpp: test for overloaded operators
+ and temporary string; inspired by problems with some compilers.
+
+ * stlport/stl/_mbstate_t.h: revert back changes from STLPORT_5_1 branch;
+ mbstate_t couple with wchar closely, and sometimes has compex and implicit
+ dependance; include wchar.h first required!
+
+2006-09-12 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/string_test.cpp: add test for bug report #1541499,
+ problem not detected; looks like gcc 4.1.1 can compile te_tmp test
+ correctly [sum operations under class derived from string, with
+ _STLP_USE_TEMPLATE_EXPRESSION].
+
+2006-09-08 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_sstream.h, _sstream.c: remove double buffering
+ on write only underlying string as buffer. Use knowlege about
+ string implementation, this should improve performance, and,
+ at least simplify code and avoid logic that already present in
+ string implementation.
+
+ * stlport/stl/_string_base.h: basic_streambuf is friend, to access
+ to internal function (access to storage pointers).
+
+ * stlport/stl/debug/_string.h, _string_sum_methods.h: change usage
+ of 'non-debug string', from 'use of' relation to 'inherit' releation.
+ Useful for access basic_streambuf to string storage in _STLP_DEBUG
+ mode too.
+
+ * test/unit/sstream_test.cpp: test for tellp call; change test
+ with inited ostringstream in accordance with another Standard
+ treatment.
+
+ * stlport/stl/_streambuf.h: remove ancient code, that can't
+ work with present code in any case.
+
+ * src/c_locale.c: ditto
+
+ * build/lib/Makefile.inc: bump minor version (5.2.0)
+
+2006-07-27 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport: Adopt include_next GNU extension for the following reasons:
+ - Standard headers do not have to be categorised anymore to be
+ included, we could have a wrong include order if headers are not
+ correctly categorized.
+ - Package builder can use any folder structure they want for gcc,
+ STLport won't have to be customized anymore.
+ - Make STLport usable with other library that also use the shadow
+ header trick to modify native headers content.
+
+ * stlport/stl/config/_gcc.h: Add definition of _STLP_HAS_INCLUDE_NEXT
+ macro to signal that this compiler preprocessor support include_next.
+ Removed all definition of native headers path that are now useless.
+
+2006-03-27 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/num_put_float.cpp: use buffers that at least longer
+ than maximal double [or long double] exponent, so avoid
+ potential vulnerabilities; this allow to read really long
+ fix-float numbers [with lost of significant digits, of course].
+
+ * test/unit/floatio_test.cpp: add test for issue above
+
+2006-03-23 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/cxa.c: remove wrong exclusion of lock for Solaris.
diff --git a/etc/ChangeLog-4.0 b/etc/ChangeLog-4.0
new file mode 100644
index 0000000..03161cd
--- /dev/null
+++ b/etc/ChangeLog-4.0
@@ -0,0 +1,668 @@
+The following fix was made in 4.0 since 4.0 Release Candidate :
+
+ * _threads.h/_config.h : for all platforms, static mutexes made non-indirect
+
+ * _iterator_base.h : made possible to choose between iterator_traits approach
+ and old-style iterator queries like iterator_category(), value_type(), etc.
+ (Thanks to John R. Bandela for pointing this out)
+ * _config.h, stl_user_config.h : introduced __STL_OLD_HP_ITERATOR_QUERIES switch to
+ allow old-style and new-style iterator queries (for all compilers).
+ iterator_traits<> made always defined.
+
+ * _ptr_specialize.h - specializations of type_traits<> for compilers w/o partial spec
+ moved into separate file. Added iterator_traits<> specializations for pointer types
+ for __STL_NO_OLD_HP_ITERATOR_QUERIES case. Macro __STL_POINTERS_SPECIALIZE is now available
+ to specialize both type_traits and iterator_traits for a pointer to user-defined
+ type (latter for standard-style iterator queries mode only)
+
+ * vc5.mak : __STL_NO_FORCE_INSTANTIATE flag restored
+
+ * _site_config.h : if __STL_NO_NEW_IOSTREAMS or __STL_NO_IOSTREAMS specified,
+ SGI iostreams are being turned off. __STL_NO_SGI_IOSTREAMS moved into stl_user_config.h
+ (Thanks to Sathish T C for the report)
+
+ * stl_watcom.h : _REENTRANT is being set if _MT is set (thanks to Ricardo E. Gayoso for the input)
+
+The following fix was made in 4.0 Release Candidate :
+ * _threads.h, _alloc.c : fixed use of _STL_mutex_base instead of _STL_STATIC_MUTEX macro
+
+The following changes were made in 4.0 Release Candidate since 4.0 beta 8:
+
+ * fstream.cpp : WIN32 fstreambuf::open flag mapping fixed
+ (thanks to Alberto Barbati for the reports)
+
+ * ctype.cpp : fixed classic table regarding ios_base::print/ios_base::space
+ conflict (thanks to Alberto Barbati for the report)
+
+ * cmath : added same workaround for SUN's math exception/std::exception name clash
+ as was there in math.h before
+
+ * _streambuf.c : added "typename" to out-of-line functions (thanks to Michael Tsirkin for the report)
+
+ * README fixed to be consistent about SGI iostreams setting (thanks to Ed Brey for the report)
+
+ * _bitset.h : fixed SUN CC 4.2 crash with -g option (thanks to Alex Vanic for the report),
+ fixed bug in bitset<>::reference base bitset typedef
+
+ * _threads.h/.c - fixed issue with inconsistent system's macro for initialization
+ and warning about partially bracketed initializer
+
+ * debug/_vector.h : fixed _Vector_nonconst_traits specialization for bit_vector
+ (thanks for Dave Abrahams for the fix & reminder)
+
+ * config/msvc.h - addidional level 4 warnings suppressed (thanks to Ed Brey for the report)
+ * _ios.h : fixed DLL export decl for MSVC (thanks to Alberto Barbati for the report)
+
+ * stdio_streambuf.cpp : compatibility fix for glibc 2.2 (thanks to Bill Shanahan for the patch)
+ * _iterator_base.h : added iterator<output_iterator_tag, void,..> specialization;
+ _stream_iterator.h : ostream_iterator changed to inherit from iterator<>
+ (thanks to Raphael Bossek for the report)
+
+ * INSTALL : added some exaples and fixed typos (thanks to Beman Dawes for the report)
+
+ * _site_config.h : more consistency checks for MT (thanks to John Maddock for the input)
+
+ * _messages_facets.h : added DLL export decls (thanks to John Maddock for the report)
+
+ * complex_io_w.cpp : fixed specialization syntax for aCC (thanks to Paul E. Blanchard for the report)
+
+ * complex_exp.cpp : fixed pow() bug for negative arguments (thanks to Anton Sergeev for the report)
+ * _fstream.h/_streambuf.h : MRC/MPW workarounds (thanks for Tsutomu Yoshida for the report)
+
+ * using/fstream.h : added missing end-of-line (thanks to Jean-Francois Panisset for the report)
+
+ * <typeinfo> : workaround for VC++ 6.0 defining type_info in gobal namespace (thanks to Bosko Ivanisevic for pointing that out)
+
+ * _threads.h/_threads.c/pthread_alloc : improved pthreads portability (thatnks to Michael Tsirkin for the patch)
+
+ * _debug.h/_debug.c : __STL_ASSERT/__STL_VERBOSE_ASSERT/__STL_VERBOSE_RETUN macros guarded to be overridable by user (thanks to Tony Gould for the input)
+
+ * _valarray.h : added assert to operator=
+
+ * config/vc_select_lib.h : added _AFXDLL recognition (thanks to Andrew Phipps for input)
+
+ * _rope.h : added default constructors to please gcc-2.7.2
+
+ * _set.h/_hash_set.h : pointer and reference typedefs fixed (thanks to Anton Sergeev for the report)
+
+ * stl/_config.h : stl_user config.h included prior to other parts of configuration
+ (thanks to Frank Samuel for the report)
+
+The following changes were made in 4.0 beta 8 since 4.0 beta 7:
+
+ * Merged changes for 06/08 SGI library snapshot; mostly in locale
+
+ * Merged series of fixes/workarounds by Tsutomu Yoshida (thanks!):
+ * _rope.c - fixed memory leak bug;
+ * _debug.c/_debug.h - added extra zero-initialization for more robustness;
+ * _list.h - MPW - specific fixes;
+ * _hashtable.h - fixed debug renaming clash for __STL_USE_ABBREVS
+ * EH workarounds to make Apple compilers behave
+
+ * _fstream.c : fixed tellg() bug in text mode
+
+ * <csignal> : added sig_atomic_t import
+
+ * series of fixes for HP aCC 1.23 ( thanks to Michael Tsirkin for the patch ):
+ _bvector.h : all relops are specialized;
+ stl_hpacc.h - fixed config;
+ hpacc.mak : added makefiles for HP aCC in src and test
+ debug/_iterator.h, debug/_vector.h - removed future errors due to baseclass member use
+
+ * <cstdlib> : added import of system() call (thanks to Petr Ovchenkov for the report)
+
+ * _REENTRANT is now set by default to be on for all SGI iostreams compilations.
+ Same is being enforced if SGI iostreams are used.
+
+ * _pair.h : added workaround for make_pair in case of char literals
+ (extension, only works with partial function order)
+
+ * config/stl_gcc.h - fixed configuration problem for "g++-3" directory used in Cygnus and Mingw
+ distributions for gcc-2.95.2, while all other platforms use "g++". Added recognition section.
+ Thanks to Dave Abrahams for the report.
+
+ * config/stl_mlc.h : added support for MLC compiler (thanks to Anton Sergeev for the patch)
+
+ * <memory> : auto_ptr simplified (thanks to Kon Tantos for problem report)
+
+ * num_get.cpp : included <ostream> to get external symbols right.
+
+ * stl_ibm.h : __STL_NO_TYPEINFO added for OS/2 (thanks to Willie Arbuckle for the report)
+
+ * stl_bc.h : fixed enforcement of static library until dynamic made to work (thanks to J. Lambert for the report)
+ * src/stlport.rc : improved version definition to work with mingw32, <winres.h> changed to <windows.h>
+
+ * src/mingw32.mak : Made use of stlport.rc for DLL build (thanks to Danny Smith for the suggestion)
+ * debug/_vector.h : name clash removed for _Base (thanks to Will Fike for the report)
+
+ * _monetary.h - added "static const bool intl" member to meneypunct<> templates
+ (thanks to Anton Sergeev for the report)
+
+ * _bitset.h : added forward friend decraration for reference (thanks to Anton Sergeev for the report)
+
+ * _tree.h : made _Rb_tree_base_iterator::_M_node initialized in default constructor (thanks to Dean Sturtevant for the report)
+
+ * _set.h : reinterpret_cast<> changed to C-style cast (thanks to Dave Abrahams for the suggestion)
+
+ * Use of raw SGI allocators (like __node_alloc) as an allocator parameter deprecated,
+ available only with __STL_USE_RAW_SGI_ALLOCATORS macro. May be removed later.
+ __allocator<T> still available unless __STL_NO_EXTENSIONS is specified
+
+ * _limits.h/_limits.c - alignment fix for Solaris;
+ * Modified __format_float* routines to take long double as parameter;
+ (thatnks to Anthony Williams for the patch)
+
+ * debug/_iterator.h - wrappers for noncompliant compilers moved under
+ #ifdef __SGI_STL_NO_ARROW_OPERATOR (thanks to Dave Abrahams for the input)
+
+ * _numeric_facets.h - num_put<> , num_get<> virtual members made outline to work
+ aroung gcc-2.95 bug.
+
+ * <cstdio> : undefined obsolete C macros : getchar/putchar & the like.
+
+ * ctype.cpp : fixed bug with ctype<char>::is (const char*, const char*, mask)
+
+ * ctype.cpp : fixed is(print) for certain platforms where print is a separate flag
+
+ * ftstream.cpp : fixed corner case bug for Win32 text output (thanks for Dirk Schreib for the report)
+
+ * _streambuf.h, _fstream.h, stdio_strembuf.h : fixed overflow/pbackfail() virtuals definition;
+ * _bitset.h : _M_copy_from_string fixed for non-member-template case (thanks to Alex Vanic for the report)
+
+ * gcc-glibc.mak, common_macros.mak : GLIBC compilation fixes (thanks to Thomas Witt for the report)
+ * WCHAR_MIN, WCHAR_MAX definitions moved from <limits> to <cwchar>
+
+ * char_traits<char>::to_char_type : parameter changed to int
+
+ * <cstddef> included in <new> (for size_t)
+
+ * _codecvt<>::do_length: fixed first parameter to be const mbstate_t &;
+ virtual fns moved into .cpp, to work aroung gcc bugs
+
+ * _complex.h : fixed complex<>::operator= and constructors signature to take const T&
+
+ * _istream.c : fixed formatted input involving binary '0'
+
+ * locale_impl.cpp : insertion of time_put<wchar_t> fixed
+
+The following changes were made in 4.0 beta 7 since 4.0 beta 6:
+
+ * Merged series of fixes/workarounds by Tsutomu Yoshida (thanks!):
+ * cmath, _complex.h, stl_apple.h, _deque.h - MPW/MRC specific workarounds
+ * _bitset.h - removed the obsolete _WordT template parameters.
+ * _ctype.h, _codecvt.h, _collate.h, _istream.h, _messages_facets.h, _monetary.c
+ _monetary.h, _numeric_facets.h, _time_facets.h - added workaround for locale's nested class.
+ * _ostream.c_ostream.h - added proposed modification against the <ostream> circular inclusion problem.
+ * test/eh/test_deque.cpp - removed the obsolete template argument
+
+ * _bitset.h - removed obsolete adaptor (thanks to Alex Vanic for the report)
+
+ * _[io]stream.h - removed extra DLL specs (thanks to Danny Smith for the report)
+
+ * stl_msvc.h - fixed bug caused static lib to always be selected
+
+ * gcc.mak - fixed AR definition for static link
+
+ * Added workaround for static locale::id member in DLL for mingw32 (thanks for Danny Smith for the report)
+
+ * _string_io.h : added _widen() to get getline() compile with wchar (somewhat missing in b6 , thanks to Mikhail Leonov for reminder)
+
+ * threads.h - fixed guards for DreamSega WinCE (thanks to Ben Nason for the report)
+
+ * fstream.cpp : fixed truncation for WIN32 (thanks to Bruce Alderson for the report)
+
+ * _istream.c/_M_ignore_unbuffered() - fixed count bug
+
+ * _istream.c/ readsome() : fixed extra failbit setting on eof
+
+ * __get_integer - enhanced using a table; input value made unchanged in case of error.
+
+ * __get_base_or_zero - more code factored out
+
+ * stl_wince.h : fixed assert() definition for Win CE (thanks to Andrew Waters for the report)
+
+ * vc_select_lib.h " fixed __declspec selection for Win CE (thanks to Andrew Waters for the report)
+
+ * _rope.c - fixed bug in _S_destr_concat_char_iter (thanks to E.Musser for the fix)
+
+ * debug/_vector.h - fixed DLL export for vector<void*>
+
+ * _vector.h, _deque.h, _bvector.h - obsolete guards around at() methods removed ;
+ * type_traits.h - WinCE compatibility fixes for -> operator definition ;
+ * _vector.h, _deque,h - removed extra casts (thanks to Andrew Waters for the report)
+
+ * _algobase.h - optimized lexicografical_compare() overload for char*
+
+The following changes were made in 4.0 beta 6 since 4.0 beta 5:
+
+ * Merged changes from SGI STL snapshots 04/03, 04/14, 04/18.
+
+ * Iostreams ported to Apple MPW/MRC (thanks to Tsutomu Yoshida for the contribution)
+
+ * Iostreams ported to OSF1/Tru64 (thanks to Marc W. Mengel for the contribution)
+
+ * Iostreams ported to FreeBSD ( Thanks to Sms for the contribution)
+
+ * <deque> : extra template parameter removed
+
+ * locale::id, locale::facet : reverted to nested classes as standard prescribes
+
+ * _string_io.h : added _widen() to get getline() compile with wchar (thanks to Mikhail Leonov for the patch)
+
+ * collate_byname[_w].cpp : fixes for VC++ 5.0 build w/__STL_DEBUG (thanks to Petr Ovchenkov for the patch)
+
+ * <complex> : __STL_COMPLEX_NAMESPACE defined before inclusion of impl. header
+ (thanks to Matthew Kelly for the patch)
+
+ * makefiles in "src" : improved to get each compiler to put object files in separate directory :
+ ./obj/$(COMP)/Debug, etc. COMP is given some default value for each compiler, but may be also overridden.
+
+ * "src" subdirectory : added stlport_prefix.h file for precompiled header support;
+ VC++ makefiles make use of them
+
+ * stl/_iterator_base.h : provided __STL_NONTEMPL_BASE_MATCH_BUG
+ workaround for new form of distance().
+
+ * <limits> : added cast to WCHAR_MAX definition (thanks for Dave Abrahams for the report).
+
+ * stl_user_config.h, stl/_config.h - setting splitted and organized more properly.
+
+ * time_facets.cpp - extra instantiations removed (thanks to Matti Rintala for the report).
+
+ * stdio_streambuf.h : added explicit qualifications of C lib functions for gcc-2.91
+
+ * SGI code used for compatibility w/older versions are guarded with #ifndef __STL_NO_ANACHRONISMS
+
+ * SGI extensions are guarded with #ifndef __STL_NO_EXTENSIONS
+
+ * SGI/HP anachronisms are guarded with #ifndef __STL_NO_ANACHRONISMS
+
+ * <typeinfo> : .h file included if __STL_NO_NEW_NEW header is set
+ (thanks to Willie Arbuckle for the report)
+
+ * Suppresed spurious BC55 warnings about iterators
+
+ * complex_io.h - fixed operators declarations for MetroWerks
+
+ * debug/_slist.h - cleaned up use of stl_debug_do obsolete macro (thanks to Matti Rintala)
+
+ * debug/_iterator.h, debug/_vector.h - fixed relaxed iterator constructors (thanks to Dave Abrahams for the patch)
+
+ * stl/_complex.h - fixes for gcc-2.95 on IRIX (thanks to Marc W. Mengel)
+
+ * debug/_iterator.h : fixed relaxed const/non-const iterator construction for debug mode
+ (thanks to Dave Abrahams for the patch)
+
+ * collate : added workaround for SUNpro linker (thanks to Petr Ovchenkov for the fix)
+
+ * _ios.h, _streambuf.h - added obsolete stuff required by the standard
+
+ * _config.h/stdexcept - introduced __STL_NOTHROW_INHERITED to be used when we actually need
+ exception specification due to inheritance (thanks to Joe for the report)
+
+ * _locale.h:104 : fixed ummaned parameters
+
+ * _tempbuf.h - fixed absent inclusion of _tempbuf.c
+
+ * <exception> : relaxed rules for importing vendor symbols
+
+ * _deque.h - added != operator
+
+ * _streambuf.h - fixed snextc() bug for wchar_t
+
+ * <ostream>, _numeric_facets.h - circular dependency resolved
+
+ * stl/_iosfwd.h - added include guard
+
+ * basic_[io]stream::sentry made inner class again (as per standard)
+ for non-DLL compilations.
+
+ * vector<void*> is used in locale implementation to reduce code bloat,
+ vector<void*> exported from DLL
+
+ * <stdexcept> : exported more stuff
+
+ * stl_intel.h : ICL config merged into stl_msvc.h
+
+ * gcc.mak - fixed for shared target
+
+The following changes were made in 4.0 beta 5 since 4.0 beta 4:
+
+ * _hastable.c:263 : removed inneeded cast (thanks to Will Fike for the report)
+
+ * debug/_string.h : added conversion to non-SGI string (thanks to Todd Richmond for the report)
+
+ * _complex.h : fixed DLL declarations for i/o operators
+
+ * _ostream.h : fixed sentry behavoiur and DLL specs.
+
+ * _istream.h : fixed DLL specs, optimized some try/catch blocks
+
+ * _vector.h : fixed vector::insert body definition for __STL_INLINE_MEMBER_TEMPLATES
+
+ * <exception> : more compilers listed as having full exception header
+
+ * debug/_debug.h : added namespace to __STL_ASSERT for EH test which uses this internal macro.
+
+ * resource info fixed (thanks to Michael Entin for the report)
+
+ * debug/_string.h : fixed _M_start resolution bug (thanks to Rob for the report )
+
+ * <new> : added import of new_handler stuff from vendor namespace (thanks to Niran Bala for the report).
+
+ * src/c_locale_glibc - missed directory contents restored (thanks to Todd Rider for the report)
+
+ * mwerks_prj - project updated for new file set, target names for x86 changed to conform to common schema
+
+ * _ostream.c/_istream.c : fixed lookup for _S_eof symbol (thanks to Anton Sergeev for the report)
+
+ * _ios.h - fixed VC++ DLL warning for specializations
+
+ * stl_ibm.h - disabled "long long" due to incomplete support on MVS by request (thanks to Tinny Ng)
+
+ * char_traits.h - worked around weird gcc internal bug (__sz identifier changed to _Sz)
+
+The following changes were made in 4.0 beta 4 since 4.0 beta 3:
+
+ * "src" directory : source divided into smaller parts to be more manageable and to
+ get more cache locality
+
+ * throw specifications removed (macros made void) - thanks to Dave Abrahams for the suggestion
+
+ * stl/_list.c - fixed reverse() "inline",
+ _deque.h - fixed cast bug for xlC (thanks to Alex Vanic for the reports)
+
+ * stl/_strstream.h - fixed DLL specs (thanks to Parcival Willems for the report)
+
+ * stl/_string.h, debug/_string.h - fixed conversion from native string with __STL_DEBUG
+ (thanks to Todd Richmond for the report).
+
+ * stl/_istream.h - fixed clash of "__N" symbol with ctype.h macro for some compilers
+ (thanks to Kees de Bruin for the report)
+
+ * Configuration fixed for Borland C++ 5.02 compiler [ deque still does not work with it ]
+
+ * gcc-2.7.2 configuration fixed
+
+ * SGI iostreams now work for Borland 5.5 with static lib , some problems with
+ locale initialization when DLL is used.
+
+ * __get_c_string exported in DLL (thanks to Ed Ball for the report).
+
+ * ENDIAN fixes for CodeWarrior/DEC (thanks to Kevin Wooten for bringing this up)
+
+ * wrap_std/h/strstream.h - added missing wrapper (Thanks to Laurent for the report)
+
+ * stl_hpacc.h - fixed #endif bug,
+ _limits.h/.c - fixed array initialization,
+ _string_io.h, _locale.h - fixed circular dependancy,
+ _set.[hc], _hashtable.c, _set.h - added __REINTERPRET_CAST need by some compilers;
+ _i[o]stream.c, _rope.[hc] - lookup fixed for dependant symbols
+ (thanks to Alain Miniussi for the reports)
+
+After-release minor bugfixes for beta3:
+
+ * stl/_list.c - fixed reverse() [ new SGI code, merged unported first ]
+ Thanks for everybody who reported it.
+
+ * stl/_bvector.h : fixed ambiguity problem with relational iterators
+ for __STL_NO_BOOL case (thanks to Alex Vanic for the report).
+
+ * stl/_alloc.c, stl/_threads.c - fixed static member definitions for compilers
+ that lack automatic static data members (gcc-2.7). Thanks to Huang-Ming Huang
+ for the report.
+
+ * standard wide streams initialization bug on Win32 fixed (thanks to Harold Putman for the
+ report)
+
+The following changes were made in 4.0 beta 3 since 4.0 beta 2:
+
+ * Merged SGI changes from 02/18 snapshot.
+
+ * Ming32W (gcc Win32 port using MS runtime lib) is now fully supported.
+
+ * .dll build schema improved, now builds with mingw32 and Borland C++
+ (Borland has some problem with numeric i/o)
+
+ * VC++ version bugfixes in <xstring>/<xutility>/<xstring>
+ (thanks to Todd Richmond for the report)
+
+ * _bvector.h - relational operators defined only for "bit_vector",
+ not for "vector" specializations (thanks to Edward Ball for the report)
+
+ * src/locale_impl.h - fixed multiple defined symbol problem with gcc
+ (Thanks to Matti Rintala for the report)
+
+ * config/stl_ibm.h - __STL_NO_TYPEINFO added (thanks for Tinny Ng).
+
+ * <string> : _stl_string_io.h/c introduced to fight inter-dependencies
+
+ * _bvector.h - added fix for -tempinc compilation on AIX (thanks to Alex Vanic for the patch)
+
+ * fstream.cpp - _M_write bug for Win32 text mode fixed (thanks to Mike Pyle)
+
+ * _string.h : debug version included prior to _string.c;
+
+ * debug/_debug.h/.c, debug/_deque.h, debug/_string.h - fixed debug mode bugs;
+ Apple compilers config fixes / iostream wrapping fixes / EH test fixes,
+ (thanks to Tsutomu Youshida for the patch)
+
+ * csetjmp/setjmp.h - guards added against VC++ #defines (thanks to Gavin Wood)
+
+ * stl/_iosfwd.h : __STL_DEFAULT_CONSTRUCTED used instead of __STL_NULL_CHAR_INIT
+ (thanks to Alex Vanic for the report)
+
+ * __stl_get_c_string() - made extern non-template for SGI iostreams mode.
+
+ * __cdecl calling convention fixes - now works for debug & non-debug code.
+
+ * _limits.h/.c : static data moved from inline functions into a class.
+
+ * stlport_msvc.rc resource file added for DLL's (thanks to Michael Entin)
+
+ * stlport/config/stl_wince.h : added abort()/assert() definitions
+ (thanks to Gavin Wood for the report)
+
+ * Initial iostreams port for xlC (thanks to Alexander Vanic for the patch).
+
+ * config files - made safe for C compilers
+
+ * src/c_locale_stub.c - made structure for full platform-dependent
+ locales other than "C". Glibc implementation merged.
+
+The following changes were made in 4.0 release candidate 2 since 4.0 release candidate 1:
+
+ * Solid approach to __STL_DEFAULT_CONSTRUCTOR_BUG problem implemented,
+ rope.h typo fixed (thanks to Alex Vanic for the report)
+
+ * getline and stream operators moved from _istream.c to _string.c
+ where they belong (thanks for Petr Ovchenkov)
+
+ * <new> fixed to import nothrow and nothrow_t
+
+ * Borland C++ 5.5 (free compiler) supported (iostreams won't compile yet).
+
+ * SUN CC 6.0 EA - new features unabled (most announced features still don't work though)
+
+ * HP ACC configuration updated, some fixes for new aCC beta(thanks to Alain Miniussi).
+
+ * Windows CE compatibility fixed (thanks to Gavin Wood for the report)
+
+ * <sstream> fixed for non-SGI case, ios.cpp bug in __STL_NO_EXCEPTIONS
+ mode fixed, debug iterators fix (thanks to Todd Richmond).
+
+ * VC++ 5.0 and 4.2 compatibility fixed (thanks to Ilya for the report)
+
+ * __cdecl calling convention explicitly specified for VC++ & static/global functions.
+
+ * vc_common.mk : debug type changed to CV (thanks to Mike Pyle for the solution)
+
+ * fstream.cpp : Win32 text mode : bugs fixed, SGI code used.
+ fixed _M_open() creation flags for Win32 (thanks to Mike Pyle for the report)
+
+ * "install" target added for VC++ to install .dll's into Win system directory.
+
+ * __STL_USE_STATIC_LIB switch added to add flexibility to VC++ linking.
+
+ * __stl_debug_message for WIN32/Unicode/MFC improved
+ (thanks to Edward Ball, Chvetsov for the reports)
+
+ * MVS fix for auto_ptr<> (thanks to Tinny Ng)
+
+ * debug/_tree.h, debug/_vector.h "typename" fixes, thanks to Matti Rintala.
+
+ * c_locale.h : fix for Solaris 2.5.x (thanks to B. K. Oxley)
+
+ * _bvector.h : Watcom compatibility fixed (thanks to Ricardo E. Gayoso for the report)
+
+ * __STL_DONT_REDEFINE_STD flag behaviour fixed
+
+The following changes were made in 4.0 release candidate 1 since 3.2.2 Beta 4 :
+
+ * Merged changes made to SGI standard library snapshot on 01/28.
+
+ * Fixed bug with istream reading numbers in hex mode (thanks to Dave Abrahams
+ for the patch).
+
+ * Debug mode redesigned (again) - no extra namespaces is being used
+ Finally, it works for MSVC and all other platforms.
+
+ * __SGI_STL_OWN_IOSTREAMS made to be the default mode except few platforms
+ not provided with makefiles to build STLport yet.
+
+ * Changed strategy on redefinig std:: namespace.
+ prolog/epilog technology used to get clean namespace wrapping.
+ It also allows for managing stack of pragmas
+ (see stlport/stl/config/_prolog.h,_epilog.h) to get rid of warnings.
+ Note : default namespace changed to _STL:: to satisfy implementation
+ constraints and to allow for more compact symbols.
+ "stlport::" namespace is still defined for backwards compatibility.
+
+ * iostreams library now compiles on HP with aCC (thanks to Steven Serocki for the patch).
+
+ * Configuration for SUN Workshop 6.0 EA provided.
+
+ * For VC++, corresponding [selected by /MT(d) or /MD(d) switch]
+ STLport iostreams library is being linked automatically - all you
+ need is to put library in lib search path or specify additional library path.
+
+ * Ability to turn on all warnings in your own code if you're using
+ a compiler with appropriate support (e.g. MSVC6).
+
+ * Small fixes posted to the forum integrated:
+
+ * config/stl_wince.h : added __STL_HAS_NO_NEW_C_HEADERS switch
+ * wrap_std/strsream : fixed preprocessor bug, strstream.h included
+ when not using new-style headers
+ * other fixes
+
+The following changes were made in 3.2.2 beta 4 since 3.2.2 Beta 3:
+
+ * Merged changes made to SGI standard library snapshot on 01/10.
+
+ * Major restructuring of header files - for maintainability and
+ 8.3 filesystems benefit.
+
+ * Major debug mode improvements - new debug mode now works with
+ VC++, gcc, intel, SUNpro, MetroWerks.
+
+ * Regression test suite changed to new-style headers - thanks to
+ Dima Pasechnik for the initial port.
+
+ * <rope> fixes for Watcom
+
+ * many miscellanous fixes.
+
+The following changes were made in 3.2.2 beta 3 since 3.2.2 Beta 2:
+
+ * Merged changes made to SGI standard library snapshot in December.
+
+ * std:: is not used for STLport namespace even with SGI iostreams,
+ to avoid possible clashes and facilitate 3rd-party library use.
+ Same macro redefinition technique for stlport:: used to keep clients
+ code with literal std:: happy as in native iostreams mode.
+
+ * C library headers wrapping changed to allow multiple inclusion tricks
+ (needed by gcc-2.95 mostly)
+
+ * gcc-2.95 and CodeWarrior configurations updated.
+
+ * HP aCC fixes applied.
+
+ * Visual C++ - added static library targets, build refined.
+ Fixed memory-mapping bugs.
+
+ * auto_ptr updated, now it passes polymorphic tests with VC++.
+
+ * Many small bugfixes.
+
+The following changes were made in 3.2.2 beta 2 since 3.2.2 Beta 1:
+
+ * Fixed SUN CC deque<> problem with -g
+
+ * Added configuration and makefiles for DEC VMS, Borland and Win32 gcc.
+
+ * Merged changes made to November SGI standard library snapshot.
+
+ * config changes - "configure" made obsolete and moved into "stlport/config/new_compiler".
+
+ * __STL_TYPENAME_ON_RETURN_TYPE handling changed.
+
+ * Miscellanous fixes.
+
+The following changes were made in 3.2.2 Beta 1 since 3.2.1 release:
+
+ * SGI iostreams adopted. To use SGI iostreams, user have to set
+ __SGI_STL_OWN_IOSTREAMS flag and to build the library in "src"
+ directory to link with. Please read INSTALL file for detailed
+ instructions.
+ Default setting is NOT to use SGI iostreams (wrappers used as before).
+
+ * Debug mode completely redesigned - debug mode containers are
+ implemented in terms of wrappers around non-debug ones.
+ That provides for more clean and efficient implementation and
+ binary compatibility between debug and non-debug versions.
+
+ * Additional configurations added for platforms :
+ - gcc-2.95
+ - SUNpro CC 5.0 in "compatibility" mode
+ "configure" made obsolete.
+
+ * Bugfixes reported by users since 3.2.1 release merged
+
+The following changes were made in 3.2.1 since 3.2 release:
+
+ * Now, by default, STLPort renames std:: namespace for user
+ if __STL_USE_OWN_NAMESPACE is used. To make it possible, many new
+ wrapper headers introduced. Internally, STLport uses stlport:: namespace,
+ so no link- or run- time clashes are possible, and you don't have to rebuild
+ the runtime lib (which you don't want to).
+ This feature makes STLport usable out-of-the box, without any modifications
+ for client code, with any compiler.
+
+ * Code bloat reduction : hashtable<T> uses vector<void*> internally.
+
+ * Vector : efficiency/code bloat reduction fixes.
+
+ * Visual C++ : DLL export is supported for allocators and strings. To use it,
+ please define __STL_USE_DECLSPEC in all modules and __STL_DESIGNATED_DLL
+ for the DLL which is supposed to instantiate STLport exports (at least one
+ source of this DLL must include <string>.
+
+ * Visual C++ : for MT synchronization, <windows.h> is not included anymore.
+
+ * For Sunpro C++ 5.0 : all headers are linked into stlport/SC5, so only
+ one include path is needed. Note that SC5.0 has problems with relative
+ search path. It is easy to work around : in your makefiles, instead of
+ "STL_INCL=../.." , write "STL_INCL=${PWD}/../..".
+
+ * Configuration files provided for compilers :
+ KAI C++
+ DEC C++ (6.x, 5.x)
+ Borland 5.02 is back on the road (finally !)
+
+ * Windows CE config provided for Visual C++.
+
+ * __STL_NO_IOSTREAMS switch introduced for embedded platforms.
+
+ * Lots of minor config fixes and improvements for various platforms.
diff --git a/etc/ChangeLog-5.1 b/etc/ChangeLog-5.1
new file mode 100644
index 0000000..135650e
--- /dev/null
+++ b/etc/ChangeLog-5.1
@@ -0,0 +1,8350 @@
+2007-10-21 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/allocators.cpp: Add missing const_cast in lock free
+ allocator implementation when _STLP_LEAKS_PEDANTIC is defined.
+ Thanks trungantran on forum.
+
+2007-10-07 Francois Dumont <dums@users.sourceforge.net>
+
+ * STLport 5.1.4 released based on revision 3219. STLport-5.1.4
+ tag created.
+
+ * stlport/stl/_stlport_version.h, build/lib/Makefile.inc: Patch
+ version bump to 5 to prepare next potential patch release.
+
+2007-10-05 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/debug/_iterator.h, _string.h, src/string.cpp:
+ Removed useless and even invalid workaround used when
+ _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND is defined. There is now
+ only one construct check class __construct_checker,
+ __msvc6_construct_checker has been removed.
+
+2007-09-28 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * Platform tested: gcc 4.1.2 20060928 (prerelease)
+ (Ubuntu 4.1.1-13ubuntu5), i686 GNU/Linux, glibc 2.4;
+
+ * release-shared: fail on list_test.cpp:392
+ [CPPUNIT_ASSERT(lint1.size() == 20)], suspected compiler's bug;
+ 1 fail from 395 tests;
+
+ * stldbg-shared: passed 395 tests;
+
+ * Platform tested: gcc 4.1.2, i686 GNU/Linux, glibc 2.4;
+
+ * release-shared: fail on list_test.cpp:392
+ [CPPUNIT_ASSERT(lint1.size() == 20)], suspected compiler's bug;
+ 1 fail from 395 tests;
+
+ * stldbg-shared: passed 395 tests;
+
+ * Platform tested: gcc 4.2.1, i686 GNU/Linux, glibc 2.4;
+
+ * release-shared: passed 395 tests;
+
+ * stldbg-shared: passed 395 tests;
+
+ * Platform tested: gcc 4.1.1, i686 athlon-4 i386 GNU/Linux,
+ glibc 2.3.6;
+
+ * release-shared: passed 395 tests;
+
+ * stldbg-shared: passed 395 tests;
+
+ * src/c_locale_glibc/c_locale_glibc2.c: this is a C, so
+ decl allowd only on top of block;
+
+ * Platform tested: gcc 2.95.4 (debian), i686 GNU/Linux,
+ glibc 2.3.2;
+
+ * release-shared: build success, as library as unit tests,
+ but run unit tests fail---stalling on spinlock during library
+ load; looks like problem with correct initialization of
+ statics;
+
+ * stldbg-shared: fail build library, stlport/stl/debug/_hashtable.h:49:
+ declaration of `operator ==' as non-function
+
+2007-09-27 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/facets_byname.cpp: In collate::do_transform, consider
+ low == high as a special case, returns empty string in this
+ case.
+
+2007-09-27 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/find_test.cpp: array initialization missed.
+
+2007-09-17 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_num_get.h: Add _STLP_DECLSPEC specification to
+ several functions that might be access by external code when
+ num_get facet is instantiated with something else than the
+ Standard required instantiation.
+
+2007-09-11 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/c_locale_glibc/c_locale_glibc.c, c_locale_glibc2.c: Fix
+ _Locale_strxfrm and _Locale_wcxfrm implementation to take
+ into account strings that are not zero terminated.
+
+ * test/unit/locale_test.cpp: Add check that collate.tranform
+ method build a key only for chars in the range pass to method.
+
+2007-09-10 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/facets_byname.cpp: John Maddock bug report 1788618 fix.
+ Moreover remove use of an intermediate buffer to get result
+ of _Locale_strxfrm.
+
+ * test/unit/locale_test.cpp: Add tests for collate::transform
+ facet method.
+
+ * src/c_locale_win32/c_locale_win32.c: Small modification,
+ _Locale_strxfrm is supposed to return the number of chars
+ required to store the generated sorted key without the trailing
+ zero.
+
+ * src/c_locale_glibc/c_locale_glibc.c, c_locale_glibc2.c: Fix
+ implementation of _Locale_strxfrm, it should never return -1.
+
+2007-09-10 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_string.c: fix bugs in string rfind, find_last_of,
+ find_last_not_of [bug #1788700, position 0 was wrongly excluded];
+
+ * test/unit/string_test.cpp: test for problems above. Thanks
+ to Bred Bored for bug report and initial test.
+
+ * unit tests: Linux 2.6.16.26 (athlon-4), gcc 4.1.1, glibc 2.3.6
+ "OK 395 tests" for release-shared and stldbg-shared targets.
+
+2007-09-09 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/rope_test.cpp, stlport/stl/_rope.h: test for
+ bug #1788615 [bug during copy of rope's iterator] and fix;
+ suggested by John Maddock.
+
+ * stlport/stl/_algobase.c: symmetry not required for
+ comparator in case of two different sequences comparison or
+ searching; symmetrical comparator just may not exist;
+
+ * stlport/stl/debug/_hashtable.h: symmetry not required for
+ comparator in hashtable in case of containers extention;
+ symmetrical comparator just may not exist;
+
+ * test/unit/alg_test.cpp: test for problem above, thanks
+ Oleg Obolenskiy.
+
+2007-09-06 Francois Dumont <dums@users.sourceforge.net>
+
+ * test/unit/strstream_buffer_read_test.cpp: Remove useless
+ strdup call that was moreover introducing a memory leak.
+
+2007-09-04 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/allocators.cpp: Fix implementation of _S_chunk_dealloc when
+ lock free implementation is not in use. Thanks bug report 1787636
+ from Sergej Zagursky.
+
+2007-08-31 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_cstdio.h, _ctime.h: Add missing macro definition
+ test before using _WIN32_WCE thanks bug report 1784174.
+
+ * stlport/stl/_bitset.h: Change macro tests in order to check
+ macro definition before using it thanks bug report 1785679.
+
+ * test/unit/bitset_test.cpp: Bitset::iostream new test to check
+ correct input/output of bitset class.
+
+ * build/Makefiles/gmake/gcc.mak: Add -Wundef gcc option when building
+ with gcc under Cygwin MinGW, it is an interesting option to detect
+ macro check errors.
+
+2007-08-26 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/config/user_config.h, host.h: Moved the administrative
+ _STLP_USE_DEFAULT_FILE_OFFSET macro from user_config.h to host.h.
+
+ * stlport/stl/config/_gcc.h: Under MinGW we now use C symbols in
+ global namespace. Tests with 4.2.1 gcc version shows that C symbols
+ are not necessarily put in std namespace.
+
+2007-08-23 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_complex.h: As in _iosfwd.h, removed useless
+ _STLP_CLASS_DECLSPEC attribute on complex class declaration.
+
+2007-08-23 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/debug/_vector.h: only random access iterators
+ allow operations 'less-than' and distance; for bidirectional
+ iterators removed usage of 'less-than', and for others
+ [like forward and input iterators] removed as usage of 'less-than'
+ as distance; thanks Oleg Obolenskiy for bug report;
+
+ * test/unit/ioiter_test.cpp: test for problem above.
+
+2007-08-18 Francois Dumont <dums@users.sourceforge.net>
+
+ * stlport/stl/_iosfwd.h: Removed useless _STLP_CLASS_DECLSPEC attribute
+ on class declaration. Latest gcc versions are reporting a warning about
+ it.
+
+2007-08-16 Francois Dumont <dums@users.sourceforge.net>
+
+ * src/dll_main.cpp: Removed useless _Atomic_swap_struct explicit
+ instantiation, moreover, MSVC 2005 do not support it.
+
+2007-08-15 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * Repository: bump lib version to 5.1.4;
+
+ * stlport/stl/char_traits.h, src/fstream.cpp: use 64-bits
+ file operations calls, if available on system; streamoff is
+ always off64_t, if _LARGEFILE_SOURCE or _LARGEFILE64_SOURCE
+ defined, i.e. if 64-bits file operations present;
+
+ * stlport/stl/config/user_config.h: add _STLP_USE_DEFAULT_FILE_OFFSET,
+ force use off_t for streamoff and appropriate file operations calls;
+ note, that this may lead to problems, for example if _FILE_OFFSET_BITS
+ defined as 64 somewhere in user's code;
+
+ * test/unit/fstream_test.cpp: test 64 bits type for filesize and
+ file offset.
+
+2007-07-22 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/fstream.cpp: force use lseek64/mmap64 for HP-UX, if _LARGEFILE64_SOURCE
+ defined; thanks for Michael Klein.
+
+2007-07-17 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_algo.c, stlport/stl/_algobase.c: search, the __tmp and
+ __p1 iterators always point at the same position, hence one of them
+ is redundant;
+
+ * stlport/stl/_algobase.c: in the main-loop of search there are two
+ successive while-loops doing exactly the same thing; one of them is
+ redundant and, since it is inside the main-loop, it slows down
+ the algorithm significantly;
+
+ * stlport/stl/_algo.c, stlport/stl/_algobase.c: in the search the main-loop
+ condition "while (__first1 != __last1)" is always true and consequently
+ redundant; this is because the initial adn in-loop conditions virtually
+ act as guards and will never let the main-loop condition to fail; since
+ this condition is evaluated in every main-loop iteration, its removal
+ will also improve the performance of the algorithm; thanks for
+ Jim Xochellis for this suggestions.
+
+2007-07-15 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/strstream.cpp: "get end" pointer should be initialized
+ to the "begin of get + N" in obsolete strstream; bug #1536503,
+ thanks for Jean-Eric Cuendet;
+
+ * test/unit/strstream_buffer_read_test.cpp, build/test/unit/Makefile.inc:
+ test for bug above; [submitted by Jean-Eric Cuendet].
+
+2007-04-02 Francois Dumont <dums@stlport...>
+
+ * 5.1.3 released based on revision 2983. STLport-5.1.3 tag created.
+
+2007-03-30 Francois Dumont <dums@stlport...>
+
+ * build/lib/configure.bat: Restore TARGET_PROC_SUBTYPE definition
+ to distinguish between ARM architectures.
+
+2007-03-22 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config/_msvc.h, _deque.h, _bvector.h: Portage from
+ Ulrich Echkardt to EVC 8.
+
+ * doc/README.evc8, README.wince: New documentations about Windows
+ CE and EVC 8 from Ulrich Echkardt.
+
+ * doc/evc_workaround.txt, doc/README.evc3, First file merged to the
+ second one.
+
+ * stlport/stl/_stlport_version.h: Bump patch level to 3.
+
+2007-03-07 Francois Dumont <dums@stlport...>
+
+ * src/dll_main.cpp, stlport/stl/_stdexcept_base.h: Change strncpy_s
+ invocation to pass _TRUNCATE parameter rather than number of chars
+ to put in destination string. Default strncpy_s behavior is not to
+ truncate string if necessary but to report the issue throught a handler
+ which lead to an application crash if no handler has been set. Thanks
+ Bronek Kozicki bug report 1674974.
+
+ * stlport/stl/type_traits.h: Add a default constructor declaration
+ in _TpWithState class to make gcc happy when class is instanciated
+ with a class with no default constructor.
+
+ * stlport/stl/config/_windows.h: Change definition of
+ _STLP_WIN32_VERSION macro. We do not report definition inconsistency
+ between WINVER and _WIN32_VERSION anymore, WINVER is prefered.
+
+2007-03-01 Francois Dumont <dums@stlport...>
+
+ * test/unit/bitset_test.cpp: Add test for the to_string member
+ method.
+
+ * stlport/stl/config/_msvc.h, test/unit/locale_test.cpp: Change
+ MSVC6 configuration that now defines _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS.
+ Even if MSVC6 supports explicit specification of function template
+ parameters it do not support the explicit specification for
+ template methods, unit tests are showing this problem.
+
+ * stlport/stl/type_traits.h, _alloc.h: Small change in stateless
+ class detection feature. Introduce _IsStateless helper struct for
+ this purpose even if it can only be used with pure class type and
+ not with build-in types or enum or union. It avoids MSVC8 warnings.
+
+2007-02-25 Francois Dumont <dums@stlport...>
+
+ * 5.1.2 released based on revision 2937, tag STLport-5.1.2 created.
+
+ * stlport/stl/config/_prolog.h, build/Makefiles/gmake/bcc.mak,
+ Patch from Eric Sanford to remove empty base class optimization
+ for Borland compilers.
+
+ * test/unit/vector_test.cpp: Enable VectorTest::ebo test for Borland
+ compilers.
+
+2007-02-22 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_alloc.h: Add a workaround for compilers with buggy
+ empty base class optimization which is used in _STLP_alloc_proxy
+ class.
+
+ * test/unit/vector_test.cpp: New test case VectorTest::ebo to show
+ problem above.
+
+2007-02-21 Francois Dumont <dums@stlport...>
+
+ * src/c_locale_win32/c_locale_win32.c: Fixed __ConvertDate and
+ __ConvertTime to avoid potential infinite loop (bug report
+ 1663604)
+
+2007-02-16 Francois Dumont <dums@stlport...>
+
+ * STLport 5.1.1 released based on revision 2919. STLport-5.1.1
+ tag created.
+
+2007-02-14 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config/_intel.h: Configuration fix, Intel compiler
+ before 8.1 have problem with template method specialization. Thanks
+ Dragan Tubic.
+
+2007-02-09 Francois Dumont <dums@stlport...>
+
+ * test/unit/locale_test.cpp: Enhance LocaleTest::collate_facet
+ test case to reveal a bug in glibc localization portage.
+
+ * src/c_locale_glibc/c_locale_glibc2.c: Fixed _Locale_strcmp
+ and _Locale_strcmp and _Locale_strwcmp implementation to take
+ into account buffer size, comparison used to always been done on the
+ whole input strings up to the termination character.
+
+ * stlport/stl/type_manips.h, test/unit/mvctor_test.cpp,
+ type_traits_test.cpp: Remove relation between STLport __true_type and
+ __false_type and homonyms ones in libstd++. Add workaround in the 2
+ test suite requiring use of those types.
+
+2007-02-08 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_threads.h, src/locale.cpp: Add missing parenthesis
+ in some macro checks thanks Jan Echternash bug report 1653966.
+
+ * test/unit/locale_test.cpp: Made LocaleTest::collate_facet test
+ really meaningful even if it requires french locale support for
+ part of it.
+
+2007-02-01 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/config/_solaris.h: __LONG_MAX__ defined on
+ 64-bits SPARCs. Thanks Aleksey Sanin.
+
+ * stlport/stl/_sparc_atomic.h, stlport/stl/_threads.h:
+ fixes for modern SPARCs. Thanks Aleksey Sanin.
+
+2007-01-28 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/debug/_deque.h: Fix iterator invalidation in erase
+ of an iterator range thanks to Steve Lobasso indirect report (bug
+ 1645657).
+
+ * test/unit/deque_test.cpp: New test case for deque erase methods.
+
+2007-01-19 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_locale.h, src/locale.cpp: Add throw() specification
+ on locale default constructor. Add const qualifier on locale::combine
+ method. Fixed combine implementation to correctly combine
+ *this with other locale instance.
+
+ * src/locale_impl.h: Removed _get_Locale_impl and
+ _copy_Nameless_Locale_impl already defined in stlport/stl/_locale.h.
+
+ * src/locale_impl.cpp: In _Locale_impl::insert add check that we
+ are working on 2 different facet instances before substitution.
+
+ * test/unit/locale_test.cpp: Add test case for locale::combine
+ method.
+
+2007-01-12 Francois Dumont <dums@stlport...>
+
+ * c_locale.h, c_locale_dummy.c, c_locale_glibc.c, c_locale_glibc2.c,
+ c_locale_win32.c: Creation of 2 new functions in the localization
+ framework _Locale_init and _Locale_final to allow localization
+ implementations to initialize and release any necessary resources.
+
+ * src/iostream.cpp: Call _Locale_init during io streams initialization
+ and _Locale_final at end.
+
+ * c_locale_win32/c_locale_win32.c: Add synchronization for locale
+ lcid look up from name required in multithreaded environment. Two
+ threads instanciating two facet instances from a given name might
+ have collide resulting in an undefined behavior. Critical section
+ used for synchronization is initialized in _Locale_init and freed
+ in _Locale_final.
+
+ * c_locale_win32/c_locale_win32.c: Add several fields in
+ _Locale_time struct to avoid use of static buffers in some locale
+ support functions like _Locale_d_t_fmt _Locale_long_d_t_fmt...
+ Moreover time format cannot be truncated anymore.
+
+2007-01-08 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_deque.c: Patch from Kevin Lin to fix iterator
+ returned by insert at position method.
+
+ * test/unit/deque_test.cpp: Add test case for the deque::insert
+ methods.
+
+2006-12-06 Francois Dumont <dums@stlport...>
+
+ * STLport 5.1.0 released based on STLPORT_5_1 branch revision 2750.
+
+2006-11-27 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config/_windows.h: Patch from Michael Fink to check
+ inclusion of winbase.h and windows.h.
+
+2006-11-24 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_fstream.h, src/fstream.cpp, iostream.cpp: Restore
+ computation of the system dependant page size that was hardcoded
+ to 4096. Initialisation code has been moved to a static method
+ called just after Standard iostream initialisation. This code used
+ to be in the _Filebuf_base constructor that might have been called
+ simultaneously by several threads.
+
+2006-11-17 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config/_macosx.h: Add endianess configuration.
+
+2006-11-16 Francois Dumont <dums@stlport...>
+
+ * test/unit/resolve_name.cpp: Clean most of MSVC6 workaround, only
+ one has been kept to have the test pass.
+
+2006-11-13 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_cwchar.h: Patch from Michael Fink to fix EVC3
+ missing mbstate_t definition.
+
+2006-11-07 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_threads.h: Removed _Atomic_swap_struct export
+ that should be useless as completely inlined. Moreover it was
+ generating a compilation error using MSVC 2005 under Windows
+ 64 bits.
+
+2006-10-26 Francois Dumont <dums@stlport...>
+
+ * test/unit/codecvt_test.cpp: Removed try/catch blocks not
+ supported by platform missing exception support and moreover
+ useless as we know the code called in the try and this code
+ do not throw (thanks Michael Fink report).
+
+ * build/Makefiles/nmake/targetdirs.mak, lib/clean.mak, app/clean.mak:
+ Complete clobber and distclean rules to really clean all generated
+ stuffs.
+
+ * build/Makefiles/nmake/top.mak: Patch from Gary Bartlett to make nmake
+ 'all' rule the default rule.
+
+2006-10-25 Francois Dumont <dums@stlport...>
+
+ * src/dll_main.cpp: Fix syntax error '>>' rather than '> >' in
+ a _STLP_alloc_proxy explicit instanciation.
+
+ * stlport/stl/_unordered_set.h: Fix template method for the
+ associative container extension, use _KT type rather than key_type.
+
+2006-10-20 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config: Removed some used macros
+ _STLP_AUTOMATIC_TYPE_TRAITS
+ _STLP_UNINITIALIZABLE_PRIVATE
+ _STLP_STATIC_ARRAY_BUG
+ _STLP_FULL_ADL_IMPLEMENTED
+
+ * test/unit/codecvt_test.cpp: Ignore test when
+ _STLP_NO_MEMBER_TEMPLATES defined.
+
+2006-10-20 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_cwchar.h: fix HP-UX problem with WCHAR_MIN, WCHAR_MAX
+ [Boris Gubenko].
+
+2006-10-19 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/sstream_test.cpp: check bugreport #1580020, not confirmed;
+ [bug in gcc 4.1.2-svn, compiler under development].
+
+2006-10-17 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_cwchar.h: Restore code to define potentially missing
+ WCHAR_MIN, WCHAR_MAX macros. It used to be in _mbstate_t.h but was
+ missing some native includes to work, in _cwchar.h everything should
+ be fine.
+
+ * test/unit/codecvt_test.cpp: Fix C cast that was losing const
+ qualifier.
+
+ * stlport/stl/_mbstate_t.h: Avoid definition of _STLP_NO_MBSTATE_T when
+ using own mbstate_t definition in _STLP_USE_NO_IOSTREAMS mode. This macro
+ is not supported anymore and should be fixed or removed in future version.
+ Own mbstate_t will be defined even in no iostreams mode.
+
+ * stlport/stl/config/_evc.h: Now that mbstate_t situation is clear EVC3
+ defines _STLP_NO_NATIVE_MBSTATE_T rather than directly defining it in
+ the config file.
+
+ * test/unit: Several fixes to build with _STLP_NO_EXTENSIONS and
+ _STLP_NO_ANACHRONISMS.
+
+2006-10-16 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_mbstate_t.h: this header may be included from system
+ stddef.h, without wchar.h---defines of wchar limits isn't good place
+ here [WCHAR_MAX, etc.].
+
+ * test/unit/cwchar.cpp: correct test to hilight problem above.
+
+2006-10-14 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/cwchar.cpp, build/test/unit/Makefile.inc: test a few macros
+ related to wchar. Inspired by problems in STLPORT_5_1 and boost::regex.
+
+2006-10-12 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_numpunct.h, src/numpunct.cpp: numpunct facet _M_truename
+ _M_falsename and _M_grouping are not static anymore. This seems useless
+ and moreover was introducing static initialisation order and threading
+ issues.
+
+ * stlport/stl/c_locale.h, _mbstate_t.h, src/c_locale.h, c_locale.c:
+ New mbstate_t policy. When no mbstate_t in native library STLport defines
+ one for its own need in localisation support. This mbstate_t is simply
+ an int defined in global namespace and imported to STLport namespace.
+ Internal localisation framework is nt anymore in STLport namespace but
+ in the global one as it is normaly a C framework.
+
+ * stlport/stl/config/_bc.h: Defines _STLP_NO_NATIVE_MBSTATE_T rather
+ than internal _STLP_USE_OWN_MBSTATE_T macro.
+
+ * stlport/stl/config/_evc.h: Add comment for EVC3 users, this platform
+ should define _STLP_NO_NATIVE_MBSTATE_T, but I have not the platform
+ to check...
+
+ * build/Makefiles/gmake/bcc.mak: Do not force anymore built of C sources
+ as C++.
+
+ * test/unit/string_test.cpp, istmit_test.cpp: Fixed macro checks to make
+ tests buildable even when _STLP_NO_IOSTREAMS is defined.
+
+2006-10-09 Francois Dumont <dums@stlport...>
+
+ * test/unit/codecvt_test.cpp: Fix use of mbstate_t to make it more
+ portable.
+
+2006-10-06 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_alloc.h, _alloc.c: Fixed __debug_alloc implementation
+ to avoid unjustified assertion about wrong size of buffer to
+ deallocate, thanks David Deakins and verntx on sourceforge.
+
+ * test/unit/vector_test.cpp: Add test for bug above.
+
+ * stlport/wchar.h, stl/_cwchar.h, _istream.h, _limits.h, _locale.h,
+ _threads.h, char_traits.h, type_traits.h, _mbstate_t.h: Fix regression
+ introduce by inclusion of mbstate_t.h in wchar.h. Now _mbstate_t.h is
+ only included at end of wchar.h and _cwchar.h. All places where _mbstate_t.h
+ was used are now including _cwchar.h.
+
+2006-10-05 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/gmake/bcc.mak: Use -P compiler to force build of C
+ translation as C++ because of the mbstate_t problem.
+
+ * build/Makefiles/gmake/lib/bcc.mak, rules-a.mak: Fix Borland tlib call
+ syntax thanks mbkenny.
+
+ * stlport/stl/wchar.h: Add include of internal _mbstate_t.h file to
+ know STLport status regarding mbstate_t configuration.
+
+ * stlport/stl/c_locale.h: When building platform localisation support
+ as C++ struct declaration are done in STLport namespace.
+
+ * src/c_locale.h: Removed _mbstate_t.h include that is now included
+ from wchar.h or _cwchar.h depending on C or C++ build. Removed #error
+ done too early (see next comment).
+
+ * src/c_locale.c: Add #error statement when building STLport on a platform
+ having real localisation support but no native mbstate_t definition. In this
+ case c_locale.c must be built as a C++ translation unit.
+
+ * src/c_locale_win32/c_locale_win32.c: Add Borland workaround to avoid
+ compilation error now that it is build as a C++ translation unit.
+
+ * stlport/stl/_mbstate_t.h: Now that this file is not included from outside
+ world we can include internal _cwchar.h rather than cwchar. Removed
+ a wint_t workaround already existing in _cwchar.h. Removed Borland workaround
+ that was defining mbstate_t when using this file in a C context, it was
+ moreover different than the definition in C++ ! Add a pure C declaration of
+ mbstate_t when in C.
+
+2006-10-04 Francois Dumont <dums@stlport...>
+
+ * src/c_locale.h: Add #error to signal issue when building c_locale.c
+ as a C source when STLport uses its own mbstate_t definition.
+
+ * src/num_put_float.cpp: Modification in Cygwin native lib headers
+ revealed that we were missing ieeefp.h include.
+
+ * src/dll_main.cpp, stlport/stl/_threads.h: Fix export of
+ _Atomic_swap_struct for compilers supporting export of templates.
+
+ * stlport/stl/config/_hpacc.h: Some cleanup (unknown _STLP_NO_KOENIG_LOOKUP
+ macro) and formating fixes.
+
+ * stlport/stl/_bvector.h: Use _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS
+ rather than reproducing the workaround hidden by this macro.
+
+ * test/unit/vector_test.cpp: Add test case to check iterators comparisons.
+
+2006-09-26 Francois Dumont <dums@stlport...>
+
+ * src/allocators.cpp: Reorder code blocks to fix build when using
+ _STLP_LEAKS_PEDANTIC.
+
+ * stlport/stl/_num_put.c: Restore __len >= 2 check in
+ __copy_integer_and_fill function. It has been removed on the
+ 2006-07-11, at this time STLport always add the base information
+ even for 0 value. This modification has been rollback but not this
+ check.
+
+ * test/unit/num_put_get_test.cpp: Add check for above fix.
+
+2006-09-26 Francois Dumont <dums@stlport...>
+
+ * src/c_locale_win32/c_locale_win32.c: Add check of code page when
+ specified in locale name.
+
+ * src/c_locale_win32/c_locale_win32.c: Add checks in __ConvertDate
+ and _Locale_t_fmt to avoid potential buffer overflow.
+
+ * src/c_locale_win32/c_locale_win32.c: Create __GetLocaleInfoUsingACP
+ function that merge a call to GetLocaleInfoA and a call to
+ __ConvertFromACP in one call, the latter function has been removed.
+
+ * src/c_locale.h: Restore _STLP_BEGIN_NAMESPACE when STLport use
+ its own mbstate_t definition which is only available in STLport
+ namespace. Fix Borland regression.
+
+ * stlport/stl/_mbstate_t.h: Replace stl/_cwchar.h include with
+ a cwchar one as this file is included from the outside world when
+ building STLport lib.
+
+2006-09-25 Francois Dumont <dums@stlport...>
+
+ * test/unit/codecvt_test.cpp: New test case for the codecvt
+ facet.
+
+ * test/unit/unordered_test.cpp: size_t replace by int to avoid
+ 64bits issue warning.
+
+2006-09-21 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/c_locale.h: Patch from Boris Gubenko to avoid
+ direct inclusion of internal header from this header that is
+ access from the outside world when building STLport lib.
+
+2006-09-20 Francois Dumont <dums@stlport...>
+
+ * test/unit/allocator_test.cpp: Add new test case for allocation of
+ empty buffer.
+
+ * test/unit/fstream_test.cpp: Use a variable to always point to the same
+ test file and adopt a 'Standard' file name 'test_file.txt'.
+
+ * stlport/stl/_hash_fun.h: Rollback 2006-08-26 Petr modification that
+ was introducing a regression with MSVC compilers.
+
+ * stlport/stl/_fstream.c: First attempt to fix seekoff basic_filebuf
+ implementation when dealing with a codecvt facet having variable
+ encoding. This fix is surely not complete, discussion with Uli is not
+ over.
+
+2006-09-13 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_exception.h: Made a previously general Windows 64 bits
+ workaround specific to the cross compiler coming with PSDK. Thanks
+ Igor Pavlov.
+
+2006-09-11 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_num_put.c: Modification in __do_put_integer to avoid
+ a Hp aCC workaround.
+
+2006-09-11 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_algo.c: search_n with predicate fail in case
+ when subsequence size is 1; thanks Timmie Smith.
+
+ * test/unit/alg_test.cpp: test for problem.
+
+2006-09-08 Francois Dumont <dums@stlport...>
+
+ * src/c_locale_win32/c_locale_win32.c: Modification in __GetLCIDFromName
+ to support the Chinese_Taiwan locale. Add of a __GetLCID call when first
+ call to it using non NLS mapping fails.
+
+ * src/c_locale_win32/c_locale_win32.c: Change __ParseLocaleString
+ implementation to correctly handle locale with a name having '.' in
+ the language or country part like in 'Chinese_Hong Kong S.A.R..950'.
+
+2006-09-05 Francois Dumont <dums@stlport...>
+
+ * build/lib/configure.bat: Fixed comment for --rtl-dynamic and
+ --rtl-static options, impact on macros to uncomment in hosts.h
+ config file was inversed. Thanks Igor Pavlov.
+
+ * build/lib/configure.bat, doc/FAQ, doc/README.msvc,
+ stlport/stl/config/user_config.h, _hpacc.h: Replaced references to
+ _site_config.h by hosts.h. Thanks Igor Pavlov.
+
+2006-08-30 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_cmath.h, _cstdlib.h: Patch from Boris Gubenko, Hp aCC
+ native Standard lib already define math functions in global namespace.
+
+ * stlport/stl/_num_put.c: Patch from Boris Gubenko, Hp aCC before version
+ 60000 do not consider 'const ptrdiff_t' as const enough to be used in a
+ static buffer declaration.
+
+2006-08-26 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_hashtable.c: allow smaller bucket counts for
+ hashtable. Thanks Herbert Duerr.
+
+ * stlport/stl/_hash_fun.h: use primary types for hasher, not
+ typedefs.
+
+ * stlport/stl/type_manips.h: workaround for __true_type/__false_type
+ for various versions gcc (oh, yes, gcc, it's real pain to detect
+ real version of libstdc++)
+
+2006-08-10 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stdlib.h: include errno.h for aCC, in case of -mt option in force.
+ This solve errno problem on HP-UX. Thanks Boris Gubenko.
+
+2006-08-09 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config/_msvc.h: Add _STLP_NORETURN_FUNCTION for MSVC
+ compilers.
+
+ * stlport: Move place of _STLP_FUNCTION_THROWS in function declaration to
+ make msvc compiler happier, gcc do not care about position of this
+ attribute.
+
+ * stlport/stl/_ioserr.h: Fixed specification of STLport configuration file
+ in #error statement.
+
+2006-08-04 Francois Dumont <dums@stlport...>
+
+ * stlport: Create _STLP_FUNCTION_THROWS depending on _STLP_NORETURN_FUNCTION
+ and also taking into account exception handling configuration.
+
+ * test/unit/alg_test.cpp, istmit_test.cpp: Fixes to make test buildable with
+ native compiler Standard library.
+
+2006-08-03 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/nmake/evc8.mak: Patch from Ulrich Echkardt to activate
+ whole program optimization.
+
+2006-07-31 Francois Dumont <dums@stlport...>
+
+ * Patch from Michael Fink to fix EVC emulator build.
+
+2006-07-26 Francois Dumont <dums@stlport...>
+
+ * src/fstream.cpp: Fixed MMAP_CHUNK definition, an offset type is signed.
+
+ * Creation of the 5.1.0 RC2 package.
+
+ * Creation of STLPORT_5_1_RC2 tag
+
+2006-07-25 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config/_system.h, _windows.h: Fixed MinGW config that also
+ need _windows.h.
+
+ * stlport/stl/config/_mingw.h: Removed, conflict with platform system
+ header.
+
+2006-07-22 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config: Add _STLP_PLATFORM and _STLP_COMPILER repectively
+ containing STLport detected platform and compiler names. Some names
+ are surely not accurate and will be fixed but introducing those macros,
+ especially _STLP_COMPILER, help to report detection issue.
+
+ * stlport/stl/config/_system.h: Change macro checks in order to guaranty
+ that only one platform and only one compiler configuration file will be
+ included.
+
+ * stlport/stl/config/_cygwin.h, _mingw.h: Added
+
+ * stlport/stl/config/features.h: Removed _STLP_NO_MEMBER_TEMPLATE_CLASSES
+ check when _STLP_USE_TEMPLATE_EXPRESSION is activated.
+
+ * stlport/stl/config/_gcc.h, features.h: Add _STLP_NORETURN_FUNCTION
+ to signal function not returning, under gcc we use __attribute__((noreturn)).
+
+ * src/locale_impl.h, stlport/stl/_ios_base.h, _locale.h, _range_errors.h,
+ _rope.h, _string_base.h, _vector.h, debug/_debug.h: Add
+ _STLP_NORETURN_FUNCTION to function that encapsulate raising of exceptions.
+ This help to limit warnings about uninitialized variable before use under
+ gcc.
+
+2006-07-18 Francois Dumont <dums@stlport...>
+
+ * test/unit/unordered_test.cpp: Change Key data type from size_t
+ to the more portable int. Fix what seems to be a bad code generation
+ of gcc under Linux 64 bits resulting in a test failure.
+
+2006-07-17 Francois Dumont <dums@stlport...>
+
+ * test/unit/alg_test.cpp: New test for find_first_of algo.
+
+ * stlport/stl/config/user_config.h, features.h: string template
+ expressions is not a transparent feature, some compilers (VC6)
+ are experimenting ICE with it or some other (gcc) do not accept
+ it when extending string class (see mystring in
+ test/unit/string_test.cpp). So default STLport configuration will
+ be without string template expression, _STLP_DONT_USE_TEMPLATE_EXPRESSION
+ has been replaced by _STLP_USE_TEMPLATE_EXPRESSION.
+
+2006-07-16 Francois Dumont <dums@stlport...>
+
+ * test/unit/mvctor_test.cpp: Patch from Michael Fink to avoid a EVC
+ ARM crash.
+
+2006-07-13 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_num_put.c: Rollback modif above, according C printf doc
+ 0 value shouldn't show their base.
+
+ * stlport/stl/type_traits.h: Avoid instanciation of _IsCVConvertible if
+ not dealing with pointers. Systematical instanciation was giving
+ compilation error as soon as type had a special memory alignment, such
+ types cannot be pass by value in function calls. Thanks andy2222 from
+ sourceforge.
+
+ * build/Makefiles/nmake/evc3.mak, evc4.mak, evc8.mak: Patch from Ulrich
+ Eckhardt to remove commctrl.lib dependency, for the moment evc3 and evc4
+ only contains a note about this potentially useless dependency.
+
+ * stlport/stl/debug/_string.h: Add missing copy methods in the debug
+ string implementation thanks Patrick Bennett report.
+
+ * test/unit/string_test.cpp: New copy test case for string::copy.
+
+ * stlport/stl/_algo.h: Add missing _STLP_PRIV namespace scope in calls
+ to __find_first_of thanks Patrick Bennett report.
+
+2006-07-11 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/debug/_deque.h, _list.h, _slist.h, _string.h, _vector.h:
+ Extend use of _Non_Dbg_iter function in all template methods dealing
+ with iterator range.
+
+ * _num_put.c: Fix to show base in octal or hexadecimal mode even for
+ 0 value.
+
+ * stlport/stl/_istream.c: Avoid modification of value to extract in
+ formatted input of short and int when value would overflow.
+
+ * test/unit/num_put_get_test.cpp: Add some tests for above fixes.
+
+ * test/unit/iostream_test.cpp: New tests for general stream
+ manipulations.
+
+ * stlport/stl/_istream.h: Fix ws iostream function, it do not set failbit
+ anymore when stream is in eof state.
+
+ * build/lib/msvc.mak: Generation of config.mak is not mandatory anymore
+ as Intel compiler do not need it for the moment. Only a COMPILER_NAME
+ is mandatory which is given by icl.mak for Intel compilers and by
+ config.mak for Microsoft ones.
+
+2006-07-10 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/debug/_iterator.h: Creation of _Non_Dbg_iter function
+ returning native iterator of special debug iterator with
+ compilers supporting partial template function ordering. Fix
+ a MSVC .Net 2003 issue that seems to be related to a too important
+ template depth.
+
+ * stlport/stl/debug/_deque.h, _list.h, _slist.h, _string.h, _vector.h:
+ Use new _Non_Dbg_iter function in constructors from iterator
+ range.
+
+2006-07-07 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/lib/configure: rollback changes 4 Jul 2006 19:42:55,
+ it's definitely wrong (phrase with quotes ['] requires double
+ quotes ["]).
+
+2006-07-06 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_num_put.c: Small refactoring with introduction
+ of the __do_put_integer function for integer types output. Moreover
+ static buffer size used for formating is now based on output
+ type sizeof.
+
+ * stlport/stl/_ostream.c: Add some assertion before cast to check that
+ no significant digit is lost. Add cast to long in int and short output
+ in order to make type of expression more explicit and correct. This
+ fix the bug report from Geoffrey Bache on sourceforge about output of
+ -1 ont value on 64bits linux.
+
+ * test/unit/floatio_test.cpp: Removed, all code moved to NumPutGetTest
+ test fixture.
+
+ * test/unit/num_put_get_test.cpp: New, contains all tests regarding
+ input/output of numeric values (locale independant).
+
+ * test/unit/locale_test.cpp: locale independant tests of numeric input/
+ output moved to NumPutGetTest test fixture.
+
+2006-07-04 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_rope.h, _rope.c: Patch from Peter Hercek to fix a
+ missing null termination in rope constructor from a character
+ and a buffer overrun.
+
+ * stlport/stl/_rope.h: Removed special _S_rounded_up implementation
+ for other types than char and wchar_t. rope implementation is
+ expecting this method to always return a size > to the given size in
+ order to store the terminating null character.
+
+ * stlport/stl/_rope.c: Fix reference counter management to avoid memory
+ leak in _S_destr_concat_char_iter.
+
+2006-06-30 Francois Dumont <dums@stlport...>
+
+ * src/num_put.cpp, num_put_float.cpp: Patch from Glen Summers
+ to fix float output using locale with grouping and float value
+ has no decimal.
+
+ * test/unit/locale_test.cpp: Add some tests showing above bug.
+
+2006-06-29 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_algo.h, _algo.c, _algobase.h, _algobase.c,
+ _hashtable.c: Patch from Andriy Syrovenko to fix implementation
+ of __equal_range, __lower_bound, __upper_bound when dealing with
+ a key whom type is different from the value_type of the iterator.
+
+ * test/unit/equal_test.cpp: Add some tests to show above bug.
+
+2006-06-28 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string_sum_methods.h, debug/_string_sum_methods.h:
+ Small refactoring and simplification of code to avoid a parameter
+ with default value. This fixing an ICE using MSVC6.
+
+ * test/unit/string_test.cpp: Ignore the newly introduce te_tmp
+ test using MSVC6.
+
+2006-06-27 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_list.h: fix bug in list.swap, thanks Viktor Govako.
+
+ * test/unit/list_test.cpp: test for bug above.
+
+2006-06-27 Francois Dumont <dums@stlport...>
+
+ * build/lib/configure: Add --with-lib_motif option to grant STLport
+ users the possibility of tweaking the generated libraries name.
+
+ * build/Makefiles/gmake/unix/lib.mak: Add code to take into account
+ configured lib motif in generated library name.
+
+ * build/Makefiles/gmake/netware/lib.mak: Looks like it needs same
+ defines as the ones in cygming/lib.mak so we simply include this
+ file.
+
+ * stlport/stl/config/_evc.h: Patch from Michael Fink to fix a
+ compilation error.
+
+ * test/unit/cppunit/cppunit_mini.h: Patch from Michael Fink to
+ avoid unused parameter warning.
+
+2006-06-23 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_pair.h, _bvector.h, config/_evc.h: Patch from
+ Ulrich Eckhardt to extend an evc4 MIPS workaround for eVC8
+ and to generalize little endian configuration.
+
+ * DMC patch from Eric Sanford. Define _STLP_NO_FUNTION_TMPL_PARTIAL_ORDER
+ so that many ignored unit test could be now passed. Also specify
+ Intel 386 instruction set during compilation to limit link errors.
+
+2006-06-22 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_algobase.c: Removed check of equivalent predicate
+ commutativity in find algorithm. In this case, equivalence relation
+ might have been implemented using a member operator == which is
+ not commutative thanks Grisha Spivak report. Other checks that are
+ using an explicit predicate parameter has been kept even if it forces
+ STLport users to implement commutative functor.
+
+ * test/unit/find_test.cpp: Add test to show above issue.
+
+ * stlport/stl/_hashtable.c: Removed equivalent predicate checks
+ that are useless as in _STLP_DEBUG mode the debug wrapping add this
+ check in the functor used to instanciate the non debug hashtable
+ implementation.
+
+2006-06-19 Francois Dumont <dums@stlport...>
+
+ * STLport 5.1.0 candidate released. STLPORT_5_1 branch created in
+ CVS. Version tagged STLPORT_5_1_RC1.
+
+2006-06-17 Francois Dumont <dums@stlport...>
+
+ * test/unit/type_traits_test.cpp, uninitialized_test.cpp: Add
+ explicit public inheritance relation to avoid an ICL warning.
+
+ * stlport/stl/config/features.h: Add definition of
+ _STLP_DEBUG_LEVEL to _STLP_STLPORT_DBG_LEVEL when _STLP_DEBUG
+ is defined but _STLP_DEBUG_LEVEL hasn't been set.
+ (thanks an ICL warning report)
+
+ * stlport/stl/config/_intel.h: Remove undef of
+ _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT, even if the linker complains
+ about not finding unexpected_exception it looks like it finally do
+ not use it.
+
+ * test/unit/cppunit/test_main.cpp: Filter definition of
+ unexpected_exception when building unit test with static STLport
+ lib.
+
+2006-06-15 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config/features.h: Several macro renamed:
+ - _STLP_LONG_DOUBLE -> _STLP_LONGEST_FLOAT_TYPE
+ - __DFL_TMPL_PARAM -> _STLP_DFL_TMPL_PARAM
+ - __DFL_TYPE_PARAM -> _STLP_DFL_TYPE_PARAM
+ - __DFL_NON_TYPE_PARAM -> _STLP_DFL_NON_TYPE_PARAM
+ __DFL_TYPE_ARG removed.
+
+ * stlport/stl: Add char_traits template parameter in all
+ istreambuf_iterator and ostreambuf_iterator instanciation where it
+ was missing as some compiler might not have supported it.
+
+ * stlport/stl/_time_facets.h, src/locale_impl.cpp: Finaly adopt a
+ specific gcc workaround for definition of _Locale_time_extract_hint
+ as friend of time_get_byname facet. Gcc 2.95 prefers to see a template
+ method otherwise it emits a warning, we want to avoid STLport users
+ to have to disable this warning. Other compilers will use a simple
+ function which seems to be more portable.
+
+ * stlport/stl/_vector.h, _pair.h: Patch from Eric Sanford for a
+ really weird Borland compiler workaround that consists in adding
+ a _Ret typedef in __move_traits or __type_traits traits struct
+ that do not normally contain it.
+
+ * stlport/stl/config/_bc.h: Borland free compiler do not support
+ STLport container extension of template methods.
+
+2006-06-14 Francois Dumont <dums@stlport...>
+
+ * test/unit: Patch from Ulrich Eckhardt to fix storage of string
+ literals to const char* rather than simple char*.
+
+ * build/Makefiles/nmake: Ulrich Eckhardt patch:
+ - /MACHINE:IX86 is obsolete and only supported for backward
+ compatibility as alias for X86. Replaced all cases of IX86
+ with X86.
+ - /NODEFAULTLIB:OLDNAMES.lib seems to also be universal so I
+ moved it to the base, too.
+ - In order to use main() as entry point under CE, use linker
+ option /ENTRY:mainACRTStartup. This was already done for
+ evc3,4,8 but I moved it to app/evc-common.mak and documented
+ it.
+
+ * stlport/stl/_cmath.h, config/_evc.h: Uli patch to activate long
+ double support for EVC and use _hypot to implement STLport
+ overload.
+
+ * src/complex.cpp: Remove internal __stlp_hypot that is not necessary
+ anymore now that STLport always define a hypot function (thanks Uli
+ remark).
+
+ * stlport/stl/config: Ulrich Eckhardt VC8/CE patch:
+ - Adapt the code to construct the paths to the native includes
+ so that it matches the changed structure. This is currently
+ only for ARM and might need more work for other targets (x86
+ works though).
+ - Make a distinction between the desktop and CE variants concerning
+ the exception support functions. These now use the same compiler
+ versions so that can't be used anymore.
+ - MS' safe string functions are not available under CE - I think,
+ need to take a closer look at Platform Builder.
+
+ * stlport/stl: Ulrich Eckhardt to adapt STLport to VC8/CE limited
+ native C library.
+
+2006-06-13 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/pointers/_tools.h: Add partial specialization for
+ _IteWrapper helper struct so that when type to store and stored
+ type are identical input iterators are not wrapped. Otherwise input
+ iterators are wrapped to perform necessary casts between pointer type
+ and void*.
+
+ * stlport/stl/_cmath.h: Fixed macros definition used to define all
+ math functions for compilers supporting long double but not having
+ float nor long double C math functions. Thanks Ulrich Eckhardt report.
+
+2006-06-12 Francois Dumont <dums@stlport...>
+
+ * test/unit/set_test.cpp, map_test.cpp: Replace size_t with the
+ more portable int type when possible.
+
+ * stlport/stl/pointers/_tools.h: Check that type to store is a
+ pointer type before modifying predicate type for set container.
+ Wrapping less functor in all cases was making move semantic tests
+ to fail as predicate is not then detected as being the STLport
+ less predicate.
+
+ * stlport/stl: DMC patch from Eric Sanford. DMC do not like __ss
+ variable that is a reserved keyword.
+
+2006-06-11 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/nmake: Patch from Ulrich Eckhardt to use
+ main rather than WinMain for EVC platform.
+
+ * build/test/unit/gcc.mak: Removed redondant macro definition
+ _STLP_USE_STATIC_LIB under cygwin/mingw as those definition
+ are part of base make files.
+
+ * stlport/stl/type_manips.h, _hashtable.h: Eric Sanford workaround
+ for Borland.
+
+2006-06-09 Francois Dumont <dums@stlport...>
+
+ * test/unit/cppunit: Patch from Ulrich Eckhardt to
+ - Removed a few superfluous semicolons.
+ - Made some constructors explicit.
+ - Documented the meaning of FileReporter::_myStream.
+ - Reformatted some things to not exceed 100 chars per
+ line or use several expressions/statements in one line.
+
+ * build/Makefiles/nmake: Patch from Ulrich Eckhardt to
+ - adds support for x86 (running on e.g. a PC, so-called CEPC).
+ - adds support for MIPS or more specifically MIPSII, other MIPS
+ subtypes can easily be added.
+ - removes a line "DEFS_COMMON = /D%TARGETCPU%" from the config.mak
+ file generated for MIPS, the same functionality was moved to the
+ CPU-specific setups where it is done for other CPUs.
+ - adds an additional compiler flag so that diagnostics better
+ match what the VC8 IDE expects.
+
+ * stlport/stl: Patch from Ulrich Eckhardt to
+ - removes several unnecessary semicolons (typically, when
+ inlining functions like "void foo() {};" where it in fact doesn't
+ hurt (due to something I consider an oversight in the standard)
+ but also doesn't make sense.
+ - fixes inconsistent indentation in three cases, one with the
+ preprocessor and two with memberfunction bodies.
+
+ * stlport/stl/pointers/_tools.h: Add missing template method
+ in _CastTraits helper struct used on compiler with no partial
+ template specialization support.
+
+2006-06-08 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/pointers/_tools.h, _set.h: Fix problems reported by
+ gcc that seems to do more check that MSVC on explicit
+ instanciation of templates. Especially fixed problem introduce
+ by STLport extension of set template methods.
+
+ * build/Makefiles/gmake/aCC.mak, lib/aCC.mak: Patch from Boris
+ Gubenko for Hp aCC build.
+
+2006-06-07 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/pointers: Restore pointer specialization feature.
+ Major modifications are:
+
+ - vector specialization is done using a qualified void pointer
+ in order to keep optimization oportunities when working on
+ pointers. Using a strict void* was forcing wrapping of iterators
+ in template method making _BothPtrTypes struct helper failing to
+ detect both pointer types.
+
+ - Fixed set specialization thanks to explicit instanciation added
+ in ptrspec_test.cpp.
+
+ - Refactoring of algorithm to find storage type from value type.
+
+2006-06-02 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/nmake: Patch from Ulrich Eckhardt for
+ cleanup. Some script refactoring, wrong OPT_STLDBG_STATIC references
+ replaced by OPT_STATIC_STLDBG.
+
+ * src: Patch from Ulrich Eckhardt to cleanup locale implementation
+ and fix time facet creation when using dummy locale implementation.
+
+ * stlport/stl/config/_evc.h: Patch from Ulrich Eckhardt to fix
+ endianess definition.
+
+ * stlport/stl/debug/_hashtable.h: Create a _DbgEqual functor to
+ check correct equivalent predicate implementation. Add also
+ missing hash_func and key_eq methods in this mode.
+
+ * stlport/stl/debug/_tree.h: Small refactoring in _DbgCompare
+ functor.
+
+ * stlport/stl/type_traits.h, boost_type_traits.h: Restore boost
+ support.
+
+2006-06-01 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_tree.h, _set.h, _map.h, debug/_tree.h: Removed
+ erase template method extension, might conflict with erase
+ overload taking an iterator. User workaround will be to use
+ erase(find(key)).
+
+ * stlport/stl/_hashtable.h, _map.h, _set.h, _unordered_set.h,
+ _unordered_map.h, debug/_hastable.h: Add template methods extension.
+
+ * stlport/stl/config/features.h: Add management of containers template
+ method extension.
+
+ * stlport/stl/config/_apple.h, _symantec.h: Config update based on
+ config that used to be in _tree.h and _hashtable.h to remove
+ container template methods extensions.
+
+2006-05-31 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config/_evc.h: Patch from Michael Fink to add ptrdiff_t
+ definition and forbid use of _STLP_DEBUG mode for evc 3/4 on ARM.
+
+ * build: Ulrich Eckhardt patch for Microsoft Visual Studio 2005 for
+ Embedded C++ portage.
+
+2006-05-30 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/type_traits.h: Rename _Is_Integer<_Tp>::_Integral and
+ _Is_Rational<_Tp>::_Rational in respectively _IsIntegral<_Tp>::_Ret
+ and _IsRational<_Tp>::_Ret for naming convention coherency.
+
+ * stlport/stl/type_traits.h: Add _TrivialNativeTypeCopy helper to
+ handle a number of oportunities to use memcpy/memmove in
+ uninitialized_* or copy algorithms that was not cover by simply
+ checking type_traits has_trivial* features.
+
+ * stlport/stl/type_traits.h, boost_type_traits.h: Refactor _BothPtrType
+ implementation, only one version is necessary as it uses _IsPtr that
+ has a variable implementation depending on config.
+
+ * stlport/stl/_vector.h: Add _DefaultZeroValue specialization for
+ vector container so that a vector of vector is simply initialized
+ using a memset to set everything to 0.
+
+ * test/unit/vector_test.cpp: Add check that previous optimization
+ works as expected.
+
+ * stlport/typeinfo.h: Borland patch from Eric Sanford.
+
+ * DMC patch from Eric Sanford
+
+ * stlport/stl/debug/_tree.h: Patch from Ulrich Eckhardt to add missing
+ count template method.
+
+ * src/dll_main.cpp: Patch from Ulrich Eckhardt to fix strncpy
+ usage.
+
+2006-05-23 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_deque.h, _deque.c: Change implementation to use
+ _TrivialInit new feature.
+
+ * stlport/stl/boost_type_traits.h: Add _TrivialInit implementation
+ using boost type traits.
+
+2006-05-22 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/type_traits.h: Add _TrivialInit helper struct to
+ report if a type is trivial to initialize or not that is to say
+ if the type has a trivial default constructor. Handle native types
+ exception that are consider as having a trivial default constructor
+ but that required a 0 initialization on explicit constructor
+ call.
+
+ * stlport/stl/_uninitialize.h: Add a helper function
+ __uninitialize_init that result in a no-op if _TrivialInit returns
+ __true_type.
+
+ * stlport/stl/_vector.h: Modification of vector constructor to
+ destect when it is called without an explicit default value so
+ that we can call __uninitialized_init.
+
+ * test/unit/uninitialized_test.cpp: Add test to check correct
+ detection of useless initialization.
+
+2006-05-19 Francois Dumont <dums@stlport...>
+
+ * test/unit/uninitialized_test.cpp: Patch from Ulrich Eckhardt
+ to replace vector instance in uninitialized_copy_test by static
+ array so that we are always working on pointers iterator.
+
+ * stlport/stl/_string_operators.h: Patch from Ulrich Eckhardt to
+ add missing != operators when using string template expression.
+
+ * stlport/stl/ctype.h, config/_evc.h, _msvc.h, _windows.h,
+ features.h: Patch from Michael Fink for evc3/4 platform.
+
+ * test/unit/mvctor_test.cpp: Add of a specific Borland test case
+ to report what seems to be a compiler bug but that is only
+ revealed when using STLport.
+
+ * stlport/stl/_tree.h, _set.h, _map.h, debug/_tree.h,
+ pointer/_set.h: Generalized already existing extension of template
+ find method on associative containers to all look up methods:
+ count, erase, lower_bound, upper_bound, equal_range.
+
+ * test/unit/set_test.cpp: Add test case for set template methods
+ extension.
+
+ * stlport/stl/_tree.c, debug/_tree.h: Removed debug check from
+ non debug implementation, now debug check is injected in tree
+ implementation from the tree debug implementation thanks to
+ a wrapping of the predicate.
+
+2006-05-18 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/c_locale.h: Fix declaration of _Locale_name_hint
+ struct so that compilers do not think that this struct is in
+ the STLport namespace because of friend declaration.
+
+2006-05-17 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_abbrevs.h: Update list of abbreviations.
+
+ * stlport/stl/_hashtable.c: Removed _Node macro and fixed
+ macros defined when _STLP_NESTED_TYPE_PARAM_BUG is defined.
+
+2006-05-16 Francois Dumont <dums@stlport...>
+
+ * test/unit/type_traits_test.cpp: Add test case to check
+ _TrivialUCopy helper metaprogramming class behavior.
+
+ * stlport/stl/_vector.h, _vector.c: Replaced _TrivialAss by
+ _TrivialCopy and _TrivialUCpy by _TrivialUCopy for coherency
+ with type_traits.h names.
+
+ * test/unit/type_traits_test.cpp: Add small test for correct
+ impact of trivial_destructor meta info in vector implementation.
+
+ * build/lib/configure.bat: Add comment to explain weird TARGETCPU
+ check.
+
+2006-05-15 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hashtable.h, _list.h, _deque.h, _slist.h,
+ _string.h, _vector.h, _move_construct_fwk.h, _rope.h:
+ Fix impact of _STLP_NO_MOVE_SEMANTIC macro on library. Now,
+ if defined, no move will ever happen.
+
+ * stlport/stl/_uninitialized.h: Simplified __uninitialized_copy_fill
+ prototype, only one type of iterator is allowed. It also fix
+ implementation as this one was not taking into account both
+ iterator value_type to consider if the operation was trivial
+ or not.
+
+ * stlport/stl/_uninitialized.h: Major code review. Remove use of
+ _OKToMemcpy, remove dependency on std::copy of std::fill, all
+ implementation is now similar to the one of std::copy algorithms
+ except that uninitialized algo are using
+ __type_traits::has_trivial_copy_constructor meta information and
+ copy __type_traits::has_trivial_assign_operator.
+
+ * test/unit/deque_test.cpp, vector_test.cpp: New test case for
+ over optimization problem.
+
+ * test/unit/map_test.cpp, locale_test.cpp, list_test.cpp, slist_test.cpp,
+ unordered_test.cpp, fstream_test.cpp, stack_allocator.h: Fixed
+ implementation to build with _STLP_NO_MEMBER_TEMPLATES.
+
+ * stlport/stl/debug/_vector.h, _list.h: Add non template assign
+ methods used when _STLP_NO_MEMBER_TEMPLATES is defined.
+
+ * stlport/stl/_slist.c: Fixed sort _Slist_sort implementation, now
+ call _Slist_merge template function rather than slist::merge method
+ as this method do not take any predicate when _STLP_NO_MEMBER_TEMPLATES
+ is defined.
+
+ * build/test/unit/Makefile.inc, test/unit/uninitialized_test.cpp:
+ New test for uninitialized_copy algo.
+
+ * stlport/stl/type_traits.h: OKToMemCpy rename in _TrivialCopy for
+ coherency with _TrivialUCopy. Moreover, thanks to refactoring in
+ uninitialized_* algorithms, _TrivialUCopy now only takes into account
+ __type_traits::has_trivial_copy_constructor meta information and
+ not has_trivial_assign_operator.
+
+ * stlport/stl/boost_type_traits.h: Fixed to reflect STLport
+ __type_traits modifications.
+
+ * stlport/stl/_uninitialized.h: Major code review proposed by
+ Ulrich Eckhardt
+
+ * stlport/stl/_algobase.h, _deque.h, _deque.c, _vector.h, _vector.c,
+ _rope.h, _rope.c, _string.h, _string.c: Impact of previous point.
+
+2006-05-05 Francois Dumont <dums@stlport...>
+
+ * test/unit/iter_test.cpp: Removed unreachable code.
+
+ * Introduction of a new configuration macro _STLP_MSVC_LIB
+
+ This macro is set to _MSC_VER value but can be overloaded to
+ an other value. First intension was to make STLport more flexible
+ for Intel C++ compiler. This compiler comes without any native
+ lib and you have to bind it to a MSVC install, Intel compiler
+ generate MSVC compatible code so that MSVC linker can correctly
+ generate final exe or dll. To mimic MSVC compiler ICL also defines
+ _MSC_VER. The problem is that definition of this macro is based
+ on a compiler option and do not necessarily reflect the MSVC lib
+ version ICL is binded to. Fortunately the compiler options
+ responsible of _MSC_VER definition (/Qvc6, /Qvc7...) is also
+ responsible of name mangling so asking for a MSVC compiler
+ compatibility different than the library ICL is binded to is
+ not easy. But _STLP_MSVC_LIB has been kept as it makes STLport
+ configuration more clean. Now MSVC compiler version is given
+ by _STLP_MSVC macro and library version by _STLP_MSVC_LIB.
+ All occurences of _MSC_VER in STLport code has been replaced
+ by those macros.
+
+ * _STLP_USE_SECURIZED_BUF_FUNCTIONS replaced by the more
+ intuitive _STLP_USE_SAFE_STRING_FUNCTIONS.
+
+ * stlport/stl/config/_msvc.h: Major refactoring to isolate
+ MSVC compiler config and MSVC native library config.
+
+2006-05-04 Francois Dumont <dums@stlport...>
+
+ * build/lib/configure.bat: And information to the --lib-motif
+ option as advised by Ulrich Eckhardt. Add option parameter and
+ relation with _STLP_LIB_NAME_MOTIF.
+
+ * src/messsage_facets.h: Removed implementation of private copy
+ constructor and assignment operator.
+
+ * src/c_locale_win32/c_locale_win32.c: Made
+ _Locale_extract_category_name locale function static.
+
+ * src/vc_warning_disable.h renamed in warning_disable.h as it is
+ used by other compilers too (ICL)
+
+ * build/lib/msvc.mak, evc.mak: Removed forced inclusion of
+ vc_warning_disable.h file. Now this file is included from
+ stlport_prefix.h.
+
+ * build/test/unit/msvc.mak, evc.mak: Replace vc_warning_disable.h
+ reference by warning_disable.h.
+
+ * src/stlport_prefix.h: Add inclusion of warning_disable.h.
+
+2006-05-01 Francois Dumont <dums@stlport...>
+
+ * test/unit/vector_test.cpp, deque_test.cpp, string_test.cpp:
+ Removed unreachable code, reported by ICL 9.0.
+
+ * test/unit/mvctor_test.cpp: Removed variable declaration hiding
+ previous one + made local functions static.
+
+ * stlport/stl/config/_msvc.h: Only use abbreviate symbols for
+ MSVC compiler and not for all compilers defining _MSC_VER. Also
+ removed some ICL specific configuration.
+
+ * src/lock_free_slist.h: Removed 'no return statement' warning
+ for ICL too.
+
+ * src/message_facets.h: Made _Message_impl copy constructor and
+ assignment operator private to avoid warning as _M_cat member
+ data has private copy constructor and assignment operator too.
+
+ * stlport/stl/_cstdlib.h: Made additional definition of
+ div(long, long) based on native library (_MSC_VER) rather than on
+ compiler used (_STLP_MSVC).
+
+ * stlport/stl/config/_intel.h: Fix Intel C++ 9.0 compiler
+ configuration with and without /Qvc6 option.
+
+ * src/dll_main.cpp: Add std::unexpected implementation that ICL
+ need but that is not part of MSVC6 native lib library.
+
+ * test/unit/test_main.cpp: Add std::unexpected implementation that
+ ICL need but that is not part of MSVC6 native lib library.
+
+2006-04-30 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_alloc.h: Moved __type_traits specialization for
+ std::allocator class before use in _STLP_alloc_proxy
+ instanciation.
+
+ * test/unit/istmit_test.cpp: Fixed macro checks to correctly
+ report ignored test.
+
+2006-04-27 Francois Dumont <dums@stlport...>
+
+ * test/unit/full_streambuf.h, deque_test.cpp, vector_test.cpp:
+ Add STLPORT macro check when checking _STLP_USE_EXCEPTION macro.
+
+ * test/unit/string_test.cpp: Fix some macro checks to correctly
+ report ignored tests.
+
+ * test/unit/mvctor_test.cpp: Fix tests to build it with native
+ MSVC 2005 Standard library. Looks like this implementation do
+ not follow atmortized constant time vector::push_back complexity.
+
+ * stlport/stl/config/_msvc.h: Clearly report status regarding build
+ of STLport using the MSVC /clr option.
+
+ * stlport/stl/_threads.h: Remove MSVC .Net 2002 annoying warning.
+
+2006-04-26 Francois Dumont <dums@stlport...>
+
+ * src/ctype.cpp: Fix ctype::scan_is and scan_not method behavior as
+ required by C++ Standard 22.2.1.1.2.
+
+ * test/unit/locale_test.cpp: Fix ctype facet test according
+ modifications above.
+
+2006-04-25 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_istream.c: Small refactoring to avoid a uninitialized
+ warning for __do_handle_exceptions local variable.
+
+ * stlport/stl/_deque.h: Ditto with __cur_node variable in
+ _M_range_initialize method.
+
+ * stlport/stl/_deque.c: Ditto with __cur in _M_fill_initialize.
+
+ * stlport/stl/config/_auto_link.h: Removed auto link feature when
+ building a C translation unit thanks Michael Fink.
+
+ * src/time_facets.cpp: Add missing calling convention on
+ __write_formatted_time internal function.
+
+2006-04-24 Francois Dumont <dums@stlport...>
+
+ * test/unit/cppunit/cppunit_mini.h: Limit scope of try/catch block to
+ the test case call so that CppUnit function methods are correctly
+ called.
+
+ * test/unit/type_traits_test.cpp: Fix use of
+ CPPUNIT_IGNORE/CPPUNIT_STOP_IGNORE macros so that ignored tests are
+ correctly reported as ignored.
+
+2006-04-20 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config/_solaris.h: Replace C++ style comment
+ in C style.
+
+ * stlport/stl/_cmath.h: Add macro definition for environment
+ having long double but no float neither long double math functions
+ This is a Solaris configuration.
+
+ * src/acquire_release.h, c_locale.h, locale.cpp,
+ locale_catalog.cpp, locale_impl.cpp, locale_impl.h,
+ message_facets.h, facets_byname.cpp: Add a locale hint feature
+ to improve locale construction from name. This is used by
+ Win32 locale implementation that broadcast the locale lcid
+ thanks to this hint. With this modification, LocaleTest fixture
+ runs 5 times faster.
+
+ * stlport/stl/_collate.h, _ctype.h, _monetary.h, _numpunct.h,
+ _time_facets.h: Add _Locale_extract_hint function as friend
+ to some locale facet in order to access locale implementation
+ specific structure and potentially extract the hint.
+
+ * stlport/stl/_codecvt.h, _collate.h, _ctype.h, _messages_facets.h,
+ _monetary.h, _numpunct.h, _time_facets.h: Add _Locale_name_hint pointer
+ parameter to facet by name constructor.
+
+ * build/Makefiles/nmake/lib/clean.mak, rules-so.mak, rules-install-so.mak:
+ Based on Dr Dobb's Richard Grimes article, change management of
+ manifest file for STLport shared library. According this article
+ .manifest file is not taken into account for a library, only .exe one is.
+ Solution is to integrate .manifest file into the .dll as an unmanaged
+ ressource with id 2. We now do so thanks to the mt manifest tool.
+
+ * stlport/stl/_pair.h: Remove __move_traits partial specialization for
+ Borland free compiler, it was introducing weird compilation error.
+
+ * stlport/stl/_move_construct_fwk.h: Add a helper struct for __move_traits
+ feature.
+
+ * build/test/unit/msvc.mak: Prepare makefile to easily build unit tests
+ without STLport.
+
+2006-04-15 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config/host.h, compat.h, debug/_debug.c: Removed
+ _STLP_NO_DEBUG_EXCEPTIONS configuration macro that is similar
+ to the new _STLP_DEBUG_MODE_THROWS except that new thrown macro
+ is catchable (std::runtime_error exception) and contained message
+ is more explicit.
+
+ * stlport/stl/debug/_tree.h: Add find template method STLport
+ extension to the debug version of binary tree thanks Mike Flamming.
+
+2006-04-11 Francois Dumont <dums@stlport...>
+
+ * src/complex_io_w.cpp: Removed, content moved to src/complex_io.cpp
+ to avoid build of an empty translation unit that can generate linker
+ warning (noticed with MSVC 2005 express)
+
+ * build/lib/Makefile.inc: Updated before of above modification.
+
+ * test/unit: Ignore many tests rather than hide it depending on
+ build configuration.
+
+ * test/unit/cppunit/file_reporter.h: Restored output existing before
+ introduction of monitoring feature.
+
+2006-04-10 Francois Dumont <dums@stlport...>
+
+ * test/unit/cppunit/cppunit_timer.h, test_main.cpp, file_reporter.h:
+ Add -m option to activate monitoring of unit tests. This option add
+ timing for each test and a global timing information. Timer class has
+ been created for Win32 API.
+
+ * stlport/stl/_bitset.h: Hide STLport bitset extensions _Find_first
+ and _Find_next.
+
+ * test/unit/bitset_test.cpp: Adapt tests to previous modification.
+
+ * stlport/stl/_string.h: Replace memory include with stl/_alloc.h
+ to limit header dependencies. Also add include of stl/_uninitialized.h.
+
+ * test/unit/fstream_test.cpp: Add missing memory include.
+
+ * test/unit/locale_test.cpp: Ditto.
+
+ * stlport/stl/_queue.h, _string.h, _rope.h, debug/_tree.h: Replace
+ stl/_function.h include with the smaller _function_base.h include.
+
+2006-04-07 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_new.h: Fixed management of _STLP_NO_BAD_ALLOC
+ and _STLP_NEW_DONT_THROW_BAD_ALLOC macros.
+
+ * stlport/stl/config/_dm.h: Change DMC configuration, use STLport
+ own namespace rather than std so that STLport can check config.
+
+ * stlport/typeinfo.h: Fix DMC configuration now that it uses own
+ STLport namespace.
+
+2006-04-05 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_tree.h, _list.h: Fixed swap implementation to
+ correctly swap allocators instance. Moreover list swap implementation
+ was wrong since list splice has been modified to correctly handled
+ allocators with state.
+
+ * test/unit/slist_test.cpp, list_test.cpp, set_test.cpp: Add tests for
+ above fix.
+
+ * stlport/stl/_deque.h: Fix swap method as deque has 2 allocator
+ instances, this should perhaps be modified one day to only keep 1...
+
+ * stlport/stl/_rope.h: Fix swap method and removed assertion for
+ equivalent allocator instances even if there are still other assertions
+ in the implementation.
+
+ * stlport/stl/_function_base.h: Add swap method for less functor if
+ partial template workaround is activated. This is for surprising
+ compilers supporting partial template specialization but no template
+ function partial ordering.
+
+ * stlport/stl/_algobase.h: Add Borland workaround for swap function
+ thanks Eric Sanford.
+
+ * test/unit/type_traits_test.cpp: Borland workaround for is_convertible
+ function thanks Eric Sanford.
+
+ * stlport/stl/config/_bc.h: Borland compilers do not support template
+ function partial ordering thanks Eric Sanford.
+
+ * test/unit/stack_allocator.h: Add Borland workaround to correctly
+ call StackAllocator::swap method when swaping STL containers in
+ allocator_with_state tests.
+
+ * test/unit/config_test.cpp: New test
+ ConfigTest::template_function_partial_ordering.
+
+ * test/unit/slist_test.cpp, list_test.cpp, set_test.cpp: Add swap tests
+ with empty containers.
+
+ * src/vc_warning_disable.h: Remove deprecated comments.
+
+ * stlport/stl/_pair.h: Removed Borland checks thanks Eric Sanford.
+
+ * Patch from Michael Fink to remove Windows CE support that is
+ no more supported by Microsoft.
+
+ * stlport/stl/config/_native_headers.h: New, contains all macros
+ relative to native headers access that used to be in features.h.
+
+ * stlport/stl/config/_evc.h, _como.h: Add include of _native_headers.h
+ as those compilers need to include native headers for correct
+ configuration.
+
+ * stlport/stl/config/features.h: Use _native_headers.h.
+
+ * test/unit/locale_test.cpp: Made LocaleTest::facet_id test STLport
+ specific rather than Borland specific. Moreover, without STLport, test
+ is ignored rather than hidden.
+
+ * stlport/stl/_num_put.h, _num_put.c: Removed useless export of
+ num_put<char, char*>, num_put<wchar_t, wchar_t*> not required by
+ the Standard.
+
+ * stlport/stl/_num_get.h, _num_get.c: Ditto for
+ num_get<char, const char*>, num_get<wchar_t, const wchar_t*>
+
+ * stlport/stl/_moneytary.h, _moneytary.c: Ditto for
+ money_get<char, const char*>, money_get<wchar_t, const wchar_t*>,
+ money_put<char, char*>, money_put<wchar_t, wchar_t*>
+
+ * stlport/stl/_time_facets.h, _time_facets.c: Ditto for
+ time_get<char, const char*>, time_get<wchar_t, const wchar_t*>,
+ time_put<char, char*>, time_put<wchar_t, wchar_t*>
+
+ * src/locale_impl.cpp: Removed id initialization of useless facets
+ no more exported.
+
+ * stlport/new, stl/_new.h: Moved all STLport code in _new.h and
+ modified new header so that it forwards include to native new
+ when include comes from inside STLport.
+
+ * cppunit/file_reporter.h, cppunit_mini.h: Change support of
+ CPPUNIT_CHECK macro, only report error once for all failures
+ in a single test case.
+
+2006-03-28 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_prolog.h: Fix macro check before inclusion of
+ features.h.
+
+ * stlport/stl/char_traits.h: Fixed include of cstddef, in STLport
+ code, Standard headers should never be included directly, their
+ stlport/stl/_xxx.h counterpart should be used.
+
+ * stlport/stl/type_traits.h, type_manip.h: Patch from Eric Sanford
+ for Borland compiler to fix _OKToMemCpy feature.
+
+ * stlport/stl/_alloc.h: Replace swap function for _STLP_alloc_proxy
+ by a member method, it is more portable.
+
+ * stlport/stl/_bvector.h, _deque.h, _list.h, _slist.h, _string_base.h
+ _tree.h: Replaced called to std::swap for _STLP_alloc_proxy instances
+ by calls to member swap method.
+
+ * test/unit/hash_test.cpp: Ignore test rather than hide it.
+
+ * test/unit/map_test.cpp: Fixed StackAllocator instanciation.
+
+ * test/unit/stack_allocator.h: Add std::swap overload for
+ StackAllocator<pair<const int, int>>.
+
+ * test/unit/string_test.cpp: Ignore tests rather than hide it.
+
+ * test/unit/unordered_test.cpp: Ditto.
+
+2006-03-27 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_stdexcept_base.h: New internal header with
+ __Named_exception implementation, improve segregation between
+ <locale> and <stdexcept> Standard headers.
+
+ * test/unit/locale_test.cpp: Add missing <stdexcept> header include.
+
+ * stlport/stl/_function_base.h, _function.h: Move as many functor as
+ possible from _function_base.h to _function.h to improve
+ segregation between <functional> and <algorithm> Standard headers.
+
+ * test/unit: Add many missing references to <functional> header.
+
+ * test/unit: Made unit tests available for build without STLport, this
+ will be a good way to compare Standard library implementations.
+
+ * stlport/stl/_string_base.h: Remove additional space for terminating
+ null character, it was actually already reserved in the return
+ expression.
+
+ * stlport/stl/_string.h: Restored basic_string capacity implementation
+ that do not depend on use of the short string optimization or not. It
+ might be hiding a real issue somewhere else in code even if unit tests
+ are not showing any problem.
+
+ * stlport/stl/_alloc.h: Add swap overload for _STLP_alloc_proxy class
+ in order to correctly call swap on the maybe rebound allocator as user
+ that implement an allocator with a state might have implement a
+ special swap function for it to correctly handle STL containers swap
+ operation.
+
+2006-03-24 Francois Dumont <dums@stlport...>
+
+ * build/lib/configure.bat: Removed script for defining INCLUDE
+ environment variable for Borland ressource compiler as it depends
+ on where STLport is install.
+
+ * build/lib/bcc.mak: Add check for INCLUDE environment variable
+ definition.
+
+ * test/unit/string_test.cpp: Change basic_string::reserve test to
+ check length_error exception rather than bad_alloc.
+
+2006-03-22 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_string.c: a bit code clean
+
+ * stlport/stl/_string_base.h: max_size should keep space for
+ allocation of terminating null.
+
+2006-03-19 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_alloc.h, _function_base.h, type_manips.h,
+ type_traits.h, test/unit/type_traits_test.cpp: Patch for
+ Eric Sanford for __bool2type Borland use.
+
+ * build/Makefiles/gmake/lib/clean.mak: Patch from Eric Sanford
+ to fix files generated by dbg-shared and stldbg-shared rules.
+
+ * build/Makefiles/gmake/lib/bcc.mak: Patch from Eric Sanford to
+ increase Borland page size to 64.
+
+2006-03-16 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config/_evc.h, _msvc.h: Add some condition for
+ definition of _STLP_MSVC macro which should only be defined for
+ real Microsoft compilers and not for compiler emulating it.
+
+ * src/allocators.cpp: Use _STLP_STATIC_MUTEX macro in place
+ of _STLP_mutex_base for mutex definition in per_thread_allocator
+ implementation.
+
+ * stlport/stl/_pthread_alloc.h: Modified deallocate methods of
+ pthread_allocator and per_thread_allocator implementation to accept
+ null pointers.
+
+2006-03-15 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string_base.h, _string.c: Force call to
+ _M_allocate_block even in short string optim mode in order
+ to detect lenght error. Based basic_string max size implementation
+ on allocator max_size.
+
+2006-03-15 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/config/_system.h, _msvc.h, _evc.h: move _STLP_MSVC
+ definition in proper place.
+
+2006-03-14 Francois Dumont <dums@stlport...>
+
+ * src/allocators.cpp: Fixed thread safety issue in
+ per_thread_allocator implementation thanks a very old William
+ Power report.
+
+ * test/unit/allocator_test.cpp: Attempt to write a test case for
+ previous bug but not yet complete as I need a better debugging
+ environment than gdb under cygwin...
+
+ * stlport/stl/config/_system.h: Patch from Michael Fink to add
+ missing _STLP_MSVC define for evc++ compilers.
+
+2006-03-13 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_alloc.h, src/allocators.cpp: Hide declaration of
+ malloc based allocator handler in library. Also limit scope of
+ declspec to expose static members rather than the whole class.
+
+ * stlport/stl/_cstdlib.h: For Borland compiler add include of
+ native process.h header, for reason see comment next to include
+ in file.
+
+ * stlport/stl/_alloc.h: Add a new STLport extension to the
+ std::allocator class: allocate(size_type, size_type&). This new
+ overload of allocate returns in an output parameter, the real
+ size of the allocated buffer that can be larger than the requested
+ one. _STLP_alloc_proxy expose this new overload only for the
+ STLport allocator and not for user defined allocators.
+
+ * stlport/stl/_vector.h, _vector.c, _string.h, _string.c: Use of the
+ allocate overload extension method to set end of storage reference
+ to the real memory block end rather than to the requested one.
+
+ * stlport/stl/_alloc.c: Adapt __debug_alloc::allocate method in order
+ to return the real allocated memory block. Also add check on computed
+ __real_n to allocate as it might roll on size_t and hide a case that
+ should result in a bad_alloc exception.
+
+ * stlport/stl/_threads.h, src/allocators.cpp: Add WINVER macro
+ check in addition to _WIN32_VERSION, according PSDK documentation
+ WINVER is more generaly used accross different Windows platforms.
+
+ * test/unit/string_test.cpp: Add constructor test case to correctly
+ handle build of a string with string::max_size elements which should
+ result in a bad_alloc exception. Idem for reserve method.
+
+ * stlport/stl/_alloc.h, src/allocators.cpp: Add check of malloc
+ result in __malloc_alloc implementation to throw an exception when
+ result is NULL.
+
+ * src/locale_impl.cpp: Patch from Eric Sanford for Borland BDS 2006
+ support. Mostly fix locale facet index issues.
+
+2006-02-28 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_string.h: capacity may return wrong value in case
+ of no _STLP_USE_SHORT_STRING_OPTIM in use; thanks Rusty Koonce
+ for report.
+
+ * test/unit/string_test.cpp: test for capacity issue.
+
+ * src/cxa.c: don't use cxa workaround for FreeBSD 6.0---it fine;
+ this is rollback of changes 2006-01-24 [bad compiler was in use].
+
+2006-02-15 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_string.h: _STLP_FORCE_STRING_TERMINATION mode become
+ default and only mode due to performance issue.
+
+ * stlport/stl/config/user_config.h: ditto.
+
+ * stlport/stl/config/features.h: ditto.
+
+2006-02-14 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hashtable.h, _hashtable.c: Add check in _STLP_DEBUG
+ that equivalent key have same hash code. Fix _M_rehash method
+ implementation that used to change elements order thanks Big Muscle
+ effort to report this issue.
+
+ * build/lib/configure: Fix reference to STLport configuration file
+ in --no-cygwin option description.
+
+2006-02-13 Francois Dumont <dums@stlport...>
+
+ * stlport: Patch from Eric Sanford to remove many now useless
+ Borland workaround.
+
+ * src/fstream.cpp: ditto
+
+ * stlport/stl/_monetary.h, _cwchar.h, _algobase.h: ditto
+
+2006-02-10 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_iosfwd.h, _locale.h: Removed type attributes on type
+ declaration, only useful on type definition.
+
+ * src/message_facets.h: Removed unused parameter in _Catalog_nl_catd_map
+ erase method to avoid warning.
+
+ * src/num_put_float.cpp: Use more macro technique to avoid unused parameters
+ in *_cvt functions.
+
+ * test/unit/cppunit/cppunit_mini.h: Comment unused parameter.
+
+ * test/unit/cppunit/file_reporter.h: Add base class initialization
+ in FileReporter copy constructor definition.
+
+2006-02-10 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/num_put_float.cpp: remove usage of static buffers
+ [potential vulnerabilities]; directly use __iostring instead.
+
+ * test/unit/floatio_test.cpp: test for fixed float output;
+ cases when fixed float fail on Linux and Solaris, related
+ with fcvt_r and fconvert calls respectivly commented.
+
+ * build/Makefiles/gmake/gcc.mak: workaround for bug in make 3.79.1
+ on Solaris [not pass -D_STLP_DEBUG to CPPFLAGS].
+
+ * stlport/stl/_string.h: rollback 2006-01-25.
+
+2006-02-08 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles: Removed all references to BUILD=r in parameters
+ to ressource compiler in release as there is no more 'r' appended
+ to the library name in this mode.
+
+ * src/stlport.rc: Fix support for Borland and add check for BUILD
+ definition before injecting it in original library file name.
+
+ * doc/README.borland: Update doc to signal new prerequisite for
+ Borland ressource compiler.
+
+ * test/unit/unordered_test.cpp: Add test for unordered_multiset
+ equal_range method.
+
+ * test/unit/partial_test.cpp: Add test for strict weak ordering
+ predicate good behavior check.
+
+2006-02-07 Francois Dumont <dums@stlport...>
+
+ * src/allocators.cpp: New simplification for _Node_Alloc_Lock,
+ it do not have to be a template class anymore.
+
+ * stlport/stl/debug/_debug.c: Implement
+ __stl_debug_engine<_Dummy>::_Message even when specifying
+ _STLP_DEBUG_MESSAGE in order to have explicit instanciation correctly
+ generated.
+
+ * stlport/stl/_heap.c, _tree.c, _list.c, _slist.c: Add strict
+ weak ordering checks.
+
+ * stlport/stl/_debug.h, _debug.c: Add new error type: bad equivalent
+ functor that has to be used in hash container implementation or in
+ algorithm like find. Check for this functor is:
+ if (pred(a, b)) assert(pred(b, a)
+
+ * stlport/stl/_hashtable.c: Add equivalent functor checks.
+
+ * stlport/stl/_debug.h, _debug.c: Check _STLP_DEBUG_MODE_THROW in
+ __debug_engine::_Message method. Now thrown exception will contain
+ description of the assertion rather than a generic message.
+
+ * build/Makefiles/gmake/bcc.mak: Fix Borland ressource compiler name,
+ brcc32 not brc32.
+
+ * stlport/stl/_range_errors.h, src/dll_main.cpp: Add
+ __stl_throw_runtime_error function used to throw exception in
+ _STLP_DEBUG_MODE_THROW.
+
+2006-02-06 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/nmake: Fixed regression generated by a side
+ effect of Uli patch below.
+
+2006-02-02 Francois Dumont <dums@stlport...>
+
+ * stlport/config/_stl_evc.h, stl/_config.h: Patch from Ulrich
+ Eckhardt to signal endianess detection problem and set EVC
+ endianess for MIPS SDK.
+
+ * src/allocators.cpp: Clean up _Node_Alloc_Lock definition, only
+ specialization are now available for thread safe and not thread
+ safe builds. Make easier definition of internal static mutex.
+
+ * stlport/float.h: Patch from Eric Sanford for Borland NaN management
+
+ * stlport/cfloat: Include STLport float.h rather than native one in
+ order to use potential internal workaround.
+
+ * stlport/stl/config/_ibm.h: Replace all C++ comment by C comments.
+
+ * stlport/errno.h: For Borland, when building for a single threaded
+ contex, errno is not a macro and is defined in std namespace so using
+ have to get the symbol in this namespace.
+
+2006-01-31 Francois Dumont <dums@stlport...>
+
+ * src/allocators.cpp: Reinforce move of allocators implementation
+
+ * stlport/stl/_alloc.h: Removed include of internal _thread.h no
+ more necessary now that allocator implementation is in allocators.cpp.
+
+ * stlport/stl/_pthread_alloc.h: Removed pthread.h include.
+
+ * stlport/stl/_rope.h: Adopt classic macro check before inclusion
+ of _threads.h.
+
+ * build/Makefiles/gmake/gcc.mak: Add -fno-inline option for debug
+ builds.
+
+ * stlport/stl/_threads.h: Remove lock free singly linked list, avoid
+ include of windows.h when using Win32 API lock free slist
+ implementation.
+
+ * src/lock_free_slist.h: New place for the lock free singly linked
+ list implementation.
+
+ * test/unit/mvctor_test.cpp, type_traits_test.cpp: Small workaround
+ for gcc 4.0.1 build, looks like there is a conflict between glibc++
+ __true_type and STLport one.
+
+2006-01-30 Francois Dumont <dums@stlport...>
+
+ * Patch from Ulrich Eckhardt for EVC4 ICE + some documentation
+ updates and fixes.
+
+2006-01-29 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hashtable.h, _limits.h: Add missing calling
+ convention to static methods thanks Petr Supina
+
+2006-01-28 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/debug/_iterator.h: Fix Hp Acc configuration thanks
+ Boris Gubenko.
+
+2006-01-27 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_alloc.h, _old_alloc.h, _pthread_alloc.h,
+ test/unit/rope_test.cpp: Fixed reference to _STLP_NO_IOSTREAMS,
+ replaced by _STLP_USE_NO_IOSTREAMS.
+
+ * stlport/stl/_alloc.h: Move _MAX_BYTES definition out of
+ _STLP_USE_NO_IOSTREAMS check scope as it is also used in deque
+ implementation.
+
+ * stlport/stl/_algo.c, debug/_debug.h, _debug.c: Add check for
+ bad predicate in safe STL mode (_STLP_DEBUG).
+
+ * test/unit/sort_test.cpp: Add test for correct invalid strict weak
+ ordering predicate detection. Active only when STL safe mode throws
+ exception rather than terminating application.
+
+ * test/unit/sort_test.cpp: Add a check that stable_sort is really
+ stable.
+
+2006-01-26 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_alloc.h, _alloc.c, _pthread_alloc.h: Many code moved
+ to allocators.cpp.
+
+ * stlport/stl/_pthread_alloc.c: Removed, content moved to
+ allocators.cpp.
+
+ * src/allocators.cpp: New, contains STLport node and per thread
+ allocator implementation.
+
+ * src/dll_main.cpp: Remove references to former __node_alloc
+ class.
+
+ * build/lib/Makefile.inc: Add allocators.cpp translation unit.
+
+ * stlport/stl/_alloc_old.h: Modified based on allocator classes new
+ interface.
+
+ * stlport/stl/config/feature.h: Default allocator in _STLP_NO_IOSTREAMS
+ mode is now the new/delete allocator, user can still use malloc/free
+ one using config swtich in host.h.
+
+ * stlport/stl/config/_gcc.h: Cygwin/MinGW can now use default node
+ allocator implementation without memory leak.
+
+2006-01-25 Francois Dumont <dums@stlport...>
+
+ * test/unit/stream_test.cpp: Add check for ptrdiff_t output
+ in streams operator when 64 bits portability issue detection
+ feature is activated with MSVC compilers.
+
+2006-01-25 Eric Sanford <...@comp...>
+
+ * stlport/stl/_exception.h: Delete obsolete workaround for
+ legacy Borland compilers.
+
+ * stlport/stl/_string.h: Use an other implementation for the
+ const_reference operator[](size_type _n) const
+
+ * stlport/stl/config/_bc.h: Restore unexpected exception handler
+ (static and dynamic) and uncaught_exception handler (static only)
+
+ * build/Makefiles/gmake/lib/bcc.mak: Typo fix in linker flags.
+
+2006-01-24 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/bind_test.cpp: add test for member function
+ binding that show workaround for const function call.
+
+ * src/cxa.c: __cxa_finalize and __cxa_atexit present in libc
+ in FreeBSD 5.3, but again absent in 6.0
+
+ * build/Makefiles/gmake/app/gcc.mak,
+ build/Makefiles/gmake/lib/gcc.mak: detect whether gcc
+ was builded with --disable-shared and use correct libgcc.
+
+ * build/lib/configure: add --use-static-gcc option to show
+ that STLport should use static language support libraries from
+ gcc if it was build with --enable-shared.
+
+2006-01-23 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/gmake/app/clean.mak: Fix distclean rule for
+ windows thanks Eric Sanford.
+
+ * stlport/stl/_cstddef.h, _cstdlib.h: When no new header support,
+ include STLport C header rather than native one to use errno
+ workaround.
+
+ * stlport/stddef.h: DMC also define errno in native stddef.h file.
+
+2006-01-22 Francois Dumont <dums@stlport...>
+
+ * src/locale_impl.cpp, stlport/stl/_codecvt.h, _monetary.c,
+ _num_get.c, _num_put.c, _time_facets.c: Borland workaround for
+ locale facet id instanciation that were duplicated. Now static
+ instances are no more defined from .c files but only from the
+ .cpp and only for facets that are implemented by STLport. Users
+ implementing facet inheriting from the STLport one will have to
+ defined the static instance themself in their translation units.
+
+ * stlport/stl/type_manips.h: Fixed _UnCVType wrong implementation
+ reported by Digital Mars compiler.
+
+ * stlport/stl/boost_type_traits.h: Fixed _OKMemCpy implementation
+ remove_pointer call was wrong.
+
+ * src/dll_main.cpp: Hide force_link definition to MSVC compilers,
+ was useless and producing a warning.
+
+ * build/Makefiles/gmake/cygming/rules-so.mak: Workaround for DMC
+ linker weird behavior. Linker create the dll file even if link
+ fail which confuse make dependency feature. As lib file is not
+ generated, dll now depends on lib that depends on build files.
+
+ * stlport/stl/config/_warning_off.h: Disabled this used in initialization
+ list warning, used in rope implementation.
+
+ * build/lib/configure: Fix --with-boost interpretation.
+
+ * build/Makefiles/gmake/dmc.mak: Use dm_link command for linker rather
+ than link that is rather the MSVC like wrapper.
+
+ * build/Makefiles/gmake/cygming/targetsys.mak: Ditto for dm_lib rather
+ than lib command.
+
+ * build/Makefiles/gmake/app/rules.mak: Use same linker command invocation
+ for DMC and Borland.
+
+ * doc/README.borland: Documentation update about limitation on locale
+ facets id instanciation.
+
+ * stlport/stdlib.h: DMC, like Borland and EVC, defines errno macro
+ in stdlib.h
+
+ * stlport/stl/config/user_config.h, features.h: Inverse
+ _STLP_FORCE_STRING_TERMINATION macro switch in
+ _STLP_DONT_FORCE_STRING_TERMINATION. This is less dangerous for
+ existing code.
+
+ * stlport/stl/_string.h: When _STLP_FORCE_STRING_TERMINATION
+ is defined operator[] implementation is simpler.
+
+ * stlport/stl/debug/_string.h: Based implementation of []
+ operator on the non STL safe internal instance, avoid duplication
+ of check for access to the element of index size().
+
+ * test/unit/fstream_test.cpp: Add custom facet id definition for
+ Borland.
+
+ * test/unit/hash_test.cpp: Now Borland support correctly hash container
+ implementation.
+
+ * test/unit/rope_test.cpp: Fixed test implementation to build in
+ _STLP_NO_IOSTREAMS mode.
+
+2006-01-18 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_ostream.h, _ostream.c: Use size_t rather than
+ unsigned int for MSVC compilers after VC6 in IO output operator
+ to avoid 64 bits warning when trying to display a size_t type.
+
+ * test/unit/sstream_test.cpp: Add test that reveal the 64 bits
+ warning.
+
+ * test/unit/string_test.cpp: Fixed unused variable warning.
+
+2006-01-17 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/c_locale_glibc/c_locale_glibc2.c: really implemented
+ getting default locale categories from environment; replace
+ a few strcpy by strncpy to protect from possible buffer overflow
+ attack.
+
+ * stlport/new.h, stlport/stl/_typeinfo.h: few workarounds for ICC 9
+ [suggested by Lim Hwan Cheol].
+
+2006-01-14 Eric Sanford <...@comp...>
+
+ * build/test/eh/bcc.mak: Copied from build/test/unit/bcc.mak.
+
+ * stlport/stl/_rope.c: Restore Borland support for _Rope_rotate.
+
+ * stlport/stl/_rope.h: Fix Borland 5.5.1 internal compiler errors
+ in _M_path_end and _M_tmp_buf structs. Restore Borland support for
+ _Rope_rotate.
+
+ * test/eh/test_rope.cpp: Restore Borland exception test for rope.
+
+ * test/unit/rope_test.cpp: Restore Borland unit test for rope.
+
+2006-01-13 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_string.h, stlport/stl/debug/_string.h:
+ const operator [n] should return CharT() in case of
+ n == size(), ISO/IEC 14882:2003(E), 21.3.4; thanks Russ Miller.
+
+ * test/unit/string_test.cpp: test for fixed bug above.
+
+ * build/lib/configure: change --use-boost= onto --with-boost=
+
+2006-01-13 Francois Dumont <dums@stlport...>
+
+ * test/unit/type_traits_test.cpp: Add boost specialization for
+ any_pod_type in order to reproduce STLport behavior when using
+ boost type traits.
+
+ * src/dll_main.cpp: Remove now invalid template explicit
+ instanciation of _Bs_G that is no more a template.
+
+ * stlport/stl/config/_detect_dll_or_lib.h: When no iostreams mode,
+ consider that we are in a static lib mode.
+
+ * stlport/stl/_limits.c, _hashtable.c: Add _STLP_CALL specification
+ to _LimG and _Stl_prime methods implementation.
+
+ * stlport/stl/_limits.c: Put _Stl_prime methods implementation in
+ a _STLP_EXPOSE_GLOBALS_IMPLEMENTATION macro check block. Those
+ methods are supposed to come from libs when using iostreams.
+
+ * stlport/stl/_num_put.h, _num_get.h, _time_facets.h, _ios.h,
+ _ios_base.h: Cleanup Borland workaround now useless.
+
+ * stlport/stl/boost_type_traits.h: Fixed _OKToMemCpy implementation
+ using boost type traits to be closer to the STLport behavior.
+
+ * build/lib/configure.bat: Fixed reference to STLport user
+ configuration file.
+
+ * build/lib/configure: Add --use-boost option to inject boost
+ path during build process.
+
+2006-01-12 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_rope.h, stlport/stl/_rope.c: pass CharConsumer
+ via reference, to take into account CharConsumer modifications.
+ This has relation to find(char) in rope. Thanks Cristian Vlasceanu.
+
+ * test/unit/rope_test.cpp: test for fixed bug above.
+
+2006-01-11 Francois Dumont <dums@stlport...>
+
+ * src/bitset.cpp: Add stlport_prefix.h include.
+
+ * stlport/stl/_bitset.h: Add an inline implementation for _S_count
+ and _S_first_one static methods for _STLP_NO_IOSTREAMS mode. Should
+ be slower than version coming with library but avoid link trouble.
+
+2006-01-11 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_bitset.h, stlport/stl/_bitset.c, src/bitset.cpp:
+ make helper structure _Bs_G non-template [it used only as instance
+ with unused bool argument only], and put static tables into library
+ to avoid possible static instances duplication.
+
+ * build/lib/Makefile.inc: idem.
+
+2006-01-10 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/type_traits.h, config/_msvc.h, _mwerks.h: Integrate
+ intrinsic type traits support for Visual 2005 and Metrowerk. Code
+ based on boost library information and not tested for Metrowerk.
+
+ * test/unit/bind_test.cpp: Fix BindTest::bind2nd3 test case, had
+ never been used.
+
+ * stlport/stl/boost_type_traits.h: Change boost type traits wrapping
+ implementation to use meta programming operation on types rather
+ than on numerical constant, MSVC6 prefer it.
+
+ * build/test/unit/msvc.mak: Systematically add /Zm800 for MSVC
+ compilers, useful in a number of case and transparent in others.
+
+ * test/unit/type_traits_test.cpp: Add is_POD test case. Add dummy
+ constructors, assignment operator and destructor to any_type struct
+ to make the tests pass even with compilers having intrinsic type
+ traits support.
+
+2006-01-09 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/debug: Fix move constructor to keep the container
+ move constructor complete. When STLport user do no require no
+ extension or Standard debug safe mode, iterators are also move
+ with the container contents.
+
+ * stlport/stl/_list.h, _slist.h, _tree.h: Made iterator struct
+ constructor from base class pointer explicit to forbid expression
+ like: list.begin() == 0.
+
+ * stlport/stl/pointers/_slist.h, _list.h, _set.h: Fix implementation
+ that was using former implicit contructor from pointer to base class.
+
+ * src/c_locale_win32/c_locale_win32.c: Fix implementation for
+ compilers coming with a native lib implementing secure C functions
+ like strncpy_s.
+
+ * src/iostream.cpp: Hide I/O streams declaration when defining
+ them when compiler has no support for removing I/O streams
+ from static global variable initialization segment. Avoid the
+ stdio_istreambuf using directive when we do not use STLport
+ private namespace.
+
+ * stlport/stl/_rope.h, _rope.c: Use internal, not _STLP_NO_EXTENSIONS
+ dependant functions for implementation.
+
+ * stlport/rope, hash_map, hash_set: Add _STLP_NO_EXTENSIONS check
+ that generate a #error if defined as those headers are STLport
+ extensions.
+
+ * stlport/_uninitialized.h: Add __uninitialized_copy_n no dependant
+ against _STLP_NO_EXTENSIONS for rope implementation.
+
+ * test/unit: Made tests ok to build even when _STLP_NO_EXTENSIONS or
+ _STLP_NO_ANACHONISM or _STLP_NO_CUSTOM_IO is defined.
+
+ * stlport/stl/_num_put.h, _num_get.h: Fix definition scope of
+ _STLP_MOVE_TO_STD_NAMESPACE that was wrong when _STLP_NO_CUSTOM_IO
+ is defined.
+
+ * stlport/stl/boost_type_traits.h: Fixed _IsRef implementation based
+ on boost type traits feature.
+
+ * build/nmake/extern.mak, lib/msvc.mak, test/unit/msvc.mak,
+ test/eh/msvc.mak: Moved injection of boost include path for all targets
+ in extern.mak. Also removed a useless double quote as make variable already
+ contains it.
+
+ * stlport/stl/config/_bc.h, test/unit/floatio_test.cpp, cmath_test.cpp,
+ limit_test.cpp: Borland patch from Eric Sanford.
+
+ * test/unit/string_test.cpp: Add template_wexpression test to check
+ wstring template expression.
+
+2006-01-05 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_stdexcept.h: Fix __Named_exception destructor
+ implementation when _STLP_NO_IOSTREAMS is defined or when
+ securized C function strcpy_s exists.
+
+ * stlport/stl/pointers/_set.h: Fixed implementation as _Identity
+ is now in private namespace and const_reverse_* functions must
+ return const_reverse_* iterators and not simply reverse_*.
+
+ * test/unit/bcompos_test.cpp, bind_test.cpp: Made the tests usable
+ when _STLP_NO_EXTENSIONS is defined.
+
+ * build/lib/configure.bat: Fix name of msvc8 compiler.
+
+ * test/unit/mfunptr_test.cpp: Ignore find test when no class
+ partial template specialization rather than commenting it.
+
+ * test/unit/type_traits_test.cpp: Ditto for reference_type test.
+
+ * build/Makefiles/nmake/top.mak: Fixed install-shared definition.
+
+ * build/Makefiles/gmake/gcc.mak: Add _STLP_USE_STATIC_LIB when
+ building and using STLport static lib under MinGW/Cygwin.
+
+2006-01-04 Francois Dumont <dums@stlport...>
+
+ * src/acquire_release.h: New file, expose __acquire_*
+ functions used in different translation unit.
+
+ * src/num_put.h: Removed, content moved to num_put.cpp that
+ was the only translation unit using exposed functions.
+
+ * src/*: Build with Intel C++ 9 compiler reveal that many
+ static specification was missing.
+
+ * src/ctype.cpp: Filter out _WCharIndexT specialization for
+ Intel compiler that consider wchar_t as unsigned, fixed a
+ warning.
+
+ * _STLP_STATIC_ASSERT is now called without trailing ';' that
+ is already in the macro definition.
+
+ * src/*: Removed reference to _SgI namespace replaced by the
+ STLport private namespace.
+
+ * src/iostream.cpp: Add iostream include to expose cout, cin, cerr
+ definition to declaration.
+
+2006-01-03 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/config/_gcc.h: Force use of new/delete based
+ allocator under Cygwin/MinGW, default node allocator has
+ problem because __node_allocator static datas are sometimes
+ duplicated in a dll context.
+
+2006-01-01 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/gmake/lib/gcc.mak, stlport/stl/config/_gcc.h:
+ Change way of building dll with Cygwin/MinGW. No more export of
+ all symbols, we use dllexport specification, makes import lib
+ really shorter and dll too. Moreover use of the
+ enable-auto-image-base linker option to make load of dll faster.
+
+ * stlport/stl/_time_facets.c, _num_put.c, _num_get.c, _monetary.c,
+ debug/_debug.c: Adapt existing Cygwin/MinGW workaround for new
+ way of generating dlls.
+
+2005-12-31 Francois Dumont <dums@stlport...>
+
+ * doc: Add Borland doc and update cygwin, mingw and msvc.
+
+ * build/lib/README.options: Removed, replaced by configrure
+ script.
+
+ * build/test/eh/bcc.mak: Added to build EH tests for Borland.
+
+2005-12-29 Francois Dumont <dums@stlport...>
+
+ * src/c_locale_win32/c_locale_win32.c: Hide _Locale_mbtowc and
+ _Locale_wctomb when no wchar_t support is detected thanks Eric
+ Sanford.
+
+ * src/c_locale_win32/c_locale_win32.c: Add mapping from Borland
+ facet macros to STLport associated string representation array index
+ thanks Eric Sanford.
+
+ * stlport/stl/config/_evc.h: Patch from Michael Fink to generalized
+ use of OutputDebugString for Windows CE when we need to trace
+ information.
+
+ * build/Makefiles/gmake/bcc.mak, lib/bcc.mak, app/bcc.mak: Fix
+ definition of START_OBJ thanks armpit33
+
+ * build/Makefiles/*: Generalize use of install-shared rather than
+ list of all shared rules, idem for install-static.
+
+2005-12-27 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string_io.c: Generalized use of _STLP_STATIC_ASSERT
+ macro rather that hand writen static assertion.
+
+ * stlport/stl/_fstream.c, _istream.c, src/fstream.cpp, strstream.cpp:
+ Add some cast to avoid Borland suspicious pointer arithmetic warnings
+ thanks Eric Sanford.
+
+ * stlport/stl/_limits.c: Fix Borland definition of NaNs and infinity
+ for long double thanks Eric Sanford.
+
+ * stlport/stl/config/_system.h, _gcc.h: Fix config for Windows, MinGW
+ and Cygwin platforms.
+
+ * stlport/stl/config/_windows.h: Can now be included by a pure C
+ compiler.
+
+ * stlport/stl/config/_warning_off.h: Removed suspicious pointer
+ arithmetic warning for Borland thanks Eric Sanford.
+
+ * stlport/stl/_construct.h: Removed now useless Borland workaround.
+
+ * src/stdio_streambuf.cpp: Ditto.
+
+ * stlport/stl/_alloc.h: Now allocator is tagged as an STLport class
+ even without partial template specialization support. This is
+ necessary because type_traits is specialized for allocator<char>,
+ allocator<wchar_t> and allocator<void*> when partial template
+ specialization is not available.
+
+ * test/unit/bitset_test.cpp: Add tests for the STLport
+ bitset::_Find_first extension.
+
+2005-12-27 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/initial_mak: obsolete makes removed (sync with STLPORT_5_0
+ branch).
+
+2005-12-24 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/config/_gcc.h: gcc, builded by Apple is differ
+ in behavior from original; in particular, in path to includes;
+
+ * build/Makefiles/gmake/app/gcc.mak: fix gcc options on MacOS X;
+ STLport is free from libstdc++ on MacOS now;
+
+ * build/Makefiles/gmake/gcc.mak: fix gcc options on MacOS X; gcc,
+ builded by Apple is differ in behavior from original;
+ detect this;
+
+ * build/Makefiles/gmake/lib/gcc.mak: fix gcc on MacOS X;
+ differentiate gcc from Apple and original;
+ STLport is free from libstdc++ on MacOS X now;
+
+ * build/Makefiles/gmake/darwin/rules-so.mak: use
+ gcc instead of c++ for linkage, if only C sources present.
+
+ * build/lib/gcc.mak, build/test/unit/gcc.mak: remove duplication
+ of stlport includes.
+
+2005-12-22 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/config/_windows.h: all system specific configuration
+ in one place [moved from stlport/stl/_windows.h]
+
+ * stlport/stl/_windows.h: deleted; all system specific configuration
+ in one place [moved to stlport/stl/config/_windows.h]
+
+ * stlport/stl/debug/_debug.c, stlport/stl/_threads.h:
+ _windows.h included via _prolog.h [i.e. via stl/config/_system.h],
+ see changes above.
+
+ * stlport/stl/config/_sunprocc.h: remove include of _solaris.h---it
+ already included from _system.h
+
+ * stlport/stl/config/_kai.h: remove include of os configuration files,
+ it should be included from _system.h
+
+ * stlport/stl/config/_intel.h: fix path after config headers
+ reorganization.
+
+ * stlport/stl/config/_evc.h: idem
+
+ * stlport/stl/_exception.h: idem
+
+ * stlport/stl/config/_prolog.h: idem
+
+ * test/unit/fstream_header_test.cpp: idem
+
+ * test/unit/iomanip_header_test.cpp: idem
+
+ * test/unit/ios_header_test.cpp: idem
+
+ * test/unit/iostream_header_test.cpp: idem
+
+ * test/unit/istream_header_test.cpp: ditto
+
+ * test/unit/locale_header_test.cpp: idem
+
+ * test/unit/ostream_header_test.cpp: idem
+
+ * test/unit/sstream_header_test.cpp: idem
+
+ * test/unit/strstream_header_test.cpp: idem
+
+2005-12-21 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/debug/_debug.h, _debug.c, _string_sum_methods.h:
+ Removed some unused parameters reported by Borland compiler.
+
+ * stlport/stl/config/_warnings_off.h: Disable unused parameters
+ warning for Borland compiler.
+
+ * build/Makefiles/gmake/targetdirs.mak: Change config in order to
+ have each generated application in a different bin folder.
+
+ * stlport/stl/_threads.h: Used _STLP_STATIC_ASSERT macro for a
+ static assertion.
+
+2005-12-19 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/lib/gcc.mak: move LDSEARCH flags after
+ possible -nostdlib
+
+ * build/lib/gcc.mak: don't add include path, it already included.
+
+ * src/c_locale.h: include stlport_prefix.h to add STLport's
+ definitions that used below.
+
+ * stlport/stl_user_config.h, stlport/stl/_config.h: moved
+ to stlport/stl/config catalog and renamed.
+
+ * stlport/stl/_config_compat.h, stlport/stl/_site_config.h: ditto.
+
+ * stlport/config: headers moved to stlport/stl/config catalog,
+ renamed and reorganized.
+
+ * stlport/stl/_prolog.h, stlport/stl/_epilog.h, src/stlport_prefix.h:
+ reflect changes in configuration files.
+
+2005-12-17 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_config.h: Removed ';' in _STLP_STATIC_ASSERT
+ definition.
+
+ * stlport/stl/_cwctype.h: Fix native namespace of wide char functions
+ for MinGW runtime <= 3.0. Also fix a typo for FreeBDS.
+
+ * src/stdio_streambuf.cpp: Add missing 'defined' when checking
+ __OS400__ macro existance.
+
+ * test/unit/resolve_name.cpp, set_test.cpp: Removed useless ';'
+ reported by remarks from Intel C++ compiler.
+
+2005-12-16 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_rope.h: Moved overload of __identity_element for
+ _Rope_Concat_fn in STLport private namespace where orginal function
+ declaration is. Also moved _Rope_Concat_fn at the same time, much more
+ many elements of _rope.h should be moved to this namespace...
+
+ * stlport/stl/_monetary.c: Change implementation of __money_do_put for
+ Borland compiler, looks like this compiler do not like ternary operator.
+
+ * src/c_locale_win32/c_locale_win32.c: Replace check of category in
+ __Extract_locale_name from > LC_ALL by != LC_ALL, there is no reason
+ for LC_ALL to be upper or lower to all other categories.
+
+ * build/Makefiles/gmake/cygming/rules-so.mak: Segregate different
+ compilers linker calls and add reference to START_OBJ in Borland
+ linker invocation.
+
+ * build/Makefiles/gmake/lib/rules-a.mak, cygming/targetsys.mak: Borland
+ archiver add option is now '+', before being invocated archive is always
+ deleted to avoid warnings because the Borland archiver do not have a
+ real add or replace module option.
+
+ * stlport/stl/type_traits.h: Fix for compiler simulating partial
+ template specialization (VC6)
+
+ * test/eh/test_rope.cpp: Removed rope test for Borland.
+
+ * test/unit/exception_test.cpp: Commented tests are now ignored.
+
+ * test/unit/locale_test.cpp, string_test.cpp: No more ignored test
+ for Borland.
+
+2005-12-14 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/sysid.mak: parse two-token target
+ system identification string along with three-token one
+ [useful when vendor is omitted]; thanks Jonathan Sprinkle.
+
+ * stlport/cwctype, stlport/stl/_cwctype.h: wctype_t and
+ others are in global namespace on FreeBSD.
+
+ * build/Makefiles/gmake/app/gcc.mak, lib/gcc.mak: use build
+ with -nostdlib on Solaris.
+
+ * src/cxa.c: fix for Solaris
+
+ * stlport/config/stl_solaris.h, stlport/stl/_cmath.h:
+ hmm, strange... sometimes MATH_L and MATH_F present on Solaris,
+ sometimes not...
+
+2005-12-14 Francois Dumont <dums@stlport...>
+
+ * test/unit/cppunit/cppunit_mini.h, file_reporter.h: Add ignore
+ test feature, now tests should be ignored rather than commented.
+ 2 new macros for that CPPUNIT_IGNORE to add in tests declaration,
+ all test following this macro won't be run; CPPUNIT_STOP_IGNORE
+ optional macro to stop ignoring tests.
+
+ * test/unit/fstream_test.cpp: Ignore custom_facet test when not
+ supported rather than comment it.
+
+ * test/unit/hash_test.cpp: Ignore hmap1 test for Borland and Digital
+ Mars compilers, looks like rope class is too complicated for those
+ compilers.
+
+ * test/unit/locale_test.cpp: Ignore locale_by_name test for compiler
+ without exceptions support. Ignore money facet tests for Borland.
+
+ * test/unit/mvctor_test.cpp, rope_test.cpp: Some tests ignored
+ depending on various configuration settings.
+
+ * test/unit/type_traits.cpp: Add test for _IsSTLportClass metaprogramming
+ tool. Ignored for Borland.
+
+ * test/unit/unordered_test.cpp: Fix test for Digital Mars, unordered
+ containers value_type are not necessarily with an immutable key, it is
+ more portable to use value type rather than redefining it in the test.
+
+ * test/unit/string_test.cpp: Removed Windows CE macro check replaced
+ by WaitForMultipleObjects returned code check, more portable and
+ maintenable. Ignore a test for Digital Mars compiler.
+
+ * stlport/stl/type_manips.h, type_traits.h: Simplified metaprograming
+ tools implementation; now avoid compilation constant replaced by
+ type, Borland compiler has problem with constants.
+
+ * stlport/config/stl_bc.h: Made supported compiler check more accurate
+ free compiler is 5.5.1 so it is the oldest supported version. Borland
+ compiler do not support IEC559 specifications.
+
+ * build/Makefiles/gmake/bcc.mak: Put startup .obj to link with in
+ START_OBJ rather than LDLIBS, thanks Eric Sanford.
+
+ * src/c_locale_win32/c_locale_win32.c: Temporarily removed category
+ check in __Extract_locale_name function for Borland, looks like LC_ALL
+ or LC_MAX has not the right value.
+
+2005-12-13 Francois Dumont <dums@stlport...>
+
+ * src/cxa.c: Add include of stlport_prefix.h first, this file
+ should be always included first in STLport translation units,
+ it prepares some compilers config and define important for Wins
+ __BUILDING_STLPORT macro.
+
+2005-12-13 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/targetdirs.mak: built-in
+ test in /bin/sh on Solaris has no -e, use external instead.
+
+2005-12-11 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/gmake/bcc.mak : Add -w-eff to disable 'useless'
+ code warning, we had to chose between this warning and the 'used
+ parameter' one.
+
+ * build/Makefiles/gmake/targetdirs.mak: Removed comment about folder
+ creation action under windows platform. The action is identical to
+ the one used in the nmake build system and no one complains about it
+ so current situation is not so bad. Only users of Windows before Windows
+ 98 should eperiment troubles, this is a known limitation.
+
+ * build/Makefiles/gmake/dmc.mak, cygming/rules-so.mak: Change config,
+ now we directly invoke the linker, we do not use a compiler call for it.
+
+ * build/Makefiles/gmake/app/bcc.mak: Fix linker option in order to generate
+ a windows executable and not a dll, thanks Eric Sanford.
+
+ * build/Makefiles/gmake/app/rules-install.mak: Add install dir dependency
+ rather than doing a folder existence check in rules actions.
+
+ * build/Makefiles/gmake/app/rules.mak: Restore slash rotation for Borland
+ linker invocation and fix static rules dependencies to guaranty folder
+ creations.
+
+ * build/Makefiles/gmake/lib/bcc.mak: Add missing archiver page size parameters.
+
+ * build/test/unit/bcc.mak: Add _STLP_DEBUG_UNINITIALIZED for static
+ debug rules.
+
+ * build/Makefiles/gmake/lib/rules-a.mak: Segregate each archiver invocation.
+
+2005-12-09 Francois Dumont <dums@stlport...>
+
+ * build/lib/configure.bat: Add Borland compiler to compilers
+ able to mix a dll build with a static native runtime.
+
+ * build/Makefiles/gmake/bcc.mak, dmc.mak: Complete libs to link
+ depending on STLport configuration.
+
+ * build/Makefiles/gmake/targetdirs.mak: roll back modif from Petr
+ 2005-12-08
+
+ * build/Makefiles/gmake/targets.mak: ditto
+
+ * build/Makefiles/gmake/cygming/lib.mak: Fix for static libs build
+ with compiler different than gcc.
+
+ * build/Makefiles/gmake/cygming/targetsys.mak: Add missing info for
+ static libs build with Borland and Digital Mars compilers.
+
+ * build/Makefiles/gmake/lib/rules-a.mak: Fix static builds commands
+ to use info of above point.
+
+ * build/Makefiles/gmake/lib/rules-install-a.mak: Add install rule
+ for windows and missing catalog in dependency tree.
+
+ * build/Makefiles/gmake/windows/rules-install-so.mak: Add missing
+ catalog dependency.
+
+2005-12-09 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/lib/Makefile.inc: add cxa.c into compilation; this
+ is useful for FreeBSD 4.11 C++ ABI workaround.
+
+ * src/cxa.c: use _cxa_atexit and related functions on
+ FreeBSD 4.11 [workaround for missed C++ ABI functions].
+
+2005-12-08 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_auto_ptr.h: Add missing Standard throw() specification
+ on all auto_ptr members.
+
+ * stlport/config/stl_mycomp.h: Removed recently introduce macro
+ _STLP_DFLT_PARAM_INSTANCIATION_BUG, already existing _STLP_DONT_SUP_DFLT_PARAM
+ is enough for the moment.
+
+ * stlport/stl/_stream_iterator.h: Small implementation change to make
+ Digital Mars compiler happy.
+
+ * stlport/stl/_unordered_map.h: Digital Mars compiler do not like
+ immutable keys in associative containers.
+
+2005-12-08 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/ctype.h: forward-declaration for _exception struct
+ for WinCE/eVC3; prevents warning message
+ ../include/stdlib.h(817) : warning C4115:
+ '_exception' : named type definition in parentheses
+ [Michael Fink's suggestion]
+
+ * stlport/float.h, stlport/limits.h, stlport/setjmp.h: idem.
+
+ * stlport/stdarg.h, stlport/string.h, stlport/stdio.h: idem.
+
+ * build/Makefiles/gmake/gcc.mak: check configuration macro
+ WITHOUT_STLPORT [useful for tests]; force usage of stlport
+ headers first otherwise.
+
+ * build/Makefiles/gmake/targetdirs.mak: fix catalogs creation
+ procedure [loop through catalogs required]; comment problematic
+ code when we have no good tools.
+
+ * build/Makefiles/gmake/lib/gcc.mak: fix typo [FreeBSD]; fix
+ set of libraries when link for FreeBSD; fix typo in macro name
+ [FreeBSD again].
+
+ * build/Makefiles/gmake/app/gcc.mak: fix set of libraries when
+ link for FreeBSD; insert stlport lib in STDLIB set [when STLPORT
+ in force], to avoid set one in application's makefile.
+
+ * build/test/unit/gcc.mak: explicit refrence to libstlport in
+ this makefile not required more [see message above].
+
+ * build/Makefiles/gmake/lib/gcc.mak: remove names inherited from
+ Complement project.
+
+ * build/Makefiles/gmake/*/rules-install-so.mak: installation
+ catalog was missed in dependency tree; ident string removed
+ to simplify merge/diff
+
+ * Build: building library and unit tests with cross [gcc 3.4.5]
+ on Linux for FreeBSD 5.3 (except cwctype_test).
+
+ * build/Makefiles/gmake/targets.mak: rotate slashes for BCC.
+
+ * build/Makefiles/gmake/app/macro.mak: remove name contruction
+ for program; rotate slashes for wins.
+
+ * build/Makefiles/gmake/app/rules-install.mak: remove name
+ contruction for program.
+
+ * build/Makefiles/gmake/app/rules.mak: remove name contruction
+ for program; objects for static and for dynamic are the same.
+
+2005-12-04 Francois Dumont <dums@stlport...>
+
+ * src/num_put_float.cpp: Filter inclusion of stdint.h, required for
+ Digital Mars compiler, forbidden for Sun platform.
+
+ * stlport/stl/_cwctype.h: wide types and function are in global
+ namespace.
+
+ * build/test/unit/gcc.mak: Modify cygwin/mingw config now that
+ default settings for those platform is shared library.
+
+ * build/Makefiles/gmake: Add support of static targets, used
+ especially for Borland C++ Compiler and Digital Mars Compiler.
+
+ * build/Makefiles/gmake/app/gcc.mak: Fix typo in FreeBSD
+ configuration.
+
+2005-12-02 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_msvc.h: Fixed configuration detection when building
+ STLport dll based on a static native runtime.
+
+ * stlport/stl/_locale.h: Fix warning convertion from size_t to
+ __stl_atomic_t that can be of lower size.
+
+ * stlport/config/stl_gcc.h, doc/README.mingw, README.cygwin: Made dll
+ default settings under cygwin/mingw.
+
+2005-12-01 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_mbstate_t.h: Add workaround for alpha bad WCHAR_MIN and
+ WCHAR_MAX definition.
+
+ * stlport/config/stl_gcc.h: Configure STLport for alpha platform as not
+ supporting iec559 specification as quiet nan is not correct. If someone
+ find the right value then this config will have to be rollbacked.
+
+ * build/Makefiles/gmake/gcc.mak: Restored Sun OS support that use the
+ -pthreads option and not -pthread
+
+ * build/Makefiles/nmake/lib/macro.mak: Fixed library name generation
+ when using cross runtime version thanks Alexey Ivanov report.
+
+2005-11-29 Francois Dumont <dums@stlport...>
+
+ * stlport/stl_user_config.h: Add _STLP_LIB_NAME_MOTIF macro to give
+ users a point of customization of the automatic linking feature.
+
+ * build/Makefiles/nmake/lib/macro.mak, gmake/cygming/lib.mak: Use
+ STLP_BUILD_LIB_MOTIF in library name generation algorithm. Also take
+ into account cross builds in library name generation.
+
+ * build/lib/configure.bat: Add --lib-motif option to give users a
+ way to customize the generated library names.
+
+ * test/eh: Generalized use of msvc.mak rather than all the nmake-vc??.mak
+ files. Idem for evc.mak instead of nmake-evc?.mak and icl.mak instead of
+ nmake-icl.mak.
+
+ * stlport/stl/_exception.h: Change _msvc_warnings_off.h include in
+ _warnings_off.h as this file now also turn off Borland warnings.
+
+ * stlport/config/_detect_dll_or_lib.h: Mutualization of code used to
+ detect current STLport type of build or usage (dll or static lib).
+
+ * stlport/config/stl_msvc.h, stl_bc.h, stl_dmc.h: Integration of
+ _detect_dll_or_lib.h
+
+ * stlport/config/_auto_link.h: Change auto link algo when we detect
+ cross STLport usage that is to say use of STLport as a dll link with
+ static native runtime or opposite.
+
+2005-11-29 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/cxa.c: mutex should be recursive-safe, due to __cxa_finalize
+ may be called recursive.
+
+2005-11-28 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_threads.h: Simplified expression used to instanciate
+ _Atomic_swap_struct, gcc 2.95 had trouble with the one line expression.
+
+ * src/dll_main.cpp: Fix instanciation of _Swap_lock_struct that has been
+ changed and renamed in _Atomic_swap_struct.
+
+ * test/unit/map_test.cpp, set_test.cpp: Simplified call to map constructor
+ taking a functor and allocator instance, split it in a creation of a les<int>
+ instance then passed to the constructor; gcc 2.95 had trouble with previous
+ version.
+
+ * stlport/stl/_cmath.h, _cstdlib.h: Now those files includes each other to
+ make sure that all abs overloads are defined when it is imported in STLport
+ namespace. gcc 2.95 is very strict on this point and only consider the abs
+ overloads existing at the first import calls, all overloads added after that
+ are discarded silently.
+
+ * stlport/stl/_cmath.h: Removed unjustified abs function overloads done
+ directly in STLport namespace for gcc 2.95 and before. Those overloads
+ clashed on a Linux with gcc 2.95 from the sourceforge compiler farm.
+
+ * build/Makefiles/gmake/gcc.mak: Generalized definition of _REENTRANT under
+ Linux to make detection of a multithreaded build from STLport code easier.
+ Problem meet on an alpha linux platform from the sourceforge compiler farm.
+
+ * stlport/stl/_locale.h: Removed _M_delete locale::facet member variable,
+ useless if facet instance reference counter is right.
+
+ * src/locale_impl.cpp, message.cpp: Change classic facets initialization code
+ to simply set initial counter to 1 rather than incrementing it after construction.
+
+ * test/unit/evc.mak fix path to config file in existance check.
+
+ * stlport/stl/_move_construct_fwk.h, type_manips.h: Add workaround to use
+ move constructor with Borland compiler.
+
+2005-11-28 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/targetdirs.mak: change names of .o output dirs
+ to make bcc happy (bug with passing name that contain '-' from
+ compiler to linker). Replacement: 'shared' -> 'so', 'static' -> 'ar',
+ '-' -> '_' (i.e. obj/gcc/shared-stlg -> obj/gcc/so_stlg, a bit shorter)
+ [Suggested by Francois Dumont].
+
+2005-11-27 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/targets.mak, app/rules.mak, linux/rules-so.mak:
+ use gcc instead of c++ as linker if there are no C++ objects.
+
+ * src/cxa.c, build/misc/cxa_atexit/Makefile.inc, build/misc/cxa_atexit/gcc.mak:
+ workaround for bugged __cxa_finalize; use builded libcxa.so in LD_PRELOAD or
+ /etc/ld.so.preload in Linux system with bugged glibc. See also
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24189
+
+2005-11-27 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/type_manips.h: Add import of __true_type and
+ __false_type in STLport private namespace as the using namespace
+ directive do not seems to be enough for latest gcc version.
+
+ * src/time_facets.cpp: Fix buffer size decrementation in __write_formatted_time
+ function thanks Petr Ovtchenkov
+
+2005-11-26 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_complex.h: Move implementation of generic abs, arg and polar
+ after definition of double overload used in implementation. Thanks Kees de
+ Bruin
+
+ * stlport/stl/_threads.h, _alloc.h, _alloc.c: Fix lock free node allocator
+ implementation thanks Weis.
+
+ * stlport/stl/wrappers: Removed, no more maintained and complicated to fix
+ with the debug and pointer specialization implementations.
+
+ * test/unit/stack_allocator.h: Creation of an allocator using a stack buffer.
+ This allocator specificity is to not be stateless and not default constructible.
+
+ * test/unit/list_test.cpp, stlport/stl/_list.h, _list.c: Add of a test with the
+ StackAllocator. Fix list implementation to correctly handle allocator state
+ in the methods moving elements from a list instance to an other.
+
+ * stlport/stl/_carray.h: Creation of a new internal struct _CArray that mimic a C
+ array with the additionnal feature of being able to be instanciated with a type
+ without default constructor.
+
+ * stlport/stl/debug/_list.h: Adapt iterator invalidation according allocators
+ compare result.
+
+ * test/unit/slist_test.cpp, stlport/stl/_slist.h, _slist.c: idem list.
+
+ * stlport/stl/_slist.h: Modification of the splice_after methods signature. Users
+ now have to pass the source slist instance, this is mandatory in order to compare
+ the 2 slists allocator instance before moving an element from a slist instance to
+ an other.
+
+ * stlport/stl/_string_base.h: Fix _M_swap implementation for basic_string instanciation
+ with allocator having a state.
+
+ * stlport/stl/_list.c, _slist.c: sort methods now throw an overflow exception when lists
+ are too long to be sorted with the current algorithm. This is preferable to a buffer
+ overrun.
+
+ * stlport/stl/_alogobase.c: Small equal_range optimization, upper_bound is not called
+ anymore when lower_bound returned value is already not equivalent to the search value.
+
+ * build/Makefiles/gmake: Add build system for Digital Mars and Borland C++ compilers
+
+ * build/lib/configure.bat: Add following options
+ --use-boost
+ --not-thread-safe
+ --no-rtti
+ see script for explanation. --mingw removed, detected with --compiler option, if
+ gcc, dmc or bcc then we are using MinGW tools.
+
+ * build/lib/configure: Add --not-thread-safe option
+
+ * build/Makefiles: Add build options to generate not thread safe libs and no rtti libs,
+ all compilers option has not been updated.
+
+ * stlport/c*: Modification of C++ headers wrapping C ones. All code moved to internal
+ headers in stlport/stl folder. Internal headers are only included if include comes from
+ user code otherwise only native header is included. Limit dependency between STLport
+ headers relations and native library once. Reported by problem building with Borland
+ compiler.
+
+ * test/unit/cppunit/cppunit_mini.h: Replace cstring include with string.h to avoid
+ references to std namespace in headers, should be more portable. Add typedef Base
+ definition in CPPUNIT_TEST_SUITE macro, used in calls to base class methods, help
+ Borland.
+
+ * Generalize use of secure string functions (strcpy_s for instance) for MSVC compilers
+ supporting it and tagging former versions like deprecated. The pragma warning that used
+ to disable this warning has been removed.
+
+ * stlport/BC50: Removed, no necassry anymore for supported Borland compiler versions.
+
+ * stlport/stl/debug: Implementation modification, now debug wrapper agregate a non debug
+ instance rather than inheriting from it. Makes debug implementation clearer as we are now
+ forced to implement the complete containers interfaces.
+
+ * stlport/stl/pointers: Fix implementation in order to support Standard compilers
+ not accepting cast from function pointer to void*.
+
+ * *: Reinforce use of STLport private namespace (stlp_priv or stlport::priv) for all
+ internals algorithms.
+
+2005-11-21 Francois Dumont <dums@stlport...>
+
+ * Fix classic locale facet initial reference counter thanks
+ Cabal
+
+2005-11-20 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/num_put.h: check that incoming string has enough
+ digits for fractional part processing. This check includes
+ check for empty incoming string. (Thanks Leonardo [leoapsilva]
+ for the bug report).
+
+ * stlport/stl/_monetary.c: fix processing the case when
+ number of digits in value less then number of digits in fraction.
+
+ * src/facets_byname.cpp: international currency symbol should
+ be the first (not depends upon where currency symbol situated in
+ the national format).
+
+ * test/unit/locale_test.cpp: tests for reproducing this problems.
+
+2005-11-20 Gail Baker <baker88@users.sourceforge.net>
+
+ * build/Makefiles/gmake/CC.mak: Updated compiler option
+ to compile larger inline functions inline.
+
+ * build/Makefiles/gmake/lib/CC.mak: Changed how the header
+ file linking is done to only do it once instead of with
+ every compile.
+
+ * build/lib/README: include instructions for SunPro compiler.
+
+ * build/test/unit/CC.mak: allow the STLP_DEBUG version to compile.
+
+2005-11-19 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stdlib.h: replace C++ comments by C, to satisfy -ansi
+ option of compiler.
+
+2005-11-18 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/nmake/lib/rules-install-so.mak,
+ app/rules-install-so.mak: Add copy of manifest file when exist
+ rather than when compiler is Visual Studio 2005.
+
+ * src/stdio_streambuf.cpp: Removed warning for EVC 3 and 4 thanks
+ Michael Fink patch.
+
+ * stlport/stl/math.h, stdlib.h: Fix EVC3 warning thanks Michael Fink
+ patch.
+
+ * doc/README.evc3: doc update from Michael Fink.
+
+ * stlport/*, stlport/*, tests/*: Clean up of trailing blank charaters
+ in all source files.
+
+2005-11-17 Gail Baker <baker88@users.sourceforge.net>
+
+ * build/Makefiles/gmake/CC.mak, depend.mak, app/CC.mak, lib/CC.mak:
+ support of SunPro 5.7 compiler.
+
+ * build/lib/CC.mak: ditto
+
+ * stlport/stl/_rope.c: Removed extra semi-colons.
+
+ * stlport/stl/_rope.h: Sunpro compiler had a problem with
+ the __ROPE_DEPTH_SIZE macro doing an addition. Changed to
+ a fixed value instead.
+
+ * stlport/cstdlib: Updated to allow the compiler to find abs and div
+
+ * stlport/config/stl_sunpro.h: Disabled _STLP_LINK_TIME_INSTANTIATION
+ since this nolonger works with current files. The issue here is that
+ a number of defines that are required in the C versions of the files
+ use defines that are undefed at the end of the include. So, when
+ the compiler finally compiles the C version at link time the defines
+ are lost and the files don't compile. Also added a minor change
+ to allow files that are compiled with cc to include stl_sunpro.h
+ without bailing out.
+
+ * stlport/stl/_bvector.h: Added stl/_range_errors.h required by
+ an exception that can be called.
+
+ * stlport/stl/_cmath.h: Changed to pull all math functions from std
+ namespace for SunPro compiles only.
+
+ * test/unit/fstream_test.cpp: Added SunPro compile to the list
+ of compilers that don't use the DO_CUSTOM_FACET_TEST.
+
+ * test/unit/string_test.cpp: Added Sun UI Threads to the list
+ of supported thread types in the test.
+
+ * test/unit/valarray_test.cpp: The compiler was having trouble
+ finding abs(). Added a "using std::abs" for the SunPro compiler
+ which solved the problem.
+
+ * test/unit/cppunit/cppunit_mini.h: Added additional using statements
+ for the str* commands.
+
+ * test/unit/cppunit/test_main.cpp: Added "using namespace std;"
+ for the SunPro compiler.
+
+ * build/test/unit/CC.mak: support of SunPro 5.7 compiler
+
+2005-11-17 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_messages_facets.h, src/messages.cpp: Move message facet
+ constructor private to guaranty that it is only called from the _Locale_impl
+ class for classic locale facets creation. Change constructor implementation
+ as now passed _Message instance is dynamically instanciated so needs to be
+ destroy on facet destruction; moreover the facet is also dynamically allocated
+ and has to be destroyed when reference counter reach 0.
+
+ * src/locale_impl.cpp: Removed call to now useless free_classic_locale function.
+ Change make_classic_locale implementation, now classic locale facets are
+ allocated on the heap and have to be destroyed like any ordinary facets
+ when reference counter reach 0.
+
+2005-11-15 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_tree.h: check iterator returned from lower_bound
+ in equal_range_unique for end, to avoid increment [useful when
+ key not available].
+
+ * test/unit/map_test.cpp: test for problem above.
+
+2005-11-09 Francois Dumont <dums@stlport...>
+
+ * build/test/eh/gcc.mak: Fix build system for Cygwin/MinGW systems that
+ was broken since library naming convention modification.
+
+2005-11-07 Michael Fink <vividos@users.sourceforge...>
+
+ * build/lib/configure.bat: Fixed configuring for Visual Studio .NET 2003.
+ Fixed jump target names for Win9x OSes: they must be 8 characters or
+ shorter.
+
+2005-11-07 Michael Fink <vividos@users.sourceforge...>
+
+ * build/Makefiles/nmake/evc3.mak, build/Makefiles/nmake/evc4.mak,
+ build/lib/configure.bat, stlport/config/stl_evc.h: Added check if
+ using x86 emulator configuration; using of proper include paths in
+ case.
+
+ * doc/README.evc4: Documentation update
+
+2005-11-01 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * Repository: STLport 5.0, tag STLPORT_5_0_RELEASE
+
+ * Repository: merge HEAD and STLPORT_5_0 branch.
+
+ * build/Makefiles/gmake/app/rules-install.mak: install-shared rule
+ added (patch by Michael Fink).
+
+ * build/Makefiles/gmake/lib/rules-install-a.mak: install-static rule
+ added (patch by Michael Fink).
+
+2005-10-12 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_threads.h, _threads.c: Fix regression for some platforms
+ introduce by modification of _Atomic_swap_ptr implementation thanks
+ Albrecht Fritzche.
+
+2005-10-09 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * repository: RC6, tag STLPORT_5_0_RC6
+
+2005-10-09 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_gcc.h: DEC alpha has not *l math functions
+
+2005-10-08 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_config.h: Add endianess specification for DEC alpha thanks
+ sourceforge compiler farm.
+
+ * stlport/config/stl_intel.h: Remove reference to _STLP_GLOBAL_NEW_HANDLER
+ in this file as this macro depends on native Standard library which is
+ the back end MSVC compiler one so macro set in stl_msvc.h.
+
+2005-10-07 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/gmake/darwin/sys.mak, freebsd/sys.mak: Fix EXT_TEST
+ definition to test rather than /usr/bin/test thanks sourceforge
+ compiler farm.
+
+2005-10-05 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/nmake/vc-common.mak: Remove /Fd option for the icl
+ compiler that do not know it.
+
+2005-10-04 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/debug/_list.h: Fix resize method implementation in safe
+ STL mode thanks Ethan Fenn report.
+
+ * test/unit/list_test.cpp: Add test case for list::resize method.
+
+ * build/Makefiles/nmake/lib/rules-install-a.mak, app/rules-install-a.mak:
+ Install .pdb files only if exist, Intel C++ compiler do not generate them
+ when building static libraries. Thanks Albrecht Fritzsche
+
+ * stlport/stl/_ostream.h, _ostream.c: Move _M_init function implementation
+ from .c to .h as .c is not included when _STLP_NO_CUSTOM_IO is defined
+ but _M_init might not be exported if compiler fully inline it.
+
+2005-10-03 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_tree.h: Fix _S_value method definition that returns
+ a value_type& rather than the reference typedef as reference might be,
+ depending on the traits used to instanciate _Rb_tree, equivalent to
+ a const_reference.
+
+2005-09-30 Francois Dumont <dums@stlport...>
+
+ * INSTALL, README, doc/FAQ, doc/README.msvc: Documentation updates.
+
+ * doc/stlport_namespaces.txt: Small doc about STLport namespaces and how
+ STLport replace native Standard library.
+
+2005-09-26 Francois Dumont <dums@stlport...>
+
+ * build/*: Finished _STLP_LEAKS_PEDANTIC clean up from all make files.
+
+2005-09-25 Francois Dumont <dums@stlport...>
+
+ * build/test/unit/gcc.mak: Remove _STLP_LEAKS_PEDANTIC option when building
+ unit tests as this option is not defined when building the libs.
+
+2005-09-22 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/sysid.mak: add underscore in architecture recognition,
+ to parse targets like x86_64-unknown-linux-gnu.
+
+2005-09-21 Francois Dumont <dums@stlport...>
+
+ * src/locale.cpp, facets_byname.cpp: Use of _STLP_ATOMIC_INCREMENT rather than
+ a lock on a mutex when the macro is available.
+
+2005-09-21 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * src/locale_impl.cpp: some internal functions used before declared.
+ Thanks Thomas Kho for report.
+
+2005-09-20 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string.h, _string_workaround.h: code refactoring, substr method
+ now use string constructor taking same parameters rather than the range
+ constructor, thanks Felix Wyss report. Also add missing allocator parameter
+ for non stateless allocators.
+
+ * build/Makefiles/gmake: Restore resource build for Cygwin and MinGW, add
+ it for Windows.
+
+ * build/lib/configure.bat: Add --extra-cxxflag to inject additional compilation
+ option in the nmake build system.
+
+2005-09-20 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * test/unit/ptrspec_test.cpp: gcc 2.95 fail to roll out template instantiation
+ for pointers to member function, skip this test for gcc 2.95.
+
+ * build/Makefiles/gmake/gcc.mak: gcc 2.95 has no -fuse-cxa-atexit option.
+
+ * build/lib/gcc.mak: don't use LEAK_PEDANTIC with gcc 2.95 [but this not help,
+ segfault at program termination still happens].
+
+ * stlport/config/stl_gcc.h: gcc 2.95 has problem with llabs, so force to use
+ _STLP_NO_VENDOR_STDLIB_L; 2.95 fails to initialize builtin types.
+
+ * stlport/stl/_cmath.h: workaround for gcc 2.95---it has problem with 'using'
+ directive [problem with 'abs' with float types as argument].
+
+ * stlport/stl/type_traits.h: workaround for gcc 2.95 [parentheses around
+ template argument]. Thanks Thomas Kho.
+
+ * test/unit/fstream_test.cpp: custom facet test compilation fail for gcc 2.95
+
+ * build/Makefiles/gmake/icc.mak, build/test/unit/icc.mak: support icc 9.0,
+ thanks John Fisher-Ogden and Thomas Kho.
+
+ * src/c_locale_glibc/c_locale_glibc2.c: use newlocale/freelocale for
+ glibc 2.3.x, and __newlocale/__freelocale for glibc 2.2.x. Thanks Gail Baker.
+
+2005-09-19 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/nmake/clean.mak, lib/clean.mak, app/clean.mak: Add check
+ for file or folder existance before calling del or rd to avoid error
+ messages that give a bad feed back to STLport users.
+
+ * build/Makefiles/gmake: Add support to use the GNU make tool in a Windows
+ cmd console. For the moment it is used to build STLport using a simple
+ MinGW distrib.
+
+ * stlport/stl/type_traits.h: Simplified code removing the _IsConvertibleIfNot
+ that has never proved of being useful, it only introduces problem with some
+ limited compilers.
+
+ * stlport/stl/_string_workaround.h, _string.h, debug/_string.h: Fix string
+ range constructor bug in the VC6 specific workaround implementation that was
+ resulting in a memory leak. Thanks Felix Wyss report.
+
+2005-09-18 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_hash_fun.h: add hash function for void *.
+
+ * src/facets_byname.cpp, src/message_facets.h: introduce map between
+ nl_catd type [that is void * on Linux] and messages_base::catalog
+ [that is int by Standard]; this should remove problems on platforms
+ where sizeof(int) < sizeof(void *).
+
+2005-09-16 Francois Dumont <dums@stlport...>
+
+ * stlport/cwchar: Add MinGW 3.8 runtime wide-char to multi-byte functions
+ import within STLport namespace thanks Rene Riviera.
+
+2005-09-14 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_gcc.h: Mingw support string wide functions thanks
+ Rene Riviera report.
+
+2005-09-13 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * stlport/stl/_thread.h: fix return type specification
+ [volatile void * -> void *].
+
+2005-09-12 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_thread.h: Fix _Atomic_swap_ptr implementation in single
+ threaded mode and when there is no pointer atomic swap operation.
+
+ * stlport/stl/_site_config.h: Add _STLP_NO_CYGWIN macro to signal use
+ of the -mno-cygwin cygwin option.
+
+ * build/lib/configure: Remove automatic generation of stlport/script_config.h.
+
+2005-09-11 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/sysid.mak: provide identification hosted platform.
+
+ * build/Makefiles/gmake/targetdirs.mak: CygWin/MinGW has no /usr/bin/test,
+ but built-in test support -e; see record 2005-09-04.
+
+ * build/Makefiles/top.mak: separate hosted platform and target platform
+ file extentions, tools, utilites.
+
+ * build/Makefiles/gmake/?/sys.mak, build/Makefiles/gmake/?/targetsys.mak:
+ ditto.
+
+2005-09-09 Francois Dumont <dums@stlport...>
+
+ * src/c_locale_win32.c: Fix _Locale_wchar_[tolower,toupper] implementation
+ which was wrong when wint_t was not the same typedef as wchar_t.
+
+ * build/lib/configure: Removed obsolete configure options --with-msvc and
+ --with-mssdk. And --no-cygwin option to make build of STLport using -mno-cygwin
+ option easier.
+
+ * stlport/script_config.h: New header used to put additionnal macros defined
+ by the configure script.
+
+ * stlport/stl/_config.h: Add script_config.h include.
+
+ * stlport/config/stl_gcc.h: Use of the new _STLP_NO_CYGWIN macro to set
+ the right _STLP_NATIVE_INCLUDE_PATH macro value.
+
+ * build/Makefiles/gmake/gcc.mak: Change CC and CXX assignment from := to
+ ?= to take into account an already existing definition.
+
+2005-09-07 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/gmake: Adopt a more traditionnal unixes naming
+ convention for cygwin and mingw.
+
+ * build/Makefiles/nmake: Attempt to make STLport library names more
+ coherent between unixes and windows systems. Now windows use the 5.0
+ extension like under unixes even if under unixes the file extension
+ is before the 5.0 and under windows it will be after. The other
+ difference is that the debug suffix is 'g' when using gcc and 'd' for
+ the other compilers. This modification comes from a work to improve
+ STLport integration within boost build system, bjam.
+
+ * stlport/config/stl_msvc.h: Modify MSVC auto link feature to reflect
+ above modifications.
+
+2005-09-06 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_gcc.h: Fix cygwin config that do have native
+ mbstate_t definition.
+
+2005-09-05 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * repository: RC5, tag STLPORT_5_0_RC5
+
+2005-09-04 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * build/Makefiles/gmake/targetdirs.mak: in sh's built-in 'test' no -e
+ option on Solaris, use external 'test' instead.
+
+ * build/test/unit/gcc.mak: Fix LDSEARCH recursive problem; fix
+ options for ld search path for some platforms.
+
+ * stlport/cstdlib, stlport/stl/_cmath.h: fix usage of native
+ ?f and ?l math functions on Solaris; hypot for long double should't
+ loose precision, if no native C function present.
+
+2005-09-02 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_msvc.h, stl/_move_construct_fwk.h: Add the
+ _STLP_NO_MOVE_SEMANTIC configuration macro to remove move semantic
+ support for MSVC .Net 2002 that seems to be unable to support it.
+ Maybe we should rather remove this compiler version support...
+
+ * test/unit/mvctor_test.cpp: Add _STLP_NO_MOVE_SEMANTIC check.
+
+2005-08-31 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/nmake: Enhance nmake build system to correctly take
+ into account the .manifest files generated by VS 2005 Beta.
+
+2005-08-29 Petr Ovtchenkov <complement@users.sourceforge.net>
+
+ * CVS repository: CVS repository master copied from cvs.stlport.com to SourceForge.
+ All history preserved!
+
+2005-08-27 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hashtable.h: Fix move feature integration for the hash_multimap
+ container.
+
+ * stlport/stl/_deque.h: Fix _Deque_base move constructor implementation.
+
+ * test/unit/mvctor_test.cpp: Change move constructor tests to use dynamically
+ allocated string rather than static ones.
+
+ * build/test/unit/nmake-vc6.mak: Increase compiler maximum heap size to allow
+ compilation with stldbg rules.
+
+ * build/test/unit/nmake-evc4.mak: Fix macro typo OPT_STLDBG_STATIC ->
+ OPT_STATIC_STLDBG
+
+ * build/Makefiles/gmake/gcc.mak: Filter out the newly added -fuse-cxa-atexit
+ compilation option for Cygwin and Mingw, the granted libc is not compatible
+ with it.
+
+2005-08-26 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/config/stl_solaris.h: C++ comments replaced by C ones,
+ this file may be included by C sources. Thanks Matti Rintala.
+
+2005-08-25 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_config.h, _epilog.h: Move of stlport namespace alias
+ definition from _epilog.h to _config.h to avoid redefinition as _epilog.h
+ is reentrant. This is a workaround for a HPUX aCC compiler bug reported
+ by Baker.
+
+2005-08-25 Petr Ovtchenkov <ptr@island...>
+
+ * build/Makefiles/gmake/gcc.mak: usage of -fuse-cxa-atexit strongly
+ required for correct order of static objects dtors calls. This is
+ used in deinitialization of locale-related objects. Thanks Matti Rintala.
+
+ * stlport/stl/_config.h: use different namespaces for mulithreaded
+ and non-multithreaded builds to avoid usage of non-multithreaded
+ application with multithreaded libstlport and vice versa;
+ [combination non-mt & mt lead to crash due to different instances
+ and sizes of allocators for non-mt and mt cases].
+
+2005-08-23 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_config_compat.h: Add check of _STLP_NO_OWN_IOSTREAMS
+ macro to make remove of its support more explicit thanks to a #error
+ directive.
+
+ * stlport/stl/_tree.h, _hashtable.h: Now reference and pointer types
+ are taken from the _Traits template parameter used to instanciate
+ the class. Doing so now set::reference and hash_set::reference are
+ const_reference which is coherent with respective iterators that are
+ immutable. Moreover it fixes a VC6 bug in reverse_iterator implementation
+ that was trying to transform a const reference to a simple reference
+ thanks Russell Miller report.
+
+ * test/unit/set_test.cpp: New test case for set reverse_iterator.
+
+2005-08-23 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/config/stl_gcc.h: seems HP-UX has no *f variants of math
+ functions [ceilf, fabsf, etc.]
+
+2005-08-21 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string.h, _rope.h: Removed __move_traits specialization
+ for string wstring crope and wrope. There is no reason to believe that
+ its move construtor will be complete as an STLport user has the right
+ to specialized the std::allocator<> with char or wchar_t.
+
+ * stlport/stl/_function_base.h, _alloc.h: Generalized use of the
+ __stlport_class struct rather than introducing a new helper type
+ (__stlport_less or __stlport_alloc) when we need to recognize STLport
+ implementation from a user one.
+
+2005-08-20 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_list.h, _slist.h: Fix move constructor implementation
+ thanks Henrik Goldman (www.x-formation.com) report.
+
+ * stlport/stl/_alloc.h: Fix type_traits specialization for allocator
+ type. Now specialization is only apply for the default STLport allocator
+ implementation and not for potential user specialization.
+
+ * stlport/stl/_deque.h, _hashtable.h, _string.h, _tree.h, _vector.h:
+ Simplification of the move framework application especially in the
+ definition of the containers __move_traits specialization. Many
+ _AsMoveSource call replaced by explicit call to the move constructor
+ when we are sure that there is one.
+
+ * test/unit/mvctor_test.cpp: Add many tests to check move contructor
+ implementations.
+
+ * stlport/stl/_function_base.h: Add type_traits specialization for the
+ less functor to help the move framework when dealing with associative
+ containers.
+
+ * test/unit/mvctor_test.cpp: Add a new test case checking correct move
+ semantic support for all STL containers.
+
+ * stlport/stl/_rope.h: Add move semantic support to the rope class.
+
+2005-08-19 Petr Ovtchenkov <ptr@island...>
+
+ * build/Makefiles/gmake/gcc.mak: fix extraction of gcc version.
+ Thanks Thomas Kho.
+
+2005-08-18 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_deque.c: Fix _M_erase range for movable types method
+ implementation, same bug as below in vector.
+
+ * test/unit/mvctor.cpp: Improve test case on vector to reveal bug
+ below and add same tests for deque which is the other container that
+ use the move contructor feature.
+
+2005-08-18 Petr Ovtchenkov <ptr@island...>
+
+ * INSTALL: add some words about multithread options and libraries.
+
+ * stlport/stl/_fstream.c: some code clean to reduce bogus compiler
+ warnings with -Wall.
+
+ * stlport/config/stl_gcc.h: seems HP-UX has no llabs and lldiv.
+
+2005-08-17 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_vector.h: Fix _M_erase range for movable types
+ implementation thanks Sergej Zagursky.
+
+ * build/Makefiles/nmake/vc8.mak: removed /RTC1 compiler option, the platform
+ SDK compiler do not support it. STLport users will just have to activate it
+ by themself if they want to.
+
+ * stlport/stl/_complex.h: Fix some floating point literals thanks
+ Ulrich Eckhardt report.
+
+ * stlport/stl/_time_facets.c: Complete integration of the '#' MS extension
+ in the date/time format string, reported thanks to the recent locale time_get
+ new test case.
+
+2005-08-14 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_msvc.h: Fix platform SDK compiler config, even latest
+ version that announce to be similar to .Net 2005 beta do not throw bad_alloc
+ from the new operator.
+
+ * stlport/cstdio, cstdlib: Replaced some _WIN64 checks by a
+ _STLP_USING_PLATFORM_SDK_COMPILER check.
+
+ * test/unit/cmath_test.cpp: Complete test filtering for Microsoft platform SDK
+ compiler.
+
+2005-08-14 Petr Ovtchenkov <ptr@island...>
+
+ * test/unit/locale_test.cpp: tests for time_get facet.
+
+ * stlport/stl/_time_facets.c: fix processing of %p format
+ [12:00 PM ~ 12:00, 12:00 AM ~ 00:00].
+
+ * src/time_facets.cpp: substitute expanded equivalent format strings
+ instead of %T, %R, %r.
+
+ * stlport/pthread.h: Fix C++ comment in a potentially C header. Thanks Ali
+
+2005-08-11 Francois Dumont <dums@stlport...>
+
+ * stlport/stl_user_config.h: Add _STLP_USING_PLATFORM_SDK_COMPILER so that
+ STLport user can signal they are using platform SDK compiler.
+
+ * stlport/config/stl_msvc.h: Add use of _STLP_USING_PLATFORM_SDK_COMPILER.
+
+ * test/unit/cmath_test.cpp, valarray_test.cpp: Removed tanh calls when using
+ AMD 64 platform SDK compiler, looks like they miss something...
+
+2005-08-09 Francois Dumont <dums@stlport...>
+
+ * src/fstream.cpp: Final fix of basic_filebuf::open method. Now when open
+ from a Win32 handle the file will be considered as in binary access with no
+ append action.
+
+2005-08-08 Francois Dumont <dums@stlport...>
+
+ * src/fstream.cpp: Fix annoying 64 warning and basic_filebuf::open method
+ from a low level file descriptor or from an HANDLE (not yet complete).
+ Thanks Yves Maliet report.
+
+2005-08-07 Francois Dumont <dums@stlport...>
+
+ * test/unit/inner_product.cpp: Fix 64 bits portability warning.
+
+ * test/unit/cmath_test.cpp: Removed modf tests for Windows 64 platform
+ as the SDK is missing the underlying modff implementation.
+
+ * stlport/cstdlib: Add a div function definition which is missing in the
+ Windows 64 SDK.
+
+ * stlport/cstdio: Add vsnprintf definition which is missing in Windows
+ 64 SDK.
+
+ * stlport/exception: Add flexibility for definition of vendor terminate
+ and uncaught_exception function namespace. Can now be defined independantly
+ of the unexpected_exception namespace.
+
+ * src/dll_main.cpp: Removed explicit turn off of optimization for Microsoft
+ compilers after .Net 2003. There were no comment to explain why optimizations
+ were turned off so I guess it was a compiler bug. .Net 2003 being a major
+ new version I hope this bug has vanish with this version.
+
+ * src/fstream.cpp: Removed static assertion for windows file handle to be 32
+ bits. Under Windows 64, even if the API is still 32 bits handles are still
+ defined as void*. We will see when code will run under a real Windows 64 platform
+ if it is a problem.
+
+ * stlport/config/stl_msvc.h: Add configuration for Windows 64 Platform SDK.
+ Expecially add automatic link to bufferoverflowU.lib to avoid modification
+ of STLport build system and STLport users projects.
+
+2005-08-06 Petr Ovtchenkov <ptr@island...>
+
+ * src/c_locale_glibc/c_locale_glibc2.c: add explicit type conversion
+ to avoid warnings on 64-bits platforms; thanks Thomas Kho and
+ Karol Szkudlarek for report.
+
+2005-08-05 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_valarray.h: Add missing _debug.h header inclusion for
+ _STLP_ASSERT macro definition.
+
+ * stlport/stl/debug/_hashtable.h: Fix typo in hashtable move constructor.
+ Thanks arabesc report.
+
+2005-08-05 Petr Ovtchenkov <ptr@island...>
+
+ * doc/FAQ: some words about cross-compilation.
+
+2005-08-04 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hashtable.c: Fix erase(range) implementation thanks
+ arabesc.
+
+ * test/unit/hash_test.cpp: Add new test for previous fix.
+
+2005-08-04 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/csetjmp: sometimes, if native setjmp.h was included first,
+ the setjmp functions situated in global namespace, not in vendor's
+ std. This may confuse following csetjmp.
+
+ * test/unit/setjmp_header_test2.cpp: test for this.
+
+ * build/test/unit/Makefile.inc: ditto.
+
+2005-08-03 Francois Dumont <dums@stlport...>
+
+ * INSTALL document updated to signal no longer support of the
+ 'wrapper' mode.
+
+2005-08-02 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl_user_config.h, stlport/stl/_site_config.h:
+ fix some obsolete comments.
+
+2005-07-31 Petr Ovtchenkov <ptr@island...>
+
+ * test/unit/math_aux.h, cmath_test.cpp: are_equals moved into
+ math_aux.h to reuse in other tests.
+
+ * test/unit/sstream_test.cpp: check input to float, inspired by
+ Jeff Williams.
+
+2005-07-27 Francois Dumont <dums@stlport...>
+
+ * stlport/iomanip, stl/_algo.h: Removed some persistent occurences
+ of __in and __out keywords reserved by Microsoft.
+
+ * stlport/stl/_pthread_alloc.c: Fix annoying warning reported by gcc.
+
+ * stlport/config/stl_msvc.h: Fix _STLP_VENDOR_UNEXPECTED_STD macro
+ definition to empty rather than '1'. Could have produce a compilation
+ error with compilers like Intel C++ used with the VC6 native Standard
+ library.
+
+ * stlport/queue, stl/_ctraits_fns.h, _hashtable.h, _numeric.h, _string.h
+ _tree.h: Fix macro guards used to avoid inclusion of _function.h or
+ _function_base.h or functional thanks Dinesh Monga report.
+
+2005-07-26 Petr Ovtchenkov <ptr@island...>
+
+ * doc/FAQ: description of pseudo-leaks, thanks Michael Fink.
+
+ * STLport (repository): STLport 5.0 RC4
+
+2005-07-25 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_evc.h: Move _DEBUG definition fix up before
+ stl_msvc.h inclusion to have correct library link automatically.
+ Thanks Michael Fink.
+
+2005-07-24 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string.c, _rope.c: Add instanciation of npos for all
+ compilers thanks Simon.
+
+ * test/unit/string_test.cpp: Add creation of a reference to string::npos
+ to force compiler to generate memory for it. Used to reveal a link error.
+
+ * test/unit/cppunit/cppunit_mini.h: Removed redondant semi column in
+ CPPUNIT_TEST_SUITE_REGISTRATION macro definition.
+
+ * stlport/config/stl_msvc.h, stl_intel.h: Concidering that compilers
+ emulating MSVC compilers use the same native Standard Library headers
+ macros _STLP_NEW_PLATFORM_SDK and _STLP_NO_VENDOR_STDLIB_L has been moved
+ outside the _STLP_MSVC scope. _STLP_GLOBAL_NEW_HANDLER is now defined
+ only for Intel compiler versions before 9.0.
+
+ * stlport/cstdlib, stl/_cmath.h: Because of the previous remark about
+ emulators of MSVC using MSVC headers, macro checks for global definition
+ of C math functions has been changed from _STLP_MSVC to _MSC_VER.
+
+2005-07-23 Michael Fink <vividos@users.sourceforge...>
+
+ * test/unit/locale_test.cpp: Added creating locale pointer in
+ test_supported_locale() when no exception handling is available.
+
+ * src/stlport.rc: Added version info defines when not available through
+ windows.h. Happens on evc3 MIPS and evc3 SH3.
+
+2005-07-23 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string_sum.h: Fix missing return statement in a compare
+ method.
+
+2005-07-22 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_algo.c: Fix search_n implementation for random access
+ iterator thanks Jim Xochellis
+
+ * test/unit/algo_test.cpp: Add test case for the previous bug thanks
+ Michael Fink.
+
+ * src/num_get_float.cpp: Fix gcc Mingwin and Cygwin special version with
+ building with -O2 option.
+
+ * build/Makefiles/gmake/gcc.mak: Add -D_REENTRANT definition for cygwin and
+ -mthreads for mingwin platform to make STLport thread safe like under the
+ other supported platforms.
+
+2005-06-30 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/wchar.h, src/c_locale.c, stlport/stl/_threads.h: fix Netware
+ wcs... functions.
+
+2005-06-30 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_rope.h, _rope.c: Duplicate basic_string::npos definition code
+ in rope implementation to use a "Standard" static const npos definition when
+ possible depending on the compiler features. Thanks caldwed report.
+
+2005-06-30 Michael Fink <vividos@users.sourceforge...>
+
+ * stlport/cstdlib, stdlib.h: Fixed issue with including stdlib.h after
+ setjmp.h; fix from 2005-06-23 wasn't solving the problem.
+
+2005-06-28 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hash_func.h: For MSVC .Net compiler we grant the hash<size_t>
+ specialization rather than the hash<unsigned int> one to avoid 64 bits
+ warnings when instanciating a hashed container with the size_t key.
+
+ * stlport/stl/_istream_iterator.h: Modify istream_iterator implementation
+ to avoid the default read from the istream even if the istream_iterator
+ instance is not used.
+
+ * test/unit/istmit_test.cpp: Add many tests for the copy_n/istream_iterator
+ combination. Those tests are no active for the moment as they are failing,
+ will be fixed after 5.0 release.
+
+ * build/test/unit/nmake-vc-common.mak: Tests are no more built with the
+ _STLP_NO_CUSTOM_IO option, see reason below.
+
+ * test/unit/fstream_test.cpp: Add custom_facet test to check that STLport
+ support instanciation of basic_fstream with something else that the std::char_traits
+ For the moment the test fail when we try to use the stream for I/O operations
+ should be fixed after 5.0 release.
+
+2005-06-27 Francois Dumont <dums@stlport...>
+
+ * src/locale_impl.cpp: Fix locale implementation to avoid to call facet
+ destructor when user explicitely required not to do so.
+
+ * stlport/stl/_fstream.c: Fix _M_setup_codecvt method implementation to avoid
+ a bad_cast exception on basic_filebuf construction. At this point the locale
+ used to instanciate it is the classic locale that might not have the necessary
+ codecvt facet. The user is then force to call imbue after basic_filebuf
+ construction otherwise I/O operations will fail. When imbue is invoked, if
+ the locale still do not have the necesary facet, the stream is put in the fail
+ state. Thanks Alexander Pototskiy
+
+2005-06-26 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_config_compat.h: Add _STLP_OWN_IOSTREAMS macro for backward
+ compatibility with library checking it.
+
+2005-06-23 Francois Dumont <dums@stlport...>
+
+ * src/complex.cpp, complex_trig.cpp, complex_exp.cpp: Removed code
+ duplication between float, double and long double version thanks to
+ some template functions. Thanks an Ulrich Eckhardt idear.
+
+ * stlport/cstdlib, stl/stdlib.h: Michael Fink patch to avoid setjmp.h
+ inclusion problem as stdlib.h contains a setjmp macro definition.
+
+ * test/eh/main.cpp: Redirection of std::cout and std::cerr for WinCE
+ thanks Michael Fink
+
+ * stlport/config/stl_evc.h: Restore long double support for WinCE, there
+ is just no *l math functions. Only define _STLP_NATIVE_INCLUDE_PATH
+ if not already defined, giving the user a chance to override the defaults
+ for yet unknown SDKs. Thanks Michael Fink and Ulrich Eckhardt.
+
+ * build/Makefiles/nmake/evc3.mak, evc4.mak: removed unneeded set of CC
+ for SHx; already done by setup batch. Thanks Michael Fink.
+
+2005-06-21 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_ios.h, _ios_base.h, _num_get.c, _num_put.c, _complex.c,
+ _istream.c, _time_facets.c: Fix cast expression for the cached facets,
+ C casts replaced by static_cast and const added when missing.
+ Thanks Oliver Stoeneberg report.
+
+ * test/unit/unary.h: Replaced old STLport with new style ones. Get sqrt
+ function in global namespace rather than forcing use of the one in std
+ namespace, avoids ambiguity with VC6.
+
+ * test/unit/resolve_name.cpp: Add _STLP_DO_IMPORT_CSTD_FUNCTIONS definition
+ at the top of it to force import of C symbols in std even for limited
+ compilers like VC6.
+
+ * stlport/stl/_valarray.h: Add global namespace scope to C function calls
+ to avoid VC6 ambiguity problem.
+
+2005-06-20 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_gcc.h: Fix gcc 3.4.4 detection under cygwin thanks
+ Ulrich Eckhardt report.
+
+ * stlport/stl/c_locale.h: Fix _Locale_mask_t definition for Mingwin.
+
+ * src/c_locale_win32/c_locale_win32.c: Add static assertion to check
+ _Locale_mask_t size.
+
+ * src/complex_exp.cpp: Replaced complex log10 function static variables
+ with global constant, avoid multithreaded init problem. Thanks Ulrich
+ Eckhardt report.
+
+2005-06-17 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_alloc.h: Add initialization of the memory buffer in
+ allocator::allocate function and reset in allocator::deallocate to
+ the _STLP_SHRED_BYTE motif when _STLP_DEBUG_UNINITIALIZED is defined
+ to help track missing initialization issue.
+
+ * src/dll_main.cpp: Removed now useless _Node_alloc_helper class.
+
+ * stlport/stl/_alloc.c: Add complete cleanup of the __node_alloc static
+ datas in the _S_chunk_dealloc method, this is important if the clean up
+ occur before STLport shared lib is unloaded.
+
+ * stlport/stl/_alloc.c: Add a static instance of __node_alloc_cleaner in the
+ _S_alloc_call method and change init number of allocation to 1 to force
+ release of memory pool only on shared library unload.
+
+2005-06-11 Francois Dumont <dums@stlport...>
+
+ * stlport/cstdlib, stl/_cmath.h: Add _STLP_NO_CSTD_FUNCTION_IMPORTS macro
+ check before import of global C functions in STLport namespace. Required
+ for VC6 compiler to avoid ambiguity issue.
+
+ * src/complex.cpp, complex_epx.cpp, complex_trig.cpp: Scope math function
+ call with the global namespace to avoid VC6 ambiguity issue. It is safe
+ for the other compilers as STLport do define those function in global
+ namespace.
+
+2005-06-10 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/c_locale.h: Fix Cygwin configuration, separate alpha mask
+ from lower and upper one to avoid all lower character to also be upper
+ and opposite.
+
+ * src/ctype.cpp: Add static assertion to detect platform where
+ alpha = lower | upper which is wrong for STLport use.
+
+2005-06-10 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hashtable.c: Fix max_load_factor management, Standard says
+ that load_factor <= max_load_factor and not <; the function detecting need
+ for rehash used to launch one even if the number of bucket do not change which
+ was counter performant. Fix the _M_insert_noresize method that was breaking
+ element order inserting elements in the middle of 2 equal elements.
+ Thanks Dieter Freismuth report.
+
+ * stlport/config/stl_gcc.h: Fix relative include path for latest gcc cygwin
+ package.
+
+2005-06-10 Petr Ovtchenkov <ptr@island...>
+
+ * build/Makefiles/gmake/mwccnlm.mak: fix compiler version collection.
+
+ * build/Makefiles/gmake/netware/extern.mak: fix useful paths.
+
+ * src/c_locale.c: put here wrappers for some wfuncs, due to bogus
+ system libs in Netware.
+
+ * stlport/cwchar: use STLport's wchar.h to take wchar_t/wint_t for
+ Netware.
+
+ * stlport/wchar.h: use correct C declaration of some wfuncs, thanks
+ again to ugly Netware libs.
+
+ * stlport/ciso646, stlport/iso646.h, stlport/wctype.h: headers absent
+ for Novell Netware.
+
+ * stlport/cwctype: Metrowerks define __MSL__, but we don't use MSL libs
+ if we have STLport for Netware.
+
+ * stlport/cstdlib: div function from Novell Netware clib and libc lead to
+ system crash.
+
+2005-06-08 Francois Dumont <dums@stlport...>
+
+ * build/test/unit: Removed references to the now useless CPPUNIT_MINI
+ macro.
+
+ * test/unit/type_traits_test.cpp: Add new test case for trivial destructor
+ detection.
+
+ * stlport/stl/_fstream.h: Add missing basic_fstream construction from a
+ Win32 file handle, was already done for basic_ifstream and basic_ofstream,
+ thanks Alex Cosealin report.
+
+2005-06-07 Francois Dumont <dums@stlport...>
+
+ * build/test/unit/Makefile.inc: Fix syntax error at last line.
+
+2005-06-06 Petr Ovtchenkov <ptr@island...>
+
+ * build/lib/configure: add config options for Metrowerks compiler for
+ Novell NetWare platform [references to root of MW headers/libs and to Novell's
+ SDK headers/libs].
+
+ * build/Makefiles/gmake/mwccnlm.mak: fixes for Metrowerk/NetWare.
+
+ * build/Makefiles/gmake/app/mwccnlm.mak: idem.
+
+ * build/Makefiles/gmake/netware/extern.mak: idem.
+
+ * build/lib/mwccnlm.mak: idem.
+
+ * build/test/unit/mwccnlm.mak: idem.
+
+2005-06-03 Francois Dumont <dums@stlport...>
+
+ * test/unit/locale_test.cpp: Remove the very platform dependent LColl
+ class that was listing supported locales. STLport already do so and
+ report it using a runtime_error exception when not supported. When
+ compiler do not support exception only the C locale is checked.
+
+ * build/Makefiles/nmake: Patches from Michael Fink to
+ - check platform before linking to crtrtti.lib
+ - check right configuration when using a nmake-evc?.mak file
+ - update STATUS file.
+
+2005-06-02 Francois Dumont <dums@stlport...>
+
+ * src/c_locale_win32/c_locale_win32.c: Add workaround for a Windows PSDK bug
+ concerning currency international symbol, the separation character is missing.
+
+ * src/locale_impl.h, locale_impl.cpp: Fix implementation to make classic locale
+ implementation a normal instance that is released when the counter reach 0, the
+ only difference is that no delete is performed on this instance. Idem for classic
+ locale implementation facets.
+
+ * stlport/cwctype: And _GLIBCPP_USE_WCHAR_T check when using GLibC as in this
+ case wide char functions are not imported in std and must be imported from the
+ global namespace.
+
+2005-06-01 Francois Dumont <dums@stlport...>
+
+ * src/locale_impl.h, locale_impl.cpp: Change classic locale initialization
+ implementation for limited compiler like MSVC6.
+
+2005-06-01 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/c_locale.h: check gcc on MacOS X. Patch by Zdenek Nemec
+
+ * build/Makefiles/nmake/evc3.mak, evc4.mak, targets.mak:
+ support SH3/SH4 platform. Patch by Michael Fink.
+
+ * build/Makefiles/nmake/app/evc3.mak, evc4.mak: ditto.
+
+ * build/Makefiles/nmake/lib/evc3.mak, evc4.mak: ditto.
+
+ * build/lib/configure.bat, src/stlport.rc: ditto.
+
+2005-05-30 Francois Dumont <dums@stlport...>
+
+ * src/locale_impl.h, locale_impl.cpp, stlport/stl/_locale.h: An other pass
+ throught the classic locale initialization. Now all needed static variables
+ are in _Locale_impl::make_classic_locale method. Removed useless _Stl_aligned_buffer
+ union use in this locale initialization. Removed now useless _Locale_impl::free_classic_locale
+ method.
+
+2005-05-30 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_windows.h: worry about Windows CE when check Interlocked
+ API for MIPS. Patch by Michael Fink.
+
+ * build/lib/configure.bat: remove the -p option by autodetecting platform.
+ Patch by Michael Fink.
+
+ * build/Makefiles/nmake/evc3.mak, evc4.mak: corrects the evc4 makefiles
+ to always use the /GF switch [string pooling]. Patch by Michael Fink.
+
+ * doc/README.evc3, doc/README.evc4: reflect changes above.
+ Patch by Michael Fink.
+
+ * stlport/errno.h, stlport/time.h: when building for evc, including
+ errno.h and time.h often outputs the message in the #pragma statement
+ that including this file won't include the native one, since there is no
+ native include file. Now the text is only output when not building the library
+ and when the file is included directly, not via another STLport header file.
+ [Patch by Michael Fink.]
+
+2005-05-29 Francois Dumont <dums@stlport...>
+
+ * test/unit/locale_test.cpp: Add opendir returned value when listing
+ installed locale under linux.
+
+ * build/Makefiles/gmake: Patch from Zdenek Nemec for Mac OS X support.
+
+2005-05-27 Francois Dumont <dums@stlport...>
+
+ * src/locale_impl.cpp: Add an initialization segment specification to make
+ global static variable ios_base::Init instance initialization prioritized
+ compare to STLport static global variable. iostreams like cout can be used
+ in global static variable initialization.
+
+2005-05-26 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/nmake/evc4.mak: Patch from Ulrich Eckhardt to use CC
+ environment variable defined by WCE*.bat script rather than redefining
+ it.
+
+ * src/locale.cpp, locale_impl.cpp, locale_catalog.cpp: New pass to move
+ static global variable in function to make initialization order clear.
+
+2005-05-25 Francois Dumont <dums@stlport...>
+
+ * stlport/ciso646: Creation of this missing C++ standard header STLport
+ wrapper.
+
+ * stlport/stl/_istream.h, _num_get.c, _algo.c, _monetary.c, _time_facets.h,
+ _time_facets.c: Replaced occurences of __in and __out reserved by Microsoft.
+
+2005-05-24 Francois Dumont <dums@stlport...>
+
+ * stlport/headers: Patch from Michael Fink to avoid inclusion of headers
+ not available under evc3.
+
+ * test/unit/*_header_test.cpp: Fix tests for no iostreams mode.
+
+ * src/locale_impl.cpp, locale_impl.cpp: Modify implementation to force
+ correct initialization order of static instances.
+
+ * stlport/strstream: Add _ioserr.h file to avoid inclusion in no iostreams
+ mode.
+
+2005-05-23 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_config.h: detect endianness for Intel's 64bit Pentium and
+ Itanium processors. Thanks Albrecht Fritzsche for contribution.
+
+2005-05-20 Francois Dumont <dums@stlport...>
+
+ * build/test/eh: Patch from Michael Fink to add EVC4 support for this test
+ suite.
+
+ * src/fstream.cpp: Use of Wlodek Szafran implementation for the _Filebuf_base::_M_read
+ method which is more performant than the previous one.
+
+ * test/unit/fstream_test.cpp: Add of a test for the special Win32 file format.
+
+ * test/unit: Add of many test to check Standard C/C++ headers independancy
+ and correct C header implementation.
+
+2005-05-18 Francois Dumont <dums@stlport...>
+
+ * src/fstream.cpp: Fix buffer overflow in _Filebuf_base::_M_read method
+ for the Win32 platform implementation thanks Wlodek Szafran report.
+
+ * src/c_locale_dummy/c_locale_dummy.c: Patch from Michael Fink for wrong C
+ prototype.
+
+2005-05-17 Petr Ovtchenkov <ptr@island...>
+
+ * test/unit/locale_test.cpp: some fixes in moneypunct test, related
+ to international currency format; some problems still remains, due to
+ unclear specifications---if international currency 3-chars abbreviation
+ used in suffix form, additional space will be appended
+ ['1 234.56 RUR ']. This is due to intl_fmp.curr_symbol() == "RUR ",
+ and the last is conform to OpenGroup spec.
+
+2005-05-16 Petr Ovtchenkov <ptr@island...>
+
+ * src/c_locale_stub.cpp: "stub" implemntation moved into
+ c_locale_dummy/c_locale_dummy.c, this file removed
+
+ * src/c_locale.c: include c_locale_dummy/c_locale_dummy.c, in case of
+ no real locale implementation.
+
+ * src/c_locale_dummy/c_locale_dummy.c: This is a "stub" implementation
+ of the "c_locale.h" interface, intended for operating systems where
+ we have not yet written a real implementation. A C++ library using
+ this stub implementation is still standard-conforming, since
+ the C++ standard does not require that any locales other
+ than "C" be supported.
+
+ * build/lib/Makefile.inc: src/c_locale_stub.cpp removed.
+
+ * src/facets_by_name.cpp: add comments in the _Init_monetary_formats.
+
+ * src/c_locale_glibc/c_locale_glibc2.c: annotate some monetary-related
+ functions.
+
+2005-05-14 Petr Ovtchenkov <ptr@island...>
+
+ * build/Makefiles/gmake/aCC.mak: HP's aCC compiler and HP-UX os support.
+ This isn't really checked and should be fixed on real system.
+
+ * build/Makefiles/gmake/app/aCC.mak, gmake/lib/aCC.mak: ditto.
+
+ * build/Makefiles/gmake/hp-ux/extern.mak, lib.mak: ditto.
+
+ * build/Makefiles/gmake/hp-ux/rules-install-so.mak, rules-so.mak: ditto.
+
+ * build/Makefiles/gmake/hp-ux/gmake/hp-ux/sys.mak: ditto.
+
+ * build/lib/aCC.mak: ditto.
+
+ * build/test/unit/aCC.mak: ditto.
+
+ * build/test/unit/gcc.mak: remove dbg-shared tag from default build;
+ if you need unit tests with debug info and without _STLP_DEBUG, make this
+ tag explicitly.
+
+2005-05-14 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_config.h, _config_compat_post.h, _cwchar.h, _epilog.h:
+ Patch from Albrecht Fritzsche to remove C++ comment from files accessible
+ by a pure C compiler.
+
+ * stlport/stl/c_locale.h: idem.
+
+ * src/c_locale.h, c_locale_glibc/c_locale_glibc2.h: idem.
+
+ * src/gcc_localeinfo.h, c_locale_win32/c_locale_win32.c: idem.
+
+ * build/Makefiles/gmake/gcc.mak: Add the -ansi option to the C compiler
+ command to know if any regression occur concerning use of C++ comment
+ in C files.
+
+2005-05-13 Francois Dumont <dums@stlport...>
+
+ * src/c_locale_win32/c_locale_win32.c: Improve the locale name recognition
+ system to be more unix compliant. Now you can pass locale name like
+ lang_country[.codepage] with lang being one of the ISO 639 values and
+ country one of the ISO 3166 ones.
+
+ * test/unit/locale_test.cpp: Add a test case for the ctype facet.
+
+ * test/unit/locale_test.cpp: Now list all the installed locales under
+ Win32 to test more locale than the simple french one.
+
+ * stlport/config/stl_msvc.h: Removed _WINDLL macro check when trying
+ to guess what type of library (dynamic/static) the STLport user want
+ to link with. _WINDLL is defined when generating a dll but it do not
+ imply anything on the user wish.
+
+ * src/ctype.cpp: Improve the ctype::scan_is method, you can now scan
+ for a character conforming to several ctype_base::mask and not only to one.
+
+ * src/ctype.cpp: Idem previous for ctype::scan_not which returns the first
+ character that do not conform to any of the passed mask.
+
+ * test/eh: Restore exception handling test suite. Removed some equality
+ tests that is no more valid for hash containers, this kind of test
+ is better in the unit tests. Add makefiles for MSVC compilers.
+
+ * stlport/stl/_tree.c: Fix _M_insert method that was leaking in case of
+ exception thrown by the comparison operator, reported by eh tests.
+
+2005-05-09 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_ctype.h, src/ctype.cpp: Reenforce data encapsulation of the
+ ctype<char> template specialization class. class static arrays
+ _S_upper, _S_lower, _S_classic_table removed from the definition and hiden
+ in the .cpp file.
+
+ * src/dll_main.cpp: Change _STLP_UNIX macro check in _STLP_PTHREADS check
+ as per thread allocator is only supported if the Posix pthread API is used,
+ thanks a Albrecht Fritzsche remarked.
+
+2005-05-07 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_gcc.h: Patch from John Smith for Mac OS X support.
+
+ * test/unit/locale_test.cpp: Idem previous.
+
+ * build/Makefiles/gmake/cygming/lib.mak, sys.mak: Import lib extension
+ change from .lib to .dll.a for Mingw like under Cygwin. ld linker
+ looks for .dll.a before .lib, avoid conflict with Cygwin lib.
+
+2005-05-07 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/errno.h: use C++ 'using' construction only for C++. Thanks Gary.
+
+ * build/Makefiles/gmake/lib/gcc.mak: option for libname for Darwin.
+
+ * build/Makefiles/gmake/app/mwccnlm.mak: build for Novell NetWare 5
+ with MetroWerks 7 and 8 compilers.
+
+ * build/Makefiles/gmake/lib/mwccnlm.mak: ditto
+
+ * build/lib/mwccnlm.mak: ditto
+
+ * build/Makefiles/gmake/mwccnlm.mak: ditto
+
+ * build/Makefiles/gmake/netware/extern.mak: ditto
+
+ * build/Makefiles/gmake/netware/lib.mak, sys.mak: ditto
+
+ * src/_stdio_file.h, num_get_float.cpp, num_put_float.cpp: ditto
+
+ * stlport/cstdio, cwchar, cwctype, stdio.h, wchar.h: ditto
+
+ * stlport/config/stl_mwerks.h: ditto
+
+ * stlport/stl/_config.h, _fstream.h, _hashtable.c, _sstream.c: ditto
+
+ * stlport/stl/_threads.h, c_locale.h, char_traits.h: ditto
+
+ * build/Makefiles/gmake/sysid.mak: treat mwccnlm as cross-compiler,
+ set correct TARGET_OS and OS-related macros.
+
+ * stlport/stl/_valarray.h: remove exhaustive this->.
+
+2005-05-04 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_msvc.h: Change configuration for MSVC .Net 2003 and
+ 2005 that seems to have a bug in the namespace management.
+
+ * stlport/stdlib.h: Add errno.h inclusion from this file for gcc mingw
+ as this compiler version do define errno macro in stdlib.h as MSVC do.
+
+2005-05-03 Francois Dumont <dums@stlport...>
+
+ * stlport/stl_user_config.h, stl/_site_config.h, config/stl_gcc.h, _prolog.h,
+ _epilog.h: Use strict Ansi C comments (/**/) for headers accessible thought
+ the STLport C headers.
+
+ * stlport/C headers: Cleaned from C++ style comments.
+
+2005-05-02 Francois Dumont <dums@stlport...>
+
+ * build/Makefiles/nmake/vc-common.mak: Restore of LDFLAGS_A_REL introduce
+ the 2004-10-30 and lost the 2005-04-16, it avoids warning due to use
+ of the whole program optimization with VC.Net 2003 and 2005.
+
+ * stlport/stl/_string_io.c: Modification of the basic_string i/o operators
+ in the way it deals with the size_type and streamsize difference; it is
+ equivalent with the former one but do not generate warning with gcc
+ (mingwin).
+
+ * stlport/stddef.h, stdlib.h, errno.h: Fix issue under MSVC compilers where
+ native stdlib.h and stddef.h are defining errno macro without including
+ errno.h forbiding STLport to do so. Now errno.h will report this problem with
+ an explicit #error.
+
+ * test/unit/test_errno.cpp: Improvement of the test to reveal the previous
+ issue.
+
+2005-05-02 Petr Ovtchenkov <ptr@island...>
+
+ * makesystem (repository): restore experimental support of MetroWerks
+ compiler for NetWare, with help of GNU make and Cygwin environment.
+
+2005-04-29 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_time_facets.c: gcc warnings reveal that we were missing some
+ ctype::widen method call to compare things like month or day names.
+ Also simplified implementation of the __match and __get_formatted_time that
+ do not really need all the template parameters passed to it.
+
+ * stlport/stl/_num_put.c: Add a cast to make call to the function min more
+ clear, it will perhaps help EVC++ builds correctly.
+
+ * src/strstream.cpp, stlport/stl/_sstream.c: Removed static assertion
+ replaced by modified implementation that takes into account the difference
+ between size_t and streamsize.
+
+2005-04-28 Francois Dumont <dums@stlport...>
+
+ * test/unit/limits_test.cpp: Improve integral types limit test for type
+ of unknown sign. In this case we check the min value of this integral type,
+ if 0 the type is unsigned. Moreover we check, except for the bool type,
+ the sign of -1 cast to the integral type, bool is a special type that
+ generate warning when built from -1 (MSVC).
+
+ * src/ctype.cpp: Creation of a small helper structure to check the validity
+ of a wchar_t value used as an index. This helper struct takes into account
+ the compiler representation of the wchar_t type, is it a sign type or not.
+ This helper avoids warning when wchar_t is unsigned.
+
+ * src/num_get.cpp: Removed unused _Initialize_get_digit function and
+ associated narrow_digits and narrow_xdigits arrays.
+
+2005-04-28 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_sstream.h, _num_put.c: __in replaced by __imode, __out
+ by __omode or __oi due to MS privatize __in and __out. Thanks Michael Fink.
+
+2005-04-27 Francois Dumont <dums@stlport...>
+
+ * src/fstream.cpp: Fix Win32-64 file stream implementation. _M_read and
+ _M_write can now correctly handle respectively read and write of really
+ big buffers ( > 2Go)
+
+ * using/iosfwd.h, stlport/strstream.h, stl/_rope.h, _rope.c, _complex.h: Removed
+ references to the _STLP_USE_NEW_IOSTREAMS macro, STLport only support "new"
+ iostreams.
+
+ * test/unit/max_test.cpp, min_test.cpp: Add tests to check that min and
+ max are not defined as macros.
+
+ * test/fstream_test.cpp: Add check in creation of test_file.txt
+ as following tests depends on its content.
+
+ * src/strstream.cpp, stdio_streambuf.cpp: Fix potential issue because of
+ the difference between streamsize and size_t of ptrdiff_t.
+ Add static assertion to clearly specify how streamsize must be to have
+ a correct behavior.
+
+ * stlport/stl/_num_put.c, _num_get.c, _fstream.c, _moneraty.c: ditto.
+
+ * src/ctype.cpp: Restore check on wchar_t positivity as according
+ 2005-02-22 Petr Ovtchenkov reports wchar_t can be signed.
+
+2005-04-26 Francois Dumont <dums@stlport...>
+
+ * src/num_get_float.cpp: Fix mingwin support for 64bits integer type
+ thanks Wlodek Szafran
+
+2005-04-25 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_time_facets.c: Fix __pos type in __match function and removed
+ unused __max_pos definition and initialisation.
+
+ * src/c_locale_win32/c_locale_win32.c: Add some cast to remove warnings.
+
+ * stlport/stl/_moneraty.c: Fix __witdh definition to use streamsize rather
+ than size_t to avoid warnings.
+
+2005-04-25 Petr Ovtchenkov <ptr@island...>
+
+ * build/test/gcc.mak: workaround for [bug?] gmake, that sometimes lose
+ increment of target-specific macro and, may be, under condition.
+ Thanks Jeff Williams.
+
+ * build/Makefiles/gmake/icc.mak: add icc 8.1 compiler-specific libs
+
+ * build/Makefiles/gmake/icc.mak: detect icc version; add includes
+ from compiler to include path
+
+ * test/unit/cppunit/test_main.cpp, cppunit_mini.h: add option -x, run all
+ except specified CLASS::TEST.
+
+2005-04-23 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_ioerr.h: #error message modification thanks Michael Fink.
+
+2005-04-22 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_istream.c: Fix _M_read_buffered function implementation,
+ there used to be a wrong implicit conversion from streamsize to ptrdiff_t,
+ which fail when sizeof(streamsize) > sizeof(ptrdiff_t).
+ See 2005-04-21 Petr report.
+
+ * test/unit/: Replaced all _STLP_NO_IOSTREAMS occurences with the STLport
+ internal equivalent _STLP_USE_NO_IOSTREAMS. The first one is defined
+ by the client while the second depends on the first and on the compiler
+ abilities, makes the unit tests more portable.
+
+ * stlport/stl/_cmath.h: Fix for Intel C++ compiler that also have all
+ C math functions in global namespace.
+
+2005-04-21 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hashtable.h: Extend the hashtable template methods extension
+ to the method computing the bucket from the key thanks Dominik Siatkowski.
+
+ * stlport/stl/_threads.h: Disable 64 bits portability warning for
+ MSVC compilers. MSVC do not see that the called function comes from
+ a macro that is different under Win32 and Win64.
+
+2005-04-21 Petr Ovtchenkov <ptr@island...>
+
+ * test/unit/sstream_test.cpp, fstream_test.cpp: integral type for
+ ptrdiff_t shorter than for streamsize; this cause problem on
+ Win32 platform, that support files larger than 4GB.
+ Thanks Timothy Tenebekov for report.
+
+2005-04-20 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/debug/_debug.c: Small Borland compiler fix to avoid call to
+ vsnprintf before version 0x550 thanks esanfo.
+
+ * src/dll_main.cpp: Fix bug reported by Intel C++ (icl) compiler.
+
+2005-04-20 Petr Ovtchenkov <ptr@island...>
+
+ * src/num_get_float.c: use uint64_t for 64-bit, but unsigned long long
+ for constants. This fix problem on linux x86_64 [amd64].
+
+2005-04-16 Francois Dumont <dums@stlport...>
+
+ * test/unit/cppunit/test_main.cpp: Patch from Michael Fink to improve
+ the macro filter for including windows.h (UNDER_CE rather than WIN32).
+
+ * build/test/unit/STATUS: Update from Michael Fink and myself.
+
+ * build/Makefiles/nmake: Apply Michael Fink patch to generate .pdb file
+ even in release mode and to install them in bin and lib folders next to
+ the .dll and .lib files.
+
+ * stlport/stl/_algobase.c: Add missing const in return type of the const
+ version of find specialized for const char*.
+
+2005-04-16 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_algobase.c: memchr return NULL if value not found,
+ while find() [specialization for char *] should return last
+ [see record 2005-02-27 below]. Thanks Joshua Berne for report.
+
+ * test/unit/find_test.cpp: if char not found, char specialization of
+ find() should return last, not NULL.
+
+2005-04-14 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_list.h, _slist.h: add this-> resolution to get_allocator
+ [required in the member templates to resolve possible ambiguity]
+
+2005-04-13 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_list.h, _slist.h: Add missing get_allocator() call when
+ building temporary list or slist instances in insert methods.
+
+2005-04-12 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/errno.h: solution 2005-04-12 not useful. Simplified schema,
+ semantically equivalent to Francois', but without extra function definition
+ [see records 2005-03-31 and 2005-04-01]
+
+2005-04-12 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/errno.h: check if we undefine previously defined errno
+
+2005-04-11 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/errno.h: save original errno definition
+
+2005-04-10 Petr Ovtchenkov <ptr@island...>
+
+ * STLport (repository): STLport 5.0 RC3
+
+2005-04-08 Francois Dumont <dums@stlport...>
+
+ * test/unit/locale_test.cpp: Add __FreeBSD__ macro check for the workaround
+ announced as Free BSD specific by the comment next to it.
+
+ * stlport/stl/_config.h: Add undef of _STLP_USE_DYNAMIC_LIB when in
+ NO_IOSTREAMS mode, this macro was generating buggy code in this case
+ for some commpilers (gcc mingwin).
+
+2005-04-07 Francois Dumont <dums@stlport...>
+
+ * build/lib/nmake-vc-common.mak: Removed useless add of STLport/lib to
+ library paths when building STLport lib.
+
+ * build/Makefiles/nmake/*: Removed useless specification of the MSVC default
+ install directory, all the job is done by the vcvcars32.bat script that sets
+ the LIB env variable to the real MSVC install directory.
+
+ * test/unit/unordered_test.cpp, locale_test.cpp: Removed gcc mingw warnings.
+
+ * build/Makefiles/nmake/icl.mak, app/icl.mak, lib/icl.mak: Removed the
+ whole program optimization option, looks like it is confusing icl.
+
+ * stlport/stl/debug/*.h: Removed useless _Get_base non-const overload.
+ In addition to being useless Intel compiler emit compilation error about it.
+
+2005-04-06 Petr Ovtchenkov <ptr@island...>
+
+ * test/unit/cppunit/test_main.cpp: windows.h required here
+ [see 2005-04-04; patch by Michael Fink].
+
+ * stlport/stl/_istream.h: __is replaced by __istr, due
+ to MS privatize __is.
+
+ * stlport/stl/_num_get.h: __in replaced by __ii, due to MS
+ privatize __in too.
+
+ * stlport/stl/_config.h: Visual C++ 8 uses _M_AMD64 to identify
+ EM64T and AMD64 platforms [thanks Mike Roberts].
+
+2005-04-05 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_evc.h: apply patch from Michael Fink to add support for
+ various EVC SDK.
+
+ * stlport/stl/_cmath.h: An other adaptation to the Intel C++ compiler.
+
+ * build/lib/nmake-vc-common.mak, test/unit/nmake-vc-common.mak: Removed check
+ of STLP_BUILD_FORCE_[STATIC,DYNAMIC]_RUNTIME environment variables,
+ moved in a common build system file.
+
+ * build/Makefiles/nmake/vc-common.mak: Add checks of
+ STLP_BUILD_FORCE_[STATIC,DYNAMIC]_RUNTIME variables.
+
+ * build/lib/configure.bat: Add a clean option to remove the hidden
+ Makefiles/config.mak file.
+
+ * stlport/stdexcept: Disable 'non dll-interface class used as base' warning
+ when building STLport dll linked with the static runtime.
+
+2005-04-04 Francois Dumont <dums@stlport...>
+
+ * test/unit/mfunptr_test.cpp: Add necessary macro checks for a test
+ that require partial template specialization compiler support.
+
+2005-04-04 Petr Ovtchenkov <ptr@island...>
+
+ * errno.h, time.h, test_errno.cpp: evc3 and evc4 has no errno.h
+ and time.h headers [patch by Michael Fink].
+
+ * stl_evc.h, _windows.h, test_main.cpp: workaround to not include
+ <windows.h> in STLport headers (it is still needed for building
+ the lib and the unit tests, but that should be no problem).
+ Occurences of GetCurrentProcess() used in _STLP_ABORT were replaced
+ with the result of the inline function, which returns a pseudo-
+ HANDLE value. [patch by Michael Fink]
+
+ * cwchar, wchar.h, stl/_cwchar.h: fix access to mbstate and wint_t
+ for FreeBSD.
+
+ * build/Makefiles/gmake/sysid.mak, app/gcc.mak, lib/gcc.mak:
+ FreeBSD before 5.3 require linkage with libc_r, while 5.3 and
+ later use libpthread.
+
+ * test/unit/locale_test.cpp: add std:: namespace qualifier for
+ gcc 3.3.2 and/or FreeBSD.
+
+ * libstlport, test/unit: library build and most tests pass for
+ FreeBSD 5.3 and FreeBSD 4.10.
+
+2005-04-02 Francois Dumont <dums@stlport...>
+
+ * stlport/cstdlib: Fix missing div taking long definition for VC71.
+
+2005-04-01 Francois Dumont <dums@stlport...>
+
+ * stlport/errno.h: Add comments to explain the file code.
+
+ * stlport/stl/_string_io.h: Yet an other fix to the i/o basic_string
+ operators that was not right under cygwin/mingwin.
+
+ * build/Makefiles/gmake/gcc.mak: Merge the 2 distinct cygmin blocks
+ in one and add -Wall and -Wsign-promo warnings.
+
+2005-04-01 Petr Ovtchenkov <ptr@island...>
+
+ * test/unit/test_errno.cpp: fix test, errno may be non-zero without
+ any error, but it reflect error code after some function fail.
+ This not the same.
+
+ * test/unit/mfunptr_test.cpp: add step-by-step test how compiler
+ recognize bind of member function for find_if. Not all compilers may
+ understand this. Thanks Markus for test idea.
+
+2005-03-31 Francois Dumont <dums@stlport...>
+
+ * stlport/errno.h: Fixed for MSVC compilers, should still be fine for
+ others.
+
+ * test/unit/test_errno.cpp: Modified to be a real unit test. Also test
+ errno assignment.
+
+2005-03-30 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_fstream.c: Try to fix ambiguous type deduction in a max
+ call under WinCE.
+
+ * stlport/stl/_cmath.h: Fix missing non Standard hypot function under
+ WinCE thanks Michael Fink.
+
+ * stlport/stl/_cmath.h: Attempt to fix the WinCE math function support
+ where neither *f nor *l functions are present even if the compiler
+ support the long double type.
+
+2005-03-30 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/assert.h, float.h, iso646.h, limits.h, errno.h:
+ added in accordance with Standard D.5 [compatibility with standard
+ C library] to prevent wrong std interpretation in ill-formed native
+ headers [definition of namespace std in C headers].
+
+ * test/unit/test_errno.cpp: check correct processing of errno.h
+ header.
+
+ * build/test/eh: build eh tests again.
+
+ * test/eh/LeakCheck.h, TestClass.cpp, TestClass.h: fix and clear.
+
+ * test/eh/test_hash_map.cpp, test_hash_set.cpp: hash_set/hash_map
+ has no == operator [no container equality]; this fix is quick-and-dirty
+
+2005-03-29 Petr Ovtchenkov <ptr@island...>
+
+ * build/Makefiles/gmake/app/rules.mak, freebsd/rules-so.mak,
+ linux/rules-so.mak, openbsd/rules-so.mak, sunos/rules-so.mak:
+ fix link sequence---the end objects should be really last, i.e. after libs.
+ This affected by linkage without libstdc++.
+
+ * stlport/stl/_cwchar.h, stlport/wchar.h: workarounds for FreeBSD.
+
+ * due to change in link sequence most tests [including exceptions] pass
+ for uClibc.
+
+ * stlport/mmemory.h: garbage, removed.
+
+ * stlport/export: ditto.
+
+2005-03-28 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_istream.h, _ostream.h: Fix assignment operators prototypes
+ for the sentry struct. Thanks -Weffc++ feature of gcc.
+
+ * build/Makefiles/gmake/cygmin/rules-install-so.mak: Add missing folder
+ creation in the install process thanks Charlemagne report.
+
+ * build/Makefiles/nmake/icl.mak: Fix Intel compiler build system under
+ Windows.
+
+2005-03-28 Petr Ovtchenkov <ptr@island...>
+
+ * src/num_put_float.cpp: in FreeBSD no *cvt* functions now, use sprintf;
+
+ * stlport/config/stl_gcc.h: in FreeBSD no math *l functions and llabs.
+
+ * test/unit/string_test.cpp: more test with assignment.
+
+2005-03-25 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stddef.h: fix typo in header id---this mistake prevent
+ inclusion _epilog.h.
+
+ * test/unit/epilog_test.cpp: regression test for bug above.
+
+ * stlport/cstdio: fix header id to avoid possible errors.
+
+2005-03-24 Petr Ovtchenkov <ptr@island...>
+
+ * build/Makefiles/gmake/lib/gcc.mak, build/Makefiles/gmake/app/gcc.mak:
+ code reorganization to simplify platform configuration with or without
+ -nostdlib [avoid link with libstdc++ or libestdc++]; now link without
+ libstdc++/libestdc++ supported on Linux and OpenBSD.
+
+ * build/Makefiles/gmake/openbsd/rules-so.mak: idem.
+
+ * build/Makefiles/gmake/freebsd/rules-so.mak: idem.
+
+ * src/num_put_float.cpp: clean float convertions for OpenBSD and FreeBSD;
+ OpenBSD and FreeBSD use STLport code instead of sprintf now.
+
+ * stlport/stl/_cwchar.h: allow masquarade to use mbstate_t from native
+ cwchar header on OpenBSD.
+
+ * stlport/config/slt_gcc.h: llabs and *l math functions absent in OpenBSD;
+ define __unix, that missed in OpenBSD.
+
+2005-03-23 Petr Ovtchenkov <ptr@island...>
+
+ * build/Makefiles/gmake/app/gcc.mak, build/Makefiles/gmake/lib/gcc.mak:
+ incorporate gcc language support library into libstlport.so
+ [add ~100k to library], but libsupc++ don't required more in link stage
+ for applications and libraries that use stlport, as in case with
+ libstdc++.
+
+2005-03-22 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string_io.c: Fix basic_string stream output operator
+ implementation for cygwin.
+
+ * stlport/stl/_cmath.h: Add fixes for cygwin support that handle long double
+ but do not have *l maths function per default.
+
+ * src/complex_exp.cpp: Fix call to logl, replaced by call to log.
+
+ * src/complex_trig.cpp: Fix mingw support by checking M_LN2l existence
+ before using it.
+
+ * test/unit/copy_test.cpp: Change test cases to avoid use of iostreams.
+
+ * test/unit/string_test.cpp: Add a small check to test use of istream width
+ in the input operator.
+
+ * stlport/cstdlib, stlport/config/stl_msvc.h, stl_gcc.h: Creation of the
+ _STLP_NO_VENDOR_STDLIB_L macro to report support of the llabs and lldiv
+ function.
+
+2005-03-21 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_cmath.h: removed logf, expf, sinf, cosf; option
+ -fno-builtin passed to gcc compiler solve the problem with uClibc;
+ this imply same option in building uClibc, as it is in normal uClibc build.
+ This is partial rollback of changes 2005-03-16.
+
+ * build/lib/configure, build/Makefiles/gmake/gcc.mak: add ability to pass
+ extra flags to C++ compiler
+
+2005-03-18 Francois Dumont <dums@stlport...>
+
+ * test/unit: Modified some test in order to check the _STLP_NO_IOSTREAMS
+ mode. This new mode of tests reveals the following bugs:
+
+ * stlport/stl/_rope.c: Add check of _STLP_USE_NO_IOSTREAMS macro before
+ include of iostream header.
+
+ * src/dll_main.cpp, stlport/stl/_string_fwd.h: Removed implementation
+ of __get_c_string, moved to _string.h header, once string has been defined,
+ as an inline function.
+
+2005-03-18 Petr Ovtchenkov <ptr@island...>
+
+ * src/complex_trig.cpp: avoid call log functions during static
+ initialization, if possible.
+
+2005-03-17 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string_io.h: Fix implementation that used to think that
+ size_t and streamsize was simply aliases. Thanks Jay Amin report.
+
+ * stlport/config/_prolog.h: Add comment about the reason of alignment
+ specification when using MSVC compilers. Fix alignment for Win64 platform.
+
+ * stlport/stl/_alloc.h: Fix _ALIGN enum definition for _Win64 platform.
+
+ * src/string_w.cpp: Fix wrong class export under debug mode thanks
+ Charlemagne report.
+
+ * build/Makefiles/nmake: Preparation of the build system for icl (Intel cl
+ compiler (mimic cl compiler from Microsoft).
+
+2005-03-16 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_cmath.h: added logf, expf, sinf, cosf---this fix
+ uClibc 0.9.27/gcc problem. Fix one macro for declaration math
+ functions in case of absent *f functions.
+
+2005-03-16 Francois Dumont <dums@stlport...>
+
+ * stlport/config/*: Clean native header include path macro definition.
+ Removed many useless definition simply recreating the default behavior.
+ Removed the unreferenced _STLP_NATIVE_OLD_STREAMS_INCLUDE_PATH macro.
+
+ * stlport/stl/_site_config.h: Update relative path headers macros
+ documentation to reflect more accurately default behavior and add
+ the unreference _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH macro.
+
+2005-03-15 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_fstream.h: Fix _Noconv_input helper class default implementation.
+ Returns traits::eof() rather than 0.
+
+2005-03-15 Petr Ovtchenkov <ptr@island...>
+
+ * src/complex.cpp, complex_exp.cpp, complex_io.cpp, complex_trig.cpp:
+ use achievements in _cmath.h---use overloaded funcs; mascarade from
+ complex_impl.h not required more.
+
+ * src/complex_impl.h: deleted.
+
+ * test/unit/cmath_test.cpp: check nested sqrt(sqrt)---possible problem with macro
+
+2005-03-14 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_msvc.h: _STLP_SAME_FUNCTION_NAME_RESOLUTION_BUG notion
+ removed, impossible to reproduce, maybe fixed by the #pragma intrinsic/function
+ directives.
+
+ * stlport/stl/_cmath.h, cstdlib: Fix .Net 2003 and .Net 2005 beta support.
+
+ * stlport/stl/_cmath.h: Removed _STLP_SAME_FUNCTION_NAME_RESOLUTION_BUG notion,
+ no more _STLP_DO_* macros.
+
+ * test/unit/valarray_test.cpp: New tests to check right compilation of
+ transcendentals valarray functions.
+
+ * stlport/stl/_valarray.h: Replaced all the _STLP_DO_* macros by real
+ function calls.
+
+ * src/fstream.cpp: Add INVALID_SET_FILE_POINTER definition when missing for
+ Win32 IO implementation thanks Michael Fink report. Add compilation check
+ of right STLport file descriptor definition.
+
+2005-03-12 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_tree.h: Fix equal_range_unique bug thanks Gunter.
+
+ * test/unit/map_test.cpp: Add of the test to reproduce the bug
+ above.
+
+2005-03-11 Petr Ovtchenkov <ptr@island...>
+
+ * build/test/unit/gcc.mak: don't write runtime path to libstlport
+ in case of crosscompilation.
+
+ * stlport/stl/_cmath.h: exclude *f and *l variants of math functions
+ if ones absent in system; add missed hypot function; few workarounds
+ for uClibc and for VC.
+
+ * src/complex.cpp, complex_exp.cpp, complex_trig.cpp: workaround
+ for systems without *f and *l variants of math functions.
+
+ * test/unit/resolve_name.cpp: exclude test line that confuse VC.
+
+ * stlport/cstdlib: div isn't intrinsic for VC.
+
+ * stlport/config/stl_gcc.h: don't use *f and *l math functions in
+ case of uClibc.
+
+2005-03-09 Petr Ovtchenkov <ptr@island...>
+
+ * doc/FAQ: FAQ was established.
+
+2005-03-07 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_bitset.h, _bitset.c: Avoid include of istream when
+ NO_IOSTREAMS mode thanks Bruno report.
+
+ * stlport/stl/char_traits.h: Modification of the streamoff and streamsize
+ definition to take into account the 64 bits file access support.
+
+ * test/unit/fstream.cpp: New test for big files ( > 2Go) unactivated by
+ default.
+
+2005-03-06 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/cstdlib, stlport/cmath, stlport/stl/_cmath.h: define
+ overloaded functions in the scope of global namespace and then import
+ all in stlp_std with 'using' directive. This is better than
+ solution from 2005-03-04 below.
+
+ * stlport/cmath: include cstdlib, due to declarations of abs
+ with integer types required in overload and when 'using'.
+
+ * src/complex.cpp, src/complex_exp.cpp, src/complex_trig.cpp: replace
+ macros that possibly will be removed.
+
+2005-03-05 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_construct.h: Simplification of the _Copy_Construct
+ function, now only takes a single template parameter and only call
+ the strict copy constructor. Creation of the _Param_Construct function
+ that replace the former _Copy_Construct implementation.
+
+ * cstdlib: Fix abs definition for MSVC compilers.
+
+ * test/unit: Fixing 64 bits warnings in many tests.
+
+ * src/c_locale_win32/c_locale_win32.c: Fixing 64 bits warnings.
+
+ * src/fstream.cpp: Creation of the INVALID_STLP_FD constant to represent
+ a portable invalid file descriptor.
+
+ * stlport/stl/_streambuf.c: Explicit instanciation of basic_streambuf
+ for wchar_t removed, already exists in _streambuf.h thanks
+ Charlemagne report.
+
+ * stlport/stl/char_traits.h: Setup modification, Windows platform now
+ use ptrdiff_t to define streamoff, make the code more portable.
+
+2005-03-04 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_cmath.h: removed recursive include of cmath header
+
+ * src/complex_impl.h: include cmath instead of stl/_cmath.h
+
+ * stlport/stl/_complex.h: idem.
+
+ * stlport/stl/_valarray.h: idem.
+
+ * test/unit/unary.h: workaround for namespace resolution.
+
+ * test/unit/resolve_name.cpp: test to show problem with namespace resolution.
+
+ * stlport/cmath, stlport/stl/_cmath.h: standard require overloaded math
+ functions for double and float arguments. Import with 'using' directive
+ can't provide such overload. Removed import with 'using', used direct
+ inline wrappers in namespace stlp_std instead. Cleaning code.
+
+ * stlport/cstdlib: complement to cmath---the same as above for abs.
+
+ * stlport/stl/_config.h: uClibc declare pthread_spin... but ones absent
+ in the library indeed.
+
+2005-03-02 Petr Ovtchenkov <ptr@island...>
+
+ * build/Makefiles/top.mak: move .PHONY target to the bottom, it work here
+ as expected
+
+ * build/Makefiles/gmake/depend.mak, targetdirs.mak: reduce amount of dummy
+ targets; fix creation of directories for install.
+
+ * build/Makefiles/gmake/linux/rules-install-so.mak: ditto.
+
+ * stlport/stl/_config.h, stlport/config/stl_gcc.h: support of gcc/linux/uClibc
+
+ * src/_stdio_file.h, num_put_float.cpp, stdio_streambuf.cpp: uClibc support
+
+ * stlport/cwchar: ditto.
+
+2005-03-01 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_threads.h, _windows.h, _rope.c: Fix of a 64 bits portage issue
+ in the rope implementation under Win64 thanks Patrick Bergeron report.
+
+2005-02-28 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hashtable.c: hashtable::erase fix thanks Patrick Bergeron.
+
+2005-02-27 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_algobase.h, _algobase.c: Fix find algo overload for
+ char* and const char*. Now the overload is on the __find underlying
+ function.
+
+ * test/unit/alg_test.cpp: Add a test case for the search_n algo.
+
+ * stlport/stl/_algo.c: Integration of the search_n algo implementation
+ for the random access iterator from Jim Xochellis.
+
+2005-02-25 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_slist.h: Fix _M_splice_after method.
+
+ * stlport/stl/debug/_slist.h: Add of many missing checks for the special
+ slist before_begin iterator which returns true to the _Dereferenceable
+ function call but is not dereferenceable in reality. Passing this
+ iterator to method like erase or insert was invalid but was not detected
+ by the _Dereferenceable function.
+
+ * test/unit/slist_test.cpp: Add checks for insert, insert_after, splice
+ splice_after methods.
+
+ * Patch from Ulrich Eckhardt:
+ - Fix macro _MSC_VER macro checks, VC6 should be found using _MSC_VER < 1300
+ check rather than _MSC_VER == 1200 to take into account compilers like
+ EVC4 that is a VC6 based compiler with _MSC_VER == 1202.
+
+2005-02-25 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_algobase.h: wrong parameters order in call to memchr,
+ thanks Patrick Bergeron.
+
+2005-02-24 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/char_traits.h: Patch from Ulrich Eckhardt fixing a wrong
+ _STLP_CALL specification on member operators and some cosmetic changes.
+
+2005-02-22 Petr Ovtchenkov <ptr@island...>
+
+ * test/unit/limits_test.cpp: wchar_t is treated as signed, except when it
+ equiv to unsigned short on Wins systems.
+
+ * Repository: STLport 5.0 RC2
+
+2005-02-20 Francois Dumont <dums@stlport...>
+
+ * Add many private definition of copy constructor and assignment operators
+ to avoid very anoying warnings under some compilers (MSVC 7.0 7.1).
+
+ * build/Makefiles/gmake/cygmin/sys.mak, test/unit/string_test.cpp:
+ Mingw fixes thanks Shura Zam.
+
+2005-02-19 Francois Dumont <dums@stlport...>
+
+ * stlport/stdexcept: Removal of a MSVC 7.0 and 7.1 workaround. Those compilers
+ have a bug resulting in the generation of very long compiler message as
+ soon as a simple compiler warning or error occur. Those messages are
+ template instanciation context of previous disabled warning. Warning message
+ are correctly disable but template instanciation context is kept until
+ an enable warning or an error happen. There is nothing to do against that
+ at STLport level except fixing or disabling warnings for unit tests build.
+
+ * build/Makefiles/nmake/vc70.mak: Add missing file.
+
+2005-02-18 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hashtable.h, _unordered_set.h, _unordered_map.h: Code review
+ based on the 12 April 2004 Technical Report document. Add missing hash policy
+ and bucket_size methods. Fix of the rehash method behavior. erase method
+ bug fix.
+
+2005-02-14 Francois Dumont <dums@stlport...>
+
+ * stlport/string, /stl/_string.h: Modification of the include schema.
+ _string_io.h no more included from _string.h to avoid circular headers
+ dependencies as basic_string class is used in iostream implementation.
+ This headers is now included from the Standard string header. Useless
+ cctype include removed from _string.h. _string_hash.h also moved from
+ _string.h to string for consistency.
+
+ * stlport/stl/_complex.c: Add of the _string_io.h header include that
+ was missing after string include schema modification.
+
+ * stlport/stl/_string_base.h, _string.h: basic_string move traits STLport
+ struct definition do not depends anymore on the _String_base struct to
+ make definition more clear.
+
+2005-02-08 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_config.h: Fix endianness for AMD 64 thanks Karol
+ Szkudlarek.
+
+2005-02-07 Boris Fomitchev <boris@stlport...>
+
+ * stlport/stl/_config_compat_post.h, stlport/stl/_relops_hash_cont.h
+ stlport/stl/_list.h, stlport/stl/_slist.h, stlport/stl/_map.h,
+ stlport/stl/_set.h: 4.6 compatibility fix
+
+2005-02-04 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_alloc.c: Fix of the _S_refill method in the lock free
+ implementation thanks Felix Wyss.
+
+ * stlport/stl/_hashtable.h: _M_get_elem_ite set as static when possible
+ to fix a MSVC6 problem thanks Michael Fink report.
+
+ * stlport/new, config/stl_evc.h: EVC patch for MFC support from Michael Fink.
+
+ * build/Makefiles/nmake/evc3.mak, evc4.mak: Warning level raised to 4
+ by Michael Fink.
+
+ * doc/README.evc3, README.evc4 doc update from Michael Fink.
+
+ * src/vc_warning_disable.h: Add warning 4201 and 4214 disabling for EVC.
+
+2005-01-31 Francois Dumont <dums@stlport...>
+
+ * Mac OS X portage thanks Zdenek Nemec.
+
+ * stlport/stl/_hashtable.c: Fix of the _M_copy_from method thanks Jay.
+
+ * stlport/stl/_vector.c: Fix of the _M_insert_fill_aux method thanks
+ Mike Roberts report.
+
+ * test/unit/unordered_test.cpp: Add of a test for the hashtable fix above.
+
+ * src/vc_warning_disable.h: Add of the missing 4503 warning disable for MSVC6.
+
+ * test/unit/nmake-vc-common.mak: Add of the _STLP_DEBUG_UNINITIALIZED macro
+ definition for the debug and stldebug rules.
+
+2005-01-28 Francois Dumont <dums@stlport...>
+
+ * Application of a patch from Michael Fink for EVC MIPS.
+
+2005-01-27 Francois Dumont <dums@stlport...>
+
+ * stlport/deque, list, map, set, slist, stack, valarray: _STLP_WHOLE_VENDOR_STD
+ replaced by the official _STLP_IMPORT_VENDOR_STD macro.
+
+ * stlport/stl/_algobase.h: Add find algo overload for char* and const char*
+ forwarding the call to the memchr C function thanks Jim Xochellis report.
+
+ * test/unit/find_test.cpp: Add check for the new find overload.
+
+ * test/unit/cmath_test.cpp: Fix of the atan and atan2 tests to avoid precision
+ problems.
+
+ * test/unit/ptrspec_test.cpp: Add check for containers of function pointers and
+ member function pointers.
+
+ * test/unit/set_test.cpp: Add check for equal_range method when the search value
+ is not in the set.
+
+ * stlport/stl/_tree.h: Fix equal_range implementation thanks Grisha Spivak report.
+
+ * stlport/stl/_vector.h, _vector.c: Fix of the movable types implementation thanks
+ Mike Roberts report.
+
+ * test/unit/mvctor_test.cpp: Add of a test case for vector class.
+
+2005-01-25 Francois Dumont <dums@stlport...>
+
+ * stlport/stl_user_config.h: Pointer specialization feature is now off
+ by default as it do not handle pointer to function and pointer to member
+ methods correctly yet. Feature documentation has been updated to report
+ this limitation.
+
+ * src/ctype.h: removal of the '>= 0' check for wchar_t variables reported
+ as a always true condition by gcc.
+
+ * stlport/stl/_hashtable.c: Removal of an unused variable in hashtable::resize
+ method thanks Jeff Grills report.
+
+ * stlport/stl/_algo.c: Fix of the search_n algo thanks Jim Xochellis report.
+
+2005-01-24 Francois Dumont <dums@stlport...>
+
+ * Some more warning fixes. Mostly add of missing char_traits::to_char_type calls.
+
+2005-01-22 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string_workaround.h, debug/_string_workaround.h: Fix of the
+ call broadcast to the base class. Non debug workaround always call non debug
+ base class methods, debug workaround always calls debug base class methods.
+
+ * Many fixes to avoid warnings using MSVC in level 4 warnings:
+ - while (true) replaced by for(;;) which do not produce the conditional
+ expression is constant warning
+ - removal of unused parameters
+ - modification of some template function signature to keep the character type
+ information and avoid the wchar_t to char type warning which was surely an
+ important warning for the wide streams support.
+
+ * stlport/stl/_monetary.c: removal of the call to the ctype::widen method
+ on the result of the moneypunct<_CharT, false>::decimal_point call as this
+ method is already supposed to return a wide character.
+
+2005-01-19 Francois Dumont <dums@stlport...>
+
+ * src/msvc_warning_disablers.h: unused file, removed.
+
+ * test/unit/logic_test.cpp: Fix of the tests to avoid warning regarding int
+ to bool cast.
+
+ * stlport/stl/pointers/_deque.h, _list.h: Fix of the exported class under MSVC
+ compiler thanks Timothy Tenebekov report.
+
+ * build/test/unit/nmake-vc-common.mak, nmake-vc6.mak, nmake-vc70.mak: Modification
+ of the make files to avoid useless inclusion of vc_warning_disable.h file for
+ MSVC.Net 2003 and MSVC 8 compilers.
+
+ * src/locale_impl.h: Export of the locale facets container for MSVC compilers.
+
+ * src/vc_warning_disable.h: Modification to limit the number of disables depending
+ on the compiler.
+
+2005-01-18 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_algo.c: Modification of the stable_partition implementation
+ to limit the size of the allocated temporary buffer of the begin and end
+ of the range are already at the right place thanks a Stephen Howe idear.
+
+ * build/test/unit/nmake-vc-common.mak, nmake-evc-common.mak: Removal of the
+ _STLP_USE_AUTO_LINK macro which is now the default.
+
+2005-01-14 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_windows.h, char_traits.h, src/c_locale_win32/c_locale_win32.c:
+ Patch from Patrick Bergeron to support 64 bits compilation under Windows using
+ VC8.
+
+ * stlport/stl/boost_type_traits.h: boost support check and fixing.
+
+2005-01-13 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_algobase.h: Improvment of the iter_swap algo to use the swap
+ method when possible thanks David Abrahams and Aleksey Gurtovoy great book
+ introduction.
+
+ * stlport/stl/_alloc.h: Deactivation of the lock free allocator implementation
+ not mature enough to be release yet.
+
+ * stlport/stl/_uninitialized.h: Fix of non Standard algo signature:
+ - uninitialized_fill_n
+
+ * stlport/stl/_iterator_base.h: Fix of non Standard algo signature:
+ - distance
+
+ * stlport/stl/_algobase.h: Fix of non Standard algo signature:
+ - fill_n
+
+ * stlport/stl/_algo.h: Fix of non Standard algo signature:
+ - rotate
+ - generate_n
+
+ * stlport/stl/_string.h, debug/_string.h: Fix of the non Standard basic_string
+ default constructor.
+
+ * stlport/stl/_algobase.h, _function.h, _iterator_base.h, _move_construct_fwk.h,
+ _ptr_specialize.h, char_traits.h, debug/_debug.h: Fix of the macro name check
+ before including type_traits.h.
+
+2005-01-08 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_codecvt.h: Add of a missing export declaration for the wchar_t
+ specialization of the codecvt_byname class.
+
+ * src/stlport.rc: improvement of the information included in the ressource file.
+ Especially add of the compiler options.
+
+ * stlport/stl/_stlport_version.h: Creation of a special file containing all the
+ version informations; very useful to avoid problem with the ressource compiler.
+
+ * stlport/stl/_config.h: Removal of the unused _STLP_USING_VENDOR_STD macro.
+ Inclusion of the _stlport_version.h file. Update of the comment explaining why
+ _STLP_USE_DECLSPEC is undefined when user do not use iostreams.
+
+ * build/Makefiles/nmake/vc-common.mak, evc-common.mak, gmake/gcc.mak: Improvement
+ of the ressource compiler options.
+
+2005-01-06 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_msvc.h: Move the _STLP_DONT_RETURN_VOID configuration
+ macro to the specific MSVC6 compiler as it is the only one that has ever
+ reveal this bug.
+
+2005-01-05 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string_sum_methods.h: Fixes reported by gcc.
+
+2005-01-04 Francois Dumont <dums@stlport...>
+
+ * doc/README.evc3: patched by Michael Fink
+
+ * build/lib/configure.bat: warning fix thanks Michael Fink.
+
+ * build/test/unit/nmake-src-prefix.mak: fixed thanks Michael Fink.
+
+2005-01-02 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string_sum.h, _string_operators.h: Fix of an assignment bug
+ in the append method taking a C string wrapper. Modification of the __bstr_sum
+ get_allocator method to avoid a useless allocation.
+
+ * build/lib/nmake-src-prefix.mak: Add of missing rules for .c and .rc file type.
+
+2004-12-29 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hashtable.c: Fix missing allocator argument in new slist
+ construction and bad number of buckets thanks See Wong report.
+
+ * test/unit/unordered_test.cpp: Add of a test to report the previous
+ problem.
+
+ * build/Makefiles/nmake/vc-common.mak, evc-common.mak: Generalization of the
+ /DMACRO compiler command rather than /D "MACRO".
+
+ * test/unit/string_test.cpp: Creation of a new test case for string template
+ expression.
+
+ * stlport/stl/_string_sum.h, _string_sum_methods.h: Fixing of many bugs in the
+ string template expressions implementation.
+
+ * stlport/stl/_tree.c: Add of a comment in the _M_increment method explaining
+ a surprising checks thanks Ulrich Eckhardt.
+
+2004-12-24 Petr Ovtchenkov <ptr@island...>
+
+ * build/Makefiles: makesystem moved here from src/Makefiles
+
+ * build/lib: makefiles moved here from src catalog.
+
+ * build/test/unit: makefiles moved here from test/unit catalog.
+
+ * INSTALL: updated.
+
+ * README: updated.
+
+2004-12-23 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_vector.h, _vector.c: Fix of the code for movable types
+ in call to push_back or insert of a value in case of auto referencing
+ thanks Benjamin Redelings.
+
+ * stlport/stl/_hashtable.c: Fix of the _M_copy method thanks Timothy
+ Tenebekov.
+
+2004-12-22 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/debug/_string.h: Fix of missing scopes thanks arabesc and
+ Benjamin Redelings
+
+ *stlport/config/stl_gcc.h: include schema fix for gcc >= 4.0.0 thanks
+ Oliver Stoeneberg
+
+2004-12-21 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hashtable.c: Fix copy method thanks KL report.
+
+ * stlport/stl/_vector.h, _deque.h: Fix implementation for vector of
+ movable objects when calling erase of a null range thanks to arabesc report.
+
+ * stlport/stl/_string.h, _string_workaround.h, debug/_string.h,
+ debug/_string_workaround.h: Implementation of the MSVC6 template method bug
+ workaround exclusively for MSVC6 and not anymore for all compilers.
+
+2004-12-21 Petr Ovtchenkov <ptr@island...>
+
+ * src: untested (lost support) .mak and installation files moved into
+ initial_mak catalog.
+
+ * explore, src: explore catalog moved into src catalog. Makefiles from
+ explore catalog become main makesystem of STLport.
+
+2004-12-20 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_hashtable.h: Fix of the const begin and end methods of the
+ new implementation thanks Timothy Tenebekov report.
+
+2004-12-17 Francois Dumont <dums@stlport...>
+
+ * stlport/cmath, cstdlib, stl/_cmath.h, config/stl_msvc.h: Configuration
+ fixes for .Net 2002.
+
+2004-12-17 Boris Fomitchev <boris@stlport...>
+
+ * char_traits.h: fixed _STLP_NO_WCHAR_T case
+
+ * src/common_macros.mak: deleted locale.cpp
+
+2004-12-17 Francois Dumont <dums@stlport...>
+
+ * src/explore/Makefiles/nmake/app/rules-install-a.mak, rules-install-so.mak
+ lib/rules-install-so.mak: Creation of the install-shared and install-static
+ from Michael Fink.
+
+2004-12-16 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/debug/_debug.h, _debug.c: Creation of functions to change iterators
+ list owner.
+
+ * stlport/stl/debug/_list.h, _slist.h: Modification of the iterator owners in the
+ splice, splice_after and merge method which do not invalidate iterators but only
+ move them from a [s]list to an other.
+
+ * stlport/stl/_relops_hash_cont.h: removal of the == operator on hashed containers
+ This operator is just impossible, or at least very complicated, to implement
+ for this container which do not require any ordering operation on the type used
+ to instanciate the container.
+
+ * test/unit/hash_test.cpp: Addition of a commented test showing why the == operator
+ is invalid on hashed constainers.
+
+ * stlport/stl/_hashtable.h: Modification of the hashtable implementation based
+ on a slist and a vector. Compared to the previous one the advantages are:
+ - lighter hashtable::iterator
+ - iterator increment operation do no require call to the hash function.
+ - no more special implementation for the debug mode, once validated debug/_hashtable.h
+ will be removed.
+ The drawback is a small overhead on the insert/erase methods.
+
+ * stlport/unordered_set, unordered_map: Introduction of the almost Standard hash containers.
+ The major difference with hash_set or hash_map containers from SGI is the load factor
+ that gives the user the ability to change the container ratio of the number of elements per
+ bucket.
+
+2004-12-13 Francois Dumont <dums@stlport...>
+
+ * stlport/stdio.h: patch from Michael Fink to avoid warning on the EVC platform.
+
+ * doc/evc_workaround.txt: Documentation file from Ulrich Eckhardt about the EVC
+ workaround to avoid annoying warnings.
+
+ * stlport/typeinfo: Patch from Ulrich Eckhardt to fix missing type_info struct
+ under MSVC6 and EVC and also identation.
+
+2004-12-10 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_collate.h, _locale.h: fix of the __locale_do_operator_call internal
+ function to make traits and allocator also template parameters.
+
+ * stlport/stl/_locale.h, _collate.h, stlport/config/stl_msvc.h, src/locale.cpp,
+ src/locale_impl.h: restoration of the MSVC6 workaround for the locale class to
+ correctly handle the member template methods.
+
+2004-12-09 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_messages_facets.h: fixed messages_base::catalog from long typedef
+ to int thanks Ulrich Eckhardt report.
+
+ * stlport/stl_user_config.h, config/stl_msvc.h: addition of the _STLP_VERBOSE_AUTO_LINK
+ config macro to make the automatic linking feature more verbose thanks Ulrich Eckhardt
+ patch.
+
+ * stlport/exception: Add check of the _STLP_HAS_SPECIFIC_PROLOG_EPILOG macro before
+ including _msvc_warning_off.h to avoid bad resulting warning status when the _epilog.h
+ header is not included thanks Gail (baker88) report.
+
+ * stlport/cassert, cerrno, csignal, ctype.h, cwctype, stdarg.h, stdlib.h, string.h,
+ config/stl_evc.h: Patch from Michael Fink to fix compilation problem using ressource
+ compiler for evc3 and evc4 and problems with cerrno and cassert inclusions reported
+ by Ulrich Eckhardt.
+
+2004-12-01 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stdexcept: removes some warnings regarding the exception class being derived
+ from a non-dll interface class on evc4. Michael Fink contribution.
+
+ * stlport/stl/_cmath.h: push/pop warning level for VCs. Michael Fink contribution.
+
+ * src/_stdio_file.h: Evc4 uses an ugly hack to implement file IO using a FILECE structure
+ representing the internal FILE structure. For evc3 Michael Fink implemented a much simpler
+ way that also works for evc4.
+
+ * stlport/config/stl_evc.h, stl_msvc.h, stlcomp.h: separate config stuff for stl_evc.h
+ and stl_msvc.h. Now all Windows CE specific defines are in stl_evc.h only.
+ Michael Fink contribution.
+
+ * stlport/stl/_codecvt.h, _ctype.h, _messages_facets.h, _monetary.h: add friend class
+ _Locale_impl.
+
+ * stlport/stl/_num_get.h, _num_put.h, _numpunct.h, _time_facets.h: ditto.
+
+2004-11-30 Petr Ovtchenkov <ptr@island...>
+
+ * src/explore/configure.bat: added quotes. Thanks Ulrich Eckhardt and Michael Fink.
+
+ * stlport/stl/_locale.h, src/locale_impl.h, src/locale_impl.cpp: added _STLP_DECLSPEC
+ and _STLP_CALL for some functions. Thanks Ulrich Eckhardt.
+
+ * stlport/stl/_collate.h, _numpunct.h, _monetary.h, _codecvt.h, _time_facets.h:
+ _Locale_imp made friend without relation to _STLP_LEAKS_PEDANTIC. Thanks Ulrich Eckhardt.
+
+ * stlport/stl/_locale.h: remove body of protected constructor to avoid warnings.
+ Thanks Kidman and Ulrich Eckhardt.
+
+ * src/locale_impl.cpp: use simple resize of facets_vec; reserve space for facets_vec to be
+ sure that allocation don't throw exception during vector resize in insert_*_facets functions.
+ Thanks Ulrich Eckhardt.
+
+2004-11-29 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_cmath.h: patch from Michael Fink applied.
+
+ * stlport/stl/_locale.h: remove enclose class spec to avoid VC confuse.
+ Thanks Ulrich Eckhardt.
+
+ * src/locale_impl.cpp, src/locale_impl.h: remove bogus _STLP_CALL decls.
+ Thanks Ulrich Eckhardt.
+
+2004-11-27 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_threads.h: direct access to _M_ref_count isn't MT-safe;
+ counter value returned by _M_incr and _M_decr methods only.
+
+ * stlport/stl/_rope.h, stlport/stl/_rope.c: adaptation to changes above;
+ removed __GC macro dependent code, that was never defined in present
+ sources.
+
+ * src/locale.cpp, locale_impl.cpp, locale_impl.h: general revision of locale
+ implementation; code clean, corrected, concepts fixed, errors fixed,
+ new bugs added.
+
+ * src/ctype.cpp, facets_byname.cpp, locale_catalog.cpp, messages.cpp, monetary.cpp:
+ ditto.
+
+ * stlport/stl/_codecvt.h, _collate.h, _ctype.h, _locale.h, _messages_facets.h:
+ ditto.
+
+ * _monetary.h, _num_get.h, _num_put.h, _numpunct.h, _time_facets.h: ditto.
+
+ * src/locale_nonclassic.h: removed due to code revision.
+
+ * src/explore/Makefile.inc: locale.cpp is directly included into locale_impl.cpp.
+
+ * src/explore/gcc.mak, test/unit/gcc.mak: use _STLP_LEAKS_PEDANTIC before release
+ by default.
+
+2004-11-24 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_cmath.h: Fix of the abs definition for the EVC platform
+ thanks Michael Fink.
+
+ * stlport/stl/_cmath.h: Fix of the Internal Compiler Error from MSVC6
+ when defining math functions in the STLport namespace thanks Ulrich
+ Eckhardt and I.
+
+ * stlport/stl/debug: Creation of a debug iterator traits used to make
+ an additional test when checking iterator deferencing status, on slist
+ before_begin iterators are not dereferenceable but were not detected
+ as so.
+
+ * stlport/math.h, stdexcept: patches from Michael Fink to avoid warning
+ on the EVC platform.
+
+2004-11-22 Francois Dumont <dums@stlport...>
+
+ * src/explore/Makefiles/nmake/evc3.mak, evc4.mak: removal of the useless
+ /DPLATFORM macro definition thanks Ulrich Eckhardt report and Michael Fink
+ patch.
+
+ * stlport/cstdlib: extension of the div overload for long input up to MSVC7.1
+ thanks Michael Fink report.
+
+ * test/unit/string_test.cpp: patch from Michael Fink for EVC which has limited
+ support of the WaitForMultipleObjects API function.
+
+ * stlport/cstdlib, cwchar, using/cstring: patch from Michael Fink to remove
+ imports of missing native C functions.
+
+2004-11-16 Francois Dumont <dums@stlport...>
+
+ * src/explore/configure.bat: Add of the --rtl-static and --rtl-dynamic
+ configuration options to force use of static or dynamic C runtime thanks
+ Michael Fink.
+
+ * stlport/config/stl_msvc.h: undef of the _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+ for the evc platform that only have the static C runtime version thanks
+ Michael Fink.
+
+ * stlport/config/stl_bc.h, stl_dmc.h, stl_solaris.h: Removal of all references
+ to the deprecated _STLP_NO_OWN_IOSTREAMS and _STLP_NO_NEW_IOSTREAMS macros.
+
+ * stlport/cmath, stl/_cmath.h: Modification of the import of the pow function
+ for MSVC6 that has a bugged overload thanks Michael Fink report.
+
+2004-11-09 Francois Dumont <dums@stlport...>
+
+ * test/unit/config_test.cpp: Creation of a test case to check correct
+ platform/compiler configuration.
+
+ * stlport/config/stl_msvc.h: Definition of the _STLP_HAS_NATIVE_FLOAT_ABS
+ now start with MSVC6.
+
+ * stlport/cstdlib, stl/_cmath.h: Addition of some missing math function
+ overloads for MSVC6.
+
+2004-11-05 Francois Dumont <dums@stlport...>
+
+ * stlport/config/stl_msvc.h: Definition of the _STLP_HAS_NATIVE_FLOAT_ABS
+ starting with MSVC .Net 2002 thanks Kevin Bluck report.
+
+ * test/unit/cmath_test.cpp: Creation of a test case to check correct import
+ and extensions of C functions.
+
+2004-11-04 Petr Ovtchenkov <ptr@island...>
+
+ * src/explore/Makefiles: added templates CC.mak for SunPro's CC compilers;
+ ones should be checked and fixed with real compiler.
+
+2004-11-04 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_function.h, _queue.h, _stack.h, _map.h, _iterator.h:
+ restoration of the Standard names of the protected datas.
+
+ * stlport/stl/_alloc.h, _alloc.c: implementation of a lock free version
+ of the default STLport node_allocator. Supported by the Win32 platform
+ for the moment.
+
+ * src/ios.cpp, locale.cpp, locale_impl.cpp: use of atomic operations
+ under Win32 platform rather than using synchronisation primitives.
+
+ * stlport/stl/_tree.h, _map.h, _set.h: creation of the erase_unique and
+ equal_range_unique methods to use the unicity information of the map and
+ set containers in binary tree searches.
+
+ * stlport/stl/_string.h: Add _STLP_USE_NO_IOSTREAMS check beforing deciding
+ not to include _string.c thanks KL
+
+2004-11-02 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/pointers/_deque.h: Fix for the problem of the deque<void*>
+ instanciation thanks Alex Cosealin report
+
+ * test/unit/ptrspec_test.cpp: Add of a test for the previous problem.
+
+2004-10-31 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_rope.h: Fix of the apply_to_pieces qualification thanks Leeya.
+
+ * test/unit/rope_test.cpp: New test case for the previous fix.
+
+2004-10-30 Francois Dumont <dums@stlport...>
+
+ * src/explore/Makefiles/nmake/vc-common.mak: introductions of the LDFLAGS_A_REL
+ macro to fix config problem under VC71 and VC8 beta.
+
+2004-10-29 Petr Ovtchenkov <ptr@island...>
+
+ * src/explore/Makefiles/gmake/app/gcc.mak: use -fPIC for gcc 2.95.x when build
+ application---this is a workaround for bug with running code in static constructors.
+
+ * stlport/config/stl_gcc.h, stlport/stl/_config.h: force usage of mutex instead
+ of spinlock for gcc 2.95.x, due to problems with initialization of statics.
+ Initialization of mutex has variant with structure filling, while for spinlock
+ initialization function call required.
+
+ * test/unit/locale_test.cpp: avoid static object for gcc 2.95.x, due to problems
+ with initialization of statics.
+
+2004-10-27 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_config.h, _fstream.h, _ios.h, _istream.h, _monetary.h, _num_get.h,
+ _num_put.h, _ostream.h, _sstream.h, _streambuf.h, _string.h, _time_facets.h:
+ Restoration of the _STLP_NO_CUSTOM_IO feature removed after cleanup reported
+ in 2004-09-28 post from Petr.
+
+ * stlport/stl/stl_user_config.h, _config.h, stl_msvc.h: reactivation of the
+ auto link feature for MSVC but only if activated by the client. Moreover the
+ new implementation of this feature is more maintenable, stl_msvc.h won't have
+ to be edited at each STLport release.
+
+ * test/unit/nmake-vc-common.mak, nmake-evc-common.mak: Adoption of the auto link
+ process.
+
+2004-10-25 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_config.h: Introduction of the _STLP_DONT_USE_EXCEPTIONS which
+ means that the client do not want to use the C++ exception feature. It is
+ different from the _STLP_NO_EXCEPTIONS which means that the compiler do not
+ support exceptions at all. The distinction is important for some macros definition.
+
+ * test/unit: Modification of the _STLP_NO_EXCEPTIONS test to the more general
+ _STLP_USE_EXCEPTION macro.
+
+ * stlport/stl/_ios_base.h, src/ios.cpp: rollback of the modifications of the
+ 2004-10-24.
+
+ * stlport/config/stl_msvc.h, stl_gcc.h: Those 2 compilers have a exception
+ support switch, when exceptions are unactivated they now define
+ _STLP_DONT_USE_EXCEPTIONS rather than _STLP_NO_EXCEPTIONS.
+
+2004-10-25 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_sstream.c: cur direction missed in seekoff. Thanks David Obermann.
+
+ * sstream_test.cpp: test for problem above.
+
+2004-10-24 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_ios_base.h, src/ios.cpp: definition of the ios_base::failure
+ nested class only when exception support is activated.
+
+ * stlport/stl/_deque.h, _deque.c: Modification of the deque implementation
+ to use the internal move framework.
+
+ * test/unit/mvctor_test.cpp: New test case for the use of the move
+ framework within the deque container.
+
+2004-10-21 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_iostring_stream.h: Simplification of the __stl_alloc_rebind
+ overload to make it less ambiguous for the compilers using it.
+
+2004-10-18 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_vector.h, _vector.c: Add of checks to know if a reference
+ is in *this before making a systematical copy of it.
+
+2004-10-18 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/type_manips.h: replace template <> by macro.
+
+ * stlport/stl/debug/_debug.h, _debug.c: __check_if_not_owner should return true
+ in case of incompatible types and do check different from __check_if_owner;
+ added message for check __check_if_not_owner.
+
+ * test/unit/mvctor_test.cpp, test/unit/ptrspec_test.cpp: fix tests to satisfy
+ changes related to 23.1.1 Table 67 in stlport/stl/debug/_vector.h, _deque.h---see
+ record 2004-10-14 below.
+
+2004-10-14 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/debug/_iterator.h: Move of some _DBG_iter_base and _DBG_iter
+ methods implementation outside struct definition to fix call on incomplete
+ type compile error generated by the call to the _Incrementable or _Dereferenceable
+ functions passing *this as input parameter thanks Alexey Sarytchev
+
+ * test/unit/sstream_test.cpp, fstream_test.cpp: Fix of the tests on streambuf
+ throwing exception for platform with no exception support.
+
+ * stl/_string.h: Add of the missing compare methods on the basic_string
+ implementation used by compilers supporting template methods thanks Patrick
+ Bennett report.
+
+ * stlport/stl/debug/_vector.h, _deque.h: Add check on the insert range method,
+ the inserted can not be pointing to the this instance where the insertion occur.
+
+2004-10-13 Petr Ovtchenkov <ptr@island...>
+
+ * src/explore/Makefiles/gmake: a bit correction of compiled and installed names
+ of executables on *nix systems, see record 2004-09-29 by Francois.
+
+2004-10-12 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_config.h: typo fix thanks KL
+
+ * stlport/stl/_move_construct_fwk.h, _set.h, _map.h, _hash_set.h, _hash_map.h:
+ Extra semicolons removal thanks Wlodek Szafran reports.
+
+2004-10-11 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/_rope.h: add typename.
+
+2004-10-08 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_deque.h, _hashtable.h, _tree.h, _bvector.h: Specialization of the
+ __type_traits struct for the iterator types.
+
+ * stlport/stl/_uninitialized.h, _vector.h: Relax of the rules to perform some
+ optimizations, no more POD check, rather use of the trivial copy constructor,
+ trivial assignment operator informations.
+
+ * stlport/stl/_config.h, _epilog.h: Adoption of stlport as the official STLport
+ namespace when users cannot use the std namespace.
+
+2004-10-07 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_list.h: Specialization of the __type_traits struct for list iterators.
+ Move of the == and != operators from the base iterator class to the iterator class
+ to make iterator of different list instanciation not comparable anymore.
+
+ * stlport/stl/_slist.h: ditto.
+
+2004-10-06 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_rope.h, _rope.c: Code review, use of general STLport tools rather
+ than specific rope ones. Use of compile time checks rather than runtime.
+
+ * stlport/stl/_bvector.h: fix to make the vector<bool> specialization movable
+ thanks a Kelly Thompson report.
+
+2004-10-05 Francois Dumont <dums@stlport...>
+
+ * src/explore/Makefiles/nmake: Application of a patch from Michael Fink to simplify
+ the evc make system.
+
+ * doc/README.evc4: New version from Zdenek Nemec.
+
+2004-10-04 Francois Dumont <dums@stlport...>
+
+ * test/unit/type_traits_test.cpp: A new test case to check behavior of
+ the numerous helper functions from type_traits.h and type_manips.h.
+
+ * stlport/stl/type_traits.h: Fix of some bugs and addition of the __type_traits
+ specializations of const, volatile and const volatile native types.
+
+ * stlport/stl/type_manips.h: Modification of the __bool2type default value
+ so that it consider any value as true and only the 0 value false.
+
+ * stlport/config/stl_msvc.h, stlport/stl/_config.h: Modification of the STLport
+ std equivalent namespace to be sure that the user rebuild correctly the STLport
+ library when he forces the use of the dynamic or static library.
+
+ * src/explore/Makefiles/nmake/lib/vc-common.mak, app/vc-common.mak: Creation
+ of the STLP_BUILD_FORCE_STATIC_RUNTIME that forces use of the static version
+ of the native runtime.
+
+ * test/unit: fix of some tests that failed to compile using the
+ _STLP_NO_ANACHRONISMS macro.
+
+2004-09-30 Petr Ovtchenkov <ptr@island...>
+
+ * test/regression: catalog removed---it obsolete and unsupported; use
+ test/unit tests instead; all tests from test/regression was moved in test/unit,
+ sometimes in redesigned form.
+
+2004-09-29 Francois Dumont <dums@stlport...>
+
+ * stlport/stl/_string_io.c: Removal of the native library specific calls of
+ use_facet, only the STLport standard one is used.
+
+ * stlport/stl/_alloc.h, _alloc.c, src/dll_main.cpp: Implementation of a clean
+ process for the node_alloc allocator. This clean is active only when
+ _STLP_LEAKS_PEDANTIC is defined and you are using STLport as a dynamic
+ library under Win32.
+
+ * src/explore: Updates of several makefiles to conform to the new library
+ and binary naming convention.
+
+ * src/c_locale_win32/c_locale_win32.c: fix of the message facet name management
+ that was generating a memory leak.
+
+2004-09-29 Petr Ovtchenkov <ptr@island...>
+
+ * stlport/stl/char_traits.h: WinCE seems don't declare off_t; thanks Michael Fink.
+
+2004-09-28 Petr Ovtchenkov <ptr@island...>
+
+ * Repository: iostreams and string wrapper mode removed, due to ones has
+ a lot of restrictions in usage and frequently lead to hard recognized problems.
+ Tonns of *_STREAMS macro replaced by _STLP_USE_NO_IOSTREAMS or _STLP_NO_IOSTREAMS
+ as configuration macro; *NATIVE_STRING macro removed by the same reasons.
+
+2004-09-27 Petr Ovtchenkov <ptr@island...>
+
+ * test/unit/gcc.mak: fix stlport library name for STLP_DEBUG mode for Solaris,
+ thanks for separate namespaces in normal and STLP_DEBUG mode, see record
+ 2004-09-10 below.
+
+2004-09-24 Francois Dumont <dums@...>
+
+ * stlport/config/stl_gcc.h: Fix of the relative include path used to access the
+ native gcc headers. Before version 3.4.0 the 0 patch level was not part of the
+ include path.
+
+ * stlport/stl/type_traits.h, _vector.h, _algobase.h, _construct.h: Removal
+ of the __action_on_move type traits replaced by a generalization of the
+ already existing __move_traits.
+
+ * test/unit/mvctor_test.cpp: New test case for the __move_traits feature.
+
+2004-09-24 Petr Ovtchenkov <ptr@island...>
+
+ * src/explore/Makefiles/gmake/sunos: 'explore' makesystem adopted to work
+ under Solaris with GNU make.
+
+ * test/unit/gcc.mak: ditto.
+
+ * src/explore/Makefiles/gmake/app/gcc.mak: ditto.
+
+ * src/explore/Makefiles/gmake/lib/gcc.mak: ditto.
+
+ * stlport/cmath: fix some math calls for Solaris.
+
+ * test/unit/list_test.cpp: add illustration for list iterator/reverse_iterator questions.
+
+ * src/explore/Makefiles/gmake/unix/lib.mak: moved from linux/lib.mak, as
+ common rules for all *nixes.
+
+ * src/explore/Makefiles/gmake/linux/lib.mak: use common for all *nixes rules
+ in unix/lib.mak.
+
+ * src/explore/Makefiles/gmake/freebsd/lib.mak: ditto.
+
+ * src/explore/Makefiles/gmake/openbsd/lib.mak: ditto.
+
+ * src/explore/Makefiles/gmake/sunos/lib.mak: ditto.
+
+ * src/explore/Makefiles/gmake/unix/lib.mak, test/unit/gcc.mak: changed library name;
+ libraries now named as libstlport, libstlportg, libstlportstlg for optimized, with
+ debug symbols, and with debug symbols and _STLP_DEBUG mode libraries respectivly.
+
+2004-09-21 Francois Dumont <dums@...>
+
+ * stlport/stl/debug: Modification of the __check_range class in the more general
+ __check_construct. Now it also checks for null pointers in the string interface.
+
+ * src/explore: Adoption of the new library naming convention for all Microsoft
+ compilers thanks Michael Fink
+
+2004-09-20 Francois Dumont <dums@...>
+
+ * src/explore/Makefiles/gmake/cygwin, mingw: Build configuration files merges
+ within a single build system: cygming. Future portage of STLport for compilers
+ using the GNU tools will be available from both systems. Removal of the vc6 build
+ under cygwin, for mono-platform compilers we support only one build system.
+
+ * stlport/stl/_vector.h: Modification of the destructor implementation to destroyed
+ object instances in a reverse order taking advantage of the way elements are
+ normaly added to this container.
+
+2004-09-16 Francois Dumont <dums@...>
+
+ * test/unit/cppunit/cppunit_mini.h, cppunit_proxy.h: Adaptation of the CPPUNIT
+ framework to take care of the exception as failures thanks Zdenek Nemec
+
+ * stlport/config/stl_msvc.h, stl_bc.h, stl_mwerks.h, stlport/stl_user_config.h:
+ Removal of the non intuitive and difficult to maintain automatic linking feature.
+
+ * Fixing of the locale implementation mecanism. Classic locale implementation is
+ also managed by a reference counter to be sure when it is possible to release
+ the associated ressources. Fix of a missing locale impl ref counter decrement
+ in the template locale constructor taking a facet, it was a possible source of
+ memory leak . Addition of a static object within locale_impl.cpp in
+ _STLP_LEAKS_PEDANTIC mode to decrement the global locale impl ref counter when
+ STLport library is unloaded. Addition of all the missing classic locale facets
+ destructor in free_classic_locale.
+
+ * src/locale_catalog.cpp: The locale by name constructor checks the "C" name
+ to simply copy (increment the ref counter) the classic locale implementation
+ rather than instanciating a new one.
+
+2004-09-15 Francois Dumont <dums@...>
+
+ * stlport/stl/_list.c: Modification of the _S_sort implementation, the __carry
+ list instance is created using the __that allocator instance copy to be more
+ allocator friendly.
+
+2004-09-11 Francois Dumont <dums@...>
+
+ * stlport/config/stl_intel.h: Configuration update for Win32 Intel 8.0
+ compiler thanks Charlemagne.
+
+2004-09-10 Francois Dumont <dums@...>
+
+ * stlport/stl/_config.h: The new official namespace is now stlp_std. _STL is
+ just an alias. STLPORT macro still contains the STLport std namespace equivalent.
+ Moreover in _STLP_DEBUG mode, which is not binary compatible with the release
+ or debug mode, the namespace is stlpd_std to generate link error rather
+ than runtime crash.
+
+2004-09-09 Francois Dumont <dums@...>
+
+ * stlport/stl/_config.h: _STLP_DONT_USE_NESTED_TCLASS_THROUGHT_TPARAM
+ renamed to the more intuitive _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE.
+
+ * stlport/stl/_config.h: Introduction of a new namespace stlp_private
+ defined in the global namespace. Everything that is STLport implementation
+ details should be in this namespace to avoid polution of the std namespace.
+
+ * stlport/stl/_iterator_base.h: Modification of the macro used to create
+ iterator traits for all tree and hashtable based containers to move it in
+ the stlp_private namespace rather than defining it as nested struct, limits
+ the symbol size.
+
+2004-09-08 Francois Dumont <dums@...>
+
+ * test/unit/fstream_test.cpp: restauration of the test added by Petr
+ the 2004-09-03, it is finaly a different test from the one in sstream_test.cpp.
+ Some more checks have also been integrated.
+
+ * stlport/stl/_ostream.c: New fix of the _M_unbuffured_copy method that was
+ still bugged in case of a throwing output streambuf, detected thanks to the
+ test case.
+
+2004-09-07 Francois Dumont <dums@...>
+
+ * stlport/config/stl_msvc.h: Add defines of the _STLP_USE_STATIC_LIB
+ or _STLP_USE_DYNAMIC_LIB depending on the current kind of build.
+
+ * stlport/stl/_streambuf.h, _streambug.c: Fix an unresolved symbol
+ problem for MSVC6 (and before?) when STLport is used as a static library.
+
+2004-09-06 Francois Dumont <dums@...>
+
+ * test/unit/nmake-evc-common.mak: Use of the dynamic runtime for the
+ *-shared rules rather than the previous static thanks Michael Fink.
+
+ * test/unit/nmake-evc*.mak: end of build code factorisation, use of
+ nmake-evc-common.mak within all makefiles thanks Michael Fink.
+
+ * test/unit/locale_test.cpp: Application of a patch from Michael Fink
+ to check the "C" locale on all platforms. Fix of the money_get_put test
+ case for the "C" locale.
+
+ * test/unit/allocator_test.cpp: new test case for std::allocator checks.
+
+2004-09-05 Francois Dumont <dums@...>
+
+ * stlport/stl/_string_hash.h: Performance improvement, multiplication
+ replaced by shift operations thanks Greg S.
+
+ * stlport/config/stl_wince_4.h: removed, never used, stl_evc.h has been
+ prefered.
+
+ * test/unit/string_test.cpp: addition of a new test short_string_optim_bug
+ to check for a compiler bugs making the short string optim invalid thanks
+ Michael Fink.
+
+ * stlport/config/stl_evc.h: Deactivation of the short string optimization
+ because of a compiler bug thanks Michael Fink.
+
+ * src/explore: factorisation of the evc build makefiles thanks Michael Fink.
+
+ * src/explore/Makefiles/nmake/lib/clean.mak, macro.mak: Addition of some
+ file clean up for the clobber rule thanks Michael Fink.
+
+2004-09-03 Francois Dumont <dums@...>
+
+ * test/unit/fstream_test.cpp, sstream_test.cpp: Move of the test for the
+ infinite loop from FstreamTest test case to SstreamTest, addition of some
+ checks.
+
+ * test/unit/full_streambuf.h: streambuf implementation simulating full
+ output.
+
+ * stlport/exception: restauration of some modification removed after the
+ rollback of the 2004-09-01.
+
+ * stlport/config/stl_gcc.h: homogeneification of the coding standard used
+ within STLport, 2 spaces indentations even for preprocessor directives.
+ Doing so, discovered a weird configuration for Mac OS platform (__APPLE__)
+ concerning the _STLP_NATIVE_INCLUDE_PATH macro definition, fixed.
+
+ * stlport/stl/config/stl_*.mak: removal of all references to the
+ _STLP_REDEFINED_STD macro as it is now the default and only way STLport
+ use to replace native Standard library.
+
+ * test/unit/nmake-vc-common.mak: add inclusion of the vc_warning_disable.h
+ file to avoid warnings during build process thanks Michael Fink.
+
+2004-09-03 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/_ostream.c: removed infinite loop in case when outgoing stream
+ can't accept more chars. Thanks Daniel White, Ulrich Eckhardt, Francois Dumont.
+
+ * test/unit/fstream_test.cpp: test for problem above. Thanks Ulrich Eckhardt.
+
+2004-09-02 Francois Dumont <dums@...>
+
+ * stlport/exception, stlport/stl/_site_config.h, test/unit/exception_test.cpp:
+ Creation of the _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT macro to signal support of
+ the unexpected exception mecanism. Related type/function are only brought to the
+ STLport namespace if correctly supported, exception_test.cpp check that.
+
+ * New modification of the _Rb_tree and _Hashtable associated iterator structs.
+ Removal of the container_type pass through the iterator traits; iterator traits
+ is the type that will make each derived container iterator type real different
+ type making them uncomparable.
+
+ * stlport/ctype.h: rollback of the above rollback ;-) only of course for the
+ Win CE code fix that was part of the previous commitment.
+
+2004-09-01 Petr Ovtchenkov <ptr@Island...>
+
+ * Rollback include schema: code is broken.
+
+2004-08-31 Francois Dumont <dums@...>
+
+ * _STLP_INCOMPLETE_EXCEPTION_HEADER replace by the more intuitive
+ _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT macro.
+
+ * Modification of the include schema of all public headers in stlport folder
+ that need to be reentrant. Now those files are fully guarded and the specific
+ STLport code is only included once at the end of the inclusion, the reentrancy
+ only concern inclusion of the native headers.
+
+2004-08-30 Francois Dumont <dums@...>
+
+ * stlport/stl/_deque.c: Fix of a pseudo 'uninitialized variable used' thanks
+ Oliver Stoeneberg.
+
+2004-08-27 Francois Dumont <dums@...>
+
+ * .Net 2002 (VC70) portage.
+
+2004-08-27 Petr Ovtchenkov <ptr@Island...>
+
+ * src/explore/Makefiles/gmake/gcc.mak, app/gcc.mak, lib/gcc.mak: buggy C++
+ language support in libsupc++ in gcc before 3.3 not allow to use it;
+ link with libstdc++ instead.
+
+ * stlport/config/stl_icc.h: fix features for icc 7.1; fix features for Linux
+ platforms.
+
+2004-08-24 Francois Dumont <dums@...>
+
+ * stlport/config/stl_gcc.h, stl_msvc.h: fixing of configuration concerning
+ uncaught_exception and exception handling in general thanks John Roberts.
+
+ * stlport/stl/_tree.h, _tree.c: Modification of the _Rb_tree_iterator struct
+ to be able to distiguish iterator types from different tree based containers
+ Removal of the == and != member operators of the _Rb_tree_base_iterator struct
+ replaced by global operators taking _Rb_tree_iterator as parameters and checking
+ that the iterators are of the same container type thanks Haroon Nassiry report.
+
+ * stlport/stl/_map.h, _set.h: Modification of the iterator traits used to
+ instanciate the _Rb_tree class.
+
+ * stlport/stl/_hashtable.h, _hashtable.c, _hash_set.h, _hash_map.h: Similar
+ modifications to the previous one in order to make for instance the iterator
+ from hash_map and hash_multimap not comparable anymore.
+
+ * stlport/config/stl_wince.h, stlport/ctype.h: Move of the isspace C function
+ Windows CE specific code from the config file to the ctype.h file. This fix
+ will also apply to Embedded C++ .Net thanks Dirk report.
+
+2004-08-23 Petr Ovtchenkov <ptr@Island...>
+
+ * test/unit/cppunit/cppunit_proxy.h, test/init/gcc.mak: CPPUNIT_MINI removed.
+
+ * src/num_get_float.cpp: suggestion to fix problem with float input for gcc 3.4.x
+ with optimization flag.
+
+ * test/unit/floatio_test.cpp: test for infinity and near
+
+ * src/explore/Makefiles/gmake/gcc.mak, app/gcc.mak, lib/gcc.mak: fix detection of
+ gcc version; gcc before 3.x had libgcc.a that contains some language support,
+ so link with it in case when we avoid link with libstd++. This has relation only
+ for linux systems.
+
+2004-08-19 Petr Ovtchenkov <ptr@Island...>
+
+ * src/explore/configure.bat: setting up compiling STLport under Windows.
+ Contribution by Michael Fink.
+
+2004-08-13 Francois Dumont <dums@...>
+
+ * test/unit/gcc.mak: Addition of the _STLP_NO_CUSTOM_IO define to make test
+ build faster.
+
+ * stlport/stl/_limits.h, _limits.c: Modification of the _LimG class definition.
+ Removal of the static variables, replaced by static method having the same role
+ but more portable. Fix link problem with MSVC compilers family when using STLport
+ static library.
+
+ * stlport/stl/_bitset.h, _bitset.c: Ditto for the _Bs_G class.
+
+ * stlport/stl/_hashtable.h, _hashtable.c: Ditto for the _Stl_prime class.
+
+ * src/dll_main.cpp: thanks to the previous modification, removal of the
+ concerned code within force_link.
+
+2004-08-13 Petr Ovtchenkov <ptr@Island...>
+
+ * test/unit/cppunit/cppunit_mini.h, file_reporter.h, test_main.cpp:
+ add function to print mess; remove def of CPPUNIT_MINI, not required; add const
+ qualifiers.
+
+ * test/unit/locale_test.cpp: print checked locale name; restore table with format
+ symbols--partially rollback changes 2004-07-29; add test for possible locale
+ init/deinit problem---I don't see problem. Test inspired by Alex Kosilin.
+
+2004-08-11 Francois Dumont <dums@...>
+
+ * src/explore/Makefiles/nmake: extension of the new build system for VC.Net
+ 2005 (VC8).
+
+ * src/explore/Makefiles/nmake/app: restauration of the default behavior shared
+ rules generates executable using the STLport dynamic library and static rules
+ use the static libraries.
+
+ * stlport/stl/_string.h: Add check of _STLP_NO_IOSTREAMS to force inclusion of
+ _string.c in this case.
+
+ * stlport/stl/_string.c: removal of the _STLP_LINK_TIME_INSTANTIATION macro check
+ before inclusion as the check is already done to include _string.c from _string.h.
+
+ * stlport/stl/_istream.h _istream.c: removal of the _M_put_num function definition
+ from the .h and removal of all the inline implementation of the >> operators.
+ _M_put_num is now hidden in the .c to avoid to have to deal with export of this
+ symbol. Fix errors while using the _STLP_NO_CUSTOM_IO macro.
+
+ * stlport/stl/_ostream.h _ostream.c, src/ostream.cpp: ditto but for the _M_get_num
+ function.
+
+ * stlport/stl/_istream.h _istream.c: _M_init_skip and _M_init_noskip are now inline
+ functions defined within the .h to fix link errors when using the _STLP_NO_CUSTOM_IO
+ macro.
+
+2004-08-10 Francois Dumont <dums@...>
+
+ * stlport/stl/_string.h: add check of the _STLP_EXPOSE_STREAM_IMPLEMENTATION
+ macro to include the _string.c file. Improve compile time when _STLP_NO_CUSTOM_IO
+ is defined.
+
+ * stlport/stl/_string.h, stlport/stl/debug/_string.h, _string_mem_t.h: restoration
+ of the template method specialization for backward compatibility between compilers
+ implementating template method and the most recent one. It is considered as an
+ STLport extension.
+
+2004-08-09 Petr Ovtchenkov <ptr@Island...>
+
+ * test/compiler: tests to check whether compiler understand or not some
+ language construction. It is NOT tests for language support libraries,
+ only tests for compiler. The main purposes of this tests is to help
+ for developers to find correct workarounds, if compiler don't understand
+ some language constructions.
+
+2004-08-09 Francois Dumont <dums@...>
+
+ * stlport/stl/_limits.h, stlport/config/stl_mycomp.h: introduction of a new macro
+ configuration to signal no support of the IEC 559 specification for floating point
+ numbers.
+
+ * stlport/config/stl_msvc.h: fix of the config to signal no IEC 559 support before
+ Visual C++ .Net even if the infinity value is fine.
+
+ * test/unit/limits_test.cpp: New test case to check the right numeric_limits class
+ configuration. Do not check the signaling_NaN yet...
+
+ * stlport/config/stl_msvc.h: Visual .Net Beta 2005 portage.
+
+ * stlport/stl/_ios.h: Move of the basic_ios::narrow and widen member method
+ specialization before the explicit instanciation of the basic_ios class for
+ the char type.
+
+ * stlport/stl/_construct.h, _num_put.c: fix of some unused parameter warning
+ thanks Oliver Stoeneberg report.
+
+2004-08-05 Francois Dumont <dums@...>
+
+ * Fixes of the internal move framework for compilers not supporting partial
+ template specialization. The problem was detected thanks to the boost regression
+ test suite.
+
+2004-08-04 Francois Dumont <dums@...>
+
+ * stlport/stl/debug/_list.h, _slist.h: small review of the stlport debug code.
+ Removal of any Standard reference in the slist class debug implementation. Removal
+ of some unjustified iterator invalidation.
+
+ * stlport/stl/_locale.h, _collate.h, src/locale.cpp, locale_catalog.cpp, locale_impl.cpp:
+ Split of the locale class implementation into _LocaleBase base class with no member
+ template methods which is exported and the locale class which is not exported. This
+ is a workaround for the MSVC6 compiler.
+
+2004-08-03 Francois Dumont <dums@...>
+
+ * stlport/stl/_iterator.h: Fix of the back_insert_iterator, front_insert_iterator
+ and insert_iterator to make them assignable like specify in the Standard requirements
+ of the output iterators.
+
+ * test/unit/insert_test.cpp, finsert_test.cpp, binsert_test.cpp: Addition of tests for
+ the assignment operators on the output iterators.
+
+2004-08-02 Francois Dumont <dums@...>
+
+ * stlport/stl/_string.h, _string.c, debug/_string.h: split of the basic_string
+ implementation into a class with no member templates and one with the member
+ templates. Only the one with no member templates is exported. This is a MSVC6
+ bug workaround as this compiler try to look for the class method symbols within
+ the dynamic library even if this symbol is the one of template method which is
+ not exported. That also make the basic_string implementation more clean so it
+ has been adopted for all compilers.
+
+2004-07-29 Francois Dumont <dums@...>
+
+ * test/unit/locale_test.cpp: Fix bad macro _STLP_NO_EXCEPTIONS spelling
+ and add of a check for real locale implementation. Patch done by
+ Michael Fink.
+
+ * stlport/stl/debug/_debug.h, _debug.c, _iterator.h: Modification of the
+ __check_same_owner_or_null function name to the more intuitive
+ __check_same_or_null_owner thanks a Aleksey Sanin remark.
+
+2004-07-26 Petr Ovtchenkov <ptr@Island...>
+
+ * src/explore/Makefiles/gmake/lib/gcc.mak: avoid linkage with libstd++
+ for gcc compilers.
+
+ * src/explore/Makefiles/gmake/linux/rules-so.mak: ditto
+
+ * src/explore/Makefiles/gmake/lib/rules-a.mak: ditto
+
+ * src/explore/Makefiles/gmake/app/top.mak: ditto
+
+2004-07-21 Francois Dumont <dums@...>
+
+ * stlport/config/stl_gcc.h: Fix of a gcc 3.3.0 test that did not handle
+ the gcc 2.95.x correctly thanks Jordan Breeding.
+
+ * src/common_rules.mak: Addition of the stlport/stl/pointers folder within
+ the folder to be install. Add of a call to ranlib under linux mandatory under
+ Mac OS X and without impact under the other Unixes systems.
+
+2004-07-17 Francois Dumont <dums@...>
+
+ * Application of a Mac OSX patch from John Daniel (www.etresoft.com)
+
+2004-07-15 Francois Dumont <dums@...>
+
+ * stlport/stl/_epilog.h: systematical use of the redefined std namespace
+ rather than using the namespace inclusion schema.
+
+ * test/unit/set_test.cpp: addition of a test case to show the problem of
+ the namespace injection schema.
+
+2004-07-13 Francois Dumont <dums@...>
+
+ * stlport/numeric: removal of the _function.h header include.
+
+ * test/unit/divide_test.cpp: add the missing functionnal header
+ inclusion.
+
+ * doc/README.msvc: new doc specific to the MSVC++ family compiler.
+
+2004-07-12 Petr Ovtchenkov <ptr@Island...>
+
+ * test/unit/fstream_test.cpp: tests for unformatted extraction bug.
+
+ * stlport/stl/_istream.c: _M_read_unbuffered should leave delimiter
+ in the stream in case of unformatted input. Thanks Joerg Becker.
+
+2004-07-09 Francois Dumont <dums@...>
+
+ * src/sgi_mipspro.mak: add the -LANG:libc_in_namespace_std:OFF
+ thanks Jack Perdue.
+
+2004-07-08 Francois Dumont <dums@...>
+
+ * doc/README.evc3: additionnal doc thanks Michael Fink
+
+2004-07-08 Petr Ovtchenkov <ptr@Island...>
+
+ * test/unit/sstream_test.cpp: added two test for unformatted extraction
+ and newline character. Inspired by Joerg Becker.
+
+2004-07-07 Francois Dumont <dums@...>
+
+ * stlport/stl/_hashtable.h, stlport/stl/_hashtable.c,
+ stlport/stl/_hash_set.h, stlport/stl/_hash_map.h: generalization
+ of the iterator traits adopted on the tree class. Now iterator and
+ const_iterator on hash_set and hash_multiset are different types
+ even if iterator is still immutable.
+
+ * stlport/stl/_deque.h, stlport/stl/_list.h, stlport/stl/_slist.h:
+ Modification of the iterator classes to only use the template
+ parameter _Traits rather than using an external type traits. It is
+ the way hash containers and sorted containers have their iterator
+ struct working.
+
+ * stlport/stl/_iterator_base.h: Addition of the immutable traits
+ struct _Const_Const_traits and _Nonconst_Const_traits for
+ implementation of the set, multiset, hash_set, hash_multiset
+ iterators.
+
+ * stlport/stl/c_locale.h, stlport/stl/debug/_debug.h: removal of
+ unjustified _config.h inclusions
+
+ * stlport/stl/_iterator_base.h: inclusion of type_traits.h only
+ for compilers that need it.
+
+ * stlport/stl/_algobase.h, stlport/stl/debug/_debug.h: add inclusion
+ of type_traits.h.
+
+ * stlport/stl/_algo.h, stlport/stl/_algo.c: move of the _tempbuf.h
+ inclusion from the .h to the .c that is the only one that need it.
+
+ * stlport/stl/_config.h: addition of the boost support section.
+
+2004-07-07 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/_monetary.c: iterator __str_first out of range,
+ i.e. outside __str_last in 'mismatch' call in __get_string, if
+ size of interval [__first, __last) is larger than size of interval
+ [__str_first, __str_last).
+
+ * test/unit/fstream_test.cpp: test for correct report by tellg added.
+
+2004-07-05 Francois Dumont <dums@...>
+
+ * stlport/stl/_map.h: internal type _Rep_type set as public for use
+ in the __move_traits specialization thanks Oliver Stoeneberg.
+
+ * stlport/stl/_set.h: specialization of the __move_traits to make the
+ set and multiset movable thanks Oliver Stoeneberg.
+
+ * stlport/stl/_function_base.h, stlport/stl/_heaps.h: removal of the
+ unjustified _config.h inclusion that should only be included from the
+ _prolog.h header.
+
+2004-07-05 Petr Ovtchenkov <ptr@Island...>
+
+ * src/facets_byname.cpp: avoid pass address to member of derived class into
+ base class via constructor.
+
+ * src/facets_byname.cpp: remove first member---EOF---of _M_byname_table---one
+ not required and lead to wrong reference; this a fix for test in
+ locale_test.cpp.
+
+ * src/ctype.cpp: ditto.
+
+ * src/c_locale_win32/c_locale_win32.c: ditto.
+
+ * stlport/stl/_ctype.h: ditto.
+
+2004-07-02 Petr Ovtchenkov <ptr@Island...>
+
+ * src/c_locale_glibc/c_locale_glibc2.c: message catalog functions dealing
+ with message catalog descriptor; but this descriptor not necessary to be
+ int; Linux use here void *, i.e. pointer to mmap segment.
+
+ * stlport/stl/_messages_facets.h: ditto.
+
+ * src/messages.cpp: ditto.
+
+ * src/message_facets.h: ditto.
+
+ * src/facets_byname.cpp: ditto.
+
+ * src/c_locale_stub.cpp: ditto.
+
+ * src/c_locale.h: ditto.
+
+ * src/c_locale_glibc/c_locale_glibc2.c: fix _Locale_extract_*_name
+ functions.
+
+2004-07-01 Francois Dumont <dums@...>
+
+ * src/explore/Makefiles/nmake/lib/vc-common.mak: creation of the
+ STLP_BUILD_FORCE_DYNAMIC_RUNTIME option to create STLport statix
+ versions more easily.
+
+2004-06-30 Francois Dumont <dums@...>
+
+ * stlport/stl/_function.h: Use a call_traits to avoid the reference
+ to reference problem in struct like binder1st or binder2nd.
+
+2004-06-26 Francois Dumont <dums@...>
+
+ * src/explore/: portage of the explore build system for the
+ MSVC .Net 2003 compiler.
+
+2004-06-24 Francois Dumont <dums@...>
+
+ * stlport/stl/_site_config.h: Addition of an entry for the per thread
+ allocator configuration.
+
+ * stlport/stl/_config.h: Avoid use of the import/export technique
+ when not using own iostreams. This way you can use the STLport debug
+ mode without building the libraries.
+
+2004-06-23 Francois Dumont <dums@...>
+
+ * extension of the cygwin link problem workaround for mingw32.
+
+ * src/locale_catalog.cpp: Move of the _STLP_lock object instance
+ declaration to limit the critical section and improve performace.
+
+ * stlport/stl/_pthread_alloc.h: fix of the pthread_allocator and
+ per_thread_allocator allocate method to check for the required
+ number of element before multiplication with the size of the objects
+ to instanciate.
+
+2004-06-22 Francois Dumont <dums@...>
+
+ * src/locale_catalog.cpp: fix of the locale facets registration system.
+ The hash container use string as key rather than char const* so that
+ a copy of the facet name is stored rather than a copy of the string
+ pointer that might be freed. We also extract the complete facet name
+ before storing it to avoid store of facet aliases that cannot be retrieved
+ at release.
+
+2004-06-21 Francois Dumont <dums@s...>
+
+ * Restauration of the cygwin support (using gcc 3.3.1). Extension of the
+ explore build system, workaround of a link problem when using shared
+ libraries.
+
+2004-06-13 Petr Ovtchenkov <ptr@Island...>
+
+ * src/c_locale_glibc/c_locale_glibc2.c: locale_data for glibc 2.3 is differ
+ from one for glibc 2.2.
+
+2004-06-11 Francois Dumont <dums@...>
+
+ * test/unit: Modification of some tests to make the assertion
+ clearer. Mainly add of check of the streams state before check
+ of the stream content.
+
+ * test/unit/locale_test.cpp: fix of the thousands separator which is
+ 0xa0 under Win32 and not a simple ' ' for the french locale.
+
+2004-06-07 Francois Dumont <dums@...>
+
+ * stlport/stl/_algo.c: rollback of the sort algo implementation
+ to the 4.5.3 version.
+
+2004-06-03 Francois Dumont <dums@...>
+
+ * stlport/stl/pointers/README, doc/pointer_specialization.txt: move and
+ rename of the doc about pointer partial template specialization feature.
+
+ * doc/README.ecv4: Creation of a documentation about the install and use
+ of STLport within Embedded Visual C++ 4 thanks Zdenek Nemec.
+
+ * doc/README.ecv3: Creation of a documentation about the process installment
+ with the Embedded Visual C++ 3 thanks Michael Fink.
+
+ * stlport/stl/_slist.h: fix of an invalid reference to a _M_node member data
+ on a _Slist_node_base struct (thanks gcc 3.4.0).
+
+ * stlport/stl/_string.c, stlport/stl/_string.h: fix of missing scopes to
+ access the base template class _String_base _DEFAULT_SIZE enum member.
+ (thanks gcc 3.4.0)
+
+ * stlport/stl/_string_base.h: fix of the anonymous union used as a parameter
+ of the template function swap. (thanks gcc 3.4.0)
+
+ * stlport/stl/_ostream.h: fixes of the missing scopes to access the basefield enum
+ within the base template class basic_ios from the basic_ostream. (thanks gcc 3.4.0)
+
+ * stlport/stl/_debug.c: clean up of a no more use template function.
+ (thanks gcc 3.4.0)
+
+ * stlport/stl/_rope.h: fix of the missing scope to access base template class
+ data member. (thanks gcc 3.4.0)
+
+2004-06-02 Petr Ovtchenkov <ptr@island...>
+
+ * src/num_put_float.cpp: some fixes for systems that use snprintf for
+ output, i.e. for FreeBSD and OpenBSD
+
+ * test/unit/floatio_test.cpp: less precise request, this should work
+ with static buffer for systems that use snprintf
+
+ * stlport/stl/_config.h: detect MT for OpenBSD
+
+ * stlport/stl/_threads.h: use original spinlock for OpenBSD
+
+2004-05-28 Francois Dumont <dums@...>
+
+ * stlport/config/stl_gcc.h: fix for the gcc3.4.0 compiler. Modification
+ of the include path macro to generate 3.4.0 rather than 3.4 . Need
+ template keyword to reveal use of a nested template class.
+
+ * stlport/stl/_config.h: creation of the _STLP_LONG_DOUBLE macro that
+ extend to long double on compiler supporting it and double on the other
+ as a workaround.
+
+ * stlport/stl/_num_put.h, stlport/stl/_num_put.c, src/num_put_float.cpp:
+ Addition of functions to get the digits from a long double for the monetary
+ facet.
+
+ * stlport/stl/_monetary.h, stlport/stl/_monetary.c, src/monetary.cpp:
+ Implementation of the missing money_put::put method taking a long double.
+ Fixing of the grouping application.
+
+ * test/unit/Makefile.inc, test/unit/locale_test.cpp: Creation of a unit test
+ for the locale support. At creation it tests the num_put, num_get, money_put,
+ money_get facets.
+
+ * src/facets_byname.cpp: fix of the monetary format determination from
+ the locale platform API informations.
+
+2004-05-28 Petr Ovtchenkov <ptr@Island...>
+
+ * src/explore/Makefiles/gmake/sysid.mak: correctly detect Mingw
+
+ * src/explore/Makefiles/gmake/mingw: compilation under Mingw
+
+2004-05-27 Petr Ovtchenkov <ptr@Island...>
+
+ * Makefiles/gmake/linux/extern.mak: fix lib catalog name in case of cross-compilation
+
+ * Makefiles/gmake/freebsd/extern.mak: ditto
+
+ * Makefiles/gmake/openbsd/extern.mak: ditto
+
+2004-05-26 Petr Ovtchenkov <ptr@Island...>
+
+ * Repository: STLport 5.0 RC1
+
+2004-05-24 Francois Dumont <dums@...>
+
+ * stlport/stl/_iostream_string.h:
+ Fix of the iostring_allocator rebind embedded struct and implementation
+ of the missing __stl_alloc_rebind and __stl_alloc_create useful for compiler
+ not supporting or buggy on the member template feature (VC6 for instance).
+
+2004-05-22 Francois Dumont <dums@...>
+
+ * src/num_put_float.cpp, stlport/stl/_num_put.h, stlport/stl/_num_put.c:
+ Correction of the locale grouping schema application in case of the scientific
+ output when there is no decimal point.
+
+2004-05-19 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/_tree.h, stlport/stl/debug/_tree.h: fix template parameters, see rec
+ 2004-05-14 below.
+
+2004-05-16 Petr Ovtchenkov <ptr@Island...>
+
+ * Repository: STLport 5.0 branch
+
+2004-05-14 Francois Dumont <dums@...>
+
+ * stlport/stl/_tree.h, stlport/stl/_tree.c, stlport/stl/_set.h, stlport/stl/_map.h:
+ Modification of the _Rb_tree implementation to restore the non mutability of the set
+ iterators but to keep distinct type between it and the const_iterator.
+
+2004-05-13 Francois Dumont <dums@...>
+
+ * stlport/config/stl_evc.h, test/unit/nmake-evc3.mak: Portage to the WinCE 3 platform.
+ Thanks Michael Fink.
+
+2004-05-13 Francois Dumont <dums@s...>
+
+ * stlport/stl/_set.h: Addition of the const/non-const methods for many methods now that
+ iterator are not const_iterator anymore. Correction of the multiset interface to be
+ homogeneous with the set interface.
+
+2004-05-09 Francois Dumont <dums@...>
+
+ * stlport/stl/char_traits.h: Addition of the specific wchar_t static methods similar
+ to the one of the char specialization calling the wide functions.
+
+2004-05-08 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/_set.h: fix definition of const/non-const for find and *_bound
+ methods. Thanks KL for report.
+
+2004-05-07 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/_set.h: fix definition of const/non-const iterators.
+ Thanks Ilya Chvetsov for report.
+
+ * test/unit/set_test.cpp: test that detect bug above.
+
+2004-04-27 Francois Dumont <dums@s...>
+
+ * stlport/stl/_complex.h: removal of a macro guard on the template != operator.
+
+ * test/unit/complex_test.cpp: creation of a test case for the complex class.
+
+2004-04-26 Francois Dumont <dums@s...>
+
+ * stlport/stl/_fstream.h, src/fstream.cpp: extension of the fstream interface to accept Win32
+ HANDLE on construction and in the open method.
+
+2004-04-26 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/_istream.h: don't change value while input error happens.
+ Thanks Nix.
+
+ * test/unit/sstream_test.cpp, test/unit/fstream_test.cpp: added test for error
+ flags and unchanged value when input error occur.
+
+2004-04-23 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/_rope.h: allow search of rope, like done in string
+
+2004-04-21 Francois Dumont <dums@...>
+
+ * stlport/stl/pointers/README: Creation of a documentation on the new
+ pointer partial specialization feature.
+
+2004-04-20 Francois Dumont <dums@s...>
+
+ * stlport/stl/_pair.h: modification of the make_pair signature. After the latest
+ Standard revision it takes params per value and not reference to const.
+
+2004-04-20 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/pointers/_list.h: 'clear' method was forgot.
+
+ * test/unit/list_test.cpp: check presence of 'clear'
+
+2004-04-15 Petr Ovtchenkov <ptr@Island...>
+
+ * test/unit/partial_test.cpp: wrong comparison during test
+
+ * test/unit/sort_test.cpp: ditto
+
+ * test/unit/rm_cp_test.cpp: #ifndef not required---should work
+
+ * test/unit/unique_test.cpp: ditto
+
+2004-04-14 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/typeinfo, stlport/config/stl_wince_4.h, stlport/stl/debug/_debug.c: adaptation for Win CE .NET;
+ Thanks Zdenek Nemec.
+
+ * stlport/stl/_algobase.h: calculate difference once
+
+ * stlport/stl/pointers/_vector.h: missed returns. Thanks KL.
+
+ * stlport/stl/pointers/_list.h: idem.
+
+ * stlport/stl/pointers/_deque.h: idem.
+
+ * stlport/stl/pointers/_slist.h: idem.
+
+ * stlport/stl/_vector.c, stlport/stl/_vector.h: big enough functions moved to non-inline section
+
+ * stlport/stl/_iterator.h: use reference instead of pointer for stored container
+
+2004-04-06 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/_prolog.h: when we in _STLP_REDEFINE_STD mode, we really
+ need to #undef std, see mistake 2004-02-19 below.
+
+ * stlport/config/stl_msvc.h: partially undo workaround 2004-03-30,
+ not required; problem was solved by #undef std in _prolog.h
+
+ * stlport/stl/_abbrevs.h: add new abbrevs---VC6 has problems in debug mode
+
+2004-04-03 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl_user_config.h: expose _STLP_DONT_FORCE_MSVC_LIB_NAME for
+ configuration.
+
+ * stlport/config/stl_msvc.h: incorporate content of stl_select_lib.h and
+ vc_select_lib.h; a bit cleaned.
+
+ * stlport/config/stl_select_lib.h: removed.
+
+ * stlport/config/vc_select_lib.h: removed.
+
+2004-04-02 Petr Ovtchenkov <ptr@Island...>
+
+ * src/time_facets.cpp: add #include <cstdio> for sprintf; remove
+ c_copy_string function.
+
+ * stlport/stl/_time_facets.h: fix for _STLP_LEAKS_PEDANTIC.
+
+2004-04-01 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/_string.h: reorder of in-class template and
+ quazi-specialization function make VC happy, ref. 2004-03-29
+
+ * stlport/stl/debug/_string.h: fix insert and replace for
+ iterators that refer to same string in _STLP_DEBUG mode.
+
+2004-03-31 Petr Ovtchenkov <ptr@Island...>
+
+ * src/explore/nmake-evc4-arm.mak, src/explore/nmake-evc4-x86.mak, etc.:
+ rules for eVC4 compilers---ARM and ix86 target architectures.
+ Contribution by Zdenek Nemec.
+
+2004-03-30 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/_algo.c: workaround for VC compilers---ones pass reference
+ to parent object directly, pay no regard for temporary object
+
+ * stlport/new, stlport/stl/_new.h, stlport/typeinfo, stlport/config/stl_msvc.h:
+ workaround for VC6's problem with 'using' directive, while import native
+ bad_alloc and some other classes into STLport's namespace
+
+ * stlport/stl/_streambuf.h: export template class, to make VCs to be happy.
+
+ * stlport/stl/_valarray.h: use <new>, not <stl/_new.h>
+
+ * src/explore/Makefiles/nmake/lib/macro.mak, test/unit/nmake-vc6.mak:
+ fix static library names
+
+2004-03-29 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/_set.h: fix problems with erase functions.
+
+ * stlport/stl/_string.h: VC compiler expect only one variant---template
+ or not---of replace function with four iterators in parameters.
+
+ * test/unit/nmake-src-prefix.mak: really know what do with sources
+ in cppunit.
+
+2004-03-25 Petr Ovtchenkov <ptr@Island...>
+
+ * stlport/stl/_string_base.h: enlarge default string static buffer size
+
+ * stlport/stl/debug/_string.h: avoid attempt to invalidate iterators beyond
+ string size range.
+
+ * stlport/config/stl_gcc.h: instantiation scheme that idefault used---witout
+ --repo option---in gcc 3 made void of sense explicit instantiation within
+ library---nothing except increased library size.
+ Define _STLP_NO_FORCE_INSTANTIATE is default now for gcc 3.x.
+
+ * stlport/stl/_streambuf.h: remove specialization of
+ basic_streambuf<char, char_traits<char> >---reference to FILE struct here
+ isn't required and really not used anyware. Functionality of standard io
+ streams, including synchronization with C std io streams provided in
+ src/stdio_streambuf.cpp
+
+ * stlport/stl/_iosfwd.h: same.
+
+ * src/fstream_impl.h, src/iostream.cpp, src/stdio_streambuf.cpp: same.
+
+ * src/streambuf.cpp: removed.
+
+ * stlport/stl/_stdio_file.h: moved...
+ * src/_stdio_file.h: ...here
+
+ * stlport/stdio_streambuf: moved...
+ * src/_stdio_file.h: ...here
+
+ * src/explore/Makefile.inc: remove streambuf.cpp
+
+2004-03-24 Petr Ovtchenkov <ptr@Island...>
+
+ * c_locale_glibc2.c: real locale implementation for glibc 2.3.x.
+
+2004-03-15 Petr Ovtchenkov <ptr@Island...>
+
+ * test/unit: unit test suite intended for test/regression replacement.
+ Zdenek Nemec contribution.
+
+2004-03-01 Francois Dumont <dums@s...>
+
+ * _hash_fun.h: Correction of the hash struct specialization for the _STLP_LONG_LONG
+ type. Thanks Vianney Lecroard
+
+ * type_traits.h: Integration of the boost (www.boost.org) type traits within STLport.
+
+2004-02-21 Francois Dumont <dums@s...>
+
+ * _tree.h: Modification of the base class implementtion to avoid the systematical
+ dynamic allocation of a node as the root note of the RB tree.
+
+ * Addition of many missing macro guards in the stlport public headers to avoid to break
+ the stlport prolog/epilog include framework.
+
+2004-02-19 Petr Ovtchenkov <ptr@Island...>
+
+ * _slist.h, debug/_slist.h,, dll_main.cpp: remove excess slist redefinitions
+
+ * debug/_slist.h: comment explicit usage of namespace with functions---under
+ some conditions this hangs gcc compilers.
+
+ * _config.h, _cwchar.h, _epilog.h, _iterator_base.h, debug/_debug.c: multiple import
+ of _STL namespace into std, as multiple import VENDOR_CSTD namespace into _STL
+ namespace lead to crash of gcc compilers. Import of _STL namespace into std
+ namespace done once in the _config.h, not in _epilog.h.
+
+ * _prolog.h: undef std not required in all cases; instead this is useful only
+ for redefinition of std namespace, and should be done in the _config.h.
+
+ * _epilog.h: include of _config.h has no sense here.
+
+ * _threads.h: wrong import of _STL namespace into global namespace
+
+2004-02-18 Francois Dumont <dums@s...>
+
+ * _list.h: Modification of the base list class based on the slist implementation.
+ The list do not allocate a node systematically anymore even for the empty list.
+
+2004-02-14 Petr Ovtchenkov <ptr@Island...>
+
+ * debug/_relops_cont.h, debug/_string.h: fix typos in template specializations.
+
+2004-02-12 Petr Ovtchenkov <ptr@Island...>
+
+ * explore/icc.mak: experimental make system support Intel's icc compiler
+ on Linux.
+
+2004-02-05 Petr Ovtchenkov <ptr@Island...>
+
+ * iostream.cpp, _ios_base.h, iostream, locale_impl.h, locale_impl.cpp:
+ revise standard iostream and locale initialization, remove worrits about
+ order of static objects initialization as soon as possible; all real
+ initialization situated in the locale_impl.cpp; locale initialization
+ moved to _Locale_impl constructor---locale will be correctly initialized
+ either via direct locale usage, or during standard iostream initialization,
+ as ios_base member. This changes may lead to problems with Digital Mars
+ and Borland compilers---should be checked and fixed.
+
+2004-02-03 Francois Dumont <dums@s...>
+
+ * integration of a portage to the Windows CE .NET (eMebedded Visual
+ C++ 4) compiler thanks Zdenek Nemek
+
+2004-02-02 Petr Ovtchenkov <ptr@Island...>
+
+ * _iostream_string.h: avoid usage of iostring in the _STLP_DEBUG mode,
+ due to iostring::iterator not convertable into string::iterator in this
+ mode.
+
+2004-01-29 Petr Ovtchenkov <ptr@Island...>
+
+ * _string.c: avoid 'insert( iterator, const_iterator, const_iterator )'
+ instantiation in the 'replace'---VC6 has problem here.
+
+2004-01-29 Francois Dumont <dums@s...>
+
+ * facets_byname.cpp: correction of the typeid use thanks to Ulrich Eckhardt.
+
+ * _iostream_string.h: creation and integration of a special string used within
+ the iostream implementation to display floating point numbers. It mixes a static
+ buffer with a dynamic one to improve performance.
+
+2004-01-22 Francois Dumont <dums@s...>
+
+ * _new.h: check of the _STLP_USE_EXCEPTIONS before correction of the new
+ operator behavior and bad_alloc exception definition.
+
+ * _ios_base.h: removal of the _M_get_facet function not fully implemented
+ and unused thanks Ulrich Eckhardt.
+
+ * _algo.h: correction of the __less_2 helper struct to remove
+ copy thanks Sergey Volk
+
+2004-01-19 Petr Ovtchenkov <ptr@Island...>
+
+ * _debug.c: avoid recursive locks in __owner_list's mutex---equivalent
+ code use underlie iterators, not debug wrapper iterators. By the way this
+ approach faster---no excessive checks; solved by Boris Fomitchev.
+
+ * _thread.h, _debug.h: recursive-safe mutex structure removed---not
+ required more; see reason just above.
+
+2004-01-09 Francois Dumont <dums@s...>
+
+ * type_manip.h: Correction of the _IsSame struct to have both partial template
+ specialization version and the other behaving similarly.
+
+2004-01-07 Francois Dumont <dums@s...>
+
+ * _deque.c: Mysterious copies of instance to store in the containers
+ has been removed.
+
+2004-01-05 Francois Dumont <dums@s...>
+
+ * _list.h, _slist.h: Implementation of the pointer specialization for list
+ and slist.
+
+2003-12-31 Petr Ovtchenkov <ptr@Island...>
+
+ * _vector.h, _vector.c, _hashtable.h: remove excess vector redefinitions
+
+ * debug/_vector.h: pointer specialization for vector not derived
+ from _Vector_base, so we should avoid references on _Vector_base
+ class members in debug wrapper.
+
+2003-12-22 Francois Dumont <dums@s...>
+
+ * _string.h: use _STLP_FORCE_STRING_TERMINATION flag to enforce
+ null-termination of data associated with string.
+
+2003-12-20 Francois Dumont <dums@s...>
+
+ * _vector.h: Implementation of the pointer specialization for vector to
+ avoid code bloat.
+
+2003-11-29 Francois Dumont <dums@s...>
+
+ * _string.h: Implementation of the short string optimization.
+ basic_string have now a short static buffer to avoid call
+ to the allocator when the string is short.
+
+2003-11-29 Petr Ovtchenkov <ptr@Island...>
+
+ * cwchar, _config.h, _cwchar.h, _stdio_file.h, c_locale.h:
+ support for OpenBSD, gcc 3.3.1
+
+ * src/explore/Makefiles/gmake/...: support for OpenBSD, gcc 3.3.1
+
+2003-11-17 Francois Dumont <dums@s...>
+
+ * _alloc.h: Move of the definition of _Alloc_Traits before inclusion
+ of _pthread_alloc.h; thanks Diego Klabjan
+
+2003-11-16 Petr Ovtchenkov <ptr@Island...>
+
+ * _algobase.h, _algo.c: iter_swap and __insertion_sort don't
+ properly deduce value type of iterator, instead uses dereference's
+ return type; this occur when dereference return some proxy object,
+ convertible into value type.
+ Thanks Przemek Kuczmierczyk <przemekk834@tlen.pl> for report, test
+ and solution.
+
+ * iterswp0.cpp, iterswp1.cpp, iterswp.cpp, stl_test.cpp,
+ stl_test.h, Makefile.inc (test/regression): move iterswp0_test,
+ iterswp1_test into iterswp.cpp, add new tests for properly deduce
+ value type of iterator, when dereference return some proxy object.
+
+2003-11-15 Francois Dumont <dums@s...>
+
+ * _string.h: implementation of the expression template for string
+ addition with other string or C string or char.
+
+ * _ostream.h: adoption of the classic (even if not clear in
+ the standard) ouput for short and int negative values in hexa
+ or octo bases that is display according its size for the compiler.
+ thanks Tanaka.
+
+2003-11-14 Petr Ovtchenkov <ptr@Island...>
+
+ * src/c_locale.c, src/c_locale_glibc/c_locale_glibc2.c: step to
+ real locales support with glibc >= 2.2.x
+
+ * src/c_locale_glibc/c_locale_glibc.c: bit fixes for locales
+ support with glibc < 1.90, and, possible, 1.90 <= glibc < 2.1;
+ we can't support this old code, so file
+ src/c_locale_glibc/c_locale_glibc.c is obsolete, and will be
+ removed.
+
+ * src/explore, test/regression/explore: exprimental make system.
+
+2003-11-13 Petr Ovtchenkov <ptr@island...>
+
+ * STLport (repository): current development moved to CVS HEAD stream.
+
+ * STLport (repository): current development stream marked as STLport 5.0.
+
+2003-11-02 Francois Dumont <dums@s...>
+
+ * _limits.c: Correction of the quiet and signaling NaN that was inverted
+ for several platform; thanks Alexey Sarytchev.
+
+2003-11-01 Francois Dumont <dums@s...>
+
+ * _string.c: judicious correction for string::find_first_not_of to
+ improve performance; thanks Stephen Cleary.
+
+ * _bitset.h: integration of a workaround for up to MSVC6 compilers
+ for the bitset input and output operators; thanks Jesse Booher.
+
+ * _ostream.h, _istream.h: fix of a non-standard behavior of the seekp
+ and seekg calls and conformance to the latest 2003 standard; thanks Tanaka.
+
+2003-10-26 Francois Dumont <dums@s...>
+
+ * _monetary.c: fix an other memory overrun on monetary display;
+ thanks Tanaka.
+
+2003-10-26 Petr Ovtchenkov <ptr@island...>
+
+ * ioiter.cpp, gcc.mak, stl_test.h, stl_test.cpp, stl_test.exp
+ (test/regression): tests for postfix increment operator and
+ indirection of istreambuf_iterator.
+
+2003-10-25 Petr Ovtchenkov <ptr@island...>
+
+ * _istreambuf_iterator.h: fix postfix increment operator
+ of istreambuf_iterator to provide conformance with
+ ISO/IEC 14882:1998(E), 24.1.1, p.511, i.e.
+ *r++ equivalent to { T tmp = *r; ++r; return tmp; }.
+ Thanks Tanaka for the report.
+
+2003-10-23 Francois Dumont <dums@s...>
+
+ * debug/: modification of the invalidation of iterators to avoid
+ invalidation of the end iterator for the associative containers,
+ hashed containers and list on calls to clear/assign/assignment
+ operator. (thanks Alexey Sarytchev)
+
+ * _rope.h: Correction of the rope::iterator and rope::const_iterator
+ copy constructor and assignment operator (thanks Bradley Grainger)
+
+2003-10-16 Francois Dumont <dums@s...>
+
+ * _alloc.h: Add of the throw() specification on allocator comparision.
+
+ * _iterator.h: Correction of the operator++(int) signature to conform
+ to the standard.
+
+ * _ctype.h: tolower and toupper for wchar_t types.
+
+ * _valarray.h: gslice_array::operator = (const value_type&) not
+ const anymore
+
+ * _valarray.h: slice_array idem
+
+ * _valarray.h: valarray<T> operator [](const gslice&) former version
+ was taking a copy of gslice
+
+ * _codecvt.h: correction of the default codecvt class definition and
+ correction of the out method
+
+ (all thanks Richard Peng)
+
+2003-10-16 Francois Dumont <dums@s...>
+
+ * debug/: add of the iterator range check on all container constructors.
+
+ * _string.h: correction of a bug on string auto referencing throught
+ some method like insert and replace. (thanks Tanaka)
+
+ * _valarray.h: correction of the missing slice_array copy constructor
+ and assignment operator in the private section (thanks Tanaka)
+
+2003-10-11 Petr Ovtchenkov <ptr@island...>
+
+ * _sstream.c: [io]?stringstream must do equivalent of seek at end,
+ after opened with ios_base::ate; this behaviour useful only when buffer
+ initialized by string; thanks Tanaka for the report.
+
+2003-10-06 Francois Dumont <dums@s...>
+
+ * _istreambuf_iterator.h, _ostreambuf_iterator.h: correction
+ of the missing iterator base class (Thanks Tanaka)
+
+2003-10-05 Francois Dumont <dums@s...>
+
+ * _string.h: correction of the replace implementation badling form
+ for self referencing
+
+ * _string.h, _string.c: Modification of the _M_copy method
+ to _M_move as basic_string do not correctly handled self referecing;
+ thanks Tanaka
+
+2003-09-25 Francois Dumont <dums@s...>
+
+ * como 4.3.0 on linux support (thanks Synge Todo and Karel Gardas)
+
+ * Quazy-leak patch: make memory detection tools happier,
+ option _STLP_LEAKS_PEDANTIC in _site_config.h. (thanks Petr Ovtchenkov)
+
+2003-09-19 Francois Dumont <dums@s...>
+
+ * Support of the Linux Intel C++ support (thanks Blaine Kubesh)
+
+ * FreeBSD support update (thanks Guy Middleton).
+
+ ----
+
+ * codecvt.cpp: charcode correction in the do_in method (thanks J Hamilton report)
+
+ ----
+
+ * _valarray.h: Correction of the missing explicit keyword in front of one of the valarray constructors
+ (thanks Stephen Clamage)
+
+ ----
+2003-08-10 Francois Dumont <dums@s...>
+
+ * stdexcept: Correction of the mysterious 50 messages from VC7.Net (thanks Krish S)
+
+ ----
+
+ * _vector.h: implementation of the max_size method based on the allocator::max_size method
+ (thanks Gennaro Prota from the boost forum).
+
+ ----
+
+ * _vector.c: add of the standard length_error exception to the reserve method (thanks Steven Youngs).
+
+ ----
+
+ * _alloc.h: add of a check of the number of element require to allocator::allocate to avoid a possible
+ size_type overflow (thanks Steven Youngs).
+
+ ----
+
+ * _istream.h: move of the ws implementation within the header to avoid undefined symbol
+ under NO_CUSTOM_IO mode (thanks Ulrich Eckhardt)
+
+ ----
+
+ * ctype.cpp : charcode correction (thanks Markus Stier reports and Alberto Barbati correction)
+
+ ----
+
+ * _function.h : all function can now be used in a non-const world (thanks Alexey Kirjushkin)
+
+ ----
+
+ * move constructor framework integration (thanks Francois Dumont)
+
+ ----
+
+ * containers interface correction for standard compliance when using explicit
+ intanciation of not default constructible type. (thanks Alexei Agafonov report)
+
+ ----
+
+ * iostream.cpp, locale_impl.cpp : static initialization made robust for case of
+ dynamic loader circular dependancies (Thanks Alexey Sarytchev for the report)
+
+ ----
+
+ * _function.h : integration of a new workaround for mem_fun_* family
+ for compiler having return void bug (Thanks Pavel Kuznetsov).
+
+ * stl_solaris.h : v8plus compilation fix (Thanks Mukesh Kapoor)
+
+ * num_put_float.cpp : FreeBSD fix
+
+ * _construct.h : fixed case for compilers with default integer
+ constructor bug
+
+ ---
+
+ * fstream.cpp : text file stream position bug correction (thanks Christopher Kohlert)
+
+ ---
+
+ * _num_put.c : Correction of the display of the min 64 bits signed integer values
+ like numeric_limits<__int64>::min() on WIN32 for instance (thanks Anders Dalvander)
+
+ ---
+ * _num_put.c : Add of the '+' sign when requested for the unsigned integer display
+ (thanks Francois Dumont)
+
+ ---
+
+ * debug : many missing iterator invalidation corrected (thanks Detlev V.Davidson and Francois Dumont)
+
+ ---
+
+ * _new.h : introduction of a new config compiler switch for those which do define
+ bad_alloc but that do not throw it! (thanks ?)
+ ---
+ * _new.h : class nothrow_t changed to struct nothrow_t (Thanks Francois Dumont)
+ ---
+ * _bvector.h : Addition of the |= and &= operator on the _Bit_reference struct (thanks Ed Rice)
+ ---
+ * Performance bug in type_traits.h fixed (Thanks Francois Dumont)
+ ---
+ * Added Linux spin lock code ()
+ ---
+ * Added GCC-3.x configurations
+
+ * Fixed HP aCC support
+
+ * Added OpenWatcom support
+
+ * version numbers bumped
+
+ * iostreams ported to EMX (gcc on OS/2) (Thanks Martin Schaffoener)
+
+ * iostreams ported to CRAY Unicos C90, T90, and J90 (Thanks Geir Johansen)
+
+ * stl_sunpro.h : fixed mbstate definition for SUN 4.2 (thanks lengzq)
+
+ * complex.cpp, _complex.h : template<> used for specializations
+
+ * _num_put.c : unused locale variable removed (thanks Petr Ovtchenkov)
+
+ * _algo.h : __reverse beautified (thanks Kabanov)
+
+ * dll_main.cpp : force_link() forced to be linked in
+
+ * stl_msvc.h : config changes for .NET
+
+ * _auto_ptr.h : "struct" changed to "class"
+
+ * _istream.c : M_read_unbuffered fixed (thanks Stefan Schwarzer )
+
+ * stl_gcc.h : added missing inclusion for SCO platform (thanks Emmanuel Soden)
+
+ * _tree.c : optimized insert_unique (thanks Timothy)
+
+ * _algo.c : relaxed type requirements for lower_bound, upper_bound, binary_search
+
+ * _algo.h : adjacent_find() expressed with compare-function flavour
+
+ * cpp_runtime/typeinfo : made adjustments for .NET (Thanks Daniel)
+
+ * cstd/cassert : guard removed (thanks Evan Cheng)
+
+The following changes were made in 4.5.3 since 4.5.1 release:
+
+ * iostreams ported to Windows CE (thanks Andrew Waters)
+
+ * iostreams ported to AmigaOS (thanks Steven Solie)
+
+ * iostreams ported to NCR 3.x (thanks Emmanuel Soden)
+
+ * _hash_map::operator[] : enhanced to avoid calling default object constructor
+ (Thanks Yuri Taranenko for the report)
+
+ * Identifier "__value" changed everywhere to "__val" to avoid clashes with Microsoft's "managed C++" keyword (thanks Crow for the report)
+
+ * Most containers : swap() fixed to swap non-stateless allocators correctly (thanks Scott Meyers)
+
+ * _sstream : fix to account for ios_base::app flag properly
+
+ * type_traits.h : _IsOKToMemCpy() fixed to only allow memcpy() for same type arguments (thanks Ed Brey for the report)
+
+ * stl/_num_put.c, stl/_list.c : workarounds for Debian gcc (thanks Levente Farkas)
+
+ * <typeinfo> : fixed MS workaround (thanks Wil Evers, Andrew Ushakov)
+
+ * _pthread_alloc.h : added per_thread_allocator class; returns memory to the same thread it's been allocated in.
+
+ * _iterator_old.h : restored ->() operator for MSVC (thanks Daniel Anderson)
+
+ * a bunch of MPW fixes (thanks Tsutomu Yoshida)
+
+ * _config_compat.h : fixed compatibility definition for _STLP_NO_EXCEPTIONS (thanks Nicolas)
+
+ * _fstream.c : fixed bug in _M_seek_init (thanks Pavel Kuznetsov)
+
+ * _rope.h : rope<>::swap() methods fixed for non-partial ordering case (thanks Eric Musser)
+
+ * comlex_trig.cpp : fixed bug on SGI (thanks Mortis)
+
+ * A bunch of fixes for HP aCC compilation with -AA option (thanks John Bossom)
+
+ * *.c files : added conditional inclusion of corresponding *.h file to fix xlC issues with -tempinc option (thanks Alla Bogolyubov for the report)
+
+ * _auto_ptr.h : "struct" changed to "class" (thanks Alex Pinsker for the report)
+
+ * _config.h/stl_user_config.h : handling of macro _STLP_WHOLE_VENDOR_STD rectified
+
+ * _num_put.c : do_put(const void*) changed to output pointers in hex format (thanks Alex Rosenberg)
+
+ * test/eh/test_algobase.cpp : fixed alignment to work on 64-bit architectures
+
+The following changes were made in 4.5.1 beta 1 since 4.5 release:
+
+ * _config.h, _epilog.h : new namespace inclusion schema implemented for own iostreams mode
+ (no std:: redefinition; _STL:: namespace imported into std::, instead of std:: imported to _STL.
+ C library header files wrappers become obsolete if this mode is used and no own namespace is selected.
+ They will be moved out to distinct directory in the next release, and default is going to be no own namespace
+ with own iostreams.)
+ For some compilers (VC6), this only works with _STLP_NO_OWN_NAMESPACE and _STLP_OWN_IOSTREAMS settings.
+
+ * iostreams ported to SCO OpenServer (thanks Emmanuel Soden)
+
+ * sparc_atomic.s : added "stbar" to fix multiprocessor crashes on SPARC
+
+ * dll_main.cpp : forced link of Bs_G static data members (thanks Sandy Martel). Function wrapped in STLport namespace.
+
+ * _alloc.c : fixed _STLP_CHUNK_MALLOC for debug malloc configuration (thanks Markus Sch pflin)
+
+ * _config_compat.h : fixed compatibility section for _STLP_NO_OWN_IOSTREAMS
+
+ * fstram.cpp , vc6.unicode.mak : fixed bug in wide streams handling for VC6 (thanks Jim Dolter)
+
+ * etc/*.txt : files list broken up into several categories for future reorganization
+
+ * stl_msvc.h : fixed library selection for .NET (Thanks Franz Zetting)
+
+ * _ftsream.h, iostream.cpp : fixed compilation for _STLP_NO_EXTENSIONS case (thanks Ben Dorman for the report)
+
+ * char_traits.h : fpos<> operators == made members (thanks Thomas Witt)
+
+ * _threads.h : added using directive for Solaris x86 compile (thanks Mukesh Kapoor)
+
+ * _threads.h : fixed InterlockedXXX definitions for VC++ 6.0 SP5 (thanks AndreasM)
+
+ * gcc-install-apple-macosx.mak : INSTALL_STEP set to install_unix (Thanks Tron Thomas)
+
+ * common.mak : default install directory for Unix set to /usr/local
+
+ * _string.h : _M_null expressed via _STLP_DEFAULT_CONSTRUCTED (Thanks Anthony)
+
+ * _site_config.h : made sure _STLP_NO_THREADS are set if _NOTHREADS is on (Thanks Jeppe Madsen)
+
+ * _config.h : _STLP_WIN32THREADS is set (bugfix) ( thanks to Andreas Malzahn )
+
+ * _num_put.c, common_rules.mak : patches by Levente Farkas
+
+ * etc/STLport-4.5.1.spec : spec file to build STLport-4.5.1 RPM added (thanks Levente Farkas)
+
+ * _auto_ptr.h , _debug.c, _debug.h : debug check for auto_ptr pointer added (thanks Gerd Hoeren for the idea)
+
+ * debug/_vector.h : invalidation for erase() corrected not to invalidate current iterator (Thanks ALberto Barbati)
+
+ * stl_bc.h : restored automatic library link directive for cases when STLport is not a native library
+
+
+ * _auto_ptr.h : template constructor conversion bug fixed (thanks mbergal)
+
+ * MIngw32 patches integrated (thanks Wu Yongwei)
+
+ * src/complex_impl.h : case for DEC CXX changed to general, instead of extension functions for float and long double, to get it compliled with CC 6.1 (thanks Tony McConnell)
+
+ * dll_main.cpp : added __malloc_alloc instantiation (thanks Michael Ehrig)
+
+ * _debug.c : fixed race condition in _M_detach (thanks Achim Stremplat)
+
+ * test/*/hpacc.mak : fixed flags and libs (thanks Michael Ehrig)
+
+ * typeinfo : added fix for MS VC ::bad_cast confusion (thanks Alberto Barbati)
+
+ * debug/_vector.h : removed extra guard for MSCV around member template constructor (thanks Alberto Barbati)
+
+ * _fstream.h : added extension basic_fstream<> constructors taking protection parameter (thanks Mukesh Kapoor for the idea)
+
+ * stl_sunpro.h : added additional C include directory choice for Solaris 6&7 (thanks John E. Bossom)
+
+ * _vector.c : added _vector.h inclusion for _STLP_LINK_TIME_INSTANTIATION case (thanks Alex Vanic)
+
+
+ * _num_put.c : fixed overflow case with grouping (thanks Will Evers)
+
+ * _istreambuf_iterator.h : fixed distance_type return type (thanks Anthony Williams)
+
+ * debug/_vector.h : debug version of push_back() added (thanks)
+
+ * Iostreams ported to LynxOS 3.0 (thanks Dmitry Azovtsev)
+
+ * wrappers/*.h : added inclusions of the master header to fix xlC 3.x compile (Thanks Dmitry Azovtsev)
+
+ * Changes for BCB6 integration (thanks Nathan York)
+
+ * Removed all dead code blocks marked by #if OBSOLETE and #if 0
+
+ * Updates build spec file for Linux rpm (thanks Levene Farkas, Harold van Oostrom)
+
+ * complex_trig.cpp : limits changed to be static, for performance optimization (thanks Sergei Nikolaev)
+
+ * _algo.c : eliminated default-constructed iterators, to lift unnecessary restriction (thanks Tonci Tomic )
+
+ * _vector.h : fixed bug in assign() : copy used instead of __copy_aux (Thanks Tim Finer)
+
+ * stl_sunpro.h : restored _STLP_HAS_NO_NEW_C_HEADERS switch for SUN CC 4.2
+
+ * <new> : __stl_new definition put into the namespace (thanks Satoshi Nakamura)
+
+ * bcb*.mak : fixed md command and DYN_LINK (thanks Kirby Zhou)
+
+ * stl_user_config.h : added _STLP_USE_CUSTOM_CHAR_TYPES_IO switch to optimize iostreams for default case
+
+ * debug/_vector.h : fixed debug check bug (thanks Gerd Hoeren)
+
+ * _alloc.h : allocator::construct uses std::_Construct (thanks Gert Grossmann)
+
+ * stl/_alloc_old.h : restored (thanks Gert Grossmann)
+
+ * stl/_threads.h : fixed _STLP_ATOMIC_xxx macros for DEC (thanks Gert Grossman)
+
+ * src/_locale_impl.cpp : added missing guards for codecvt<> in _STLP_NO_MBSTATE_T case
+
+
+The following changes were made in 4.5 release since 4.5 beta 8 :
+
+ * _threads.h, debug/_debug.h etc : STLport iostreams library made binary compatible with user code compiler w/o multithreaded switch, for some platforms
+
+ * config/stl_msvc.h, <cmath> : corrected _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS for VC++ 6.0 SP5
+ (Thanks Alberto Barbati)
+
+ * src/vc6.mak : RC macro definition restored (Thanks Graham)
+
+ * stl/_cmath.h, <cmath> : parts of code moved to <cmath> as <valarray> uses it (Thanks Synge Todo)
+
+ * stl/_tree.c : fixed insert_unique() with a hint bug (Thanks Serge Pashkov)
+
+ * src/gcc-*.mak : removed -nostdinc++ option
+
+ * stl_solaris.h : definition of _STLP_SUNPRO_EXCLUDE made dependant on _XOPEN macro instead of SUN CC macros (Thanks ecohen for the report)
+
+ * fstream.cpp : mmap_chunk made to be 1M instead of 16M as was originally intended (thanks Alexey Starikovskiy)
+ * stl_sunpro.h : _STLP_LIMITED_DEFAULT_TEMPLATES not defined for compat mode anymore ( thanks Michael Kopp)
+ * dll_main.cpp : added instantiation for _Swap_lock_struct<> (thanks simonb)
+
+ * _ostream.c : fixed formatting bug for width()==1
+
+ * config/_epilog.h : added option pop section for Borland.
+
+ * stl/_threads.h : fixed InterlockedXXX declarations for MS .NET (thanks Piers Haken)
+
+ * vc7.mak makefile added for MS VC++ 7.0 (.NET)
+
+ * fixed _STLP_ITERATOR_CATEGORY, etc. for Mwerks CodeWarrior 5.0
+
+ * stl/_num_put.c : fixed operator<<(void*) to use _STLP_LONG_LONG where available.
+
+ * _STLP_WHOLE_VENDOR_STD option is back supported (Thanks anton ephanov for the input)
+
+ * _cmath.h : added guard to mask additional overloads (thanks Tim Smith)
+
+ * stl_solaris.h : mbstate_t stuff defined here, old-style C headers used (Thanks Mukesh Kapoor)
+
+ * type_traits.h : __default_constructed() inlined (Thanks Matt Davies)
+
+ * new.h : fix for gcc-3.0 to look in backward directory (Thanks Ken)
+
+ * stlport/using/h/streambuf.h added (Thanks Gennadiy)
+
+ * A bunch of changes for Borland static and DLL compile (Thanks Nathan York)
+
+ * stl/_algo.c : fixed find_end() bug (Thanks Alberto Barbati)
+
+ * stl/_queue.h : priority_queue<>::_comp renamed to "comp" as standard states (thanks Todd Greer)
+
+ * _limits.c : added correct data member representations for AS400 and Alpha machines (thanks Holger Stash)
+
+ * _vector.h : added check to avoid calling allocator<>::deallocate(0) (thanks Stephen Cleary)
+
+ * config/_prolog.h, config/_epilog.h : added push/pop pack(8) pragmas for MSVC (thanks Todd Greer, Alberto Barbati)
+
+ * gcc.mak's : default spelling for "-pthreads" option changed to "-pthread" as more platforms use that.
+
+
+The following changes were made in 4.5 beta 8 since 4.5 beta 7 :
+
+ * stl/_fstream.c : _M_underflow bug fix for custom codecvt facets (thanks Alberto Barbati)
+
+ * bcc55.mak : c_locale.c added to the link command (thanks Steve Loves)
+
+ * _iterator_base.h & many other places : iterator tags are being accepted by const reference
+ instead of value, to fix segmentation faults experienced on certain platforms with beta7.
+ That also should improve efficiency on same platforms (apparently, empty unreferenced
+ objects with no constructors/destructors were copied on the stack when passed by value).
+ Accompanied change eliminates hardcoded deference hack used in previous beta.
+ Thanks everybody who reported this.
+
+ * stl_user_config.h : added _STLP_GCC_USES_GNU_LD switch. This is for those platforms
+ where native linker does not let gcc to implement automatic instantiation of static
+ template data members (Tru64, AIX, HP-UX).
+ It is being put in this file as there is no automatic way to check if we are using GNU ld or not.
+
+ * _range_erors.h : depandancy on <stdexcept> and <string> removed for own iostreams mode
+ (thanks Doug Gilbert)
+
+ * debug/_list.h : "typename" added in new methods (thanks Doug Gilbert)
+
+ * _config.h, src/common_macros.mak : beta version number bumped
+
+ * src/ftream.cpp, c_locale_win32.c : fixes for UNICODE compilation (thanks Valo)
+
+ * stl_gcc.h, etc : changes for GCC support on Tru64 (thanks Tobias Ernst)
+
+ * _alloc.c : for MS VC, malloc_dbg only used when _STLP_DEBUG_ALLOC is set, not for all debug configs
+ (Thanks Anton Ephanov)
+
+ * test/eh/gcc.mak : directories stuff fixed (Thanks Brodie)
+
+ * stl/_complex.h : fixed declarations for long double specializations (Thanks Tsutomu Yoshida)
+
+ * locale_byname.cpp, etc. : fixes for Apple compilers by Tsutomu Yoshida.
+
+ * _ios_base.h : __evenk id changed not to clash with MS VC++ 7 (thanks Paul Ghezzi)
+
+ * _fstream.c : added basic_filebuf constructor workaround for compiler which do not initialize builtins
+ to zero when default constructed (thanks Alberto Barbati)
+
+ * _locale.h : relaxed guerd around templated locale constructor (thanks Alberto Barbati)
+
+ * stl_mwerks.h : changes to accomodate CodeWarrior 6.2 (thanks cprosser)
+
+ * stl/_cmath.h : extracted from <cmath> for better decoupling
+
+ * stl/_std_prolog.h, stl/_std_epilog.h : hooks for future alternative namespace inclusion style.
+
+ * config/stl_gcc.h : gcc-3.0 now supported
+
+ * src/gcc-beos.h : only static library is being built (dynamic stil don't work) (thanks John Maddock)
+
+ * using/iostream : included using/istream and using/ostream
+
+ * dll_main.cpp : force_link() fix to prevent numeric_limits static members and
+ _M_increment/decrement from _tree.c from being optimized out by VC++
+ (thanks Sofus Mortensen, Alberto Barbati )
+
+ * _alloc.c : added CHECK_NULL_ALLOC for _STLP_CHUNK_ALLOC with malloc, to throw exception if malloc returns 0 (thanks ghunt)
+
+ * stl_bc.h, <exception> : fixed Borland C++ import of unexpected handler stuff
+
+ * stl_ibm.h, etc. : fixes for IBM VisualAge 5.02 to compile
+
+ * type_traits.h : bool2type<> changed to be parameterized on int, to work around SUN CC bugs (probably others, too)
+
+The following changes were made in 4.5 beta 7 since 4.1 beta 6 :
+
+ * sparc_atomic.s : file missing from the distribution restored
+
+ * etc/ subdirectory created; miscellanous files moved there
+
+ * STLport ported to BeOs, complete with iostreams (thanks John Maddock)
+
+ * Macro _STLP_NO_SGI_IOSTREAMS renamed to _STLP_NO_OWN_IOSTREAMS, old references to SGI removed;
+
+ * "prepare" target added to all makefiles in src/; should be run before using STLport;
+ on most platforms it's empty, on some of them it creates necessary symbolic links, etc.
+
+ * stl/_deque.h : deque<>::erase bug (introduced in 4.1b4) fixed (thanks to BruceFlorman)
+ : default parameter in constructor bug fixed (Thanks to Alex Vanic)
+
+ * stl_msvc.h : explicit template function agruments enabled for VC++;
+
+ * stl_wince.h : added <windows.h> inclusion
+
+ * stl/_limits.h : numeric_limits<bool>::digits changed from 0 to 1 (Thanks Mukesh Kapoor)
+
+ * stl/_function_base.h : added __identity_element() (extension name), _numeric.h : this one used instead of identity_element() (Thanks Hafeez)
+
+ * stl_msvc.h : explicit template function agruments enabled for VC++;
+
+ use_facet<> now fully conforms to the standard with VC++. (Thanks Jeff Kohn for the input)
+
+ * fstream.cpp : LARGE_INTEGER used to work around Intel shift instruction bug (thanks Thomas Meischner)
+ * fstream.cpp : ULL macro fixed for Win32
+ * fstream.cpp : Added test for for INVALID_HANDLE_VALUE and NULL base and _M_view_id,
+ for _M_close on Win32 (Thanks Stephen Baker)
+ * fstream.cpp : Fixed corner case with mmap() on EOF (Thanks Jens Maurer)
+
+ * _istream.c : fixed _M_read_buffered sssso that it does not skip delimiters (Thanks Gerd Hoeren)
+
+ * stl/_string.h : operator __std_string() uses constructor with a size to correctly initialize string containing null chars (Thanks Armin)
+
+ * iomanip : added operator for setfill object and istream (was ostream only) (Thanks Mukesh Kapoor)
+
+ * stl/_locale.h , stl_intel.h : fixes for Intel 5.0 compiler (Thanks Anton and Marcello Pietrobon)
+
+ * stl_solaris.h : added _STLP_NO_NATIVE_WIDE_FUNCTIONS
+
+ * New makefiles added for Intel C++ 5.0 and VC++ 6.0 in src/, test/eh, test/regression (Thanks to Marcello Pietrobon)
+
+ * _STLP_NO_LONG_DOUBLE case handled for STLport iostreams as well (thanks John Daniel)
+
+ * SUN CC compiler template cache is being properly cleaned up (Thanks Whitney Kew)
+
+ * dll_main.cpp : added extern "C" around DllMain() (Thanks Danny Smith)
+
+ * type_traits.h : added bool parameter to shut up warnings on some compilers (Thanks glassman)
+
+ * stl/_rope.h/.c, src/mrcpp.mak, src/mrc.mak, stl/_tree.h : MPW & MRC fixes by Tsutomu Yoshida
+
+ * stl_gcc.h : added path for <exceptions> et al for gcc-2.95.3 on FreeBSD (Thanks to
+
+ * _tree.h /_tree.c : pointers used as return values instead of iterators for implementation
+ functions, for efficiency.
+
+ * _algo.h/.c : added leading underscrore to some symbols (Thanks to Ed James-Beckerman for the report)
+
+ * dll_main.cpp : fixed nothrow object initialization (Thanks to Dan Ingold)
+
+ * beta suffix in common_macros.mak updated (thanks to Whitney Kew)
+
+ * c_locale_win32.c : incomple fix for locale completed (thanks to Alberto Barbati)
+
+ * c_locale.h : _Locale_ALPHA definition for VC++ and mingw32 fixed (thanks Danny Smith)
+
+ * _threads.h : fixed _DECTHREADS block to work on both DEC and HP
+
+ * _hash_set.h : fixed typo in MSVC++ bug workaround ( Thanks to Jon_Hanson for the report)
+
+ * stlport/strstream.h : fixed inclusion for MSVC 6 (Thanks Joachim Achtzehnter)
+
+ * _config.h : _STLP_RETHROW changed to avoid warnings with NO_EXCEPTIONS (thanks Richmond)
+
+ * _hashtable.c : prime list definition made consistent (thanks Rainer Schnitker)
+
+ * stl_hpacc.h : _STLP_FORCE_ALLOCATORS workaround used for Version 3.15 also (thanks Rainer Schnitker)
+
+ * stl/_string_io.c : fixed using directive in operator >>() (thanks Rainer Schnitker)
+
+ * debug/_deque.h : a check in erase() fixed (thanks Andreas Malzahn)
+
+ * debug/_list.h : added remove() to do iterator invalidation; range erase() fixed to do invalidation
+
+ * stl_watcom.h : added switches; disabled own iosterams by default;
+ enabled ->() operator for iterators (thanks Steven Green)
+
+ * <exception> : added throw spec for what(); stl_sgi.h : made _STLP_NO_EXCEPTIONS depend on __EXCEPTIONS macro (Thanks Anton Ephanov)
+
+ * _string_io.c : operator << : fixed width() interpretation bug
+
+ * stl_hpacc.h/cmath : fixed HP aCC settings for -AA option (thanks Doug Gilbert)
+
+
+
+The following changes were made in 4.1 beta 6 since 4.1 beta 5 :
+
+ * _istream.h, _ostream.h, _ios.h, _fstream.h : guard macros fixed to not clash with .h files in "stlport" directory
+ Also all uses of those macros fixed. (thanks to Gerd Hoeren for the report)
+
+ * _debug.c/_debug.h : fixed swap() for rb_tree and list (thanks to Gerd Hoeren for the report)
+ swap() changed not to invalidate any iterators, as prescribed by the standard
+
+ * forced _REENTRANT to be defined when compiling with STLport iostreams and _STLP_DEBUG
+ (without _STLP_DEBUG it seems to be binary compatible even without that)
+
+ * facets_byname.cpp source introduced to replace all xx_byname.cpp files;
+ restored separate facets .cpp complilation (they used to be included in locale_impl.cpp)
+
+ * introduced _STLP_USE_PERTHREAD_ALLOC to optionally use per-thread allocator
+ (_Pthread_alloc from _pthread_alloc.h) as the deafult node allocator. Only works with pthreads for now.
+
+ * Switches _STLP_DONT_REDEFINE_STD and _STLP_WHOLE_VENOR_STD are back (thanks to Anton Ephanov for the report)
+
+ * _vector.h : fixed bug in template version of insert (Thanks to Yotam Medini for the report)
+
+ * monetary.cpp : unneded hack for cygwin removed (thanks to Dean Sturtevant)
+
+ * <iostream> : fixed _STLP_OUTERMOST_HEADER_ID macro
+
+ * cin/cout/cerr redefined if no namespaces and SGI iostreams are used, for all compilers, just in case.
+ * _sparc_atomic.h : fixed and improved atomic ops for gcc
+
+ * test/regression : non-backward-compatible old-style __STL_xx macros use changed to _STLP_xx
+
+ * config/st_gcc.h : disabled non-standard "extern" use for non-DLL templates
+
+ * mingw32 - used 'windows.h replacement' section in _threads.h (thanks to Danny Smith)
+
+ * locale Win32 bug fixed (thanks to Alberto Balbarti)
+
+ * mingw32 : _STLP_CONST_INIT_BUG defined for dll (thanks to Danny Smith)
+
+ * "make clean" glitches fixed (thanks to Whitney Kew for the report)
+
+ * _fstream.c : fixed codecvt bug for variable width encoding
+
+ * _STLP_ABORT macro introduced to avoid clashes with third-party sw redefining abort() (thanks to Jerry)
+
+ * c_locale_win32 : fixed parse bug in __ParseLocaleString (thanks to Danny Smith)
+
+ * extra declspecs removed from templates to fix VC++ 7.0 ; only concrete classes have specifiers (thanks to Holger Stasch for the report)
+
+ * stl_msvc.h, _hashtable.h/.c : fixes for IA64 compilation (thanks to Rainer Schnitker )
+
+ * fixed bugs in "make install" on Unix (thanks to Carlos Paniago)
+
+ * dll_main.cpp : DisableThreadLibraryCalls used for optimization (thanks to Alberto Barbati)
+
+ * dll_main.cpp : a dummy function added to force <limits> guts for static VC++ link (thanks to Alberto Barbati)
+
+ * gcc-linux.mak : flags fixed (thanks to Levente Farkas )
+
+ * stl_msvc.h, stl_intel.h : fixed __ICL version test (thanks to Serge Pashkov)
+
+ * versioning schema changed on Windows to have .dll extension (thanks everybody for the feedback)
+
+ * NetBSD makefiles fixed
+
+ * A bunch of fixes by Tsutomu Yoshida : MPW fixes plus :
+ * stl/_config.h : I believe the definition for _STLP_STD under debug/non-debug configurations swapped.
+
+ * typeinfo.h : added check for _STLP_NO_NEW_HEADER for using declaration.
+ Otherwise three classes will not be included in the namespace std when #include <typeinfo>.
+
+ * _istream.c : use of bind2nd (which required _function.h inclusion) changed to use alternate functor (thanks to Sergei Nikolaev)
+
+ * stl_msvc.h : removed erroneous _STLP_USE_TEMPLATE_EXPORT setting which caused major code bloat for native streams builds on VC++ (Thanks to Johannes Brunen for the report)
+
+ * _string_io.c : fixed Intel C++ compilation bug in native streams mode
+
+ * fstream.cpp : added write-sharing for fstream file handle (Thanks to Leland Best)
+
+ * stl_gcc.h : disabled wide function imports for linux (some xx_POSIX macro should be really used; disabled for all linuxes for now). Thanks everybody for the reports.
+
+ * KAI C++ 4.0 is now supported on SUN
+
+ * MAC OS X compilation fixed (thanks Patrick Luby for the patch)
+
+ * HP aCC fixes by Michael Tsirkin
+
+ * "INF/NAN" string representation for uppercase changed to "Inf/NaN" to behave like printf() on most systems.
+
+ * debug/_iterator.c : fixed SUN 6.0 compiler internal error
+
+ * typeinfo.h : global scope used to import bad_cast, etc. (thanks to Val Melamed)
+
+ * debug/_list.h : missing template versions of remove_if(), merge() added. Missing regular sort() added.
+ (Thanks to dgehri)
+
+ * debug/_slist.h : missing sort() (template and regular) interface added
+
+ * _istream.h : eliminated warning about comparison with unsigned (Thanks to Gerd Hoeren for the report)
+
+ * template constructors for containers changed to be one version with default allocator agrument, where possible.
+
+ * remaining _STL_ prefixes changed to _STLP_
+
+ * Solaris 7 compilation fixed
+
+ * fstream.cpp : seek() allowed to seek past the end of the stream (Thanks to Phillip Toland for the input)
+The following changes were made in 4.1 beta 5 since 4.1 beta 4 :
+
+ * All internal macros changed to have prefix _STLP_ instead of __STL or __STLPORT or __SGI_STL.
+ That is to allow seamless wrapping on platforms that use SGI STL as native STL/iostreams.
+ For backward compatibility, most of user-settable __STL_xxx macros are accepted.
+
+ * Versioning of shared libraries made UNIX-compliant
+
+
+ * Some temporary lifetime problems in SGI iostreams which may introduce memory corruption, fixed.
+
+ * <new> : fixed memory leak bug due to unclever macro expansion in __stl_new (thanks to Joachim Achtzehnter)
+
+ * stl/_tree.h : fixed several bugs in new code for corner cases in insert_equal()/insert_unique() with a hint
+ (thanks to Micheal Tsirkin for the report and patch)
+
+ * _vector.h:284 : __copy call fixed to be __copy_aux (thanks to Alex Vanic)
+
+ * _config.h : fixed static build bug due to __STL_EXPOSE_GLOBALS_IMPLEMENTATION typo (thanks to Serge Pashkov)
+
+ * fstream.cpp: __pioinfo definition for mingw32 fixed (Thanks to Danny Smith)
+
+ * *.SUNWCCh files changed to regular files; moved to "stlport" directory
+
+ * pthread_alloc : split into <pthread_alloc>/<stl/_pthread_alloc.h>
+
+ * lightweight atomic ops used on SPARC v8plus and v9 (gcc and SUN CC)
+
+ * Mac OS X support introduced (thanks to Patrick Luby)
+
+ * SGI iostreams ported to DJGPP (thanks to Tanes Sriviroolchai)
+
+ * SGI iostreams ported to NetBSD (thanks to Michael Rauch)
+
+ * FreeBSD build fixed, now builds for wchar_t too
+
+ * DEC CXX build fixed; restricted to dynamic lib only
+
+ * SGI MIPSpro build fixed; GNU make has to be used
+
+ * Set of HP fixes by Michael Tsirkin
+
+ * Set of Watcom fixes by Ricardo Gayozo
+
+ * Bunch of Apple MRC/MPW fixes by Tsutomu Yoshida integrated
+
+ * Bunch of iostream fixes for Cygwin, Borland and Intel 4.5, by Serge Pashkov
+
+ * debug/_list.h : added checking versions of pop_back/pop_front (thanks to Per Liboriussen)
+
+ * src/c_locale_win32.c : fix for VC5sp3 (thanks to Petr Ovtchenkov), fix for day of week order (thanks to Danny Smith),
+ fix for null-termination in my_ltoa (thanks to Serge Pashkov)
+
+ * Some warnings in debug mode fixed (thanks to Marco)
+
+ * type_traits.h : IsP functions return types changed to be more portable (thanks to Serge Pashkov for the suggestion),
+ __cdecl added for Win (thanks to Todd Wilson)
+
+ * debug/_tree.h : added owner check for erase() (thanks to Alberto Barbati)
+
+ * stl/_ostream.h : << operator specializations added for compilers w/o partial ordering
+ (thanks to Alberto Barbati for pointing this out).
+
+ * "make install" on UNIX : fixed the target not to remove lib directory;
+ default installdir restored to be /usr/local (thanks to Jeff de Vries for the input)
+
+ * _construct.h : extra cast for __STL_SHRED_BYTE removed (thanks to khesin)
+
+ * _relops.h header obsoleted; some extra includes removed
+
+ * __STL_STATIC_CONST_INIT_BUG use normalized; now it's used for all compilers not able
+ to treat const members as coplile-time constants; enum used for them (e.g VC++).
+ Thanks to Dean Sturtevant and Gavin Collins for the ideas.
+
+ * stlport/cmath : fixed SUN CC 5.0 compatibility mode bug (thanks to ade for the report)
+
+ * debug/_hashtable.h : fixed equal_range() bug (thanks to decraft for the report)
+
+ * streambuf.cpp/_streambuf.h : fixes xsgetn() bug (thanks to Vadim Egorov)
+
+ * istreambuf_iterator<> : nonconforming behaviour fixed (thanks to Tom Widmer)
+
+ * _num_put.c : fixed corner case for 0x8000000 output.
+
+ * num_get<> : extra get() and do_get() members for "int" and "short" removed; istream operators changed accordingly
+
+ * _itreambuf_iterator.h/_ostreambuf_iterator.h introduced to decouple those from num_get/num_put
+
+ * gcc makefiles in src : "-fno-implement-inlines" removed
+
+ * Added workaround for gcc's limits.h and SUN Ultra with -mcpu=ultrasparc in 32-bit mode.
+
+ * ios_base:: type for constants made "int" for all compilers, as it more efficient and perfectly compliant.
+
+ * debug/_hashtable.h : fixed typo in swap() ( thanks to Gerd Hoeren for the report)
+
+ * debug/_string.h : +() operators defined unconditionally ( thanks to Gerd Hoeren for the report)
+
+ * _istream.c : removed dependancy on _function.h (thanks to Kenny Simpson for the report)
+
+ * _limits.c : fixed little-endian representation of infinity & NaN (thanks to Rene van Oostrum)
+
+ * _stdio_file.h : fixed postdecr macro for 64-bit Solaris (thanks to Jim Cole)
+
+
+The following changes were made in 4.1 beta 4 since 4.1 beta 3 :
+
+ * Simulation of class partial specialization (thanks to Mat Marcus and Jesse Jones of Adobe)
+ used to provide following enhancements :
+
+ - type_traits are automatically specialized for all pointer types for all compilers,
+ which makes them able to utilize type_traits-based optimizations when dealing with pointer types,
+ automatically.
+
+ - all functions specialized for pointers and optimized via __type_traits
+ ( like copy()/copy_backward(), _uninitialized_xx) now enjoy this optimization for all compilers!
+
+ - generic __value_type()/__difference_type()/__iterator_category() are written so user does not have
+ to supply any of its own even when partial specialization is not available.
+ (Note : gcc-2.7 and VC++ 5.x, 6.x have bugs which prevents them from using this enhancement, still)
+
+ * <iterator> : by default, non-standard iterator query names like
+ value_type()/difference_type()/iterator_category() are not used
+
+ * <algo> : major revision:
+ - algorithms without explicit Compare() function expressed via the one that has it where possible.
+ This considerably reduces header size and reduces code bloat for programs which use both flavours of
+ those algorithms.
+ - some function bodies moved between .c and .h
+ - all functions used internally moved out to _algobase.h, so no other header includes <_algo.h> anymore
+ - find() specialized for random access iterators regardless of partial spec.
+
+ * Dynamic libraries (.DLL and .so) : name versioning used to prevent clashes between STLport versions
+
+ * src/ : code regrouped between .cpp files to provide for less executable size with dumb linkers;
+
+ * locale subsystem initialization : startup changed to use statically allocated structures as much as possible;
+
+ * <stl/_function.h> : basic stuff moved to _function_base.h ;
+ other STL headers now include _function_base.h instead
+
+ * _threads.h : MT support for OS/2 added (only tested with VAC++)
+
+ * _stdio_file.h : added support for Solaris in ELF64 mode (thanks to Holger Stasch)
+
+ * stl/_hashtable.h : [] operator for hash_map optimized to take no more than find() when element is present
+ (Thanks to Thomas Witt et al.)
+
+ * _ostream.h : fix for default unsigned char (thanks to Holger Stasch)
+
+ * all __STL_ABBREVS abbreviations moved aside in _abbrevs.h header.
+
+ * Fujitsu C++ Compiler support added (thanks to Holger Stasch)
+
+ * Initial SGI iostreams port to OS/390 introduced (thanks to Holger Stasch).
+
+ * More on SGI iostreams port to xlC 5.0 (thanks to Holger Stasch).
+
+ * Fixes for SGI MIPSpro compilers (Thanks to Ralph)
+
+ * Fixes for HP aCC compiler (Thanks to Michael Tsirkin)
+
+ * stlport/SC5 directory : removed C library .h files to fix circular inclusion problem with WS6.0 + C programs.
+
+ * hash_map::swap() in debug mode fixed (thanks to Anton)
+
+ * __STL_COMPILE_INSTANTIATE hack for DEC removed (thanks to Ralph)
+
+ * __STL_INLINE_STRING_LITERAL_BUG defined for HP aCC ( thanks to Jason Taylor)
+
+ * _bitset.h - member workaround operators made const (thanks to dzwick)
+
+ * _bitset.h/.c, hashtable.h -- small bugfixes (thanks to Levente Farkas)
+
+ * <exception> - now includes exception.h if only that is available.
+
+ * vector::assign() inplemented for vector::iterator when member templates are not available (Thanks to dzwick)
+
+ * fstream.cpp : __pioinfo used for MinGW32 (thanks to Danny Smith)
+
+The following changes were made in 4.1 beta 3 since 4.1 beta 2 :
+
+ * list<>::clear() : protected access bug fixed
+
+ * __STL_MUTEX_INITIALIZER set back to PTHREAD_MUTEX_INITIALIZER for pthreads case,
+ as some platforms (eg AIX) do not treat zero-initialized mutex as valid one (thanks to Alex Vanic, Jack Andrews for help)
+
+ * stl/_limits.c : fixed typo preventing numeric limits constants to be defined for __STL_LITTLE_ENDIAN,
+ constants initialization fixed (thanks to Ingo Donasch)
+
+ * real implementation of locales for Win32 contributed by Anton Lapach (thanks !) merged in.
+
+ * stl_user_config.h, _config.h : changed default to not define relops:: operators
+ in __STL_NO_NAMESPACES mode.
+
+ * _numeric_facets.c/num_put.cpp : printing of integer do not use sprintf() anymore
+
+ * "install" target implemented for UNIX & VC++ Makefiles. It now installs headers and libraries.
+
+ * "src" : files merged to get less compilation time and less space overhead for imperfect compilers
+
+ * "debug" flavour of STLport excluded from default build and auto-select ;
+ please use __STL_USE_DEBUG_LIB and build debug STLport lib explicitly with "make debug_dynamic"
+ if you really need it). "all" now builds 2 kinds : "release" and "STLdebug", for static and dynamic builds.
+
+ * stlport_prefix.h : WIN32_LEAN_AND_MEAN set for Win32 build of STLport library, for speed.
+
+ * FreeBSD compile fixed; makefiles added.
+
+ * All "__init" changed to "_Init" to fix clashes with DEC conventions (thanks to Holger Stasch)
+
+ * _range_errors.h -- fixed to always set __STL_EXTERN_RANGE_ERRORS for SGI iostreams (thanks to Serge Pashkov)
+
+ * *gcc* mak : some files renamed to gcc-platform mak
+
+ * "extern template" extension used for gcc & standard i/o classes, to reduce code bloat in application's .o
+
+ * "extern template" extension used for VC++ & standard i/o classes (was for DLL only)
+
+ * _iterator.h : added template(and non-template) assignment operator for reverse_iterator<> (thanks to psw). Obsolete HP-style code moved to _iterator_old.h
+
+ * _alloc.h : obsolete code for raw SGI allocators support moved to separate header, for compile-time improvement
+
+ * More iostreams code conditionally moved out for clients who only use standard i/o and can set __STL_NO_CUSTOM_IO flag
+
+ * <iostream>, <locale> : initialization of locale subsystem made independent of standard streams.
+ sync_with_stdio call before iostream initialization now works.
+
+ * <fstream>, <fstream.h> : added initialization code for locale , same as in <locale>
+ (thanks to George Trojan for the report)
+
+ * fstream.cpp : fixed resource leak in case memory map fails on Win32 (thanks to Mark Laffoon)
+
+ * <cmath>, <cstdlib> : added additonal overload signatures required by chapter 26.5 of ANSI (thanks to Levente Farkas for
+ the suggestion), plus "long long" flavour where applicable.
+
+ * __STL_LONG_LONG generalized to support __int64 on Win32 (thanks to Adam Gates for the suggestion)
+
+ * _fstream.h : added constructor from file descriptor, as extension (thanks to eric_a_benson)
+
+ * _fstream.h : added basic_filebuf<>::fd() file descriptor accessor, as extension (thanks to George Trojan)
+
+ * stl_sunpro.h : strstream masked for CC 4.2 to avoid virtual table clash (thanks to Ken)
+
+ * stl_msvc.h : member templates allowed for VC5, it's capable of hadling most of them (same restrictions as VC6 -- inline).
+
+ * debug/_debug.c : slightly changed format of debug message to please VC++ IDE (thanks for Bruce Dawson for the suggestion)
+
+ * src/sgi_mipspro.mak added, for SGI MIPSPro compilation
+
+ * merged series of HP/SUN minor fixes by Petr Ovtchenkov
+
+ * merged series of Intel 4.5 fixes by Serge
+
+ * vc_common.mak : -Yd dropped, as obsolete (thanks to psw)
+
+ * _range_errors.h:95 : unused argument removed (thanks to George Trojan)
+
+ * _string_io.h : refined _WRTLING workaround for Watcom (thanks to Serge Pashkov)
+
+ * _threads.h : fixed SGI threads dafines for gcc on IRIX (thanks to Brett Denner for the report)
+
+ * <typeinfo.h>, <typeinfo> : mutually-exclusive machanism added to allow including both in same unit.
+
+ * Inclusion of SGI iostreams headers put to some order; _streambuf_iterator.h file introduced to resolve circular dependancies
+
+The following changes were made in 4.1 beta 2 since 4.1 beta 1 :
+
+ * _algobase.h : fixed __STL_DECLARE_COPY_TRIVIAL definition
+ (thanks to Charles Burfoot for the report)
+
+ * _algobase.h : added copy_backward specializations for builtin types for compilers w/o partial spec.
+
+ * _char_traits.h : fixed zero-length check for copy (thanks to Michael Tsirkin)
+
+ * msvc_warnings_off.h : fixed "and" typo
+ (thanks to Charles Burfoot for the report)
+
+ * num_put_float.cpp : fixed rounding for "g" format (thanks to Bernd Mohr for the report)
+
+ * Initial port of iostreams to xlC 5.0 added (thanks to Jack Andrews)
+
+ * stl_sunpro.h : a fix for Forte config (Thanks to Alex Vanic for the report)
+
+ * old_hp/iterator.h : fixed iterator_category()/etc. import
+
+ * _threads.h : __stl_atomic_t used instead of "unsigned long" (thanks to Alex Vanic for the report)
+ * using/iomanip : old-streams path used for native iomanip.h (thanks to Michael Tsirkin for the report).
+
+ * _bitset.h , _bitset.c : direct STL_THROW replaced with __stl_throw_xxx calls (thanks to Michael Tsirkin for the report)
+
+ * range_errors.h/cpp : added functions to support throwing of overflow_error and invalid_argument
+
+ * _threads.h : enganced HP-specific guards for HP-UX 11 (thanks to Matthew Collins for the report)
+
+ * _string.h : compare() bugfix (thanks to Anton Sergeev)
+
+ * moneypunct_byname_w.cpp : rolled back wrong bugfix (thanks to Ken)
+
+ * _vector.h, _deque.h, _list.h : nonstandard versions of push_back()/push_front()
+ moved under __STL_NO_ANACHRONISMS guard (thanks to Ed Brey)
+
+ * _tree.c, _list.c, _slist.c, _debug.c : compile-time improvements
+
+ * _tree.h/c, _list.h/c, _slist.h/c, _vector.h/c, _string.h/c : using directive for data members
+ changed to explicit "this->".
+
+ * _complex.h : signatures of some methods changed to take value_type instead of const value_type&,
+ for better conformance (thanks to Petr Ovtchenkov)
+
+ * Bunch of fixes to compile with gcc on HP-UX 10, 11 (thanks to Petr Ovtchenkov)
+
+ * Code duplication for __STL_INLINE_MEMBER_TEMPLATES removed -- corresponding methods are always inlined
+
+ * stl_sunpro.h : fix for "-compat" mode (thanks to Vijay Ramachandran)
+
+ * pthread.h : new wrapper added
+
+ * Added custom prolog/epilog for HP aCC to select kthreads on HP-UX 11 (Thanks to Michael Tsirkin)
+
+ * <new> : fixed throw specification for bad_alloc (has to be inherited)
+
+ * Macro __STL_NATIVE_CPP_RUNTIME_INCLUDE_PATH introduced to specify separate path for <exception>, <typeinfo>, <new>.
+ (thanks to Bryan Byrnes)
+
+ * <stdio_streambuf> : moved from stlport/stl to stlport directory, for SGI compatibility
+
+The following changes were made in 4.1 beta 1 since 4.0 :
+
+ * Sun Forte 6.0 C++ configuration provided (thanks to Alexander Vanic for the input)
+
+ * _threads.h/_config.h : added efficient support for atomic operations for
+ DEC CXX and Watcom (thanks to Ricardo Gayoso for the input).
+ Macros __STL_ATOMIC_xxx introduced to facilitate this.
+
+ * _tree.h : optimizations to lower number of comparisons (thanks to Craig Powers for the patch)
+
+ * _tree.h, _hashtable.h and clients : added templated find() as an extension (thanks to Michael Tsirkin for the suggestion)
+
+ * _tree.h : changed some inlining for performance optimization
+
+ * __node_alloc:: allocate broken into two functions for better inlining
+
+ * _threads.h : added PTHREAD_MUTEX_INITIALIZER guard for HP workaround
+
+ * stl_bc.h : option set to control alignment and virtual table behaviour to be consistent;
+ library name adjusted to stlport_bcc55_xxx
+
+ * _algobase.h, _uninitialized.h, char_traits.h -- optimized out empty memcpy() calls
+ (thanks to Michael Tsirkin for the report).
+
+ * _iterator.h : fixed reverse_iterator::operator+(int, reverse_iterator) resolution
+ (thanks to Anton Sergeev for the input)
+
+ * _bitset.h : bitset<>::test bugfix (thanks to Anton Sergeev for the patch)
+
+ * complex_trig.cpp : use of __STL_NO_LONG_DOUBLE made consistent, fixes for Borland on Linux
+ (thanks to John Wiegley for the input)
+
+ * moneypunct_byname_w.cpp : bugfixes for string copying (thanks to Anton Sergeev for the input)
+
+ * Watcom-specific fixes (thanks to Ricardo Gayoso for the input)
+
+ * src/common_macros.mak : some intermediate targets added (thanks to Jeremy for the suggestion)
+
+ * _debug.c : fixes for Win CE (thanks to John Hynes for the patch)
+
+ * Intel CC 4.0-specific fixes (thanks to Sean Cavanaugh for the input)
+
+ * _list.c : workaround for Watcom C++ (thanks to Mike Steed for the report)
+
+ * __STL_NO_NATIVE_WIDE_STREAMS definition fixed (thanks to Glen Summers for the patch)
+
+ * cast macros fixed to be more robust (thanks to Geoff Oakham for the report)
+
+ * "strstream.h" native inclusion for VC 6.0 fixed (thanks to Sathish T C for the report)
+
+ * debug/_string.h : improvement to string with __STL_DEBUG w/o member templates
+ (thanks to Paul Furnanz for the report)
+
+ * debug/_string.h : fixed internal compiler error for VC++ 5.x (thanks to chvetsov for the report)
+
+ * cstdio, stl/_streambuf.h : fixes to allow gcc compilation with -ansi flag
+
+ * workaround for cin/cout renaming on HPUX11 for -D_REENTRANT (thankf to Jeff Sparkes for the report)
+
+ * cin/cout/cerr/clog renaming in STLport for CC 4.0 and SGI iostreams,
+ to avoid symbol clashes with native ones (thanks to Dirk Schreib for the report)
+
+ * type_info scope fixes for VC++ 6.0 (thanks to Sathish T C for the report)
+
+ * typeinfo.h using fixes (thanks to Glen Summers for the input)
+
+ * stlcomp.h : fixes to allow compilation of .c modules with VAC++, Sun CC, DEC CC, Watcom CC
+ (thanks to Dmitry A.Steklenev, Jonathan Richardson for the report)
+
+ * debug/_tree.h : fixed insert_unique() bug (thanks to Ben Liblit for the report)
+
+ * regression/gcc.mak made non-dependant on "." in the path
+ (thanks to Thomas Matelich for the report)
+
+ * hmset1.cpp fixed to compile under OS390 ( thanks to Andrey Khovanskiy for the report)
+
diff --git a/etc/ReleaseNote.txt b/etc/ReleaseNote.txt
new file mode 100644
index 0000000..4840db0
--- /dev/null
+++ b/etc/ReleaseNote.txt
@@ -0,0 +1,138 @@
+5.2:
+
+- Major modifications:
+
+ * Use of #include_next to access native platform/compiler headers when the
+ preprocessor support it. Enhance STLport portability as native header path do
+ not have to be adapted each time the header structure is modified.
+
+ * Yet a modification of the include schema in all C++ Standard headers. Now
+ _STLP_WHOLE_NATIVE_STD mode works as expected, used in conjonction with
+ _STLP_DONT_REDEFINE_STD it is possible to use STLport in stlport namespace at
+ the same time as using native library in std namespace.
+
+ * Use of the gcc visibility feature for gcc versions after 4.0.
+
+ * For builds under Windows, STLport now adapt to the PSDK used to build it. It
+ should be the same as the one used when building an application using the
+ STLport libs. A compatibility detection mecanism has been implemented in order
+ to report not homogeneous build environment with a link error rather than undefined
+ runtime error.
+
+- Enhancements:
+
+ * Use of malloc based allocator on system having GlibC 2.3 and later, keep
+ node allocator for others.
+
+ * Delay instanciation of type traits type in vector and deque implementation to
+ be able to use some of the nested types like iterator even if type used to
+ instanciate the container is not completely defined.
+
+ * Container pointer specialization feature now works even with incomplete types
+ thanks to use of partial template specialization.
+
+5.1:
+
+- Major modifications
+
+ * Folder architecture: All configuration files are now in stlport/stl/config folder.
+ stlport/stl_user_config.h renamed and moved as stlport/stl/config/user_config.h.
+ stlport/stl/_site_config.h renamed and moved as stlport/stl/config/hosts.h.
+ STLport configuration now also try to seperate platform configuration from compiler
+ one.
+
+ * Allocators implementation is in src folder to enhance encapsulation. Default
+ allocator when using STLport without building it (_STLP_NO_IOSTREAMS) is the simple
+ new/delete based allocator, node allocator is the default when building the lib.
+
+ * Access to native headers has been modified to make STLport less dependant on
+ native headers internal includes, should improve portability.
+
+ * Segregation of headers has been improved. You might have to add now missing
+ functional or algorithm Standard headers include in your code.
+
+- Enhancements
+
+ * Support enhancements:
+ - Borland compilers starting with the free one (5.5.1)
+ - HP aC++/ANSI C B3910B A.06.06
+ - Visual Studio 2005 for Windows CE
+ - Use of intrinsic type traits support of Visual Studio 2005
+
+ * Improved meta programming techniques especially in uninitialized_* algorithms.
+ If you need a vector of null pointer prefer to write 'vector<void*> v(10)' rather
+ than 'vector<void*> v(10, (void*)0)'.
+
+ * Fully functional pointer specialization feature (_STLP_USE_PTR_SPECIALIZATIONS).
+
+ * Extension of template search methods in associative and hashed container has
+ been completed.
+
+ * STL safe mode: Now detect badly implemented strict weak ordering functors, assert
+ if a < b && b < a. Same for equivalent functor used in hash container implementation,
+ assert if a <=> b but !(b <=> a).
+
+ * Improved locale creation delay on Windows platform.
+
+ * STL containers implementation now correctly handle allocators with state. This kind
+ of allocator has to overload swap method if any specific action has to be made when
+ swaping 2 instances.
+
+ * STLport is ready for safe string functions *_s (_STLP_USE_SAFE_STRING_FUNCTIONS)
+
+ * Many bug fixes, see etc/ChangeLog-5.1.
+
+5.0:
+
+- Major modifications
+
+ * No more wrapper mode: you can use STLport iostreams or no iostreams
+ at all.
+
+ * _STLP_NO_CUSTOM_IO now also hide basic_string implementation
+
+ * internal namespace schema has been modified, see doc folder for additionnal
+ informations.
+
+- Enhancements
+
+ * Support of many modern C++ compilers and platforms
+ - gcc 3.4.0 and later
+ - MSVC .Net 2002, 2003 and MSVC 2005 Beta
+ - Windows CE
+ see build/test/unit/STATUS for a complete list of tested platforms/compilers
+
+ * Move semantic: vector or deque of any other STL containers are using
+ move semantic when resized or modified rather than copy.
+
+ * New checks in safe STL mode like null pointer or check of iterator range
+ pass to container constructors.
+
+ * Expression template for string concatenation operations (available
+ throught the _STLP_USE_TEMPLATE_EXPRESSION config option)
+
+ * Implementation of the short string optimization trick, basic_string have
+ a small static buffer in this case.
+
+ * STL containers vector, deque, list and slist pointer specialization to
+ limit code bloats (see _STLP_USE_PTR_SPECIALIZATIONS on config file)
+
+ * Use of boost type_traits rather than internal equivalent when requested
+ (see _STLP_USE_BOOST_SUPPORT in config file)
+
+ * set/multiset, or map/multimap iterators cannot be compared anymore.
+
+ * unordered_set, unordered_multiset, unordered_map, unordered_multimap hash
+ containers implementation specified in the TR1 document.
+
+ * Thanks to the _STLP_LEAKS_PEDANTIC config option you can ask STLport to
+ clean its memory pool before being unloaded, useful to only detect real
+ memory leak problems.
+
+ * Creation of configuration scripts to make STLport configuration easier.
+
+ * Improvment of some algorithm like search_n or stable_sort.
+
+ * Ported to 64 bits platforms.
+
+ * Large file ( > 4 Go) stream support on Win32 platform.
diff --git a/etc/STLport-4.5.1.spec b/etc/STLport-4.5.1.spec
new file mode 100644
index 0000000..17607f5
--- /dev/null
+++ b/etc/STLport-4.5.1.spec
@@ -0,0 +1,96 @@
+%define MAKEFILE gcc-linux.mak
+
+Summary: Complete C++ standard library
+Name: STLport
+Version: 4.5.1
+Release: 1
+Copyright: free (see license), see /usr/share/doc/%{name}-%{version}/license.html
+URL: http://www.stlport.org/
+Packager: Levente Farkas <lfarkas@mindmaker.hu>
+Group: System Environment/Languages
+Icon: stlport_powered_white.gif
+Source0: http://www.stlport.org/archive/%{name}-%{version}.tar.gz
+Patch0: STLport-rename.patch
+#Patch1: STLport-rules.patch
+#Patch2: STLport-install-dir.patch
+Buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n)
+
+%description
+STLport is a multiplatform STL implementation based on SGI STL.
+This package contains the runtime library for STLport.
+
+%package -n STLport-devel
+Summary: Complete C++ standard library header files and libraries
+Group: Development/Libraries
+Requires: STLport = %{version}
+
+%description -n STLport-devel
+STLport is a multiplatform STL implementation based on SGI STL. Complete
+C++ standard library, including <complex> and SGI STL iostreams. If you
+would like to use your code with STLport add
+"-nostdinc++ -I/usr/include/stlport" when compile and -lstlport_gcc when
+link (eg: gcc -nostdinc++ -I/usr/include/stlport x.cc -lstlport_gcc).
+
+%prep
+%setup
+%patch0 -p1
+#%patch1 -p1
+#%patch2 -p1
+
+%build
+cd src
+make -f %{MAKEFILE} INSTALLDIR=$RPM_BUILD_ROOT/usr clean all
+
+%install
+rm -rf $RPM_BUILD_ROOT
+cd src
+make -f %{MAKEFILE} INSTALLDIR=$RPM_BUILD_ROOT/usr install
+cd $RPM_BUILD_ROOT/usr/include/stlport
+ln -s . ext
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%post -n STLport-devel
+/sbin/ldconfig
+
+%postun -n STLport-devel
+/sbin/ldconfig
+
+%files
+%defattr(-,root,root)
+%doc doc/license.html
+/usr/lib/libstlport_gcc.so
+#/usr/lib/libstlport_gcc.so.%{version}
+/usr/lib/libstlport_gcc.so.4.5
+
+%files -n STLport-devel
+%defattr(-,root,root)
+%doc INSTALL README doc etc test
+/usr/lib/libstlport_gcc*.a
+/usr/lib/libstlport_gcc_*debug.so*
+/usr/include/*
+
+%changelog
+* Mon Dec 10 2001 Levente Farkas <lfarkas@mindmaker.hu>
+- upgrade to 4.5.1
+
+* Fri Nov 16 2001 Levente Farkas <lfarkas@mindmaker.hu>
+- merge with Harold's changes
+
+* Thu Nov 15 2001 <stlport@lanceerplaats.nl>
+- rebuild for RedHat 7.2, spec file fixes.
+
+* Tue Oct 2 2001 Levente Farkas <lfarkas@mindmaker.hu>
+- upgrade to 4.5
+
+* Thu Oct 26 2000 Levente Farkas <lfarkas@mindmaker.hu>
+- upgrade to 4.1-b3
+
+* Thu Jul 17 2000 Levente Farkas <lfarkas@mindmaker.hu>
+- initial release use STLport-4.0
+
diff --git a/etc/STLport-4.5.3.spec b/etc/STLport-4.5.3.spec
new file mode 100644
index 0000000..92e8cb7
--- /dev/null
+++ b/etc/STLport-4.5.3.spec
@@ -0,0 +1,96 @@
+%define MAKEFILE gcc-linux.mak
+
+Summary: Complete C++ standard library
+Name: STLport
+Version: 4.5.3
+Release: 1
+Copyright: free (see license), see /usr/share/doc/%{name}-%{version}/license.html
+URL: http://www.stlport.org/
+Packager: Levente Farkas <lfarkas@mindmaker.hu>
+Group: System Environment/Languages
+Icon: stlport_powered_white.gif
+Source0: http://www.stlport.org/archive/%{name}-%{version}.tar.gz
+#Patch0: STLport-rename.patch
+#Patch1: STLport-rules.patch
+#Patch2: STLport-install-dir.patch
+Buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n)
+
+%description
+STLport is a multiplatform STL implementation based on SGI STL.
+This package contains the runtime library for STLport.
+
+%package -n STLport-devel
+Summary: Complete C++ standard library header files and libraries
+Group: Development/Libraries
+Requires: STLport = %{version}
+
+%description -n STLport-devel
+STLport is a multiplatform STL implementation based on SGI STL. Complete
+C++ standard library, including <complex> and SGI STL iostreams. If you
+would like to use your code with STLport add
+"-nostdinc++ -I/usr/include/stlport" when compile and -lstlport_gcc when
+link (eg: gcc -nostdinc++ -I/usr/include/stlport x.cc -lstlport_gcc).
+
+%prep
+%setup
+%patch0 -p1
+#%patch1 -p1
+#%patch2 -p1
+
+%build
+cd src
+make -f %{MAKEFILE} INSTALLDIR=$RPM_BUILD_ROOT/usr clean all
+
+%install
+rm -rf $RPM_BUILD_ROOT
+cd src
+make -f %{MAKEFILE} INSTALLDIR=$RPM_BUILD_ROOT/usr install
+cd $RPM_BUILD_ROOT/usr/include/stlport
+ln -s . ext
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%post -n STLport-devel
+/sbin/ldconfig
+
+%postun -n STLport-devel
+/sbin/ldconfig
+
+%files
+%defattr(-,root,root)
+%doc doc/license.html
+/usr/lib/libstlport_gcc.so
+#/usr/lib/libstlport_gcc.so.%{version}
+/usr/lib/libstlport_gcc.so.4.5
+
+%files -n STLport-devel
+%defattr(-,root,root)
+%doc INSTALL README doc etc test
+/usr/lib/libstlport_gcc*.a
+/usr/lib/libstlport_gcc_*debug.so*
+/usr/include/*
+
+%changelog
+* Mon Dec 10 2001 Levente Farkas <lfarkas@mindmaker.hu>
+- upgrade to 4.5.1
+
+* Fri Nov 16 2001 Levente Farkas <lfarkas@mindmaker.hu>
+- merge with Harold's changes
+
+* Thu Nov 15 2001 <stlport@lanceerplaats.nl>
+- rebuild for RedHat 7.2, spec file fixes.
+
+* Tue Oct 2 2001 Levente Farkas <lfarkas@mindmaker.hu>
+- upgrade to 4.5
+
+* Thu Oct 26 2000 Levente Farkas <lfarkas@mindmaker.hu>
+- upgrade to 4.1-b3
+
+* Thu Jul 17 2000 Levente Farkas <lfarkas@mindmaker.hu>
+- initial release use STLport-4.0
+
diff --git a/etc/STLport-4.6.spec b/etc/STLport-4.6.spec
new file mode 100644
index 0000000..b37d782
--- /dev/null
+++ b/etc/STLport-4.6.spec
@@ -0,0 +1,99 @@
+%define MAKEFILE gcc-linux.mak
+
+Summary: Complete C++ standard library
+Name: STLport
+Version: 4.6
+Release: 1
+Copyright: free (see license), see /usr/share/doc/%{name}-%{version}/license.html
+URL: http://www.stlport.org/
+Packager: Levente Farkas <lfarkas@mindmaker.hu>
+Group: System Environment/Languages
+Icon: stlport_powered_white.gif
+Source0: http://www.stlport.org/archive/%{name}-%{version}.tar.gz
+#Patch0: STLport-rename.patch
+#Patch1: STLport-rules.patch
+#Patch2: STLport-install-dir.patch
+Buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n)
+
+%description
+STLport is a multiplatform STL implementation based on SGI STL.
+This package contains the runtime library for STLport.
+
+%package -n STLport-devel
+Summary: Complete C++ standard library header files and libraries
+Group: Development/Libraries
+Requires: STLport = %{version}
+
+%description -n STLport-devel
+STLport is a multiplatform STL implementation based on SGI STL. Complete
+C++ standard library, including <complex> and SGI STL iostreams. If you
+would like to use your code with STLport add
+"-nostdinc++ -I/usr/include/stlport" when compile and -lstlport_gcc when
+link (eg: gcc -nostdinc++ -I/usr/include/stlport x.cc -lstlport_gcc).
+
+%prep
+%setup
+%patch0 -p1
+#%patch1 -p1
+#%patch2 -p1
+
+%build
+cd src
+make -f %{MAKEFILE} INSTALLDIR=$RPM_BUILD_ROOT/usr clean all
+
+%install
+rm -rf $RPM_BUILD_ROOT
+cd src
+make -f %{MAKEFILE} INSTALLDIR=$RPM_BUILD_ROOT/usr install
+cd $RPM_BUILD_ROOT/usr/include/stlport
+ln -s . ext
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%post -n STLport-devel
+/sbin/ldconfig
+
+%postun -n STLport-devel
+/sbin/ldconfig
+
+%files
+%defattr(-,root,root)
+%doc doc/license.html
+/usr/lib/libstlport_gcc.so
+#/usr/lib/libstlport_gcc.so.%{version}
+/usr/lib/libstlport_gcc.so.4.6
+
+%files -n STLport-devel
+%defattr(-,root,root)
+%doc INSTALL README doc etc test
+/usr/lib/libstlport_gcc*.a
+/usr/lib/libstlport_gcc_*debug.so*
+/usr/include/*
+
+%changelog
+* Fri Oct 31 2003 <boris@stlport.com>
+- upgrade to 4.6
+
+* Mon Dec 10 2001 Levente Farkas <lfarkas@mindmaker.hu>
+- upgrade to 4.5.1
+
+* Fri Nov 16 2001 Levente Farkas <lfarkas@mindmaker.hu>
+- merge with Harold's changes
+
+* Thu Nov 15 2001 <stlport@lanceerplaats.nl>
+- rebuild for RedHat 7.2, spec file fixes.
+
+* Tue Oct 2 2001 Levente Farkas <lfarkas@mindmaker.hu>
+- upgrade to 4.5
+
+* Thu Oct 26 2000 Levente Farkas <lfarkas@mindmaker.hu>
+- upgrade to 4.1-b3
+
+* Thu Jul 17 2000 Levente Farkas <lfarkas@mindmaker.hu>
+- initial release use STLport-4.0
+
diff --git a/etc/autoexp.dat b/etc/autoexp.dat
new file mode 100644
index 0000000..35cef5b
--- /dev/null
+++ b/etc/autoexp.dat
@@ -0,0 +1,835 @@
+;------------------------------------------------------------------------------
+; This is the description of STLport data structures in Visual Studio debugger
+; language. Those descriptions has been tested with Visual C++ 2005 Express
+; Edition, you are welcome to report successful usage with any other Visual
+; Studio version.
+; Those descriptions has been tested with STLport 5.2.0.
+; How to use: Copy/Paste this file content in the autoexp.dat file you will find
+; in your Visual Studio install, for instance
+; C:\Program Files\Microsoft Visual Studio 8\Common7\Packages\Debugger, in the
+; [Visualizer] section.
+; TODO: Enhance debug iterator visualization to report end iterators.
+; TODO: Add visualization for rope.
+; TODO: Fix bitset visualization.
+;------------------------------------------------------------------------------
+;------------------------------------------------------------------------------
+; stlport::basic_string
+;------------------------------------------------------------------------------
+stlp_std::basic_string<char,*>|stlpx_std::basic_string<char,*>|stlpmtx_std::basic_string<char,*>|stlpxmtx_std::basic_string<char,*>|stlpd_std::priv::_NonDbg_str<char,*>|stlpdx_std::priv::_NonDbg_str<char,*>|stlpdmtx_std::priv::_NonDbg_str<char,*>|stlpdxmtx_std::priv::_NonDbg_str<char,*>{
+ preview
+ (
+ [$c._M_start_of_storage._M_data, s]
+ )
+
+ stringview
+ (
+ [$c._M_start_of_storage._M_data, s]
+ )
+
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ buffer: [(unsigned int)$c._M_start_of_storage._M_data, x],
+ length: $c._M_finish - $c._M_start_of_storage._M_data,
+ capacity: #if($c._M_start_of_storage._M_data == $c._M_buffers._M_static_buf)
+ (
+ $c._DEFAULT_SIZE
+ )
+ #else
+ (
+ $c._M_buffers._M_end_of_storage - $c._M_start_of_storage._M_data
+ ),
+ #array
+ (
+ expr: $c._M_start_of_storage._M_data[$i],
+ size: $c._M_finish - $c._M_start_of_storage._M_data
+ )
+ )
+ )
+}
+
+stlp_std::basic_string<unsigned short,*>|stlp_std::basic_string<wchar_t,*>|stlpx_std::basic_string<unsigned short,*>|stlpx_std::basic_string<wchar_t,*>|stlpmtx_std::basic_string<unsigned short,*>|stlpmtx_std::basic_string<wchar_t,*>|stlpxmtx_std::basic_string<unsigned short,*>|stlpxmtx_std::basic_string<wchar_t,*>|stlpd_std::priv::_NonDbg_str<unsigned short,*>|stlpd_std::priv::_NonDbg_str<wchar_t,*>|stlpdx_std::priv::_NonDbg_str<unsigned short,*>|stlpdx_std::priv::_NonDbg_str<wchar_t,*>|stlpdmtx_std::priv::_NonDbg_str<unsigned short,*>|stlpdmtx_std::priv::_NonDbg_str<wchar_t,*>|stlpdxmtx_std::priv::_NonDbg_str<unsigned short,*>|stlpdxmtx_std::priv::_NonDbg_str<wchar_t,*>{
+ preview
+ (
+ [$c._M_start_of_storage._M_data, su]
+ )
+
+ stringview
+ (
+ [$c._M_start_of_storage._M_data, su]
+ )
+
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ buffer: [(unsigned int)$c._M_start_of_storage._M_data, x],
+ length: $c._M_finish - $c._M_start_of_storage._M_data,
+ capacity: #if($c._M_start_of_storage._M_data == $c._M_buffers._M_static_buf)
+ (
+ $c._DEFAULT_SIZE
+ )
+ #else
+ (
+ $c._M_buffers._M_end_of_storage - $c._M_start_of_storage._M_data
+ ),
+ #array
+ (
+ expr: $c._M_start_of_storage._M_data[$i],
+ size: $c._M_finish - $c._M_start_of_storage._M_data
+ )
+ )
+ )
+}
+
+stlpd_std::basic_string<*>|stlpdx_std::basic_string<*>|stlpdmtx_std::basic_string<*>|stlpdxmtx_std::basic_string<*>{
+ preview
+ (
+ $c._M_non_dbg_impl
+ )
+
+ stringview
+ (
+ $c._M_non_dbg_impl
+ )
+
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ string: $c._M_non_dbg_impl
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport::vector
+;------------------------------------------------------------------------------
+stlp_std::vector<bool,*>|stlpx_std::vector<bool,*>|stlpmtx_std::vector<bool,*>|stlpxmtx_std::vector<bool,*>|stlpd_std::priv::_NonDbg_vector<bool,*>|stlpdx_std::priv::_NonDbg_vector<bool,*>|stlpdmtx_std::priv::_NonDbg_vector<bool,*>|stlpdxmtx_std::priv::_NonDbg_vector<bool,*>{
+ preview
+ (
+ #(
+ "[",
+ ($c._M_finish._M_p - $c._M_start._M_p) * sizeof(unsigned int) * 8 + $c._M_finish._M_offset,
+ "](",
+ #array
+ (
+ expr : ($c._M_start._M_p[$i / (sizeof(unsigned int) * 8)] >> ($i % (sizeof(unsigned int) * 8))),
+ size : (($c._M_finish._M_p - $c._M_start._M_p) * sizeof(unsigned int) * 8 + $c._M_finish._M_offset)
+ ) : (bool)($e & 1),
+ ")"
+ )
+ )
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ buffer : [(unsigned int)$c._M_start._M_p, x],
+ size : (($c._M_finish._M_p - $c._M_start._M_p) * sizeof(unsigned int) * 8 + $c._M_finish._M_offset),
+ #array
+ (
+ expr : ($c._M_start._M_p[$i / (sizeof(unsigned int) * 8)] >> ($i % (sizeof(unsigned int) * 8))),
+ size : (($c._M_finish._M_p - $c._M_start._M_p) * sizeof(unsigned int) * 8 + $c._M_finish._M_offset)
+ ) : (bool)($e & 1)
+ )
+ )
+}
+
+stlp_std::priv::_Bit_iter<*>|stlpx_std::priv::_Bit_iter<*>|stlpmtx_std::priv::_Bit_iter<*>|stlpxmtx_std::priv::_Bit_iter<*>|stlpd_std::priv::_Bit_iter<*>|stlpdx_std::priv::_Bit_iter<*>|stlpdmtx_std::priv::::_Bit_iter<*>|stlpdxmtx_std::priv::_Bit_iter<*>{
+ preview
+ (
+ #(
+ (bool) (((*$c._M_p) >> $c._M_offset) & 1)
+ )
+ )
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ value : (bool) (((*$c._M_p) >> $c._M_offset) & 1)
+ )
+ )
+}
+
+stlp_std::vector<*>|stlpx_std::vector<*>|stlpmtx_std::vector<*>|stlpxmtx_std::vector<*>|stlpd_std::priv::_NonDbg_vector<*>|stlpdx_std::priv::_NonDbg_vector<*>|stlpdmtx_std::priv::_NonDbg_vector<*>|stlpdxmtx_std::priv::_NonDbg_vector<*>{
+ preview
+ (
+ #(
+ "[",
+ $c._M_finish - $c._M_start,
+ "/",
+ $c._M_end_of_storage._M_data - $c._M_start,
+ "](",
+ #array
+ (
+ expr : ($c._M_start)[$i],
+ size : $c._M_finish - $c._M_start
+ ),
+ ")"
+ )
+ )
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ size : $c._M_finish - $c._M_start,
+ capacity : $c._M_end_of_storage._M_data - $c._M_start,
+ #array
+ (
+ expr : ($c._M_start)[$i],
+ size : $c._M_finish - $c._M_start
+ )
+ )
+ )
+}
+
+stlpd_std::vector<*>|stlpdx_std::vector<*>|stlpdmtx_std::vector<*>|stlpdxmtx_std::vector<*>{
+ preview
+ (
+ $c._M_non_dbg_impl
+ )
+ children
+ (
+ #(
+ [raw view] : [$c,!],
+ vector : $c._M_non_dbg_impl
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport::deque
+;------------------------------------------------------------------------------
+stlp_std::deque<*,*>|stlpx_std::deque<*,*>|stlpmtx_std::deque<*,*>|stlpxmtx_std::deque<*,*>|stlpd_std::priv::_NonDbg_deque<*,*>|stlpdx_std::priv::_NonDbg_deque<*,*>|stlpdmtx_std::priv::_NonDbg_deque<*,*>|stlpdxmtx_std::priv::_NonDbg_deque<*,*>{
+ preview
+ (
+ #if (((unsigned int)($c._M_start._M_cur + 1) - ((unsigned int)$c._M_start._M_cur)) < _MAX_BYTES)
+ (
+ #(
+ "[",
+ (($c._M_finish._M_node - $c._M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1))) - ($c._M_start._M_cur - $c._M_start._M_first) - ($c._M_finish._M_last - $c._M_finish._M_cur),
+ "/",
+ ($c._M_finish._M_node - $c._M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1)) - 1,
+ "](",
+ #array
+ (
+ expr : *(*($c._M_start._M_node + (($i + ($c._M_start._M_cur - $c._M_start._M_first)) / (_MAX_BYTES / sizeof($T1)))) + (($i + ($c._M_start._M_cur - $c._M_start._M_first)) % (_MAX_BYTES / sizeof($T1)))),
+ size : (($c._M_finish._M_node - $c._M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1))) - ($c._M_start._M_cur - $c._M_start._M_first) - ($c._M_finish._M_last - $c._M_finish._M_cur)
+ ),
+ ")"
+ )
+ )
+ #else
+ (
+ #(
+ "[",
+ $c._M_finish._M_node - $c._M_start._M_node,
+ "/",
+ $c._M_finish._M_node - $c._M_start._M_node,
+ "](",
+ #array
+ (
+ expr : **($c._M_start._M_node + $i),
+ size : $c._M_finish._M_node - $c._M_start._M_node
+ ),
+ ")"
+ )
+ )
+ )
+ children
+ (
+ #if (((unsigned int)($c._M_start._M_cur + 1) - ((unsigned int)$c._M_start._M_cur)) < _MAX_BYTES)
+ (
+ #(
+ [raw view]: [$c,!],
+ size : (($c._M_finish._M_node - $c._M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1))) - ($c._M_start._M_cur - $c._M_start._M_first) - ($c._M_finish._M_last - $c._M_finish._M_cur),
+ capacity : ($c._M_finish._M_node - $c._M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1)) - 1,
+ front free space : $c._M_start._M_cur - $c._M_start._M_first,
+ back free space : $c._M_finish._M_last - $c._M_finish._M_cur - 1,
+ #array
+ (
+ expr : *(*($c._M_start._M_node + (($i + ($c._M_start._M_cur - $c._M_start._M_first)) / (_MAX_BYTES / sizeof($T1)))) + (($i + ($c._M_start._M_cur - $c._M_start._M_first)) % (_MAX_BYTES / sizeof($T1)))),
+ size : (($c._M_finish._M_node - $c._M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1))) - ($c._M_start._M_cur - $c._M_start._M_first) - ($c._M_finish._M_last - $c._M_finish._M_cur)
+ )
+ )
+ )
+ #else
+ (
+ #(
+ [raw view] : [$c,!],
+ size : $c._M_finish._M_node - $c._M_start._M_node,
+ capacity : $c._M_finish._M_node - $c._M_start._M_node,
+ front free space : $c._M_start._M_cur - $c._M_start._M_first,
+ back free space : $c._M_finish._M_last - $c._M_finish._M_cur - 1,
+ #array
+ (
+ expr : **($c._M_start._M_node + $i),
+ size : $c._M_finish._M_node - $c._M_start._M_node
+ )
+ )
+ )
+ )
+}
+
+stlp_std::priv::_Deque_iterator<*>|stlpx_std::priv::_Deque_iterator<*>|stlpmtx_std::priv::_Deque_iterator<*>|stlpxmtx_std::priv::_Deque_iterator<*>|stlpd_std::priv::_Deque_iterator<*>|stlpdx_std::priv::_Deque_iterator<*>|stlpdmtx_std::priv::_Deque_iterator<*>|stlpdxmtx_std::priv::_Deque_iterator<*>{
+ preview
+ (
+ *($c._M_cur)
+ )
+ children
+ (
+ #(
+ [raw view] : [$c, !],
+ ptr : [(unsigned int)($c._M_cur), x],
+ value : *($c._M_cur)
+ )
+ )
+}
+
+stlpd_std::deque<*>|stlpdx_std::deque<*>|stlpdmtx_std::deque<*>|stlpdxmtx_std::deque<*>{
+ preview
+ (
+ $c._M_non_dbg_impl
+ )
+ children
+ (
+ #(
+ [raw view] : [$c,!],
+ deque : $c._M_non_dbg_impl
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport::list
+;------------------------------------------------------------------------------
+stlp_std::list<*,*>|stlpx_std::list<*,*>|stlpmtx_std::list<*,*>|stlpxmtx_std::list<*,*>|stlpd_std::priv::_NonDbg_list<*,*>|stlpdx_std::priv::_NonDbg_list<*,*>|stlpdmtx_std::priv::_NonDbg_list<*,*>|stlpdxmtx_std::priv::_NonDbg_list<*,*>{
+ preview
+ (
+ #(
+ "(",
+ #list
+ (
+ head : $c._M_node._M_data._M_next,
+ skip : &($c._M_node._M_data),
+ next : _M_next,
+ ): #( *($T1*)(&($e) + 1)),
+ ")"
+ )
+ )
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ #list
+ (
+ head : $c._M_node._M_data._M_next,
+ skip : &($c._M_node._M_data),
+ next : _M_next,
+ ): #( *($T1*)(&($e) + 1))
+ )
+ )
+}
+
+stlp_std::priv::_List_iterator<*,*>|stlpx_std::priv::_List_iterator<*,*>|stlpmtx_std::priv::_List_iterator<*,*>|stlpxmtx_std::priv::_List_iterator<*,*>|stlpd_std::priv::_List_iterator<*,*>|stlpdx_std::priv::_List_iterator<*,*>|stlpdmtx_std::priv::_List_iterator<*,*>|stlpdxmtx_std::priv::_List_iterator<*,*>{
+ preview
+ (
+ #(*($T1 *)($c._M_node + 1))
+ )
+ children
+ (
+ #(
+ [raw view] : [$c, !],
+ ptr : [(unsigned int)($c._M_node + 1), x],
+ value : *($T1 *)($c._M_node + 1)
+ )
+ )
+}
+
+stlpd_std::list<*,*>|stlpdx_std::list<*,*>|stlpdmtx_std::list<*,*>|stlpdxmtx_std::list<*,*>{
+ preview
+ (
+ $c._M_non_dbg_impl
+ )
+ children
+ (
+ #(
+ [raw view] : [$c,!],
+ list : $c._M_non_dbg_impl
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport::slist
+;------------------------------------------------------------------------------
+stlp_std::slist<*,*>|stlpx_std::slist<*,*>|stlpmtx_std::slist<*,*>|stlpxmtx_std::slist<*,*>|stlpd_std::priv::_NonDbg_slist<*,*>|stlpdx_std::priv::_NonDbg_slist<*,*>|stlpdmtx_std::priv::_NonDbg_slist<*,*>|stlpdxmtx_std::priv::_NonDbg_slist<*,*>{
+ preview
+ (
+ #(
+ "(",
+ #list
+ (
+ head : $c._M_head._M_data._M_next,
+ skip : &($c._M_head._M_data),
+ next : _M_next,
+ ): #( *($T1*)(&($e) + 1)),
+ ")"
+ )
+ )
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ #list
+ (
+ head : $c._M_head._M_data._M_next,
+ skip : &($c._M_head._M_data),
+ next : _M_next,
+ ): #( *($T1*)(&($e) + 1))
+ )
+ )
+}
+
+stlp_std::priv::_Slist_iterator<*,*>|stlpx_std::priv::_Slist_iterator<*,*>|stlpmtx_std::priv::_Slist_iterator<*,*>|stlpxmtx_std::priv::_Slist_iterator<*,*>|stlpd_std::priv::_Slist_iterator<*,*>|stlpdx_std::priv::_Slist_iterator<*,*>|stlpdmtx_std::priv::_Slist_iterator<*,*>|stlpdxmtx_std::priv::_Slist_iterator<*,*>{
+ preview
+ (
+ #(*($T1 *)($c._M_node + 1))
+ )
+ children
+ (
+ #(
+ [raw view] : [$c,!],
+ ptr : [(unsigned int)($c._M_node + 1), x],
+ value : *($T1 *)($c._M_node + 1)
+ )
+ )
+}
+
+stlpd_std::slist<*,*>|stlpdx_std::slist<*,*>|stlpdmtx_std::slist<*,*>|stlpdxmtx_std::slist<*,*>{
+ preview
+ (
+ $c._M_non_dbg_impl
+ )
+ children
+ (
+ #(
+ [raw view] : [$c,!],
+ [slist] : $c._M_non_dbg_impl
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport::pair
+;------------------------------------------------------------------------------
+stlp_std::pair<*,*>|stlpx_std::pair<*,*>|stlpmtx_std::pair<*,*>|stlpxmtx_std::pair<*,*>|stlpd_std::pair<*,*>|stlpdx_std::pair<*,*>|stlpdmtx_std::pair<*,*>|stlpdxmtx_std::pair<*,*>{
+ preview
+ (
+ #(
+ "(",
+ $c.first,
+ ", ",
+ $c.second,
+ ")"
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport::map, stlport::multimap, stlport::set, stlport::multiset
+;------------------------------------------------------------------------------
+stlp_std::map<*>|stlpx_std::map<*>|stlpmtx_std::map<*>|stlpxmtx_std::map<*>|stlp_std::multimap<*>|stlpx_std::multimap<*>|stlpmtx_std::multimap<*>|stlpxmtx_std::multimap<*>|stlp_std::set<*>|stlpx_std::set<*>|stlpmtx_std::set<*>|stlpxmtx_std::set<*>|stlp_std::multiset<*>|stlpx_std::multiset<*>|stlpmtx_std::multiset<*>|stlpxmtx_std::multiset<*>{
+ preview
+ (
+ #(
+ "[",
+ $c._M_t._M_node_count,
+ "](",
+ $c._M_t,
+ ")"
+ )
+ )
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ size: [$c._M_t._M_node_count],
+ tree: $c._M_t
+ )
+ )
+}
+
+stlpd_std::map<*>|stlpdx_std::map<*>|stlpdmtx_std::map<*>|stlpdxmtx_std::map<*>|stlpd_std::multimap<*>|stlpdx_std::multimap<*>|stlpdmtx_std::multimap<*>|stlpdxmtx_std::multimap<*>|stlpd_std::set<*>|stlpdx_std::set<*>|stlpdmtx_std::set<*>|stlpdxmtx_std::set<*>|stlpd_std::multiset<*>|stlpdx_std::multiset<*>|stlpdmtx_std::multiset<*>|stlpdxmtx_std::multiset<*>{
+ preview
+ (
+ #(
+ "[",
+ $c._M_t._M_non_dbg_impl._M_node_count,
+ "](",
+ $c._M_t._M_non_dbg_impl,
+ ")"
+ )
+ )
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ size: $c._M_t._M_non_dbg_impl._M_node_count,
+ tree: $c._M_t._M_non_dbg_impl
+ )
+ )
+}
+
+stlp_std::priv::_Rb_tree<*,*,*,*,*>|stlpx_std::priv::_Rb_tree<*,*,*,*,*>|stlpmtx_std::priv::_Rb_tree<*,*,*,*,*>|stlpxmtx_std::priv::_Rb_tree<*,*,*,*,*>|stlpd_std::priv::_NonDbg_Rb_tree<*,*,*,*,*>|stlpdx_std::priv::_NonDbg_Rb_tree<*,*,*,*,*>|stlpdmtx_std::priv::_NonDbg_Rb_tree<*,*,*,*,*>|stlpdxmtx_std::priv::_NonDbg_Rb_tree<*,*,*,*,*>{
+ preview
+ (
+ #tree
+ (
+ head : $c._M_header._M_data._M_parent,
+ skip : &($c._M_header._M_data),
+ size : $c._M_node_count,
+ left : _M_left,
+ right : _M_right
+ ): #(*($T3 *)(&($e) + 1))
+ )
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ #tree
+ (
+ head : $c._M_header._M_data._M_parent,
+ skip : &($c._M_header._M_data),
+ size : $c._M_node_count,
+ left : _M_left,
+ right : _M_right
+ ) : #(*($T3 *)(&($e) + 1))
+ )
+ )
+}
+
+stlp_std::priv::_Rb_tree_iterator<*,*>|stlpx_std::priv::_Rb_tree_iterator<*,*>|stlpmtx_std::priv::_Rb_tree_iterator<*,*>|stlpxmtx_std::priv::_Rb_tree_iterator<*,*>|stlpd_std::priv::_Rb_tree_iterator<*,*>|stlpdx_std::priv::_Rb_tree_iterator<*,*>|stlpdmtx_std::priv::_Rb_tree_iterator<*,*>|stlpdxmtx_std::priv::_Rb_tree_iterator<*,*>{
+ preview
+ (
+ [*($T1*)($c._M_node + 1)]
+ )
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ value: [*($T1*)($c._M_node + 1)],
+ ptr: [(unsigned int)($c._M_node + 1), x]
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport::hash_map, stlport::hash_multimap, stlport::hash_set, stlport::hash_multiset
+; stlport::unordered_map, stlport::unordered_multimap, stlport::unordered_set, stlport::unordered_multiset
+;------------------------------------------------------------------------------
+stlp_std::hash_map<*>|stlpx_std::hash_map<*>|stlpmtx_std::hash_map<*>|stlpxmtx_std::hash_map<*>|stlp_std::hash_multimap<*>|stlpx_std::hash_multimap<*>|stlpmtx_std::hash_multimap<*>|stlpxmtx_std::hash_multimap<*>|stlp_std::hash_set<*>|stlpx_std::hash_set<*>|stlpmtx_std::hash_set<*>|stlpxmtx_std::hash_set<*>|stlp_std::hash_multiset<*>|stlpx_std::hash_multiset<*>|stlpmtx_std::hash_multiset<*>|stlpxmtx_std::hash_multiset<*>|stlp_std::tr1::unordered_map<*>|stlpx_std::tr1::unordered_map<*>|stlpmtx_std::tr1::unordered_map<*>|stlpxmtx_std::tr1::unordered_map<*>|stlp_std::tr1::unordered_multimap<*>|stlpx_std::tr1::unordered_multimap<*>|stlpmtx_std::tr1::unordered_multimap<*>|stlpxmtx_std::tr1::unordered_multimap<*>|stlp_std::tr1::unordered_set<*>|stlpx_std::tr1::unordered_set<*>|stlpmtx_std::tr1::unordered_set<*>|stlpxmtx_std::tr1::unordered_set<*>|stlp_std::tr1::unordered_multiset<*>|stlpx_std::tr1::unordered_multiset<*>|stlpmtx_std::tr1::unordered_multiset<*>|stlpxmtx_std::tr1::unordered_multiset<*>{
+ preview
+ (
+ #(
+ "[",
+ $c._M_ht._M_num_elements,
+ "]",
+ $c._M_ht
+ )
+ )
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ hashtable: $c._M_ht
+ )
+ )
+}
+
+stlpd_std::hash_map<*>|stlpdx_std::hash_map<*>|stlpdmtx_std::hash_map<*>|stlpdxmtx_std::hash_map<*>|stlpd_std::hash_multimap<*>|stlpdx_std::hash_multimap<*>|stlpdmtx_std::hash_multimap<*>|stlpdxmtx_std::hash_multimap<*>|stlpd_std::hash_set<*>|stlpdx_std::hash_set<*>|stlpdmtx_std::hash_set<*>|stlpdxmtx_std::hash_set<*>|stlpd_std::hash_multiset<*>|stlpdx_std::hash_multiset<*>|stlpdmtx_std::hash_multiset<*>|stlpdxmtx_std::hash_multiset<*>|stlpd_std::tr1::unordered_map<*>|stlpdx_std::tr1::unordered_map<*>|stlpdmtx_std::tr1::unordered_map<*>|stlpdxmtx_std::tr1::unordered_map<*>|stlpd_std::tr1::unordered_multimap<*>|stlpdx_std::tr1::unordered_multimap<*>|stlpdmtx_std::tr1::unordered_multimap<*>|stlpdxmtx_std::tr1::unordered_multimap<*>|stlpd_std::tr1::unordered_set<*>|stlpdx_std::tr1::unordered_set<*>|stlpdmtx_std::tr1::unordered_set<*>|stlpdxmtx_std::tr1::unordered_set<*>|stlpd_std::tr1::unordered_multiset<*>|stlpdx_std::tr1::unordered_multiset<*>|stlpdmtx_std::tr1::unordered_multiset<*>|stlpdxmtx_std::tr1::unordered_multiset<*>{
+ preview
+ (
+ #(
+ "[",
+ $c._M_ht._M_non_dbg_impl._M_num_elements,
+ "]",
+ $c._M_ht._M_non_dbg_impl
+ )
+ )
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ hashtable: $c._M_ht._M_non_dbg_impl
+ )
+ )
+}
+
+stlp_std::hashtable<*,*>|stlpx_std::hashtable<*,*>|stlpmtx_std::hashtable<*,*>|stlpxmtx_std::hashtable<*,*>|stlpd_std::priv::_NonDbg_hashtable<*,*>|stlpdx_std::priv::_NonDbg_hashtable<*,*>|stlpdmtx_std::priv::_NonDbg_hashtable<*,*>|stlpdxmtx_std::priv::_NonDbg_hashtable<*,*>{
+ preview
+ (
+ $c._M_elems
+ )
+ children
+ (
+ #(
+ [raw view]: [$c,!],
+ size : $c._M_num_elements,
+ load factor : (float)$c._M_num_elements / ($c._M_buckets._M_finish - $c._M_buckets._M_start),
+ max load factor: $c._M_max_load_factor,
+ buckets : $c._M_buckets,
+ elements : $c._M_elems
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport::queue, stlport::priority_queue, stlport::stack
+;------------------------------------------------------------------------------
+stlp_std::queue<*>|stlpx_std::queue<*>|stlpmtx_std::queue<*>|stlpxmtx_std::queue<*>|stlpd_std::queue<*>|stlpdx_std::queue<*>|stlpdmtx_std::queue<*>|stlpdxmtx_std::queue<*>|stlp_std::priority_queue<*>|stlpx_std::priority_queue<*>|stlpmtx_std::priority_queue<*>|stlpxmtx_std::priority_queue<*>|stlpd_std::priority_queue<*>|stlpdx_std::priority_queue<*>|stlpdmtx_std::priority_queue<*>|stlpdxmtx_std::priority_queue<*>|stlp_std::stack<*>|stlpx_std::stack<*>|stlpmtx_std::stack<*>|stlpxmtx_std::stack<*>|stlpd_std::stack<*>|stlpdx_std::stack<*>|stlpdmtx_std::stack<*>|stlpdxmtx_std::stack<*>{
+ preview
+ (
+ $c.c
+ )
+ children
+ (
+ #(
+ [raw view] : [$c,!],
+ container : $c.c
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport debug iterator
+;------------------------------------------------------------------------------
+stlp_std::priv::_DBG_iter<*>|stlpx_std::priv::_DBG_iter<*>|stlpmtx_std::priv::_DBG_iter<*>|stlpxmtx_std::priv::_DBG_iter<*>|stlpd_std::priv::_DBG_iter<*>|stlpdx_std::priv::_DBG_iter<*>|stlpdmtx_std::priv::_DBG_iter<*>|stlpdxmtx_std::priv::_DBG_iter<*>{
+ preview
+ (
+ #if($c._M_owner != 0)
+ (
+ $c._M_iterator
+ )
+ #else
+ (
+ "undefined"
+ )
+ )
+ children
+ (
+ #(
+ #if($c._M_owner != 0)
+ (
+ #(
+ [raw view] : [$c,!],
+ [iterator] : $c._M_iterator,
+ [valid] : [true]
+ )
+ )
+ #else
+ (
+ #(
+ [raw view] : [$c,!],
+ [valid] : [false]
+ )
+ )
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport::bitset
+; TODO: Fix it, it doesn't work as expected even when adding an enum to the bitset
+; class to get access to the bitset static size rather than using $T1.
+;------------------------------------------------------------------------------
+stdp_std::bitset<*,*>|stdpx_std::bitset<*,*>|stdpmtx_std::bitset<*,*>|stdpxmtx_std::bitset<*,*>|stdpd_std::bitset<*>|stdpdx_std::bitset<*>|stdpdmtx_std::bitset<*>|stdpdxmtx_std::bitset<*>{
+ preview
+ (
+ #(
+ "[",
+ $T1,
+ "](",
+ #array
+ (
+ expr : ($c._M_w[$i / (sizeof(unsigned long) * 8)] >> ($i % (sizeof(unsigned long) * 8))),
+ size : $T1
+ ) : [($e & 1),d],
+ ")"
+ )
+ )
+ children
+ (
+ #array
+ (
+ expr : ($c._M_w[$i / (sizeof(unsigned long) * 8)] >> ($i % (sizeof(unsigned long) * 8))),
+ size : $T1
+ ) : (bool)($e & 1)
+ )
+}
+
+stdp_std::bitset<*>::reference|stdpx_std::bitset<*>::reference|stdpmtx_std::bitset<*>::reference|stdpxmtx_std::bitset<*>::reference|stdpd_std::bitset<*>::reference|stdpdx_std::bitset<*>::reference|stdpdmtx_std::bitset<*>::reference|stdpdxmtx_std::bitset<*>{
+ preview
+ (
+ #(
+ "bitset[", $c._M_bpos, "] = ",
+ (bool)(*($c._M_wp) >> $c._M_bpos) & 1)
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport::auto_ptr
+;------------------------------------------------------------------------------
+stlp_std::auto_ptr<*>|stlpx_std::auto_ptr<*>|stlpmtx_std::auto_ptr<*>|stlpxmtx_std::auto_ptr<*>|stlpd_std::auto_ptr<*>|stlpdx_std::auto_ptr<*>|stlpdmtx_std::auto_ptr<*>|stlpdxmtx_std::auto_ptr<*>{
+ preview
+ (
+ #if(($c._M_p) != 0)
+ (
+ [*($T1 *)$c._M_p]
+ )
+ #else
+ (
+ "null"
+ )
+ )
+ children
+ (
+ #if(($c._M_p) != 0)
+ (
+ #(
+ [raw view]: [$c,!],
+ ptr: [(unsigned int)$c._M_p, x],
+ value: [*($T1 *)$c._M_p]
+ )
+ )
+ #else
+ (
+ #(
+ [raw view]: [$c,!]
+ )
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport::complex
+;------------------------------------------------------------------------------
+stlp_std::complex<*>|stlpx_std::complex<*>|stlpmtx_std::complex<*>|stlpxmtx_std::complex<*>|stlpd_std::complex<*>|stlpdx_std::complex<*>|stlpdmtx_std::complex<*>|stlpdxmtx_std::complex<*>{
+ children
+ (
+ #(
+ real: $e._M_re,
+ imaginary: $e._M_im
+ )
+ )
+ preview
+ (
+ #if($e._M_im != 0)
+ (
+ #if ($e._M_re != 0)
+ ( ; Real and Imaginary components
+ #if ($e._M_im >= 0)
+ (
+ #($e._M_re,"+i*", $e._M_im)
+ )
+ #else
+ (
+ #($e._M_re,"-i*", -$e._M_im)
+ )
+ )
+ #else
+ ( ; Purely imaginary
+ #if ($e._M_im >= 0.0)
+ (
+ #("i*", $e._M_im)
+ )
+ #else
+ (
+ #("-i*", -$e._M_im)
+ )
+ )
+ )
+ #else
+ ( ; Purely real
+ $e._M_re
+ )
+ )
+}
+
+;------------------------------------------------------------------------------
+; stlport::valarray
+;------------------------------------------------------------------------------
+
+stlp_std::valarray<*>|stlpx_std::valarray<*>|stlpmtx_std::valarray<*>|stlpxmtx_std::valarray<*>|stlpd_std::valarray<*>|stlpdx_std::valarray<*>|stlpdmtx_std::valarray<*>|stlpdxmtx_std::valarray<*>{
+ preview
+ (
+ #(
+ "[",
+ $c._M_size ,
+ "](",
+ #array
+ (
+ expr : ($c._M_first)[$i],
+ size : $c._M_size
+ ),
+ ")"
+ )
+ )
+
+ children
+ (
+ #array
+ (
+ expr : ($c._M_first)[$i],
+ size : $c._M_size
+ )
+ )
+}
+
+stlp_std::slice|stlpx_std::slice|stlpmtx_std::slice|stlpxmtx_std::slice|stlpd_std::slice|stlpdx_std::slice|stlpdmtx_std::slice|stlpdxmtx_std::slice{
+ preview
+ (
+ #(
+ "start = ",
+ $c._M_start,
+ ", size = ",
+ $c._M_length,
+ ", stride = ",
+ $c._M_stride
+ )
+ )
+ children
+ (
+ #(
+ [raw view] : [$c,!],
+ start : $c._M_start,
+ size : $c._M_length,
+ stride : $c._M_stride
+ )
+ )
+}
+
+stlp_std::gslice|stlpx_std::gslice|stlpmtx_std::gslice|stlpxmtx_std::gslice|stlpd_std::gslice|stlpdx_std::gslice|stlpdmtx_std::gslice|stlpdxmtx_std::gslice{
+ preview
+ (
+ #(
+ "start = ",
+ $c._M_start,
+ ", sizes = ",
+ $c._M_lengths,
+ ", strides = ",
+ $c._M_strides
+ )
+ )
+ children
+ (
+ #(
+ [raw view] : [$c,!],
+ start : $c._M_start,
+ sizes : $c._M_lengths,
+ strides : $c._M_strides
+ )
+ )
+}
diff --git a/etc/msvcincl.dat b/etc/msvcincl.dat
new file mode 100644
index 0000000..64d6881
--- /dev/null
+++ b/etc/msvcincl.dat
@@ -0,0 +1,309 @@
+algo.h
+algobase.h
+algorith.h
+algorithm
+alloc.h
+bitset
+bitset.h
+bvector.h
+cassert
+cassert.h
+cctype
+cctype.h
+cerrno
+cerrno.h
+cfloat
+cfloat.h
+char_traits.h
+climits
+climits.h
+clocale
+clocale.h
+cmath
+cmath.h
+complex
+complex.h
+concept_checks.h
+configure
+configure.in
+csetjmp
+csetjmp.h
+csignal
+csignal.h
+cstdarg
+cstdarg.h
+cstddef
+cstddef.h
+cstdio
+cstdio.h
+cstdlib
+cstdlib.h
+cstring
+cstring.h
+ctime
+ctime.h
+ctype.h
+cwchar
+cwchar.h
+cwctype
+cwctype.h
+c_locale.h
+defalloc.h
+deque
+deque.h
+exceptio.h
+exception
+exception.h
+export
+fstream
+fstream.h
+function.h
+functional
+hashtable.h
+hash_map
+hash_map.h
+hash_set
+hash_set.h
+heap.h
+iomanip
+iomanip.h
+ios
+ios.h
+iosfwd
+iosfwd.h
+iostream
+iostream.h
+istream
+istream.h
+iterator
+iterator.h
+limits
+limits.h
+list
+list.h
+locale
+locale.h
+map
+map.h
+math.h
+mem.h
+memory
+memory.h
+mmemory.h
+msl_string.h
+multimap.h
+multiset.h
+new
+new.h
+numeric
+numeric.h
+numeric.h
+ostream
+ostream.h
+pair.h
+pthread.h
+pthread_alloc
+pthread_alloc.h
+queue
+queue.h
+rope
+rope.h
+set
+set.h
+setjmp.h
+signal.h
+slist
+slist.h
+sstream
+sstream.h
+stack
+stack.h
+stdarg.h
+stddef.h
+stddef.h
+stdexcep.h
+stdexcept
+stdio.h
+stdio_streambuf
+stdlib.h
+stdlib.h
+stlcomp.h
+stlconf.h.in
+stl_apcc.h
+stl_apple.bak.h
+stl_apple.h
+stl_as400.h
+stl_bc.h
+stl_como.h
+stl_confix.h
+stl_dec.h
+stl_dec_vms.h
+stl_fujitsu.h
+stl_gcc.h
+stl_hpacc.h
+stl_ibm.h
+stl_intel.h
+stl_kai.h
+stl_mlc.h
+stl_msvc.h
+stl_mwerks.h
+stl_mycomp.h
+stl_sco.h
+stl_select_lib.h
+stl_sgi.h
+stl_solaris.h
+stl_sunpro.h
+stl_symantec.h
+stl_tmpl.h
+stl_user_config.h
+stl_watcom.h
+stl_wince.h
+streambu.h
+streambuf
+streambuf.h
+string
+string.h
+strstrea.h
+strstream
+strstream.h
+tempbuf.h
+time.h
+tree.h
+typeinfo
+typeinfo.h
+type_traits.h
+utility
+utility.h
+valarray
+valarray.h
+vc_select_lib.h
+vector
+vector.h
+wchar.h
+wctype.h
+_abbrevs.h
+_algo.c
+_algo.h
+_algobase.c
+_algobase.h
+_alloc.c
+_alloc.h
+_alloc_old.h
+_auto_ptr.h
+_bitset.c
+_bitset.h
+_bvector.h
+_check_config.h
+_codecvt.h
+_collate.h
+_complex.c
+_complex.h
+_config.h
+_config_compat.h
+_config_compat_post.h
+_construct.h
+_ctraits_fns.h
+_ctype.h
+_cwchar.h
+_debug.c
+_debug.h
+_deque.c
+_deque.h
+_epilog.h
+_epilog.h
+_exception.h
+_fstream.c
+_fstream.h
+_function.h
+_function_base.h
+_hashtable.c
+_hashtable.h
+_hash_fun.h
+_hash_map.h
+_hash_set.h
+_heap.c
+_heap.h
+_ios.c
+_ios.h
+_iosfwd.h
+_ios_base.h
+_istream.c
+_istream.h
+_istreambuf_iterator.h
+_iterator.h
+_iterator.h
+_iterator_base.h
+_iterator_old.h
+_limits.c
+_limits.h
+_list.c
+_list.h
+_list.h
+_locale.h
+_map.h
+_messages_facets.h
+_mmap.h
+_monetary.c
+_monetary.h
+_msvc_warnings_off.h
+_null_stream.h
+_numeric.c
+_numeric.h
+_numpunct.h
+_num_get.c
+_num_get.h
+_num_put.c
+_num_put.h
+_ostream.c
+_ostream.h
+_ostreambuf_iterator.h
+_pair.h
+_prolog.h
+_pthread_alloc.h
+_ptrs_specialize.h
+_queue.h
+_range_errors.h
+_raw_storage_iter.h
+_relops.h
+_relops_cont.h
+_relops_template.h
+_rope.c
+_rope.h
+_set.h
+_set_operators.h
+_site_config.h
+_slist.c
+_slist.h
+_slist_base.c
+_slist_base.h
+_sparc_atomic.h
+_sstream.c
+_sstream.h
+_stack.h
+_stdio_file.h
+_stdio_file.h.new
+_streambuf.c
+_streambuf.h
+_streambuf_iterator.h
+_stream_iterator.h
+_string.c
+_string.h
+_string_fwd.c
+_string_fwd.h
+_string_hash.h
+_string_io.c
+_string_io.h
+_strstream.h
+_tempbuf.c
+_tempbuf.h
+_threads.c
+_threads.h
+_time_facets.c
+_time_facets.h
+_tree.c
+_tree.h
+_uninitialized.h
+_valarray.c
+_valarray.h
+_vector.c
+_vector.h
diff --git a/etc/std_headers.txt b/etc/std_headers.txt
new file mode 100644
index 0000000..321e8ff
--- /dev/null
+++ b/etc/std_headers.txt
@@ -0,0 +1,34 @@
+algorithm
+bitset
+complex
+deque
+fstream
+functional
+hash_map
+hash_set
+iomanip
+ios
+iosfwd
+iostream
+istream
+iterator
+limits
+list
+locale
+map
+memory
+numeric
+ostream
+pthread_alloc
+queue
+set
+slist
+sstream
+stack
+stdexcept
+streambuf
+string
+strstream
+utility
+valarray
+vector
diff --git a/etc/std_headers_c.txt b/etc/std_headers_c.txt
new file mode 100644
index 0000000..3753b7d
--- /dev/null
+++ b/etc/std_headers_c.txt
@@ -0,0 +1,17 @@
+cassert
+cctype
+cerrno
+cfloat
+climits
+clocale
+cmath
+csetjmp
+csignal
+cstdarg
+cstddef
+cstdio
+cstdlib
+cstring
+ctime
+cwchar
+cwctype
diff --git a/etc/std_headers_c_h.txt b/etc/std_headers_c_h.txt
new file mode 100644
index 0000000..dc78cd7
--- /dev/null
+++ b/etc/std_headers_c_h.txt
@@ -0,0 +1,13 @@
+ctype.h
+locale.h
+math.h
+setjmp.h
+signal.h
+stdarg.h
+stddef.h
+stdio.h
+stdlib.h
+string.h
+time.h
+wchar.h
+wctype.h
diff --git a/etc/std_headers_classic_iostreams.txt b/etc/std_headers_classic_iostreams.txt
new file mode 100644
index 0000000..cb035dd
--- /dev/null
+++ b/etc/std_headers_classic_iostreams.txt
@@ -0,0 +1,8 @@
+fstream.h
+iomanip.h
+ios.h
+iostream.h
+istream.h
+ostream.h
+streambuf.h
+strstream.h
diff --git a/etc/std_headers_cpp_runtime.txt b/etc/std_headers_cpp_runtime.txt
new file mode 100644
index 0000000..90f93bb
--- /dev/null
+++ b/etc/std_headers_cpp_runtime.txt
@@ -0,0 +1,3 @@
+exception
+new
+typeinfo
diff --git a/etc/std_headers_cpp_runtime_h.txt b/etc/std_headers_cpp_runtime_h.txt
new file mode 100644
index 0000000..6c1fb1d
--- /dev/null
+++ b/etc/std_headers_cpp_runtime_h.txt
@@ -0,0 +1,3 @@
+exception.h
+new.h
+typeinfo.h
diff --git a/etc/stlport_powered_red.gif b/etc/stlport_powered_red.gif
new file mode 100644
index 0000000..8f725d1
--- /dev/null
+++ b/etc/stlport_powered_red.gif
Binary files differ
diff --git a/etc/stlport_powered_white.gif b/etc/stlport_powered_white.gif
new file mode 100644
index 0000000..2bea0fc
--- /dev/null
+++ b/etc/stlport_powered_white.gif
Binary files differ
diff --git a/exception b/exception
deleted file mode 100644
index a8e8cd7..0000000
--- a/exception
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-// This header exists solely for portability. Normally it just includes
-// the native header <exception>.
-
-#ifndef _STLP_EXCEPTION
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x423
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x423)
-# define _STLP_DONT_POP_HEADER_ID
-# define _STLP_EXCEPTION
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x423) || defined (_STLP_DONT_POP_HEADER_ID)
-/* If we are here it means that we are in an include called
- * from the native lib which means that we can simply forward this
- * call to the native exception header:
- */
-# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
-#else
-# include <stl/_exception.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x423)
-# if !defined(_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-#endif
-
-#endif /* _STLP_EXCEPTION */
-
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/exception.h b/exception.h
deleted file mode 100644
index c5937ab..0000000
--- a/exception.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_OLDSTD_exception
-#define _STLP_OLDSTD_exception
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x824
-# include <stl/_prolog.h>
-#endif
-
-#if defined (__BORLANDC__) || defined (_MSC_VER)
-# include <exception>
-#else
-# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x824)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_OLDSTD_exception */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/float.h b/float.h
deleted file mode 100644
index 67adb57..0000000
--- a/float.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x203
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x203) && !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x203)
-# error This header is only reentrant once, it should be modified if it has to be included more.
-#endif
-
-#if defined (_STLP_WCE_EVC3)
-struct _exception;
-#endif
-
-#include _STLP_NATIVE_C_HEADER(float.h)
-
-#if defined(__BORLANDC__) && defined (__cplusplus) && (__BORLANDC__ >= 0x560)
-_STLP_BEGIN_NAMESPACE
-using ::_max_dble;
-using ::_max_flt;
-using ::_max_ldble;
-using ::_tiny_ldble;
-_STLP_END_NAMESPACE
-#endif
-
-#if defined (__BORLANDC__) && defined (__cplusplus) && !defined (_STLP_BCC_FPU_BUG)
-# define _STLP_BCC_FPU_BUG
-// Ignore FPU exceptions, set FPU precision to 53 bits for floatio_test and cmath_test
-static unsigned int _bcc_fpu_bug = _control87(PC_53|MCW_EM, MCW_PC|MCW_EM);
-template <class _Fp>
-int __fpclass(_Fp __val)
-{ int __f = _fpclass(__val); _control87(PC_53|MCW_EM, MCW_PC|MCW_EM); return __f; }
-# define _fpclass __fpclass
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x203)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-# undef _STLP_DONT_POP_HEADER_ID
-#endif
diff --git a/fstream b/fstream
deleted file mode 100644
index efdf645..0000000
--- a/fstream
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-
-// This header defines classes basic_filebuf, basic_ifstream,
-// basic_ofstream, and basic_fstream. These classes represent
-// streambufs and streams whose sources or destinations are files.
-
-#ifndef _STLP_FSTREAM
-#define _STLP_FSTREAM
-
-# ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x1025
-# include <stl/_prolog.h>
-# endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-# include <stl/_ioserr.h>
-# include <stl/_fstream.h>
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x1025)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-
-#endif /* _STLP_FSTREAM */
-
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/functional b/functional
deleted file mode 100644
index d074103..0000000
--- a/functional
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_FUNCTIONAL
-#define _STLP_FUNCTIONAL
-
-# ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x27
-# include <stl/_prolog.h>
-# endif
-
-# ifdef _STLP_PRAGMA_ONCE
-# pragma once
-# endif
-
-# if defined (_STLP_IMPORT_VENDOR_STD)
-# include _STLP_NATIVE_HEADER(functional)
-# endif
-
-# ifndef _STLP_INTERNAL_FUNCTION_H
-# include <stl/_function.h>
-# endif
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x27)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-
-#endif /* _STLP_FUNCTIONAL */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/iomanip b/iomanip
deleted file mode 100644
index 6956190..0000000
--- a/iomanip
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_IOMANIP
-#define _STLP_IOMANIP
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x1030
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#include <stl/_ioserr.h>
-#include <stl/_istream.h> // Includes <ostream> and <ios>
-
-_STLP_BEGIN_NAMESPACE
-
-//----------------------------------------------------------------------
-// Machinery for defining manipulators.
-
-// Class that calls one of ios_base's single-argument member functions.
-template <class _Arg>
-struct _Ios_Manip_1 {
- typedef _Arg (ios_base::*__f_ptr_type)(_Arg);
-
- _Ios_Manip_1(__f_ptr_type __f, const _Arg& __arg)
- : _M_f(__f), _M_arg(__arg) {}
-
- void operator()(ios_base& __ios) const
- { (__ios.*_M_f)(_M_arg); }
-
- __f_ptr_type _M_f;
- _Arg _M_arg;
-};
-
-// Class that calls one of ios_base's two-argument member functions.
-struct _Ios_Setf_Manip {
- ios_base::fmtflags _M_flag;
- ios_base::fmtflags _M_mask;
- bool _M_two_args;
-
- _Ios_Setf_Manip(ios_base::fmtflags __f)
- : _M_flag(__f), _M_mask(0), _M_two_args(false) {}
-
- _Ios_Setf_Manip(ios_base::fmtflags __f, ios_base::fmtflags __m)
- : _M_flag(__f), _M_mask(__m), _M_two_args(true) {}
-
- void operator()(ios_base& __ios) const {
- if (_M_two_args)
- __ios.setf(_M_flag, _M_mask);
- else
- __ios.setf(_M_flag);
- }
-};
-
-
-template <class _CharT, class _Traits, class _Arg>
-inline basic_istream<_CharT, _Traits>& _STLP_CALL
-operator>>(basic_istream<_CharT, _Traits>& __istr,
- const _Ios_Manip_1<_Arg>& __f) {
- __f(__istr);
- return __istr;
-}
-
-template <class _CharT, class _Traits, class _Arg>
-inline basic_ostream<_CharT, _Traits>& _STLP_CALL
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const _Ios_Manip_1<_Arg>& __f) {
- __f(__os);
- return __os;
-}
-
-template <class _CharT, class _Traits>
-inline basic_istream<_CharT, _Traits>& _STLP_CALL
-operator>>(basic_istream<_CharT, _Traits>& __istr, const _Ios_Setf_Manip& __f) {
- __f(__istr);
- return __istr;
-}
-
-template <class _CharT, class _Traits>
-inline basic_ostream<_CharT, _Traits>& _STLP_CALL
-operator<<(basic_ostream<_CharT, _Traits>& __os, const _Ios_Setf_Manip& __f) {
- __f(__os);
- return __os;
-}
-
-//----------------------------------------------------------------------
-// The ios_base manipulators.
-inline _Ios_Setf_Manip _STLP_CALL resetiosflags(ios_base::fmtflags __mask)
-{ return _Ios_Setf_Manip(0, __mask); }
-
-inline _Ios_Setf_Manip _STLP_CALL setiosflags(ios_base::fmtflags __flag)
-{ return _Ios_Setf_Manip(__flag); }
-
-inline _Ios_Setf_Manip _STLP_CALL setbase(int __n) {
- ios_base::fmtflags __base = __n == 8 ? ios_base::oct :
- __n == 10 ? ios_base::dec :
- __n == 16 ? ios_base::hex :
- ios_base::fmtflags(0);
- return _Ios_Setf_Manip(__base, ios_base::basefield);
-}
-
-inline _Ios_Manip_1<streamsize> _STLP_CALL
-setprecision(int __n) {
- _Ios_Manip_1<streamsize>::__f_ptr_type __f = &ios_base::precision;
- return _Ios_Manip_1<streamsize>(__f, __n);
-}
-
-inline _Ios_Manip_1<streamsize> _STLP_CALL
-setw(int __n) {
- _Ios_Manip_1<streamsize>::__f_ptr_type __f = &ios_base::width;
- return _Ios_Manip_1<streamsize>(__f, __n);
-}
-
-//----------------------------------------------------------------------
-// setfill, a manipulator that operates on basic_ios<> instead of ios_base.
-
-template <class _CharT>
-struct _Setfill_Manip {
- _Setfill_Manip(_CharT __c) : _M_c(__c) {}
- _CharT _M_c;
-};
-
-template <class _CharT, class _CharT2, class _Traits>
-inline basic_ostream<_CharT, _Traits>& _STLP_CALL
-operator<<(basic_ostream<_CharT, _Traits>& __os,
- const _Setfill_Manip<_CharT2>& __m) {
- __os.fill(__m._M_c);
- return __os;
-}
-
-template <class _CharT, class _CharT2, class _Traits>
-inline basic_istream<_CharT, _Traits>& _STLP_CALL
-operator>>(basic_istream<_CharT, _Traits>& __is,
- const _Setfill_Manip<_CharT2>& __m) {
- __is.fill(__m._M_c);
- return __is;
-}
-
-template <class _CharT>
-inline _Setfill_Manip<_CharT> _STLP_CALL
-setfill(_CharT __c) {
- return _Setfill_Manip<_CharT>(__c);
-}
-
-_STLP_END_NAMESPACE
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x1030)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_IOMANIP */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/ios b/ios
deleted file mode 100644
index 2a923ad..0000000
--- a/ios
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_IOS
-#define _STLP_IOS
-
-# ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x1032
-# include <stl/_prolog.h>
-# endif
-
-# ifdef _STLP_PRAGMA_ONCE
-# pragma once
-# endif
-
-# include <stl/_ioserr.h>
-# include <stl/_ios.h>
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x1032)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-
-#endif /* _STLP_IOS */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/iosfwd b/iosfwd
deleted file mode 100644
index 0a44982..0000000
--- a/iosfwd
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_IOSFWD
-#define _STLP_IOSFWD
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x1034
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#if !defined (_STLP_USE_NO_IOSTREAMS)
-
-# if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR)
-# include <stl/_cwchar.h>
-# endif /* _STLP_HAS_WCHAR_T && !_STLP_CWCHAR */
-
-# include <stl/_iosfwd.h>
-#else
-# include <stl/char_traits.h>
-#endif /* _STLP_USE_NO_IOSTREAMS */
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x1034)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_IOSFWD */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/iostream b/iostream
deleted file mode 100644
index 05289e4..0000000
--- a/iostream
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_IOSTREAM
-#define _STLP_IOSTREAM
-
-# ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x1037
-# include <stl/_prolog.h>
-# endif
-
-# ifdef _STLP_PRAGMA_ONCE
-# pragma once
-# endif
-
-#include <stl/_ioserr.h>
-
-#ifdef _STLP_REDIRECT_STDSTREAMS
-// for ofstream redirection
-# include <fstream>
-#endif
-
-#include <stl/_iosfwd.h>
-#include <stl/_istream.h>
-
-_STLP_BEGIN_NAMESPACE
-
-#ifndef _STLP_USE_NAMESPACES
-// in case of SGI iostreams, we have to rename our streams not to clash with those
-// provided in native lib
-# define cin _STLP_cin
-# define cout _STLP_cout
-# define cerr _STLP_cerr
-# define clog _STLP_clog
-#endif
-
-// Note: cin and wcin are both associated with stdio. The C standard
-// (Amendment 1, section 4.6.2.1) says that it is an error to mix
-// wide- and narrow-oriented I/O on the same stream. This implies
-// that it is an error to use both cin and wcin in the same C++
-// program; the same applies to cout and wcout, and cerr/clog and
-// wcerr/wclog.
-
-# ifdef _STLP_REDIRECT_STDSTREAMS
-extern _STLP_DECLSPEC istream cin;
-extern _STLP_DECLSPEC ofstream cout;
-extern _STLP_DECLSPEC ofstream cerr;
-extern _STLP_DECLSPEC ofstream clog;
-# else
-extern _STLP_DECLSPEC istream cin;
-extern _STLP_DECLSPEC ostream cout;
-extern _STLP_DECLSPEC ostream cerr;
-extern _STLP_DECLSPEC ostream clog;
-# endif
-
-# ifndef _STLP_NO_WCHAR_T
-extern _STLP_DECLSPEC wistream wcin;
-extern _STLP_DECLSPEC wostream wcout;
-extern _STLP_DECLSPEC wostream wcerr;
-extern _STLP_DECLSPEC wostream wclog;
-# endif
-
-_STLP_END_NAMESPACE
-
-//# elif defined ( _STLP_USE_NO_IOSTREAMS )
-//# include <stl/_null_stream.h>
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x1037)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-
-#endif /* _STLP_IOSTREAM */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/iso646.h b/iso646.h
deleted file mode 100644
index 058ed3b..0000000
--- a/iso646.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x204
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x204) && !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-/* evc3 doesn't have iso646.h */
-#if !defined (_STLP_WCE_EVC3) && !defined (N_PLAT_NLM) && !defined (__BORLANDC__)
-# include _STLP_NATIVE_C_HEADER(iso646.h)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x204)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-# undef _STLP_DONT_POP_HEADER_ID
-#endif
-
-/* Local Variables:
- * mode:C++
- * End:
- */
diff --git a/istream b/istream
deleted file mode 100644
index 9c288ba..0000000
--- a/istream
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_ISTREAM
-#define _STLP_ISTREAM
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x1036
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#include <stl/_ioserr.h>
-
-#ifndef _STLP_INTERNAL_ISTREAM
-# include <stl/_istream.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x1036)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_ISTREAM */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/iterator b/iterator
deleted file mode 100644
index b08caf4..0000000
--- a/iterator
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_ITERATOR
-#define _STLP_ITERATOR
-
-# ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x38
-# include <stl/_prolog.h>
-# endif
-
-# ifdef _STLP_PRAGMA_ONCE
-# pragma once
-# endif
-
-#if defined (_STLP_IMPORT_VENDOR_STD)
-# include _STLP_NATIVE_HEADER(iterator)
-#endif /* IMPORT */
-
-# ifndef _STLP_INTERNAL_ITERATOR_H
-# include <stl/_iterator.h>
-# endif
-
-# ifndef _STLP_INTERNAL_STREAM_ITERATOR_H
-# include <stl/_stream_iterator.h>
-# endif
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x38)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-
-#endif /* _STLP_ITERATOR */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/libstlport.mk b/libstlport.mk
new file mode 100644
index 0000000..43b5124
--- /dev/null
+++ b/libstlport.mk
@@ -0,0 +1,12 @@
+# Add a couple include paths to use stlport.
+
+# Only use this on the device or emulator.
+ifeq ($(TARGET_SIMULATOR),true)
+$(error STLPort not suitable for the simulator! $(LOCAL_PATH))
+endif
+
+# Make sure bionic is first so we can include system headers.
+LOCAL_C_INCLUDES := \
+ bionic \
+ external/stlport/stlport \
+ $(LOCAL_C_INCLUDES)
diff --git a/limits b/limits
deleted file mode 100644
index c0db9eb..0000000
--- a/limits
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_LIMITS
-#define _STLP_LIMITS
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x39
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#ifndef _STLP_INTERNAL_LIMITS
-# include <stl/_limits.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x39)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_LIMITS */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/limits.h b/limits.h
deleted file mode 100644
index 9353af1..0000000
--- a/limits.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x201
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x201) && ! defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-#if defined(_STLP_WCE_EVC3)
-struct _exception;
-#endif
-
-#include _STLP_NATIVE_C_HEADER(limits.h)
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x201)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-# undef _STLP_DONT_POP_HEADER_ID
-#endif
diff --git a/list b/list
deleted file mode 100644
index a638f04..0000000
--- a/list
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_LIST
-#define _STLP_LIST
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x40
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#ifndef _STLP_INTERNAL_LIST_H
-# include <stl/_list.h>
-#endif
-
-#if defined (_STLP_IMPORT_VENDOR_STD)
-# include _STLP_NATIVE_HEADER(list)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x40)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_LIST */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/locale b/locale
deleted file mode 100644
index 289bfe3..0000000
--- a/locale
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_LOCALE
-#define _STLP_LOCALE
-
-// Basic framework: class locale and class locale::facet
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x1041
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#include <stl/_ioserr.h>
-
-// Individual facets
-#ifndef _STLP_INTERNAL_CTYPE_H
-# include <stl/_ctype.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CODECVT_H
-# include <stl/_codecvt.h>
-#endif
-
-#ifndef _STLP_INTERNAL_COLLATE_H
-# include <stl/_collate.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NUM_PUT_H
-# include <stl/_num_put.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NUM_GET_H
-# include <stl/_num_get.h>
-#endif
-
-// those never included separately anyway
-#include <stl/_monetary.h>
-#include <stl/_time_facets.h>
-#include <stl/_messages_facets.h>
-
-// some stuff for streambuf iterators ended up defined there
-// Strictly speaking, _istream.h portion is only required for <iterator>, but it may break too many
-// programs if we omit it
-#ifndef _STLP_ISTREAM_H
-# include <stl/_istream.h>
-#endif
-
-// Convenience interfaces
-#undef isspace
-#undef isprint
-#undef iscntrl
-#undef isupper
-#undef islower
-#undef isalpha
-#undef isdigit
-#undef ispunct
-#undef isxdigit
-#undef isalnum
-#undef isgraph
-#undef toupper
-#undef tolower
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _CharT>
-inline bool isspace (_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::space, c); }
-
-template <class _CharT>
-inline bool isprint (_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::print, c); }
-
-template <class _CharT>
-inline bool iscntrl (_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::cntrl, c); }
-
-template <class _CharT>
-inline bool isupper (_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::upper, c); }
-
-template <class _CharT>
-inline bool islower (_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::lower, c); }
-
-template <class _CharT>
-inline bool isalpha (_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alpha, c); }
-
-template <class _CharT>
-inline bool isdigit (_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::digit, c); }
-
-template <class _CharT>
-inline bool ispunct (_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::punct, c); }
-
-template <class _CharT>
-inline bool isxdigit (_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::xdigit, c); }
-
-template <class _CharT>
-inline bool isalnum (_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alnum, c); }
-
-template <class _CharT>
-inline bool isgraph (_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::graph, c); }
-
-template <class _CharT>
-inline _CharT toupper(_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).toupper(c); }
-
-template <class _CharT>
-inline _CharT tolower(_CharT c, const locale& loc)
-{ return (use_facet<ctype<_CharT> >(loc)).tolower(c); }
-
-_STLP_END_NAMESPACE
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x1041)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_LOCALE */
-
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/locale.h b/locale.h
deleted file mode 100644
index 9bf7691..0000000
--- a/locale.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x242
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x242)
-# if !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-# else
-# error STLport include schema violation
-# endif
-#endif
-
-/* evc3 doesn't have locale.h */
-#ifndef _STLP_WCE_EVC3
-# include _STLP_NATIVE_C_HEADER(locale.h)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x242)
-# if !defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-#endif
-
-/* Local Variables:
- * mode:C++
- * End:
- */
diff --git a/map b/map
deleted file mode 100644
index e18a89b..0000000
--- a/map
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_MAP
-#define _STLP_MAP
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x43
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#include <stl/_map.h>
-
-#if defined (_STLP_IMPORT_VENDOR_STD)
-# include _STLP_NATIVE_HEADER(map)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x43)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_MAP */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/math.h b/math.h
deleted file mode 100644
index 57bf541..0000000
--- a/math.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x244
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x244) && !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-#if !defined (exception) && (!defined (__KCC) || (__KCC_VERSION < 4000)) && \
- !(defined(__IBMCPP__) && (500 <= __IBMCPP__)) && !defined(_STLP_WCE_EVC3)
-# define _STLP_EXCEPTION_WAS_REDEFINED 1
-# define exception __math_exception
-#endif
-
-#include _STLP_NATIVE_C_HEADER(math.h)
-
-#if defined (_STLP_EXCEPTION_WAS_REDEFINED)
-# undef exception
-# undef _STLP_EXCEPTION_WAS_REDEFINED
-#endif
-
-#ifdef _STLP_WCE_EVC3
-# undef _exception
-# define _exception exception
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x244)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-#endif
-
-/* Local Variables:
- * mode:C++
- * End:
- */
diff --git a/mem.h b/mem.h
deleted file mode 100644
index d8b3935..0000000
--- a/mem.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_mem_h
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x245
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x245) && !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x245) || defined (_STLP_DONT_POP_HEADER_ID)
-# include _STLP_NATIVE_C_HEADER(mem.h)
-#else
-# if defined (__BORLANDC__) && defined (__USING_CNAME__)
-# define _USING_CNAME_WAS_UNDEFINED
-# undef __USING_CNAME__
-# endif
-
-# include _STLP_NATIVE_C_HEADER(mem.h)
-
-# if defined (__BORLANDC__) && defined (_USING_CNAME_WAS_UNDEFINED)
-# define __USING_CNAME__
-# define _STLP_mem_h 1
-# undef _USING_CNAME_WAS_UNDEFINED
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x245)
-# if !defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-# undef _STLP_DONT_POP_HEADER_ID
-#endif
-
-#endif /* _STLP_mem_h */
-
-/* Local Variables:
- * mode:C++
- * End:
- */
diff --git a/memory b/memory
deleted file mode 100644
index 89af883..0000000
--- a/memory
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 1997-1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_MEMORY
-#define _STLP_MEMORY
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x46
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-# include <stl/_alloc.h>
-#endif
-
-#ifndef _STLP_INTERNAL_TEMPBUF_H
-# include <stl/_tempbuf.h>
-#endif
-
-#ifndef _STLP_INTERNAL_RAW_STORAGE_ITER_H
-# include <stl/_raw_storage_iter.h>
-#endif
-
-#include <stl/_auto_ptr.h>
-
-#if defined (_STLP_IMPORT_VENDOR_STD)
-
-# if defined (__MSL__)
-# include _STLP_NATIVE_HEADER(limits)
-# endif
-
-# include _STLP_NATIVE_HEADER(memory)
-
-# if defined (__MSL__) && (__MSL__ >= 0x2405 && __MSL__ < 0x5201)
-/* 980401 vss MSL 2.4 Pro 3 Release */
-# include <new_mem.h>
-# endif
-
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x46)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_MEMORY */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/new b/new
deleted file mode 100644
index e013dab..0000000
--- a/new
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_NEW_HEADER
-#define _STLP_NEW_HEADER
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x447
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x447)
-# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new)
-#else
-# ifndef _STLP_NEW_H_HEADER
-# include <stl/_new.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x447)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_NEW */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/new.h b/new.h
deleted file mode 100644
index 6489b5d..0000000
--- a/new.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x848
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x848) && ! defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-#if !defined(_STLP_NO_NEW_HEADER)
-# if defined (__BORLANDC__)
-# include <new>
-# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800 && !defined(_MSC_VER))
-# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h)
-# else
-# if defined (__GNUC__) && (__GNUC__ >= 3)
-# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h)
-# else
-# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new.h)
-# endif
-# endif
-#endif /* !defined(_STLP_NO_NEW_HEADER) */
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x848)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-#endif
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/numeric b/numeric
deleted file mode 100644
index 8a32cfe..0000000
--- a/numeric
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_NUMERIC
-#define _STLP_NUMERIC
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x49
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#ifndef _STLP_INTERNAL_NUMERIC_H
-# include <stl/_numeric.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x49)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_NUMERIC */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/ostream b/ostream
deleted file mode 100644
index 0cf823f..0000000
--- a/ostream
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_OSTREAM
-#define _STLP_OSTREAM
-
-# ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x1050
-# include <stl/_prolog.h>
-# endif
-
-# ifdef _STLP_PRAGMA_ONCE
-# pragma once
-# endif
-
-# include <stl/_ioserr.h>
-# include <stl/_ostream.h>
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x1050)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-
-#endif /* _STLP_OSTREAM */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/pthread.h b/pthread.h
deleted file mode 100644
index 57c0c24..0000000
--- a/pthread.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-# if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x280
-# include <stl/_prolog.h>
-# elif (_STLP_OUTERMOST_HEADER_ID == 0x280) && ! defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-# endif
-
-# if defined (__SUNPRO_CC) || defined (__HP_aCC)
-# include "/usr/include/pthread.h"
-# else
-# include _STLP_NATIVE_C_HEADER(pthread.h)
-# endif
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x280)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-# endif
-
-/*
- Local Variables:
- mode:C++
- End:
-*/
diff --git a/queue b/queue
deleted file mode 100644
index 190bc06..0000000
--- a/queue
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_QUEUE
-#define _STLP_QUEUE
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x53
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#ifndef _STLP_INTERNAL_QUEUE_H
-# include <stl/_queue.h>
-#endif
-
-#ifndef _STLP_FUNCTIONAL
-# include <functional>
-#endif
-
-#if defined (_STLP_IMPORT_VENDOR_STD)
-# include _STLP_NATIVE_HEADER(queue)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x53)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_QUEUE */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/set b/set
deleted file mode 100644
index 4c3dd2d..0000000
--- a/set
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_SET
-#define _STLP_SET
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x55
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#include <stl/_set.h>
-
-#if defined (_STLP_IMPORT_VENDOR_STD)
-# include _STLP_NATIVE_HEADER(set)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x55)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_SET */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/setjmp.h b/setjmp.h
deleted file mode 100644
index dabef16..0000000
--- a/setjmp.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_SETJMP_H
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x256
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x256) && !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-# define _STLP_SETJMP_H
-#endif
-
-#if defined(_STLP_WCE_EVC3)
-struct _exception;
-#endif
-
-#if !defined (setjmp)
-# define _STLP_NATIVE_SETJMP_H_INCLUDED
-# include _STLP_NATIVE_C_HEADER(setjmp.h)
-#endif
-
-#if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
-/* See errno.h file for a description of this problem. */
-# error setjmp has been defined before inclusion of setjmp.h header.
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x256)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-#endif
-#endif /* _STLP_SETJMP_H */
diff --git a/signal.h b/signal.h
deleted file mode 100644
index 7b3c70a..0000000
--- a/signal.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x257
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x257) && ! defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-/* evc3 and evc4 don't have signal.h */
-#ifndef _STLP_WCE
-# include _STLP_NATIVE_C_HEADER(signal.h)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x257)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-# undef _STLP_DONT_POP_HEADER_ID
-#endif
-
-/* Local Variables:
- * mode:C++
- * End:
- */
diff --git a/src/_stdio_file.h b/src/_stdio_file.h
new file mode 100644
index 0000000..d913fc4
--- /dev/null
+++ b/src/_stdio_file.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STDIO_FILE_H
+#define _STLP_STDIO_FILE_H
+
+/* This file provides a low-level interface between the internal
+ * representation of struct FILE, from the C stdio library, and
+ * the C++ I/O library. */
+
+#ifndef _STLP_CSTDIO
+# include <cstdio>
+#endif
+#ifndef _STLP_CSTDDEF
+# include <cstddef>
+#endif
+
+#if defined (__MSL__)
+# include <unix.h> /* get the definition of fileno */
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_WCE)
+
+inline int _FILE_fd(const FILE *__f) {
+ /* Check if FILE is one of the three standard streams
+ We do this check first, because invoking _fileno() on one of them
+ causes a terminal window to be created. This also happens if you do
+ any IO on them, but merely retrieving the filedescriptor shouldn't
+ already do that.
+
+ Obviously this is pretty implementation-specific because it requires
+ that indeed the first three FDs are always the same, but that is not
+ only common but almost guaranteed. */
+ for (int __fd = 0; __fd != 3; ++__fd) {
+ if (__f == _getstdfilex(__fd))
+ return __fd;
+ }
+
+ /* Normal files. */
+ return (int)::_fileno((FILE*)__f);
+}
+
+# elif defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
+
+inline int _FILE_fd(const FILE *__f) { return __f->__file; }
+
+# elif defined (__sun) && defined (_LP64)
+
+inline int _FILE_fd(const FILE *__f) { return (int) __f->__pad[2]; }
+
+#elif defined (__hpux) /* && defined(__hppa) && defined(__HP_aCC)) */ || \
+ defined (__MVS__) || \
+ defined (_STLP_USE_UCLIBC) /* should be before _STLP_USE_GLIBC */
+
+inline int _FILE_fd(const FILE *__f) { return fileno(__CONST_CAST(FILE*, __f)); }
+
+#elif defined (_STLP_USE_GLIBC)
+
+inline int _FILE_fd(const FILE *__f) { return __f->_fileno; }
+
+#elif defined (__BORLANDC__)
+
+inline int _FILE_fd(const FILE *__f) { return __f->fd; }
+
+#elif defined (__MWERKS__)
+
+/* using MWERKS-specific defines here to detect other OS targets
+ * dwa: I'm not sure they provide fileno for all OS's, but this should
+ * work for Win32 and WinCE
+
+ * Hmm, at least for Novell NetWare __dest_os == __mac_os true too..
+ * May be both __dest_os and __mac_os defined and empty? - ptr */
+# if __dest_os == __mac_os
+inline int _FILE_fd(const FILE *__f) { return ::fileno(__CONST_CAST(FILE*, __f)); }
+# else
+inline int _FILE_fd(const FILE *__f) { return ::_fileno(__CONST_CAST(FILE*, __f)); }
+# endif
+
+#elif defined (__QNXNTO__) || defined (__WATCOMC__) || defined (__EMX__)
+
+inline int _FILE_fd(const FILE *__f) { return __f->_handle; }
+
+#elif defined (__Lynx__)
+
+/* the prototypes are taken from LynxOS patch for STLport 4.0 */
+inline int _FILE_fd(const FILE *__f) { return __f->_fd; }
+
+#else /* The most common access to file descriptor. */
+
+inline int _FILE_fd(const FILE *__f) { return __f->_file; }
+
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_STDIO_FILE_H */
+
+/* Local Variables:
+ * mode:C++
+ * End: */
diff --git a/src/acquire_release.h b/src/acquire_release.h
new file mode 100644
index 0000000..5ea73da
--- /dev/null
+++ b/src/acquire_release.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef ACQUIRE_RELEASE_H
+#define ACQUIRE_RELEASE_H
+
+#include "c_locale.h"
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_Locale_ctype* _STLP_CALL __acquire_ctype(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code);
+_Locale_codecvt* _STLP_CALL __acquire_codecvt(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code);
+_Locale_numeric* _STLP_CALL __acquire_numeric(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code);
+_Locale_collate* _STLP_CALL __acquire_collate(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code);
+_Locale_monetary* _STLP_CALL __acquire_monetary(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code);
+_Locale_time* _STLP_CALL __acquire_time(const char* &name, char *buf, _Locale_name_hint*, int *__err_code);
+_Locale_messages* _STLP_CALL __acquire_messages(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code);
+
+void _STLP_CALL __release_ctype(_Locale_ctype* cat);
+void _STLP_CALL __release_codecvt(_Locale_codecvt* cat);
+void _STLP_CALL __release_numeric(_Locale_numeric* cat);
+void _STLP_CALL __release_collate(_Locale_collate* cat);
+void _STLP_CALL __release_monetary(_Locale_monetary* cat);
+void _STLP_CALL __release_time(_Locale_time* __time);
+void _STLP_CALL __release_messages(_Locale_messages* cat);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#endif /* ACQUIRE_RELEASE_H */
diff --git a/src/aligned_buffer.h b/src/aligned_buffer.h
new file mode 100644
index 0000000..6ff6ca6
--- /dev/null
+++ b/src/aligned_buffer.h
@@ -0,0 +1,21 @@
+#ifndef ALIGNED_BUFFER_H
+#define ALIGNED_BUFFER_H
+
+_STLP_BEGIN_NAMESPACE
+// this is for fake initialization
+template<class T>
+union _Stl_aligned_buffer {
+ char buf[sizeof(T)];
+ struct { double a; double b; } padding;
+
+ T* operator&() {
+ return __REINTERPRET_CAST(T*, this);
+ }
+
+ T const* operator&() const {
+ return __REINTERPRET_CAST(T const*, this);
+ }
+};
+_STLP_END_NAMESPACE
+
+#endif
diff --git a/src/allocators.cpp b/src/allocators.cpp
new file mode 100644
index 0000000..8bbcca8
--- /dev/null
+++ b/src/allocators.cpp
@@ -0,0 +1,1121 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <memory>
+
+#if defined (__GNUC__) && (defined (__CYGWIN__) || defined (__MINGW32__))
+# include <malloc.h>
+#endif
+
+#if defined (_STLP_PTHREADS) && !defined (_STLP_NO_THREADS)
+# include <pthread_alloc>
+# include <cerrno>
+#endif
+
+#include <stl/_threads.h>
+
+#include "lock_free_slist.h"
+
+#if defined (__WATCOMC__)
+# pragma warning 13 9
+# pragma warning 367 9
+# pragma warning 368 9
+#endif
+
+#if defined (_STLP_SGI_THREADS)
+ // We test whether threads are in use before locking.
+ // Perhaps this should be moved into stl_threads.h, but that
+ // probably makes it harder to avoid the procedure call when
+ // it isn't needed.
+extern "C" {
+ extern int __us_rsthread_malloc;
+}
+#endif
+
+// Specialised debug form of new operator which does not provide "false"
+// memory leaks when run with debug CRT libraries.
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1020 && defined (_STLP_DEBUG_ALLOC)) && !defined (_STLP_WCE)
+# include <crtdbg.h>
+inline char* __stlp_new_chunk(size_t __bytes) {
+ void *__chunk = _STLP_CHECK_NULL_ALLOC(::operator new(__bytes, __FILE__, __LINE__));
+ return __STATIC_CAST(char*, __chunk);
+}
+inline void __stlp_delete_chunck(void* __p) { ::operator delete(__p, __FILE__, __LINE__); }
+#else
+# ifdef _STLP_NODE_ALLOC_USE_MALLOC
+# include <cstdlib>
+inline char* __stlp_new_chunk(size_t __bytes) {
+ // do not use _STLP_CHECK_NULL_ALLOC, this macro is dedicated to new operator.
+ void *__chunk = _STLP_VENDOR_CSTD::malloc(__bytes);
+ if (__chunk == 0) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return __STATIC_CAST(char*, __chunk);
+}
+inline void __stlp_delete_chunck(void* __p) { _STLP_VENDOR_CSTD::free(__p); }
+# else
+inline char* __stlp_new_chunk(size_t __bytes)
+{ return __STATIC_CAST(char*, _STLP_STD::__stl_new(__bytes)); }
+inline void __stlp_delete_chunck(void* __p) { _STLP_STD::__stl_delete(__p); }
+# endif
+#endif
+
+/* This is an additional atomic operations to the ones already defined in
+ * stl/_threads.h, platform should try to support it to improve performance.
+ * __add_atomic_t _STLP_ATOMIC_ADD(volatile __add_atomic_t* __target, __add_atomic_t __val) :
+ * does *__target = *__target + __val and returns the old *__target value */
+typedef long __add_atomic_t;
+typedef unsigned long __uadd_atomic_t;
+
+#if defined (__GNUC__) && defined (__i386__)
+inline long _STLP_atomic_add_gcc_x86(long volatile* p, long addend) {
+ long result;
+ __asm__ __volatile__
+ ("lock; xaddl %1, %0;"
+ :"=m" (*p), "=r" (result)
+ :"m" (*p), "1" (addend)
+ :"cc");
+ return result + addend;
+}
+# define _STLP_ATOMIC_ADD(__dst, __val) _STLP_atomic_add_gcc_x86(__dst, __val)
+#elif defined (_STLP_WIN32THREADS)
+// The Win32 API function InterlockedExchangeAdd is not available on Windows 95.
+# if !defined (_STLP_WIN95_LIKE)
+# if defined (_STLP_NEW_PLATFORM_SDK)
+# define _STLP_ATOMIC_ADD(__dst, __val) InterlockedExchangeAdd(__dst, __val)
+# else
+# define _STLP_ATOMIC_ADD(__dst, __val) InterlockedExchangeAdd(__CONST_CAST(__add_atomic_t*, __dst), __val)
+# endif
+# endif
+#endif
+
+#if defined (__OS400__)
+// dums 02/05/2007: is it really necessary ?
+enum { _ALIGN = 16, _ALIGN_SHIFT = 4 };
+#else
+enum { _ALIGN = 2 * sizeof(void*), _ALIGN_SHIFT = 2 + sizeof(void*) / 4 };
+#endif
+
+#define _S_FREELIST_INDEX(__bytes) ((__bytes - size_t(1)) >> (int)_ALIGN_SHIFT)
+
+_STLP_BEGIN_NAMESPACE
+
+// malloc_alloc out-of-memory handling
+static __oom_handler_type __oom_handler = __STATIC_CAST(__oom_handler_type, 0);
+
+#ifdef _STLP_THREADS
+_STLP_mutex __oom_handler_lock;
+#endif
+
+void* _STLP_CALL __malloc_alloc::allocate(size_t __n)
+{
+ void *__result = malloc(__n);
+ if ( 0 == __result ) {
+ __oom_handler_type __my_malloc_handler;
+
+ for (;;) {
+ {
+#ifdef _STLP_THREADS
+ _STLP_auto_lock _l( __oom_handler_lock );
+#endif
+ __my_malloc_handler = __oom_handler;
+ }
+ if ( 0 == __my_malloc_handler) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ (*__my_malloc_handler)();
+ __result = malloc(__n);
+ if ( __result )
+ return __result;
+ }
+ }
+ return __result;
+}
+
+__oom_handler_type _STLP_CALL __malloc_alloc::set_malloc_handler(__oom_handler_type __f)
+{
+#ifdef _STLP_THREADS
+ _STLP_auto_lock _l( __oom_handler_lock );
+#endif
+ __oom_handler_type __old = __oom_handler;
+ __oom_handler = __f;
+ return __old;
+}
+
+// *******************************************************
+// Default node allocator.
+// With a reasonable compiler, this should be roughly as fast as the
+// original STL class-specific allocators, but with less fragmentation.
+//
+// Important implementation properties:
+// 1. If the client request an object of size > _MAX_BYTES, the resulting
+// object will be obtained directly from malloc.
+// 2. In all other cases, we allocate an object of size exactly
+// _S_round_up(requested_size). Thus the client has enough size
+// information that we can return the object to the proper free list
+// without permanently losing part of the object.
+//
+
+#define _STLP_NFREELISTS 16
+
+#if defined (_STLP_LEAKS_PEDANTIC) && defined (_STLP_USE_DYNAMIC_LIB)
+/*
+ * We can only do cleanup of the node allocator memory pool if we are
+ * sure that the STLport library is used as a shared one as it guaranties
+ * the unicity of the node allocator instance. Without that guaranty node
+ * allocator instances might exchange memory blocks making the implementation
+ * of a cleaning process much more complicated.
+ */
+# define _STLP_DO_CLEAN_NODE_ALLOC
+#endif
+
+/* When STLport is used without multi threaded safety we use the node allocator
+ * implementation with locks as locks becomes no-op. The lock free implementation
+ * always use system specific atomic operations which are slower than 'normal'
+ * ones.
+ */
+#if defined (_STLP_THREADS) && \
+ defined (_STLP_HAS_ATOMIC_FREELIST) && defined (_STLP_ATOMIC_ADD)
+/*
+ * We have an implementation of the atomic freelist (_STLP_atomic_freelist)
+ * for this architecture and compiler. That means we can use the non-blocking
+ * implementation of the node-allocation engine.*/
+# define _STLP_USE_LOCK_FREE_IMPLEMENTATION
+#endif
+
+#if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+# if defined (_STLP_THREADS)
+
+class _Node_Alloc_Lock {
+ static _STLP_STATIC_MUTEX& _S_Mutex() {
+ static _STLP_STATIC_MUTEX mutex _STLP_MUTEX_INITIALIZER;
+ return mutex;
+ }
+public:
+ _Node_Alloc_Lock() {
+# if defined (_STLP_SGI_THREADS)
+ if (__us_rsthread_malloc)
+# endif
+ _S_Mutex()._M_acquire_lock();
+ }
+
+ ~_Node_Alloc_Lock() {
+# if defined (_STLP_SGI_THREADS)
+ if (__us_rsthread_malloc)
+# endif
+ _S_Mutex()._M_release_lock();
+ }
+};
+
+# else
+
+class _Node_Alloc_Lock {
+public:
+ _Node_Alloc_Lock() { }
+ ~_Node_Alloc_Lock() { }
+};
+
+# endif
+
+struct _Node_alloc_obj {
+ _Node_alloc_obj * _M_next;
+};
+#endif
+
+class __node_alloc_impl {
+ static inline size_t _STLP_CALL _S_round_up(size_t __bytes)
+ { return (((__bytes) + (size_t)_ALIGN-1) & ~((size_t)_ALIGN - 1)); }
+
+#if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+ typedef _STLP_atomic_freelist::item _Obj;
+ typedef _STLP_atomic_freelist _Freelist;
+ typedef _STLP_atomic_freelist _ChunkList;
+
+ // Header of blocks of memory that have been allocated as part of
+ // a larger chunk but have not yet been chopped up into nodes.
+ struct _FreeBlockHeader : public _STLP_atomic_freelist::item {
+ char* _M_end; // pointer to end of free memory
+ };
+#else
+ typedef _Node_alloc_obj _Obj;
+ typedef _Obj* _STLP_VOLATILE _Freelist;
+ typedef _Obj* _ChunkList;
+#endif
+
+private:
+ // Returns an object of size __n, and optionally adds to size __n free list.
+ static _Obj* _S_refill(size_t __n);
+ // Allocates a chunk for nobjs of size __p_size. nobjs may be reduced
+ // if it is inconvenient to allocate the requested number.
+ static char* _S_chunk_alloc(size_t __p_size, int& __nobjs);
+ // Chunk allocation state.
+ static _Freelist _S_free_list[_STLP_NFREELISTS];
+ // Amount of total allocated memory
+#if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+ static _STLP_VOLATILE __add_atomic_t _S_heap_size;
+#else
+ static size_t _S_heap_size;
+#endif
+
+#if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+ // List of blocks of free memory
+ static _STLP_atomic_freelist _S_free_mem_blocks;
+#else
+ // Start of the current free memory buffer
+ static char* _S_start_free;
+ // End of the current free memory buffer
+ static char* _S_end_free;
+#endif
+
+#if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+public:
+ // Methods to report alloc/dealloc calls to the counter system.
+# if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+ typedef _STLP_VOLATILE __stl_atomic_t _AllocCounter;
+# else
+ typedef __stl_atomic_t _AllocCounter;
+# endif
+ static _AllocCounter& _STLP_CALL _S_alloc_counter();
+ static void _S_alloc_call();
+ static void _S_dealloc_call();
+
+private:
+ // Free all the allocated chuncks of memory
+ static void _S_chunk_dealloc();
+ // Beginning of the linked list of allocated chunks of memory
+ static _ChunkList _S_chunks;
+#endif /* _STLP_DO_CLEAN_NODE_ALLOC */
+
+public:
+ /* __n must be > 0 */
+ static void* _M_allocate(size_t& __n);
+ /* __p may not be 0 */
+ static void _M_deallocate(void *__p, size_t __n);
+};
+
+#if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+void* __node_alloc_impl::_M_allocate(size_t& __n) {
+ __n = _S_round_up(__n);
+ _Obj * _STLP_VOLATILE * __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n);
+ _Obj *__r;
+
+ // Acquire the lock here with a constructor call.
+ // This ensures that it is released in exit or during stack
+ // unwinding.
+ _Node_Alloc_Lock __lock_instance;
+
+ if ( (__r = *__my_free_list) != 0 ) {
+ *__my_free_list = __r->_M_next;
+ } else {
+ __r = _S_refill(__n);
+ }
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ _S_alloc_call();
+# endif
+ // lock is released here
+ return __r;
+}
+
+void __node_alloc_impl::_M_deallocate(void *__p, size_t __n) {
+ _Obj * _STLP_VOLATILE * __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n);
+ _Obj * __pobj = __STATIC_CAST(_Obj*, __p);
+
+ // acquire lock
+ _Node_Alloc_Lock __lock_instance;
+ __pobj->_M_next = *__my_free_list;
+ *__my_free_list = __pobj;
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ _S_dealloc_call();
+# endif
+ // lock is released here
+}
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+# define _STLP_OFFSET sizeof(_Obj)
+# else
+# define _STLP_OFFSET 0
+# endif
+
+/* We allocate memory in large chunks in order to avoid fragmenting */
+/* the malloc heap too much. */
+/* We assume that size is properly aligned. */
+/* We hold the allocation lock. */
+char* __node_alloc_impl::_S_chunk_alloc(size_t _p_size, int& __nobjs) {
+ char* __result;
+ size_t __total_bytes = _p_size * __nobjs;
+ size_t __bytes_left = _S_end_free - _S_start_free;
+
+ if (__bytes_left > 0) {
+ if (__bytes_left >= __total_bytes) {
+ __result = _S_start_free;
+ _S_start_free += __total_bytes;
+ return __result;
+ }
+
+ if (__bytes_left >= _p_size) {
+ __nobjs = (int)(__bytes_left / _p_size);
+ __total_bytes = _p_size * __nobjs;
+ __result = _S_start_free;
+ _S_start_free += __total_bytes;
+ return __result;
+ }
+
+ // Try to make use of the left-over piece.
+ _Obj* _STLP_VOLATILE* __my_free_list = _S_free_list + _S_FREELIST_INDEX(__bytes_left);
+ __REINTERPRET_CAST(_Obj*, _S_start_free)->_M_next = *__my_free_list;
+ *__my_free_list = __REINTERPRET_CAST(_Obj*, _S_start_free);
+ _S_start_free = _S_end_free = 0;
+ }
+
+ size_t __bytes_to_get = 2 * __total_bytes + _S_round_up(_S_heap_size) + _STLP_OFFSET;
+
+ _STLP_TRY {
+ _S_start_free = __stlp_new_chunk(__bytes_to_get);
+ }
+#if defined (_STLP_USE_EXCEPTIONS)
+ catch (const _STLP_STD::bad_alloc&) {
+ _Obj* _STLP_VOLATILE* __my_free_list;
+ _Obj* __p;
+ // Try to do with what we have. That can't hurt.
+ // We do not try smaller requests, since that tends
+ // to result in disaster on multi-process machines.
+ for (size_t __i = _p_size; __i <= (size_t)_MAX_BYTES; __i += (size_t)_ALIGN) {
+ __my_free_list = _S_free_list + _S_FREELIST_INDEX(__i);
+ __p = *__my_free_list;
+ if (0 != __p) {
+ *__my_free_list = __p -> _M_next;
+ _S_start_free = __REINTERPRET_CAST(char*, __p);
+ _S_end_free = _S_start_free + __i;
+ return _S_chunk_alloc(_p_size, __nobjs);
+ // Any leftover piece will eventually make it to the
+ // right free list.
+ }
+ }
+ __bytes_to_get = __total_bytes + _STLP_OFFSET;
+ _S_start_free = __stlp_new_chunk(__bytes_to_get);
+ }
+#endif
+
+ _S_heap_size += __bytes_to_get >> 4;
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ __REINTERPRET_CAST(_Obj*, _S_start_free)->_M_next = _S_chunks;
+ _S_chunks = __REINTERPRET_CAST(_Obj*, _S_start_free);
+# endif
+ _S_end_free = _S_start_free + __bytes_to_get;
+ _S_start_free += _STLP_OFFSET;
+ return _S_chunk_alloc(_p_size, __nobjs);
+}
+
+/* Returns an object of size __n, and optionally adds to size __n free list.*/
+/* We assume that __n is properly aligned. */
+/* We hold the allocation lock. */
+_Node_alloc_obj* __node_alloc_impl::_S_refill(size_t __n) {
+ int __nobjs = 20;
+ char* __chunk = _S_chunk_alloc(__n, __nobjs);
+
+ if (1 == __nobjs) return __REINTERPRET_CAST(_Obj*, __chunk);
+
+ _Obj* _STLP_VOLATILE* __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n);
+ _Obj* __result;
+ _Obj* __current_obj;
+ _Obj* __next_obj;
+
+ /* Build free list in chunk */
+ __result = __REINTERPRET_CAST(_Obj*, __chunk);
+ *__my_free_list = __next_obj = __REINTERPRET_CAST(_Obj*, __chunk + __n);
+ for (--__nobjs; --__nobjs; ) {
+ __current_obj = __next_obj;
+ __next_obj = __REINTERPRET_CAST(_Obj*, __REINTERPRET_CAST(char*, __next_obj) + __n);
+ __current_obj->_M_next = __next_obj;
+ }
+ __next_obj->_M_next = 0;
+ return __result;
+}
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+void __node_alloc_impl::_S_alloc_call()
+{ ++_S_alloc_counter(); }
+
+void __node_alloc_impl::_S_dealloc_call() {
+ __stl_atomic_t &counter = _S_alloc_counter();
+ if (--counter == 0)
+ { _S_chunk_dealloc(); }
+}
+
+/* We deallocate all the memory chunks */
+void __node_alloc_impl::_S_chunk_dealloc() {
+ _Obj *__pcur = _S_chunks, *__pnext;
+ while (__pcur != 0) {
+ __pnext = __pcur->_M_next;
+ __stlp_delete_chunck(__pcur);
+ __pcur = __pnext;
+ }
+ _S_chunks = 0;
+ _S_start_free = _S_end_free = 0;
+ _S_heap_size = 0;
+ memset(__REINTERPRET_CAST(char*, __CONST_CAST(_Obj**, &_S_free_list[0])), 0, _STLP_NFREELISTS * sizeof(_Obj*));
+}
+# endif
+
+#else
+
+void* __node_alloc_impl::_M_allocate(size_t& __n) {
+ __n = _S_round_up(__n);
+ _Obj* __r = _S_free_list[_S_FREELIST_INDEX(__n)].pop();
+ if (__r == 0)
+ { __r = _S_refill(__n); }
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ _S_alloc_call();
+# endif
+ return __r;
+}
+
+void __node_alloc_impl::_M_deallocate(void *__p, size_t __n) {
+ _S_free_list[_S_FREELIST_INDEX(__n)].push(__STATIC_CAST(_Obj*, __p));
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ _S_dealloc_call();
+# endif
+}
+
+/* Returns an object of size __n, and optionally adds additional ones to */
+/* freelist of objects of size __n. */
+/* We assume that __n is properly aligned. */
+__node_alloc_impl::_Obj* __node_alloc_impl::_S_refill(size_t __n) {
+ int __nobjs = 20;
+ char* __chunk = _S_chunk_alloc(__n, __nobjs);
+
+ if (__nobjs <= 1)
+ return __REINTERPRET_CAST(_Obj*, __chunk);
+
+ // Push all new nodes (minus first one) onto freelist
+ _Obj* __result = __REINTERPRET_CAST(_Obj*, __chunk);
+ _Obj* __cur_item = __result;
+ _Freelist* __my_freelist = _S_free_list + _S_FREELIST_INDEX(__n);
+ for (--__nobjs; __nobjs != 0; --__nobjs) {
+ __cur_item = __REINTERPRET_CAST(_Obj*, __REINTERPRET_CAST(char*, __cur_item) + __n);
+ __my_freelist->push(__cur_item);
+ }
+ return __result;
+}
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+# define _STLP_OFFSET _ALIGN
+# else
+# define _STLP_OFFSET 0
+# endif
+
+/* We allocate memory in large chunks in order to avoid fragmenting */
+/* the malloc heap too much. */
+/* We assume that size is properly aligned. */
+char* __node_alloc_impl::_S_chunk_alloc(size_t _p_size, int& __nobjs) {
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ //We are going to add a small memory block to keep all the allocated blocks
+ //address, we need to do so respecting the memory alignment. The following
+ //static assert checks that the reserved block is big enough to store a pointer.
+ _STLP_STATIC_ASSERT(sizeof(_Obj) <= _ALIGN)
+# endif
+ char* __result = 0;
+ __add_atomic_t __total_bytes = __STATIC_CAST(__add_atomic_t, _p_size) * __nobjs;
+
+ _FreeBlockHeader* __block = __STATIC_CAST(_FreeBlockHeader*, _S_free_mem_blocks.pop());
+ if (__block != 0) {
+ // We checked a block out and can now mess with it with impugnity.
+ // We'll put the remainder back into the list if we're done with it below.
+ char* __buf_start = __REINTERPRET_CAST(char*, __block);
+ __add_atomic_t __bytes_left = __block->_M_end - __buf_start;
+
+ if ((__bytes_left < __total_bytes) && (__bytes_left >= __STATIC_CAST(__add_atomic_t, _p_size))) {
+ // There's enough left for at least one object, but not as much as we wanted
+ __result = __buf_start;
+ __nobjs = (int)(__bytes_left/_p_size);
+ __total_bytes = __STATIC_CAST(__add_atomic_t, _p_size) * __nobjs;
+ __bytes_left -= __total_bytes;
+ __buf_start += __total_bytes;
+ }
+ else if (__bytes_left >= __total_bytes) {
+ // The block has enough left to satisfy all that was asked for
+ __result = __buf_start;
+ __bytes_left -= __total_bytes;
+ __buf_start += __total_bytes;
+ }
+
+ if (__bytes_left != 0) {
+ // There is still some memory left over in block after we satisfied our request.
+ if ((__result != 0) && (__bytes_left >= (__add_atomic_t)sizeof(_FreeBlockHeader))) {
+ // We were able to allocate at least one object and there is still enough
+ // left to put remainder back into list.
+ _FreeBlockHeader* __newblock = __REINTERPRET_CAST(_FreeBlockHeader*, __buf_start);
+ __newblock->_M_end = __block->_M_end;
+ _S_free_mem_blocks.push(__newblock);
+ }
+ else {
+ // We were not able to allocate enough for at least one object.
+ // Shove into freelist of nearest (rounded-down!) size.
+ size_t __rounded_down = _S_round_up(__bytes_left + 1) - (size_t)_ALIGN;
+ if (__rounded_down > 0)
+ _S_free_list[_S_FREELIST_INDEX(__rounded_down)].push((_Obj*)__buf_start);
+ }
+ }
+ if (__result != 0)
+ return __result;
+ }
+
+ // We couldn't satisfy it from the list of free blocks, get new memory.
+ __add_atomic_t __bytes_to_get = 2 * __total_bytes +
+ __STATIC_CAST(__add_atomic_t,
+ _S_round_up(__STATIC_CAST(__uadd_atomic_t, _STLP_ATOMIC_ADD(&_S_heap_size, 0)))) +
+ _STLP_OFFSET;
+ _STLP_TRY {
+ __result = __stlp_new_chunk(__bytes_to_get);
+ }
+#if defined (_STLP_USE_EXCEPTIONS)
+ catch (const bad_alloc&) {
+ // Allocation failed; try to canibalize from freelist of a larger object size.
+ for (size_t __i = _p_size; __i <= (size_t)_MAX_BYTES; __i += (size_t)_ALIGN) {
+ _Obj* __p = _S_free_list[_S_FREELIST_INDEX(__i)].pop();
+ if (0 != __p) {
+ if (__i < sizeof(_FreeBlockHeader)) {
+ // Not enough to put into list of free blocks, divvy it up here.
+ // Use as much as possible for this request and shove remainder into freelist.
+ __nobjs = (int)(__i/_p_size);
+ __total_bytes = __nobjs * __STATIC_CAST(__add_atomic_t, _p_size);
+ size_t __bytes_left = __i - __total_bytes;
+ size_t __rounded_down = _S_round_up(__bytes_left+1) - (size_t)_ALIGN;
+ if (__rounded_down > 0) {
+ _S_free_list[_S_FREELIST_INDEX(__rounded_down)].push(__REINTERPRET_CAST(_Obj*, __REINTERPRET_CAST(char*, __p) + __total_bytes));
+ }
+ return __REINTERPRET_CAST(char*, __p);
+ }
+ else {
+ // Add node to list of available blocks and recursively allocate from it.
+ _FreeBlockHeader* __newblock = (_FreeBlockHeader*)__p;
+ __newblock->_M_end = __REINTERPRET_CAST(char*, __p) + __i;
+ _S_free_mem_blocks.push(__newblock);
+ return _S_chunk_alloc(_p_size, __nobjs);
+ }
+ }
+ }
+
+ // We were not able to find something in a freelist, try to allocate a smaller amount.
+ __bytes_to_get = __total_bytes + _STLP_OFFSET;
+ __result = __stlp_new_chunk(__bytes_to_get);
+
+ // This should either throw an exception or remedy the situation.
+ // Thus we assume it succeeded.
+ }
+#endif
+ // Alignment check
+ _STLP_VERBOSE_ASSERT(((__REINTERPRET_CAST(size_t, __result) & __STATIC_CAST(size_t, _ALIGN - 1)) == 0),
+ _StlMsg_DBA_DELETED_TWICE)
+ _STLP_ATOMIC_ADD(&_S_heap_size, __bytes_to_get >> 4);
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+ // We have to track the allocated memory chunks for release on exit.
+ _S_chunks.push(__REINTERPRET_CAST(_Obj*, __result));
+ __result += _ALIGN;
+ __bytes_to_get -= _ALIGN;
+# endif
+
+ if (__bytes_to_get > __total_bytes) {
+ // Push excess memory allocated in this chunk into list of free memory blocks
+ _FreeBlockHeader* __freeblock = __REINTERPRET_CAST(_FreeBlockHeader*, __result + __total_bytes);
+ __freeblock->_M_end = __result + __bytes_to_get;
+ _S_free_mem_blocks.push(__freeblock);
+ }
+ return __result;
+}
+
+# if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+void __node_alloc_impl::_S_alloc_call()
+{ _STLP_ATOMIC_INCREMENT(&_S_alloc_counter()); }
+
+void __node_alloc_impl::_S_dealloc_call() {
+ _STLP_VOLATILE __stl_atomic_t *pcounter = &_S_alloc_counter();
+ if (_STLP_ATOMIC_DECREMENT(pcounter) == 0)
+ _S_chunk_dealloc();
+}
+
+/* We deallocate all the memory chunks */
+void __node_alloc_impl::_S_chunk_dealloc() {
+ // Note: The _Node_alloc_helper class ensures that this function
+ // will only be called when the (shared) library is unloaded or the
+ // process is shutdown. It's thus not possible that another thread
+ // is currently trying to allocate a node (we're not thread-safe here).
+ //
+
+ // Clear the free blocks and all freelistst. This makes sure that if
+ // for some reason more memory is allocated again during shutdown
+ // (it'd also be really nasty to leave references to deallocated memory).
+ _S_free_mem_blocks.clear();
+ _S_heap_size = 0;
+
+ for (size_t __i = 0; __i < _STLP_NFREELISTS; ++__i) {
+ _S_free_list[__i].clear();
+ }
+
+ // Detach list of chunks and free them all
+ _Obj* __chunk = _S_chunks.clear();
+ while (__chunk != 0) {
+ _Obj* __next = __chunk->_M_next;
+ __stlp_delete_chunck(__chunk);
+ __chunk = __next;
+ }
+}
+# endif
+
+#endif
+
+#if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+struct __node_alloc_cleaner {
+ ~__node_alloc_cleaner()
+ { __node_alloc_impl::_S_dealloc_call(); }
+};
+
+# if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+_STLP_VOLATILE __stl_atomic_t& _STLP_CALL
+# else
+__stl_atomic_t& _STLP_CALL
+# endif
+__node_alloc_impl::_S_alloc_counter() {
+ static _AllocCounter _S_counter = 1;
+ static __node_alloc_cleaner _S_node_alloc_cleaner;
+ return _S_counter;
+}
+#endif
+
+#if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+_Node_alloc_obj * _STLP_VOLATILE
+__node_alloc_impl::_S_free_list[_STLP_NFREELISTS]
+= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+// The 16 zeros are necessary to make version 4.1 of the SunPro
+// compiler happy. Otherwise it appears to allocate too little
+// space for the array.
+#else
+_STLP_atomic_freelist __node_alloc_impl::_S_free_list[_STLP_NFREELISTS];
+_STLP_atomic_freelist __node_alloc_impl::_S_free_mem_blocks;
+#endif
+
+#if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+char *__node_alloc_impl::_S_start_free = 0;
+char *__node_alloc_impl::_S_end_free = 0;
+#endif
+
+#if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+_STLP_VOLATILE __add_atomic_t
+#else
+size_t
+#endif
+__node_alloc_impl::_S_heap_size = 0;
+
+#if defined (_STLP_DO_CLEAN_NODE_ALLOC)
+# if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION)
+_STLP_atomic_freelist __node_alloc_impl::_S_chunks;
+# else
+_Node_alloc_obj* __node_alloc_impl::_S_chunks = 0;
+# endif
+#endif
+
+void * _STLP_CALL __node_alloc::_M_allocate(size_t& __n)
+{ return __node_alloc_impl::_M_allocate(__n); }
+
+void _STLP_CALL __node_alloc::_M_deallocate(void *__p, size_t __n)
+{ __node_alloc_impl::_M_deallocate(__p, __n); }
+
+#if defined (_STLP_PTHREADS) && !defined (_STLP_NO_THREADS)
+
+# define _STLP_DATA_ALIGNMENT 8
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// *******************************************************
+// __perthread_alloc implementation
+union _Pthread_alloc_obj {
+ union _Pthread_alloc_obj * __free_list_link;
+ char __client_data[_STLP_DATA_ALIGNMENT]; /* The client sees this. */
+};
+
+// Pthread allocators don't appear to the client to have meaningful
+// instances. We do in fact need to associate some state with each
+// thread. That state is represented by _Pthread_alloc_per_thread_state.
+
+struct _Pthread_alloc_per_thread_state {
+ typedef _Pthread_alloc_obj __obj;
+ enum { _S_NFREELISTS = _MAX_BYTES / _STLP_DATA_ALIGNMENT };
+
+ // Free list link for list of available per thread structures.
+ // When one of these becomes available for reuse due to thread
+ // termination, any objects in its free list remain associated
+ // with it. The whole structure may then be used by a newly
+ // created thread.
+ _Pthread_alloc_per_thread_state() : __next(0)
+ { memset((void *)__CONST_CAST(_Pthread_alloc_obj**, __free_list), 0, (size_t)_S_NFREELISTS * sizeof(__obj *)); }
+ // Returns an object of size __n, and possibly adds to size n free list.
+ void *_M_refill(size_t __n);
+
+ _Pthread_alloc_obj* volatile __free_list[_S_NFREELISTS];
+ _Pthread_alloc_per_thread_state *__next;
+ // this data member is only to be used by per_thread_allocator, which returns memory to the originating thread.
+ _STLP_mutex _M_lock;
+};
+
+// Pthread-specific allocator.
+class _Pthread_alloc_impl {
+public: // but only for internal use:
+ typedef _Pthread_alloc_per_thread_state __state_type;
+ typedef char value_type;
+
+ // Allocates a chunk for nobjs of size size. nobjs may be reduced
+ // if it is inconvenient to allocate the requested number.
+ static char *_S_chunk_alloc(size_t __size, size_t &__nobjs, __state_type*);
+
+ enum {_S_ALIGN = _STLP_DATA_ALIGNMENT};
+
+ static size_t _S_round_up(size_t __bytes)
+ { return (((__bytes) + (int)_S_ALIGN - 1) & ~((int)_S_ALIGN - 1)); }
+ static size_t _S_freelist_index(size_t __bytes)
+ { return (((__bytes) + (int)_S_ALIGN - 1) / (int)_S_ALIGN - 1); }
+
+private:
+ // Chunk allocation state. And other shared state.
+ // Protected by _S_chunk_allocator_lock.
+ static _STLP_STATIC_MUTEX _S_chunk_allocator_lock;
+ static char *_S_start_free;
+ static char *_S_end_free;
+ static size_t _S_heap_size;
+ static __state_type *_S_free_per_thread_states;
+ static pthread_key_t _S_key;
+ static bool _S_key_initialized;
+ // Pthread key under which per thread state is stored.
+ // Allocator instances that are currently unclaimed by any thread.
+ static void _S_destructor(void *instance);
+ // Function to be called on thread exit to reclaim per thread
+ // state.
+ static __state_type *_S_new_per_thread_state();
+public:
+ // Return a recycled or new per thread state.
+ static __state_type *_S_get_per_thread_state();
+private:
+ // ensure that the current thread has an associated
+ // per thread state.
+ class _M_lock;
+ friend class _M_lock;
+ class _M_lock {
+ public:
+ _M_lock () { _S_chunk_allocator_lock._M_acquire_lock(); }
+ ~_M_lock () { _S_chunk_allocator_lock._M_release_lock(); }
+ };
+
+public:
+
+ /* n must be > 0 */
+ static void * allocate(size_t& __n);
+
+ /* p may not be 0 */
+ static void deallocate(void *__p, size_t __n);
+
+ // boris : versions for per_thread_allocator
+ /* n must be > 0 */
+ static void * allocate(size_t& __n, __state_type* __a);
+
+ /* p may not be 0 */
+ static void deallocate(void *__p, size_t __n, __state_type* __a);
+
+ static void * reallocate(void *__p, size_t __old_sz, size_t& __new_sz);
+};
+
+/* Returns an object of size n, and optionally adds to size n free list.*/
+/* We assume that n is properly aligned. */
+/* We hold the allocation lock. */
+void *_Pthread_alloc_per_thread_state::_M_refill(size_t __n) {
+ typedef _Pthread_alloc_obj __obj;
+ size_t __nobjs = 128;
+ char * __chunk = _Pthread_alloc_impl::_S_chunk_alloc(__n, __nobjs, this);
+ __obj * volatile * __my_free_list;
+ __obj * __result;
+ __obj * __current_obj, * __next_obj;
+ size_t __i;
+
+ if (1 == __nobjs) {
+ return __chunk;
+ }
+
+ __my_free_list = __free_list + _Pthread_alloc_impl::_S_freelist_index(__n);
+
+ /* Build free list in chunk */
+ __result = (__obj *)__chunk;
+ *__my_free_list = __next_obj = (__obj *)(__chunk + __n);
+ for (__i = 1; ; ++__i) {
+ __current_obj = __next_obj;
+ __next_obj = (__obj *)((char *)__next_obj + __n);
+ if (__nobjs - 1 == __i) {
+ __current_obj -> __free_list_link = 0;
+ break;
+ } else {
+ __current_obj -> __free_list_link = __next_obj;
+ }
+ }
+ return __result;
+}
+
+void _Pthread_alloc_impl::_S_destructor(void *__instance) {
+ _M_lock __lock_instance; // Need to acquire lock here.
+ _Pthread_alloc_per_thread_state* __s = (_Pthread_alloc_per_thread_state*)__instance;
+ __s -> __next = _S_free_per_thread_states;
+ _S_free_per_thread_states = __s;
+}
+
+_Pthread_alloc_per_thread_state* _Pthread_alloc_impl::_S_new_per_thread_state() {
+ /* lock already held here. */
+ if (0 != _S_free_per_thread_states) {
+ _Pthread_alloc_per_thread_state *__result = _S_free_per_thread_states;
+ _S_free_per_thread_states = _S_free_per_thread_states -> __next;
+ return __result;
+ }
+ else {
+ return new _Pthread_alloc_per_thread_state;
+ }
+}
+
+_Pthread_alloc_per_thread_state* _Pthread_alloc_impl::_S_get_per_thread_state() {
+ int __ret_code;
+ __state_type* __result;
+
+ if (_S_key_initialized && (__result = (__state_type*) pthread_getspecific(_S_key)))
+ return __result;
+
+ /*REFERENCED*/
+ _M_lock __lock_instance; // Need to acquire lock here.
+ if (!_S_key_initialized) {
+ if (pthread_key_create(&_S_key, _S_destructor)) {
+ _STLP_THROW_BAD_ALLOC; // failed
+ }
+ _S_key_initialized = true;
+ }
+
+ __result = _S_new_per_thread_state();
+ __ret_code = pthread_setspecific(_S_key, __result);
+ if (__ret_code) {
+ if (__ret_code == ENOMEM) {
+ _STLP_THROW_BAD_ALLOC;
+ } else {
+ // EINVAL
+ _STLP_ABORT();
+ }
+ }
+ return __result;
+}
+
+/* We allocate memory in large chunks in order to avoid fragmenting */
+/* the malloc heap too much. */
+/* We assume that size is properly aligned. */
+char *_Pthread_alloc_impl::_S_chunk_alloc(size_t __p_size, size_t &__nobjs, _Pthread_alloc_per_thread_state *__a) {
+ typedef _Pthread_alloc_obj __obj;
+ {
+ char * __result;
+ size_t __total_bytes;
+ size_t __bytes_left;
+ /*REFERENCED*/
+ _M_lock __lock_instance; // Acquire lock for this routine
+
+ __total_bytes = __p_size * __nobjs;
+ __bytes_left = _S_end_free - _S_start_free;
+ if (__bytes_left >= __total_bytes) {
+ __result = _S_start_free;
+ _S_start_free += __total_bytes;
+ return __result;
+ } else if (__bytes_left >= __p_size) {
+ __nobjs = __bytes_left/__p_size;
+ __total_bytes = __p_size * __nobjs;
+ __result = _S_start_free;
+ _S_start_free += __total_bytes;
+ return __result;
+ } else {
+ size_t __bytes_to_get = 2 * __total_bytes + _S_round_up(_S_heap_size);
+ // Try to make use of the left-over piece.
+ if (__bytes_left > 0) {
+ __obj * volatile * __my_free_list = __a->__free_list + _S_freelist_index(__bytes_left);
+ ((__obj *)_S_start_free) -> __free_list_link = *__my_free_list;
+ *__my_free_list = (__obj *)_S_start_free;
+ }
+# ifdef _SGI_SOURCE
+ // Try to get memory that's aligned on something like a
+ // cache line boundary, so as to avoid parceling out
+ // parts of the same line to different threads and thus
+ // possibly different processors.
+ {
+ const int __cache_line_size = 128; // probable upper bound
+ __bytes_to_get &= ~(__cache_line_size-1);
+ _S_start_free = (char *)memalign(__cache_line_size, __bytes_to_get);
+ if (0 == _S_start_free) {
+ _S_start_free = (char *)__malloc_alloc::allocate(__bytes_to_get);
+ }
+ }
+# else /* !SGI_SOURCE */
+ _S_start_free = (char *)__malloc_alloc::allocate(__bytes_to_get);
+# endif
+ _S_heap_size += __bytes_to_get >> 4;
+ _S_end_free = _S_start_free + __bytes_to_get;
+ }
+ }
+ // lock is released here
+ return _S_chunk_alloc(__p_size, __nobjs, __a);
+}
+
+
+/* n must be > 0 */
+void *_Pthread_alloc_impl::allocate(size_t& __n) {
+ typedef _Pthread_alloc_obj __obj;
+ __obj * volatile * __my_free_list;
+ __obj * __result;
+ __state_type* __a;
+
+ if (__n > _MAX_BYTES) {
+ return __malloc_alloc::allocate(__n);
+ }
+
+ __n = _S_round_up(__n);
+ __a = _S_get_per_thread_state();
+
+ __my_free_list = __a->__free_list + _S_freelist_index(__n);
+ __result = *__my_free_list;
+ if (__result == 0) {
+ void *__r = __a->_M_refill(__n);
+ return __r;
+ }
+ *__my_free_list = __result->__free_list_link;
+ return __result;
+};
+
+/* p may not be 0 */
+void _Pthread_alloc_impl::deallocate(void *__p, size_t __n) {
+ typedef _Pthread_alloc_obj __obj;
+ __obj *__q = (__obj *)__p;
+ __obj * volatile * __my_free_list;
+ __state_type* __a;
+
+ if (__n > _MAX_BYTES) {
+ __malloc_alloc::deallocate(__p, __n);
+ return;
+ }
+
+ __a = _S_get_per_thread_state();
+
+ __my_free_list = __a->__free_list + _S_freelist_index(__n);
+ __q -> __free_list_link = *__my_free_list;
+ *__my_free_list = __q;
+}
+
+// boris : versions for per_thread_allocator
+/* n must be > 0 */
+void *_Pthread_alloc_impl::allocate(size_t& __n, __state_type* __a) {
+ typedef _Pthread_alloc_obj __obj;
+ __obj * volatile * __my_free_list;
+ __obj * __result;
+
+ if (__n > _MAX_BYTES) {
+ return __malloc_alloc::allocate(__n);
+ }
+ __n = _S_round_up(__n);
+
+ // boris : here, we have to lock per thread state, as we may be getting memory from
+ // different thread pool.
+ _STLP_auto_lock __lock(__a->_M_lock);
+
+ __my_free_list = __a->__free_list + _S_freelist_index(__n);
+ __result = *__my_free_list;
+ if (__result == 0) {
+ void *__r = __a->_M_refill(__n);
+ return __r;
+ }
+ *__my_free_list = __result->__free_list_link;
+ return __result;
+};
+
+/* p may not be 0 */
+void _Pthread_alloc_impl::deallocate(void *__p, size_t __n, __state_type* __a) {
+ typedef _Pthread_alloc_obj __obj;
+ __obj *__q = (__obj *)__p;
+ __obj * volatile * __my_free_list;
+
+ if (__n > _MAX_BYTES) {
+ __malloc_alloc::deallocate(__p, __n);
+ return;
+ }
+
+ // boris : here, we have to lock per thread state, as we may be returning memory from
+ // different thread.
+ _STLP_auto_lock __lock(__a->_M_lock);
+
+ __my_free_list = __a->__free_list + _S_freelist_index(__n);
+ __q -> __free_list_link = *__my_free_list;
+ *__my_free_list = __q;
+}
+
+void *_Pthread_alloc_impl::reallocate(void *__p, size_t __old_sz, size_t& __new_sz) {
+ void * __result;
+ size_t __copy_sz;
+
+ if (__old_sz > _MAX_BYTES && __new_sz > _MAX_BYTES) {
+ return realloc(__p, __new_sz);
+ }
+
+ if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return __p;
+ __result = allocate(__new_sz);
+ __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
+ memcpy(__result, __p, __copy_sz);
+ deallocate(__p, __old_sz);
+ return __result;
+}
+
+_Pthread_alloc_per_thread_state* _Pthread_alloc_impl::_S_free_per_thread_states = 0;
+pthread_key_t _Pthread_alloc_impl::_S_key = 0;
+_STLP_STATIC_MUTEX _Pthread_alloc_impl::_S_chunk_allocator_lock _STLP_MUTEX_INITIALIZER;
+bool _Pthread_alloc_impl::_S_key_initialized = false;
+char *_Pthread_alloc_impl::_S_start_free = 0;
+char *_Pthread_alloc_impl::_S_end_free = 0;
+size_t _Pthread_alloc_impl::_S_heap_size = 0;
+
+void * _STLP_CALL _Pthread_alloc::allocate(size_t& __n)
+{ return _Pthread_alloc_impl::allocate(__n); }
+void _STLP_CALL _Pthread_alloc::deallocate(void *__p, size_t __n)
+{ _Pthread_alloc_impl::deallocate(__p, __n); }
+void * _STLP_CALL _Pthread_alloc::allocate(size_t& __n, __state_type* __a)
+{ return _Pthread_alloc_impl::allocate(__n, __a); }
+void _STLP_CALL _Pthread_alloc::deallocate(void *__p, size_t __n, __state_type* __a)
+{ _Pthread_alloc_impl::deallocate(__p, __n, __a); }
+void * _STLP_CALL _Pthread_alloc::reallocate(void *__p, size_t __old_sz, size_t& __new_sz)
+{ return _Pthread_alloc_impl::reallocate(__p, __old_sz, __new_sz); }
+_Pthread_alloc_per_thread_state* _STLP_CALL _Pthread_alloc::_S_get_per_thread_state()
+{ return _Pthread_alloc_impl::_S_get_per_thread_state(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef _S_FREELIST_INDEX
diff --git a/src/bitset.cpp b/src/bitset.cpp
new file mode 100644
index 0000000..90f1799
--- /dev/null
+++ b/src/bitset.cpp
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <bitset>
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// ------------------------------------------------------------
+// Lookup tables for find and count operations.
+
+size_t _Bs_G::_S_count(const unsigned char *__first,
+ const unsigned char *__last)
+{
+ static const unsigned char _bit_count[256] = {
+ 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */
+ 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */
+ 2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */
+ 4, /* 15 */ 1, /* 16 */ 2, /* 17 */ 2, /* 18 */ 3, /* 19 */
+ 2, /* 20 */ 3, /* 21 */ 3, /* 22 */ 4, /* 23 */ 2, /* 24 */
+ 3, /* 25 */ 3, /* 26 */ 4, /* 27 */ 3, /* 28 */ 4, /* 29 */
+ 4, /* 30 */ 5, /* 31 */ 1, /* 32 */ 2, /* 33 */ 2, /* 34 */
+ 3, /* 35 */ 2, /* 36 */ 3, /* 37 */ 3, /* 38 */ 4, /* 39 */
+ 2, /* 40 */ 3, /* 41 */ 3, /* 42 */ 4, /* 43 */ 3, /* 44 */
+ 4, /* 45 */ 4, /* 46 */ 5, /* 47 */ 2, /* 48 */ 3, /* 49 */
+ 3, /* 50 */ 4, /* 51 */ 3, /* 52 */ 4, /* 53 */ 4, /* 54 */
+ 5, /* 55 */ 3, /* 56 */ 4, /* 57 */ 4, /* 58 */ 5, /* 59 */
+ 4, /* 60 */ 5, /* 61 */ 5, /* 62 */ 6, /* 63 */ 1, /* 64 */
+ 2, /* 65 */ 2, /* 66 */ 3, /* 67 */ 2, /* 68 */ 3, /* 69 */
+ 3, /* 70 */ 4, /* 71 */ 2, /* 72 */ 3, /* 73 */ 3, /* 74 */
+ 4, /* 75 */ 3, /* 76 */ 4, /* 77 */ 4, /* 78 */ 5, /* 79 */
+ 2, /* 80 */ 3, /* 81 */ 3, /* 82 */ 4, /* 83 */ 3, /* 84 */
+ 4, /* 85 */ 4, /* 86 */ 5, /* 87 */ 3, /* 88 */ 4, /* 89 */
+ 4, /* 90 */ 5, /* 91 */ 4, /* 92 */ 5, /* 93 */ 5, /* 94 */
+ 6, /* 95 */ 2, /* 96 */ 3, /* 97 */ 3, /* 98 */ 4, /* 99 */
+ 3, /* 100 */ 4, /* 101 */ 4, /* 102 */ 5, /* 103 */ 3, /* 104 */
+ 4, /* 105 */ 4, /* 106 */ 5, /* 107 */ 4, /* 108 */ 5, /* 109 */
+ 5, /* 110 */ 6, /* 111 */ 3, /* 112 */ 4, /* 113 */ 4, /* 114 */
+ 5, /* 115 */ 4, /* 116 */ 5, /* 117 */ 5, /* 118 */ 6, /* 119 */
+ 4, /* 120 */ 5, /* 121 */ 5, /* 122 */ 6, /* 123 */ 5, /* 124 */
+ 6, /* 125 */ 6, /* 126 */ 7, /* 127 */ 1, /* 128 */ 2, /* 129 */
+ 2, /* 130 */ 3, /* 131 */ 2, /* 132 */ 3, /* 133 */ 3, /* 134 */
+ 4, /* 135 */ 2, /* 136 */ 3, /* 137 */ 3, /* 138 */ 4, /* 139 */
+ 3, /* 140 */ 4, /* 141 */ 4, /* 142 */ 5, /* 143 */ 2, /* 144 */
+ 3, /* 145 */ 3, /* 146 */ 4, /* 147 */ 3, /* 148 */ 4, /* 149 */
+ 4, /* 150 */ 5, /* 151 */ 3, /* 152 */ 4, /* 153 */ 4, /* 154 */
+ 5, /* 155 */ 4, /* 156 */ 5, /* 157 */ 5, /* 158 */ 6, /* 159 */
+ 2, /* 160 */ 3, /* 161 */ 3, /* 162 */ 4, /* 163 */ 3, /* 164 */
+ 4, /* 165 */ 4, /* 166 */ 5, /* 167 */ 3, /* 168 */ 4, /* 169 */
+ 4, /* 170 */ 5, /* 171 */ 4, /* 172 */ 5, /* 173 */ 5, /* 174 */
+ 6, /* 175 */ 3, /* 176 */ 4, /* 177 */ 4, /* 178 */ 5, /* 179 */
+ 4, /* 180 */ 5, /* 181 */ 5, /* 182 */ 6, /* 183 */ 4, /* 184 */
+ 5, /* 185 */ 5, /* 186 */ 6, /* 187 */ 5, /* 188 */ 6, /* 189 */
+ 6, /* 190 */ 7, /* 191 */ 2, /* 192 */ 3, /* 193 */ 3, /* 194 */
+ 4, /* 195 */ 3, /* 196 */ 4, /* 197 */ 4, /* 198 */ 5, /* 199 */
+ 3, /* 200 */ 4, /* 201 */ 4, /* 202 */ 5, /* 203 */ 4, /* 204 */
+ 5, /* 205 */ 5, /* 206 */ 6, /* 207 */ 3, /* 208 */ 4, /* 209 */
+ 4, /* 210 */ 5, /* 211 */ 4, /* 212 */ 5, /* 213 */ 5, /* 214 */
+ 6, /* 215 */ 4, /* 216 */ 5, /* 217 */ 5, /* 218 */ 6, /* 219 */
+ 5, /* 220 */ 6, /* 221 */ 6, /* 222 */ 7, /* 223 */ 3, /* 224 */
+ 4, /* 225 */ 4, /* 226 */ 5, /* 227 */ 4, /* 228 */ 5, /* 229 */
+ 5, /* 230 */ 6, /* 231 */ 4, /* 232 */ 5, /* 233 */ 5, /* 234 */
+ 6, /* 235 */ 5, /* 236 */ 6, /* 237 */ 6, /* 238 */ 7, /* 239 */
+ 4, /* 240 */ 5, /* 241 */ 5, /* 242 */ 6, /* 243 */ 5, /* 244 */
+ 6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */
+ 6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */
+ 8 /* 255 */
+ };
+
+ size_t __result(0);
+ while ( __first < __last ) {
+ __result += _bit_count[*(__first++)];
+ }
+ return __result;
+}
+
+unsigned char _Bs_G::_S_first_one(unsigned char __byte)
+{
+ static const unsigned char _first_one[256] = {
+ 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */
+ 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */
+ 1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */
+ 0, /* 15 */ 4, /* 16 */ 0, /* 17 */ 1, /* 18 */ 0, /* 19 */
+ 2, /* 20 */ 0, /* 21 */ 1, /* 22 */ 0, /* 23 */ 3, /* 24 */
+ 0, /* 25 */ 1, /* 26 */ 0, /* 27 */ 2, /* 28 */ 0, /* 29 */
+ 1, /* 30 */ 0, /* 31 */ 5, /* 32 */ 0, /* 33 */ 1, /* 34 */
+ 0, /* 35 */ 2, /* 36 */ 0, /* 37 */ 1, /* 38 */ 0, /* 39 */
+ 3, /* 40 */ 0, /* 41 */ 1, /* 42 */ 0, /* 43 */ 2, /* 44 */
+ 0, /* 45 */ 1, /* 46 */ 0, /* 47 */ 4, /* 48 */ 0, /* 49 */
+ 1, /* 50 */ 0, /* 51 */ 2, /* 52 */ 0, /* 53 */ 1, /* 54 */
+ 0, /* 55 */ 3, /* 56 */ 0, /* 57 */ 1, /* 58 */ 0, /* 59 */
+ 2, /* 60 */ 0, /* 61 */ 1, /* 62 */ 0, /* 63 */ 6, /* 64 */
+ 0, /* 65 */ 1, /* 66 */ 0, /* 67 */ 2, /* 68 */ 0, /* 69 */
+ 1, /* 70 */ 0, /* 71 */ 3, /* 72 */ 0, /* 73 */ 1, /* 74 */
+ 0, /* 75 */ 2, /* 76 */ 0, /* 77 */ 1, /* 78 */ 0, /* 79 */
+ 4, /* 80 */ 0, /* 81 */ 1, /* 82 */ 0, /* 83 */ 2, /* 84 */
+ 0, /* 85 */ 1, /* 86 */ 0, /* 87 */ 3, /* 88 */ 0, /* 89 */
+ 1, /* 90 */ 0, /* 91 */ 2, /* 92 */ 0, /* 93 */ 1, /* 94 */
+ 0, /* 95 */ 5, /* 96 */ 0, /* 97 */ 1, /* 98 */ 0, /* 99 */
+ 2, /* 100 */ 0, /* 101 */ 1, /* 102 */ 0, /* 103 */ 3, /* 104 */
+ 0, /* 105 */ 1, /* 106 */ 0, /* 107 */ 2, /* 108 */ 0, /* 109 */
+ 1, /* 110 */ 0, /* 111 */ 4, /* 112 */ 0, /* 113 */ 1, /* 114 */
+ 0, /* 115 */ 2, /* 116 */ 0, /* 117 */ 1, /* 118 */ 0, /* 119 */
+ 3, /* 120 */ 0, /* 121 */ 1, /* 122 */ 0, /* 123 */ 2, /* 124 */
+ 0, /* 125 */ 1, /* 126 */ 0, /* 127 */ 7, /* 128 */ 0, /* 129 */
+ 1, /* 130 */ 0, /* 131 */ 2, /* 132 */ 0, /* 133 */ 1, /* 134 */
+ 0, /* 135 */ 3, /* 136 */ 0, /* 137 */ 1, /* 138 */ 0, /* 139 */
+ 2, /* 140 */ 0, /* 141 */ 1, /* 142 */ 0, /* 143 */ 4, /* 144 */
+ 0, /* 145 */ 1, /* 146 */ 0, /* 147 */ 2, /* 148 */ 0, /* 149 */
+ 1, /* 150 */ 0, /* 151 */ 3, /* 152 */ 0, /* 153 */ 1, /* 154 */
+ 0, /* 155 */ 2, /* 156 */ 0, /* 157 */ 1, /* 158 */ 0, /* 159 */
+ 5, /* 160 */ 0, /* 161 */ 1, /* 162 */ 0, /* 163 */ 2, /* 164 */
+ 0, /* 165 */ 1, /* 166 */ 0, /* 167 */ 3, /* 168 */ 0, /* 169 */
+ 1, /* 170 */ 0, /* 171 */ 2, /* 172 */ 0, /* 173 */ 1, /* 174 */
+ 0, /* 175 */ 4, /* 176 */ 0, /* 177 */ 1, /* 178 */ 0, /* 179 */
+ 2, /* 180 */ 0, /* 181 */ 1, /* 182 */ 0, /* 183 */ 3, /* 184 */
+ 0, /* 185 */ 1, /* 186 */ 0, /* 187 */ 2, /* 188 */ 0, /* 189 */
+ 1, /* 190 */ 0, /* 191 */ 6, /* 192 */ 0, /* 193 */ 1, /* 194 */
+ 0, /* 195 */ 2, /* 196 */ 0, /* 197 */ 1, /* 198 */ 0, /* 199 */
+ 3, /* 200 */ 0, /* 201 */ 1, /* 202 */ 0, /* 203 */ 2, /* 204 */
+ 0, /* 205 */ 1, /* 206 */ 0, /* 207 */ 4, /* 208 */ 0, /* 209 */
+ 1, /* 210 */ 0, /* 211 */ 2, /* 212 */ 0, /* 213 */ 1, /* 214 */
+ 0, /* 215 */ 3, /* 216 */ 0, /* 217 */ 1, /* 218 */ 0, /* 219 */
+ 2, /* 220 */ 0, /* 221 */ 1, /* 222 */ 0, /* 223 */ 5, /* 224 */
+ 0, /* 225 */ 1, /* 226 */ 0, /* 227 */ 2, /* 228 */ 0, /* 229 */
+ 1, /* 230 */ 0, /* 231 */ 3, /* 232 */ 0, /* 233 */ 1, /* 234 */
+ 0, /* 235 */ 2, /* 236 */ 0, /* 237 */ 1, /* 238 */ 0, /* 239 */
+ 4, /* 240 */ 0, /* 241 */ 1, /* 242 */ 0, /* 243 */ 2, /* 244 */
+ 0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */
+ 1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */
+ 0, /* 255 */
+ };
+ return _first_one[__byte];
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
diff --git a/src/c_locale.c b/src/c_locale.c
new file mode 100644
index 0000000..376e22e
--- /dev/null
+++ b/src/c_locale.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include "c_locale.h"
+
+#if defined (_STLP_WIN32) && !defined (_STLP_WCE)
+# include "c_locale_win32/c_locale_win32.c"
+#elif defined (_STLP_USE_GLIBC2_LOCALIZATION)
+# include "c_locale_glibc/c_locale_glibc2.c" /* glibc 2.2 and newer */
+#else
+# include "c_locale_dummy/c_locale_dummy.c"
+#endif
diff --git a/src/c_locale.h b/src/c_locale.h
new file mode 100644
index 0000000..36d9961
--- /dev/null
+++ b/src/c_locale.h
@@ -0,0 +1,450 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * It is impossible to write the C++ locale library in terms of locales
+ * as defined in the C standard. Instead, we write the C++ locale and I/O
+ * library in terms of a low level C-like interface. This file defines
+ * that interface.
+ *
+ * The low-level locale interface can't be written portably; there
+ * must be a version of it for each platform that the C++ library
+ * is ported to. On many systems this interface may be a thin wrapper
+ * for existing functionality.
+ */
+
+#ifndef _STLP_C_LOCALE_IMPL_H
+#define _STLP_C_LOCALE_IMPL_H
+
+#include "stlport_prefix.h"
+
+#include <wchar.h> /* for mbstate_t */
+#include <stl/c_locale.h>
+
+struct _Locale_name_hint;
+
+#if defined (_GNU_SOURCE) && defined (__GLIBC__) && \
+ ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2))
+# define _STLP_USE_GLIBC2_LOCALIZATION
+# include <nl_types.h>
+typedef nl_catd nl_catd_type;
+#else
+typedef int nl_catd_type;
+#endif
+
+/*
+ * A number: the maximum length of a simple locale name.
+ * (i.e. a name like like en_US, as opposed to a name like
+ * en_US/de_AT/de_AT/es_MX/en_US/en_US) */
+#define _Locale_MAX_SIMPLE_NAME 256
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Typedefs:
+ */
+typedef unsigned short int _Locale_mask_t;
+
+/* Function called during STLport library load phase. Might contain any
+ * code necessary to the platform localization layer.
+ */
+void _Locale_init(void);
+
+/* Function called during STLport library unload. Might contain any
+ * code necessary to the platform localization layer.
+ */
+void _Locale_final(void);
+
+/* Create a category of the locale with the given name.
+ *
+ * The char* argument is a simple (not a composite) locale name, which may
+ * neither be an empty string nor a null pointer.
+ *
+ * These functions return NULL to indicate failure. Failure reason should be reported
+ * using the __err_code pointer.
+ */
+struct _Locale_ctype* _Locale_ctype_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+struct _Locale_codecvt* _Locale_codecvt_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+struct _Locale_numeric* _Locale_numeric_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+struct _Locale_time* _Locale_time_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+struct _Locale_collate* _Locale_collate_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+struct _Locale_monetary* _Locale_monetary_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+struct _Locale_messages* _Locale_messages_create(const char *, struct _Locale_name_hint*, int * /* __err_code */);
+
+/* Give error reason on failure of one of the _Locale_*_create functions. Available
+ * reasons are:
+ * 0: No specific error reason has been reported.
+ * 1: No platform support for the given facet.
+ * 2: Unknown locale name
+ * 3: No platform API for localization support.
+ * 4: No more memory
+ */
+#define _STLP_LOC_UNDEFINED 0
+#define _STLP_LOC_UNSUPPORTED_FACET_CATEGORY 1
+#define _STLP_LOC_UNKNOWN_NAME 2
+#define _STLP_LOC_NO_PLATFORM_SUPPORT 3
+#define _STLP_LOC_NO_MEMORY 4
+
+/* Release a category of a locale
+ *
+ * These functions are used to release a category acquired with the
+ * according _Locale_*_create() functions.
+ */
+void _Locale_ctype_destroy(struct _Locale_ctype *);
+void _Locale_codecvt_destroy(struct _Locale_codecvt *);
+void _Locale_numeric_destroy(struct _Locale_numeric *);
+void _Locale_time_destroy(struct _Locale_time *);
+void _Locale_collate_destroy(struct _Locale_collate *);
+void _Locale_monetary_destroy(struct _Locale_monetary *);
+void _Locale_messages_destroy(struct _Locale_messages *);
+
+/*
+ * Returns the name of the user's default locale in each
+ * category, as a null-terminated string. A NULL value
+ * means the default "C" locale.
+ */
+const char * _Locale_ctype_default(char * __buf);
+const char * _Locale_numeric_default(char * __buf);
+const char * _Locale_time_default(char * __buf);
+const char * _Locale_collate_default(char * __buf);
+const char * _Locale_monetary_default(char * __buf);
+const char * _Locale_messages_default(char * __buf);
+
+/* Retrieve the name of the given category
+ *
+ * __buf points to a buffer that can hold at least _Locale_MAX_SIMPLE_NAME
+ * characters. These functions store the name, as a null-terminated
+ * string, in __buf. This function can't fail, at worst name is truncated.
+ */
+char const* _Locale_ctype_name(const struct _Locale_ctype *, char* __buf);
+char const* _Locale_codecvt_name(const struct _Locale_codecvt *, char* __buf);
+char const* _Locale_numeric_name(const struct _Locale_numeric *, char* __buf);
+char const* _Locale_time_name(const struct _Locale_time *, char* __buf);
+char const* _Locale_collate_name(const struct _Locale_collate *, char* __buf);
+char const* _Locale_monetary_name(const struct _Locale_monetary *, char* __buf);
+char const* _Locale_messages_name(const struct _Locale_messages *, char* __buf);
+
+/*
+ * cname is a (possibly composite) locale name---i.e. a name that can
+ * be passed to setlocale. __buf points to an array large enough to
+ * store at least _Locale_MAX_SIMPLE_NAME characters, and each of these
+ * functions extracts the name of a single category, stores it in buf
+ * as a null-terminated string, and returns buf.
+ */
+char const* _Locale_extract_ctype_name(const char *cname, char *__buf,
+ struct _Locale_name_hint* __hint, int *__err_code);
+char const* _Locale_extract_numeric_name(const char *cname, char *__buf,
+ struct _Locale_name_hint* __hint, int *__err_code);
+char const* _Locale_extract_time_name(const char *cname, char *__buf,
+ struct _Locale_name_hint* __hint, int *__err_code);
+char const* _Locale_extract_collate_name(const char *cname, char *__buf,
+ struct _Locale_name_hint* __hint, int *__err_code);
+char const* _Locale_extract_monetary_name(const char *cname, char *__buf,
+ struct _Locale_name_hint* __hint, int *__err_code);
+char const* _Locale_extract_messages_name(const char *cname, char *__buf,
+ struct _Locale_name_hint* __hint, int *__err_code);
+
+/* Functions to improve locale creation process. For some locale API (Win32)
+ * you need to find a locale identification from the name which can be a
+ * rather expensive operation especially if you do so for all facets of a
+ * locale. Those functions can be used to extract from a API dependent facet
+ * struct the information necessary to skip this lookup process for other
+ * facets creation. If not supported those function should return NULL.
+ */
+struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype*);
+struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric*);
+struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time*);
+struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate*);
+struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary*);
+struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages*);
+
+/*
+ * FUNCTIONS THAT USE CTYPE
+ */
+
+/*
+ * Narrow character functions:
+ */
+
+/*
+ * Returns a pointer to the beginning of the ctype table. The table is
+ * at least 257 bytes long; if p is the pointer returned by this
+ * function, then p[c] is valid if c is EOF or if p is any value of
+ * type unsigned char.
+ */
+const _Locale_mask_t * _Locale_ctype_table(struct _Locale_ctype *);
+
+/*
+ * c is either EOF, or an unsigned char value.
+ */
+int _Locale_toupper(struct _Locale_ctype *, int /* c */);
+int _Locale_tolower(struct _Locale_ctype *, int /* c */);
+
+
+#ifndef _STLP_NO_WCHAR_T
+/*
+ * Wide character functions:
+ */
+_Locale_mask_t _WLocale_ctype(struct _Locale_ctype *, wint_t, _Locale_mask_t);
+wint_t _WLocale_tolower(struct _Locale_ctype *, wint_t);
+wint_t _WLocale_toupper(struct _Locale_ctype *, wint_t);
+
+/*
+ * Multibyte functions:
+ */
+
+/*
+ * Returns the number of bytes of the longest allowed multibyte
+ * character in the current encoding.
+ */
+int _WLocale_mb_cur_max(struct _Locale_codecvt *);
+
+/*
+ * Returns the number of bytes of the shortest allowed multibyte
+ * character in the current encoding.
+ */
+int _WLocale_mb_cur_min(struct _Locale_codecvt *);
+
+/*
+ * Returns 1 if the current multibyte encoding is stateless
+ * and does not require the use of an mbstate_t value.
+ */
+int _WLocale_is_stateless(struct _Locale_codecvt *);
+
+/*
+ * Almost identical to mbrtowc, from 4.6.5.3.2 of NA1. The only
+ * important difference is that mbrtowc treats null wide characters
+ * as special, and we don't. Specifically: examines the characters
+ * in [from, from + n), extracts a single wide character, and stores
+ * it in *to. Modifies shift_state if appropriate. The return value,
+ * which is always positive, is the number of characters extracted from
+ * the input sequence. Return value is (size_t) -1 if there was an
+ * encoding error in the input sequence, and (size_t) -2 if
+ * [from, from + n) is correct but not complete. None of the pointer
+ * arguments may be null pointers.
+ */
+size_t _WLocale_mbtowc(struct _Locale_codecvt *,
+ wchar_t * /* to */,
+ const char * /* from */, size_t /* n */,
+ mbstate_t *);
+
+/*
+ * Again, very similar to wcrtomb. The differences are that (1) it
+ * doesn't treat null characters as special; and (2) it stores at most
+ * n characters. Converts c to a multibyte sequence, stores that
+ * sequence in the array 'to', and returns the length of the sequence.
+ * Modifies shift_state if appropriate. The return value is (size_t) -1
+ * if c is not a valid wide character, and (size_t) -2 if the length of
+ * the multibyte character sequence is greater than n.
+ */
+size_t _WLocale_wctomb(struct _Locale_codecvt *,
+ char *, size_t,
+ const wchar_t,
+ mbstate_t *);
+
+/*
+ * Inserts whatever characters are necessary to restore st to an
+ * initial shift state. Sets *next to buf + m, where m is the number
+ * of characters inserted. (0 <= m <= n.) Returns m to indicate
+ * success, (size_t) -1 to indicate error, (size_t) -2 to indicate
+ * partial success (more than n characters needed). For success or partial
+ * success, sets *next to buf + m.
+ */
+size_t _WLocale_unshift(struct _Locale_codecvt *,
+ mbstate_t *,
+ char *, size_t, char **);
+#endif
+
+/*
+ * FUNCTIONS THAT USE COLLATE
+ */
+
+/*
+ * Compares the two sequences [s1, s1 + n1) and [s2, s2 + n2). Neither
+ * sequence is assumed to be null-terminated, and null characters
+ * aren't special. If the two sequences are the same up through
+ * min(n1, n2), then the sequence that compares less is whichever one
+ * is shorter.
+ */
+int _Locale_strcmp(struct _Locale_collate *,
+ const char * /* s1 */, size_t /* n1 */,
+ const char * /* s2 */, size_t /* n2 */);
+#ifndef _STLP_NO_WCHAR_T
+int _WLocale_strcmp(struct _Locale_collate *,
+ const wchar_t * /* s1 */, size_t /* n1 */,
+ const wchar_t * /* s2 */, size_t /* n2 */);
+#endif
+
+/*
+ * Creates a transformed version of the string [s2, s2 + n2). The
+ * string may contain embedded null characters; nulls aren't special.
+ * The transformed string begins at s1, and contains at most n1
+ * characters. The return value is the length of the transformed
+ * string. If the return value is greater than n1 then this is an
+ * error condition: it indicates that there wasn't enough space. In
+ * that case, the contents of [s1, s1 + n1) is unspecified.
+*/
+size_t _Locale_strxfrm(struct _Locale_collate *,
+ char * /* s1 */, size_t /* n1 */,
+ const char * /* s2 */, size_t /* n2 */);
+
+#ifndef _STLP_NO_WCHAR_T
+size_t _WLocale_strxfrm(struct _Locale_collate *,
+ wchar_t * /* s1 */, size_t /* n1 */,
+ const wchar_t * /* s2 */, size_t /* n2 */);
+#endif
+
+
+/*
+ * FUNCTIONS THAT USE NUMERIC
+ */
+
+/*
+ * Equivalent to the first three fields in struct lconv. (C standard,
+ * section 7.4.)
+ */
+char _Locale_decimal_point(struct _Locale_numeric *);
+char _Locale_thousands_sep(struct _Locale_numeric *);
+const char * _Locale_grouping(struct _Locale_numeric *);
+
+#ifndef _STLP_NO_WCHAR_T
+wchar_t _WLocale_decimal_point(struct _Locale_numeric *);
+wchar_t _WLocale_thousands_sep(struct _Locale_numeric *);
+#endif
+
+/*
+ * Return "true" and "false" in English locales, and something
+ * appropriate in non-English locales.
+ */
+const char * _Locale_true(struct _Locale_numeric *);
+const char * _Locale_false(struct _Locale_numeric *);
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t * _WLocale_true(struct _Locale_numeric *, wchar_t* /* buf */, size_t /* bufSize */);
+const wchar_t * _WLocale_false(struct _Locale_numeric *, wchar_t* /* buf */, size_t /* bufSize */);
+#endif
+
+/*
+ * FUNCTIONS THAT USE MONETARY
+ */
+
+/*
+ * Return the obvious fields of struct lconv.
+ */
+const char * _Locale_int_curr_symbol(struct _Locale_monetary *);
+const char * _Locale_currency_symbol(struct _Locale_monetary *);
+char _Locale_mon_decimal_point(struct _Locale_monetary *);
+char _Locale_mon_thousands_sep(struct _Locale_monetary *);
+const char * _Locale_mon_grouping(struct _Locale_monetary *);
+const char * _Locale_positive_sign(struct _Locale_monetary *);
+const char * _Locale_negative_sign(struct _Locale_monetary *);
+char _Locale_int_frac_digits(struct _Locale_monetary *);
+char _Locale_frac_digits(struct _Locale_monetary *);
+int _Locale_p_cs_precedes(struct _Locale_monetary *);
+int _Locale_p_sep_by_space(struct _Locale_monetary *);
+int _Locale_p_sign_posn(struct _Locale_monetary *);
+int _Locale_n_cs_precedes(struct _Locale_monetary *);
+int _Locale_n_sep_by_space(struct _Locale_monetary *);
+int _Locale_n_sign_posn(struct _Locale_monetary *);
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t * _WLocale_int_curr_symbol(struct _Locale_monetary *, wchar_t* /* buf */, size_t /* bufSize */);
+const wchar_t * _WLocale_currency_symbol(struct _Locale_monetary *, wchar_t* /* buf */, size_t /* bufSize */);
+wchar_t _WLocale_mon_decimal_point(struct _Locale_monetary *);
+wchar_t _WLocale_mon_thousands_sep(struct _Locale_monetary *);
+const wchar_t * _WLocale_positive_sign(struct _Locale_monetary *, wchar_t* /* buf */, size_t /* bufSize */);
+const wchar_t * _WLocale_negative_sign(struct _Locale_monetary *, wchar_t* /* buf */, size_t /* bufSize */);
+#endif
+
+/*
+ * FUNCTIONS THAT USE TIME
+ */
+
+/*
+ * month is in the range [0, 12).
+ */
+const char * _Locale_full_monthname(struct _Locale_time *, int /* month */);
+const char * _Locale_abbrev_monthname(struct _Locale_time *, int /* month */);
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t * _WLocale_full_monthname(struct _Locale_time *, int /* month */,
+ wchar_t* /* buf */, size_t /* bufSize */);
+const wchar_t * _WLocale_abbrev_monthname(struct _Locale_time *, int /* month */,
+ wchar_t* /* buf */, size_t /* bufSize */);
+#endif
+
+/*
+ * day is in the range [0, 7). Sunday is 0.
+ */
+const char * _Locale_full_dayofweek(struct _Locale_time *, int /* day */);
+const char * _Locale_abbrev_dayofweek(struct _Locale_time *, int /* day */);
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t * _WLocale_full_dayofweek(struct _Locale_time *, int /* day */,
+ wchar_t* /* buf */, size_t /* bufSize */);
+const wchar_t * _WLocale_abbrev_dayofweek(struct _Locale_time *, int /* day */,
+ wchar_t* /* buf */, size_t /* bufSize */);
+#endif
+
+const char * _Locale_d_t_fmt(struct _Locale_time *);
+const char * _Locale_d_fmt(struct _Locale_time *);
+const char * _Locale_t_fmt(struct _Locale_time *);
+const char * _Locale_long_d_t_fmt(struct _Locale_time*);
+const char * _Locale_long_d_fmt(struct _Locale_time*);
+
+const char * _Locale_am_str(struct _Locale_time *);
+const char * _Locale_pm_str(struct _Locale_time *);
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t * _WLocale_am_str(struct _Locale_time *,
+ wchar_t* /* buf */, size_t /* bufSize */);
+const wchar_t * _WLocale_pm_str(struct _Locale_time *,
+ wchar_t* /* buf */, size_t /* bufSize */);
+#endif
+
+/*
+ * FUNCTIONS THAT USE MESSAGES
+ */
+
+/*
+ * Very similar to catopen, except that it uses the given message
+ * category to determine which catalog to open.
+ */
+nl_catd_type _Locale_catopen(struct _Locale_messages*, const char*);
+
+/* Complementary to _Locale_catopen.
+ * The catalog must be a value that was returned by a previous call
+ * to _Locale_catopen.
+ */
+void _Locale_catclose(struct _Locale_messages*, nl_catd_type);
+
+/*
+ * Returns a string, identified by a set index and a message index,
+ * from an opened message catalog. Returns the supplied default if
+ * no such string exists.
+ */
+const char * _Locale_catgets(struct _Locale_messages *, nl_catd_type,
+ int, int,const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _STLP_C_LOCALE_IMPL_H */
diff --git a/src/c_locale_dummy/c_locale_dummy.c b/src/c_locale_dummy/c_locale_dummy.c
new file mode 100644
index 0000000..be48f23
--- /dev/null
+++ b/src/c_locale_dummy/c_locale_dummy.c
@@ -0,0 +1,485 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* This is a "stub" implementation of the "c_locale.h" interface,
+ intended for operating systems where we have not yet written
+ a real implementation. A C++ library using this stub implementation
+ is still standard-conforming, since the C++ standard does not require
+ that any locales other than "C" be supported.
+*/
+
+#include <string.h>
+#include <wchar.h>
+#include <ctype.h>
+#include <wctype.h>
+#include <limits.h>
+
+#if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+# define _STLP_STRNCPY(D, DS, S, C) strncpy_s(D, DS, S, C)
+# if !defined (_STLP_NO_WCHAR_T)
+# define _STLP_WCSNCPY(D, DS, S, C) wcsncpy_s(D, DS, S, C)
+# endif
+#else
+# define _STLP_STRNCPY(D, DS, S, C) strncpy(D, S, C)
+# if !defined (_STLP_NO_WCHAR_T)
+# define _STLP_WCSNCPY(D, DS, S, C) wcsncpy(D, S, C)
+# endif
+#endif
+
+static const char *_C_name = "C";
+static const char *_empty_str = "";
+#ifndef _STLP_NO_WCHAR_T
+static const wchar_t *_empty_wstr = L"";
+#endif
+
+static _Locale_mask_t ctable[256];
+
+/* Framework functions */
+
+void _Locale_init(void) {
+ /* Ctype table for the ASCII character set. */
+ char c;
+ /* We might never reach 128 when char is signed. */
+ for (c = 0; /* c != 128 */; ++c) {
+ if (isalpha(c)) ctable[(unsigned char)c] |= _Locale_ALPHA;
+ if (iscntrl(c)) ctable[(unsigned char)c] |= _Locale_CNTRL;
+ if (isdigit(c)) ctable[(unsigned char)c] |= _Locale_DIGIT;
+ if (isprint(c)) ctable[(unsigned char)c] |= _Locale_PRINT;
+ if (ispunct(c)) ctable[(unsigned char)c] |= _Locale_PUNCT;
+ if (isspace(c)) ctable[(unsigned char)c] |= _Locale_SPACE;
+ if (isxdigit(c)) ctable[(unsigned char)c] |= _Locale_XDIGIT;
+ if (isupper(c)) ctable[(unsigned char)c] |= _Locale_UPPER;
+ if (islower(c)) ctable[(unsigned char)c] |= _Locale_LOWER;
+ if (c == 127) break;
+ }
+
+ /* ASCII is a 7-bit code, so everything else is non-ASCII. */
+ memset(&(ctable[128]), 0, 128 * sizeof(_Locale_mask_t));
+}
+
+void _Locale_final(void)
+{}
+
+void* _Locale_create(const char* name, int *__err_code) {
+ if (name[0] == 'C' && name[1] == 0)
+ { return (void*)0x1; }
+ *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0;
+}
+
+struct _Locale_ctype* _Locale_ctype_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_ctype*)_Locale_create(name, __err_code); }
+
+struct _Locale_codecvt* _Locale_codecvt_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_codecvt*)_Locale_create(name, __err_code); }
+
+struct _Locale_numeric* _Locale_numeric_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_numeric*)_Locale_create(name, __err_code); }
+
+struct _Locale_time* _Locale_time_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_time*)_Locale_create(name, __err_code); }
+
+struct _Locale_collate* _Locale_collate_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_collate*)_Locale_create(name, __err_code); }
+
+struct _Locale_monetary* _Locale_monetary_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_monetary*)_Locale_create(name, __err_code); }
+
+struct _Locale_messages* _Locale_messages_create(const char *name,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return (struct _Locale_messages*)_Locale_create(name, __err_code); }
+
+const char *_Locale_ctype_default(char* buf) { return _C_name; }
+const char *_Locale_numeric_default(char * buf) { return _C_name; }
+const char *_Locale_time_default(char* buf) { return _C_name; }
+const char *_Locale_collate_default(char* buf) { return _C_name; }
+const char *_Locale_monetary_default(char* buf) { return _C_name; }
+const char *_Locale_messages_default(char* buf) { return _C_name; }
+
+char const* _Locale_ctype_name(const struct _Locale_ctype *lctype, char* buf)
+{ return _C_name; }
+
+char const* _Locale_codecvt_name(const struct _Locale_codecvt *lcodecvt, char* buf)
+{ return _C_name; }
+
+char const* _Locale_numeric_name(const struct _Locale_numeric *lnum, char* buf)
+{ return _C_name; }
+
+char const* _Locale_time_name(const struct _Locale_time *ltime, char* buf)
+{ return _C_name; }
+
+char const* _Locale_collate_name(const struct _Locale_collate *lcol, char* buf)
+{ return _C_name; }
+
+char const* _Locale_monetary_name(const struct _Locale_monetary *lmon, char* buf)
+{ return _C_name; }
+
+char const* _Locale_messages_name(const struct _Locale_messages *lmes, char* buf)
+{ return _C_name; }
+
+void _Locale_ctype_destroy(struct _Locale_ctype *lctype) {}
+void _Locale_codecvt_destroy(struct _Locale_codecvt *lcodecvt) {}
+void _Locale_numeric_destroy(struct _Locale_numeric *lnum) {}
+void _Locale_time_destroy(struct _Locale_time *ltime) {}
+void _Locale_collate_destroy(struct _Locale_collate *lcol) {}
+void _Locale_monetary_destroy(struct _Locale_monetary *lmon) {}
+void _Locale_messages_destroy(struct _Locale_messages *lmes) {}
+
+static char const* _Locale_extract_name(const char* name, int *__err_code) {
+ // When the request is the default locale or the "C" locale we answer "C".
+ if (name[0] == 0 ||
+ (name[0] == 'C' && name[1] == 0))
+ { return _C_name; }
+ *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0;
+}
+
+char const* _Locale_extract_ctype_name(const char *name, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_extract_name(name, __err_code); }
+
+char const* _Locale_extract_numeric_name(const char *name, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_extract_name(name, __err_code); }
+
+char const* _Locale_extract_time_name(const char*name, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_extract_name(name, __err_code); }
+
+char const* _Locale_extract_collate_name(const char *name, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_extract_name(name, __err_code); }
+
+char const* _Locale_extract_monetary_name(const char *name, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_extract_name(name, __err_code); }
+
+char const* _Locale_extract_messages_name(const char *name, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_extract_name(name, __err_code); }
+
+struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages)
+{ return 0; }
+
+/* ctype */
+const _Locale_mask_t* _Locale_ctype_table(struct _Locale_ctype* lctype) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lctype)
+ return ctable;
+}
+
+int _Locale_toupper(struct _Locale_ctype*lctype, int c)
+{ return toupper(c); }
+
+int _Locale_tolower(struct _Locale_ctype*lctype, int c)
+{ return tolower(c); }
+
+#ifndef _STLP_NO_WCHAR_T
+_Locale_mask_t _WLocale_ctype(struct _Locale_ctype *lctype, wint_t wc, _Locale_mask_t mask) {
+ _Locale_mask_t ret = 0;
+ if ((mask & _Locale_ALPHA) != 0 && iswalpha(wc))
+ ret |= _Locale_ALPHA;
+
+ if ((mask & _Locale_CNTRL) != 0 && iswcntrl(wc))
+ ret |= _Locale_CNTRL;
+
+ if ((mask & _Locale_DIGIT) != 0 && iswdigit(wc))
+ ret |= _Locale_DIGIT;
+
+ if ((mask & _Locale_PRINT) != 0 && iswprint(wc))
+ ret |= _Locale_PRINT;
+
+ if ((mask & _Locale_PUNCT) != 0 && iswpunct(wc))
+ ret |= _Locale_PUNCT;
+
+ if ((mask & _Locale_SPACE) != 0 && iswspace(wc))
+ ret |= _Locale_SPACE;
+
+ if ((mask & _Locale_XDIGIT) != 0 && iswxdigit(wc))
+ ret |= _Locale_XDIGIT;
+
+ if ((mask & _Locale_UPPER) != 0 && iswupper(wc))
+ ret |= _Locale_UPPER;
+
+ if ((mask & _Locale_LOWER) != 0 && iswlower(wc))
+ ret |= _Locale_LOWER;
+
+ return ret;
+}
+
+wint_t _WLocale_tolower(struct _Locale_ctype *lctype, wint_t wc)
+{ return towlower(wc); }
+
+wint_t _WLocale_toupper(struct _Locale_ctype *lctype, wint_t wc)
+{ return towupper(wc); }
+
+int _WLocale_mb_cur_max (struct _Locale_codecvt *lcodecvt) { return 1; }
+int _WLocale_mb_cur_min (struct _Locale_codecvt *lcodecvt) { return 1; }
+int _WLocale_is_stateless (struct _Locale_codecvt *lcodecvt) { return 1; }
+
+size_t _WLocale_mbtowc(struct _Locale_codecvt *lcodecvt,
+ wchar_t *to,
+ const char *from, size_t n,
+ mbstate_t *st)
+{ *to = *from; return 1; }
+
+size_t _WLocale_wctomb(struct _Locale_codecvt *lcodecvt,
+ char *to, size_t n,
+ const wchar_t c,
+ mbstate_t *st)
+{ *to = (char)c; return 1; }
+
+size_t _WLocale_unshift(struct _Locale_codecvt *lcodecvt,
+ mbstate_t *st,
+ char *buf, size_t n, char ** next)
+{ *next = buf; return 0; }
+#endif
+
+/* Collate */
+ int _Locale_strcmp(struct _Locale_collate* lcol,
+ const char* s1, size_t n1, const char* s2, size_t n2) {
+ int ret = 0;
+ char buf1[64], buf2[64];
+ while (n1 > 0 || n2 > 0) {
+ size_t bufsize1 = n1 < 63 ? n1 : 63;
+ size_t bufsize2 = n2 < 63 ? n2 : 63;
+ _STLP_STRNCPY(buf1, 64, s1, bufsize1); buf1[bufsize1] = 0;
+ _STLP_STRNCPY(buf2, 64, s2, bufsize2); buf2[bufsize2] = 0;
+
+ ret = strcmp(buf1, buf2);
+ if (ret != 0) return ret < 0 ? -1 : 1;
+ s1 += bufsize1; n1 -= bufsize1;
+ s2 += bufsize2; n2 -= bufsize2;
+ }
+ return ret == 0 ? 0 : (ret < 0 ? -1 : 1);
+}
+
+#ifndef _STLP_NO_WCHAR_T
+
+int _WLocale_strcmp(struct _Locale_collate* lcol,
+ const wchar_t* s1, size_t n1, const wchar_t* s2, size_t n2) {
+ int ret = 0;
+ wchar_t buf1[64], buf2[64];
+ while (n1 > 0 || n2 > 0) {
+ size_t bufsize1 = n1 < 63 ? n1 : 63;
+ size_t bufsize2 = n2 < 63 ? n2 : 63;
+ _STLP_WCSNCPY(buf1, 64, s1, bufsize1); buf1[bufsize1] = 0;
+ _STLP_WCSNCPY(buf2, 64, s2, bufsize2); buf2[bufsize2] = 0;
+
+ ret = wcscmp(buf1, buf2);
+ if (ret != 0) return ret < 0 ? -1 : 1;
+ s1 += bufsize1; n1 -= bufsize1;
+ s2 += bufsize2; n2 -= bufsize2;
+ }
+ return ret == 0 ? 0 : (ret < 0 ? -1 : 1);
+}
+
+#endif
+
+size_t _Locale_strxfrm(struct _Locale_collate* lcol,
+ char* dest, size_t dest_n,
+ const char* src, size_t src_n) {
+ if (dest != 0) {
+ _STLP_STRNCPY(dest, dest_n, src, dest_n - 1); dest[dest_n - 1] = 0;
+ }
+ return src_n;
+}
+
+#ifndef _STLP_NO_WCHAR_T
+
+size_t _WLocale_strxfrm(struct _Locale_collate* lcol,
+ wchar_t* dest, size_t dest_n,
+ const wchar_t* src, size_t src_n) {
+ if (dest != 0) {
+ _STLP_WCSNCPY(dest, dest_n, src, dest_n - 1); dest[dest_n - 1] = 0;
+ }
+ return src_n;
+}
+
+#endif
+
+/* Numeric */
+
+char _Locale_decimal_point(struct _Locale_numeric* lnum)
+{ return '.'; }
+char _Locale_thousands_sep(struct _Locale_numeric* lnum)
+{ return ','; }
+const char* _Locale_grouping(struct _Locale_numeric * lnum)
+{ return _empty_str; }
+const char * _Locale_true(struct _Locale_numeric * lnum)
+{ return "true"; }
+const char * _Locale_false(struct _Locale_numeric * lnum)
+{ return "false"; }
+
+#ifndef _STLP_NO_WCHAR_T
+wchar_t _WLocale_decimal_point(struct _Locale_numeric* lnum)
+{ return L'.'; }
+wchar_t _WLocale_thousands_sep(struct _Locale_numeric* lnum)
+{ return L','; }
+const wchar_t * _WLocale_true(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize)
+{ return L"true"; }
+const wchar_t * _WLocale_false(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize)
+{ return L"false"; }
+#endif
+
+/* Monetary */
+
+const char* _Locale_int_curr_symbol(struct _Locale_monetary * lmon)
+{ return _empty_str; }
+const char* _Locale_currency_symbol(struct _Locale_monetary * lmon)
+{ return _empty_str; }
+char _Locale_mon_decimal_point(struct _Locale_monetary * lmon)
+{ return '.'; }
+char _Locale_mon_thousands_sep(struct _Locale_monetary * lmon)
+{ return ','; }
+const char* _Locale_mon_grouping(struct _Locale_monetary * lmon)
+{ return _empty_str; }
+const char* _Locale_positive_sign(struct _Locale_monetary * lmon)
+{ return _empty_str; }
+const char* _Locale_negative_sign(struct _Locale_monetary * lmon)
+{ return _empty_str; }
+char _Locale_int_frac_digits(struct _Locale_monetary * lmon)
+{ return 0; }
+char _Locale_frac_digits(struct _Locale_monetary * lmon)
+{ return 0; }
+int _Locale_p_cs_precedes(struct _Locale_monetary * lmon)
+{ return CHAR_MAX; }
+int _Locale_p_sep_by_space(struct _Locale_monetary * lmon)
+{ return CHAR_MAX; }
+int _Locale_p_sign_posn(struct _Locale_monetary * lmon)
+{ return CHAR_MAX; }
+int _Locale_n_cs_precedes(struct _Locale_monetary * lmon)
+{ return CHAR_MAX; }
+int _Locale_n_sep_by_space(struct _Locale_monetary * lmon)
+{ return CHAR_MAX; }
+int _Locale_n_sign_posn(struct _Locale_monetary * lmon)
+{ return CHAR_MAX; }
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t* _WLocale_int_curr_symbol(struct _Locale_monetary * lmon,
+ wchar_t* buf, size_t bufSize)
+{ return _empty_wstr; }
+const wchar_t* _WLocale_currency_symbol(struct _Locale_monetary * lmon,
+ wchar_t* buf, size_t bufSize)
+{ return _empty_wstr; }
+wchar_t _WLocale_mon_decimal_point(struct _Locale_monetary * lmon)
+{ return L'.'; }
+wchar_t _WLocale_mon_thousands_sep(struct _Locale_monetary * lmon)
+{ return L','; }
+const wchar_t* _WLocale_positive_sign(struct _Locale_monetary * lmon,
+ wchar_t* buf, size_t bufSize)
+{ return _empty_wstr; }
+const wchar_t* _WLocale_negative_sign(struct _Locale_monetary * lmon,
+ wchar_t* buf, size_t bufSize)
+{ return _empty_wstr; }
+#endif
+
+/* Time */
+static const char* full_monthname[] =
+{ "January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December" };
+const char * _Locale_full_monthname(struct _Locale_time * ltime, int n)
+{ return full_monthname[n]; }
+
+static const char* abbrev_monthname[] =
+{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+const char * _Locale_abbrev_monthname(struct _Locale_time * ltime, int n)
+{ return abbrev_monthname[n]; }
+
+static const char* full_dayname[] =
+{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
+const char * _Locale_full_dayofweek(struct _Locale_time * ltime, int n)
+{ return full_dayname[n]; }
+
+static const char* abbrev_dayname[] =
+{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+const char * _Locale_abbrev_dayofweek(struct _Locale_time * ltime, int n)
+{ return abbrev_dayname[n]; }
+
+const char* _Locale_d_t_fmt(struct _Locale_time* ltime)
+{ return "%m/%d/%y"; }
+const char* _Locale_d_fmt(struct _Locale_time* ltime)
+{ return "%m/%d/%y"; }
+const char* _Locale_t_fmt(struct _Locale_time* ltime)
+{ return "%H:%M:%S"; }
+const char* _Locale_long_d_t_fmt(struct _Locale_time* ltime)
+{ return _empty_str; }
+const char* _Locale_long_d_fmt(struct _Locale_time* ltime)
+{ return _empty_str; }
+const char* _Locale_am_str(struct _Locale_time* ltime)
+{ return "AM"; }
+const char* _Locale_pm_str(struct _Locale_time* ltime)
+{ return "PM"; }
+
+#ifndef _STLP_NO_WCHAR_T
+static const wchar_t* full_wmonthname[] =
+{ L"January", L"February", L"March", L"April", L"May", L"June",
+ L"July", L"August", L"September", L"October", L"November", L"December" };
+const wchar_t * _WLocale_full_monthname(struct _Locale_time * ltime, int n,
+ wchar_t* buf, size_t bufSize)
+{ return full_wmonthname[n]; }
+
+static const wchar_t* abbrev_wmonthname[] =
+{ L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun",
+ L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec" };
+const wchar_t * _WLocale_abbrev_monthname(struct _Locale_time * ltime, int n,
+ wchar_t* buf, size_t bufSize)
+{ return abbrev_wmonthname[n]; }
+
+static const wchar_t* full_wdayname[] =
+{ L"Sunday", L"Monday", L"Tuesday", L"Wednesday", L"Thursday", L"Friday", L"Saturday" };
+const wchar_t * _WLocale_full_dayofweek(struct _Locale_time * ltime, int n,
+ wchar_t* buf, size_t bufSize)
+{ return full_wdayname[n]; }
+
+static const wchar_t* abbrev_wdayname[] =
+{ L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat" };
+const wchar_t * _WLocale_abbrev_dayofweek(struct _Locale_time * ltime, int n,
+ wchar_t* buf, size_t bufSize)
+{ return abbrev_wdayname[n]; }
+
+const wchar_t* _WLocale_am_str(struct _Locale_time* ltime,
+ wchar_t* buf, size_t bufSize)
+{ return L"AM"; }
+const wchar_t* _WLocale_pm_str(struct _Locale_time* ltime,
+ wchar_t* buf, size_t bufSize)
+{ return L"PM"; }
+#endif
+
+/* Messages */
+
+nl_catd_type _Locale_catopen(struct _Locale_messages* lmes, const char* name)
+{ return -1; }
+void _Locale_catclose(struct _Locale_messages* lmes, nl_catd_type cat) {}
+const char* _Locale_catgets(struct _Locale_messages* lmes, nl_catd_type cat,
+ int setid, int msgid, const char *dfault)
+{ return dfault; }
diff --git a/src/c_locale_glibc/c_locale_glibc2.c b/src/c_locale_glibc/c_locale_glibc2.c
new file mode 100644
index 0000000..0cf8279
--- /dev/null
+++ b/src/c_locale_glibc/c_locale_glibc2.c
@@ -0,0 +1,705 @@
+#include <locale.h>
+#include <langinfo.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wctype.h>
+#include <string.h>
+#include <stdint.h>
+
+static const char *_empty_str = "";
+static const char *_C_name = "C";
+
+static wchar_t* _ToWChar(const char* buf, wchar_t *wbuf, size_t wbufSize) {
+ wchar_t *wcur = wbuf;
+ wchar_t *wend = wbuf + wbufSize - 1;
+ for (; wcur != wend && *buf != 0; ++buf, ++wcur)
+ *wcur = *buf;
+ *wcur = 0;
+ return wbuf;
+}
+
+#if 0
+struct _Locale_ctype
+{
+ locale_t __cloc;
+};
+
+struct _Locale_numeric
+{
+ locale_t __cloc;
+};
+
+struct _Locale_time
+{
+ locale_t __cloc;
+};
+
+struct _Locale_collate
+{
+ locale_t __cloc;
+};
+
+struct _Locale_monetary
+{
+ locale_t __cloc;
+};
+
+struct _Locale_messages
+{
+ locale_t __cloc;
+};
+#endif
+
+void _Locale_init()
+{}
+
+void _Locale_final()
+{}
+
+struct _Locale_ctype *_Locale_ctype_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ *__err_code = _STLP_LOC_UNKNOWN_NAME;
+ return (struct _Locale_ctype*)newlocale(LC_CTYPE_MASK, nm, NULL);
+}
+
+struct _Locale_codecvt *_Locale_codecvt_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ // Glibc do not support multibyte manipulation for the moment, it simply implements "C".
+ if (nm[0] == 'C' && nm[1] == 0)
+ { return (struct _Locale_codecvt*)0x01; }
+ *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0;
+}
+
+struct _Locale_numeric *_Locale_numeric_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ *__err_code = _STLP_LOC_UNKNOWN_NAME;
+ return (struct _Locale_numeric*)newlocale(LC_NUMERIC_MASK, nm, NULL);
+}
+
+struct _Locale_time *_Locale_time_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ *__err_code = _STLP_LOC_UNKNOWN_NAME;
+ return (struct _Locale_time*)newlocale(LC_TIME_MASK, nm, NULL);
+}
+
+struct _Locale_collate *_Locale_collate_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ *__err_code = _STLP_LOC_UNKNOWN_NAME;
+ return (struct _Locale_collate*)newlocale(LC_COLLATE_MASK, nm, NULL);
+}
+
+struct _Locale_monetary *_Locale_monetary_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ *__err_code = _STLP_LOC_UNKNOWN_NAME;
+ return (struct _Locale_monetary*)newlocale(LC_MONETARY_MASK, nm, NULL);
+}
+
+struct _Locale_messages *_Locale_messages_create(const char *nm, struct _Locale_name_hint* hint,
+ int *__err_code) {
+ *__err_code = _STLP_LOC_UNKNOWN_NAME;
+ return (struct _Locale_messages*)newlocale(LC_MESSAGES_MASK, nm, NULL);
+}
+
+/*
+ try to see locale category LC should be used from environment;
+ according POSIX, the order is
+ 1. LC_ALL
+ 2. category (LC_CTYPE, LC_NUMERIC, ... )
+ 3. LANG
+ If set nothing, return "C" (this really implementation-specific).
+*/
+static const char *_Locale_aux_default( const char *LC, char *nm )
+{
+ char *name = getenv( "LC_ALL" );
+
+ if ( name != NULL && *name != 0 ) {
+ return name;
+ }
+ name = getenv( LC );
+ if ( name != NULL && *name != 0 ) {
+ return name;
+ }
+ name = getenv( "LANG" );
+ if ( name != NULL && *name != 0 ) {
+ return name;
+ }
+
+ return _C_name;
+}
+
+const char *_Locale_ctype_default( char *nm )
+{
+ return _Locale_aux_default( "LC_CTYPE", nm );
+}
+
+const char *_Locale_numeric_default( char *nm )
+{
+ return _Locale_aux_default( "LC_NUMERIC", nm );
+}
+
+const char *_Locale_time_default( char *nm )
+{
+ return _Locale_aux_default( "LC_TIME", nm );
+}
+
+const char *_Locale_collate_default( char *nm )
+{
+ return _Locale_aux_default( "LC_COLLATE", nm );
+}
+
+const char *_Locale_monetary_default( char *nm )
+{
+ return _Locale_aux_default( "LC_MONETARY", nm );
+}
+
+const char *_Locale_messages_default( char *nm )
+{
+ return _Locale_aux_default( "LC_MESSAGES", nm );
+}
+
+char const*_Locale_ctype_name( const struct _Locale_ctype *__loc, char *buf )
+{
+ return ((locale_t)__loc)->__names[LC_CTYPE];
+}
+
+char const*_Locale_codecvt_name( const struct _Locale_codecvt *__loc, char *buf )
+{
+ return _C_name;
+}
+
+char const*_Locale_numeric_name( const struct _Locale_numeric *__loc, char *buf )
+{
+ return ((locale_t)__loc)->__names[LC_NUMERIC];
+}
+
+char const*_Locale_time_name( const struct _Locale_time *__loc, char *buf )
+{
+ return ((locale_t)__loc)->__names[LC_TIME];
+}
+
+char const*_Locale_collate_name( const struct _Locale_collate *__loc, char *buf )
+{
+ return ((locale_t)__loc)->__names[LC_COLLATE];
+}
+
+char const*_Locale_monetary_name( const struct _Locale_monetary *__loc, char *buf )
+{
+ return ((locale_t)__loc)->__names[LC_MONETARY];
+}
+
+char const*_Locale_messages_name( const struct _Locale_messages *__loc, char *buf )
+{
+ return ((locale_t)__loc)->__names[LC_MESSAGES];
+}
+
+void _Locale_ctype_destroy( struct _Locale_ctype *__loc )
+{ freelocale((locale_t)__loc); }
+
+void _Locale_codecvt_destroy( struct _Locale_codecvt *__loc )
+{}
+
+void _Locale_numeric_destroy( struct _Locale_numeric *__loc )
+{ freelocale((locale_t)__loc); }
+
+void _Locale_time_destroy( struct _Locale_time *__loc )
+{ freelocale((locale_t)__loc); }
+
+void _Locale_collate_destroy( struct _Locale_collate *__loc )
+{ freelocale((locale_t)__loc); }
+
+void _Locale_monetary_destroy( struct _Locale_monetary *__loc )
+{ freelocale((locale_t)__loc); }
+
+void _Locale_messages_destroy( struct _Locale_messages* __loc )
+{ freelocale((locale_t)__loc); }
+
+/*
+ * locale loc expected either locale name indeed (platform-specific)
+ * or string like "LC_CTYPE=LocaleNameForCType;LC_NUMERIC=LocaleNameForNum;"
+ *
+ */
+
+static char const*__Extract_locale_name( const char *loc, const char *category, char *buf )
+{
+ char *expr;
+ size_t len_name;
+
+ if( loc[0]=='L' && loc[1]=='C' && loc[2]=='_') {
+ expr = strstr( (char*)loc, category );
+ if ( expr == NULL )
+ return NULL; /* Category not found. */
+ ++expr;
+ len_name = strcspn( expr, ";" );
+ len_name = len_name >= _Locale_MAX_SIMPLE_NAME ? _Locale_MAX_SIMPLE_NAME - 1 : len_name;
+ strncpy( buf, expr, len_name );
+ buf[len_name] = 0;
+ return buf;
+ }
+ return loc;
+}
+
+char const*_Locale_extract_ctype_name(const char *loc, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return __Extract_locale_name( loc, "LC_CTYPE=", buf ); }
+
+char const*_Locale_extract_numeric_name(const char *loc, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return __Extract_locale_name( loc, "LC_NUMERIC=", buf ); }
+
+char const*_Locale_extract_time_name(const char *loc, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return __Extract_locale_name( loc, "LC_TIME=", buf ); }
+
+char const*_Locale_extract_collate_name(const char *loc, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return __Extract_locale_name( loc, "LC_COLLATE=", buf ); }
+
+char const*_Locale_extract_monetary_name(const char *loc, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return __Extract_locale_name( loc, "LC_MONETARY=", buf ); }
+
+char const*_Locale_extract_messages_name(const char *loc, char *buf,
+ struct _Locale_name_hint* hint, int *__err_code)
+{ return __Extract_locale_name( loc, "LC_MESSAGES=", buf ); }
+
+struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary)
+{ return 0; }
+struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages)
+{ return 0; }
+
+/* ctype */
+
+const _Locale_mask_t *_Locale_ctype_table( struct _Locale_ctype *__loc )
+{
+ /* return table with masks (upper, lower, alpha, etc.) */
+ _STLP_STATIC_ASSERT( sizeof(_Locale_mask_t) == sizeof(((locale_t)__loc)->__ctype_b[0]) )
+ return ((locale_t)__loc)->__ctype_b;
+}
+
+int _Locale_toupper( struct _Locale_ctype *__loc, int c )
+{ return ((locale_t)__loc)->__ctype_toupper[c]; }
+
+int _Locale_tolower( struct _Locale_ctype *__loc, int c )
+{ return ((locale_t)__loc)->__ctype_tolower[c]; }
+
+#if !defined (_STLP_NO_WCHAR_T)
+_Locale_mask_t _WLocale_ctype( struct _Locale_ctype *__loc, wint_t wc, _Locale_mask_t __mask )
+{
+ _Locale_mask_t ret = 0;
+ if ((__mask & _Locale_ALPHA) != 0 && iswalpha_l(wc, (locale_t)__loc))
+ ret |= _Locale_ALPHA;
+
+ if ((__mask & _Locale_CNTRL) != 0 && iswcntrl_l(wc, (locale_t)__loc))
+ ret |= _Locale_CNTRL;
+
+ if ((__mask & _Locale_DIGIT) != 0 && iswdigit_l(wc, (locale_t)__loc))
+ ret |= _Locale_DIGIT;
+
+ if ((__mask & _Locale_PRINT) != 0 && iswprint_l(wc, (locale_t)__loc))
+ ret |= _Locale_PRINT;
+
+ if ((__mask & _Locale_PUNCT) != 0 && iswpunct_l(wc, (locale_t)__loc))
+ ret |= _Locale_PUNCT;
+
+ if ((__mask & _Locale_SPACE) != 0 && iswspace_l(wc, (locale_t)__loc))
+ ret |= _Locale_SPACE;
+
+ if ((__mask & _Locale_XDIGIT) != 0 && iswxdigit_l(wc, (locale_t)__loc))
+ ret |= _Locale_XDIGIT;
+
+ if ((__mask & _Locale_UPPER) != 0 && iswupper_l(wc, (locale_t)__loc))
+ ret |= _Locale_UPPER;
+
+ if ((__mask & _Locale_LOWER) != 0 && iswlower_l(wc, (locale_t)__loc))
+ ret |= _Locale_LOWER;
+
+ return ret;
+}
+
+wint_t _WLocale_tolower( struct _Locale_ctype *__loc, wint_t c )
+{
+ return towlower_l( c, ((locale_t)__loc) );
+}
+
+wint_t _WLocale_toupper( struct _Locale_ctype *__loc, wint_t c )
+{
+ return towupper_l( c, ((locale_t)__loc) );
+}
+#endif
+
+int _WLocale_mb_cur_max( struct _Locale_codecvt * lcodecvt) { return 1; }
+int _WLocale_mb_cur_min( struct _Locale_codecvt * lcodecvt) { return 1; }
+int _WLocale_is_stateless( struct _Locale_codecvt * lcodecvt) { return 1; }
+
+#if !defined (_STLP_NO_WCHAR_T)
+size_t _WLocale_mbtowc(struct _Locale_codecvt *lcodecvt,
+ wchar_t *to,
+ const char *from, size_t n,
+ mbstate_t *st)
+{ *to = *from; return 1; }
+
+size_t _WLocale_wctomb(struct _Locale_codecvt *lcodecvt,
+ char *to, size_t n,
+ const wchar_t c,
+ mbstate_t *st)
+{ *to = (char)c; return 1; }
+#endif
+
+size_t _WLocale_unshift(struct _Locale_codecvt *lcodecvt,
+ mbstate_t *st,
+ char *buf, size_t n, char ** next)
+{ *next = buf; return 0; }
+
+/* Collate */
+int _Locale_strcmp(struct _Locale_collate * __loc,
+ const char *s1, size_t n1,
+ const char *s2, size_t n2) {
+ int ret = 0;
+ char buf1[64], buf2[64];
+ while (n1 > 0 || n2 > 0) {
+ size_t bufsize1 = n1 < 63 ? n1 : 63;
+ size_t bufsize2 = n2 < 63 ? n2 : 63;
+ strncpy(buf1, s1, bufsize1); buf1[bufsize1] = 0;
+ strncpy(buf2, s2, bufsize2); buf2[bufsize2] = 0;
+
+ ret = strcoll_l(buf1, buf2, (locale_t)__loc);
+ if (ret != 0) return ret;
+ s1 += bufsize1; n1 -= bufsize1;
+ s2 += bufsize2; n2 -= bufsize2;
+ }
+ return ret;
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+int _WLocale_strcmp(struct _Locale_collate *__loc,
+ const wchar_t *s1, size_t n1,
+ const wchar_t *s2, size_t n2) {
+ int ret = 0;
+ wchar_t buf1[64], buf2[64];
+ while (n1 > 0 || n2 > 0) {
+ size_t bufsize1 = n1 < 63 ? n1 : 63;
+ size_t bufsize2 = n2 < 63 ? n2 : 63;
+ wcsncpy(buf1, s1, bufsize1); buf1[bufsize1] = 0;
+ wcsncpy(buf2, s2, bufsize2); buf2[bufsize2] = 0;
+
+ ret = wcscoll_l(buf1, buf2, (locale_t)__loc);
+ if (ret != 0) return ret;
+ s1 += bufsize1; n1 -= bufsize1;
+ s2 += bufsize2; n2 -= bufsize2;
+ }
+ return ret;
+}
+
+#endif
+
+size_t _Locale_strxfrm(struct _Locale_collate *__loc,
+ char *dest, size_t dest_n,
+ const char *src, size_t src_n )
+{
+ const char *real_src;
+ char *buf = NULL;
+ size_t result;
+
+ if (src_n == 0)
+ {
+ if (dest != NULL) dest[0] = 0;
+ return 0;
+ }
+ if (src[src_n] != 0) {
+ buf = malloc(src_n + 1);
+ strncpy(buf, src, src_n);
+ buf[src_n] = 0;
+ real_src = buf;
+ }
+ else
+ real_src = src;
+ result = strxfrm_l(dest, real_src, dest_n, (locale_t)__loc);
+ if (buf != NULL) free(buf);
+ return result;
+}
+
+# ifndef _STLP_NO_WCHAR_T
+
+size_t _WLocale_strxfrm( struct _Locale_collate *__loc,
+ wchar_t *dest, size_t dest_n,
+ const wchar_t *src, size_t src_n )
+{
+ const wchar_t *real_src;
+ wchar_t *buf = NULL;
+ size_t result;
+
+ if (src_n == 0)
+ {
+ if (dest != NULL) dest[0] = 0;
+ return 0;
+ }
+ if (src[src_n] != 0) {
+ buf = malloc((src_n + 1) * sizeof(wchar_t));
+ wcsncpy(buf, src, src_n);
+ buf[src_n] = 0;
+ real_src = buf;
+ }
+ else
+ real_src = src;
+ result = wcsxfrm_l(dest, real_src, dest_n, (locale_t)__loc);
+ if (buf != NULL) free(buf);
+ return result;
+}
+
+# endif
+
+/* Numeric */
+
+char _Locale_decimal_point(struct _Locale_numeric *__loc)
+{
+ return *(nl_langinfo_l(RADIXCHAR, (locale_t)__loc));
+}
+
+char _Locale_thousands_sep(struct _Locale_numeric *__loc)
+{
+ return *(nl_langinfo_l(THOUSEP, (locale_t)__loc));
+}
+
+const char* _Locale_grouping(struct _Locale_numeric *__loc)
+{
+ return (_Locale_thousands_sep(__loc) != 0 ) ? (nl_langinfo_l(GROUPING, (locale_t)__loc)) : _empty_str;
+}
+
+const char *_Locale_true(struct _Locale_numeric *__loc)
+{
+ return nl_langinfo_l(YESSTR, (locale_t)__loc);
+}
+
+const char *_Locale_false(struct _Locale_numeric *__loc)
+{
+ return nl_langinfo_l(NOSTR, (locale_t)__loc);
+}
+
+#ifndef _STLP_NO_WCHAR_T
+wchar_t _WLocale_decimal_point(struct _Locale_numeric *__loc)
+{ return (wchar_t)_Locale_decimal_point(__loc); }
+wchar_t _WLocale_thousands_sep(struct _Locale_numeric *__loc)
+{ return (wchar_t)_Locale_thousands_sep(__loc); }
+const wchar_t *_WLocale_true(struct _Locale_numeric *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_true(__loc), buf, bufSize); }
+const wchar_t *_WLocale_false(struct _Locale_numeric *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_false(__loc), buf, bufSize); }
+#endif
+
+/* Monetary */
+
+const char *_Locale_int_curr_symbol(struct _Locale_monetary *__loc)
+{
+ return nl_langinfo_l(INT_CURR_SYMBOL, (locale_t)__loc);
+}
+
+const char *_Locale_currency_symbol(struct _Locale_monetary *__loc)
+{
+ return nl_langinfo_l(CURRENCY_SYMBOL, (locale_t)__loc);
+}
+
+char _Locale_mon_decimal_point(struct _Locale_monetary * __loc)
+{
+ return *(nl_langinfo_l(MON_DECIMAL_POINT,(locale_t)__loc));
+}
+
+char _Locale_mon_thousands_sep(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(MON_THOUSANDS_SEP, (locale_t)__loc));
+}
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t *_WLocale_int_curr_symbol(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_int_curr_symbol(__loc), buf, bufSize); }
+const wchar_t *_WLocale_currency_symbol(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_currency_symbol(__loc), buf, bufSize); }
+wchar_t _WLocale_mon_decimal_point(struct _Locale_monetary * __loc)
+{ return (wchar_t)_Locale_mon_decimal_point(__loc); }
+wchar_t _WLocale_mon_thousands_sep(struct _Locale_monetary * __loc)
+{ return (wchar_t)_Locale_mon_thousands_sep(__loc); }
+const wchar_t *_WLocale_positive_sign(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_positive_sign(__loc), buf, bufSize); }
+const wchar_t *_WLocale_negative_sign(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_negative_sign(__loc), buf, bufSize); }
+#endif
+
+const char *_Locale_mon_grouping(struct _Locale_monetary *__loc)
+{
+ return (_Locale_mon_thousands_sep( __loc ) != 0 ) ? nl_langinfo_l(MON_GROUPING, (locale_t)__loc) : _empty_str;
+}
+
+const char *_Locale_positive_sign(struct _Locale_monetary *__loc)
+{
+ return nl_langinfo_l(POSITIVE_SIGN, (locale_t)__loc);
+}
+
+const char *_Locale_negative_sign(struct _Locale_monetary *__loc)
+{
+ return nl_langinfo_l(NEGATIVE_SIGN, (locale_t)__loc);
+}
+
+char _Locale_int_frac_digits(struct _Locale_monetary *__loc)
+{
+ /* We are forced to manually handled the "C" locale for consistency with
+ * the default implementation in STLport. */
+ const char* lname = ((locale_t)__loc)->__names[LC_MONETARY];
+ if (lname[0] == 'C' && lname[1] == 0)
+ return 0;
+ return *(nl_langinfo_l(INT_FRAC_DIGITS, (locale_t)__loc));
+}
+
+char _Locale_frac_digits(struct _Locale_monetary *__loc)
+{
+ /* We are forced to manually handled the "C" locale for consistency with
+ * the default implementation in STLport. */
+ const char* lname = ((locale_t)__loc)->__names[LC_MONETARY];
+ if (lname[0] == 'C' && lname[1] == 0)
+ return 0;
+ return *(nl_langinfo_l(FRAC_DIGITS, (locale_t)__loc));
+}
+
+/* 1 if currency_symbol precedes a positive value, 0 if succeeds */
+int _Locale_p_cs_precedes(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(P_CS_PRECEDES, (locale_t)__loc));
+}
+
+/* 1 if a space separates currency_symbol from a positive value. */
+int _Locale_p_sep_by_space(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(P_SEP_BY_SPACE, (locale_t)__loc));
+}
+
+/*
+ * 0 Parentheses surround the quantity and currency_symbol
+ * 1 The sign string precedes the quantity and currency_symbol
+ * 2 The sign string succeeds the quantity and currency_symbol.
+ * 3 The sign string immediately precedes the currency_symbol.
+ * 4 The sign string immediately succeeds the currency_symbol.
+ */
+int _Locale_p_sign_posn(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(P_SIGN_POSN, (locale_t)__loc));
+}
+
+/* 1 if currency_symbol precedes a negative value, 0 if succeeds */
+int _Locale_n_cs_precedes(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(N_CS_PRECEDES, (locale_t)__loc));
+}
+
+/* 1 if a space separates currency_symbol from a negative value. */
+int _Locale_n_sep_by_space(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(N_SEP_BY_SPACE, (locale_t)__loc));
+}
+
+/*
+ * 0 Parentheses surround the quantity and currency_symbol
+ * 1 The sign string precedes the quantity and currency_symbol
+ * 2 The sign string succeeds the quantity and currency_symbol.
+ * 3 The sign string immediately precedes the currency_symbol.
+ * 4 The sign string immediately succeeds the currency_symbol.
+ */
+int _Locale_n_sign_posn(struct _Locale_monetary *__loc)
+{
+ return *(nl_langinfo_l(N_SIGN_POSN, (locale_t)__loc));
+}
+
+
+/* Time */
+const char *_Locale_full_monthname(struct _Locale_time *__loc, int _m )
+{
+ return nl_langinfo_l(MON_1 + _m, (locale_t)__loc);
+}
+
+const char *_Locale_abbrev_monthname(struct _Locale_time *__loc, int _m )
+{
+ return nl_langinfo_l(ABMON_1 + _m, (locale_t)__loc);
+}
+
+const char *_Locale_full_dayofweek(struct _Locale_time *__loc, int _d )
+{
+ return nl_langinfo_l(DAY_1 + _d, (locale_t)__loc);
+}
+
+const char *_Locale_abbrev_dayofweek(struct _Locale_time *__loc, int _d )
+{
+ return nl_langinfo_l(ABDAY_1 + _d, (locale_t)__loc);
+}
+
+const char *_Locale_d_t_fmt(struct _Locale_time *__loc)
+{
+ return nl_langinfo_l(D_T_FMT, (locale_t)__loc);
+}
+
+const char *_Locale_d_fmt(struct _Locale_time *__loc )
+{
+ return nl_langinfo_l(D_FMT, (locale_t)__loc);
+}
+
+const char *_Locale_t_fmt(struct _Locale_time *__loc )
+{
+ return nl_langinfo_l(T_FMT, (locale_t)__loc);
+}
+
+const char *_Locale_long_d_t_fmt(struct _Locale_time *__loc )
+{
+ return nl_langinfo_l(ERA_D_T_FMT, (locale_t)__loc);
+}
+
+const char *_Locale_long_d_fmt(struct _Locale_time *__loc )
+{
+ return nl_langinfo_l(ERA_D_FMT, (locale_t)__loc);
+}
+
+const char *_Locale_am_str(struct _Locale_time *__loc )
+{
+ return nl_langinfo_l(AM_STR, (locale_t)__loc);
+}
+
+const char *_Locale_pm_str(struct _Locale_time* __loc )
+{
+ return nl_langinfo_l(PM_STR, (locale_t)__loc);
+}
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t *_WLocale_full_monthname(struct _Locale_time *__loc, int _m, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_full_monthname(__loc, _m), buf, bufSize); }
+const wchar_t *_WLocale_abbrev_monthname(struct _Locale_time *__loc, int _m, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_abbrev_monthname(__loc, _m), buf, bufSize); }
+const wchar_t *_WLocale_full_dayofweek(struct _Locale_time *__loc, int _d, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_full_dayofweek(__loc, _d), buf, bufSize); }
+const wchar_t *_WLocale_abbrev_dayofweek(struct _Locale_time *__loc, int _d, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_abbrev_dayofweek(__loc, _d), buf, bufSize); }
+const wchar_t *_WLocale_am_str(struct _Locale_time *__loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_am_str(__loc), buf, bufSize); }
+const wchar_t *_WLocale_pm_str(struct _Locale_time* __loc, wchar_t *buf, size_t bufSize)
+{ return _ToWChar(_Locale_pm_str(__loc), buf, bufSize); }
+#endif
+
+/* Messages */
+
+nl_catd_type _Locale_catopen(struct _Locale_messages *__loc, const char *__cat_name )
+{
+ return catopen( __cat_name, NL_CAT_LOCALE );
+}
+
+void _Locale_catclose(struct _Locale_messages *__loc, nl_catd_type __cat )
+{
+ catclose( __cat );
+}
+
+const char *_Locale_catgets(struct _Locale_messages *__loc, nl_catd_type __cat,
+ int __setid, int __msgid, const char *dfault)
+{
+ return catgets( __cat, __setid, __msgid, dfault );
+}
diff --git a/src/c_locale_win32/c_locale_win32.c b/src/c_locale_win32/c_locale_win32.c
new file mode 100644
index 0000000..dab958d
--- /dev/null
+++ b/src/c_locale_win32/c_locale_win32.c
@@ -0,0 +1,1786 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * Written 2000
+ * Anton Lapach
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include <limits.h>
+#if defined (_STLP_MSVC) || defined (__ICL)
+# include <memory.h>
+#endif
+#include <string.h>
+#include <locale.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+# define _STLP_STRCPY(D, DS, S) strcpy_s(D, DS, S)
+# define _STLP_STRNCPY(D, DS, S, C) strncpy_s(D, DS, S, C)
+# define _STLP_STRCAT(D, DS, S) strcat_s(D, DS, S)
+#else
+# define _STLP_STRCPY(D, DS, S) strcpy(D, S)
+# define _STLP_STRNCPY(D, DS, S, C) strncpy(D, S, C)
+# define _STLP_STRCAT(D, DS, S) strcat(D, S)
+#endif
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* Framework functions */
+/*
+ locale :: "lang[_country[.code_page]]"
+ | ".code_page"
+ | ""
+ | NULL
+
+*/
+
+typedef struct _LOCALECONV {
+ const char* name;
+ const char* abbrev;
+} LOCALECONV;
+
+#define MAX_LANG_LEN 64 /* max language name length */
+#define MAX_CTRY_LEN 64 /* max country name length */
+#define MAX_MODIFIER_LEN 0 /* max modifier name length - n/a */
+#define MAX_LC_LEN (MAX_LANG_LEN+MAX_CTRY_LEN+MAX_MODIFIER_LEN+3)
+ /* max entire locale string length */
+#define MAX_CP_LEN 5 /* max code page name length */
+
+#if !defined (LANG_INVARIANT)
+# define LANG_INVARIANT 0x7f
+# define _STLP_LANG_INVARIANT_DEFINED
+#endif
+
+#ifndef CP_UTF7
+# define CP_UTF7 65000
+#endif
+
+#ifndef CP_UTF8
+# define CP_UTF8 65001
+#endif
+
+#define INVARIANT_LCID MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT)
+
+static const char *_C_name = "C";
+
+/* non-NLS language string table */
+static LOCALECONV __rg_language[] = {
+ {"american", "ENU"},
+ {"american english", "ENU"},
+ {"american-english", "ENU"},
+ {"australian", "ENA"},
+ {"belgian", "NLB"},
+ {"canadian", "ENC"},
+ {"chh", "ZHH"},
+ {"chi", "ZHI"},
+ {"chinese", "CHS"},
+ {"chinese-hongkong", "ZHH"},
+ {"chinese-simplified", "CHS"},
+ {"chinese-singapore", "ZHI"},
+ {"chinese-traditional", "CHT"},
+ {"dutch-belgian", "NLB"},
+ {"english-american", "ENU"},
+ {"english-aus", "ENA"},
+ {"english-belize", "ENL"},
+ {"english-can", "ENC"},
+ {"english-caribbean", "ENB"},
+ {"english-ire", "ENI"},
+ {"english-jamaica", "ENJ"},
+ {"english-nz", "ENZ"},
+ {"english-south africa", "ENS"},
+ {"english-trinidad y tobago", "ENT"},
+ {"english-uk", "ENG"},
+ {"english-us", "ENU"},
+ {"english-usa", "ENU"},
+ {"french-belgian", "FRB"},
+ {"french-canadian", "FRC"},
+ {"french-luxembourg", "FRL"},
+ {"french-swiss", "FRS"},
+ {"german-austrian", "DEA"},
+ {"german-lichtenstein", "DEC"},
+ {"german-luxembourg", "DEL"},
+ {"german-swiss", "DES"},
+ {"irish-english", "ENI"},
+ {"italian-swiss", "ITS"},
+ {"norwegian", "NOR"},
+ {"norwegian-bokmal", "NOR"},
+ {"norwegian-nynorsk", "NON"},
+ {"portuguese-brazilian", "PTB"},
+ {"spanish-argentina", "ESS"},
+ {"spanish-bolivia", "ESB"},
+ {"spanish-chile", "ESL"},
+ {"spanish-colombia", "ESO"},
+ {"spanish-costa rica", "ESC"},
+ {"spanish-dominican republic", "ESD"},
+ {"spanish-ecuador", "ESF"},
+ {"spanish-el salvador", "ESE"},
+ {"spanish-guatemala", "ESG"},
+ {"spanish-honduras", "ESH"},
+ {"spanish-mexican", "ESM"},
+ {"spanish-modern", "ESN"},
+ {"spanish-nicaragua", "ESI"},
+ {"spanish-panama", "ESA"},
+ {"spanish-paraguay", "ESZ"},
+ {"spanish-peru", "ESR"},
+ {"spanish-puerto rico", "ESU"},
+ {"spanish-uruguay", "ESY"},
+ {"spanish-venezuela", "ESV"},
+ {"swedish-finland", "SVF"},
+ {"swiss", "DES"},
+ {"uk", "ENG"},
+ {"us", "ENU"},
+ {"usa", "ENU"}
+};
+
+/* non-NLS country string table */
+static LOCALECONV __rg_country[] = {
+ {"america", "USA"},
+ {"britain", "GBR"},
+ {"china", "CHN"},
+ {"czech", "CZE"},
+ {"england", "GBR"},
+ {"great britain", "GBR"},
+ {"holland", "NLD"},
+ {"hong-kong", "HKG"},
+ {"new-zealand", "NZL"},
+ {"nz", "NZL"},
+ {"pr china", "CHN"},
+ {"pr-china", "CHN"},
+ {"puerto-rico", "PRI"},
+ {"slovak", "SVK"},
+ {"south africa", "ZAF"},
+ {"south korea", "KOR"},
+ {"south-africa", "ZAF"},
+ {"south-korea", "KOR"},
+ {"trinidad & tobago", "TTO"},
+ {"uk", "GBR"},
+ {"united-kingdom", "GBR"},
+ {"united-states", "USA"},
+ {"us", "USA"},
+};
+
+typedef struct _Locale_name_hint {
+ LCID id;
+} _Locale_lcid_t;
+
+typedef struct _Locale_ctype {
+ _Locale_lcid_t lc;
+ UINT cp;
+ unsigned short ctable[256];
+} _Locale_ctype_t;
+
+typedef struct _Locale_numeric {
+ _Locale_lcid_t lc;
+ char cp[MAX_CP_LEN + 1];
+ char decimal_point[4];
+ char thousands_sep[4];
+ char *grouping;
+} _Locale_numeric_t;
+
+typedef struct _Locale_time {
+ _Locale_lcid_t lc;
+ char cp[MAX_CP_LEN + 1];
+ char *month[12];
+ char *abbrev_month[12];
+ char *dayofweek[7];
+ char *abbrev_dayofweek[7];
+ char *date_time_format;
+ char *long_date_time_format;
+ char *date_format;
+ char *long_date_format;
+ char *time_format;
+ char am[9];
+ char pm[9];
+} _Locale_time_t;
+
+typedef struct _Locale_collate {
+ _Locale_lcid_t lc;
+ char cp[MAX_CP_LEN + 1];
+} _Locale_collate_t;
+
+typedef struct _Locale_monetary {
+ _Locale_lcid_t lc;
+ char cp[MAX_CP_LEN + 1];
+ char decimal_point[4];
+ char thousands_sep[4];
+ char *grouping;
+ char int_curr_symbol[5]; /* 3 + 1 + 1 */
+ char curr_symbol[6];
+ char negative_sign[5];
+ char positive_sign[5];
+ int frac_digits;
+ int int_frac_digits;
+} _Locale_monetary_t;
+
+/* Internal function */
+static void __FixGrouping(char *grouping);
+static const char* __ConvertName(const char* lname, LOCALECONV* ConvTable, int TableSize);
+static int __ParseLocaleString(const char* lname, char* lang, char* ctry, char* page);
+static int __GetLCID(const char* lang, const char* ctry, LCID* lcid);
+static int __GetLCIDFromName(const char* lname, LCID* lcid, char *cp, _Locale_lcid_t *hint);
+static char const* __GetLocaleName(LCID lcid, const char* cp, char* buf);
+static char const* __Extract_locale_name(const char* loc, const char* category, char* buf);
+static char const* __TranslateToSystem(const char* lname, char* buf, _Locale_lcid_t* hint, int *__err_code);
+static void __GetLocaleInfoUsingACP(LCID lcid, const char* cp, LCTYPE lctype, char* buf, int buf_size, wchar_t* wbuf, int wbuf_size);
+static int __intGetACP(LCID lcid);
+static int __intGetOCP(LCID lcid);
+static int __GetDefaultCP(LCID lcid);
+static char* __ConvertToCP(int from_cp, int to_cp, const char *from, size_t size, size_t *ret_buf_size);
+static void my_ltoa(long __x, char* buf);
+
+void my_ltoa(long __x, char* buf) {
+ char rbuf[64];
+ char* ptr = rbuf;
+
+ if (__x == 0)
+ *ptr++ = '0';
+ else {
+ for (; __x != 0; __x /= 10)
+ *ptr++ = (char)(__x % 10) + '0';
+ }
+ while(ptr > rbuf) *buf++ = *--ptr;
+ /* psw */
+ *buf = '\0';
+}
+
+#if defined (__cplusplus)
+_STLP_BEGIN_NAMESPACE
+extern "C" {
+#endif
+
+_Locale_lcid_t* _Locale_get_ctype_hint(_Locale_ctype_t* ltype)
+{ return (ltype != 0) ? <ype->lc : 0; }
+_Locale_lcid_t* _Locale_get_numeric_hint(_Locale_numeric_t* lnumeric)
+{ return (lnumeric != 0) ? &lnumeric->lc : 0; }
+_Locale_lcid_t* _Locale_get_time_hint(_Locale_time_t* ltime)
+{ return (ltime != 0) ? <ime->lc : 0; }
+_Locale_lcid_t* _Locale_get_collate_hint(_Locale_collate_t* lcollate)
+{ return (lcollate != 0) ? &lcollate->lc : 0; }
+_Locale_lcid_t* _Locale_get_monetary_hint(_Locale_monetary_t* lmonetary)
+{ return (lmonetary != 0) ? &lmonetary->lc : 0; }
+_Locale_lcid_t* _Locale_get_messages_hint(struct _Locale_messages* lmessages) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lmessages)
+ return 0;
+}
+
+#define MAP(x, y) if ((mask & x) != 0) ret |= (y)
+unsigned short MapCtypeMask(unsigned short mask) {
+ unsigned short ret = 0;
+ MAP(C1_UPPER, _Locale_UPPER | _Locale_PRINT);
+ MAP(C1_LOWER, _Locale_LOWER | _Locale_PRINT);
+ MAP(C1_DIGIT, _Locale_DIGIT | _Locale_PRINT);
+ MAP(C1_SPACE, _Locale_SPACE | _Locale_PRINT);
+ MAP(C1_PUNCT, _Locale_PUNCT | _Locale_PRINT);
+ /* MAP(C1_BLANK, ?); */
+ MAP(C1_XDIGIT, _Locale_XDIGIT | _Locale_PRINT);
+ MAP(C1_ALPHA, _Locale_ALPHA | _Locale_PRINT);
+ if ((mask & C1_CNTRL) != 0) { ret |= _Locale_CNTRL; ret &= ~_Locale_PRINT; }
+ return ret;
+}
+
+static void MapCtypeMasks(unsigned short *cur, unsigned short *end) {
+ for (; cur != end; ++cur) {
+ *cur = MapCtypeMask(*cur);
+ }
+}
+
+_Locale_ctype_t* _Locale_ctype_create(const char * name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ char cp_name[MAX_CP_LEN + 1];
+ int NativeCP;
+ unsigned char Buffer[256];
+ unsigned char *ptr;
+ CPINFO CPInfo;
+ int i;
+ wchar_t *wbuffer;
+ int BufferSize;
+
+ _Locale_ctype_t *ltype = (_Locale_ctype_t*)malloc(sizeof(_Locale_ctype_t));
+
+ if (!ltype) { *__err_code = _STLP_LOC_NO_MEMORY; return ltype; }
+ memset(ltype, 0, sizeof(_Locale_ctype_t));
+
+ if (__GetLCIDFromName(name, <ype->lc.id, cp_name, lc_hint) == -1)
+ { free(ltype); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+#if defined (__BORLANDC__)
+ if ( ltype->lc.id == INVARIANT_LCID && name[0] == 'C' && name[1] == 0 )
+ { ltype->lc.id = 0x409; }
+#endif
+
+ ltype->cp = atoi(cp_name);
+
+ NativeCP = __GetDefaultCP(ltype->lc.id);
+
+ /* Make table with all characters. */
+ for (i = 0; i < 256; ++i) Buffer[i] = (unsigned char)i;
+
+ if (!GetCPInfo(NativeCP, &CPInfo)) { free(ltype); return NULL; }
+
+ if (CPInfo.MaxCharSize > 1) {
+ for (ptr = (unsigned char*)CPInfo.LeadByte; *ptr && *(ptr + 1); ptr+=2)
+ for (i = *ptr; i <= *(ptr + 1); ++i) Buffer[i] = 0;
+ }
+
+ if ((UINT)NativeCP != ltype->cp) {
+ OSVERSIONINFO ver_info;
+ ver_info.dwOSVersionInfoSize = sizeof(ver_info);
+ GetVersionEx(&ver_info);
+ if (ver_info.dwPlatformId == VER_PLATFORM_WIN32_NT) {
+ /* Convert character sequence to Unicode. */
+ BufferSize = MultiByteToWideChar(ltype->cp, MB_PRECOMPOSED, (const char*)Buffer, 256, NULL, 0);
+ if (!BufferSize) { free(ltype); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+ wbuffer = (wchar_t*)malloc(BufferSize * sizeof(wchar_t));
+ if (!wbuffer) { free(ltype); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ MultiByteToWideChar(ltype->cp, MB_PRECOMPOSED, (const char*)Buffer, 256, wbuffer, BufferSize);
+
+ GetStringTypeW(CT_CTYPE1, wbuffer, 256, ltype->ctable);
+ MapCtypeMasks(ltype->ctable, ltype->ctable + 256);
+ free(wbuffer);
+ }
+ else {
+ unsigned short ctable[256];
+ unsigned char TargetBuffer[256];
+ GetStringTypeA(ltype->lc.id, CT_CTYPE1, (const char*)Buffer, 256, ctable);
+
+ /* Convert character sequence to target code page. */
+ BufferSize = MultiByteToWideChar(NativeCP, MB_PRECOMPOSED, (const char*)Buffer, 256, NULL, 0);
+ if (!BufferSize) { free(ltype); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+ wbuffer = (wchar_t*)malloc(BufferSize * sizeof(wchar_t));
+ if (!wbuffer) { free(ltype); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ MultiByteToWideChar(NativeCP, MB_PRECOMPOSED, (const char*)Buffer, 256, wbuffer, BufferSize);
+ if (!WideCharToMultiByte(ltype->cp, WC_COMPOSITECHECK | WC_SEPCHARS, wbuffer, BufferSize, (char*)TargetBuffer, 256, NULL, FALSE))
+ { free(wbuffer); free(ltype); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+ free(wbuffer);
+
+ /* Translate ctype table. */
+ for (i = 0; i < 256; ++i) {
+ if (!TargetBuffer[i]) continue;
+ ltype->ctable[TargetBuffer[i]] = MapCtypeMask(ctable[i]);
+ }
+ }
+ }
+ else {
+ GetStringTypeA(ltype->lc.id, CT_CTYPE1, (const char*)Buffer, 256, ltype->ctable);
+ MapCtypeMasks(ltype->ctable, ltype->ctable + 256);
+ }
+ return ltype;
+}
+
+_Locale_numeric_t* _Locale_numeric_create(const char * name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ wchar_t wbuf[4];
+ char *GroupingBuffer;
+ int BufferSize;
+
+ _Locale_numeric_t *lnum = (_Locale_numeric_t*)malloc(sizeof(_Locale_numeric_t));
+ if (!lnum) { *__err_code = _STLP_LOC_NO_MEMORY; return lnum; }
+ memset(lnum, 0, sizeof(_Locale_numeric_t));
+
+ if (__GetLCIDFromName(name, &lnum->lc.id, lnum->cp, lc_hint) == -1)
+ { free(lnum); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+#if defined (__BORLANDC__)
+ if (lnum->lc.id != INVARIANT_LCID) {
+#endif
+ __GetLocaleInfoUsingACP(lnum->lc.id, lnum->cp, LOCALE_SDECIMAL, lnum->decimal_point, 4, wbuf, 4);
+ __GetLocaleInfoUsingACP(lnum->lc.id, lnum->cp, LOCALE_STHOUSAND, lnum->thousands_sep, 4, wbuf, 4);
+#if defined (__BORLANDC__)
+ }
+ else
+ lnum->decimal_point[0] = '.';
+#endif
+
+ if (lnum->lc.id != INVARIANT_LCID) {
+ BufferSize = GetLocaleInfoA(lnum->lc.id, LOCALE_SGROUPING, NULL, 0);
+ GroupingBuffer = (char*)malloc(BufferSize);
+ if (!GroupingBuffer) { free(lnum); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ GetLocaleInfoA(lnum->lc.id, LOCALE_SGROUPING, GroupingBuffer, BufferSize);
+ __FixGrouping(GroupingBuffer);
+ lnum->grouping = GroupingBuffer;
+ }
+ else {
+ lnum->grouping = (char*)malloc(1);
+ if (!lnum->grouping) { free(lnum); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ lnum->grouping[0] = 0;
+ }
+
+ return lnum;
+}
+
+static int __ConvertDate(const char *NTDate, char *buffer, int buf_size) {
+ /* This function will return an incomplete buffer if buffer is not long enough */
+ const char *cur_char;
+ char *cur_output, *end_output;
+
+ /* Correct time format. */
+ cur_char = NTDate;
+ cur_output = buffer;
+ end_output = cur_output + buf_size;
+ buf_size = 0;
+ while (*cur_char) {
+ if (cur_output && (cur_output == end_output)) break;
+ switch (*cur_char) {
+ case 'd':
+ {
+ if (*(cur_char + 1) == 'd') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (*(cur_char + 2) == 'd') {
+ if (*(cur_char + 3) == 'd') {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'A'; }
+ buf_size += 2;
+ cur_char += 3;
+ }
+ else {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'a'; }
+ buf_size += 2;
+ cur_char += 2;
+ }
+ }
+ else {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'd'; }
+ buf_size += 2;
+ cur_char++;
+ }
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'd'; }
+ buf_size += 3;
+ }
+ }
+ break;
+ case 'M':
+ {
+ if (*(cur_char + 1) == 'M') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (*(cur_char + 2) == 'M') {
+ if (*(cur_char + 3) == 'M') {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'B'; }
+ buf_size += 2;
+ cur_char += 3;
+ }
+ else {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'b'; }
+ buf_size += 2;
+ cur_char += 2;
+ }
+ }
+ else {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'm'; }
+ buf_size += 2;
+ cur_char++;
+ }
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'm'; }
+ buf_size += 3;
+ }
+ }
+ break;
+ case 'y':
+ {
+ if (*(cur_char + 1) == 'y') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (*(cur_char + 2) == 'y' && *(cur_char + 3) == 'y') {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'Y'; }
+ buf_size += 2;
+ cur_char += 3;
+ }
+ else {
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'y'; }
+ buf_size += 2;
+ cur_char++;
+ }
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'y'; }
+ buf_size += 3;
+ }
+ }
+ break;
+ case '%':
+ {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '%'; }
+ buf_size += 2;
+ }
+ break;
+ case '\'':
+ {
+ ++cur_char;
+ while (*cur_char != '\'' && *cur_char != 0 && (cur_output == NULL || cur_output != end_output)) {
+ if (cur_output) { *cur_output++ = *cur_char; }
+ ++cur_char;
+ buf_size += 1;
+ }
+ }
+ break;
+ default:
+ {
+ if (cur_output) { *(cur_output++) = *cur_char; }
+ buf_size += 1;
+ }
+ break;
+ }
+ if (*cur_char == 0) break;
+ ++cur_char;
+ }
+
+ if (!cur_output || cur_output != end_output) {
+ if (cur_output) *cur_output = 0;
+ buf_size += 1;
+ }
+ else {
+ /* We trunc result */
+ *(--cur_output) = 0;
+ }
+
+ return buf_size;
+}
+
+static int __ConvertTime(const char *NTTime, char *buffer, int buf_size) {
+ const char *cur_char;
+ char *cur_output, *end_output;
+ cur_char = NTTime;
+ cur_output = buffer;
+ end_output = cur_output + buf_size;
+ buf_size = 0;
+ while (*cur_char) {
+ switch(*cur_char) {
+ case 'h':
+ if (*(cur_char + 1) == 'h') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'I'; }
+ buf_size += 2;
+ ++cur_char;
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'I'; }
+ buf_size += 3;
+ }
+ break;
+ case 'H':
+ if (*(cur_char + 1) == 'H') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'H'; }
+ buf_size += 2;
+ ++cur_char;
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'H'; }
+ buf_size += 3;
+ }
+ break;
+ case 'm':
+ if (*(cur_char + 1) == 'm') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'M'; }
+ buf_size += 2;
+ cur_char++;
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'M'; }
+ buf_size += 3;
+ }
+ break;
+ case 's':
+ if (*(cur_char + 1) == 's') {
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'S'; }
+ buf_size += 2;
+ ++cur_char;
+ }
+ else {
+ if (cur_output && (cur_output + 3 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = '#'; *(cur_output++) = 'S'; }
+ buf_size += 3;
+ }
+ break;
+ case 't':
+ if (*(cur_char + 1) == 't')
+ ++cur_char;
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++) = '%'; *(cur_output++) = 'p'; }
+ buf_size += 2;
+ break;
+ case '%':
+ if (cur_output && (cur_output + 2 > end_output)) {
+ *cur_output = 0;
+ return ++buf_size;
+ }
+ if (cur_output) { *(cur_output++)='%'; *(cur_output++)='%'; }
+ buf_size += 2;
+ break;
+ case '\'':
+ ++cur_char;
+ while (*cur_char != '\'' && *cur_char != 0 && (!cur_output || (cur_output != end_output))) {
+ if (cur_output) *cur_output++ = *cur_char;
+ ++cur_char;
+ buf_size += 1;
+ }
+ break;
+ default:
+ if (cur_output) { *(cur_output++) = *cur_char; }
+ buf_size += 1;
+ break;
+ }
+ if (*cur_char == 0) break;
+ ++cur_char;
+ }
+
+ if (!cur_output || cur_output != end_output) {
+ if (cur_output) *cur_output = 0;
+ buf_size += 1;
+ }
+ else {
+ /* We trunc result */
+ *(--cur_output) = 0;
+ }
+
+ return buf_size;
+}
+
+_Locale_time_t* _Locale_time_create(const char * name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ int size, month, dayofweek;
+ size_t length;
+ char fmt80[80];
+ wchar_t wbuf80[80];
+
+ _Locale_time_t *ltime = (_Locale_time_t*)malloc(sizeof(_Locale_time_t));
+
+ if (!ltime) { *__err_code = _STLP_LOC_NO_MEMORY; return ltime; }
+ memset(ltime, 0, sizeof(_Locale_time_t));
+
+ if (__GetLCIDFromName(name, <ime->lc.id, ltime->cp, lc_hint) == -1)
+ { free(ltime); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+#if defined (__BORLANDC__)
+ if ( ltime->lc.id == INVARIANT_LCID && name[0] == 'C' && name[1] == 0 )
+ { ltime->lc.id = 0x409; }
+#endif
+
+ for (month = LOCALE_SMONTHNAME1; month <= LOCALE_SMONTHNAME12; ++month) { /* Small hack :-) */
+ size = GetLocaleInfoA(ltime->lc.id, month, NULL, 0);
+ ltime->month[month - LOCALE_SMONTHNAME1] = (char*)malloc(size);
+ if (!ltime->month[month - LOCALE_SMONTHNAME1])
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, month, ltime->month[month - LOCALE_SMONTHNAME1], size, wbuf80, 80);
+ }
+
+ for (month = LOCALE_SABBREVMONTHNAME1; month <= LOCALE_SABBREVMONTHNAME12; ++month) {
+ size = GetLocaleInfoA(ltime->lc.id, month, NULL, 0);
+ ltime->abbrev_month[month - LOCALE_SABBREVMONTHNAME1] = (char*)malloc(size);
+ if (!ltime->abbrev_month[month - LOCALE_SABBREVMONTHNAME1])
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, month, ltime->abbrev_month[month - LOCALE_SABBREVMONTHNAME1], size, wbuf80, 80);
+ }
+
+ for (dayofweek = LOCALE_SDAYNAME1; dayofweek <= LOCALE_SDAYNAME7; ++dayofweek) {
+ int dayindex = ( dayofweek != LOCALE_SDAYNAME7 ) ? dayofweek - LOCALE_SDAYNAME1 + 1 : 0;
+ size = GetLocaleInfoA(ltime->lc.id, dayofweek, NULL, 0);
+ ltime->dayofweek[dayindex] = (char*)malloc(size);
+ if (!ltime->dayofweek[dayindex])
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, dayofweek, ltime->dayofweek[dayindex], size, wbuf80, 80);
+ }
+
+ for (dayofweek = LOCALE_SABBREVDAYNAME1; dayofweek <= LOCALE_SABBREVDAYNAME7; ++dayofweek) {
+ int dayindex = ( dayofweek != LOCALE_SABBREVDAYNAME7 ) ? dayofweek - LOCALE_SABBREVDAYNAME1 + 1 : 0;
+ size = GetLocaleInfoA(ltime->lc.id, dayofweek, NULL, 0);
+ ltime->abbrev_dayofweek[dayindex] = (char*)malloc(size);
+ if (!ltime->abbrev_dayofweek[dayindex])
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, dayofweek, ltime->abbrev_dayofweek[dayindex], size, wbuf80, 80);
+ }
+
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_SSHORTDATE, fmt80, 80, wbuf80, 80);
+ size = __ConvertDate(fmt80, NULL, 0);
+ ltime->date_format = (char*)malloc(size);
+ if (!ltime->date_format)
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __ConvertDate(fmt80, ltime->date_format, size);
+
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_SLONGDATE, fmt80, 80, wbuf80, 80);
+ size = __ConvertDate(fmt80, NULL, 0);
+ ltime->long_date_format = (char*)malloc(size);
+ if (!ltime->long_date_format)
+ { _Locale_time_destroy(ltime);*__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __ConvertDate(fmt80, ltime->long_date_format, size);
+
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_STIMEFORMAT, fmt80, 80, wbuf80, 80);
+ size = __ConvertTime(fmt80, NULL, 0);
+ ltime->time_format = (char*)malloc(size);
+ if (!ltime->time_format)
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ __ConvertTime(fmt80, ltime->time_format, size);
+
+ /* NT doesn't provide this information, we must simulate. */
+ length = strlen(ltime->date_format) + strlen(ltime->time_format) + 1 /* space */ + 1 /* trailing 0 */;
+ ltime->date_time_format = (char*)malloc(length);
+ if (!ltime->date_time_format)
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ _STLP_STRCPY(ltime->date_time_format, length, ltime->date_format);
+ _STLP_STRCAT(ltime->date_time_format, length, " ");
+ _STLP_STRCAT(ltime->date_time_format, length, ltime->time_format);
+
+ /* NT doesn't provide this information, we must simulate. */
+ length = strlen(ltime->long_date_format) + strlen(ltime->time_format) + 1 /* space */ + 1 /* trailing 0 */;
+ ltime->long_date_time_format = (char*)malloc(length);
+ if (!ltime->long_date_time_format)
+ { _Locale_time_destroy(ltime); *__err_code = _STLP_LOC_NO_MEMORY; return NULL; }
+ _STLP_STRCPY(ltime->long_date_time_format, length, ltime->long_date_format);
+ _STLP_STRCAT(ltime->long_date_time_format, length, " ");
+ _STLP_STRCAT(ltime->long_date_time_format, length, ltime->time_format);
+
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_S1159, ltime->am, 9, wbuf80, 80);
+ __GetLocaleInfoUsingACP(ltime->lc.id, ltime->cp, LOCALE_S2359, ltime->pm, 9, wbuf80, 80);
+
+ return ltime;
+}
+
+_Locale_collate_t* _Locale_collate_create(const char * name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ _Locale_collate_t *lcol = (_Locale_collate_t*)malloc(sizeof(_Locale_collate_t));
+ if (!lcol) { *__err_code = _STLP_LOC_NO_MEMORY; return lcol; }
+ memset(lcol, 0, sizeof(_Locale_collate_t));
+
+ if (__GetLCIDFromName(name, &lcol->lc.id, lcol->cp, lc_hint) == -1)
+ { free(lcol); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+#if defined (__BORLANDC__)
+ if ( lcol->lc.id == INVARIANT_LCID && name[0] == 'C' && name[1] == 0 )
+ { lcol->lc.id = 0x409; }
+#endif
+
+ return lcol;
+}
+
+_Locale_monetary_t* _Locale_monetary_create(const char * name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ char *GroupingBuffer;
+ int BufferSize;
+ char FracDigits[3];
+ wchar_t wbuf[6];
+
+ _Locale_monetary_t *lmon = (_Locale_monetary_t*)malloc(sizeof(_Locale_monetary_t));
+ if (!lmon) { *__err_code = _STLP_LOC_NO_MEMORY; return lmon; }
+ memset(lmon, 0, sizeof(_Locale_monetary_t));
+
+ if (__GetLCIDFromName(name, &lmon->lc.id, lmon->cp, lc_hint) == -1)
+ { free(lmon); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+ if (lmon->lc.id != INVARIANT_LCID) {
+ /* Extract information about monetary system */
+ __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SDECIMAL, lmon->decimal_point, 4, wbuf, 6);
+ __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_STHOUSAND, lmon->thousands_sep, 4, wbuf, 6);
+
+ BufferSize = GetLocaleInfoA(lmon->lc.id, LOCALE_SGROUPING, NULL, 0);
+ GroupingBuffer = (char*)malloc(BufferSize);
+ if (!GroupingBuffer)
+ { lmon->grouping = NULL; *__err_code = _STLP_LOC_NO_MEMORY; return lmon; }
+ GetLocaleInfoA(lmon->lc.id, LOCALE_SGROUPING, GroupingBuffer, BufferSize);
+ __FixGrouping(GroupingBuffer);
+ lmon->grouping = GroupingBuffer;
+
+ __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SCURRENCY, lmon->curr_symbol, 6, wbuf, 6);
+ __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SNEGATIVESIGN, lmon->negative_sign, 5, wbuf, 6);
+ __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SPOSITIVESIGN, lmon->positive_sign, 5, wbuf, 6);
+
+ GetLocaleInfoA(lmon->lc.id, LOCALE_ICURRDIGITS, FracDigits, 3);
+ lmon->frac_digits = atoi(FracDigits);
+
+ GetLocaleInfoA(lmon->lc.id, LOCALE_IINTLCURRDIGITS, FracDigits, 3);
+ lmon->int_frac_digits = atoi(FracDigits);
+
+ __GetLocaleInfoUsingACP(lmon->lc.id, lmon->cp, LOCALE_SINTLSYMBOL, lmon->int_curr_symbol, 5, wbuf, 6);
+ /* Even if Platform SDK documentation says that the returned symbol should
+ * be a 3 letters symbol followed by a seperation character, experimentation
+ * has shown that no seperation character is ever appended. We are adding it
+ * ourself to conform to the POSIX specification.
+ */
+ if (lmon->int_curr_symbol[3] == 0) {
+ lmon->int_curr_symbol[3] = ' ';
+ lmon->int_curr_symbol[4] = 0;
+ }
+ }
+ /* else it is already ok */
+
+ return lmon;
+}
+
+struct _Locale_messages* _Locale_messages_create(const char *name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ /* The Win32 API has no support for messages facet */
+ _STLP_MARK_PARAMETER_AS_UNUSED(name)
+ _STLP_MARK_PARAMETER_AS_UNUSED(lc_hint)
+ *__err_code = _STLP_LOC_UNSUPPORTED_FACET_CATEGORY;
+ return NULL;
+}
+
+static const char* _Locale_common_default(char* buf) {
+ char cp[MAX_CP_LEN + 1];
+ int CodePage = __GetDefaultCP(LOCALE_USER_DEFAULT);
+ my_ltoa(CodePage, cp);
+ return __GetLocaleName(LOCALE_USER_DEFAULT, cp, buf);
+}
+
+const char* _Locale_ctype_default(char* buf)
+{ return _Locale_common_default(buf); }
+
+const char* _Locale_numeric_default(char * buf)
+{ return _Locale_common_default(buf); }
+
+const char* _Locale_time_default(char* buf)
+{ return _Locale_common_default(buf); }
+
+const char* _Locale_collate_default(char* buf)
+{ return _Locale_common_default(buf); }
+
+const char* _Locale_monetary_default(char* buf)
+{ return _Locale_common_default(buf); }
+
+const char* _Locale_messages_default(char* buf)
+{ return _Locale_common_default(buf); }
+
+char const* _Locale_ctype_name(const _Locale_ctype_t* ltype, char* buf) {
+ char cp_buf[MAX_CP_LEN + 1];
+ my_ltoa(ltype->cp, cp_buf);
+ return __GetLocaleName(ltype->lc.id, cp_buf, buf);
+}
+
+char const* _Locale_numeric_name(const _Locale_numeric_t* lnum, char* buf)
+{ return __GetLocaleName(lnum->lc.id, lnum->cp, buf); }
+
+char const* _Locale_time_name(const _Locale_time_t* ltime, char* buf)
+{ return __GetLocaleName(ltime->lc.id, ltime->cp, buf); }
+
+char const* _Locale_collate_name(const _Locale_collate_t* lcol, char* buf)
+{ return __GetLocaleName(lcol->lc.id, lcol->cp, buf); }
+
+char const* _Locale_monetary_name(const _Locale_monetary_t* lmon, char* buf)
+{ return __GetLocaleName(lmon->lc.id, lmon->cp, buf); }
+
+char const* _Locale_messages_name(const struct _Locale_messages* lmes, char* buf) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lmes)
+ _STLP_MARK_PARAMETER_AS_UNUSED(buf)
+ return NULL;
+}
+
+void _Locale_ctype_destroy(_Locale_ctype_t* ltype) {
+ if (!ltype) return;
+
+ free(ltype);
+}
+
+void _Locale_numeric_destroy(_Locale_numeric_t* lnum) {
+ if (!lnum) return;
+
+ if (lnum->grouping) free(lnum->grouping);
+ free(lnum);
+}
+
+void _Locale_time_destroy(_Locale_time_t* ltime) {
+ int i;
+ if (!ltime) return;
+
+ for (i = 0; i < 12; ++i) {
+ if (ltime->month[i]) free(ltime->month[i]);
+ if (ltime->abbrev_month[i]) free(ltime->abbrev_month[i]);
+ }
+
+ for (i = 0; i < 7; ++i) {
+ if (ltime->dayofweek[i]) free(ltime->dayofweek[i]);
+ if (ltime->abbrev_dayofweek[i]) free(ltime->abbrev_dayofweek[i]);
+ }
+
+ if (ltime->date_format) free(ltime->date_format);
+ if (ltime->long_date_format) free(ltime->long_date_format);
+ if (ltime->time_format) free(ltime->time_format);
+ if (ltime->date_time_format) free(ltime->date_time_format);
+ if (ltime->long_date_time_format) free(ltime->long_date_time_format);
+
+ free(ltime);
+}
+
+void _Locale_collate_destroy(_Locale_collate_t* lcol) {
+ if (!lcol) return;
+
+ free(lcol);
+}
+
+void _Locale_monetary_destroy(_Locale_monetary_t* lmon) {
+ if (!lmon) return;
+
+ if (lmon->grouping) free(lmon->grouping);
+ free(lmon);
+}
+
+void _Locale_messages_destroy(struct _Locale_messages* lmes)
+{ _STLP_MARK_PARAMETER_AS_UNUSED(lmes) }
+
+static char const* _Locale_extract_category_name(const char* name, const char* category, char* buf,
+ _Locale_lcid_t* hint, int *__err_code) {
+ const char* cname = __Extract_locale_name(name, category, buf);
+ if (cname == 0 || (cname[0] == 'C' && cname[1] == 0)) {
+ return cname;
+ }
+ return __TranslateToSystem(cname, buf, hint, __err_code);
+}
+
+char const* _Locale_extract_ctype_name(const char* cname, char* buf,
+ _Locale_lcid_t* hint, int *__err_code)
+{ return _Locale_extract_category_name(cname, "LC_CTYPE", buf, hint, __err_code); }
+
+char const* _Locale_extract_numeric_name(const char* cname, char* buf,
+ _Locale_lcid_t* hint, int *__err_code)
+{ return _Locale_extract_category_name(cname, "LC_NUMERIC", buf, hint, __err_code); }
+
+char const* _Locale_extract_time_name(const char* cname, char* buf,
+ _Locale_lcid_t* hint, int *__err_code)
+{ return _Locale_extract_category_name(cname, "LC_TIME", buf, hint, __err_code); }
+
+char const* _Locale_extract_collate_name(const char* cname, char* buf,
+ _Locale_lcid_t* hint, int *__err_code)
+{ return _Locale_extract_category_name(cname, "LC_COLLATE", buf, hint, __err_code); }
+
+char const* _Locale_extract_monetary_name(const char* cname, char* buf,
+ _Locale_lcid_t* hint, int *__err_code)
+{ return _Locale_extract_category_name(cname, "LC_MONETARY", buf, hint, __err_code); }
+
+char const* _Locale_extract_messages_name(const char* cname, char* buf,
+ _Locale_lcid_t* hint, int *__err_code) {
+ if (cname[0] == 'L' && cname[1] == 'C' && cname[2] == '_') {
+ return _C_name;
+ }
+ if (cname[0] == 'C' && cname[1] == 0) {
+ return _C_name;
+ }
+ return __TranslateToSystem(cname, buf, hint, __err_code);
+}
+
+/* ctype */
+
+const _Locale_mask_t* _Locale_ctype_table(_Locale_ctype_t* ltype) {
+ _STLP_STATIC_ASSERT(sizeof(_Locale_mask_t) == sizeof(ltype->ctable[0]))
+ return (const _Locale_mask_t*)ltype->ctable;
+}
+
+int _Locale_toupper(_Locale_ctype_t* ltype, int c) {
+ char buf[2], out_buf[2];
+ buf[0] = (char)c; buf[1] = 0;
+ if ((UINT)__GetDefaultCP(ltype->lc.id) == ltype->cp) {
+ LCMapStringA(ltype->lc.id, LCMAP_LINGUISTIC_CASING | LCMAP_UPPERCASE, buf, 2, out_buf, 2);
+ return out_buf[0];
+ }
+ else {
+ wchar_t wbuf[2];
+ MultiByteToWideChar(ltype->cp, MB_PRECOMPOSED, buf, 2, wbuf, 2);
+ WideCharToMultiByte(__GetDefaultCP(ltype->lc.id), WC_COMPOSITECHECK | WC_SEPCHARS, wbuf, 2, buf, 2, NULL, FALSE);
+
+ LCMapStringA(ltype->lc.id, LCMAP_LINGUISTIC_CASING | LCMAP_UPPERCASE, buf, 2, out_buf, 2);
+
+ MultiByteToWideChar(__GetDefaultCP(ltype->lc.id), MB_PRECOMPOSED, out_buf, 2, wbuf, 2);
+ WideCharToMultiByte(ltype->cp, WC_COMPOSITECHECK | WC_SEPCHARS, wbuf, 2, out_buf, 2, NULL, FALSE);
+ return out_buf[0];
+ }
+}
+
+int _Locale_tolower(_Locale_ctype_t* ltype, int c) {
+ char buf[2], out_buf[2];
+ buf[0] = (char)c; buf[1] = 0;
+ if ((UINT)__GetDefaultCP(ltype->lc.id) == ltype->cp) {
+ LCMapStringA(ltype->lc.id, LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE, buf, 2, out_buf, 2);
+ return out_buf[0];
+ }
+ else {
+ wchar_t wbuf[2];
+ MultiByteToWideChar(ltype->cp, MB_PRECOMPOSED, buf, 2, wbuf, 2);
+ WideCharToMultiByte(__GetDefaultCP(ltype->lc.id), WC_COMPOSITECHECK | WC_SEPCHARS, wbuf, 2, buf, 2, NULL, FALSE);
+
+ LCMapStringA(ltype->lc.id, LCMAP_LINGUISTIC_CASING | LCMAP_LOWERCASE, buf, 2, out_buf, 2);
+
+ MultiByteToWideChar(__GetDefaultCP(ltype->lc.id), MB_PRECOMPOSED, out_buf, 2, wbuf, 2);
+ WideCharToMultiByte(ltype->cp, WC_COMPOSITECHECK | WC_SEPCHARS, wbuf, 2, out_buf, 2, NULL, FALSE);
+ return out_buf[0];
+ }
+}
+
+#ifndef CSTR_EQUAL /* VC5SP3*/
+# define CSTR_EQUAL 2
+#endif
+#ifndef CSTR_LESS_THAN /* VC5SP3 */
+# define CSTR_LESS_THAN 1
+#endif
+
+static DWORD max_DWORD = 0xffffffff;
+static DWORD trim_size_t_to_DWORD(size_t n) { return n < (size_t)max_DWORD ? (DWORD)n : max_DWORD; }
+
+/* Collate */
+/* This function takes care of the potential size_t DWORD different size. */
+static int _Locale_strcmp_auxA(_Locale_collate_t* lcol,
+ const char* s1, size_t n1,
+ const char* s2, size_t n2) {
+ int result = CSTR_EQUAL;
+ while (n1 > 0 || n2 > 0) {
+ DWORD size1 = trim_size_t_to_DWORD(n1);
+ DWORD size2 = trim_size_t_to_DWORD(n2);
+ result = CompareStringA(lcol->lc.id, 0, s1, size1, s2, size2);
+ if (result != CSTR_EQUAL)
+ break;
+ n1 -= size1;
+ n2 -= size2;
+ }
+ return result;
+}
+
+int _Locale_strcmp(_Locale_collate_t* lcol,
+ const char* s1, size_t n1,
+ const char* s2, size_t n2) {
+ int result;
+ if (__GetDefaultCP(lcol->lc.id) == atoi(lcol->cp)) {
+ result = _Locale_strcmp_auxA(lcol, s1, n1, s2, n2);
+ }
+ else {
+ char *buf1, *buf2;
+ size_t size1, size2;
+ buf1 = __ConvertToCP(atoi(lcol->cp), __GetDefaultCP(lcol->lc.id), s1, n1, &size1);
+ buf2 = __ConvertToCP(atoi(lcol->cp), __GetDefaultCP(lcol->lc.id), s2, n2, &size2);
+
+ result = _Locale_strcmp_auxA(lcol, buf1, size1, buf2, size2);
+ free(buf1); free(buf2);
+ }
+ return (result == CSTR_EQUAL) ? 0 : (result == CSTR_LESS_THAN) ? -1 : 1;
+}
+
+size_t _Locale_strxfrm(_Locale_collate_t* lcol,
+ char* dst, size_t dst_size,
+ const char* src, size_t src_size) {
+ int result;
+
+ /* The Windows API do not support transformation of very long strings (src_size > INT_MAX)
+ * In this case the result will just be the input string:
+ */
+ if (src_size > INT_MAX) {
+ if (dst != 0) {
+ _STLP_STRNCPY(dst, dst_size, src, src_size);
+ }
+ return src_size;
+ }
+ if (dst_size > INT_MAX) {
+ /* now that we know that src_size <= INT_MAX we can safely decrease dst_size to INT_MAX. */
+ dst_size = INT_MAX;
+ }
+
+ if (__GetDefaultCP(lcol->lc.id) == atoi(lcol->cp))
+ result = LCMapStringA(lcol->lc.id, LCMAP_SORTKEY, src, (int)src_size, dst, (int)dst_size);
+ else {
+ char *buf;
+ size_t size;
+ buf = __ConvertToCP(atoi(lcol->cp), __GetDefaultCP(lcol->lc.id), src, src_size, &size);
+
+ result = LCMapStringA(lcol->lc.id, LCMAP_SORTKEY, buf, (int)size, dst, (int)dst_size);
+ free(buf);
+ }
+ return result != 0 ? result - 1 : 0;
+}
+
+/* Numeric */
+static const char* __true_name = "true";
+static const char* __false_name = "false";
+
+char _Locale_decimal_point(_Locale_numeric_t* lnum)
+{ return lnum->decimal_point[0]; }
+
+char _Locale_thousands_sep(_Locale_numeric_t* lnum)
+{ return lnum->thousands_sep[0]; }
+
+const char* _Locale_grouping(_Locale_numeric_t * lnum) {
+ if (!lnum->grouping) return "";
+ else return lnum->grouping;
+}
+
+const char * _Locale_true(_Locale_numeric_t * lnum) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lnum)
+ return __true_name; /* NT does't provide information about this */
+}
+
+const char * _Locale_false(_Locale_numeric_t * lnum) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lnum)
+ return __false_name; /* NT does't provide information about this */
+}
+
+/* Monetary */
+const char* _Locale_int_curr_symbol(_Locale_monetary_t * lmon)
+{ return lmon->int_curr_symbol; }
+
+const char* _Locale_currency_symbol(_Locale_monetary_t * lmon)
+{ return lmon->curr_symbol; }
+
+char _Locale_mon_decimal_point(_Locale_monetary_t * lmon)
+{ return lmon->decimal_point[0]; }
+
+char _Locale_mon_thousands_sep(_Locale_monetary_t * lmon)
+{ return lmon->thousands_sep[0]; }
+
+const char* _Locale_mon_grouping(_Locale_monetary_t * lmon) {
+ if (!lmon->grouping) return "";
+ else return lmon->grouping;
+}
+
+const char* _Locale_positive_sign(_Locale_monetary_t * lmon)
+{ return lmon->positive_sign; }
+
+const char* _Locale_negative_sign(_Locale_monetary_t * lmon)
+{ return lmon->negative_sign; }
+
+char _Locale_int_frac_digits(_Locale_monetary_t * lmon)
+{ return (char)lmon->int_frac_digits; }
+
+char _Locale_frac_digits(_Locale_monetary_t * lmon)
+{ return (char)lmon->frac_digits; }
+
+int _Locale_p_cs_precedes(_Locale_monetary_t * lmon) {
+ char loc_data[2];
+ GetLocaleInfoA(lmon->lc.id, LOCALE_IPOSSYMPRECEDES, loc_data, 2);
+ if (loc_data[0] == '0') return 0;
+ else if (loc_data[0] == '1') return 1;
+ else return -1;
+}
+
+int _Locale_p_sep_by_space(_Locale_monetary_t * lmon) {
+ char loc_data[2];
+ GetLocaleInfoA(lmon->lc.id, LOCALE_IPOSSEPBYSPACE, loc_data, 2);
+ if (loc_data[0] == '0') return 0;
+ else if (loc_data[0] == '1') return 1;
+ else return -1;
+}
+
+int _Locale_p_sign_posn(_Locale_monetary_t * lmon) {
+ char loc_data[2];
+ if (lmon->lc.id != INVARIANT_LCID) {
+ GetLocaleInfoA(lmon->lc.id, LOCALE_IPOSSIGNPOSN, loc_data, 2);
+ return atoi(loc_data);
+ }
+ else {
+ return CHAR_MAX;
+ }
+}
+
+int _Locale_n_cs_precedes(_Locale_monetary_t * lmon) {
+ char loc_data[2];
+ GetLocaleInfoA(lmon->lc.id, LOCALE_INEGSYMPRECEDES, loc_data, 2);
+ if (loc_data[0] == '0') return 0;
+ else if (loc_data[0] == '1') return 1;
+ else return -1;
+}
+
+int _Locale_n_sep_by_space(_Locale_monetary_t * lmon) {
+ char loc_data[2];
+ GetLocaleInfoA(lmon->lc.id, LOCALE_INEGSEPBYSPACE, loc_data, 2);
+ if (loc_data[0] == '0') return 0;
+ else if (loc_data[0] == '1') return 1;
+ else return -1;
+}
+
+int _Locale_n_sign_posn(_Locale_monetary_t * lmon) {
+ char loc_data[2];
+ if (lmon->lc.id != INVARIANT_LCID) {
+ GetLocaleInfoA(lmon->lc.id, LOCALE_INEGSIGNPOSN, loc_data, 2);
+ return atoi(loc_data);
+ }
+ else {
+ return CHAR_MAX;
+ }
+}
+
+/* Time */
+const char * _Locale_full_monthname(_Locale_time_t * ltime, int month) {
+ const char **names = (const char**)ltime->month;
+ return names[month];
+}
+
+const char * _Locale_abbrev_monthname(_Locale_time_t * ltime, int month) {
+ const char **names = (const char**)ltime->abbrev_month;
+ return names[month];
+}
+
+const char * _Locale_full_dayofweek(_Locale_time_t * ltime, int day) {
+ const char **names = (const char**)ltime->dayofweek;
+ return names[day];
+}
+
+const char * _Locale_abbrev_dayofweek(_Locale_time_t * ltime, int day) {
+ const char **names = (const char**)ltime->abbrev_dayofweek;
+ return names[day];
+}
+
+const char* _Locale_d_t_fmt(_Locale_time_t* ltime)
+{ return ltime->date_time_format; }
+
+const char* _Locale_long_d_t_fmt(_Locale_time_t* ltime)
+{ return ltime->long_date_time_format; }
+
+const char* _Locale_d_fmt(_Locale_time_t* ltime)
+{ return ltime->date_format; }
+
+const char* _Locale_long_d_fmt(_Locale_time_t* ltime)
+{ return ltime->long_date_format; }
+
+const char* _Locale_t_fmt(_Locale_time_t* ltime)
+{ return ltime->time_format; }
+
+const char* _Locale_am_str(_Locale_time_t* ltime)
+{ return ltime->am; }
+
+const char* _Locale_pm_str(_Locale_time_t* ltime)
+{ return ltime->pm; }
+
+/* Messages */
+nl_catd_type _Locale_catopen(struct _Locale_messages* lmes, const char* cat_name) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lmes)
+ _STLP_MARK_PARAMETER_AS_UNUSED(cat_name)
+ return -1;
+}
+void _Locale_catclose(struct _Locale_messages* lmes, nl_catd_type cat) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lmes)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&cat)
+}
+const char* _Locale_catgets(struct _Locale_messages* lmes, nl_catd_type cat,
+ int setid, int msgid, const char *dfault) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lmes)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&cat)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&setid)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&msgid)
+ return dfault;
+}
+
+#ifdef __cplusplus
+} /* extern C */
+_STLP_END_NAMESPACE
+#endif
+
+void __FixGrouping(char *grouping) {
+ /* This converts NT version which uses '0' instead of 0, etc ; to ANSI */
+ char *g = grouping;
+ char building_group = 0;
+ char repeat_last = 0;
+ /* Check there is a grouping info otherwise we would add a useless CHAR_MAX */
+ if (*g) {
+ for (; *g; ++g) {
+ if (*g > '0' && *g <= '9') {
+ if (!building_group) {
+ *grouping = *g - '0';
+ building_group = 1;
+ }
+ else {
+ /* Known issue: grouping might roll. */
+ *grouping = *grouping * 10 + *g - '0';
+ }
+ }
+ else if (*g == '0') {
+ if (!building_group) {
+ repeat_last = 1;
+ }
+ else
+ /* Known issue: grouping might roll. */
+ *grouping *= 10;
+ }
+ else if (*g == ';') {
+ /* Stop adding to the current group */
+ building_group = 0;
+ ++grouping;
+ }
+ /* else we ignore the character */
+ }
+
+ if (!repeat_last)
+ *grouping++ = CHAR_MAX;
+ *grouping = 0;
+ }
+}
+
+const char* __ConvertName(const char* lname, LOCALECONV* ConvTable, int TableSize) {
+ int i;
+ int cmp;
+ int low = 0;
+ int high = TableSize - 1;
+
+ /* typical binary search - do until no more to search or match */
+ while (low <= high) {
+ i = (low + high) / 2;
+
+ if ((cmp = lstrcmpiA(lname, (*(ConvTable + i)).name)) == 0)
+ return (*(ConvTable + i)).abbrev;
+ else if (cmp < 0)
+ high = i - 1;
+ else
+ low = i + 1;
+ }
+ return lname;
+}
+
+int __ParseLocaleString(const char* lname,
+ char* lang, char* ctry, char* page) {
+ int param = 0;
+ size_t len;
+ size_t tmpLen;
+
+ if (lname[0] == 0)
+ return 0;
+
+ /* We look for the first country separator '_' */
+ len = strcspn(lname, "_");
+ if (lname[len] == '_') {
+ if (len == 0 || len > MAX_LANG_LEN) return -1; /* empty lang is invalid*/
+ _STLP_STRNCPY(lang, MAX_LANG_LEN + 1, lname, len);
+ lname += len + 1;
+ ++param;
+ }
+
+ /* We look for the last code page separator '.' */
+ len = -1;
+ tmpLen = strcspn(lname, ".");
+ while (lname[tmpLen] == '.') {
+ len = tmpLen; ++tmpLen;
+ tmpLen += strcspn(lname + tmpLen, ".");
+ }
+ if (len != -1) { /* Means that we found a '.' */
+ if (param == 0) {
+ /* We have no lang yet so we have to fill it first, no country */
+ if (len > MAX_LANG_LEN) return -1;
+ if (len == 0) {
+ /* No language nor country, only code page */
+ ++param;
+ }
+ else
+ { _STLP_STRNCPY(lang, MAX_LANG_LEN + 1, lname, len); }
+ ++param;
+ }
+ else {
+ /* We already have a lang so we are now looking for the country: */
+ if (len == 0) return -1; /* We forbid locale name with the "_." motif in it */
+ if (len > MAX_CTRY_LEN) return -1;
+ _STLP_STRNCPY(ctry, MAX_CTRY_LEN + 1, lname, len);
+ }
+ ++param;
+ lname += len + 1;
+ }
+
+ /* We look for ',' for compatibility with POSIX */
+ len = strcspn(lname, ",");
+ switch (param) {
+ case 0:
+ if (len > MAX_LANG_LEN) return -1;
+ _STLP_STRNCPY(lang, MAX_LANG_LEN + 1, lname, len);
+ break;
+ case 1:
+ if (len > MAX_CTRY_LEN) return -1;
+ _STLP_STRNCPY(ctry, MAX_CTRY_LEN + 1, lname, len);
+ break;
+ default:
+ if (len > MAX_CP_LEN) return -1;
+ _STLP_STRNCPY(page, MAX_CP_LEN + 1, lname, len);
+ break;
+ }
+
+ /* ',' POSIX modifier is not used in NT */
+ return 0;
+}
+
+/* Data necessary for find LCID*/
+static CRITICAL_SECTION __criticalSection;
+static int __FindFlag;
+static LCID __FndLCID;
+static const char* __FndLang;
+static const char* __FndCtry;
+
+void _Locale_init()
+{ InitializeCriticalSection(&__criticalSection); }
+
+void _Locale_final()
+{ DeleteCriticalSection(&__criticalSection); }
+
+static LCID LocaleFromHex(const char* locale) {
+ unsigned long result = 0;
+ int digit;
+ while (*locale) {
+ result <<= 4;
+ digit = (*locale >= '0' && *locale <= '9') ? *locale - '0':
+ (*locale >= 'A' && *locale <= 'F') ? (*locale - 'A') + 10
+ : (*locale - 'a') + 10;
+ result += digit;
+ ++locale;
+ }
+ return (LCID)result;
+}
+
+static BOOL CALLBACK EnumLocalesProcA(LPSTR locale) {
+ LCID lcid = LocaleFromHex(locale);
+ int LangFlag = 0, CtryFlag = !__FndCtry;
+ static char Lang[MAX_LANG_LEN], Ctry[MAX_CTRY_LEN];
+
+ GetLocaleInfoA(lcid, LOCALE_SENGLANGUAGE, Lang, MAX_LANG_LEN);
+ if (lstrcmpiA(Lang, __FndLang) != 0) {
+ GetLocaleInfoA(lcid, LOCALE_SABBREVLANGNAME, Lang, MAX_LANG_LEN);
+ if (lstrcmpiA(Lang, __FndLang) != 0) {
+ GetLocaleInfoA(lcid, LOCALE_SISO639LANGNAME, Lang, MAX_LANG_LEN);
+ if (lstrcmpiA(Lang, __FndLang) == 0) LangFlag = 1;
+ }
+ else LangFlag = 1;
+ }
+ else LangFlag = 1;
+
+ if (__FndCtry) {
+ GetLocaleInfoA(lcid, LOCALE_SENGCOUNTRY, Ctry, MAX_CTRY_LEN);
+ if (lstrcmpiA(Ctry, __FndCtry) != 0) {
+ GetLocaleInfoA(lcid, LOCALE_SABBREVCTRYNAME, Ctry, MAX_CTRY_LEN);
+ if (lstrcmpiA(Ctry, __FndCtry) != 0) {
+ GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME, Ctry, MAX_CTRY_LEN);
+ if (lstrcmpiA(Ctry, __FndCtry) == 0) CtryFlag = 1;
+ }
+ else CtryFlag = 1;
+ }
+ else
+ CtryFlag = 1;
+ }
+
+ if (LangFlag && CtryFlag) {
+ __FindFlag = 1;
+ __FndLCID = lcid;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+int __GetLCID(const char* lang, const char* ctry, LCID* lcid) {
+ int ret;
+ EnterCriticalSection(&__criticalSection);
+
+ __FindFlag = 0;
+ __FndLang = lang;
+ __FndCtry = ctry;
+ EnumSystemLocalesA(EnumLocalesProcA, LCID_INSTALLED);
+
+ if (__FindFlag != 0) *lcid = __FndLCID;
+ ret = __FindFlag != 0 ? 0 : -1;
+
+ LeaveCriticalSection(&__criticalSection);
+ return ret;
+}
+
+int __GetLCIDFromName(const char* lname, LCID* lcid, char* cp, _Locale_lcid_t *hint) {
+ char lang[MAX_LANG_LEN + 1], ctry[MAX_CTRY_LEN + 1], page[MAX_CP_LEN + 1];
+ int result = 0;
+ if (lname == NULL || lname[0] == 0) {
+ *lcid = LOCALE_USER_DEFAULT;
+ return 0;
+ }
+
+ memset(lang, 0, MAX_LANG_LEN + 1);
+ memset(ctry, 0, MAX_CTRY_LEN + 1);
+ memset(page, 0, MAX_CP_LEN + 1);
+ if (__ParseLocaleString(lname, lang, ctry, page) == -1) return -1;
+
+ if (hint != 0) {
+ *lcid = hint->id;
+ }
+ else {
+ if (lang[0] == 0 && ctry[0] == 0)
+ *lcid = LOCALE_USER_DEFAULT; /* Only code page given. */
+ else {
+ if (ctry[0] == 0) {
+ result = __GetLCID(__ConvertName(lang, __rg_language, sizeof(__rg_language) / sizeof(LOCALECONV)), NULL, lcid);
+ if (result != 0) {
+ /* Check 'C' special case. Check is done after call to __GetLCID because normal programs do not
+ * generate facet from 'C' name, they use the locale::classic() facets. */
+ if (lang[0] == 'C' && lang[1] == 0) {
+ *lcid = INVARIANT_LCID;
+ result = 0;
+ }
+ }
+ }
+ else {
+ result = __GetLCID(__ConvertName(lang, __rg_language, sizeof(__rg_language) / sizeof(LOCALECONV)),
+ __ConvertName(ctry, __rg_country, sizeof(__rg_country) / sizeof(LOCALECONV)),
+ lcid);
+ if (result != 0) {
+ /* Non NLS mapping might introduce problem with some locales when only one entry is mapped,
+ * the lang or the country (example: chinese locales like 'chinese_taiwan' gives 'CHS_taiwan'
+ * that do not exists in system). This is why we are giving this locale an other chance by
+ * calling __GetLCID without the mapping. */
+ result = __GetLCID(lang, ctry, lcid);
+ }
+ }
+ }
+ }
+
+ if (result == 0) {
+ /* Handling code page */
+ if (lstrcmpiA(page, "ACP") == 0 || page[0] == 0)
+ my_ltoa(__intGetACP(*lcid), cp);
+ else if (lstrcmpiA(page, "OCP") == 0)
+ my_ltoa(__intGetOCP(*lcid), cp);
+ else if (lstrcmpiA(page, "UTF7") == 0)
+ my_ltoa(CP_UTF7, cp);
+ else if (lstrcmpiA(page, "UTF8") == 0)
+ my_ltoa(CP_UTF8, cp);
+ else
+ _STLP_STRNCPY(cp, MAX_CP_LEN + 1, page, 5);
+
+ /* Code page must be an integer value,
+ * 0 returned by __intGetACP and 1 returned by __intGetOCP are invalid
+ * values.
+ */
+ if (cp[1] == 0 && (cp[0] == '0' || cp[1] == '1'))
+ return -1;
+ else if (atoi(cp) == 0)
+ return -1;
+ }
+
+ return result;
+}
+
+char const* __GetLocaleName(LCID lcid, const char* cp, char* buf) {
+ if (lcid == INVARIANT_LCID) {
+ return _C_name;
+ }
+ else {
+ char lang[MAX_LANG_LEN + 1], ctry[MAX_CTRY_LEN + 1];
+ GetLocaleInfoA(lcid, LOCALE_SENGLANGUAGE, lang, MAX_LANG_LEN);
+ GetLocaleInfoA(lcid, LOCALE_SENGCOUNTRY, ctry, MAX_CTRY_LEN);
+ _STLP_STRCPY(buf, _Locale_MAX_SIMPLE_NAME, lang);
+ _STLP_STRCAT(buf, _Locale_MAX_SIMPLE_NAME, "_");
+ _STLP_STRCAT(buf, _Locale_MAX_SIMPLE_NAME, ctry);
+ _STLP_STRCAT(buf, _Locale_MAX_SIMPLE_NAME, ".");
+ _STLP_STRCAT(buf, _Locale_MAX_SIMPLE_NAME, cp);
+ return buf;
+ }
+}
+
+char const* __Extract_locale_name(const char* loc, const char* category, char* buf) {
+ char *expr;
+ size_t len_name;
+
+ if (loc[0] == 'L' && loc[1] == 'C' && loc[2] == '_') {
+ expr = strstr((char*)loc, category);
+ if (expr == NULL) return NULL; /* Category not found. */
+ expr = strchr(expr, '=');
+ if (expr == NULL) return NULL;
+ ++expr;
+ len_name = strcspn(expr, ";");
+ len_name = len_name >= _Locale_MAX_SIMPLE_NAME ? _Locale_MAX_SIMPLE_NAME - 1
+ : len_name;
+ _STLP_STRNCPY(buf, _Locale_MAX_SIMPLE_NAME, expr, len_name); buf[len_name] = 0;
+ return buf;
+ }
+ else {
+ return loc;
+ }
+}
+
+char const* __TranslateToSystem(const char* lname, char* buf, _Locale_lcid_t* hint,
+ int *__err_code) {
+ LCID lcid;
+ char cp[MAX_CP_LEN + 1];
+ if (__GetLCIDFromName(lname, &lcid, cp, hint) != 0)
+ { *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+ return __GetLocaleName(lcid, cp, buf);
+}
+
+void __GetLocaleInfoUsingACP(LCID lcid, const char* cp, LCTYPE lctype, char* buf, int buf_size, wchar_t* wbuf, int wbuf_size) {
+ wchar_t *Buffer;
+ int BufferSize;
+ int icp;
+
+ GetLocaleInfoA(lcid, lctype, buf, buf_size);
+
+ icp = atoi(cp);
+ if (icp != CP_ACP && buf[0] != 0) {
+ BufferSize = MultiByteToWideChar(CP_ACP, 0, buf, -1, NULL, 0);
+ if (BufferSize > wbuf_size)
+ {
+ Buffer = (wchar_t*)malloc(sizeof(wchar_t) * BufferSize);
+ }
+ else
+ {
+ Buffer = wbuf;
+ }
+ MultiByteToWideChar(CP_ACP, 0, buf, -1, Buffer, BufferSize);
+ WideCharToMultiByte(icp, 0, Buffer, -1, buf, buf_size, NULL, NULL);
+ if (Buffer != wbuf)
+ {
+ free(Buffer);
+ }
+ }
+}
+
+/* Return 0 if ANSI code page not used */
+int __intGetACP(LCID lcid) {
+ char cp[6];
+ if (!GetLocaleInfoA(lcid, LOCALE_IDEFAULTANSICODEPAGE, cp, 6)) {
+#if defined (_STLP_LANG_INVARIANT_DEFINED)
+ if (lcid == INVARIANT_LCID) {
+ /* We are using a limited PSDK, we rely on the most common code page */
+ return 1252;
+ }
+#endif
+ return 0;
+ }
+ return atoi(cp);
+}
+
+/* Return 1 if OEM code page not used */
+int __intGetOCP(LCID lcid) {
+ char cp[6];
+ if (!GetLocaleInfoA(lcid, LOCALE_IDEFAULTCODEPAGE, cp, 6))
+ return 0;
+ return atoi(cp);
+}
+
+int __GetDefaultCP(LCID lcid) {
+ int cp = __intGetACP(lcid);
+ if (cp == 0) return __intGetOCP(lcid);
+ else return cp;
+}
+
+static int trim_size_t_to_int(size_t n) { return n < (size_t)INT_MAX ? (int)n : INT_MAX; }
+
+char* __ConvertToCP(int from_cp, int to_cp, const char *from, size_t size, size_t *ret_buf_size) {
+ size_t wbuffer_size, buffer_size, from_offset, wbuf_offset;
+ int from_size, to_size, wbuf_size;
+ wchar_t *wbuffer;
+ char* buffer;
+
+ size_t orig_size = size;
+
+ wbuffer_size = 0;
+ from_offset = 0;
+ while (size > 0) {
+ from_size = trim_size_t_to_int(size);
+ wbuffer_size += MultiByteToWideChar(from_cp, MB_PRECOMPOSED,
+ from + from_offset, from_size, NULL, 0);
+ from_offset += from_size;
+ size -= from_size;
+ }
+
+ wbuffer = (wchar_t*)malloc(sizeof(wchar_t)*wbuffer_size);
+
+ size = orig_size;
+ wbuf_offset = 0;
+ from_offset = 0;
+ while (size > 0) {
+ from_size = trim_size_t_to_int(size);
+ wbuf_size = trim_size_t_to_int(wbuffer_size - wbuf_offset);
+ wbuf_offset += MultiByteToWideChar(from_cp, MB_PRECOMPOSED,
+ from + from_offset, from_size, wbuffer + wbuf_offset, wbuf_size);
+ from_offset += from_size;
+ size -= from_size;
+ }
+
+ buffer_size = 0;
+ wbuf_offset = 0;
+ size = wbuffer_size;
+ while (size > 0) {
+ wbuf_size = trim_size_t_to_int(size);
+ buffer_size += WideCharToMultiByte(to_cp, WC_COMPOSITECHECK | WC_SEPCHARS,
+ wbuffer + wbuf_offset, wbuf_size,
+ NULL, 0, NULL, FALSE);
+ wbuf_offset += wbuf_size;
+ size -= wbuf_size;
+ }
+
+ buffer = (char*)malloc(buffer_size);
+ *ret_buf_size = buffer_size;
+
+ size = wbuffer_size;
+ wbuf_offset = 0;
+ while (size > 0) {
+ wbuf_size = trim_size_t_to_int(size);
+ to_size = trim_size_t_to_int(buffer_size);
+ buffer_size -= WideCharToMultiByte(to_cp, WC_COMPOSITECHECK | WC_SEPCHARS,
+ wbuffer + wbuf_offset, wbuf_size,
+ buffer, to_size, NULL, FALSE);
+ wbuf_offset += wbuf_size;
+ size -= wbuf_size;
+ }
+
+ free(wbuffer);
+ return buffer;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifndef _STLP_NO_WCHAR_T
+# include "c_wlocale_win32.c"
+#endif
diff --git a/src/c_locale_win32/c_wlocale_win32.c b/src/c_locale_win32/c_wlocale_win32.c
new file mode 100644
index 0000000..a12659b
--- /dev/null
+++ b/src/c_locale_win32/c_wlocale_win32.c
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2007 2008
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+# define _STLP_WCSNCPY(D, DS, S, C) wcsncpy_s(D, DS, S, C)
+#else
+# define _STLP_WCSNCPY(D, DS, S, C) wcsncpy(D, S, C)
+#endif
+
+static const wchar_t* __wtrue_name = L"true";
+static const wchar_t* __wfalse_name = L"false";
+
+typedef struct _Locale_codecvt {
+ _Locale_lcid_t lc;
+ UINT cp;
+ unsigned char cleads[256 / CHAR_BIT];
+ unsigned char max_char_size;
+ DWORD mbtowc_flags;
+ DWORD wctomb_flags;
+} _Locale_codecvt_t;
+
+/* Ctype */
+_Locale_mask_t _WLocale_ctype(_Locale_ctype_t* ltype, wint_t c,
+ _Locale_mask_t which_bits) {
+ wchar_t buf[2];
+ WORD out[2];
+ buf[0] = c; buf[1] = 0;
+ GetStringTypeW(CT_CTYPE1, buf, -1, out);
+ _STLP_MARK_PARAMETER_AS_UNUSED(ltype)
+ return (_Locale_mask_t)(MapCtypeMask(out[0]) & which_bits);
+}
+
+wint_t _WLocale_tolower(_Locale_ctype_t* ltype, wint_t c) {
+ wchar_t in_c = c;
+ wchar_t res;
+
+ LCMapStringW(ltype->lc.id, LCMAP_LOWERCASE, &in_c, 1, &res, 1);
+ return res;
+}
+
+wint_t _WLocale_toupper(_Locale_ctype_t* ltype, wint_t c) {
+ wchar_t in_c = c;
+ wchar_t res;
+
+ LCMapStringW(ltype->lc.id, LCMAP_UPPERCASE, &in_c, 1, &res, 1);
+ return res;
+}
+
+_Locale_codecvt_t* _Locale_codecvt_create(const char * name, _Locale_lcid_t* lc_hint, int *__err_code) {
+ char cp_name[MAX_CP_LEN + 1];
+ unsigned char *ptr;
+ CPINFO CPInfo;
+ int i;
+
+ _Locale_codecvt_t *lcodecvt = (_Locale_codecvt_t*)malloc(sizeof(_Locale_codecvt_t));
+
+ if (!lcodecvt) { *__err_code = _STLP_LOC_NO_MEMORY; return lcodecvt; }
+ memset(lcodecvt, 0, sizeof(_Locale_codecvt_t));
+
+ if (__GetLCIDFromName(name, &lcodecvt->lc.id, cp_name, lc_hint) == -1)
+ { free(lcodecvt); *__err_code = _STLP_LOC_UNKNOWN_NAME; return NULL; }
+
+ lcodecvt->cp = atoi(cp_name);
+ if (!GetCPInfo(lcodecvt->cp, &CPInfo)) { free(lcodecvt); return NULL; }
+
+ if (lcodecvt->cp != CP_UTF7 && lcodecvt->cp != CP_UTF8) {
+ lcodecvt->mbtowc_flags = MB_PRECOMPOSED;
+ lcodecvt->wctomb_flags = WC_COMPOSITECHECK | WC_SEPCHARS;
+ }
+ lcodecvt->max_char_size = CPInfo.MaxCharSize;
+
+ if (CPInfo.MaxCharSize > 1) {
+ for (ptr = (unsigned char*)CPInfo.LeadByte; *ptr && *(ptr + 1); ptr += 2)
+ for (i = *ptr; i <= *(ptr + 1); ++i) lcodecvt->cleads[i / CHAR_BIT] |= (0x01 << i % CHAR_BIT);
+ }
+
+ return lcodecvt;
+}
+
+char const* _Locale_codecvt_name(const _Locale_codecvt_t* lcodecvt, char* buf) {
+ char cp_buf[MAX_CP_LEN + 1];
+ my_ltoa(lcodecvt->cp, cp_buf);
+ return __GetLocaleName(lcodecvt->lc.id, cp_buf, buf);
+}
+
+void _Locale_codecvt_destroy(_Locale_codecvt_t* lcodecvt) {
+ if (!lcodecvt) return;
+
+ free(lcodecvt);
+}
+
+int _WLocale_mb_cur_max (_Locale_codecvt_t * lcodecvt)
+{ return lcodecvt->max_char_size; }
+
+int _WLocale_mb_cur_min (_Locale_codecvt_t *lcodecvt) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lcodecvt)
+ return 1;
+}
+
+int _WLocale_is_stateless (_Locale_codecvt_t * lcodecvt)
+{ return (lcodecvt->max_char_size == 1) ? 1 : 0; }
+
+static int __isleadbyte(int i, unsigned char *ctable) {
+ unsigned char c = (unsigned char)i;
+ return (ctable[c / CHAR_BIT] & (0x01 << c % CHAR_BIT));
+}
+
+static int __mbtowc(_Locale_codecvt_t *l, wchar_t *dst, const char *from, unsigned int count) {
+ int result;
+
+ if (l->cp == CP_UTF7 || l->cp == CP_UTF8) {
+ result = MultiByteToWideChar(l->cp, l->mbtowc_flags, from, count, dst, 1);
+ if (result == 0) {
+ switch (GetLastError()) {
+ case ERROR_NO_UNICODE_TRANSLATION:
+ return -2;
+ default:
+ return -1;
+ }
+ }
+ }
+ else {
+ if (count == 1 && __isleadbyte(*from, l->cleads)) return (size_t)-2;
+ result = MultiByteToWideChar(l->cp, l->mbtowc_flags, from, count, dst, 1);
+ if (result == 0) return -1;
+ }
+
+ return result;
+}
+
+size_t _WLocale_mbtowc(_Locale_codecvt_t *lcodecvt, wchar_t *to,
+ const char *from, size_t n, mbstate_t *shift_state) {
+ int result;
+ _STLP_MARK_PARAMETER_AS_UNUSED(shift_state)
+ if (lcodecvt->max_char_size == 1) { /* Single byte encoding. */
+ result = MultiByteToWideChar(lcodecvt->cp, lcodecvt->mbtowc_flags, from, 1, to, 1);
+ if (result == 0) return (size_t)-1;
+ return result;
+ }
+ else { /* Multi byte encoding. */
+ int retval;
+ unsigned int count = 1;
+ while (n--) {
+ retval = __mbtowc(lcodecvt, to, from, count);
+ if (retval == -2)
+ { if (++count > ((unsigned int)lcodecvt->max_char_size)) return (size_t)-1; }
+ else if (retval == -1)
+ { return (size_t)-1; }
+ else
+ { return count; }
+ }
+ return (size_t)-2;
+ }
+}
+
+size_t _WLocale_wctomb(_Locale_codecvt_t *lcodecvt, char *to, size_t n,
+ const wchar_t c, mbstate_t *shift_state) {
+ int size = WideCharToMultiByte(lcodecvt->cp, lcodecvt->wctomb_flags, &c, 1, NULL, 0, NULL, NULL);
+
+ if (!size) return (size_t)-1;
+ if ((size_t)size > n) return (size_t)-2;
+
+ if (n > INT_MAX)
+ /* Limiting the output buf size to INT_MAX seems like reasonable to transform a single wchar_t. */
+ n = INT_MAX;
+
+ WideCharToMultiByte(lcodecvt->cp, lcodecvt->wctomb_flags, &c, 1, to, (int)n, NULL, NULL);
+
+ _STLP_MARK_PARAMETER_AS_UNUSED(shift_state)
+ return (size_t)size;
+}
+
+size_t _WLocale_unshift(_Locale_codecvt_t *lcodecvt, mbstate_t *st,
+ char *buf, size_t n, char **next) {
+ /* _WLocale_wctomb do not even touch to st, there is nothing to unshift in this localization implementation. */
+ _STLP_MARK_PARAMETER_AS_UNUSED(lcodecvt)
+ _STLP_MARK_PARAMETER_AS_UNUSED(st)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&n)
+ *next = buf;
+ return 0;
+}
+
+/* Collate */
+/* This function takes care of the potential size_t DWORD different size. */
+static int _WLocale_strcmp_aux(_Locale_collate_t* lcol,
+ const wchar_t* s1, size_t n1,
+ const wchar_t* s2, size_t n2) {
+ int result = CSTR_EQUAL;
+ while (n1 > 0 || n2 > 0) {
+ DWORD size1 = trim_size_t_to_DWORD(n1);
+ DWORD size2 = trim_size_t_to_DWORD(n2);
+ result = CompareStringW(lcol->lc.id, 0, s1, size1, s2, size2);
+ if (result != CSTR_EQUAL)
+ break;
+ n1 -= size1;
+ n2 -= size2;
+ }
+ return result;
+}
+
+int _WLocale_strcmp(_Locale_collate_t* lcol,
+ const wchar_t* s1, size_t n1,
+ const wchar_t* s2, size_t n2) {
+ int result;
+ result = _WLocale_strcmp_aux(lcol, s1, n1, s2, n2);
+ return (result == CSTR_EQUAL) ? 0 : (result == CSTR_LESS_THAN) ? -1 : 1;
+}
+
+size_t _WLocale_strxfrm(_Locale_collate_t* lcol,
+ wchar_t* dst, size_t dst_size,
+ const wchar_t* src, size_t src_size) {
+ int result, i;
+
+ /* see _Locale_strxfrm: */
+ if (src_size > INT_MAX) {
+ if (dst != 0) {
+ _STLP_WCSNCPY(dst, dst_size, src, src_size);
+ }
+ return src_size;
+ }
+ if (dst_size > INT_MAX) {
+ dst_size = INT_MAX;
+ }
+ result = LCMapStringW(lcol->lc.id, LCMAP_SORTKEY, src, (int)src_size, dst, (int)dst_size);
+ if (result != 0 && dst != 0) {
+ for (i = result - 1; i >= 0; --i) {
+ dst[i] = ((unsigned char*)dst)[i];
+ }
+ }
+ return result != 0 ? result - 1 : 0;
+}
+
+/* Numeric */
+wchar_t _WLocale_decimal_point(_Locale_numeric_t* lnum) {
+ wchar_t buf[4];
+ GetLocaleInfoW(lnum->lc.id, LOCALE_SDECIMAL, buf, 4);
+ return buf[0];
+}
+
+wchar_t _WLocale_thousands_sep(_Locale_numeric_t* lnum) {
+ wchar_t buf[4];
+ GetLocaleInfoW(lnum->lc.id, LOCALE_STHOUSAND, buf, 4);
+ return buf[0];
+}
+
+const wchar_t * _WLocale_true(_Locale_numeric_t* lnum, wchar_t* buf, size_t bufSize) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lnum)
+ _STLP_MARK_PARAMETER_AS_UNUSED(buf)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&bufSize)
+ return __wtrue_name;
+}
+
+const wchar_t * _WLocale_false(_Locale_numeric_t* lnum, wchar_t* buf, size_t bufSize) {
+ _STLP_MARK_PARAMETER_AS_UNUSED(lnum)
+ _STLP_MARK_PARAMETER_AS_UNUSED(buf)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&bufSize)
+ return __wfalse_name;
+}
+
+/* Monetary */
+const wchar_t* _WLocale_int_curr_symbol(_Locale_monetary_t * lmon, wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(lmon->lc.id, LOCALE_SINTLSYMBOL, buf, (int)bufSize); return buf; }
+
+const wchar_t* _WLocale_currency_symbol(_Locale_monetary_t * lmon, wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(lmon->lc.id, LOCALE_SCURRENCY, buf, (int)bufSize); return buf; }
+
+wchar_t _WLocale_mon_decimal_point(_Locale_monetary_t * lmon)
+{ return lmon->decimal_point[0]; }
+
+wchar_t _WLocale_mon_thousands_sep(_Locale_monetary_t * lmon)
+{ return lmon->thousands_sep[0]; }
+
+const wchar_t* _WLocale_positive_sign(_Locale_monetary_t * lmon, wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(lmon->lc.id, LOCALE_SPOSITIVESIGN, buf, (int)bufSize); return buf; }
+
+const wchar_t* _WLocale_negative_sign(_Locale_monetary_t * lmon, wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(lmon->lc.id, LOCALE_SNEGATIVESIGN, buf, (int)bufSize); return buf; }
+
+/* Time */
+const wchar_t * _WLocale_full_monthname(_Locale_time_t * ltime, int month,
+ wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(ltime->lc.id, LOCALE_SMONTHNAME1 + month, buf, (int)bufSize); return buf; }
+
+const wchar_t * _WLocale_abbrev_monthname(_Locale_time_t * ltime, int month,
+ wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(ltime->lc.id, LOCALE_SABBREVMONTHNAME1 + month, buf, (int)bufSize); return buf; }
+
+const wchar_t * _WLocale_full_dayofweek(_Locale_time_t * ltime, int day,
+ wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(ltime->lc.id, LOCALE_SDAYNAME1 + day, buf, (int)bufSize); return buf; }
+
+const wchar_t * _WLocale_abbrev_dayofweek(_Locale_time_t * ltime, int day,
+ wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(ltime->lc.id, LOCALE_SABBREVDAYNAME1 + day, buf, (int)bufSize); return buf; }
+
+const wchar_t* _WLocale_am_str(_Locale_time_t* ltime,
+ wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(ltime->lc.id, LOCALE_S1159, buf, (int)bufSize); return buf; }
+
+const wchar_t* _WLocale_pm_str(_Locale_time_t* ltime,
+ wchar_t* buf, size_t bufSize)
+{ GetLocaleInfoW(ltime->lc.id, LOCALE_S2359, buf, (int)bufSize); return buf; }
diff --git a/src/codecvt.cpp b/src/codecvt.cpp
new file mode 100644
index 0000000..113a262
--- /dev/null
+++ b/src/codecvt.cpp
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <locale>
+#include <algorithm>
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// codecvt<char, char, mbstate_t>
+
+codecvt<char, char, mbstate_t>::~codecvt() {}
+
+int codecvt<char, char, mbstate_t>::do_length(state_type&,
+ const char* from,
+ const char* end,
+ size_t mx) const
+{ return (int)(min) ( __STATIC_CAST(size_t, (end - from)), mx); }
+
+int codecvt<char, char, mbstate_t>::do_max_length() const _STLP_NOTHROW
+{ return 1; }
+
+bool
+codecvt<char, char, mbstate_t>::do_always_noconv() const _STLP_NOTHROW
+{ return true; }
+
+int
+codecvt<char, char, mbstate_t>::do_encoding() const _STLP_NOTHROW
+{ return 1; }
+
+codecvt_base::result
+codecvt<char, char, mbstate_t>::do_unshift(state_type& /* __state */,
+ char* __to,
+ char* /* __to_limit */,
+ char*& __to_next) const
+{ __to_next = __to; return noconv; }
+
+codecvt_base::result
+codecvt<char, char, mbstate_t>::do_in (state_type& /* __state */ ,
+ const char* __from,
+ const char* /* __from_end */,
+ const char*& __from_next,
+ char* __to,
+ char* /* __to_end */,
+ char*& __to_next) const
+{ __from_next = __from; __to_next = __to; return noconv; }
+
+codecvt_base::result
+codecvt<char, char, mbstate_t>::do_out(state_type& /* __state */,
+ const char* __from,
+ const char* /* __from_end */,
+ const char*& __from_next,
+ char* __to,
+ char* /* __to_limit */,
+ char*& __to_next) const
+{ __from_next = __from; __to_next = __to; return noconv; }
+
+
+#if !defined (_STLP_NO_WCHAR_T)
+//----------------------------------------------------------------------
+// codecvt<wchar_t, char, mbstate_t>
+
+codecvt<wchar_t, char, mbstate_t>::~codecvt() {}
+
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt<wchar_t, char, mbstate_t>::do_out(state_type& /* state */,
+ const intern_type* from,
+ const intern_type* from_end,
+ const intern_type*& from_next,
+ extern_type* to,
+ extern_type* to_limit,
+ extern_type*& to_next) const {
+ ptrdiff_t len = (min) (from_end - from, to_limit - to);
+ copy(from, from + len, to);
+ from_next = from + len;
+ to_next = to + len;
+ return ok;
+}
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt<wchar_t, char, mbstate_t>::do_in (state_type& /* state */,
+ const extern_type* from,
+ const extern_type* from_end,
+ const extern_type*& from_next,
+ intern_type* to,
+ intern_type* to_limit,
+ intern_type*& to_next) const {
+ ptrdiff_t len = (min) (from_end - from, to_limit - to);
+ copy(__REINTERPRET_CAST(const unsigned char*, from),
+ __REINTERPRET_CAST(const unsigned char*, from) + len, to);
+ from_next = from + len;
+ to_next = to + len;
+ return ok;
+}
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& /* state */,
+ extern_type* to,
+ extern_type* ,
+ extern_type*& to_next) const {
+ to_next = to;
+ return noconv;
+}
+
+int codecvt<wchar_t, char, mbstate_t>::do_encoding() const _STLP_NOTHROW
+{ return 1; }
+
+bool codecvt<wchar_t, char, mbstate_t>::do_always_noconv() const _STLP_NOTHROW
+{ return true; }
+
+int codecvt<wchar_t, char, mbstate_t>::do_length(state_type&,
+ const extern_type* from,
+ const extern_type* end,
+ size_t mx) const
+{ return (int)(min) ((size_t) (end - from), mx); }
+
+int codecvt<wchar_t, char, mbstate_t>::do_max_length() const _STLP_NOTHROW
+{ return 1; }
+#endif /* wchar_t */
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/src/collate.cpp b/src/collate.cpp
new file mode 100644
index 0000000..ee5540d
--- /dev/null
+++ b/src/collate.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <locale>
+
+_STLP_BEGIN_NAMESPACE
+
+// collate<char>
+
+collate<char>::~collate() {}
+
+int collate<char>::do_compare(const char* low1, const char* high1,
+ const char* low2, const char* high2) const
+{ return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); }
+
+string collate<char>::do_transform(const char* low, const char* high) const
+{ return string(low, high); }
+
+long collate<char>::do_hash(const char* low, const char* high) const {
+ unsigned long result = 0;
+ for ( ; low < high; ++low)
+ result = 5 * result + *low;
+ return result;
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+// collate<wchar_t>
+
+collate<wchar_t>::~collate() {}
+
+int
+collate<wchar_t>::do_compare(const wchar_t* low1, const wchar_t* high1,
+ const wchar_t* low2, const wchar_t* high2) const
+{ return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); }
+
+wstring collate<wchar_t>::do_transform(const wchar_t* low, const wchar_t* high) const
+{ return wstring(low, high); }
+
+long collate<wchar_t>::do_hash(const wchar_t* low, const wchar_t* high) const {
+ unsigned long result = 0;
+ for ( ; low < high; ++low)
+ result = 5 * result + *low;
+ return result;
+}
+#endif
+
+_STLP_END_NAMESPACE
+
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/src/complex.cpp b/src/complex.cpp
new file mode 100644
index 0000000..50f310c
--- /dev/null
+++ b/src/complex.cpp
@@ -0,0 +1,347 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <numeric>
+#include <cmath>
+#include <complex>
+
+#if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB >= 1400)
+// hypot is deprecated.
+# if defined (_STLP_MSVC)
+# pragma warning (disable : 4996)
+# elif defined (__ICL)
+# pragma warning (disable : 1478)
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// Complex division and square roots.
+
+// Absolute value
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC float _STLP_CALL abs(const complex<float>& __z)
+{ return ::hypot(__z._M_re, __z._M_im); }
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC double _STLP_CALL abs(const complex<double>& __z)
+{ return ::hypot(__z._M_re, __z._M_im); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>& __z)
+{ return ::hypot(__z._M_re, __z._M_im); }
+#endif
+
+// Phase
+
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC float _STLP_CALL arg(const complex<float>& __z)
+{ return ::atan2(__z._M_im, __z._M_re); }
+
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC double _STLP_CALL arg(const complex<double>& __z)
+{ return ::atan2(__z._M_im, __z._M_re); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>& __z)
+{ return ::atan2(__z._M_im, __z._M_re); }
+#endif
+
+// Construct a complex number from polar representation
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi)
+{ return complex<float>(__rho * ::cos(__phi), __rho * ::sin(__phi)); }
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi)
+{ return complex<double>(__rho * ::cos(__phi), __rho * ::sin(__phi)); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<long double> _STLP_CALL polar(const long double& __rho, const long double& __phi)
+{ return complex<long double>(__rho * ::cos(__phi), __rho * ::sin(__phi)); }
+#endif
+
+// Division
+template <class _Tp>
+static void _divT(const _Tp& __z1_r, const _Tp& __z1_i,
+ const _Tp& __z2_r, const _Tp& __z2_i,
+ _Tp& __res_r, _Tp& __res_i) {
+ _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
+ _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
+
+ if (__ar <= __ai) {
+ _Tp __ratio = __z2_r / __z2_i;
+ _Tp __denom = __z2_i * (1 + __ratio * __ratio);
+ __res_r = (__z1_r * __ratio + __z1_i) / __denom;
+ __res_i = (__z1_i * __ratio - __z1_r) / __denom;
+ }
+ else {
+ _Tp __ratio = __z2_i / __z2_r;
+ _Tp __denom = __z2_r * (1 + __ratio * __ratio);
+ __res_r = (__z1_r + __z1_i * __ratio) / __denom;
+ __res_i = (__z1_i - __z1_r * __ratio) / __denom;
+ }
+}
+
+template <class _Tp>
+static void _divT(const _Tp& __z1_r,
+ const _Tp& __z2_r, const _Tp& __z2_i,
+ _Tp& __res_r, _Tp& __res_i) {
+ _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
+ _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
+
+ if (__ar <= __ai) {
+ _Tp __ratio = __z2_r / __z2_i;
+ _Tp __denom = __z2_i * (1 + __ratio * __ratio);
+ __res_r = (__z1_r * __ratio) / __denom;
+ __res_i = - __z1_r / __denom;
+ }
+ else {
+ _Tp __ratio = __z2_i / __z2_r;
+ _Tp __denom = __z2_r * (1 + __ratio * __ratio);
+ __res_r = __z1_r / __denom;
+ __res_i = - (__z1_r * __ratio) / __denom;
+ }
+}
+
+void _STLP_CALL
+complex<float>::_div(const float& __z1_r, const float& __z1_i,
+ const float& __z2_r, const float& __z2_i,
+ float& __res_r, float& __res_i)
+{ _divT(__z1_r, __z1_i, __z2_r, __z2_i, __res_r, __res_i); }
+
+void _STLP_CALL
+complex<float>::_div(const float& __z1_r,
+ const float& __z2_r, const float& __z2_i,
+ float& __res_r, float& __res_i)
+{ _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); }
+
+
+void _STLP_CALL
+complex<double>::_div(const double& __z1_r, const double& __z1_i,
+ const double& __z2_r, const double& __z2_i,
+ double& __res_r, double& __res_i)
+{ _divT(__z1_r, __z1_i, __z2_r, __z2_i, __res_r, __res_i); }
+
+void _STLP_CALL
+complex<double>::_div(const double& __z1_r,
+ const double& __z2_r, const double& __z2_i,
+ double& __res_r, double& __res_i)
+{ _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+void _STLP_CALL
+complex<long double>::_div(const long double& __z1_r, const long double& __z1_i,
+ const long double& __z2_r, const long double& __z2_i,
+ long double& __res_r, long double& __res_i)
+{ _divT(__z1_r, __z1_i, __z2_r, __z2_i, __res_r, __res_i); }
+
+void _STLP_CALL
+complex<long double>::_div(const long double& __z1_r,
+ const long double& __z2_r, const long double& __z2_i,
+ long double& __res_r, long double& __res_i)
+{ _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); }
+#endif
+
+//----------------------------------------------------------------------
+// Square root
+template <class _Tp>
+static complex<_Tp> sqrtT(const complex<_Tp>& z) {
+ _Tp re = z._M_re;
+ _Tp im = z._M_im;
+ _Tp mag = ::hypot(re, im);
+ complex<_Tp> result;
+
+ if (mag == 0.f) {
+ result._M_re = result._M_im = 0.f;
+ } else if (re > 0.f) {
+ result._M_re = ::sqrt(0.5f * (mag + re));
+ result._M_im = im/result._M_re/2.f;
+ } else {
+ result._M_im = ::sqrt(0.5f * (mag - re));
+ if (im < 0.f)
+ result._M_im = - result._M_im;
+ result._M_re = im/result._M_im/2.f;
+ }
+ return result;
+}
+
+complex<float> _STLP_CALL
+sqrt(const complex<float>& z) { return sqrtT(z); }
+
+complex<double> _STLP_CALL
+sqrt(const complex<double>& z) { return sqrtT(z); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+complex<long double> _STLP_CALL
+sqrt(const complex<long double>& z) { return sqrtT(z); }
+#endif
+
+// exp, log, pow for complex<float>, complex<double>, and complex<long double>
+//----------------------------------------------------------------------
+// exp
+template <class _Tp>
+static complex<_Tp> expT(const complex<_Tp>& z) {
+ _Tp expx = ::exp(z._M_re);
+ return complex<_Tp>(expx * ::cos(z._M_im),
+ expx * ::sin(z._M_im));
+}
+_STLP_DECLSPEC complex<float> _STLP_CALL exp(const complex<float>& z)
+{ return expT(z); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL exp(const complex<double>& z)
+{ return expT(z); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL exp(const complex<long double>& z)
+{ return expT(z); }
+#endif
+
+//----------------------------------------------------------------------
+// log10
+template <class _Tp>
+static complex<_Tp> log10T(const complex<_Tp>& z, const _Tp& ln10_inv) {
+ complex<_Tp> r;
+
+ r._M_im = ::atan2(z._M_im, z._M_re) * ln10_inv;
+ r._M_re = ::log10(::hypot(z._M_re, z._M_im));
+ return r;
+}
+
+static const float LN10_INVF = 1.f / ::log(10.f);
+_STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>& z)
+{ return log10T(z, LN10_INVF); }
+
+static const double LN10_INV = 1. / ::log10(10.);
+_STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>& z)
+{ return log10T(z, LN10_INV); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+static const long double LN10_INVL = 1.l / ::log(10.l);
+_STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>& z)
+{ return log10T(z, LN10_INVL); }
+#endif
+
+//----------------------------------------------------------------------
+// log
+template <class _Tp>
+static complex<_Tp> logT(const complex<_Tp>& z) {
+ complex<_Tp> r;
+
+ r._M_im = ::atan2(z._M_im, z._M_re);
+ r._M_re = ::log(::hypot(z._M_re, z._M_im));
+ return r;
+}
+_STLP_DECLSPEC complex<float> _STLP_CALL log(const complex<float>& z)
+{ return logT(z); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL log(const complex<double>& z)
+{ return logT(z); }
+
+#ifndef _STLP_NO_LONG_DOUBLE
+_STLP_DECLSPEC complex<long double> _STLP_CALL log(const complex<long double>& z)
+{ return logT(z); }
+# endif
+
+//----------------------------------------------------------------------
+// pow
+template <class _Tp>
+static complex<_Tp> powT(const _Tp& a, const complex<_Tp>& b) {
+ _Tp logr = ::log(a);
+ _Tp x = ::exp(logr * b._M_re);
+ _Tp y = logr * b._M_im;
+
+ return complex<_Tp>(x * ::cos(y), x * ::sin(y));
+}
+
+template <class _Tp>
+static complex<_Tp> powT(const complex<_Tp>& z_in, int n) {
+ complex<_Tp> z = z_in;
+ z = _STLP_PRIV __power(z, (n < 0 ? -n : n), multiplies< complex<_Tp> >());
+ if (n < 0)
+ return _Tp(1.0) / z;
+ else
+ return z;
+}
+
+template <class _Tp>
+static complex<_Tp> powT(const complex<_Tp>& a, const _Tp& b) {
+ _Tp logr = ::log(::hypot(a._M_re,a._M_im));
+ _Tp logi = ::atan2(a._M_im, a._M_re);
+ _Tp x = ::exp(logr * b);
+ _Tp y = logi * b;
+
+ return complex<_Tp>(x * ::cos(y), x * ::sin(y));
+}
+
+template <class _Tp>
+static complex<_Tp> powT(const complex<_Tp>& a, const complex<_Tp>& b) {
+ _Tp logr = ::log(::hypot(a._M_re,a._M_im));
+ _Tp logi = ::atan2(a._M_im, a._M_re);
+ _Tp x = ::exp(logr * b._M_re - logi * b._M_im);
+ _Tp y = logr * b._M_im + logi * b._M_re;
+
+ return complex<_Tp>(x * ::cos(y), x * ::sin(y));
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const float& a, const complex<float>& b)
+{ return powT(a, b); }
+
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>& z_in, int n)
+{ return powT(z_in, n); }
+
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>& a, const float& b)
+{ return powT(a, b); }
+
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>& a, const complex<float>& b)
+{ return powT(a, b); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const double& a, const complex<double>& b)
+{ return powT(a, b); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>& z_in, int n)
+{ return powT(z_in, n); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>& a, const double& b)
+{ return powT(a, b); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>& a, const complex<double>& b)
+{ return powT(a, b); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const long double& a,
+ const complex<long double>& b)
+{ return powT(a, b); }
+
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>& z_in, int n)
+{ return powT(z_in, n); }
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>& a,
+ const long double& b)
+{ return powT(a, b); }
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>& a,
+ const complex<long double>& b)
+{ return powT(a, b); }
+#endif
+
+_STLP_END_NAMESPACE
diff --git a/src/complex_io.cpp b/src/complex_io.cpp
new file mode 100644
index 0000000..4cb6636
--- /dev/null
+++ b/src/complex_io.cpp
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <complex>
+#include <istream>
+
+_STLP_BEGIN_NAMESPACE
+
+// Specializations for narrow characters; lets us avoid the nuisance of
+// widening.
+_STLP_OPERATOR_SPEC
+basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<< (basic_ostream<char, char_traits<char> >& __os, const complex<float>& __z)
+{ return __os << '(' << (double)__z.real() << ',' << (double)__z.imag() << ')'; }
+
+_STLP_OPERATOR_SPEC
+basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<< (basic_ostream<char, char_traits<char> >& __os, const complex<double>& __z)
+{ return __os << '(' << __z.real() << ',' << __z.imag() << ')'; }
+
+#ifndef _STLP_NO_LONG_DOUBLE
+_STLP_OPERATOR_SPEC
+basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<< (basic_ostream<char, char_traits<char> >& __os, const complex<long double>& __z)
+{ return __os << '(' << __z.real() << ',' << __z.imag() << ')'; }
+#endif
+
+// Specialization for narrow characters; lets us avoid widen.
+_STLP_OPERATOR_SPEC
+basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z) {
+ float __re = 0;
+ float __im = 0;
+
+ char __c;
+
+ __is >> __c;
+ if (__c == '(') {
+ __is >> __re >> __c;
+ if (__c == ',')
+ __is >> __im >> __c;
+ if (__c != ')')
+ __is.setstate(ios_base::failbit);
+ }
+ else {
+ __is.putback(__c);
+ __is >> __re;
+ }
+
+ if (__is)
+ __z = complex<float>(__re, __im);
+ return __is;
+}
+
+_STLP_OPERATOR_SPEC
+basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z) {
+ double __re = 0;
+ double __im = 0;
+
+ char __c;
+
+ __is >> __c;
+ if (__c == '(') {
+ __is >> __re >> __c;
+ if (__c == ',')
+ __is >> __im >> __c;
+ if (__c != ')')
+ __is.setstate(ios_base::failbit);
+ }
+ else {
+ __is.putback(__c);
+ __is >> __re;
+ }
+
+ if (__is)
+ __z = complex<double>(__re, __im);
+ return __is;
+}
+
+#ifndef _STLP_NO_LONG_DOUBLE
+_STLP_OPERATOR_SPEC
+basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z) {
+ long double __re = 0;
+ long double __im = 0;
+
+ char __c;
+
+ __is >> __c;
+ if (__c == '(') {
+ __is >> __re >> __c;
+ if (__c == ',')
+ __is >> __im >> __c;
+ if (__c != ')')
+ __is.setstate(ios_base::failbit);
+ }
+ else {
+ __is.putback(__c);
+ __is >> __re;
+ }
+
+ if (__is)
+ __z = complex<long double>(__re, __im);
+ return __is;
+}
+#endif
+
+// Force instantiation of complex I/O functions
+#if !(defined (_STLP_NO_FORCE_INSTANTIATE) || defined (_STLP_NO_WCHAR_T))
+
+_STLP_OPERATOR_SPEC basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
+
+_STLP_OPERATOR_SPEC basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
+
+#ifndef _STLP_NO_LONG_DOUBLE
+_STLP_OPERATOR_SPEC basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
+
+_STLP_OPERATOR_SPEC basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
+#endif
+
+_STLP_OPERATOR_SPEC basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
+
+_STLP_OPERATOR_SPEC basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
+
+#endif /* _STLP_NO_WCHAR_T */
+
+_STLP_END_NAMESPACE
+
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/src/complex_trig.cpp b/src/complex_trig.cpp
new file mode 100644
index 0000000..f566fe9
--- /dev/null
+++ b/src/complex_trig.cpp
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+
+// Trigonometric and hyperbolic functions for complex<float>,
+// complex<double>, and complex<long double>
+#include <complex>
+#include <cfloat>
+#include <cmath>
+
+_STLP_BEGIN_NAMESPACE
+
+
+//----------------------------------------------------------------------
+// helpers
+#if defined (__sgi)
+ static const union { unsigned int i; float f; } float_ulimit = { 0x42b2d4fc };
+ static const float float_limit = float_ulimit.f;
+ static union {
+ struct { unsigned int h; unsigned int l; } w;
+ double d;
+ } double_ulimit = { 0x408633ce, 0x8fb9f87d };
+ static const double double_limit = double_ulimit.d;
+ static union {
+ struct { unsigned int h[2]; unsigned int l[2]; } w;
+ long double ld;
+ } ldouble_ulimit = {0x408633ce, 0x8fb9f87e, 0xbd23b659, 0x4e9bd8b1};
+# if !defined (_STLP_NO_LONG_DOUBLE)
+ static const long double ldouble_limit = ldouble_ulimit.ld;
+# endif
+#else
+# if defined (M_LN2) && defined (FLT_MAX_EXP)
+ static const float float_limit = float(M_LN2 * FLT_MAX_EXP);
+ static const double double_limit = M_LN2 * DBL_MAX_EXP;
+# else
+ static const float float_limit = ::log(FLT_MAX);
+ static const double double_limit = ::log(DBL_MAX);
+# endif
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# if defined (M_LN2l)
+ static const long double ldouble_limit = M_LN2l * LDBL_MAX_EXP;
+# else
+ static const long double ldouble_limit = ::log(LDBL_MAX);
+# endif
+# endif
+#endif
+
+
+//----------------------------------------------------------------------
+// sin
+template <class _Tp>
+static complex<_Tp> sinT(const complex<_Tp>& z) {
+ return complex<_Tp>(::sin(z._M_re) * ::cosh(z._M_im),
+ ::cos(z._M_re) * ::sinh(z._M_im));
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sin(const complex<float>& z)
+{ return sinT(z); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sin(const complex<double>& z)
+{ return sinT(z); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL sin(const complex<long double>& z)
+{ return sinT(z); }
+#endif
+
+//----------------------------------------------------------------------
+// cos
+template <class _Tp>
+static complex<_Tp> cosT(const complex<_Tp>& z) {
+ return complex<_Tp>(::cos(z._M_re) * ::cosh(z._M_im),
+ -::sin(z._M_re) * ::sinh(z._M_im));
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL cos(const complex<float>& z)
+{ return cosT(z); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL cos(const complex<double>& z)
+{ return cosT(z); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL cos(const complex<long double>& z)
+{ return cosT(z); }
+#endif
+
+//----------------------------------------------------------------------
+// tan
+template <class _Tp>
+static complex<_Tp> tanT(const complex<_Tp>& z, const _Tp& Tp_limit) {
+ _Tp re2 = 2.f * z._M_re;
+ _Tp im2 = 2.f * z._M_im;
+
+ if (::abs(im2) > Tp_limit)
+ return complex<_Tp>(0.f, (im2 > 0 ? 1.f : -1.f));
+ else {
+ _Tp den = ::cos(re2) + ::cosh(im2);
+ return complex<_Tp>(::sin(re2) / den, ::sinh(im2) / den);
+ }
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL tan(const complex<float>& z)
+{ return tanT(z, float_limit); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL tan(const complex<double>& z)
+{ return tanT(z, double_limit); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL tan(const complex<long double>& z)
+{ return tanT(z, ldouble_limit); }
+#endif
+
+//----------------------------------------------------------------------
+// sinh
+template <class _Tp>
+static complex<_Tp> sinhT(const complex<_Tp>& z) {
+ return complex<_Tp>(::sinh(z._M_re) * ::cos(z._M_im),
+ ::cosh(z._M_re) * ::sin(z._M_im));
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sinh(const complex<float>& z)
+{ return sinhT(z); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sinh(const complex<double>& z)
+{ return sinhT(z); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL sinh(const complex<long double>& z)
+{ return sinhT(z); }
+#endif
+
+//----------------------------------------------------------------------
+// cosh
+template <class _Tp>
+static complex<_Tp> coshT(const complex<_Tp>& z) {
+ return complex<_Tp>(::cosh(z._M_re) * ::cos(z._M_im),
+ ::sinh(z._M_re) * ::sin(z._M_im));
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL cosh(const complex<float>& z)
+{ return coshT(z); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL cosh(const complex<double>& z)
+{ return coshT(z); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL cosh(const complex<long double>& z)
+{ return coshT(z); }
+#endif
+
+//----------------------------------------------------------------------
+// tanh
+template <class _Tp>
+static complex<_Tp> tanhT(const complex<_Tp>& z, const _Tp& Tp_limit) {
+ _Tp re2 = 2.f * z._M_re;
+ _Tp im2 = 2.f * z._M_im;
+ if (::abs(re2) > Tp_limit)
+ return complex<_Tp>((re2 > 0 ? 1.f : -1.f), 0.f);
+ else {
+ _Tp den = ::cosh(re2) + ::cos(im2);
+ return complex<_Tp>(::sinh(re2) / den, ::sin(im2) / den);
+ }
+}
+
+_STLP_DECLSPEC complex<float> _STLP_CALL tanh(const complex<float>& z)
+{ return tanhT(z, float_limit); }
+
+_STLP_DECLSPEC complex<double> _STLP_CALL tanh(const complex<double>& z)
+{ return tanhT(z, double_limit); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL tanh(const complex<long double>& z)
+{ return tanhT(z, ldouble_limit); }
+#endif
+
+_STLP_END_NAMESPACE
diff --git a/src/ctype.cpp b/src/ctype.cpp
new file mode 100644
index 0000000..b1e84b1
--- /dev/null
+++ b/src/ctype.cpp
@@ -0,0 +1,486 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <algorithm>
+#include <locale>
+#include <functional>
+
+#include "c_locale.h"
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// ctype<char>
+
+// The classic table: static data members.
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+//*TY 02/25/2000 - added workaround for MPW compilers; they confuse on in-class static const
+const size_t ctype<char>::table_size;
+#endif
+
+// This macro is specifically for platforms where isprint() relies
+// on separate flag
+
+const ctype_base::mask*
+ctype<char>::classic_table() _STLP_NOTHROW {
+ /* Ctype table for the ASCII character set. */
+ static const ctype_base::mask _S_classic_table[table_size] = {
+ cntrl /* null */,
+ cntrl /* ^A */,
+ cntrl /* ^B */,
+ cntrl /* ^C */,
+ cntrl /* ^D */,
+ cntrl /* ^E */,
+ cntrl /* ^F */,
+ cntrl /* ^G */,
+ cntrl /* ^H */,
+ ctype_base::mask(space | cntrl) /* tab */,
+ ctype_base::mask(space | cntrl) /* LF */,
+ ctype_base::mask(space | cntrl) /* ^K */,
+ ctype_base::mask(space | cntrl) /* FF */,
+ ctype_base::mask(space | cntrl) /* ^M */,
+ cntrl /* ^N */,
+ cntrl /* ^O */,
+ cntrl /* ^P */,
+ cntrl /* ^Q */,
+ cntrl /* ^R */,
+ cntrl /* ^S */,
+ cntrl /* ^T */,
+ cntrl /* ^U */,
+ cntrl /* ^V */,
+ cntrl /* ^W */,
+ cntrl /* ^X */,
+ cntrl /* ^Y */,
+ cntrl /* ^Z */,
+ cntrl /* esc */,
+ cntrl /* ^\ */,
+ cntrl /* ^] */,
+ cntrl /* ^^ */,
+ cntrl /* ^_ */,
+ ctype_base::mask(space | print) /* */,
+ ctype_base::mask(punct | print) /* ! */,
+ ctype_base::mask(punct | print) /* " */,
+ ctype_base::mask(punct | print) /* # */,
+ ctype_base::mask(punct | print) /* $ */,
+ ctype_base::mask(punct | print) /* % */,
+ ctype_base::mask(punct | print) /* & */,
+ ctype_base::mask(punct | print) /* ' */,
+ ctype_base::mask(punct | print) /* ( */,
+ ctype_base::mask(punct | print) /* ) */,
+ ctype_base::mask(punct | print) /* * */,
+ ctype_base::mask(punct | print) /* + */,
+ ctype_base::mask(punct | print) /* , */,
+ ctype_base::mask(punct | print) /* - */,
+ ctype_base::mask(punct | print) /* . */,
+ ctype_base::mask(punct | print) /* / */,
+ ctype_base::mask(digit | print | xdigit) /* 0 */,
+ ctype_base::mask(digit | print | xdigit) /* 1 */,
+ ctype_base::mask(digit | print | xdigit) /* 2 */,
+ ctype_base::mask(digit | print | xdigit) /* 3 */,
+ ctype_base::mask(digit | print | xdigit) /* 4 */,
+ ctype_base::mask(digit | print | xdigit) /* 5 */,
+ ctype_base::mask(digit | print | xdigit) /* 6 */,
+ ctype_base::mask(digit | print | xdigit) /* 7 */,
+ ctype_base::mask(digit | print | xdigit) /* 8 */,
+ ctype_base::mask(digit | print | xdigit) /* 9 */,
+ ctype_base::mask(punct | print) /* : */,
+ ctype_base::mask(punct | print) /* ; */,
+ ctype_base::mask(punct | print) /* < */,
+ ctype_base::mask(punct | print) /* = */,
+ ctype_base::mask(punct | print) /* > */,
+ ctype_base::mask(punct | print) /* ? */,
+ ctype_base::mask(punct | print) /* ! */,
+ ctype_base::mask(alpha | print | upper | xdigit) /* A */,
+ ctype_base::mask(alpha | print | upper | xdigit) /* B */,
+ ctype_base::mask(alpha | print | upper | xdigit) /* C */,
+ ctype_base::mask(alpha | print | upper | xdigit) /* D */,
+ ctype_base::mask(alpha | print | upper | xdigit) /* E */,
+ ctype_base::mask(alpha | print | upper | xdigit) /* F */,
+ ctype_base::mask(alpha | print | upper) /* G */,
+ ctype_base::mask(alpha | print | upper) /* H */,
+ ctype_base::mask(alpha | print | upper) /* I */,
+ ctype_base::mask(alpha | print | upper) /* J */,
+ ctype_base::mask(alpha | print | upper) /* K */,
+ ctype_base::mask(alpha | print | upper) /* L */,
+ ctype_base::mask(alpha | print | upper) /* M */,
+ ctype_base::mask(alpha | print | upper) /* N */,
+ ctype_base::mask(alpha | print | upper) /* O */,
+ ctype_base::mask(alpha | print | upper) /* P */,
+ ctype_base::mask(alpha | print | upper) /* Q */,
+ ctype_base::mask(alpha | print | upper) /* R */,
+ ctype_base::mask(alpha | print | upper) /* S */,
+ ctype_base::mask(alpha | print | upper) /* T */,
+ ctype_base::mask(alpha | print | upper) /* U */,
+ ctype_base::mask(alpha | print | upper) /* V */,
+ ctype_base::mask(alpha | print | upper) /* W */,
+ ctype_base::mask(alpha | print | upper) /* X */,
+ ctype_base::mask(alpha | print | upper) /* Y */,
+ ctype_base::mask(alpha | print | upper) /* Z */,
+ ctype_base::mask(punct | print) /* [ */,
+ ctype_base::mask(punct | print) /* \ */,
+ ctype_base::mask(punct | print) /* ] */,
+ ctype_base::mask(punct | print) /* ^ */,
+ ctype_base::mask(punct | print) /* _ */,
+ ctype_base::mask(punct | print) /* ` */,
+ ctype_base::mask(alpha | print | lower | xdigit) /* a */,
+ ctype_base::mask(alpha | print | lower | xdigit) /* b */,
+ ctype_base::mask(alpha | print | lower | xdigit) /* c */,
+ ctype_base::mask(alpha | print | lower | xdigit) /* d */,
+ ctype_base::mask(alpha | print | lower | xdigit) /* e */,
+ ctype_base::mask(alpha | print | lower | xdigit) /* f */,
+ ctype_base::mask(alpha | print | lower) /* g */,
+ ctype_base::mask(alpha | print | lower) /* h */,
+ ctype_base::mask(alpha | print | lower) /* i */,
+ ctype_base::mask(alpha | print | lower) /* j */,
+ ctype_base::mask(alpha | print | lower) /* k */,
+ ctype_base::mask(alpha | print | lower) /* l */,
+ ctype_base::mask(alpha | print | lower) /* m */,
+ ctype_base::mask(alpha | print | lower) /* n */,
+ ctype_base::mask(alpha | print | lower) /* o */,
+ ctype_base::mask(alpha | print | lower) /* p */,
+ ctype_base::mask(alpha | print | lower) /* q */,
+ ctype_base::mask(alpha | print | lower) /* r */,
+ ctype_base::mask(alpha | print | lower) /* s */,
+ ctype_base::mask(alpha | print | lower) /* t */,
+ ctype_base::mask(alpha | print | lower) /* u */,
+ ctype_base::mask(alpha | print | lower) /* v */,
+ ctype_base::mask(alpha | print | lower) /* w */,
+ ctype_base::mask(alpha | print | lower) /* x */,
+ ctype_base::mask(alpha | print | lower) /* y */,
+ ctype_base::mask(alpha | print | lower) /* z */,
+ ctype_base::mask(punct | print) /* { */,
+ ctype_base::mask(punct | print) /* | */,
+ ctype_base::mask(punct | print) /* } */,
+ ctype_base::mask(punct | print) /* ~ */,
+ cntrl /* del (0x7f)*/,
+ /* ASCII is a 7-bit code, so everything else is non-ASCII */
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0),
+ ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0)
+ };
+ return _S_classic_table;
+}
+
+// For every c in the range 0 <= c < 256, _S_upper[c] is the
+// uppercased version of c and _S_lower[c] is the lowercased
+// version. As before, these two tables assume the ASCII character
+// set.
+
+const unsigned char _S_upper[ctype<char>::table_size] =
+{
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
+};
+
+const unsigned char _S_lower[ctype<char>::table_size] =
+{
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
+};
+
+//An helper struct to check wchar_t index without generating warnings
+//under some compilers (gcc) because of a limited range of value
+//(when wchar_t is unsigned)
+template <bool _IsSigned>
+struct _WCharIndexT;
+
+#if !(defined (__BORLANDC__) && !defined(__linux__)) && \
+ !(defined (__GNUC__) && (defined (__MINGW32__) || defined (__CYGWIN__))) && \
+ !defined (__ICL)
+_STLP_TEMPLATE_NULL
+struct _WCharIndexT<true> {
+ static bool in_range(wchar_t c, size_t upperBound) {
+ return c >= 0 && size_t(c) < upperBound;
+ }
+};
+#endif
+
+_STLP_TEMPLATE_NULL
+struct _WCharIndexT<false> {
+ static bool in_range(wchar_t c, size_t upperBound) {
+ return size_t(c) < upperBound;
+ }
+};
+
+typedef _WCharIndexT<wchar_t(-1) < 0> _WCharIndex;
+
+// Some helper functions used in ctype<>::scan_is and scan_is_not.
+
+struct _Ctype_is_mask : public unary_function<char, bool> {
+ ctype_base::mask _Mask;
+ const ctype_base::mask* _M_table;
+
+ _Ctype_is_mask(ctype_base::mask __m, const ctype_base::mask* __t) : _Mask(__m), _M_table(__t) {}
+ bool operator()(char __c) const { return (_M_table[(unsigned char) __c] & _Mask) != 0; }
+};
+
+struct _Ctype_not_mask : public unary_function<char, bool> {
+ ctype_base::mask _Mask;
+ const ctype_base::mask* _M_table;
+
+ _Ctype_not_mask(ctype_base::mask __m, const ctype_base::mask* __t) : _Mask(__m), _M_table(__t) {}
+ bool operator()(char __c) const { return (_M_table[(unsigned char) __c] & _Mask) == 0; }
+};
+
+ctype<char>::ctype(const ctype_base::mask * __tab, bool __del, size_t __refs) :
+ locale::facet(__refs),
+ _M_ctype_table(__tab ? __tab : classic_table()),
+ _M_delete(__tab && __del)
+{}
+
+ctype<char>::~ctype() {
+ if (_M_delete)
+ delete[] __CONST_CAST(ctype_base::mask *, _M_ctype_table);
+}
+
+const char*
+#if defined (__DMC__)
+_STLP_DECLSPEC
+#endif
+ctype<char>::scan_is(ctype_base::mask __m, const char* __low, const char* __high) const
+{ return _STLP_STD::find_if(__low, __high, _Ctype_is_mask(__m, _M_ctype_table)); }
+
+const char*
+#if defined (__DMC__)
+_STLP_DECLSPEC
+#endif
+ctype<char>::scan_not(ctype_base::mask __m, const char* __low, const char* __high) const
+{ return _STLP_STD::find_if(__low, __high, _Ctype_not_mask(__m, _M_ctype_table)); }
+
+char ctype<char>::do_toupper(char __c) const
+{ return (char) _S_upper[(unsigned char) __c]; }
+char ctype<char>::do_tolower(char __c) const
+{ return (char) _S_lower[(unsigned char) __c]; }
+
+const char* ctype<char>::do_toupper(char* __low, const char* __high) const {
+ for ( ; __low < __high; ++__low)
+ *__low = (char) _S_upper[(unsigned char) *__low];
+ return __high;
+}
+const char* ctype<char>::do_tolower(char* __low, const char* __high) const {
+ for ( ; __low < __high; ++__low)
+ *__low = (char) _S_lower[(unsigned char) *__low];
+ return __high;
+}
+
+char
+ctype<char>::do_widen(char __c) const { return __c; }
+
+const char*
+ctype<char>::do_widen(const char* __low, const char* __high,
+ char* __to) const {
+ _STLP_PRIV __copy_trivial(__low, __high, __to);
+ return __high;
+}
+char
+ctype<char>::do_narrow(char __c, char /* dfault */ ) const { return __c; }
+const char*
+ctype<char>::do_narrow(const char* __low, const char* __high,
+ char /* dfault */, char* __to) const {
+ _STLP_PRIV __copy_trivial(__low, __high, __to);
+ return __high;
+}
+
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+struct _Ctype_w_is_mask : public unary_function<wchar_t, bool> {
+ ctype_base::mask M;
+ const ctype_base::mask* table;
+
+ _Ctype_w_is_mask(ctype_base::mask m, const ctype_base::mask* t)
+ : M(m), table(t) {}
+ bool operator()(wchar_t c) const
+ { return _WCharIndex::in_range(c, ctype<char>::table_size) && (table[c] & M); }
+};
+
+//----------------------------------------------------------------------
+// ctype<wchar_t>
+
+ctype<wchar_t>::~ctype() {}
+
+
+bool ctype<wchar_t>::do_is(ctype_base::mask m, wchar_t c) const {
+ const ctype_base::mask * table = ctype<char>::classic_table();
+ return _WCharIndex::in_range(c, ctype<char>::table_size) && (m & table[c]);
+}
+
+const wchar_t* ctype<wchar_t>::do_is(const wchar_t* low, const wchar_t* high,
+ ctype_base::mask * vec) const {
+ // boris : not clear if this is the right thing to do...
+ const ctype_base::mask * table = ctype<char>::classic_table();
+ wchar_t c;
+ for ( ; low < high; ++low, ++vec) {
+ c = *low;
+ *vec = _WCharIndex::in_range(c, ctype<char>::table_size) ? table[c] : ctype_base::mask(0);
+ }
+ return high;
+}
+
+const wchar_t*
+ctype<wchar_t>::do_scan_is(ctype_base::mask m,
+ const wchar_t* low, const wchar_t* high) const {
+ return find_if(low, high, _Ctype_w_is_mask(m, ctype<char>::classic_table()));
+}
+
+
+const wchar_t*
+ctype<wchar_t>::do_scan_not(ctype_base::mask m,
+ const wchar_t* low, const wchar_t* high) const {
+ return find_if(low, high, not1(_Ctype_w_is_mask(m, ctype<char>::classic_table())));
+}
+
+wchar_t ctype<wchar_t>::do_toupper(wchar_t c) const {
+ return _WCharIndex::in_range(c, ctype<char>::table_size) ? (wchar_t)_S_upper[c]
+ : c;
+}
+
+const wchar_t*
+ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const {
+ for ( ; low < high; ++low) {
+ wchar_t c = *low;
+ *low = _WCharIndex::in_range(c, ctype<char>::table_size) ? (wchar_t)_S_upper[c]
+ : c;
+ }
+ return high;
+}
+
+wchar_t ctype<wchar_t>::do_tolower(wchar_t c) const {
+ return _WCharIndex::in_range(c, ctype<char>::table_size) ? (wchar_t)_S_lower[c]
+ : c;
+}
+
+const wchar_t*
+ctype<wchar_t>::do_tolower(wchar_t* low, const wchar_t* high) const {
+ for ( ; low < high; ++low) {
+ wchar_t c = *low;
+ *low = _WCharIndex::in_range(c, ctype<char>::table_size) ? (wchar_t)_S_lower[c]
+ : c;
+ }
+ return high;
+}
+
+wchar_t ctype<wchar_t>::do_widen(char c) const {
+ return (wchar_t)(unsigned char)c;
+}
+
+const char*
+ctype<wchar_t>::do_widen(const char* low, const char* high,
+ wchar_t* dest) const {
+ while (low != high)
+ *dest++ = (wchar_t)(unsigned char)*low++;
+ return high;
+}
+
+char ctype<wchar_t>::do_narrow(wchar_t c, char dfault) const
+{ return (unsigned char)c == c ? (char)c : dfault; }
+
+const wchar_t* ctype<wchar_t>::do_narrow(const wchar_t* low,
+ const wchar_t* high,
+ char dfault, char* dest) const {
+ while (low != high) {
+ wchar_t c = *low++;
+ *dest++ = (unsigned char)c == c ? (char)c : dfault;
+ }
+
+ return high;
+}
+
+# endif
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/src/cxa.c b/src/cxa.c
new file mode 100644
index 0000000..998170e
--- /dev/null
+++ b/src/cxa.c
@@ -0,0 +1,198 @@
+#include "stlport_prefix.h"
+
+#if defined(__unix) && defined(__GNUC__)
+
+#ifdef __FreeBSD__
+# include <osreldate.h>
+#endif
+
+#if (defined(__FreeBSD__) && (__FreeBSD_version < 503001)) || defined(__sun) || defined (__hpux)
+/* Note: __cxa_finalize and __cxa_atexit present in libc in FreeBSD 5.3 */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <pthread.h>
+
+/* __asm__ (".symver " "__cxa_finalize" "," "__cxa_finalize" "@" "STLPORT_5_0_0"); */
+/* __asm__ (".symver " "__cxa_finalize" "," "__cxa_finalize" "@@" "STLPORT_5_0_0"); */
+
+/* Not atomic! */
+/* But we can use static mutexes here: I hope that performance issue isn't very
+ significant on unloading (for only few calls, ~10) - ptr */
+
+/*
+#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+ ({ __typeof (mem) __gmemp = (mem); \
+ __typeof (*mem) __gnewval = (newval); \
+ \
+ *__gmemp == (oldval) ? (*__gmemp = __gnewval, 0) : 1; })
+*/
+
+enum {
+ ef_free, /* `ef_free' MUST be zero! */
+ ef_us,
+ ef_on,
+ ef_at,
+ ef_cxa
+};
+
+struct exit_function
+{
+ /* `flavour' should be of type of the `enum' above but since we need
+ this element in an atomic operation we have to use `long int'. */
+ long int flavor;
+ union {
+ void (*at)(void);
+ struct {
+ void (*fn)(int status, void *arg);
+ void *arg;
+ } on;
+ struct {
+ void (*fn)(void *arg, int status);
+ void *arg;
+ void *dso_handle;
+ } cxa;
+ } func;
+};
+
+struct exit_function_list
+{
+ struct exit_function_list *next;
+ size_t idx;
+ struct exit_function fns[32];
+};
+
+struct exit_function *__new_exitfn (void);
+
+/* Register a function to be called by exit or when a shared library
+ is unloaded. This function is only called from code generated by
+ the C++ compiler. */
+int __cxa_atexit(void (*func)(void *), void *arg, void *d)
+{
+ struct exit_function *new = __new_exitfn ();
+
+ if ( new == NULL )
+ return -1;
+
+ new->flavor = ef_cxa;
+ new->func.cxa.fn = (void (*) (void *, int)) func;
+ new->func.cxa.arg = arg;
+ new->func.cxa.dso_handle = d;
+ return 0;
+}
+
+
+/* We change global data, so we need locking. */
+#ifdef __linux__
+static pthread_mutex_t lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+#endif
+/* #ifdef __FreeBSD__ */
+#if 0
+static pthread_mutex_t lock =
+ { PTHREAD_MUTEX_RECURSIVE /* PTHREAD_MUTEX_DEFAULT */, PTHREAD_PRIO_NONE, {NULL,NULL},
+ NULL, { NULL }, /* MUTEX_FLAGS_PRIVATE */ 0x1, 0, 0, 0, {NULL, NULL},
+ { 0, 0, 0, 0 } };
+#endif
+#ifdef __sun
+static pthread_mutex_t lock =
+ {{0, 0, 0, PTHREAD_MUTEX_RECURSIVE, _MUTEX_MAGIC}, {{{0}}}, 0};
+#endif
+#ifdef __hpux
+static pthread_mutex_t lock = PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP;
+# ifdef __ia64
+void *__dso_handle = (void *) &__dso_handle;
+# endif
+#endif
+
+
+static struct exit_function_list initial;
+struct exit_function_list *__exit_funcs = &initial;
+
+struct exit_function *__new_exitfn(void)
+{
+ struct exit_function_list *l;
+ size_t i = 0;
+
+#ifndef __FreeBSD__
+ pthread_mutex_lock( &lock );
+#endif
+
+ for (l = __exit_funcs; l != NULL; l = l->next) {
+ for (i = 0; i < l->idx; ++i)
+ if (l->fns[i].flavor == ef_free)
+ break;
+ if ( i < l->idx )
+ break;
+
+ if (l->idx < sizeof (l->fns) / sizeof (l->fns[0])) {
+ i = l->idx++;
+ break;
+ }
+ }
+
+ if (l == NULL) {
+ l = (struct exit_function_list *)malloc( sizeof(struct exit_function_list) );
+ if (l != NULL) {
+ l->next = __exit_funcs;
+ __exit_funcs = l;
+
+ l->idx = 1;
+ i = 0;
+ }
+ }
+
+ /* Mark entry as used, but we don't know the flavor now. */
+ if ( l != NULL )
+ l->fns[i].flavor = ef_us;
+
+#ifndef __FreeBSD__
+ pthread_mutex_unlock( &lock );
+#endif
+
+ return l == NULL ? NULL : &l->fns[i];
+}
+
+/* If D is non-NULL, call all functions registered with `__cxa_atexit'
+ with the same dso handle. Otherwise, if D is NULL, call all of the
+ registered handlers. */
+
+/*
+ * Note, that original __cxa_finalize don't use lock, but use __exit_funcs
+ * i.e. global data.
+ */
+void __cxa_finalize(void *d)
+{
+ struct exit_function_list *funcs;
+
+#ifndef __FreeBSD__
+ pthread_mutex_lock( &lock );
+#endif
+
+ for (funcs = __exit_funcs; funcs; funcs = funcs->next) {
+ struct exit_function *f;
+
+ for (f = &funcs->fns[funcs->idx - 1]; f >= &funcs->fns[0]; --f) {
+ if ( (d == NULL || d == f->func.cxa.dso_handle) && (f->flavor == ef_cxa) ) {
+ f->flavor = ef_free;
+ (*f->func.cxa.fn) (f->func.cxa.arg, 0);
+ }
+ }
+ }
+
+ /* Remove the registered fork handlers. We do not have to
+ unregister anything if the program is going to terminate anyway. */
+#ifdef UNREGISTER_ATFORK
+ if (d != NULL)
+ UNREGISTER_ATFORK (d);
+#endif
+#ifndef __FreeBSD__
+ pthread_mutex_unlock( &lock );
+#endif
+}
+
+/* __asm__ (".symver " "__cxa_finalize" "," "__cxa_finalize" "@@" "STLPORT_5_0_0"); */
+/* void __cxa_finalize(void *d) __attribute__ ((weak)); */
+
+#endif /* OS name */
+#endif /* __unix */
+
diff --git a/src/details/fstream_stdio.cpp b/src/details/fstream_stdio.cpp
new file mode 100644
index 0000000..8392ffd
--- /dev/null
+++ b/src/details/fstream_stdio.cpp
@@ -0,0 +1,387 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if defined (__SUNPPRO_CC) && !defined (_STLP_NO_NEW_C_HEADERS)
+# include <time.h>
+// For sunpro, it chokes if time.h is included through stat.h
+#endif
+
+#include <fstream>
+
+#ifdef __CYGWIN__
+# define __int64 long long
+#endif
+
+#include <cstdio>
+#if !defined(__ISCPP__)
+extern "C" {
+# include <sys/stat.h>
+}
+#endif
+
+#if defined( __MSL__ )
+# include <unix.h>
+#endif
+
+#if defined(__ISCPP__)
+# include <c_locale_is/filestat.h>
+#endif
+
+#if defined(__BEOS__) && defined(__INTEL__)
+# include <fcntl.h>
+# include <sys/stat.h> // For _fstat
+#endif
+
+#if defined (_STLP_MSVC) || defined (__MINGW32__)
+# include <fcntl.h>
+# define S_IREAD _S_IREAD
+# define S_IWRITE _S_IWRITE
+# define S_IFREG _S_IFREG
+ // map permission masks
+# ifndef S_IRUSR
+# define S_IRUSR _S_IREAD
+# define S_IWUSR _S_IWRITE
+# endif
+# ifndef S_IRGRP
+# define S_IRGRP _S_IREAD
+# define S_IWGRP _S_IWRITE
+# endif
+# ifndef S_IROTH
+# define S_IROTH _S_IREAD
+# define S_IWOTH _S_IWRITE
+# endif
+
+# ifndef O_RDONLY
+# define O_RDONLY _O_RDONLY
+# define O_WRONLY _O_WRONLY
+# define O_RDWR _O_RDWR
+# define O_APPEND _O_APPEND
+# define O_CREAT _O_CREAT
+# define O_TRUNC _O_TRUNC
+# define O_TEXT _O_TEXT
+# define O_BINARY _O_BINARY
+# endif
+
+# ifndef O_ACCMODE
+# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+# endif
+#endif
+
+const _STLP_fd INVALID_STLP_FD = -1;
+
+
+# ifdef __MSL__
+# define _O_TEXT 0x0
+# if !defined( O_TEXT )
+# define O_TEXT _O_TEXT
+# endif
+# define _S_IFREG S_IFREG
+# define S_IREAD S_IRUSR
+# define S_IWRITE S_IWUSR
+# define S_IEXEC S_IXUSR
+# define _S_IWRITE S_IWRITE
+# define _S_IREAD S_IREAD
+# define _open open
+# define _close close
+# define _read read
+# define _write write
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+// Compare with streamoff definition in stl/char_traits.h!
+
+#if defined (_STLP_USE_DEFAULT_FILE_OFFSET) || \
+ (!defined(_LARGEFILE_SOURCE) && !defined(_LARGEFILE64_SOURCE))
+# define FOPEN fopen
+# define FSEEK fseek
+# define FSTAT fstat
+# define STAT stat
+# define FTELL ftell
+#else
+# define FOPEN fopen64
+# define FSEEK fseeko64
+# define FSTAT fstat64
+# define STAT stat64
+# define FTELL ftello64
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Helper functions for _Filebuf_base.
+
+static bool __is_regular_file(_STLP_fd fd) {
+ struct STAT buf;
+ return FSTAT(fd, &buf) == 0 && (buf.st_mode & S_IFREG) != 0 ;
+}
+
+// Number of characters in the file.
+static streamoff __file_size(_STLP_fd fd) {
+ streamoff ret = 0;
+
+ struct STAT buf;
+ if (FSTAT(fd, &buf) == 0 && (buf.st_mode & S_IFREG) != 0)
+ ret = buf.st_size > 0 ? buf.st_size : 0;
+
+ return ret;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// All version of Unix have mmap and lseek system calls. Some also have
+// longer versions of those system calls to accommodate 64-bit offsets.
+// If we're on a Unix system, define some macros to encapsulate those
+// differences.
+
+size_t _Filebuf_base::_M_page_size = 4096;
+
+_Filebuf_base::_Filebuf_base()
+ : _M_file_id(INVALID_STLP_FD),
+ _M_openmode(0),
+ _M_is_open(false),
+ _M_should_close(false)
+{}
+
+void _Filebuf_base::_S_initialize()
+{
+
+}
+
+// Return the size of the file. This is a wrapper for stat.
+// Returns zero if the size cannot be determined or is ill-defined.
+streamoff _Filebuf_base::_M_file_size()
+{
+ return _STLP_PRIV __file_size(_M_file_id);
+}
+
+bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode,
+ long permission)
+{
+ _STLP_fd file_no;
+
+ if (_M_is_open)
+ return false;
+
+ // use FILE-based i/o
+ const char* flags;
+
+ switch (openmode & (~ios_base::ate)) {
+ case ios_base::out:
+ case ios_base::out | ios_base::trunc:
+ flags = "w";
+ break;
+
+ case ios_base::out | ios_base::binary:
+ case ios_base::out | ios_base::trunc | ios_base::binary:
+ flags = "wb";
+ break;
+
+ case ios_base::out | ios_base::app:
+ flags = "a";
+ break;
+
+ case ios_base::out | ios_base::app | ios_base::binary:
+ flags = "ab";
+ break;
+
+ case ios_base::in:
+ flags = "r";
+ break;
+
+ case ios_base::in | ios_base::binary:
+ flags = "rb";
+ break;
+
+ case ios_base::in | ios_base::out:
+ flags = "r+";
+ break;
+
+ case ios_base::in | ios_base::out | ios_base::binary:
+ flags = "r+b";
+ break;
+
+ case ios_base::in | ios_base::out | ios_base::trunc:
+ flags = "w+";
+ break;
+
+ case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary:
+ flags = "w+b";
+ break;
+
+ default: // The above are the only combinations of
+ return false; // flags allowed by the C++ standard.
+ }
+
+ // fbp : TODO : set permissions !
+ (void)permission; // currently unused //*TY 02/26/2000 - added to suppress warning message
+ _M_file = FOPEN(name, flags);
+
+ if (_M_file) {
+ file_no = fileno(_M_file);
+ } else {
+ return false;
+ }
+
+ // unset buffering immediately
+ setbuf(_M_file, 0);
+
+ _M_is_open = true;
+
+ if (openmode & ios_base::ate) {
+ if (FSEEK(_M_file, 0, SEEK_END) != 0)
+ _M_is_open = false;
+ }
+
+ _M_file_id = file_no;
+ _M_should_close = _M_is_open;
+ _M_openmode = openmode;
+
+ if (_M_is_open)
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+
+ return (_M_is_open != 0);
+}
+
+
+bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode)
+{
+ // This doesn't really grant everyone in the world read/write
+ // access. On Unix, file-creation system calls always clear
+ // bits that are set in the umask from the permissions flag.
+ return this->_M_open(name, openmode, S_IRUSR | S_IWUSR | S_IRGRP |
+ S_IWGRP | S_IROTH | S_IWOTH);
+}
+
+// Associated the filebuf with a file descriptor pointing to an already-
+// open file. Mode is set to be consistent with the way that the file
+// was opened.
+bool _Filebuf_base::_M_open( int file_no, ios_base::openmode )
+{
+ if (_M_is_open || file_no < 0)
+ return false;
+
+ struct STAT buf;
+ if (FSTAT(file_no, &buf) != 0)
+ return false;
+ int mode = buf.st_mode;
+
+ switch ( mode & (S_IWRITE | S_IREAD) ) {
+ case S_IREAD:
+ _M_openmode = ios_base::in;
+ break;
+ case S_IWRITE:
+ _M_openmode = ios_base::out;
+ break;
+ case (S_IWRITE | S_IREAD):
+ _M_openmode = ios_base::in | ios_base::out;
+ break;
+ default:
+ return false;
+ }
+ _M_file_id = file_no;
+ _M_is_open = true;
+ _M_should_close = false;
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+ return true;
+}
+
+bool _Filebuf_base::_M_close()
+{
+ if (!_M_is_open)
+ return false;
+
+ bool ok = _M_should_close ? (fclose(_M_file) == 0) : true;
+
+ _M_is_open = _M_should_close = false;
+ _M_openmode = 0;
+ return ok;
+}
+
+// Read up to n characters into a buffer. Return value is number of
+// characters read.
+ptrdiff_t _Filebuf_base::_M_read(char* buf, ptrdiff_t n) {
+ return fread(buf, 1, n, _M_file);
+}
+
+// Write n characters from a buffer. Return value: true if we managed
+// to write the entire buffer, false if we didn't.
+bool _Filebuf_base::_M_write(char* buf, ptrdiff_t n)
+{
+ for (;;) {
+ ptrdiff_t written = fwrite(buf, 1, n, _M_file);
+
+ if (n == written) {
+ return true;
+ }
+
+ if (written > 0 && written < n) {
+ n -= written;
+ buf += written;
+ } else {
+ return false;
+ }
+ }
+}
+
+// Wrapper for lseek or the like.
+streamoff _Filebuf_base::_M_seek(streamoff offset, ios_base::seekdir dir)
+{
+ int whence;
+
+ switch ( dir ) {
+ case ios_base::beg:
+ if (offset < 0 /* || offset > _M_file_size() */ )
+ return streamoff(-1);
+ whence = SEEK_SET;
+ break;
+ case ios_base::cur:
+ whence = SEEK_CUR;
+ break;
+ case ios_base::end:
+ if (/* offset > 0 || */ -offset > _M_file_size() )
+ return streamoff(-1);
+ whence = SEEK_END;
+ break;
+ default:
+ return streamoff(-1);
+ }
+
+ if ( FSEEK(_M_file, offset, whence) == 0 ) {
+ return FTELL(_M_file);
+ }
+
+ return streamoff(-1);
+}
+
+
+// Attempts to memory-map len bytes of the current file, starting
+// at position offset. Precondition: offset is a multiple of the
+// page size. Postcondition: return value is a null pointer if the
+// memory mapping failed. Otherwise the return value is a pointer to
+// the memory-mapped file and the file position is set to offset.
+void *_Filebuf_base::_M_mmap(streamoff, streamoff )
+{
+ return 0;
+}
+
+void _Filebuf_base::_M_unmap(void*, streamoff)
+{
+ // precondition : there is a valid mapping at the moment
+}
+
+_STLP_END_NAMESPACE
diff --git a/src/details/fstream_unistd.cpp b/src/details/fstream_unistd.cpp
new file mode 100644
index 0000000..7440883
--- /dev/null
+++ b/src/details/fstream_unistd.cpp
@@ -0,0 +1,347 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if defined (__SUNPPRO_CC) && !defined (_STLP_NO_NEW_C_HEADERS)
+# include <time.h>
+// For sunpro, it chokes if time.h is included through stat.h
+#endif
+
+#include <fstream>
+
+#ifdef __CYGWIN__
+# define __int64 long long
+#endif
+
+extern "C" {
+// open/close/read/write
+#include <sys/stat.h> // For stat
+#if !defined (_CRAY) && ! defined (__EMX__)
+# include <sys/mman.h> // For mmap
+#endif
+
+// on HP-UX 11, this one contradicts with pthread.h on pthread_atfork, unless we unset this
+#if defined (__hpux) && defined (__GNUC__)
+# undef _INCLUDE_POSIX1C_SOURCE
+#endif
+
+#include <unistd.h>
+#include <fcntl.h>
+}
+
+#ifdef __APPLE__
+# include <sys/sysctl.h>
+#endif
+
+const _STLP_fd INVALID_STLP_FD = -1;
+
+#ifndef O_ACCMODE
+# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+#endif
+
+// Compare with streamoff definition in stl/char_traits.h!
+#if defined (_STLP_USE_DEFAULT_FILE_OFFSET) || \
+ (!defined(_LARGEFILE_SOURCE) && !defined (_LARGEFILE64_SOURCE))
+# define FSTAT fstat
+# define STAT stat
+# define LSEEK lseek
+# define MMAP mmap
+# define OPEN open
+#else
+# define FSTAT fstat64
+# define STAT stat64
+# define LSEEK lseek64
+# define MMAP mmap64
+# define OPEN open64
+#endif
+
+#ifndef MAP_FAILED /* MMAP failure return code */
+# define MAP_FAILED -1
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+static ios_base::openmode flag_to_openmode(int mode)
+{
+ ios_base::openmode ret = ios_base::__default_mode;
+
+ switch ( mode & O_ACCMODE ) {
+ case O_RDONLY:
+ ret = ios_base::in;
+ break;
+ case O_WRONLY:
+ ret = ios_base::out;
+ break;
+ case O_RDWR:
+ ret = ios_base::in | ios_base::out;
+ break;
+ }
+
+ if ( mode & O_APPEND )
+ ret |= ios_base::app;
+
+ return ret;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Helper functions for _Filebuf_base.
+
+static bool __is_regular_file(_STLP_fd fd) {
+ struct STAT buf;
+ return FSTAT(fd, &buf) == 0 && S_ISREG(buf.st_mode);
+}
+
+// Number of characters in the file.
+static streamoff __file_size(_STLP_fd fd) {
+ streamoff ret = 0;
+
+ struct STAT buf;
+ if (FSTAT(fd, &buf) == 0 && S_ISREG(buf.st_mode))
+ ret = buf.st_size > 0 ? buf.st_size : 0;
+
+ return ret;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+size_t _Filebuf_base::_M_page_size = 4096;
+
+_Filebuf_base::_Filebuf_base()
+ : _M_file_id(INVALID_STLP_FD),
+ _M_openmode(0),
+ _M_is_open(false),
+ _M_should_close(false)
+{}
+
+void _Filebuf_base::_S_initialize()
+{
+#if defined (__APPLE__)
+ int mib[2];
+ size_t pagesize, len;
+ mib[0] = CTL_HW;
+ mib[1] = HW_PAGESIZE;
+ len = sizeof(pagesize);
+ sysctl(mib, 2, &pagesize, &len, NULL, 0);
+ _M_page_size = pagesize;
+#elif defined (__DJGPP) && defined (_CRAY)
+ _M_page_size = BUFSIZ;
+#else
+ _M_page_size = sysconf(_SC_PAGESIZE);
+#endif
+}
+
+// Return the size of the file. This is a wrapper for stat.
+// Returns zero if the size cannot be determined or is ill-defined.
+streamoff _Filebuf_base::_M_file_size()
+{
+ return _STLP_PRIV __file_size(_M_file_id);
+}
+
+bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode,
+ long permission)
+{
+ _STLP_fd file_no;
+
+ if (_M_is_open)
+ return false;
+
+ int flags = 0;
+
+ // Unix makes no distinction between text and binary files.
+ switch ( openmode & (~ios_base::ate & ~ios_base::binary) ) {
+ case ios_base::out:
+ case ios_base::out | ios_base::trunc:
+ flags = O_WRONLY | O_CREAT | O_TRUNC;
+ break;
+ case ios_base::app:
+ case ios_base::out | ios_base::app:
+ flags = O_WRONLY | O_CREAT | O_APPEND;
+ break;
+ case ios_base::in:
+ flags = O_RDONLY;
+ permission = 0; // Irrelevant unless we're writing.
+ break;
+ case ios_base::in | ios_base::out:
+ flags = O_RDWR;
+ break;
+ case ios_base::in | ios_base::out | ios_base::trunc:
+ flags = O_RDWR | O_CREAT | O_TRUNC;
+ break;
+ case ios_base::in | ios_base::app:
+ case ios_base::in | ios_base::out | ios_base::app:
+ flags = O_RDWR | O_CREAT | O_APPEND;
+ break;
+ default: // The above are the only combinations of
+ return false; // flags allowed by the C++ standard.
+ }
+
+ file_no = OPEN(name, flags, permission);
+
+ if (file_no < 0)
+ return false;
+
+ _M_is_open = true;
+
+ if ((openmode & (ios_base::ate | ios_base::app)) && (LSEEK(file_no, 0, SEEK_END) == -1)) {
+ _M_is_open = false;
+ }
+
+ _M_file_id = file_no;
+ _M_should_close = _M_is_open;
+ _M_openmode = openmode;
+
+ if (_M_is_open)
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+
+ return (_M_is_open != 0);
+}
+
+
+bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode)
+{
+ // This doesn't really grant everyone in the world read/write
+ // access. On Unix, file-creation system calls always clear
+ // bits that are set in the umask from the permissions flag.
+ return this->_M_open(name, openmode, S_IRUSR | S_IWUSR | S_IRGRP |
+ S_IWGRP | S_IROTH | S_IWOTH);
+}
+
+// Associated the filebuf with a file descriptor pointing to an already-
+// open file. Mode is set to be consistent with the way that the file
+// was opened.
+bool _Filebuf_base::_M_open(int file_no, ios_base::openmode)
+{
+ if (_M_is_open || file_no < 0)
+ return false;
+
+ int mode = fcntl(file_no, F_GETFL);
+
+ if (mode == -1)
+ return false;
+
+ _M_openmode = flag_to_openmode(mode);
+ _M_file_id = file_no;
+
+ _M_is_open = true;
+ _M_should_close = false;
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+ return true;
+}
+
+bool _Filebuf_base::_M_close()
+{
+ if (!_M_is_open)
+ return false;
+
+ bool ok = _M_should_close ? (close(_M_file_id) == 0) : true;
+
+ _M_is_open = _M_should_close = false;
+ _M_openmode = 0;
+ return ok;
+}
+
+// Read up to n characters into a buffer. Return value is number of
+// characters read.
+ptrdiff_t _Filebuf_base::_M_read(char* buf, ptrdiff_t n)
+{
+ return read(_M_file_id, buf, n);
+}
+
+// Write n characters from a buffer. Return value: true if we managed
+// to write the entire buffer, false if we didn't.
+bool _Filebuf_base::_M_write(char* buf, ptrdiff_t n)
+{
+ for (;;) {
+ ptrdiff_t written = write(_M_file_id, buf, n);
+
+ if (n == written) {
+ return true;
+ }
+
+ if (written > 0 && written < n) {
+ n -= written;
+ buf += written;
+ } else {
+ return false;
+ }
+ }
+}
+
+// Wrapper for lseek or the like.
+streamoff _Filebuf_base::_M_seek(streamoff offset, ios_base::seekdir dir)
+{
+ int whence;
+
+ switch ( dir ) {
+ case ios_base::beg:
+ if (offset < 0 /* || offset > _M_file_size() */ )
+ return streamoff(-1);
+ whence = SEEK_SET;
+ break;
+ case ios_base::cur:
+ whence = SEEK_CUR;
+ break;
+ case ios_base::end:
+ if (/* offset > 0 || */ -offset > _M_file_size() )
+ return streamoff(-1);
+ whence = SEEK_END;
+ break;
+ default:
+ return streamoff(-1);
+ }
+
+ return LSEEK(_M_file_id, offset, whence);
+}
+
+// Attempts to memory-map len bytes of the current file, starting
+// at position offset. Precondition: offset is a multiple of the
+// page size. Postcondition: return value is a null pointer if the
+// memory mapping failed. Otherwise the return value is a pointer to
+// the memory-mapped file and the file position is set to offset.
+void* _Filebuf_base::_M_mmap(streamoff offset, streamoff len)
+{
+ void* base;
+#if !defined (__DJGPP) && !defined (_CRAY)
+ base = MMAP(0, len, PROT_READ, MAP_PRIVATE, _M_file_id, offset);
+ if (base != (void*)MAP_FAILED) {
+ if (LSEEK(_M_file_id, offset + len, SEEK_SET) < 0) {
+ this->_M_unmap(base, len);
+ base = 0;
+ }
+ } else
+ base =0;
+#else
+ _STLP_MARK_PARAMETER_AS_UNUSED(&offset)
+ _STLP_MARK_PARAMETER_AS_UNUSED(&len)
+ base = 0;
+#endif
+ return base;
+}
+
+void _Filebuf_base::_M_unmap(void* base, streamoff len)
+{
+ // precondition : there is a valid mapping at the moment
+#if !defined (__DJGPP) && !defined (_CRAY)
+ munmap((char*)base, len);
+#else
+ _STLP_MARK_PARAMETER_AS_UNUSED(&len)
+ _STLP_MARK_PARAMETER_AS_UNUSED(base)
+#endif
+}
+
+_STLP_END_NAMESPACE
diff --git a/src/details/fstream_win32io.cpp b/src/details/fstream_win32io.cpp
new file mode 100644
index 0000000..673f367
--- /dev/null
+++ b/src/details/fstream_win32io.cpp
@@ -0,0 +1,629 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include <fstream>
+
+#if !defined (_STLP_WCE)
+# ifdef __BORLANDC__
+# include <cfcntl.h> // For _O_RDONLY, etc
+# else
+# include <io.h> // For _get_osfhandle
+# include <fcntl.h> // For _O_RDONLY, etc
+# endif
+# include <sys/stat.h> // For _fstat
+#endif
+
+#define _TEXTBUF_SIZE 0x1000
+
+const _STLP_fd INVALID_STLP_FD = INVALID_HANDLE_VALUE;
+
+#if !defined (INVALID_SET_FILE_POINTER)
+# define INVALID_SET_FILE_POINTER 0xffffffff
+#endif
+
+#ifndef O_ACCMODE
+# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined(__MSL__) && !defined(_STLP_WCE)
+static ios_base::openmode flag_to_openmode(int mode) {
+ ios_base::openmode ret = ios_base::__default_mode;
+
+ switch (mode & O_ACCMODE) {
+ case O_RDONLY:
+ ret = ios_base::in; break;
+ case O_WRONLY:
+ ret = ios_base::out; break;
+ case O_RDWR:
+ ret = ios_base::in | ios_base::out; break;
+ }
+
+ if (mode & O_APPEND)
+ ret |= ios_base::app;
+
+ if (mode & O_BINARY)
+ ret |= ios_base::binary;
+
+ return ret;
+}
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Helper functions for _Filebuf_base.
+
+static bool __is_regular_file(_STLP_fd fd) {
+ BY_HANDLE_FILE_INFORMATION info;
+
+ // Return true if the file handle isn't a directory.
+ return GetFileInformationByHandle(fd, &info) &&
+ ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0);
+}
+
+// Number of characters in the file.
+static streamoff __file_size(_STLP_fd fd) {
+ streamoff ret = 0;
+
+ LARGE_INTEGER li;
+ li.LowPart = GetFileSize(fd, (unsigned long*) &li.HighPart);
+ if (li.LowPart != INVALID_FILE_SIZE || GetLastError() == NO_ERROR)
+ ret = li.QuadPart;
+
+ return ret;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Visual C++ and Intel use this, but not Metrowerks
+// Also MinGW, msvcrt.dll (but not crtdll.dll) dependent version
+#if (defined (_STLP_MSVC_LIB) && !defined (_STLP_WCE)) || \
+ (defined (__MINGW32__) && defined (__MSVCRT__))
+
+// fcntl(fileno, F_GETFL) for Microsoft library
+// 'semi-documented' defines:
+# define IOINFO_L2E 5
+# define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
+# define _pioinfo(i) ( __pioinfo[(i) >> IOINFO_L2E] + \
+ ((i) & (IOINFO_ARRAY_ELTS - 1)) )
+# define FAPPEND 0x20 // O_APPEND flag
+# define FTEXT 0x80 // O_TEXT flag
+// end of 'semi-documented' defines
+
+// 'semi-documented' internal structure
+extern "C" {
+ struct ioinfo {
+ long osfhnd; // the real os HANDLE
+ char osfile; // file handle flags
+ char pipech; // pipe buffer
+# if defined (_MT)
+ // multi-threaded locking
+ int lockinitflag;
+ CRITICAL_SECTION lock;
+# endif
+ };
+# if defined (__MINGW32__)
+ __MINGW_IMPORT ioinfo * __pioinfo[];
+# else
+ extern _CRTIMP ioinfo * __pioinfo[];
+# endif
+} // extern "C"
+// end of 'semi-documented' declarations
+
+static ios_base::openmode _get_osfflags(int fd, HANDLE oshandle) {
+ char dosflags = 0;
+ if (fd >= 0)
+ dosflags = _pioinfo(fd)->osfile;
+ //else
+ //the file will be considered as open in binary mode with no append attribute
+ // end of 'semi-documented' stuff
+
+ int mode = 0;
+ if (dosflags & FAPPEND)
+ mode |= O_APPEND;
+
+ if (dosflags & FTEXT)
+ mode |= O_TEXT;
+ else
+ mode |= O_BINARY;
+
+ // For Read/Write access we have to guess
+ DWORD dummy, dummy2;
+ BOOL writeOk = WriteFile(oshandle, &dummy2, 0, &dummy, 0);
+ BOOL readOk = ReadFile(oshandle, &dummy2, 0, &dummy, NULL);
+ if (writeOk && readOk)
+ mode |= O_RDWR;
+ else if (readOk)
+ mode |= O_RDONLY;
+ else
+ mode |= O_WRONLY;
+
+ return flag_to_openmode(mode);
+}
+
+#elif defined (__DMC__)
+
+# define FHND_APPEND 0x04
+# define FHND_DEVICE 0x08
+# define FHND_TEXT 0x10
+
+extern "C" unsigned char __fhnd_info[_NFILE];
+
+static ios_base::openmode _get_osfflags(int fd, HANDLE oshandle) {
+ int mode = 0;
+
+ if (__fhnd_info[fd] & FHND_APPEND)
+ mode |= O_APPEND;
+
+ if (__fhnd_info[fd] & FHND_TEXT == 0)
+ mode |= O_BINARY;
+
+ for (FILE *fp = &_iob[0]; fp < &_iob[_NFILE]; fp++) {
+ if ((fileno(fp) == fd) && (fp->_flag & (_IOREAD | _IOWRT | _IORW))) {
+ const int osflags = fp->_flag;
+
+ if ((osflags & _IOREAD) && !(osflags & _IOWRT) && !(osflags & _IORW))
+ mode |= O_RDONLY;
+ else if ((osflags & _IOWRT) && !(osflags & _IOREAD) && !(osflags & _IORW))
+ mode |= O_WRONLY;
+ else
+ mode |= O_RDWR;
+ break;
+ }
+ }
+
+ return flag_to_openmode(mode);
+}
+#endif
+
+size_t _Filebuf_base::_M_page_size = 4096;
+
+_Filebuf_base::_Filebuf_base()
+ : _M_file_id(INVALID_STLP_FD),
+ _M_openmode(0),
+ _M_is_open(false),
+ _M_should_close(false),
+ _M_view_id(0)
+{}
+
+void _Filebuf_base::_S_initialize() {
+ SYSTEM_INFO SystemInfo;
+ GetSystemInfo(&SystemInfo);
+ _M_page_size = SystemInfo.dwPageSize;
+ // might be .dwAllocationGranularity
+}
+
+// Return the size of the file. This is a wrapper for stat.
+// Returns zero if the size cannot be determined or is ill-defined.
+streamoff _Filebuf_base::_M_file_size() {
+ return _STLP_PRIV __file_size(_M_file_id);
+}
+
+bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode,
+ long permission) {
+ _STLP_fd file_no;
+
+ if (_M_is_open)
+ return false;
+
+ DWORD dwDesiredAccess, dwCreationDisposition;
+ bool doTruncate = false;
+
+ switch (openmode & (~ios_base::ate & ~ios_base::binary)) {
+ case ios_base::out:
+ case ios_base::out | ios_base::trunc:
+ dwDesiredAccess = GENERIC_WRITE;
+ dwCreationDisposition = OPEN_ALWAYS;
+ // boris : even though it is very non-intuitive, standard
+ // requires them both to behave same.
+ doTruncate = true;
+ break;
+ case ios_base::out | ios_base::app:
+ dwDesiredAccess = GENERIC_WRITE;
+ dwCreationDisposition = OPEN_ALWAYS;
+ break;
+ case ios_base::in:
+ dwDesiredAccess = GENERIC_READ;
+ dwCreationDisposition = OPEN_EXISTING;
+ permission = 0; // Irrelevant unless we're writing.
+ break;
+ case ios_base::in | ios_base::out:
+ dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
+ dwCreationDisposition = OPEN_EXISTING;
+ break;
+ case ios_base::in | ios_base::out | ios_base::trunc:
+ dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
+ dwCreationDisposition = OPEN_ALWAYS;
+ doTruncate = true;
+ break;
+ default: // The above are the only combinations of
+ return false; // flags allowed by the C++ standard.
+ }
+
+ DWORD dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
+
+#if defined(_STLP_USE_WIDE_INTERFACE)
+ file_no = CreateFile (_STLP_PRIV __ASCIIToWide(name).c_str(),
+#else
+ file_no = CreateFileA(name,
+#endif
+ dwDesiredAccess, dwShareMode, 0,
+ dwCreationDisposition, permission, 0);
+
+ if (file_no == INVALID_STLP_FD)
+ return false;
+
+ if (
+#if !defined (_STLP_WCE)
+ GetFileType(file_no) == FILE_TYPE_DISK &&
+#endif
+ ((doTruncate && SetEndOfFile(file_no) == 0) ||
+ (((openmode & ios_base::ate) != 0) &&
+ (SetFilePointer(file_no, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER)))) {
+ CloseHandle(file_no);
+ return false;
+ }
+
+ _M_is_open = true;
+ _M_file_id = file_no;
+ _M_should_close = _M_is_open;
+ _M_openmode = openmode;
+
+ if (_M_is_open)
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+
+ return (_M_is_open != 0);
+}
+
+bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode) {
+ // This doesn't really grant everyone in the world read/write
+ // access. On Unix, file-creation system calls always clear
+ // bits that are set in the umask from the permissions flag.
+ return this->_M_open(name, openmode, FILE_ATTRIBUTE_NORMAL);
+}
+
+bool _Filebuf_base::_M_open(_STLP_fd __id, ios_base::openmode init_mode) {
+#if (defined (_STLP_MSVC_LIB) && !defined (_STLP_WCE)) || \
+ (defined (__MINGW32__) && defined (__MSVCRT__)) || defined (__DMC__)
+
+ if (_M_is_open || __id == INVALID_STLP_FD)
+ return false;
+
+ if (init_mode != ios_base::__default_mode)
+ _M_openmode = init_mode;
+ else
+ _M_openmode = _get_osfflags(-1, __id);
+
+ _M_is_open = true;
+ _M_file_id = __id;
+ _M_should_close = false;
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+
+ return true;
+#else
+ (void)__id;
+ (void)init_mode; // dwa 4/27/00 - suppress unused parameter warning
+
+ // not available for the API
+ return false;
+
+#endif
+}
+
+// Associated the filebuf with a file descriptor pointing to an already-
+// open file. Mode is set to be consistent with the way that the file
+// was opened.
+bool _Filebuf_base::_M_open(int file_no, ios_base::openmode init_mode) {
+ if (_M_is_open || file_no < 0)
+ return false;
+
+#if (defined (_STLP_MSVC_LIB) && !defined (_STLP_WCE)) || \
+ (defined (__MINGW32__) && defined (__MSVCRT__)) || defined (__DMC__)
+
+ HANDLE oshandle = (HANDLE)_get_osfhandle(file_no);
+ if (oshandle == INVALID_STLP_FD)
+ return false;
+
+ if (init_mode != ios_base::__default_mode)
+ _M_openmode = init_mode;
+ else
+ _M_openmode = _get_osfflags(file_no, oshandle);
+
+ _M_file_id = oshandle;
+ _M_is_open = true;
+ _M_should_close = false;
+ _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id);
+ return true;
+#else
+ _STLP_MARK_PARAMETER_AS_UNUSED(&init_mode)
+ // not available for the API
+ return false;
+#endif
+}
+
+bool _Filebuf_base::_M_close() {
+ if (!_M_is_open)
+ return false;
+
+ bool ok;
+
+ if (!_M_should_close)
+ ok = true;
+ else {
+ if (_M_file_id != INVALID_STLP_FD) {
+ ok = (CloseHandle(_M_file_id) != 0);
+ }
+ else {
+ ok = false;
+ }
+ }
+
+ _M_is_open = _M_should_close = false;
+ _M_openmode = 0;
+ return ok;
+}
+
+
+#define _STLP_LF 10
+#define _STLP_CR 13
+#define _STLP_CTRLZ 26
+
+// Read up to n characters into a buffer. Return value is number of
+// characters read.
+ptrdiff_t _Filebuf_base::_M_read(char* buf, ptrdiff_t n) {
+ ptrdiff_t readen = 0;
+ //Here cast to size_t is safe as n cannot be negative.
+ size_t chunkSize = (min)(size_t(0xffffffff), __STATIC_CAST(size_t, n));
+ // The following, while validating that we are still able to extract chunkSize
+ // charaters to the buffer, avoids extraction of too small chunk of datas
+ // which would be counter performant.
+ while (__STATIC_CAST(size_t, (n - readen)) >= chunkSize) {
+ DWORD numberOfBytesRead;
+ ReadFile(_M_file_id, buf + readen, __STATIC_CAST(DWORD, chunkSize), &numberOfBytesRead, 0);
+
+ if (numberOfBytesRead == 0)
+ break;
+
+ if (!(_M_openmode & ios_base::binary)) {
+ // translate CR-LFs to LFs in the buffer
+ char *to = buf + readen;
+ char *from = to;
+ char *last = from + numberOfBytesRead - 1;
+ for (; from <= last && *from != _STLP_CTRLZ; ++from) {
+ if (*from != _STLP_CR)
+ *to++ = *from;
+ else { // found CR
+ if (from < last) { // not at buffer end
+ if (*(from + 1) != _STLP_LF)
+ *to++ = _STLP_CR;
+ }
+ else { // last char is CR, peek for LF
+ char peek = ' ';
+ DWORD NumberOfBytesPeeked;
+ ReadFile(_M_file_id, (LPVOID)&peek, 1, &NumberOfBytesPeeked, 0);
+ if (NumberOfBytesPeeked != 0) {
+ if (peek != _STLP_LF) { //not a <CR><LF> combination
+ *to++ = _STLP_CR;
+ if ((to < buf + n) && (peek != _STLP_CR))
+ //We have enough place to store peek and it is no a special
+ //_STLP_CR character, we can store it.
+ *to++ = peek;
+ else
+ SetFilePointer(_M_file_id, (LONG)-1, 0, FILE_CURRENT);
+ }
+ else {
+ // A <CR><LF> combination, we keep the <LF>:
+ *to++ = _STLP_LF;
+ }
+ }
+ else {
+ /* This case is tedious, we could
+ * - put peek back in the file but this would then generate an infinite loop
+ * - report an error as we don't know if in a future call to ReadFile we won't then
+ * get a <LF>. Doing so would make all files with a <CR> last an invalid file
+ * for STLport, a hard solution for STLport clients.
+ * - store the <CR> in the returned buffer, the chosen solution, even if in this
+ * case we could miss a <CR><LF> combination.
+ */
+ *to++ = _STLP_CR;
+ }
+ }
+ } // found CR
+ } // for
+ readen = to - buf;
+ // seek back to TEXT end of file if hit CTRL-Z
+ if (from <= last) { // terminated due to CTRLZ
+ SetFilePointer(_M_file_id, -(LONG)((last + 1) - from), 0, FILE_CURRENT);
+ break;
+ }
+ }
+ else
+ readen += numberOfBytesRead;
+ }
+ return readen;
+}
+
+// Write n characters from a buffer. Return value: true if we managed
+// to write the entire buffer, false if we didn't.
+bool _Filebuf_base::_M_write(char* buf, ptrdiff_t n) {
+ for (;;) {
+ ptrdiff_t written;
+
+ //In the following implementation we are going to cast most of the ptrdiff_t
+ //values in size_t to work with coherent unsigned values. Doing so make code
+ //more simple especially in the min function call.
+
+ // In append mode, every write does an implicit seek to the end
+ // of the file.
+ if (_M_openmode & ios_base::app)
+ _M_seek(0, ios_base::end);
+
+ if (_M_openmode & ios_base::binary) {
+ // binary mode
+ size_t bytes_to_write = (size_t)n;
+ DWORD NumberOfBytesWritten;
+ written = 0;
+ for (; bytes_to_write != 0;) {
+ WriteFile(_M_file_id, buf + written,
+ __STATIC_CAST(DWORD, (min)(size_t(0xffffffff), bytes_to_write)),
+ &NumberOfBytesWritten, 0);
+ if (NumberOfBytesWritten == 0)
+ return false;
+ bytes_to_write -= NumberOfBytesWritten;
+ written += NumberOfBytesWritten;
+ }
+ }
+ else {
+ char textbuf[_TEXTBUF_SIZE + 1]; // extra 1 in case LF at end
+ char * nextblock = buf, * ptrtextbuf = textbuf;
+ char * endtextbuf = textbuf + _TEXTBUF_SIZE;
+ char * endblock = buf + n;
+ ptrdiff_t nextblocksize = (min) (n, (ptrdiff_t)_TEXTBUF_SIZE);
+ char * nextlf;
+
+ while ( (nextblocksize > 0) &&
+ (nextlf = (char *)memchr(nextblock, _STLP_LF, nextblocksize)) != 0) {
+ ptrdiff_t linelength = nextlf - nextblock;
+ memcpy(ptrtextbuf, nextblock, linelength);
+ ptrtextbuf += linelength;
+ nextblock += (linelength + 1);
+ * ptrtextbuf ++ = _STLP_CR;
+ * ptrtextbuf ++ = _STLP_LF;
+ nextblocksize = (min) (ptrdiff_t(endblock - nextblock),
+ (max) (ptrdiff_t(0), ptrdiff_t(endtextbuf - ptrtextbuf)));
+ }
+ // write out what's left, > condition is here since for LF at the end ,
+ // endtextbuf may get < ptrtextbuf ...
+ if (nextblocksize > 0) {
+ memcpy(ptrtextbuf, nextblock, nextblocksize);
+ ptrtextbuf += nextblocksize;
+ nextblock += nextblocksize;
+ }
+ // now write out the translated buffer
+ char * writetextbuf = textbuf;
+ for (size_t NumberOfBytesToWrite = (size_t)(ptrtextbuf - textbuf);
+ NumberOfBytesToWrite;) {
+ DWORD NumberOfBytesWritten;
+ WriteFile((HANDLE)_M_file_id, writetextbuf,
+ __STATIC_CAST(DWORD, (min)(size_t(0xffffffff), NumberOfBytesToWrite)),
+ &NumberOfBytesWritten, 0);
+ if (!NumberOfBytesWritten) // write shortfall
+ return false;
+ writetextbuf += NumberOfBytesWritten;
+ NumberOfBytesToWrite -= NumberOfBytesWritten;
+ }
+ // count non-translated characters
+ written = (nextblock - buf);
+ }
+
+ if (n == written)
+ return true;
+ else if (written > 0 && written < n) {
+ n -= written;
+ buf += written;
+ }
+ else
+ return false;
+ }
+}
+
+// Wrapper for lseek or the like.
+streamoff _Filebuf_base::_M_seek(streamoff offset, ios_base::seekdir dir) {
+ streamoff result = -1;
+ int whence;
+
+ switch(dir) {
+ case ios_base::beg:
+ if (offset < 0 /* || offset > _M_file_size() */ )
+ return streamoff(-1);
+ whence = FILE_BEGIN;
+ break;
+ case ios_base::cur:
+ whence = FILE_CURRENT;
+ break;
+ case ios_base::end:
+ if (/* offset > 0 || */ -offset > _M_file_size() )
+ return streamoff(-1);
+ whence = FILE_END;
+ break;
+ default:
+ return streamoff(-1);
+ }
+
+ LARGE_INTEGER li;
+ li.QuadPart = offset;
+ li.LowPart = SetFilePointer(_M_file_id, li.LowPart, &li.HighPart, whence);
+ if (li.LowPart != INVALID_SET_FILE_POINTER || GetLastError() == NO_ERROR)
+ result = li.QuadPart;
+
+ return result;
+}
+
+
+// Attempts to memory-map len bytes of the current file, starting
+// at position offset. Precondition: offset is a multiple of the
+// page size. Postcondition: return value is a null pointer if the
+// memory mapping failed. Otherwise the return value is a pointer to
+// the memory-mapped file and the file position is set to offset.
+void* _Filebuf_base::_M_mmap(streamoff offset, streamoff len) {
+ void* base;
+ _M_view_id = CreateFileMapping(_M_file_id, (PSECURITY_ATTRIBUTES)0 ,
+ PAGE_READONLY, 0 /* len >> 32 */ ,
+ 0 /* len & 0xFFFFFFFF */ , // low-order DWORD of size
+ 0);
+
+ if (_M_view_id) {
+#if 0
+/*
+ printf("view %x created from file %x, error = %d, size = %d, map_offset = %d map_len = %d\n",
+ _M_view_id, _M_file_id, GetLastError(),
+ (int)cur_filesize, ULL(offset) & 0xffffffff, len);
+*/
+#endif
+ LARGE_INTEGER li;
+ li.QuadPart = offset;
+ base = MapViewOfFile(_M_view_id, FILE_MAP_READ, li.HighPart, li.LowPart,
+#if !defined (__DMC__)
+ __STATIC_CAST(SIZE_T, len));
+#else
+ __STATIC_CAST(DWORD, len));
+#endif
+ // check if mapping succeded and is usable
+ if (base == 0 || _M_seek(offset + len, ios_base::beg) < 0) {
+ this->_M_unmap(base, len);
+ base = 0;
+ }
+ } else
+ base = 0;
+
+ return base;
+}
+
+void _Filebuf_base::_M_unmap(void* base, streamoff len) {
+ // precondition : there is a valid mapping at the moment
+ if (base != NULL)
+ UnmapViewOfFile(base);
+ // destroy view handle as well
+ if (_M_view_id != NULL)
+ CloseHandle(_M_view_id);
+ _M_view_id = NULL;
+ (void)len; //unused variable
+}
+
+_STLP_END_NAMESPACE
diff --git a/src/dll_main.cpp b/src/dll_main.cpp
new file mode 100644
index 0000000..faaa721
--- /dev/null
+++ b/src/dll_main.cpp
@@ -0,0 +1,262 @@
+ /*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+
+#include "stlport_prefix.h"
+
+#if !defined (_STLP_DEBUG) && ! defined (_STLP_ASSERTIONS)
+# if !defined (__APPLE__) || !defined (__GNUC__) || (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
+/* dums: Please if the following code was being uncommented please explain why
+ * as for the moment it only looks like a source of inconsistency in the way
+ * STLport different translation units are compiled.
+ */
+//# define _STLP_ASSERTIONS 1
+# endif
+#endif
+
+#include <utility>
+#include <memory>
+#include <vector>
+#include <set>
+#include <list>
+#include <slist>
+#include <deque>
+#include <hash_map>
+#include <limits>
+#include <string>
+#include <stdexcept>
+#include <bitset>
+#include <locale>
+
+#if defined (__DMC__)
+// for rope static members
+# include <rope>
+#endif
+
+#include <stl/_range_errors.c>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
+exception::exception() _STLP_NOTHROW {}
+exception::~exception() _STLP_NOTHROW {}
+bad_exception::bad_exception() _STLP_NOTHROW {}
+bad_exception::~bad_exception() _STLP_NOTHROW {}
+const char* exception::what() const _STLP_NOTHROW { return "class exception"; }
+const char* bad_exception::what() const _STLP_NOTHROW { return "class bad_exception"; }
+#endif
+
+#if defined (_STLP_OWN_STDEXCEPT)
+# include <stl/_stdexcept_base.c>
+
+// boris : those are needed to force typeinfo nodes to be created in here only
+logic_error::~logic_error() _STLP_NOTHROW_INHERENTLY {}
+runtime_error::~runtime_error() _STLP_NOTHROW_INHERENTLY {}
+domain_error::~domain_error() _STLP_NOTHROW_INHERENTLY {}
+invalid_argument::~invalid_argument() _STLP_NOTHROW_INHERENTLY {}
+length_error::~length_error() _STLP_NOTHROW_INHERENTLY {}
+out_of_range::~out_of_range() _STLP_NOTHROW_INHERENTLY {}
+range_error::~range_error() _STLP_NOTHROW_INHERENTLY {}
+overflow_error::~overflow_error() _STLP_NOTHROW_INHERENTLY {}
+underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {}
+
+#endif
+
+#if !defined(_STLP_WCE_EVC3)
+# if defined (_STLP_NO_BAD_ALLOC)
+const nothrow_t nothrow /* = {} */;
+# endif
+#endif
+
+#if !defined (_STLP_NO_FORCE_INSTANTIATE)
+
+# if defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template class _STLP_CLASS_DECLSPEC __stl_debug_engine<bool>;
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+template class _STLP_CLASS_DECLSPEC __debug_alloc<__node_alloc>;
+template class _STLP_CLASS_DECLSPEC __debug_alloc<__new_alloc>;
+
+//Export of the types used to represent buckets in the hashtable implementation.
+/*
+ * For the vector class we do not use any MSVC6 workaround even if we export it from
+ * the STLport dynamic libraries because we know what methods are called and none is
+ * a template method. Moreover the exported class is an instanciation of vector with
+ * _Slist_node_base struct that is an internal STLport class that no user should ever
+ * use.
+ */
+# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
+template class _STLP_CLASS_DECLSPEC allocator<_STLP_PRIV _Slist_node_base*>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
+ allocator<_Slist_node_base*> >;
+template class _STLP_CLASS_DECLSPEC _Vector_base<_Slist_node_base*,
+ allocator<_Slist_node_base*> >;
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+# if defined (_STLP_DEBUG)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_NAME(vector)<_Slist_node_base*,
+ allocator<_Slist_node_base*> >;
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+template class _STLP_CLASS_DECLSPEC vector<_STLP_PRIV _Slist_node_base*,
+ allocator<_STLP_PRIV _Slist_node_base*> >;
+//End of hashtable bucket types export.
+
+//Export of _Locale_impl facets container:
+# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
+template class _STLP_CLASS_DECLSPEC allocator<locale::facet*>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
+template class _STLP_CLASS_DECLSPEC _Vector_base<locale::facet*, allocator<locale::facet*> >;
+_STLP_MOVE_TO_STD_NAMESPACE
+
+# endif
+# if defined (_STLP_DEBUG)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
+template class _STLP_CLASS_DECLSPEC __construct_checker<_STLP_PRIV _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
+template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >;
+# undef _STLP_NON_DBG_VECTOR
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+template class _STLP_CLASS_DECLSPEC vector<locale::facet*, allocator<locale::facet*> >;
+//End of export of _Locale_impl facets container.
+
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+template class _STLP_CLASS_DECLSPEC allocator<void*>;
+
+typedef _STLP_PRIV _List_node<void*> _VoidPtr_Node;
+template class _STLP_CLASS_DECLSPEC allocator<_VoidPtr_Node>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void**, void*, allocator<void*> >;
+template class _STLP_CLASS_DECLSPEC _Vector_base<void*, allocator<void*> >;
+template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(vector)<void*, allocator<void*> >;
+
+template class _STLP_CLASS_DECLSPEC _List_node<void*>;
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_List_node_base, _VoidPtr_Node, allocator<_VoidPtr_Node> >;
+template class _STLP_CLASS_DECLSPEC _List_base<void*, allocator<void*> >;
+template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(list)<void*, allocator<void*> >;
+
+template class _STLP_CLASS_DECLSPEC _Slist_node<void*>;
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base, _Slist_node<void*>, allocator<_Slist_node<void*> > >;
+template class _STLP_CLASS_DECLSPEC _Slist_base<void*, allocator<void*> >;
+template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(slist)<void*, allocator<void*> >;
+
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void***, void**, allocator<void**> >;
+template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
+template class _STLP_CLASS_DECLSPEC _Deque_base<void*, allocator<void*> >;
+template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(deque)<void*, allocator<void*> >;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+# endif /* _STLP_USE_PTR_SPECIALIZATIONS */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template class _STLP_CLASS_DECLSPEC _Rb_global<bool>;
+template class _STLP_CLASS_DECLSPEC _List_global<bool>;
+
+template class _STLP_CLASS_DECLSPEC _Sl_global<bool>;
+template class _STLP_CLASS_DECLSPEC _Stl_prime<bool>;
+
+template class _STLP_CLASS_DECLSPEC _LimG<bool>;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif /* _STLP_NO_FORCE_INSTANTIATE */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY)
+extern "C" void _STLP_DECLSPEC _STLP_CALL _STLP_SIGNAL_RUNTIME_COMPATIBILITY() {}
+#endif
+
+#define FORCE_SYMBOL extern
+
+#if defined (_WIN32) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_USE_STATIC_LIB)
+// stlportmt.cpp : Defines the entry point for the DLL application.
+//
+# undef FORCE_SYMBOL
+# define FORCE_SYMBOL APIENTRY
+
+extern "C" {
+
+BOOL APIENTRY DllMain( HANDLE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID) {
+ switch (ul_reason_for_call) {
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls((HINSTANCE)hModule);
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
+} /* extern "C" */
+
+#if !defined (_STLP_MSVC) && !defined (__MINGW32__)
+_STLP_BEGIN_NAMESPACE
+
+static void FORCE_SYMBOL
+force_link() {
+ set<int>::iterator iter;
+ // _M_increment; _M_decrement instantiation
+ ++iter;
+ --iter;
+}
+
+_STLP_END_NAMESPACE
+#endif
+
+#endif /* _WIN32 */
+
+#if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
+# undef std
+
+namespace std
+{
+ void _STLP_CALL unexpected() {
+ unexpected_handler hdl;
+ set_unexpected(hdl = set_unexpected((unexpected_handler)0));
+ hdl();
+ }
+}
+#endif
diff --git a/src/facets_byname.cpp b/src/facets_byname.cpp
new file mode 100644
index 0000000..07d1a3d
--- /dev/null
+++ b/src/facets_byname.cpp
@@ -0,0 +1,1057 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <hash_map>
+#include <vector>
+
+#include <locale>
+#include <istream>
+
+#include <algorithm>
+#include <functional>
+
+#include "c_locale.h"
+#include "locale_impl.h"
+#include "acquire_release.h"
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// ctype_byname<char>
+
+#if defined (__DMC__)
+_STLP_DECLSPEC
+#endif
+ctype_byname<char>::ctype_byname(const char* name, size_t refs)
+ : ctype<char>( 0, false, refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_ctype = _STLP_PRIV __acquire_ctype(name, buf, 0, &__err_code);
+ if (!_M_ctype)
+ locale::_M_throw_on_creation_failure(__err_code, name, "ctype");
+
+ _M_init();
+}
+
+void ctype_byname<char>::_M_init() {
+ _M_ctype_table = _M_byname_table;
+
+ // We have to do this, instead of just pointer twiddling, because
+ // ctype_base::mask isn't the same type as _Locale_mask_t.
+ const _Locale_mask_t* p = _Locale_ctype_table(_M_ctype);
+ for (size_t i = 0; i != table_size; ++i) {
+ _M_byname_table[i] = ctype_base::mask(p[i]);
+ }
+}
+
+ctype_byname<char>::~ctype_byname()
+{ _STLP_PRIV __release_ctype(_M_ctype); }
+
+char ctype_byname<char>::do_toupper(char c) const
+{ return (char)_Locale_toupper(_M_ctype, c); }
+
+char ctype_byname<char>::do_tolower(char c) const
+{ return (char)_Locale_tolower(_M_ctype, c); }
+
+const char*
+ctype_byname<char>::do_toupper(char* first, const char* last) const {
+ for ( ; first != last ; ++first)
+ *first = (char)_Locale_toupper(_M_ctype, *first);
+ return last;
+}
+
+const char*
+ctype_byname<char>::do_tolower(char* first, const char* last) const {
+ for ( ; first != last ; ++first)
+ *first = (char)_Locale_tolower(_M_ctype, *first);
+ return last;
+}
+
+
+// Some helper functions used in ctype<>::scan_is and scan_is_not.
+#if !defined (_STLP_NO_WCHAR_T)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// ctype_byname<wchar_t>
+
+struct _Ctype_byname_w_is_mask : public unary_function<wchar_t, bool> {
+ _Locale_mask_t M;
+ _Locale_ctype* M_ctp;
+
+ _Ctype_byname_w_is_mask(_Locale_mask_t m, _Locale_ctype* c)
+ : M(m), M_ctp(c) {}
+ bool operator()(wchar_t c) const
+ { return _WLocale_ctype(M_ctp, c, M) != 0; }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (__DMC__)
+_STLP_DECLSPEC
+#endif
+ctype_byname<wchar_t>::ctype_byname(const char* name, size_t refs)
+ : ctype<wchar_t>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_ctype = _STLP_PRIV __acquire_ctype(name, buf, 0, &__err_code);
+ if (!_M_ctype)
+ locale::_M_throw_on_creation_failure(__err_code, name, "ctype");
+}
+
+ctype_byname<wchar_t>::~ctype_byname()
+{ _STLP_PRIV __release_ctype(_M_ctype); }
+
+bool ctype_byname<wchar_t>::do_is(ctype_base::mask m, wchar_t c) const
+{ return _WLocale_ctype(_M_ctype, c, (_Locale_mask_t)m) != 0; }
+
+const wchar_t*
+ctype_byname<wchar_t>::do_is(const wchar_t* low, const wchar_t* high,
+ ctype_base::mask * m) const {
+ _Locale_mask_t all_bits = _Locale_mask_t(ctype_base::space |
+ ctype_base::print |
+ ctype_base::cntrl |
+ ctype_base::upper |
+ ctype_base::lower |
+ ctype_base::alpha |
+ ctype_base::digit |
+ ctype_base::punct |
+ ctype_base::xdigit);
+
+ for ( ; low < high; ++low, ++m)
+ *m = ctype_base::mask (_WLocale_ctype(_M_ctype, *low, all_bits));
+ return high;
+}
+
+const wchar_t*
+ctype_byname<wchar_t>
+ ::do_scan_is(ctype_base::mask m, const wchar_t* low, const wchar_t* high) const
+{ return find_if(low, high, _STLP_PRIV _Ctype_byname_w_is_mask(m, _M_ctype)); }
+
+const wchar_t*
+ctype_byname<wchar_t>
+ ::do_scan_not(ctype_base::mask m, const wchar_t* low, const wchar_t* high) const
+{ return find_if(low, high, not1(_STLP_PRIV _Ctype_byname_w_is_mask(m, _M_ctype))); }
+
+wchar_t ctype_byname<wchar_t>::do_toupper(wchar_t c) const
+{ return _WLocale_toupper(_M_ctype, c); }
+
+const wchar_t*
+ctype_byname<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const {
+ for ( ; low < high; ++low)
+ *low = _WLocale_toupper(_M_ctype, *low);
+ return high;
+}
+
+wchar_t ctype_byname<wchar_t>::do_tolower(wchar_t c) const
+{ return _WLocale_tolower(_M_ctype, c); }
+
+const wchar_t*
+ctype_byname<wchar_t>::do_tolower(wchar_t* low, const wchar_t* high) const {
+ for ( ; low < high; ++low)
+ *low = _WLocale_tolower(_M_ctype, *low);
+ return high;
+}
+
+#endif /* WCHAR_T */
+
+// collate_byname<char>
+#if defined (__DMC__)
+_STLP_DECLSPEC
+#endif
+collate_byname<char>::collate_byname(const char* name, size_t refs)
+ : collate<char>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_collate = _STLP_PRIV __acquire_collate(name, buf, 0, &__err_code);
+ if (!_M_collate)
+ locale::_M_throw_on_creation_failure(__err_code, name, "collate");
+}
+
+collate_byname<char>::~collate_byname()
+{ _STLP_PRIV __release_collate(_M_collate); }
+
+int collate_byname<char>::do_compare(const char* __low1,
+ const char* __high1,
+ const char* __low2,
+ const char* __high2) const {
+ return _Locale_strcmp(_M_collate,
+ __low1, __high1 - __low1,
+ __low2, __high2 - __low2);
+}
+
+collate_byname<char>::string_type
+collate_byname<char>::do_transform(const char* low, const char* high) const {
+ if (low == high)
+ return string_type();
+
+ size_t n = _Locale_strxfrm(_M_collate, NULL, 0, low, high - low);
+
+ // NOT PORTABLE. What we're doing relies on internal details of the
+ // string implementation. (Contiguity of string elements and presence
+ // of trailing zero.)
+ string_type buf(n, 0);
+ _Locale_strxfrm(_M_collate, &(*buf.begin()), n + 1, low, high - low);
+ return buf;
+}
+
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+// collate_byname<wchar_t>
+
+#if defined (__DMC__)
+_STLP_DECLSPEC
+#endif
+collate_byname<wchar_t>::collate_byname(const char* name, size_t refs)
+ : collate<wchar_t>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_collate = _STLP_PRIV __acquire_collate(name, buf, 0, &__err_code);
+ if (!_M_collate)
+ locale::_M_throw_on_creation_failure(__err_code, name, "collate");
+}
+
+collate_byname<wchar_t>::~collate_byname()
+{ _STLP_PRIV __release_collate(_M_collate); }
+
+int collate_byname<wchar_t>::do_compare(const wchar_t* low1,
+ const wchar_t* high1,
+ const wchar_t* low2,
+ const wchar_t* high2) const {
+ return _WLocale_strcmp(_M_collate,
+ low1, high1 - low1,
+ low2, high2 - low2);
+}
+
+collate_byname<wchar_t>::string_type
+collate_byname<wchar_t>::do_transform(const wchar_t* low,
+ const wchar_t* high) const {
+ if (low == high)
+ return string_type();
+
+ size_t n = _WLocale_strxfrm(_M_collate, NULL, 0, low, high - low);
+
+ // NOT PORTABLE. What we're doing relies on internal details of the
+ // string implementation. (Contiguity of string elements and presence
+ // of trailing zero.)
+ string_type buf(n, 0);
+ _WLocale_strxfrm(_M_collate, &(*buf.begin()), n + 1, low, high - low);
+ return buf;
+}
+
+#endif /* _STLP_NO_WCHAR_T */
+
+//----------------------------------------------------------------------
+// codecvt_byname<char>
+
+codecvt_byname<char, char, mbstate_t>
+ ::codecvt_byname(const char* name, size_t refs)
+ : codecvt<char, char, mbstate_t>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+}
+
+codecvt_byname<char, char, mbstate_t>::~codecvt_byname() {}
+
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+//----------------------------------------------------------------------
+// codecvt_byname<wchar_t>
+codecvt_byname<wchar_t, char, mbstate_t>::codecvt_byname(const char* name, size_t refs)
+ : codecvt<wchar_t, char, mbstate_t>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_codecvt = _STLP_PRIV __acquire_codecvt(name, buf, 0, &__err_code);
+ if (!_M_codecvt)
+ locale::_M_throw_on_creation_failure(__err_code, name, "ctype");
+}
+
+codecvt_byname<wchar_t, char, mbstate_t>::~codecvt_byname()
+{ _STLP_PRIV __release_codecvt(_M_codecvt); }
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt_byname<wchar_t, char, mbstate_t>::do_out(state_type& state,
+ const intern_type* from,
+ const intern_type* from_end,
+ const intern_type*& from_next,
+ extern_type* to,
+ extern_type* to_limit,
+ extern_type*& to_next) const {
+ while (from != from_end && to != to_limit) {
+ size_t chars_stored = _WLocale_wctomb(_M_codecvt,
+ to, to_limit - to, *from,
+ &state);
+ if (chars_stored == (size_t) -1) {
+ from_next = from;
+ to_next = to;
+ return error;
+ }
+ else if (chars_stored == (size_t) -2) {
+ from_next = from;
+ to_next = to;
+ return partial;
+ }
+
+ ++from;
+ to += chars_stored;
+ }
+
+ from_next = from;
+ to_next = to;
+ return ok;
+}
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt_byname<wchar_t, char, mbstate_t>::do_in(state_type& state,
+ const extern_type* from,
+ const extern_type* from_end,
+ const extern_type*& from_next,
+ intern_type* to,
+ intern_type* to_end,
+ intern_type*& to_next) const {
+ while (from != from_end && to != to_end) {
+ size_t chars_read = _WLocale_mbtowc(_M_codecvt,
+ to, from, from_end - from,
+ &state);
+ if (chars_read == (size_t) -1) {
+ from_next = from;
+ to_next = to;
+ return error;
+ }
+
+ if (chars_read == (size_t) -2) {
+ from_next = from;
+ to_next = to;
+ return partial;
+ }
+
+ from += chars_read;
+ to++;
+ }
+
+ from_next = from;
+ to_next = to;
+ return ok;
+}
+
+codecvt<wchar_t, char, mbstate_t>::result
+codecvt_byname<wchar_t, char, mbstate_t>::do_unshift(state_type& state,
+ extern_type* to,
+ extern_type* to_limit,
+ extern_type*& to_next) const {
+ to_next = to;
+ size_t result = _WLocale_unshift(_M_codecvt, &state,
+ to, to_limit - to, &to_next);
+ if (result == (size_t) -1)
+ return error;
+ else if (result == (size_t) -2)
+ return partial;
+ else
+# if defined (__ISCPP__)
+ return /*to_next == to ? noconv :*/ ok;
+# else
+ return to_next == to ? noconv : ok;
+# endif
+}
+
+int
+codecvt_byname<wchar_t, char, mbstate_t>::do_encoding() const _STLP_NOTHROW {
+ if (_WLocale_is_stateless(_M_codecvt)) {
+ int max_width = _WLocale_mb_cur_max(_M_codecvt);
+ int min_width = _WLocale_mb_cur_min(_M_codecvt);
+ return min_width == max_width ? min_width : 0;
+ }
+ else
+ return -1;
+}
+
+bool
+codecvt_byname<wchar_t, char, mbstate_t>::do_always_noconv() const _STLP_NOTHROW
+{ return false; }
+
+int
+codecvt_byname<wchar_t, char, mbstate_t>::do_length(state_type& state,
+ const extern_type* from,
+ const extern_type* end,
+ size_t mx) const {
+ size_t __count = 0;
+ while (from != end && mx--) {
+ intern_type __dummy;
+ size_t chars_read = _WLocale_mbtowc(_M_codecvt,
+ &__dummy, from, end - from,
+ &state);
+ if ((chars_read == (size_t) -1) || (chars_read == (size_t) -2)) // error or partial
+ break;
+ __count += chars_read;
+ from += chars_read;
+ }
+ return int(__count);
+}
+
+int
+codecvt_byname<wchar_t, char, mbstate_t>::do_max_length() const _STLP_NOTHROW
+{ return _WLocale_mb_cur_max(_M_codecvt); }
+#endif
+
+// numpunct_byname<char>
+numpunct_byname<char>::numpunct_byname(const char* name, size_t refs)
+: numpunct<char>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_numeric = _STLP_PRIV __acquire_numeric(name, buf, 0, &__err_code);
+ if (!_M_numeric)
+ locale::_M_throw_on_creation_failure(__err_code, name, "numpunct");
+}
+
+numpunct_byname<char>::~numpunct_byname()
+{ _STLP_PRIV __release_numeric(_M_numeric); }
+
+char numpunct_byname<char>::do_decimal_point() const
+{ return _Locale_decimal_point(_M_numeric); }
+
+char numpunct_byname<char>::do_thousands_sep() const
+{ return _Locale_thousands_sep(_M_numeric); }
+
+string numpunct_byname<char>::do_grouping() const {
+ const char * __grouping = _Locale_grouping(_M_numeric);
+ if (__grouping != NULL && __grouping[0] == CHAR_MAX)
+ __grouping = "";
+ return __grouping;
+}
+
+string numpunct_byname<char>::do_truename() const
+{ return _Locale_true(_M_numeric); }
+
+string numpunct_byname<char>::do_falsename() const
+{ return _Locale_false(_M_numeric); }
+
+//----------------------------------------------------------------------
+// numpunct<wchar_t>
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+// numpunct_byname<wchar_t>
+
+numpunct_byname<wchar_t>::numpunct_byname(const char* name, size_t refs)
+: numpunct<wchar_t>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_numeric = _STLP_PRIV __acquire_numeric(name, buf, 0, &__err_code);
+ if (!_M_numeric)
+ locale::_M_throw_on_creation_failure(__err_code, name, "numpunct");
+}
+
+numpunct_byname<wchar_t>::~numpunct_byname()
+{ _STLP_PRIV __release_numeric(_M_numeric); }
+
+wchar_t numpunct_byname<wchar_t>::do_decimal_point() const
+{ return _WLocale_decimal_point(_M_numeric); }
+
+wchar_t numpunct_byname<wchar_t>::do_thousands_sep() const
+{ return _WLocale_thousands_sep(_M_numeric); }
+
+string numpunct_byname<wchar_t>::do_grouping() const {
+ const char * __grouping = _Locale_grouping(_M_numeric);
+ if (__grouping != NULL && __grouping[0] == CHAR_MAX)
+ __grouping = "";
+ return __grouping;
+}
+
+wstring numpunct_byname<wchar_t>::do_truename() const {
+ wchar_t buf[16];
+ return _WLocale_true(_M_numeric, _STLP_ARRAY_AND_SIZE(buf));
+}
+
+wstring numpunct_byname<wchar_t>::do_falsename() const {
+ wchar_t buf[16];
+ return _WLocale_false(_M_numeric, _STLP_ARRAY_AND_SIZE(buf));
+}
+
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+static void _Init_monetary_formats(money_base::pattern& pos_format,
+ money_base::pattern& neg_format,
+ _Locale_monetary * monetary) {
+ switch (_Locale_p_sign_posn(monetary)) {
+ case 0: // Parentheses surround the quantity and currency symbol
+ case 1: // The sign string precedes the quantity and currency symbol
+ pos_format.field[0] = (char) money_base::sign;
+ if (_Locale_p_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a positive value
+ pos_format.field[1] = (char) money_base::symbol;
+ if (_Locale_p_sep_by_space(monetary)) {
+ // a space separates currency symbol from a positive value.
+ pos_format.field[2] = (char) money_base::space;
+ pos_format.field[3] = (char) money_base::value;
+ } else {
+ // a space not separates currency symbol from a positive value.
+ pos_format.field[2] = (char) money_base::value;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ } else {
+ // 0 if currency symbol succeeds a positive value
+ pos_format.field[1] = (char) money_base::value;
+ if (_Locale_p_sep_by_space(monetary)) {
+ // a space separates currency symbol from a positive value.
+ pos_format.field[2] = (char) money_base::space;
+ pos_format.field[3] = (char) money_base::symbol;
+ } else {
+ // a space not separates currency symbol from a positive value.
+ pos_format.field[2] = (char) money_base::symbol;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ }
+ break;
+ case 2: // The sign string succeeds the quantity and currency symbol.
+ if (_Locale_p_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a positive value
+ pos_format.field[0] = (char) money_base::symbol;
+ if (_Locale_p_sep_by_space(monetary)) {
+ // a space separates currency symbol from a positive value.
+ pos_format.field[1] = (char) money_base::space;
+ pos_format.field[2] = (char) money_base::value;
+ pos_format.field[3] = (char) money_base::sign;
+ } else {
+ // a space not separates currency symbol from a positive value.
+ pos_format.field[1] = (char) money_base::value;
+ pos_format.field[2] = (char) money_base::sign;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ } else {
+ // 0 if currency symbol succeeds a positive value
+ pos_format.field[0] = (char) money_base::value;
+ if (_Locale_p_sep_by_space(monetary)) {
+ // a space separates currency symbol from a positive value.
+ pos_format.field[1] = (char) money_base::space;
+ pos_format.field[2] = (char) money_base::symbol;
+ pos_format.field[3] = (char) money_base::sign;
+ } else {
+ // a space not separates currency symbol from a positive value.
+ pos_format.field[1] = (char) money_base::symbol;
+ pos_format.field[2] = (char) money_base::sign;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ }
+ break;
+ case 3: // The sign string immediately precedes the currency symbol.
+ if (_Locale_p_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a positive value
+ pos_format.field[0] = (char) money_base::sign;
+ pos_format.field[1] = (char) money_base::symbol;
+ if (_Locale_p_sep_by_space(monetary)) {
+ // a space separates currency symbol from a positive value.
+ pos_format.field[2] = (char) money_base::space;
+ pos_format.field[3] = (char) money_base::value;
+ } else {
+ // a space not separates currency symbol from a positive value.
+ pos_format.field[2] = (char) money_base::value;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ } else {
+ // 0 if currency symbol succeeds a positive value
+ pos_format.field[0] = (char) money_base::value;
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::symbol;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ break;
+ case 4: // The sign string immediately succeeds the currency symbol.
+ if (_Locale_p_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a positive value
+ pos_format.field[0] = (char) money_base::symbol;
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::value;
+ pos_format.field[3] = (char) money_base::none;
+ } else {
+ // 0 if currency symbol succeeds a positive value
+ pos_format.field[0] = (char) money_base::value;
+ if (_Locale_p_sep_by_space(monetary)) {
+ // a space separates currency symbol from a positive value.
+ pos_format.field[1] = (char) money_base::space;
+ pos_format.field[2] = (char) money_base::symbol;
+ pos_format.field[3] = (char) money_base::sign;
+ } else {
+ // a space not separates currency symbol from a positive value.
+ pos_format.field[1] = (char) money_base::symbol;
+ pos_format.field[2] = (char) money_base::sign;
+ pos_format.field[3] = (char) money_base::none;
+ }
+ }
+ break;
+ default: // Default C++ Standard format
+ pos_format.field[0] = (char) money_base::symbol;
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::none;
+ pos_format.field[3] = (char) money_base::value;
+ break;
+ }
+
+ switch (_Locale_n_sign_posn(monetary)) {
+ case 0: // Parentheses surround the quantity and currency symbol
+ case 1: // The sign string precedes the quantity and currency symbol
+ neg_format.field[0] = (char) money_base::sign;
+ if (_Locale_n_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a negative value
+ neg_format.field[1] = (char) money_base::symbol;
+ if (_Locale_n_sep_by_space(monetary)) {
+ // a space separates currency symbol from a negative value.
+ neg_format.field[2] = (char) money_base::space;
+ neg_format.field[3] = (char) money_base::value;
+ } else {
+ // a space not separates currency symbol from a negative value.
+ neg_format.field[2] = (char) money_base::value;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ } else {
+ // 0 if currency symbol succeeds a negative value
+ neg_format.field[1] = (char) money_base::value;
+ if (_Locale_n_sep_by_space(monetary)) {
+ // a space separates currency symbol from a negative value.
+ neg_format.field[2] = (char) money_base::space;
+ neg_format.field[3] = (char) money_base::symbol;
+ } else {
+ // a space not separates currency symbol from a negative value.
+ neg_format.field[2] = (char) money_base::symbol;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ }
+ break;
+ case 2: // The sign string succeeds the quantity and currency symbol.
+ if (_Locale_n_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a negative value
+ neg_format.field[0] = (char) money_base::symbol;
+ if (_Locale_n_sep_by_space(monetary)) {
+ // a space separates currency symbol from a negative value.
+ neg_format.field[1] = (char) money_base::space;
+ neg_format.field[2] = (char) money_base::value;
+ neg_format.field[3] = (char) money_base::sign;
+ } else {
+ // a space not separates currency symbol from a negative value.
+ neg_format.field[1] = (char) money_base::value;
+ neg_format.field[2] = (char) money_base::sign;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ } else {
+ // 0 if currency symbol succeeds a negative value
+ neg_format.field[0] = (char) money_base::value;
+ if (_Locale_n_sep_by_space(monetary)) {
+ // a space separates currency symbol from a negative value.
+ neg_format.field[1] = (char) money_base::space;
+ neg_format.field[2] = (char) money_base::symbol;
+ neg_format.field[3] = (char) money_base::sign;
+ } else {
+ // a space not separates currency symbol from a negative value.
+ neg_format.field[1] = (char) money_base::symbol;
+ neg_format.field[2] = (char) money_base::sign;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ }
+ break;
+ case 3: // The sign string immediately precedes the currency symbol.
+ if (_Locale_n_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a negative value
+ neg_format.field[0] = (char) money_base::sign;
+ neg_format.field[1] = (char) money_base::symbol;
+ if (_Locale_n_sep_by_space(monetary)) {
+ // a space separates currency symbol from a negative value.
+ neg_format.field[2] = (char) money_base::space;
+ neg_format.field[3] = (char) money_base::value;
+ } else {
+ // a space not separates currency symbol from a negative value.
+ neg_format.field[2] = (char) money_base::value;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ } else {
+ // 0 if currency symbol succeeds a negative value
+ neg_format.field[0] = (char) money_base::value;
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::symbol;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ break;
+ case 4: // The sign string immediately succeeds the currency symbol.
+ if (_Locale_n_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a negative value
+ neg_format.field[0] = (char) money_base::symbol;
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::none;
+ neg_format.field[3] = (char) money_base::value;
+ } else {
+ // 0 if currency symbol succeeds a negative value
+ neg_format.field[0] = (char) money_base::value;
+ if (_Locale_n_sep_by_space(monetary)) {
+ // a space separates currency symbol from a negative value.
+ neg_format.field[1] = (char) money_base::space;
+ neg_format.field[2] = (char) money_base::symbol;
+ neg_format.field[3] = (char) money_base::sign;
+ } else {
+ // a space not separates currency symbol from a negative value.
+ neg_format.field[1] = (char) money_base::symbol;
+ neg_format.field[2] = (char) money_base::sign;
+ neg_format.field[3] = (char) money_base::none;
+ }
+ }
+ break;
+ default: // Default C++ Standard format
+ neg_format.field[0] = (char) money_base::symbol;
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::none;
+ neg_format.field[3] = (char) money_base::value;
+ break;
+ }
+}
+
+// international variant of monetary
+
+/*
+ * int_curr_symbol
+ *
+ * The international currency symbol. The operand is a four-character
+ * string, with the first three characters containing the alphabetic
+ * international currency symbol in accordance with those specified
+ * in the ISO 4217 specification. The fourth character is the character used
+ * to separate the international currency symbol from the monetary quantity.
+ *
+ * (http://www.opengroup.org/onlinepubs/7990989775/xbd/locale.html)
+ */
+
+/*
+ * Standards are unclear in the usage of international currency
+ * and monetary formats.
+ * But I am expect that international currency symbol should be the first
+ * (not depends upon where currency symbol situated in the national
+ * format).
+ *
+ * If this isn't so, let's see:
+ * 1 234.56 RUR
+ * GBP 1,234.56
+ * USD 1,234.56
+ * The situation really is worse than you see above:
+ * RUR typed wrong here---it prints '1 234.56 RUR ' (see space after RUR).
+ * This is due to intl_fmp.curr_symbol() == "RUR ". (see reference in comments
+ * above).
+ *
+ */
+
+static void _Init_monetary_formats_int(money_base::pattern& pos_format,
+ money_base::pattern& neg_format,
+ _Locale_monetary * monetary)
+{
+
+ switch (_Locale_p_sign_posn(monetary)) {
+ case 0: // Parentheses surround the quantity and currency symbol
+ case 1: // The sign string precedes the quantity and currency symbol
+ pos_format.field[0] = (char) money_base::symbol;
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::value;
+ pos_format.field[3] = (char) money_base::none;
+ break;
+ case 2: // The sign string succeeds the quantity and currency symbol.
+ pos_format.field[0] = (char) money_base::symbol;
+ pos_format.field[1] = (char) money_base::value;
+ pos_format.field[2] = (char) money_base::sign;
+ pos_format.field[3] = (char) money_base::none;
+ break;
+ case 3: // The sign string immediately precedes the currency symbol.
+ case 4: // The sign string immediately succeeds the currency symbol.
+ pos_format.field[0] = (char) money_base::symbol;
+ if (_Locale_p_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a positive value
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::value;
+ } else {
+ // 0 if currency symbol succeeds a positive value
+ pos_format.field[1] = (char) money_base::value;
+ pos_format.field[2] = (char) money_base::sign;
+ }
+ pos_format.field[3] = (char) money_base::none;
+ break;
+ default: // Default C++ Standard format
+ pos_format.field[0] = (char) money_base::symbol;
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::none;
+ pos_format.field[3] = (char) money_base::value;
+ break;
+ }
+
+
+ switch (_Locale_n_sign_posn(monetary)) {
+ case 0: // Parentheses surround the quantity and currency symbol
+ case 1: // The sign string precedes the quantity and currency symbol
+ neg_format.field[0] = (char) money_base::symbol;
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::value;
+ neg_format.field[3] = (char) money_base::none;
+ break;
+ case 2: // The sign string succeeds the quantity and currency symbol.
+ neg_format.field[0] = (char) money_base::symbol;
+ neg_format.field[1] = (char) money_base::value;
+ neg_format.field[2] = (char) money_base::sign;
+ neg_format.field[3] = (char) money_base::none;
+ break;
+ case 3: // The sign string immediately precedes the currency symbol.
+ case 4: // The sign string immediately succeeds the currency symbol.
+ neg_format.field[0] = (char) money_base::symbol;
+ if (_Locale_n_cs_precedes(monetary)) {
+ // 1 if currency symbol precedes a negative value
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::value;
+ } else {
+ // 0 if currency symbol succeeds a negative value
+ neg_format.field[1] = (char) money_base::value;
+ neg_format.field[2] = (char) money_base::sign;
+ }
+ neg_format.field[3] = (char) money_base::none;
+ break;
+ default: // Default C++ Standard format
+ neg_format.field[0] = (char) money_base::symbol;
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::none;
+ neg_format.field[3] = (char) money_base::value;
+ break;
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//
+// moneypunct_byname<>
+//
+moneypunct_byname<char, true>::moneypunct_byname(const char * name,
+ size_t refs)
+ : moneypunct<char, true>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_monetary = _STLP_PRIV __acquire_monetary(name, buf, 0, &__err_code);
+ if (!_M_monetary)
+ locale::_M_throw_on_creation_failure(__err_code, name, "moneypunct");
+
+ _STLP_PRIV _Init_monetary_formats_int(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<char, true>::moneypunct_byname(_Locale_monetary *__mon)
+ : _M_monetary(__mon) {
+ _STLP_PRIV _Init_monetary_formats_int(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<char, true>::~moneypunct_byname()
+{ _STLP_PRIV __release_monetary(_M_monetary); }
+
+char moneypunct_byname<char, true>::do_decimal_point() const
+{ return _Locale_mon_decimal_point(_M_monetary); }
+
+char moneypunct_byname<char, true>::do_thousands_sep() const
+{ return _Locale_mon_thousands_sep(_M_monetary); }
+
+string moneypunct_byname<char, true>::do_grouping() const
+{ return _Locale_mon_grouping(_M_monetary); }
+
+string moneypunct_byname<char, true>::do_curr_symbol() const
+{ return _Locale_int_curr_symbol(_M_monetary); }
+
+string moneypunct_byname<char, true>::do_positive_sign() const
+{ return _Locale_positive_sign(_M_monetary); }
+
+string moneypunct_byname<char, true>::do_negative_sign() const
+{ return _Locale_negative_sign(_M_monetary); }
+
+int moneypunct_byname<char, true>::do_frac_digits() const
+{ return _Locale_int_frac_digits(_M_monetary); }
+
+moneypunct_byname<char, false>::moneypunct_byname(const char * name,
+ size_t refs)
+ : moneypunct<char, false>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_monetary = _STLP_PRIV __acquire_monetary(name, buf, 0, &__err_code);
+ if (!_M_monetary)
+ locale::_M_throw_on_creation_failure(__err_code, name, "moneypunct");
+
+ _STLP_PRIV _Init_monetary_formats(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<char, false>::moneypunct_byname(_Locale_monetary *__mon)
+ : _M_monetary(__mon) {
+ _STLP_PRIV _Init_monetary_formats(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<char, false>::~moneypunct_byname()
+{ _STLP_PRIV __release_monetary(_M_monetary); }
+
+char moneypunct_byname<char, false>::do_decimal_point() const
+{ return _Locale_mon_decimal_point(_M_monetary); }
+
+char moneypunct_byname<char, false>::do_thousands_sep() const
+{ return _Locale_mon_thousands_sep(_M_monetary); }
+
+string moneypunct_byname<char, false>::do_grouping() const
+{ return _Locale_mon_grouping(_M_monetary); }
+
+string moneypunct_byname<char, false>::do_curr_symbol() const
+{ return _Locale_currency_symbol(_M_monetary); }
+
+string moneypunct_byname<char, false>::do_positive_sign() const
+{ return _Locale_positive_sign(_M_monetary); }
+
+string moneypunct_byname<char, false>::do_negative_sign() const
+{ return _Locale_negative_sign(_M_monetary); }
+
+int moneypunct_byname<char, false>::do_frac_digits() const
+{ return _Locale_frac_digits(_M_monetary); }
+
+//
+// moneypunct_byname<wchar_t>
+//
+#if !defined (_STLP_NO_WCHAR_T)
+
+moneypunct_byname<wchar_t, true>::moneypunct_byname(const char * name,
+ size_t refs)
+ : moneypunct<wchar_t, true>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_monetary = _STLP_PRIV __acquire_monetary(name, buf, 0, &__err_code);
+ if (!_M_monetary)
+ locale::_M_throw_on_creation_failure(__err_code, name, "moneypunct");
+
+ _STLP_PRIV _Init_monetary_formats_int(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<wchar_t, true>::moneypunct_byname(_Locale_monetary *__mon)
+ : _M_monetary(__mon) {
+ _STLP_PRIV _Init_monetary_formats_int(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<wchar_t, true>::~moneypunct_byname()
+{ _STLP_PRIV __release_monetary(_M_monetary); }
+
+wchar_t moneypunct_byname<wchar_t, true>::do_decimal_point() const
+{ return _Locale_mon_decimal_point(_M_monetary); }
+
+wchar_t moneypunct_byname<wchar_t, true>::do_thousands_sep() const
+{ return _Locale_mon_thousands_sep(_M_monetary); }
+
+string moneypunct_byname<wchar_t, true>::do_grouping() const
+{ return _Locale_mon_grouping(_M_monetary); }
+
+inline wstring __do_widen (string const& str) {
+#if defined (_STLP_NO_MEMBER_TEMPLATES) || defined (_STLP_MSVC)
+ wstring::_Reserve_t __Reserve;
+ size_t __size = str.size();
+ wstring result(__Reserve, __size);
+ copy(str.begin(), str.end(), result.begin());
+#else
+ wstring result(str.begin(), str.end());
+#endif
+ return result;
+}
+
+wstring moneypunct_byname<wchar_t, true>::do_curr_symbol() const
+{ wchar_t buf[16]; return _WLocale_int_curr_symbol(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); }
+
+wstring moneypunct_byname<wchar_t, true>::do_positive_sign() const
+{ wchar_t buf[16]; return _WLocale_positive_sign(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); }
+
+wstring moneypunct_byname<wchar_t, true>::do_negative_sign() const
+{ wchar_t buf[16]; return _WLocale_negative_sign(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); }
+
+int moneypunct_byname<wchar_t, true>::do_frac_digits() const
+{ return _Locale_int_frac_digits(_M_monetary); }
+
+moneypunct_byname<wchar_t, false>::moneypunct_byname(const char * name,
+ size_t refs)
+ : moneypunct<wchar_t, false>(refs) {
+ if (!name)
+ locale::_M_throw_on_null_name() ;
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_monetary = _STLP_PRIV __acquire_monetary(name, buf, 0, &__err_code);
+ if (!_M_monetary)
+ locale::_M_throw_on_creation_failure(__err_code, name, "moneypunct");
+
+ _STLP_PRIV _Init_monetary_formats(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<wchar_t, false>::moneypunct_byname(_Locale_monetary *__mon)
+ : _M_monetary(__mon) {
+ _STLP_PRIV _Init_monetary_formats(_M_pos_format, _M_neg_format, _M_monetary);
+}
+
+moneypunct_byname<wchar_t, false>::~moneypunct_byname()
+{ _STLP_PRIV __release_monetary(_M_monetary); }
+
+wchar_t moneypunct_byname<wchar_t, false>::do_decimal_point() const
+{ return _Locale_mon_decimal_point(_M_monetary); }
+
+wchar_t moneypunct_byname<wchar_t, false>::do_thousands_sep() const
+{ return _Locale_mon_thousands_sep(_M_monetary); }
+
+string moneypunct_byname<wchar_t, false>::do_grouping() const
+{ return _Locale_mon_grouping(_M_monetary); }
+
+wstring moneypunct_byname<wchar_t, false>::do_curr_symbol() const
+{ wchar_t buf[16]; return _WLocale_currency_symbol(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); }
+
+wstring moneypunct_byname<wchar_t, false>::do_positive_sign() const
+{ wchar_t buf[16]; return _WLocale_positive_sign(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); }
+
+wstring moneypunct_byname<wchar_t, false>::do_negative_sign() const
+{ wchar_t buf[16]; return _WLocale_negative_sign(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); }
+
+int moneypunct_byname<wchar_t, false>::do_frac_digits() const
+{ return _Locale_frac_digits(_M_monetary); }
+
+#endif
+
+_STLP_END_NAMESPACE
+
diff --git a/src/fstream.cpp b/src/fstream.cpp
new file mode 100644
index 0000000..81543bb
--- /dev/null
+++ b/src/fstream.cpp
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#ifdef _STLP_USE_UNIX_IO
+# include "details/fstream_unistd.cpp"
+#elif defined(_STLP_USE_STDIO_IO)
+# include "details/fstream_stdio.cpp"
+#elif defined(_STLP_USE_WIN32_IO)
+# include "details/fstream_win32io.cpp"
+#else
+# error "Can't recognize IO scheme to use"
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// fbp : let us map 1 MB maximum, just be sure not to trash VM
+#define MMAP_CHUNK 0x100000L
+
+_Underflow< char, char_traits<char> >::int_type _STLP_CALL
+_Underflow< char, char_traits<char> >::_M_doit(basic_filebuf<char, char_traits<char> >* __this)
+{
+ typedef char_traits<char> traits_type;
+ typedef traits_type::int_type int_type;
+
+ if (!__this->_M_in_input_mode) {
+ if (!__this->_M_switch_to_input_mode())
+ return traits_type::eof();
+ }
+ else if (__this->_M_in_putback_mode) {
+ __this->_M_exit_putback_mode();
+ if (__this->gptr() != __this->egptr()) {
+ int_type __c = traits_type::to_int_type(*__this->gptr());
+ return __c;
+ }
+ }
+
+ // If it's a disk file, and if the internal and external character
+ // sequences are guaranteed to be identical, then try to use memory
+ // mapped I/O. Otherwise, revert to ordinary read.
+ if (__this->_M_base.__regular_file()
+ && __this->_M_always_noconv
+ && __this->_M_base._M_in_binary_mode()) {
+ // If we've mmapped part of the file already, then unmap it.
+ if (__this->_M_mmap_base)
+ __this->_M_base._M_unmap(__this->_M_mmap_base, __this->_M_mmap_len);
+
+ // Determine the position where we start mapping. It has to be
+ // a multiple of the page size.
+ streamoff __cur = __this->_M_base._M_seek(0, ios_base::cur);
+ streamoff __size = __this->_M_base._M_file_size();
+ if (__size > 0 && __cur >= 0 && __cur < __size) {
+ streamoff __offset = (__cur / __this->_M_base.__page_size()) * __this->_M_base.__page_size();
+ streamoff __remainder = __cur - __offset;
+
+ __this->_M_mmap_len = __size - __offset;
+
+ if (__this->_M_mmap_len > MMAP_CHUNK)
+ __this->_M_mmap_len = MMAP_CHUNK;
+
+ if ((__this->_M_mmap_base = __this->_M_base._M_mmap(__offset, __this->_M_mmap_len)) != 0) {
+ __this->setg(__STATIC_CAST(char*, __this->_M_mmap_base),
+ __STATIC_CAST(char*, __this->_M_mmap_base) + __STATIC_CAST(ptrdiff_t, __remainder),
+ __STATIC_CAST(char*, __this->_M_mmap_base) + __STATIC_CAST(ptrdiff_t, __this->_M_mmap_len));
+ return traits_type::to_int_type(*__this->gptr());
+ }
+ else
+ __this->_M_mmap_len = 0;
+ }
+ else {
+ __this->_M_mmap_base = 0;
+ __this->_M_mmap_len = 0;
+ }
+ }
+
+ return __this->_M_underflow_aux();
+}
+
+//----------------------------------------------------------------------
+// Force instantiation of filebuf and fstream classes.
+#if !defined(_STLP_NO_FORCE_INSTANTIATE)
+
+template class basic_filebuf<char, char_traits<char> >;
+template class basic_ifstream<char, char_traits<char> >;
+template class basic_ofstream<char, char_traits<char> >;
+template class basic_fstream<char, char_traits<char> >;
+
+# if !defined (_STLP_NO_WCHAR_T)
+template class _Underflow<wchar_t, char_traits<wchar_t> >;
+template class basic_filebuf<wchar_t, char_traits<wchar_t> >;
+template class basic_ifstream<wchar_t, char_traits<wchar_t> >;
+template class basic_ofstream<wchar_t, char_traits<wchar_t> >;
+template class basic_fstream<wchar_t, char_traits<wchar_t> >;
+# endif /* _STLP_NO_WCHAR_T */
+
+#endif
+
+_STLP_END_NAMESPACE
diff --git a/src/ios.cpp b/src/ios.cpp
new file mode 100644
index 0000000..cb35e0b
--- /dev/null
+++ b/src/ios.cpp
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <algorithm>
+#include <ios>
+#include <locale>
+#include <ostream> // for __get_ostreambuf definition
+
+#include "aligned_buffer.h"
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// ios_base members
+
+// class ios_base::failure, a subclass of exception. It's used solely
+// for reporting errors.
+
+ios_base::failure::failure(const string& s)
+ : __Named_exception(s)
+{}
+
+ios_base::failure::~failure() _STLP_NOTHROW_INHERENTLY {}
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+// Definitions of ios_base's formatting flags.
+const ios_base::fmtflags ios_base::left;
+const ios_base::fmtflags ios_base::right;
+const ios_base::fmtflags ios_base::internal;
+const ios_base::fmtflags ios_base::dec;
+const ios_base::fmtflags ios_base::hex;
+const ios_base::fmtflags ios_base::oct;
+const ios_base::fmtflags ios_base::fixed;
+const ios_base::fmtflags ios_base::scientific;
+const ios_base::fmtflags ios_base::boolalpha;
+const ios_base::fmtflags ios_base::showbase;
+const ios_base::fmtflags ios_base::showpoint;
+const ios_base::fmtflags ios_base::showpos;
+const ios_base::fmtflags ios_base::skipws;
+const ios_base::fmtflags ios_base::unitbuf;
+const ios_base::fmtflags ios_base::uppercase;
+const ios_base::fmtflags ios_base::adjustfield;
+const ios_base::fmtflags ios_base::basefield;
+const ios_base::fmtflags ios_base::floatfield;
+
+// Definitions of ios_base's state flags.
+const ios_base::iostate ios_base::goodbit;
+const ios_base::iostate ios_base::badbit;
+const ios_base::iostate ios_base::eofbit;
+const ios_base::iostate ios_base::failbit;
+
+// Definitions of ios_base's openmode flags.
+const ios_base::openmode ios_base::app;
+const ios_base::openmode ios_base::ate;
+const ios_base::openmode ios_base::binary;
+const ios_base::openmode ios_base::in;
+const ios_base::openmode ios_base::out;
+const ios_base::openmode ios_base::trunc;
+
+// Definitions of ios_base's seekdir flags.
+const ios_base::seekdir ios_base::beg;
+const ios_base::seekdir ios_base::cur;
+const ios_base::seekdir ios_base::end;
+
+#endif
+
+// Internal functions used for managing exponentially-growing arrays of
+// POD types.
+
+// array is a pointer to N elements of type PODType. Expands the array,
+// if necessary, so that array[index] is meaningful. All new elements are
+// initialized to zero. Returns a pointer to the new array, and the new
+// size.
+
+template <class PODType>
+static pair<PODType*, size_t>
+_Stl_expand_array(PODType* __array, size_t N, int index) {
+ if ((int)N < index + 1) {
+ size_t new_N = (max)(2 * N, size_t(index + 1));
+ PODType* new_array
+ = __STATIC_CAST(PODType*,realloc(__array, new_N * sizeof(PODType)));
+ if (new_array) {
+ fill(new_array + N, new_array + new_N, PODType());
+ return pair<PODType*, size_t>(new_array, new_N);
+ }
+ else
+ return pair<PODType*, size_t>(__STATIC_CAST(PODType*,0), 0);
+ }
+ else
+ return pair<PODType*, size_t>(__array, N);
+}
+
+// array is a pointer to N elements of type PODType. Allocate a new
+// array of N elements, copying the values from the old array to the new.
+// Return a pointer to the new array. It is assumed that array is non-null
+// and N is nonzero.
+template <class PODType>
+static PODType* _Stl_copy_array(const PODType* __array, size_t N) {
+ PODType* result = __STATIC_CAST(PODType*,malloc(N * sizeof(PODType)));
+ if (result)
+ copy(__array, __array + N, result);
+ return result;
+}
+
+locale ios_base::imbue(const locale& loc) {
+ if (loc != _M_locale) {
+ locale previous = _M_locale;
+ _M_locale = loc;
+ _M_invoke_callbacks(imbue_event);
+ return previous;
+ }
+ else {
+ _M_invoke_callbacks(imbue_event);
+ return _M_locale;
+ }
+}
+
+int _STLP_CALL ios_base::xalloc() {
+#if defined (_STLP_THREADS) && \
+ defined (_STLP_WIN32THREADS) && defined (_STLP_NEW_PLATFORM_SDK)
+ static volatile __stl_atomic_t _S_index = 0;
+ return _STLP_ATOMIC_INCREMENT(&_S_index);
+#else
+ static int _S_index = 0;
+ static _STLP_STATIC_MUTEX __lock _STLP_MUTEX_INITIALIZER;
+ _STLP_auto_lock sentry(__lock);
+ return _S_index++;
+#endif
+}
+
+long& ios_base::iword(int index) {
+ static long dummy = 0;
+
+ pair<long*, size_t> tmp = _Stl_expand_array(_M_iwords, _M_num_iwords, index);
+ if (tmp.first) { // The allocation, if any, succeeded.
+ _M_iwords = tmp.first;
+ _M_num_iwords = tmp.second;
+ return _M_iwords[index];
+ }
+ else {
+ _M_setstate_nothrow(badbit);
+ _M_check_exception_mask();
+ return dummy;
+ }
+}
+
+
+void*& ios_base::pword(int index) {
+ static void* dummy = 0;
+
+ pair<void**, size_t> tmp = _Stl_expand_array(_M_pwords, _M_num_pwords, index);
+ if (tmp.first) { // The allocation, if any, succeeded.
+ _M_pwords = tmp.first;
+ _M_num_pwords = tmp.second;
+ return _M_pwords[index];
+ }
+ else {
+ _M_setstate_nothrow(badbit);
+ _M_check_exception_mask();
+ return dummy;
+ }
+}
+
+void ios_base::register_callback(event_callback __fn, int index) {
+ pair<pair<event_callback, int>*, size_t> tmp
+ = _Stl_expand_array(_M_callbacks, _M_num_callbacks, (int)_M_callback_index /* fbp: index ??? */ );
+ if (tmp.first) {
+ _M_callbacks = tmp.first;
+ _M_num_callbacks = tmp.second;
+ _M_callbacks[_M_callback_index++] = make_pair(__fn, index);
+ }
+ else {
+ _M_setstate_nothrow(badbit);
+ _M_check_exception_mask();
+ }
+}
+
+// Invokes all currently registered callbacks for a particular event.
+// Behaves correctly even if one of the callbacks adds a new callback.
+void ios_base::_M_invoke_callbacks(event E) {
+ for (size_t i = _M_callback_index; i > 0; --i) {
+ event_callback f = _M_callbacks[i-1].first;
+ int n = _M_callbacks[i-1].second;
+ f(E, *this, n);
+ }
+}
+
+// This function is called if the state, rdstate(), has a bit set
+// that is also set in the exception mask exceptions().
+void ios_base::_M_throw_failure() {
+ const char* arg ;
+# if 0
+ char buffer[256];
+ char* ptr;
+ strcpy(buffer, "ios failure: rdstate = 0x");
+ ptr = __write_integer(buffer+strlen(buffer), ios_base::hex, __STATIC_CAST(unsigned long,_M_iostate));
+ strcpy(ptr, " mask = 0x");
+ ptr = __write_integer(buffer+strlen(buffer), ios_base::hex, __STATIC_CAST(unsigned long,_M_exception_mask));
+ *ptr = 0;
+ arg = buffer;
+# else
+ arg = "ios failure";
+# endif
+
+# ifndef _STLP_USE_EXCEPTIONS
+ fputs(arg, stderr);
+# else
+ throw failure(arg);
+# endif
+}
+
+// Copy x's state to *this. This member function is used in the
+// implementation of basic_ios::copyfmt. Does not copy _M_exception_mask
+// or _M_iostate.
+void ios_base::_M_copy_state(const ios_base& x) {
+ _M_fmtflags = x._M_fmtflags; // Copy the flags, except for _M_iostate
+ _M_openmode = x._M_openmode; // and _M_exception_mask.
+ _M_seekdir = x._M_seekdir;
+ _M_precision = x._M_precision;
+ _M_width = x._M_width;
+ _M_locale = x._M_locale;
+
+ if (x._M_callbacks) {
+ pair<event_callback, int>* tmp = _Stl_copy_array(x._M_callbacks, x._M_callback_index);
+ if (tmp) {
+ free(_M_callbacks);
+ _M_callbacks = tmp;
+ _M_num_callbacks = _M_callback_index = x._M_callback_index;
+ }
+ else {
+ _M_setstate_nothrow(badbit);
+ _M_check_exception_mask();
+ }
+ }
+
+ if (x._M_iwords) {
+ long* tmp = _Stl_copy_array(x._M_iwords, x._M_num_iwords);
+ if (tmp) {
+ free(_M_iwords);
+ _M_iwords = tmp;
+ _M_num_iwords = x._M_num_iwords;
+ }
+ else {
+ _M_setstate_nothrow(badbit);
+ _M_check_exception_mask();
+ }
+ }
+
+ if (x._M_pwords) {
+ void** tmp = _Stl_copy_array(x._M_pwords, x._M_num_pwords);
+ if (tmp) {
+ free(_M_pwords);
+ _M_pwords = tmp;
+ _M_num_pwords = x._M_num_pwords;
+ }
+ else {
+ _M_setstate_nothrow(badbit);
+ _M_check_exception_mask();
+ }
+ }
+}
+
+// ios's (protected) default constructor. The standard says that all
+// fields have indeterminate values; we initialize them to zero for
+// simplicity. The only thing that really matters is that the arrays
+// are all initially null pointers, and the array element counts are all
+// initially zero.
+ios_base::ios_base()
+ : _M_fmtflags(0), _M_iostate(0), _M_openmode(0), _M_seekdir(0),
+ _M_exception_mask(0),
+ _M_precision(0), _M_width(0),
+ _M_locale(),
+ _M_callbacks(0), _M_num_callbacks(0), _M_callback_index(0),
+ _M_iwords(0), _M_num_iwords(0),
+ _M_pwords(0),
+ _M_num_pwords(0)
+{}
+
+// ios's destructor.
+ios_base::~ios_base() {
+ _M_invoke_callbacks(erase_event);
+ free(_M_callbacks);
+ free(_M_iwords);
+ free(_M_pwords);
+}
+
+//----------------------------------------------------------------------
+// Force instantiation of basic_ios
+// For DLL exports, they are already instantiated.
+#if !defined(_STLP_NO_FORCE_INSTANTIATE)
+template class _STLP_CLASS_DECLSPEC basic_ios<char, char_traits<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+template class _STLP_CLASS_DECLSPEC basic_ios<wchar_t, char_traits<wchar_t> >;
+# endif /* _STLP_NO_WCHAR_T */
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/iostream.cpp b/src/iostream.cpp
new file mode 100644
index 0000000..0d3329b
--- /dev/null
+++ b/src/iostream.cpp
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <memory>
+#include <istream>
+#include <fstream>
+#if defined (_STLP_MSVC) || defined (__MWERKS__) || defined (__ICL) || defined (__ISCPP__)
+# define _STLP_USE_NOT_INIT_SEGMENT
+# include <iostream>
+#endif
+
+#include "stdio_streambuf.h"
+#include "aligned_buffer.h"
+#include "_stdio_file.h"
+#include "c_locale.h"
+
+// boris : note this is repeated in <iostream>
+#ifndef _STLP_USE_NAMESPACES
+// in case of SGI iostreams, we have to rename our streams not to clash with those
+// provided in native lib
+# define cin _STLP_cin
+# define cout _STLP_cout
+# define cerr _STLP_cerr
+# define clog _STLP_clog
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// This file handles iostream initialization. It is inherently
+// nonportable, since the C++ language definition provides no mechanism
+// for controlling order of initialization of nonlocal objects.
+// Initialization has three parts, which must be performed in the following
+// order:
+// (1) Initialize the locale system
+// (2) Call the constructors for the eight global stream objects.
+// (3) Create streambufs for the global stream objects, and initialize
+// the stream objects by calling the init() member function.
+
+
+#if defined (_STLP_USE_NOT_INIT_SEGMENT)
+
+// Definitions of the eight global I/O objects that are declared in
+// <iostream>. For some compilers we use pragmas to put the global I/O
+// objects into an initialization segment that will not
+// be executed. We then explicitly invoke the constructors
+// with placement new in ios_base::_S_initialize()
+
+# if defined (__MWERKS__)
+# pragma suppress_init_code on
+# else
+# pragma init_seg("STLPORT_NO_INIT")
+# endif
+
+_STLP_DECLSPEC istream cin(0);
+_STLP_DECLSPEC ostream cout(0);
+_STLP_DECLSPEC ostream cerr(0);
+_STLP_DECLSPEC ostream clog(0);
+
+# ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC wistream wcin(0);
+_STLP_DECLSPEC wostream wcout(0);
+_STLP_DECLSPEC wostream wcerr(0);
+_STLP_DECLSPEC wostream wclog(0);
+# endif
+
+# if defined (__MWERKS__)
+# pragma suppress_init_code off
+# endif
+
+#else
+
+// Definitions of the eight global I/O objects that are declared in
+// <iostream>. Disgusting hack: we deliberately define them with the
+// wrong types so that the constructors don't get run automatically.
+// We need special tricks to make sure that these objects are struct-
+// aligned rather than byte-aligned.
+
+// This is not portable. Declaring a variable with different types in
+// two translations units is "undefined", according to the C++ standard.
+// Most compilers, however, silently accept this instead of diagnosing
+// it as an error.
+
+# ifndef __DMC__
+_STLP_DECLSPEC _Stl_aligned_buffer<istream> cin;
+_STLP_DECLSPEC _Stl_aligned_buffer<ostream> cout;
+_STLP_DECLSPEC _Stl_aligned_buffer<ostream> cerr;
+_STLP_DECLSPEC _Stl_aligned_buffer<ostream> clog;
+# else
+_Stl_aligned_buffer<istream> cin;
+_Stl_aligned_buffer<ostream> cout;
+_Stl_aligned_buffer<ostream> cerr;
+_Stl_aligned_buffer<ostream> clog;
+
+# pragma alias("?cin@std@@3V?$basic_istream@std@DV?$char_traits@std@D@1@@1@A", "?cin@std@@3T?$_Stl_aligned_buffer@std@V?$basic_istream@std@DV?$char_traits@std@D@1@@1@@1@A")
+# pragma alias("?cout@std@@3V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@A", "?cout@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@@1@A")
+# pragma alias("?cerr@std@@3V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@A", "?cerr@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@@1@A")
+# pragma alias("?clog@std@@3V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@A", "?clog@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@@1@A")
+# endif
+
+# ifndef _STLP_NO_WCHAR_T
+
+# ifndef __DMC__
+_STLP_DECLSPEC _Stl_aligned_buffer<wistream> wcin;
+_STLP_DECLSPEC _Stl_aligned_buffer<wostream> wcout;
+_STLP_DECLSPEC _Stl_aligned_buffer<wostream> wcerr;
+_STLP_DECLSPEC _Stl_aligned_buffer<wostream> wclog;
+# else
+_Stl_aligned_buffer<wistream> wcin;
+_Stl_aligned_buffer<wostream> wcout;
+_Stl_aligned_buffer<wostream> wcerr;
+_Stl_aligned_buffer<wostream> wclog;
+
+# pragma alias("?wcin@std@@3V?$basic_istream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wcin@std@@3T?$_Stl_aligned_buffer@std@V?$basic_istream@std@_YV?$char_traits@std@_Y@1@@1@@1@A")
+# pragma alias("?wcout@std@@3V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wcout@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@@1@A")
+# pragma alias("?wcerr@std@@3V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wcerr@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@@1@A")
+# pragma alias("?wclog@std@@3V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wclog@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@@1@A")
+# endif
+# endif
+#endif /* STL_MSVC || __MWERKS__ */
+
+// Member functions from class ios_base and ios_base::Init
+
+long ios_base::Init::_S_count = 0;
+// by default, those are synced
+bool ios_base::_S_is_synced = true;
+
+ios_base::Init::Init() {
+ if (_S_count++ == 0) {
+ _Locale_init();
+ ios_base::_S_initialize();
+ _Filebuf_base::_S_initialize();
+ }
+}
+
+ios_base::Init::~Init() {
+ if (--_S_count == 0) {
+ ios_base::_S_uninitialize();
+ _Locale_final();
+ }
+}
+
+static int _Stl_extract_open_param(FILE* f)
+{ return _FILE_fd(f); }
+
+#ifdef _STLP_REDIRECT_STDSTREAMS
+static const char* _Stl_extract_open_param(const char* name)
+{ return name; }
+#endif
+
+template <class _Tp>
+static filebuf*
+_Stl_create_filebuf(_Tp x, ios_base::openmode mode ) {
+ auto_ptr<filebuf> result(new basic_filebuf<char, char_traits<char> >());
+ result->open(_Stl_extract_open_param(x), mode);
+
+ if (result->is_open())
+ return result.release();
+
+ return 0;
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+static wfilebuf*
+_Stl_create_wfilebuf(FILE* f, ios_base::openmode mode) {
+ auto_ptr<wfilebuf> result(new basic_filebuf<wchar_t, char_traits<wchar_t> >());
+ result->_M_open(_FILE_fd(f), mode);
+
+ if (result->is_open())
+ return result.release();
+
+ return 0;
+}
+#endif
+
+void _STLP_CALL ios_base::_S_initialize() {
+#if !defined (_STLP_HAS_NO_NAMESPACES) && !defined (_STLP_DONT_USE_PRIV_NAMESPACE)
+ using _STLP_PRIV stdio_istreambuf;
+ using _STLP_PRIV stdio_ostreambuf;
+#endif
+
+ auto_ptr<streambuf> cin_buf;
+ auto_ptr<streambuf> cout_buf;
+ auto_ptr<streambuf> cerr_buf;
+ auto_ptr<streambuf> clog_buf;
+
+ if (_S_is_synced)
+ cin_buf.reset(new stdio_istreambuf(stdin));
+ else
+ cin_buf.reset(_Stl_create_filebuf(stdin, ios_base::in));
+
+ if (_S_is_synced) {
+#ifdef _STLP_REDIRECT_STDSTREAMS
+ cout_buf.reset(_Stl_create_filebuf("/stdout.txt", ios::out));
+ cerr_buf.reset(_Stl_create_filebuf("/stderr.txt", ios::out));
+ clog_buf.reset(_Stl_create_filebuf("/stdlog.txt", ios::out));
+#else
+ cout_buf.reset(new stdio_ostreambuf(stdout));
+ cerr_buf.reset(new stdio_ostreambuf(stderr));
+ clog_buf.reset(new stdio_ostreambuf(stderr));
+#endif
+ }
+ else {
+ cout_buf.reset(_Stl_create_filebuf(stdout, ios_base::out));
+ cerr_buf.reset(_Stl_create_filebuf(stderr, ios_base::out));
+ clog_buf.reset(_Stl_create_filebuf(stderr, ios_base::out));
+ }
+
+ istream* ptr_cin = new(&cin) istream(cin_buf.get()); cin_buf.release();
+ ostream* ptr_cout = new(&cout) ostream(cout_buf.get()); cout_buf.release();
+ ostream* ptr_cerr = new(&cerr) ostream(cerr_buf.get()); cerr_buf.release();
+ /*ostream* ptr_clog = */ new(&clog) ostream(clog_buf.get()); clog_buf.release();
+ ptr_cin->tie(ptr_cout);
+ ptr_cerr->setf(ios_base::unitbuf);
+
+#ifndef _STLP_NO_WCHAR_T
+ auto_ptr<wfilebuf> win(_Stl_create_wfilebuf(stdin, ios_base::in));
+ auto_ptr<wfilebuf> wout(_Stl_create_wfilebuf(stdout, ios_base::out));
+ auto_ptr<wfilebuf> werr(_Stl_create_wfilebuf(stderr, ios_base::out));
+ auto_ptr<wfilebuf> wlog(_Stl_create_wfilebuf(stderr, ios_base::out));
+
+ // Run constructors for the four wide stream objects.
+ wistream* ptr_wcin = new(&wcin) wistream(win.get()); win.release();
+ wostream* ptr_wcout = new(&wcout) wostream(wout.get()); wout.release();
+ wostream* ptr_wcerr = new(&wcerr) wostream(werr.get()); werr.release();
+ /*wostream* ptr_wclog = */ new(&wclog) wostream(wlog.get()); wlog.release();
+
+ ptr_wcin->tie(ptr_wcout);
+ ptr_wcerr->setf(ios_base::unitbuf);
+#endif
+}
+
+void _STLP_CALL ios_base::_S_uninitialize() {
+ // Note that destroying output streambufs flushes the buffers.
+ istream* ptr_cin = &cin;
+ ostream* ptr_cout = &cout;
+ ostream* ptr_cerr = &cerr;
+ ostream* ptr_clog = &clog;
+
+ // We don't want any exceptions being thrown here
+ ptr_cin->exceptions(0);
+ ptr_cout->exceptions(0);
+ ptr_cerr->exceptions(0);
+ ptr_clog->exceptions(0);
+
+ delete ptr_cin->rdbuf(0);
+ delete ptr_cout->rdbuf(0);
+ delete ptr_cerr->rdbuf(0);
+ delete ptr_clog->rdbuf(0);
+
+ _Destroy(ptr_cin);
+ _Destroy(ptr_cout);
+ _Destroy(ptr_cerr);
+ _Destroy(ptr_clog);
+
+#ifndef _STLP_NO_WCHAR_T
+ wistream* ptr_wcin = &wcin;
+ wostream* ptr_wcout = &wcout;
+ wostream* ptr_wcerr = &wcerr;
+ wostream* ptr_wclog = &wclog;
+
+ // We don't want any exceptions being thrown here
+ ptr_wcin->exceptions(0);
+ ptr_wcout->exceptions(0);
+ ptr_wcerr->exceptions(0);
+ ptr_wclog->exceptions(0);
+
+ delete ptr_wcin->rdbuf(0);
+ delete ptr_wcout->rdbuf(0);
+ delete ptr_wcerr->rdbuf(0);
+ delete ptr_wclog->rdbuf(0);
+
+ _Destroy(ptr_wcin);
+ _Destroy(ptr_wcout);
+ _Destroy(ptr_wcerr);
+ _Destroy(ptr_wclog);
+#endif
+}
+
+
+bool _STLP_CALL ios_base::sync_with_stdio(bool sync) {
+# if !defined (_STLP_HAS_NO_NAMESPACES) && !defined (_STLP_DONT_USE_PRIV_NAMESPACE)
+ using _STLP_PRIV stdio_istreambuf;
+ using _STLP_PRIV stdio_ostreambuf;
+# endif
+
+ if (sync == _S_is_synced) return sync;
+
+ // if by any chance we got there before std streams initialization,
+ // just set the sync flag and exit
+ if (Init::_S_count == 0) {
+ _S_is_synced = sync;
+ return sync;
+ }
+
+ auto_ptr<streambuf> cin_buf;
+ auto_ptr<streambuf> cout_buf;
+ auto_ptr<streambuf> cerr_buf;
+ auto_ptr<streambuf> clog_buf;
+
+ if (sync)
+ cin_buf.reset(new stdio_istreambuf(stdin));
+ else
+ cin_buf.reset(_Stl_create_filebuf(stdin, ios_base::in));
+
+ if (sync) {
+#ifdef _STLP_REDIRECT_STDSTREAMS
+ cout_buf.reset(_Stl_create_filebuf("/stdout.txt", ios::out));
+ cerr_buf.reset(_Stl_create_filebuf("/stderr.txt", ios::out));
+ clog_buf.reset(_Stl_create_filebuf("/stdlog.txt", ios::out));
+#else
+ cout_buf.reset(new stdio_ostreambuf(stdout));
+ cerr_buf.reset(new stdio_ostreambuf(stderr));
+ clog_buf.reset(new stdio_ostreambuf(stderr));
+#endif
+ }
+ else {
+ cout_buf.reset(_Stl_create_filebuf(stdout, ios_base::out));
+ cerr_buf.reset(_Stl_create_filebuf(stderr, ios_base::out));
+ clog_buf.reset(_Stl_create_filebuf(stderr, ios_base::out));
+ }
+
+ if (cin_buf.get() != 0 && cout_buf.get() != 0 && cerr_buf.get() != 0 && clog_buf.get() != 0) {
+ // When streambuf passed to rdbuf is not null, rdbuf is exception safe:
+ delete (&cin)->rdbuf(cin_buf.release());
+ delete (&cout)->rdbuf(cout_buf.release());
+ delete (&cerr)->rdbuf(cerr_buf.release());
+ delete (&clog)->rdbuf(clog_buf.release());
+ _S_is_synced = sync;
+ }
+
+ return _S_is_synced;
+}
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/istream.cpp b/src/istream.cpp
new file mode 100644
index 0000000..715364c
--- /dev/null
+++ b/src/istream.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+# include "stlport_prefix.h"
+
+#include <istream>
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined(_STLP_NO_FORCE_INSTANTIATE)
+
+// instantiations
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+template class _STLP_CLASS_DECLSPEC _Isentry<char, char_traits<char> >;
+# endif
+
+template class _STLP_CLASS_DECLSPEC basic_iostream<char, char_traits<char> >;
+template class _STLP_CLASS_DECLSPEC basic_istream<char, char_traits<char> >;
+
+# if !defined (_STLP_NO_WCHAR_T)
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+template class _STLP_CLASS_DECLSPEC _Isentry<wchar_t, char_traits<wchar_t> >;
+# endif
+template class _STLP_CLASS_DECLSPEC basic_istream<wchar_t, char_traits<wchar_t> >;
+template class _STLP_CLASS_DECLSPEC basic_iostream<wchar_t, char_traits<wchar_t> >;
+# endif /* !_STLP_NO_WCHAR_T */
+
+#endif /* _STLP_NO_FORCE_INSTANTIATE */
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/locale.cpp b/src/locale.cpp
new file mode 100644
index 0000000..8df976b
--- /dev/null
+++ b/src/locale.cpp
@@ -0,0 +1,445 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <locale>
+#include <stdexcept>
+
+#include "c_locale.h"
+#include "locale_impl.h"
+
+_STLP_BEGIN_NAMESPACE
+
+static const string _Nameless("*");
+
+static inline bool is_C_locale_name (const char* name)
+{ return ((name[0] == 'C') && (name[1] == 0)); }
+
+locale* _Stl_get_classic_locale();
+locale* _Stl_get_global_locale();
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+# define locale _STLP_NO_MEM_T_NAME(loc)
+#endif
+
+locale::facet::~facet() {}
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || defined (_STLP_INLINE_MEMBER_TEMPLATES)
+// members that fail to be templates
+bool locale::operator()(const string& __x,
+ const string& __y) const
+{ return __locale_do_operator_call(*this, __x, __y); }
+
+# if !defined (_STLP_NO_WCHAR_T)
+bool locale::operator()(const wstring& __x,
+ const wstring& __y) const
+{ return __locale_do_operator_call(*this, __x, __y); }
+# endif
+#endif
+
+void _STLP_CALL locale::_M_throw_on_null_name()
+{ _STLP_THROW(runtime_error("Invalid null locale name")); }
+
+void _STLP_CALL locale::_M_throw_on_combine_error(const string& name) {
+ string what = "Unable to find facet";
+ what += " in ";
+ what += name.empty() ? "system" : name.c_str();
+ what += " locale";
+ _STLP_THROW(runtime_error(what.c_str()));
+}
+
+void _STLP_CALL locale::_M_throw_on_creation_failure(int __err_code,
+ const char* name, const char* facet) {
+ string what;
+ switch (__err_code) {
+ case _STLP_LOC_UNSUPPORTED_FACET_CATEGORY:
+ what = "No platform localization support for ";
+ what += facet;
+ what += " facet category, unable to create facet for ";
+ what += name[0] == 0 ? "system" : name;
+ what += " locale";
+ break;
+ case _STLP_LOC_NO_PLATFORM_SUPPORT:
+ what = "No platform localization support, unable to create ";
+ what += name[0] == 0 ? "system" : name;
+ what += " locale";
+ break;
+ default:
+ case _STLP_LOC_UNKNOWN_NAME:
+ what = "Unable to create facet ";
+ what += facet;
+ what += " from name '";
+ what += name;
+ what += "'";
+ break;
+ case _STLP_LOC_NO_MEMORY:
+ _STLP_THROW_BAD_ALLOC;
+ break;
+ }
+
+ _STLP_THROW(runtime_error(what.c_str()));
+}
+
+// Takes a reference to a locale::id, assign a numeric index if not already
+// affected and returns it. The returned index is always positive.
+static const locale::id& _Stl_loc_get_index(locale::id& id) {
+ if (id._M_index == 0) {
+#if defined (_STLP_ATOMIC_INCREMENT) && !defined (_STLP_WIN95_LIKE)
+ static _STLP_VOLATILE __stl_atomic_t _S_index = __STATIC_CAST(__stl_atomic_t, locale::id::_S_max);
+ id._M_index = _STLP_ATOMIC_INCREMENT(&_S_index);
+#else
+ static _STLP_STATIC_MUTEX _Index_lock _STLP_MUTEX_INITIALIZER;
+ _STLP_auto_lock sentry(_Index_lock);
+ size_t new_index = locale::id::_S_max++;
+ id._M_index = new_index;
+#endif
+ }
+ return id;
+}
+
+// Default constructor: create a copy of the global locale.
+locale::locale() _STLP_NOTHROW
+ : _M_impl(_get_Locale_impl(_Stl_get_global_locale()->_M_impl))
+{}
+
+// Copy constructor
+locale::locale(const locale& L) _STLP_NOTHROW
+ : _M_impl( _get_Locale_impl( L._M_impl ) )
+{}
+
+void locale::_M_insert(facet* f, locale::id& n) {
+ if (f)
+ _M_impl->insert(f, _Stl_loc_get_index(n));
+}
+
+locale::locale( _Locale_impl* impl ) :
+ _M_impl( _get_Locale_impl( impl ) )
+{}
+
+// Create a locale from a name.
+locale::locale(const char* name)
+ : _M_impl(0) {
+ if (!name)
+ _M_throw_on_null_name();
+
+ if (is_C_locale_name(name)) {
+ _M_impl = _get_Locale_impl( locale::classic()._M_impl );
+ return;
+ }
+
+ _Locale_impl* impl = 0;
+ _STLP_TRY {
+ impl = new _Locale_impl(locale::id::_S_max, name);
+
+ // Insert categories one at a time.
+ _Locale_name_hint *hint = 0;
+ const char* ctype_name = name;
+ char ctype_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* numeric_name = name;
+ char numeric_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* time_name = name;
+ char time_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* collate_name = name;
+ char collate_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* monetary_name = name;
+ char monetary_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* messages_name = name;
+ char messages_buf[_Locale_MAX_SIMPLE_NAME];
+ hint = impl->insert_ctype_facets(ctype_name, ctype_buf, hint);
+ hint = impl->insert_numeric_facets(numeric_name, numeric_buf, hint);
+ hint = impl->insert_time_facets(time_name, time_buf, hint);
+ hint = impl->insert_collate_facets(collate_name, collate_buf, hint);
+ hint = impl->insert_monetary_facets(monetary_name, monetary_buf, hint);
+ impl->insert_messages_facets(messages_name, messages_buf, hint);
+
+ // Try to use a normalize locale name in order to have the == operator
+ // to behave correctly:
+ if (strcmp(ctype_name, numeric_name) == 0 &&
+ strcmp(ctype_name, time_name) == 0 &&
+ strcmp(ctype_name, collate_name) == 0 &&
+ strcmp(ctype_name, monetary_name) == 0 &&
+ strcmp(ctype_name, messages_name) == 0) {
+ impl->name = ctype_name;
+ }
+ // else we keep current name.
+
+ // reassign impl
+ _M_impl = _get_Locale_impl( impl );
+ }
+ _STLP_UNWIND(delete impl);
+}
+
+static void _Stl_loc_combine_names_aux(_Locale_impl* L,
+ const char* name,
+ const char* ctype_name, const char* time_name, const char* numeric_name,
+ const char* collate_name, const char* monetary_name, const char* messages_name,
+ locale::category c) {
+ // This function is only called when names has been validated so using _Locale_extract_*_name
+ // can't fail.
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ L->name = string("LC_CTYPE=") + _Locale_extract_ctype_name((c & locale::ctype) ? ctype_name : name, buf, 0, &__err_code) + ";";
+ L->name += string("LC_TIME=") + _Locale_extract_time_name((c & locale::time) ? time_name : name, buf, 0, &__err_code) + ";";
+ L->name += string("LC_NUMERIC=") + _Locale_extract_numeric_name((c & locale::numeric) ? numeric_name : name, buf, 0, &__err_code) + ";";
+ L->name += string("LC_COLLATE=") + _Locale_extract_collate_name((c & locale::collate) ? collate_name : name, buf, 0, &__err_code) + ";";
+ L->name += string("LC_MONETARY=") + _Locale_extract_monetary_name((c & locale::monetary) ? monetary_name : name, buf, 0, &__err_code) + ";";
+ L->name += string("LC_MESSAGES=") + _Locale_extract_messages_name((c & locale::messages) ? messages_name : name, buf, 0, &__err_code);
+}
+
+// Give L a name where all facets except those in category c
+// are taken from name1, and those in category c are taken from name2.
+static void _Stl_loc_combine_names(_Locale_impl* L,
+ const char* name1, const char* name2,
+ locale::category c) {
+ if ((c & locale::all) == 0 || strcmp(name1, name1) == 0)
+ L->name = name1;
+ else if ((c & locale::all) == locale::all)
+ L->name = name2;
+ else {
+ _Stl_loc_combine_names_aux(L, name1, name2, name2, name2, name2, name2, name2, c);
+ }
+}
+
+static void _Stl_loc_combine_names(_Locale_impl* L,
+ const char* name,
+ const char* ctype_name, const char* time_name, const char* numeric_name,
+ const char* collate_name, const char* monetary_name, const char* messages_name,
+ locale::category c) {
+ if ((c & locale::all) == 0 || (strcmp(name, ctype_name) == 0 &&
+ strcmp(name, time_name) == 0 &&
+ strcmp(name, numeric_name) == 0 &&
+ strcmp(name, collate_name) == 0 &&
+ strcmp(name, monetary_name) == 0 &&
+ strcmp(name, messages_name) == 0))
+ L->name = name;
+ else if ((c & locale::all) == locale::all && strcmp(ctype_name, time_name) == 0 &&
+ strcmp(ctype_name, numeric_name) == 0 &&
+ strcmp(ctype_name, collate_name) == 0 &&
+ strcmp(ctype_name, monetary_name) == 0 &&
+ strcmp(ctype_name, messages_name) == 0)
+ L->name = ctype_name;
+ else {
+ _Stl_loc_combine_names_aux(L, name, ctype_name, time_name, numeric_name, collate_name, monetary_name, messages_name, c);
+ }
+}
+
+
+// Create a locale that's a copy of L, except that all of the facets
+// in category c are instead constructed by name.
+locale::locale(const locale& L, const char* name, locale::category c)
+ : _M_impl(0) {
+ if (!name)
+ _M_throw_on_null_name();
+
+ if (_Nameless == name)
+ _STLP_THROW(runtime_error((string("Invalid locale name '") + _Nameless + "'").c_str()));
+
+ _Locale_impl* impl = 0;
+
+ _STLP_TRY {
+ impl = new _Locale_impl(*L._M_impl);
+
+ _Locale_name_hint *hint = 0;
+ const char* ctype_name = name;
+ char ctype_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* numeric_name = name;
+ char numeric_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* time_name = name;
+ char time_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* collate_name = name;
+ char collate_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* monetary_name = name;
+ char monetary_buf[_Locale_MAX_SIMPLE_NAME];
+ const char* messages_name = name;
+ char messages_buf[_Locale_MAX_SIMPLE_NAME];
+ if (c & locale::ctype)
+ hint = impl->insert_ctype_facets(ctype_name, ctype_buf, hint);
+ if (c & locale::numeric)
+ hint = impl->insert_numeric_facets(numeric_name, numeric_buf, hint);
+ if (c & locale::time)
+ hint = impl->insert_time_facets(time_name, time_buf, hint);
+ if (c & locale::collate)
+ hint = impl->insert_collate_facets(collate_name, collate_buf, hint);
+ if (c & locale::monetary)
+ hint = impl->insert_monetary_facets(monetary_name, monetary_buf,hint);
+ if (c & locale::messages)
+ impl->insert_messages_facets(messages_name, messages_buf, hint);
+
+ _Stl_loc_combine_names(impl, L._M_impl->name.c_str(),
+ ctype_name, time_name, numeric_name,
+ collate_name, monetary_name, messages_name, c);
+ _M_impl = _get_Locale_impl( impl );
+ }
+ _STLP_UNWIND(delete impl)
+}
+
+// Contruct a new locale where all facets that aren't in category c
+// come from L1, and all those that are in category c come from L2.
+locale::locale(const locale& L1, const locale& L2, category c)
+ : _M_impl(0) {
+ _Locale_impl* impl = new _Locale_impl(*L1._M_impl);
+
+ _Locale_impl* i2 = L2._M_impl;
+
+ if (L1.name() != _Nameless && L2.name() != _Nameless)
+ _Stl_loc_combine_names(impl, L1._M_impl->name.c_str(), L2._M_impl->name.c_str(), c);
+ else {
+ impl->name = _Nameless;
+ }
+
+ if (c & collate) {
+ impl->insert( i2, _STLP_STD::collate<char>::id);
+# ifndef _STLP_NO_WCHAR_T
+ impl->insert( i2, _STLP_STD::collate<wchar_t>::id);
+# endif
+ }
+ if (c & ctype) {
+ impl->insert( i2, _STLP_STD::ctype<char>::id);
+ impl->insert( i2, _STLP_STD::codecvt<char, char, mbstate_t>::id);
+# ifndef _STLP_NO_WCHAR_T
+ impl->insert( i2, _STLP_STD::ctype<wchar_t>::id);
+ impl->insert( i2, _STLP_STD::codecvt<wchar_t, char, mbstate_t>::id);
+# endif
+ }
+ if (c & monetary) {
+ impl->insert( i2, _STLP_STD::moneypunct<char, true>::id);
+ impl->insert( i2, _STLP_STD::moneypunct<char, false>::id);
+ impl->insert( i2, _STLP_STD::money_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+ impl->insert( i2, _STLP_STD::money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+# ifndef _STLP_NO_WCHAR_T
+ impl->insert( i2, _STLP_STD::moneypunct<wchar_t, true>::id);
+ impl->insert( i2, _STLP_STD::moneypunct<wchar_t, false>::id);
+ impl->insert( i2, _STLP_STD::money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ impl->insert( i2, _STLP_STD::money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+# endif
+ }
+ if (c & numeric) {
+ impl->insert( i2, _STLP_STD::numpunct<char>::id);
+ impl->insert( i2, _STLP_STD::num_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+ impl->insert( i2, _STLP_STD::num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+# ifndef _STLP_NO_WCHAR_T
+ impl->insert( i2, _STLP_STD::numpunct<wchar_t>::id);
+ impl->insert( i2, _STLP_STD::num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ impl->insert( i2, _STLP_STD::num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+# endif
+ }
+ if (c & time) {
+ impl->insert( i2, _STLP_STD::time_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+ impl->insert( i2, _STLP_STD::time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+# ifndef _STLP_NO_WCHAR_T
+ impl->insert( i2, _STLP_STD::time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ impl->insert( i2, _STLP_STD::time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+# endif
+ }
+ if (c & messages) {
+ impl->insert( i2, _STLP_STD::messages<char>::id);
+# ifndef _STLP_NO_WCHAR_T
+ impl->insert( i2, _STLP_STD::messages<wchar_t>::id);
+# endif
+ }
+ _M_impl = _get_Locale_impl( impl );
+}
+
+// Destructor.
+locale::~locale() _STLP_NOTHROW {
+ if (_M_impl)
+ _release_Locale_impl(_M_impl);
+}
+
+// Assignment operator. Much like the copy constructor: just a bit of
+// pointer twiddling.
+const locale& locale::operator=(const locale& L) _STLP_NOTHROW {
+ if (this->_M_impl != L._M_impl) {
+ if (this->_M_impl)
+ _release_Locale_impl(this->_M_impl);
+ this->_M_impl = _get_Locale_impl(L._M_impl);
+ }
+ return *this;
+}
+
+locale::facet* locale::_M_get_facet(const locale::id& n) const {
+ return n._M_index < _M_impl->size() ? _M_impl->facets_vec[n._M_index] : 0;
+}
+
+locale::facet* locale::_M_use_facet(const locale::id& n) const {
+ locale::facet* f = (n._M_index < _M_impl->size() ? _M_impl->facets_vec[n._M_index] : 0);
+ if (!f)
+ _M_impl->_M_throw_bad_cast();
+ return f;
+}
+
+string locale::name() const {
+ return _M_impl->name;
+}
+
+// Compare two locales for equality.
+bool locale::operator==(const locale& L) const {
+ return this->_M_impl == L._M_impl ||
+ (this->name() == L.name() && this->name() != _Nameless);
+}
+
+bool locale::operator!=(const locale& L) const {
+ return !(*this == L);
+}
+
+// static data members.
+
+const locale& _STLP_CALL locale::classic() {
+ return *_Stl_get_classic_locale();
+}
+
+#if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+locale _STLP_CALL locale::global(const locale& L) {
+#else
+_Locale_impl* _STLP_CALL locale::global(const locale& L) {
+#endif
+ locale old(_Stl_get_global_locale()->_M_impl);
+ if (_Stl_get_global_locale()->_M_impl != L._M_impl) {
+ _release_Locale_impl(_Stl_get_global_locale()->_M_impl);
+ // this assign should be atomic, should be fixed here:
+ _Stl_get_global_locale()->_M_impl = _get_Locale_impl(L._M_impl);
+
+ // Set the global C locale, if appropriate.
+#if !defined(_STLP_NO_LOCALE_SUPPORT)
+ if (L.name() != _Nameless)
+ setlocale(LC_ALL, L.name().c_str());
+#endif
+ }
+
+#if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ return old;
+#else
+ return old._M_impl;
+#endif
+}
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+const locale::category locale::none;
+const locale::category locale::collate;
+const locale::category locale::ctype;
+const locale::category locale::monetary;
+const locale::category locale::numeric;
+const locale::category locale::time;
+const locale::category locale::messages;
+const locale::category locale::all;
+#endif
+
+_STLP_END_NAMESPACE
+
diff --git a/src/locale_catalog.cpp b/src/locale_catalog.cpp
new file mode 100644
index 0000000..31e672e
--- /dev/null
+++ b/src/locale_catalog.cpp
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <hash_map>
+#include <string>
+
+#include <locale>
+#include <istream>
+
+#include "c_locale.h"
+#include "locale_impl.h"
+#include "acquire_release.h"
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Those wrappers are needed to use locale functions in __acquire_category,
+// all functions have to present the same prototype.
+
+static void* _Loc_ctype_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_ctype_create(s, hint, __err_code); }
+static void* _Loc_codecvt_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_codecvt_create(s, hint, __err_code); }
+static void* _Loc_numeric_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_numeric_create(s, hint, __err_code); }
+static void* _Loc_time_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_time_create(s, hint, __err_code); }
+static void* _Loc_collate_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_collate_create(s, hint, __err_code); }
+static void* _Loc_monetary_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_monetary_create(s, hint, __err_code); }
+static void* _Loc_messages_create(const char * s, _Locale_name_hint* hint, int *__err_code)
+{ return _Locale_messages_create(s, hint, __err_code); }
+
+static char const* _Loc_ctype_name(void* l, char* s)
+{ return _Locale_ctype_name((_Locale_ctype*)l, s); }
+static char const* _Loc_codecvt_name(void* l, char* s)
+{ return _Locale_codecvt_name((_Locale_codecvt*)l, s); }
+static char const* _Loc_numeric_name(void* l, char* s)
+{ return _Locale_numeric_name((_Locale_numeric*)l, s); }
+static char const* _Loc_time_name(void* l, char* s)
+{ return _Locale_time_name((_Locale_time*)l, s); }
+static char const* _Loc_collate_name(void* l, char* s)
+{ return _Locale_collate_name((_Locale_collate*)l, s); }
+static char const* _Loc_monetary_name(void* l, char* s)
+{ return _Locale_monetary_name((_Locale_monetary*)l, s); }
+static char const* _Loc_messages_name(void* l, char* s)
+{ return _Locale_messages_name((_Locale_messages*)l, s); }
+
+static const char* _Loc_ctype_default(char* p)
+{ return _Locale_ctype_default(p); }
+static const char* _Loc_numeric_default(char * p)
+{ return _Locale_numeric_default(p); }
+static const char* _Loc_time_default(char* p)
+{ return _Locale_time_default(p); }
+static const char* _Loc_collate_default(char* p)
+{ return _Locale_collate_default(p); }
+static const char* _Loc_monetary_default(char* p)
+{ return _Locale_monetary_default(p); }
+static const char* _Loc_messages_default(char* p)
+{ return _Locale_messages_default(p); }
+
+static void _Loc_ctype_destroy(void* p) {_Locale_ctype_destroy((_Locale_ctype*)p); }
+static void _Loc_codecvt_destroy(void* p) {_Locale_codecvt_destroy((_Locale_codecvt*)p); }
+static void _Loc_numeric_destroy(void* p) {_Locale_numeric_destroy((_Locale_numeric*)p); }
+static void _Loc_time_destroy(void* p) {_Locale_time_destroy((_Locale_time*)p);}
+static void _Loc_collate_destroy(void* p) {_Locale_collate_destroy((_Locale_collate*)p);}
+static void _Loc_monetary_destroy(void* p) {_Locale_monetary_destroy((_Locale_monetary*)p);}
+static void _Loc_messages_destroy(void* p) {_Locale_messages_destroy((_Locale_messages*)p);}
+
+typedef void* (*loc_create_func_t)(const char *, _Locale_name_hint*, int *__err_code);
+typedef char const* (*loc_name_func_t)(void* l, char* s);
+typedef void (*loc_destroy_func_t)(void* l);
+typedef const char* (*loc_default_name_func_t)(char* s);
+typedef char const* (*loc_extract_name_func_t)(const char*, char*, _Locale_name_hint*, int *__err_code);
+
+//----------------------------------------------------------------------
+// Acquire and release low-level category objects. The whole point of
+// this is so that we don't allocate (say) four different _Locale_ctype
+// objects for a single locale.
+
+// Global hash tables for category objects.
+typedef hash_map<string, pair<void*, size_t>, hash<string>, equal_to<string> > Category_Map;
+
+// Look up a category by name
+static Category_Map** ctype_hash() {
+ static Category_Map *_S_ctype_hash = 0;
+ return &_S_ctype_hash;
+}
+static Category_Map** codecvt_hash() {
+ static Category_Map *_S_codecvt_hash = 0;
+ return &_S_codecvt_hash;
+}
+static Category_Map** numeric_hash() {
+ static Category_Map *_S_numeric_hash = 0;
+ return &_S_numeric_hash;
+}
+static Category_Map** time_hash() {
+ static Category_Map *_S_time_hash = 0;
+ return &_S_time_hash;
+}
+static Category_Map** collate_hash() {
+ static Category_Map *_S_collate_hash = 0;
+ return &_S_collate_hash;
+}
+static Category_Map** monetary_hash() {
+ static Category_Map *_S_monetary_hash = 0;
+ return &_S_monetary_hash;
+}
+static Category_Map** messages_hash() {
+ static Category_Map *_S_messages_hash;
+ return &_S_messages_hash;
+}
+
+// We have a single lock for all of the hash tables. We may wish to
+// replace it with six different locks.
+/* REFERENCED */
+static _STLP_STATIC_MUTEX& category_hash_mutex() {
+ static _STLP_STATIC_MUTEX lock _STLP_MUTEX_INITIALIZER;
+ return lock;
+}
+
+static void*
+__acquire_category(const char* &name, char *buf, _Locale_name_hint* hint,
+ loc_extract_name_func_t extract_name,
+ loc_create_func_t create_obj, loc_default_name_func_t default_name,
+ Category_Map ** M, int *__err_code) {
+#if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x564)
+ typedef Category_Map::iterator Category_iterator;
+ pair<Category_iterator, bool> result;
+#else
+# if !defined(_STLP_DEBUG)
+ pair<_Ht_iterator<_Slist_iterator<pair<const string,pair<void *,unsigned int> >,_Nonconst_traits<pair<const string,pair<void *,unsigned int> > > >,_NonLocalHashMapTraitsT<pair<const string,pair<void *,unsigned int> > > >, bool> result;
+# else
+ pair<_DBG_iter<_NonDbg_hashtable<pair<const string,pair<void *,unsigned int> >,string,hash<string>,_HashMapTraitsT<pair<const string,pair<void *,unsigned int> > >,_Select1st<pair<const string,pair<void *,unsigned int> > >,_DbgEqual<string,equal_to<string> >,allocator<pair<const string,pair<void *,unsigned int> > > >,_DbgTraits<_NonLocalHashMapTraitsT<pair<const string,pair<void *,unsigned int> > > > >, bool> result;
+# endif
+#endif
+
+ *__err_code = _STLP_LOC_UNDEFINED;
+
+ // Find what name to look for. Be careful if user requests the default.
+ if (name[0] == 0) {
+ name = default_name(buf);
+ if (name == 0 || name[0] == 0)
+ name = "C";
+ }
+ else {
+ const char* cname = extract_name(name, buf, hint, __err_code);
+ if (cname == 0) {
+ return 0;
+ }
+ name = cname;
+ }
+
+ Category_Map::value_type __e(name, pair<void*,size_t>((void*)0,size_t(0)));
+
+ _STLP_auto_lock sentry(category_hash_mutex());
+
+ if (!*M)
+ *M = new Category_Map();
+
+ // Look for an existing entry with that name.
+ result = (*M)->insert_noresize(__e);
+
+ if (result.second) {
+ // There was no entry in the map already. Create the category.
+ (*result.first).second.first = create_obj(name, hint, __err_code);
+ if (!(*result.first).second.first) {
+ (*M)->erase(result.first);
+#if defined (_STLP_LEAKS_PEDANTIC)
+ if ((*M)->empty()) {
+ delete *M;
+ *M = 0;
+ }
+#endif
+ return 0;
+ }
+ }
+
+ // Increment the reference count.
+ ++((*result.first).second.second);
+
+ return (*result.first).second.first;
+}
+
+static void
+__release_category(void* cat,
+ loc_destroy_func_t destroy_fun,
+ loc_name_func_t get_name,
+ Category_Map** M) {
+ Category_Map *pM = *M;
+
+ if (cat && pM) {
+ // Find the name of the category object.
+ char buf[_Locale_MAX_SIMPLE_NAME + 1];
+ char const* name = get_name(cat, buf);
+
+ if (name != 0) {
+ _STLP_auto_lock sentry(category_hash_mutex());
+ Category_Map::iterator it = pM->find(name);
+ if (it != pM->end()) {
+ // Decrement the ref count. If it goes to zero, delete this category
+ // from the map.
+ if (--((*it).second.second) == 0) {
+ void* cat1 = (*it).second.first;
+ destroy_fun(cat1);
+ pM->erase(it);
+#if defined (_STLP_LEAKS_PEDANTIC)
+ if (pM->empty()) {
+ delete pM;
+ *M = 0;
+ }
+#endif
+ }
+ }
+ }
+ }
+}
+
+_Locale_ctype* _STLP_CALL __acquire_ctype(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_ctype*, __acquire_category(name, buf, hint,
+ _Locale_extract_ctype_name, _Loc_ctype_create, _Loc_ctype_default,
+ ctype_hash(), __err_code));
+}
+_Locale_codecvt* _STLP_CALL __acquire_codecvt(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_codecvt*, __acquire_category(name, buf, hint,
+ _Locale_extract_ctype_name, _Loc_codecvt_create, _Loc_ctype_default,
+ codecvt_hash(), __err_code));
+}
+_Locale_numeric* _STLP_CALL __acquire_numeric(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_numeric*, __acquire_category(name, buf, hint,
+ _Locale_extract_numeric_name, _Loc_numeric_create, _Loc_numeric_default,
+ numeric_hash(), __err_code));
+}
+_Locale_time* _STLP_CALL __acquire_time(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_time*, __acquire_category(name, buf, hint,
+ _Locale_extract_time_name, _Loc_time_create, _Loc_time_default,
+ time_hash(), __err_code));
+}
+_Locale_collate* _STLP_CALL __acquire_collate(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_collate*, __acquire_category(name, buf, hint,
+ _Locale_extract_collate_name, _Loc_collate_create, _Loc_collate_default,
+ collate_hash(), __err_code));
+}
+_Locale_monetary* _STLP_CALL __acquire_monetary(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_monetary*, __acquire_category(name, buf, hint,
+ _Locale_extract_monetary_name, _Loc_monetary_create, _Loc_monetary_default,
+ monetary_hash(), __err_code));
+}
+_Locale_messages* _STLP_CALL __acquire_messages(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) {
+ return __REINTERPRET_CAST(_Locale_messages*, __acquire_category(name, buf, hint,
+ _Locale_extract_messages_name, _Loc_messages_create, _Loc_messages_default,
+ messages_hash(), __err_code));
+}
+
+void _STLP_CALL __release_ctype(_Locale_ctype* cat)
+{ __release_category(cat, _Loc_ctype_destroy, _Loc_ctype_name, ctype_hash()); }
+void _STLP_CALL __release_codecvt(_Locale_codecvt* cat)
+{ __release_category(cat, _Loc_codecvt_destroy, _Loc_codecvt_name, codecvt_hash()); }
+void _STLP_CALL __release_numeric(_Locale_numeric* cat)
+{ __release_category(cat, _Loc_numeric_destroy, _Loc_numeric_name, numeric_hash()); }
+void _STLP_CALL __release_time(_Locale_time* cat)
+{ __release_category(cat, _Loc_time_destroy, _Loc_time_name, time_hash()); }
+void _STLP_CALL __release_collate(_Locale_collate* cat)
+{ __release_category(cat, _Loc_collate_destroy, _Loc_collate_name, collate_hash()); }
+void _STLP_CALL __release_monetary(_Locale_monetary* cat)
+{ __release_category(cat, _Loc_monetary_destroy, _Loc_monetary_name, monetary_hash()); }
+void _STLP_CALL __release_messages(_Locale_messages* cat)
+{ __release_category(cat, _Loc_messages_destroy, _Loc_messages_name, messages_hash()); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
diff --git a/src/locale_impl.cpp b/src/locale_impl.cpp
new file mode 100644
index 0000000..103b603
--- /dev/null
+++ b/src/locale_impl.cpp
@@ -0,0 +1,765 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <locale>
+#include <algorithm>
+#include <typeinfo>
+
+#include "c_locale.h"
+#include "aligned_buffer.h"
+#include "acquire_release.h"
+#include "locale_impl.h"
+
+_STLP_BEGIN_NAMESPACE
+
+static const string _Nameless("*");
+
+static inline bool is_C_locale_name (const char* name)
+{ return ((name[0] == 'C') && (name[1] == 0)); }
+
+locale::facet * _STLP_CALL _get_facet(locale::facet *f)
+{
+ if (f != 0)
+ f->_M_incr();
+ return f;
+}
+
+void _STLP_CALL _release_facet(locale::facet *&f)
+{
+ if ((f != 0) && (f->_M_decr() == 0)) {
+ delete f;
+ f = 0;
+ }
+}
+
+size_t locale::id::_S_max = 27;
+
+static void _Stl_loc_assign_ids();
+
+static _Stl_aligned_buffer<_Locale_impl::Init> __Loc_init_buf;
+
+_Locale_impl::Init::Init() {
+ if (_M_count()._M_incr() == 1) {
+ _Locale_impl::_S_initialize();
+ }
+}
+
+_Locale_impl::Init::~Init() {
+ if (_M_count()._M_decr() == 0) {
+ _Locale_impl::_S_uninitialize();
+ }
+}
+
+_Refcount_Base& _Locale_impl::Init::_M_count() const {
+ static _Refcount_Base _S_count(0);
+ return _S_count;
+}
+
+_Locale_impl::_Locale_impl(const char* s)
+ : _Refcount_Base(0), name(s), facets_vec() {
+ facets_vec.reserve( locale::id::_S_max );
+ new (&__Loc_init_buf) Init();
+}
+
+_Locale_impl::_Locale_impl( _Locale_impl const& locimpl )
+ : _Refcount_Base(0), name(locimpl.name), facets_vec() {
+ for_each( locimpl.facets_vec.begin(), locimpl.facets_vec.end(), _get_facet);
+ facets_vec = locimpl.facets_vec;
+ new (&__Loc_init_buf) Init();
+}
+
+_Locale_impl::_Locale_impl( size_t n, const char* s)
+ : _Refcount_Base(0), name(s), facets_vec(n, 0) {
+ new (&__Loc_init_buf) Init();
+}
+
+_Locale_impl::~_Locale_impl() {
+ (&__Loc_init_buf)->~Init();
+ for_each( facets_vec.begin(), facets_vec.end(), _release_facet);
+}
+
+// Initialization of the locale system. This must be called before
+// any locales are constructed. (Meaning that it must be called when
+// the I/O library itself is initialized.)
+void _STLP_CALL _Locale_impl::_S_initialize() {
+ _Stl_loc_assign_ids();
+ make_classic_locale();
+}
+
+// Release of the classic locale ressources. Has to be called after the last
+// locale destruction and not only after the classic locale destruction as
+// the facets can be shared between different facets.
+void _STLP_CALL _Locale_impl::_S_uninitialize() {
+ //Not necessary anymore as classic facets are now 'normal' dynamically allocated
+ //facets with a reference counter telling to _release_facet when the facet can be
+ //deleted.
+ //free_classic_locale();
+}
+
+// _Locale_impl non-inline member functions.
+void _STLP_CALL _Locale_impl::_M_throw_bad_cast() {
+ _STLP_THROW(bad_cast());
+}
+
+void _Locale_impl::insert(_Locale_impl *from, const locale::id& n) {
+ if (n._M_index > 0 && n._M_index < from->size()) {
+ this->insert(from->facets_vec[n._M_index], n);
+ }
+}
+
+locale::facet* _Locale_impl::insert(locale::facet *f, const locale::id& n) {
+ if (f == 0 || n._M_index == 0)
+ return 0;
+
+ if (n._M_index >= facets_vec.size()) {
+ facets_vec.resize(n._M_index + 1);
+ }
+
+ if (f != facets_vec[n._M_index])
+ {
+ _release_facet(facets_vec[n._M_index]);
+ facets_vec[n._M_index] = _get_facet(f);
+ }
+
+ return f;
+}
+
+//
+// <locale> content which is dependent on the name
+//
+
+/* Six functions, one for each category. Each of them takes a
+ * a name, constructs that appropriate category facets by name,
+ * and inserts them into the locale. */
+_Locale_name_hint* _Locale_impl::insert_ctype_facets(const char* &name, char *buf, _Locale_name_hint* hint) {
+ if (name[0] == 0)
+ name = _Locale_ctype_default(buf);
+
+ if (name == 0 || name[0] == 0 || is_C_locale_name(name)) {
+ _Locale_impl* i2 = locale::classic()._M_impl;
+ this->insert(i2, ctype<char>::id);
+ this->insert(i2, codecvt<char, char, mbstate_t>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2, ctype<wchar_t>::id);
+ this->insert(i2, codecvt<wchar_t, char, mbstate_t>::id);
+#endif
+ } else {
+ locale::facet* ct = 0;
+ locale::facet* cvt = 0;
+#ifndef _STLP_NO_WCHAR_T
+ locale::facet* wct = 0;
+ locale::facet* wcvt = 0;
+#endif
+ int __err_code;
+ _Locale_ctype *__lct = _STLP_PRIV __acquire_ctype(name, buf, hint, &__err_code);
+ if (!__lct) {
+ locale::_M_throw_on_creation_failure(__err_code, name, "ctype");
+ return hint;
+ }
+
+ if (hint == 0) hint = _Locale_get_ctype_hint(__lct);
+
+ _STLP_TRY {
+ ct = new ctype_byname<char>(__lct);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_ctype(__lct));
+
+ _STLP_TRY {
+ cvt = new codecvt_byname<char, char, mbstate_t>(name);
+ }
+ _STLP_UNWIND(delete ct);
+
+#ifndef _STLP_NO_WCHAR_T
+ _STLP_TRY {
+ _Locale_ctype *__lwct = _STLP_PRIV __acquire_ctype(name, buf, hint, &__err_code);
+ if (!__lwct) {
+ locale::_M_throw_on_creation_failure(__err_code, name, "ctype");
+ return hint;
+ }
+
+ _STLP_TRY {
+ wct = new ctype_byname<wchar_t>(__lwct);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_ctype(__lwct));
+
+ _Locale_codecvt *__lwcvt = _STLP_PRIV __acquire_codecvt(name, buf, hint, &__err_code);
+ if (__lwcvt) {
+ _STLP_TRY {
+ wcvt = new codecvt_byname<wchar_t, char, mbstate_t>(__lwcvt);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_codecvt(__lwcvt); delete wct);
+ }
+ }
+ _STLP_UNWIND(delete cvt; delete ct);
+#endif
+
+ this->insert(ct, ctype<char>::id);
+ this->insert(cvt, codecvt<char, char, mbstate_t>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(wct, ctype<wchar_t>::id);
+ if (wcvt) this->insert(wcvt, codecvt<wchar_t, char, mbstate_t>::id);
+#endif
+ }
+ return hint;
+}
+
+_Locale_name_hint* _Locale_impl::insert_numeric_facets(const char* &name, char *buf, _Locale_name_hint* hint) {
+ if (name[0] == 0)
+ name = _Locale_numeric_default(buf);
+
+ _Locale_impl* i2 = locale::classic()._M_impl;
+
+ // We first insert name independant facets taken from the classic locale instance:
+ this->insert(i2,
+ num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+ this->insert(i2,
+ num_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2,
+ num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ this->insert(i2,
+ num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+#endif
+
+ if (name == 0 || name[0] == 0 || is_C_locale_name(name)) {
+ this->insert(i2, numpunct<char>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2, numpunct<wchar_t>::id);
+#endif
+ }
+ else {
+ locale::facet* punct = 0;
+#ifndef _STLP_NO_WCHAR_T
+ locale::facet* wpunct = 0;
+#endif
+
+ int __err_code;
+ _Locale_numeric *__lpunct = _STLP_PRIV __acquire_numeric(name, buf, hint, &__err_code);
+ if (!__lpunct) {
+ locale::_M_throw_on_creation_failure(__err_code, name, "numpunct");
+ return hint;
+ }
+
+ if (hint == 0) hint = _Locale_get_numeric_hint(__lpunct);
+ _STLP_TRY {
+ punct = new numpunct_byname<char>(__lpunct);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_numeric(__lpunct));
+
+#ifndef _STLP_NO_WCHAR_T
+ _Locale_numeric *__lwpunct = _STLP_PRIV __acquire_numeric(name, buf, hint, &__err_code);
+ if (!__lwpunct) {
+ delete punct;
+ locale::_M_throw_on_creation_failure(__err_code, name, "numpunct");
+ return hint;
+ }
+ if (__lwpunct) {
+ _STLP_TRY {
+ wpunct = new numpunct_byname<wchar_t>(__lwpunct);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_numeric(__lwpunct); delete punct);
+ }
+#endif
+
+ this->insert(punct, numpunct<char>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(wpunct, numpunct<wchar_t>::id);
+#endif
+ }
+ return hint;
+}
+
+_Locale_name_hint* _Locale_impl::insert_time_facets(const char* &name, char *buf, _Locale_name_hint* hint) {
+ if (name[0] == 0)
+ name = _Locale_time_default(buf);
+
+ if (name == 0 || name[0] == 0 || is_C_locale_name(name)) {
+ _Locale_impl* i2 = locale::classic()._M_impl;
+ this->insert(i2,
+ time_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+ this->insert(i2,
+ time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2,
+ time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ this->insert(i2,
+ time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+#endif
+ } else {
+ locale::facet *get = 0;
+ locale::facet *put = 0;
+#ifndef _STLP_NO_WCHAR_T
+ locale::facet *wget = 0;
+ locale::facet *wput = 0;
+#endif
+
+ int __err_code;
+ _Locale_time *__time = _STLP_PRIV __acquire_time(name, buf, hint, &__err_code);
+ if (!__time) {
+ // time facets category is not mandatory for correct stream behavior so if platform
+ // do not support it we do not generate a runtime_error exception.
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return hint;
+ }
+
+ if (!hint) hint = _Locale_get_time_hint(__time);
+ _STLP_TRY {
+ get = new time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >(__time);
+ put = new time_put_byname<char, ostreambuf_iterator<char, char_traits<char> > >(__time);
+#ifndef _STLP_NO_WCHAR_T
+ wget = new time_get_byname<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(__time);
+ wput = new time_put_byname<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(__time);
+#endif
+ }
+#ifndef _STLP_NO_WCHAR_T
+ _STLP_UNWIND(delete wget; delete put; delete get; _STLP_PRIV __release_time(__time));
+#else
+ _STLP_UNWIND(delete get; _STLP_PRIV __release_time(__time));
+#endif
+
+ _STLP_PRIV __release_time(__time);
+
+ this->insert(get, time_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+ this->insert(put, time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(wget, time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ this->insert(wput, time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+#endif
+ }
+ return hint;
+}
+
+_Locale_name_hint* _Locale_impl::insert_collate_facets(const char* &name, char *buf, _Locale_name_hint* hint) {
+ if (name[0] == 0)
+ name = _Locale_collate_default(buf);
+
+ if (name == 0 || name[0] == 0 || is_C_locale_name(name)) {
+ _Locale_impl* i2 = locale::classic()._M_impl;
+ this->insert(i2, collate<char>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2, collate<wchar_t>::id);
+#endif
+ }
+ else {
+ locale::facet *col = 0;
+#ifndef _STLP_NO_WCHAR_T
+ locale::facet *wcol = 0;
+#endif
+
+ int __err_code;
+ _Locale_collate *__coll = _STLP_PRIV __acquire_collate(name, buf, hint, &__err_code);
+ if (!__coll) {
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return hint;
+ }
+
+ if (hint == 0) hint = _Locale_get_collate_hint(__coll);
+ _STLP_TRY {
+ col = new collate_byname<char>(__coll);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_collate(__coll));
+
+#ifndef _STLP_NO_WCHAR_T
+ _Locale_collate *__wcoll = _STLP_PRIV __acquire_collate(name, buf, hint, &__err_code);
+ if (!__wcoll) {
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ delete col;
+ _STLP_THROW_BAD_ALLOC;
+ }
+ }
+ if (__wcoll) {
+ _STLP_TRY {
+ wcol = new collate_byname<wchar_t>(__wcoll);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_collate(__wcoll); delete col);
+ }
+#endif
+
+ this->insert(col, collate<char>::id);
+#ifndef _STLP_NO_WCHAR_T
+ if (wcol) this->insert(wcol, collate<wchar_t>::id);
+#endif
+ }
+ return hint;
+}
+
+_Locale_name_hint* _Locale_impl::insert_monetary_facets(const char* &name, char *buf, _Locale_name_hint* hint) {
+ if (name[0] == 0)
+ name = _Locale_monetary_default(buf);
+
+ _Locale_impl* i2 = locale::classic()._M_impl;
+
+ // We first insert name independant facets taken from the classic locale instance:
+ this->insert(i2, money_get<char, istreambuf_iterator<char, char_traits<char> > >::id);
+ this->insert(i2, money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2, money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+ this->insert(i2, money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id);
+#endif
+
+ if (name == 0 || name[0] == 0 || is_C_locale_name(name)) {
+ this->insert(i2, moneypunct<char, false>::id);
+ this->insert(i2, moneypunct<char, true>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2, moneypunct<wchar_t, false>::id);
+ this->insert(i2, moneypunct<wchar_t, true>::id);
+#endif
+ }
+ else {
+ locale::facet *punct = 0;
+ locale::facet *ipunct = 0;
+
+#ifndef _STLP_NO_WCHAR_T
+ locale::facet* wpunct = 0;
+ locale::facet* wipunct = 0;
+#endif
+
+ int __err_code;
+ _Locale_monetary *__mon = _STLP_PRIV __acquire_monetary(name, buf, hint, &__err_code);
+ if (!__mon) {
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return hint;
+ }
+
+ if (hint == 0) hint = _Locale_get_monetary_hint(__mon);
+
+ _STLP_TRY {
+ punct = new moneypunct_byname<char, false>(__mon);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_monetary(__mon));
+
+ _Locale_monetary *__imon = _STLP_PRIV __acquire_monetary(name, buf, hint, &__err_code);
+ if (!__imon) {
+ delete punct;
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return hint;
+ }
+
+ _STLP_TRY {
+ ipunct = new moneypunct_byname<char, true>(__imon);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_monetary(__imon); delete punct);
+
+#ifndef _STLP_NO_WCHAR_T
+ _STLP_TRY {
+ _Locale_monetary *__wmon = _STLP_PRIV __acquire_monetary(name, buf, hint, &__err_code);
+ if (!__wmon) {
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ }
+
+ if (__wmon) {
+ _STLP_TRY {
+ wpunct = new moneypunct_byname<wchar_t, false>(__wmon);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_monetary(__wmon));
+
+ _Locale_monetary *__wimon = _STLP_PRIV __acquire_monetary(name, buf, hint, &__err_code);
+ if (!__wimon) {
+ delete wpunct;
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ wpunct = 0;
+ }
+ else {
+ _STLP_TRY {
+ wipunct = new moneypunct_byname<wchar_t, true>(__wimon);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_monetary(__wimon); delete wpunct);
+ }
+ }
+ }
+ _STLP_UNWIND(delete ipunct; delete punct);
+#endif
+
+ this->insert(punct, moneypunct<char, false>::id);
+ this->insert(ipunct, moneypunct<char, true>::id);
+#ifndef _STLP_NO_WCHAR_T
+ if (wpunct) this->insert(wpunct, moneypunct<wchar_t, false>::id);
+ if (wipunct) this->insert(wipunct, moneypunct<wchar_t, true>::id);
+#endif
+ }
+ return hint;
+}
+
+_Locale_name_hint* _Locale_impl::insert_messages_facets(const char* &name, char *buf, _Locale_name_hint* hint) {
+ if (name[0] == 0)
+ name = _Locale_messages_default(buf);
+
+ if (name == 0 || name[0] == 0 || is_C_locale_name(name)) {
+ _Locale_impl* i2 = locale::classic()._M_impl;
+ this->insert(i2, messages<char>::id);
+#ifndef _STLP_NO_WCHAR_T
+ this->insert(i2, messages<wchar_t>::id);
+#endif
+ }
+ else {
+ locale::facet *msg = 0;
+#ifndef _STLP_NO_WCHAR_T
+ locale::facet *wmsg = 0;
+#endif
+
+ int __err_code;
+ _Locale_messages *__msg = _STLP_PRIV __acquire_messages(name, buf, hint, &__err_code);
+ if (!__msg) {
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return hint;
+ }
+
+ _STLP_TRY {
+ msg = new messages_byname<char>(__msg);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_messages(__msg));
+
+#ifndef _STLP_NO_WCHAR_T
+ _STLP_TRY {
+ _Locale_messages *__wmsg = _STLP_PRIV __acquire_messages(name, buf, hint, &__err_code);
+ if (!__wmsg) {
+ if (__err_code == _STLP_LOC_NO_MEMORY) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ }
+
+ if (__wmsg) {
+ _STLP_TRY {
+ wmsg = new messages_byname<wchar_t>(__wmsg);
+ }
+ _STLP_UNWIND(_STLP_PRIV __release_messages(__wmsg));
+ }
+ }
+ _STLP_UNWIND(delete msg);
+#endif
+
+ this->insert(msg, messages<char>::id);
+#ifndef _STLP_NO_WCHAR_T
+ if (wmsg) this->insert(wmsg, messages<wchar_t>::id);
+#endif
+ }
+ return hint;
+}
+
+static void _Stl_loc_assign_ids() {
+ // This assigns ids to every facet that is a member of a category,
+ // and also to money_get/put, num_get/put, and time_get/put
+ // instantiated using ordinary pointers as the input/output
+ // iterators. (The default is [io]streambuf_iterator.)
+
+ money_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 8;
+ money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 9;
+ num_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 10;
+ num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 11;
+ time_get<char, istreambuf_iterator<char, char_traits<char> > >::id._M_index = 12;
+ time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id._M_index = 13;
+
+#ifndef _STLP_NO_WCHAR_T
+ money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 21;
+ money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 22;
+ num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 23;
+ num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > ::id._M_index = 24;
+ time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 25;
+ time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id._M_index = 26;
+#endif
+ // locale::id::_S_max = 27;
+}
+
+// To access those static instance use the getter below, they guaranty
+// a correct initialization.
+static locale *_Stl_classic_locale = 0;
+static locale *_Stl_global_locale = 0;
+
+locale* _Stl_get_classic_locale() {
+ static _Locale_impl::Init init;
+ return _Stl_classic_locale;
+}
+
+locale* _Stl_get_global_locale() {
+ static _Locale_impl::Init init;
+ return _Stl_global_locale;
+}
+
+#if defined (_STLP_MSVC) || defined (__ICL) || defined (__ISCPP__) || defined (__DMC__)
+/*
+ * The following static variable needs to be initialized before STLport
+ * users static variable in order for him to be able to use Standard
+ * streams in its variable initialization.
+ * This variable is here because MSVC do not allow to change the initialization
+ * segment in a given translation unit, iostream.cpp already contains an
+ * initialization segment specification.
+ */
+# pragma warning (disable : 4073)
+# pragma init_seg(lib)
+#endif
+
+static ios_base::Init _IosInit;
+
+void _Locale_impl::make_classic_locale() {
+ // This funcion will be called once: during build classic _Locale_impl
+
+ // The classic locale contains every facet that belongs to a category.
+ static _Stl_aligned_buffer<_Locale_impl> _Locale_classic_impl_buf;
+ _Locale_impl *classic = new(&_Locale_classic_impl_buf) _Locale_impl("C");
+
+ locale::facet* classic_facets[] = {
+ 0,
+ new collate<char>(1),
+ new ctype<char>(0, false, 1),
+ new codecvt<char, char, mbstate_t>(1),
+ new moneypunct<char, true>(1),
+ new moneypunct<char, false>(1),
+ new numpunct<char>(1),
+ new messages<char>(1),
+ new money_get<char, istreambuf_iterator<char, char_traits<char> > >(1),
+ new money_put<char, ostreambuf_iterator<char, char_traits<char> > >(1),
+ new num_get<char, istreambuf_iterator<char, char_traits<char> > >(1),
+ new num_put<char, ostreambuf_iterator<char, char_traits<char> > >(1),
+ new time_get<char, istreambuf_iterator<char, char_traits<char> > >(1),
+ new time_put<char, ostreambuf_iterator<char, char_traits<char> > >(1),
+#ifndef _STLP_NO_WCHAR_T
+ new collate<wchar_t>(1),
+ new ctype<wchar_t>(1),
+ new codecvt<wchar_t, char, mbstate_t>(1),
+ new moneypunct<wchar_t, true>(1),
+ new moneypunct<wchar_t, false>(1),
+ new numpunct<wchar_t>(1),
+ new messages<wchar_t>(1),
+ new money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
+ new money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
+ new num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
+ new num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
+ new time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
+ new time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(1),
+#endif
+ 0
+ };
+
+ const size_t nb_classic_facets = sizeof(classic_facets) / sizeof(locale::facet *);
+ classic->facets_vec.reserve(nb_classic_facets);
+ classic->facets_vec.assign(&classic_facets[0], &classic_facets[0] + nb_classic_facets);
+
+ static locale _Locale_classic(classic);
+ _Stl_classic_locale = &_Locale_classic;
+
+ static locale _Locale_global(classic);
+ _Stl_global_locale = &_Locale_global;
+}
+
+// Declarations of (non-template) facets' static data members
+// size_t locale::id::_S_max = 27; // made before
+
+locale::id collate<char>::id = { 1 };
+locale::id ctype<char>::id = { 2 };
+locale::id codecvt<char, char, mbstate_t>::id = { 3 };
+locale::id moneypunct<char, true>::id = { 4 };
+locale::id moneypunct<char, false>::id = { 5 };
+locale::id numpunct<char>::id = { 6 } ;
+locale::id messages<char>::id = { 7 };
+
+#ifndef _STLP_NO_WCHAR_T
+locale::id collate<wchar_t>::id = { 14 };
+locale::id ctype<wchar_t>::id = { 15 };
+locale::id codecvt<wchar_t, char, mbstate_t>::id = { 16 };
+locale::id moneypunct<wchar_t, true>::id = { 17 } ;
+locale::id moneypunct<wchar_t, false>::id = { 18 } ;
+locale::id numpunct<wchar_t>::id = { 19 };
+locale::id messages<wchar_t>::id = { 20 };
+#endif
+
+_STLP_DECLSPEC _Locale_impl* _STLP_CALL _get_Locale_impl(_Locale_impl *loc)
+{
+ _STLP_ASSERT( loc != 0 );
+ loc->_M_incr();
+ return loc;
+}
+
+void _STLP_CALL _release_Locale_impl(_Locale_impl *& loc)
+{
+ _STLP_ASSERT( loc != 0 );
+ if (loc->_M_decr() == 0) {
+ if (*loc != *_Stl_classic_locale)
+ delete loc;
+ else
+ loc->~_Locale_impl();
+ loc = 0;
+ }
+}
+
+_STLP_DECLSPEC _Locale_impl* _STLP_CALL _copy_Nameless_Locale_impl(_Locale_impl *loc)
+{
+ _STLP_ASSERT( loc != 0 );
+ _Locale_impl *loc_new = new _Locale_impl(*loc);
+ loc_new->name = _Nameless;
+ return loc_new;
+}
+
+/* _GetFacetId implementation have to be here in order to be in the same translation unit
+ * as where id are initialize (in _Stl_loc_assign_ids) */
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_get<char, istreambuf_iterator<char, char_traits<char> > >*)
+{ return money_get<char, istreambuf_iterator<char, char_traits<char> > >::id; }
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_put<char, ostreambuf_iterator<char, char_traits<char> > >*)
+{ return money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id; }
+#ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*)
+{ return money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; }
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*)
+{ return money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; }
+#endif
+
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_get<char, istreambuf_iterator<char, char_traits<char> > >*)
+{ return num_get<char, istreambuf_iterator<char, char_traits<char> > >::id; }
+#ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*)
+{ return num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; }
+#endif
+
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_put<char, ostreambuf_iterator<char, char_traits<char> > >*)
+{ return num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id; }
+#ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*)
+{ return num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; }
+#endif
+
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_get<char, istreambuf_iterator<char, char_traits<char> > >*)
+{ return time_get<char, istreambuf_iterator<char, char_traits<char> > >::id; }
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_put<char, ostreambuf_iterator<char, char_traits<char> > >*)
+{ return time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id; }
+#ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*)
+{ return time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; }
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*)
+{ return time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id; }
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
diff --git a/src/locale_impl.h b/src/locale_impl.h
new file mode 100644
index 0000000..2aa694c
--- /dev/null
+++ b/src/locale_impl.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef LOCALE_IMPL_H
+#define LOCALE_IMPL_H
+
+#include <clocale> // C locale header file.
+#include <vector>
+#include <string>
+#include <locale>
+#include "c_locale.h"
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+//Export of _Locale_impl facets container:
+# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
+//If we are using pointer specialization, vector<locale::facet*> will use
+//the already exported vector<void*> implementation.
+_STLP_EXPORT_TEMPLATE_CLASS allocator<locale::facet*>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Vector_base<locale::facet*, allocator<locale::facet*> >;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+# if defined (_STLP_DEBUG)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
+_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >;
+# undef _STLP_NON_DBG_VECTOR
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+_STLP_EXPORT_TEMPLATE_CLASS vector<locale::facet*, allocator<locale::facet*> >;
+#endif
+
+//----------------------------------------------------------------------
+// Class _Locale_impl
+// This is the base class which implements access only and is supposed to
+// be used for classic locale only
+class _STLP_CLASS_DECLSPEC _Locale_impl : public _Refcount_Base {
+ public:
+ _Locale_impl(const char* s);
+ _Locale_impl(const _Locale_impl&);
+ _Locale_impl(size_t n, const char* s);
+
+ private:
+ ~_Locale_impl();
+
+ public:
+ size_t size() const { return facets_vec.size(); }
+
+ basic_string<char, char_traits<char>, allocator<char> > name;
+
+ static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_bad_cast();
+
+ private:
+ void operator=(const _Locale_impl&);
+
+ public:
+ class _STLP_CLASS_DECLSPEC Init {
+ public:
+ Init();
+ ~Init();
+ private:
+ _Refcount_Base& _M_count() const;
+ };
+
+ static void _STLP_CALL _S_initialize();
+ static void _STLP_CALL _S_uninitialize();
+
+ static void make_classic_locale();
+ static void free_classic_locale();
+
+ friend class Init;
+
+ public:
+ // void remove(size_t index);
+ locale::facet* insert(locale::facet*, const locale::id& n);
+ void insert(_Locale_impl* from, const locale::id& n);
+
+ // Helper functions for byname construction of locales.
+ _Locale_name_hint* insert_ctype_facets(const char* &name, char *buf, _Locale_name_hint* hint);
+ _Locale_name_hint* insert_numeric_facets(const char* &name, char *buf, _Locale_name_hint* hint);
+ _Locale_name_hint* insert_time_facets(const char* &name, char *buf, _Locale_name_hint* hint);
+ _Locale_name_hint* insert_collate_facets(const char* &name, char *buf, _Locale_name_hint* hint);
+ _Locale_name_hint* insert_monetary_facets(const char* &name, char *buf, _Locale_name_hint* hint);
+ _Locale_name_hint* insert_messages_facets(const char* &name, char *buf, _Locale_name_hint* hint);
+
+ bool operator != (const locale& __loc) const { return __loc._M_impl != this; }
+
+ private:
+ vector<locale::facet*> facets_vec;
+
+ private:
+ friend _Locale_impl * _STLP_CALL _copy_Nameless_Locale_impl( _Locale_impl * );
+ friend void _STLP_CALL _release_Locale_impl( _Locale_impl *& loc );
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+ friend class _STLP_NO_MEM_T_NAME(loc);
+#else
+ friend class locale;
+#endif
+};
+
+void _STLP_CALL _release_Locale_impl( _Locale_impl *& loc );
+
+_STLP_END_NAMESPACE
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/lock_free_slist.h b/src/lock_free_slist.h
new file mode 100644
index 0000000..7c753d1
--- /dev/null
+++ b/src/lock_free_slist.h
@@ -0,0 +1,307 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_LOCK_FREE_SLIST_H
+#define _STLP_LOCK_FREE_SLIST_H
+
+#if defined(_STLP_PTHREADS)
+# include <pthread.h>
+
+# if defined (__GNUC__) && defined (__i386__)
+
+# define _STLP_HAS_ATOMIC_FREELIST
+/**
+ * Class that implements a non-blocking and thread-safe freelist.
+ * It is used for the lock-free node allocation engine.
+ *
+ * @author felixw@inin.com
+ */
+class _STLP_atomic_freelist {
+public:
+ /**
+ * Type representing items of the freelist
+ */
+ struct item {
+ item* _M_next;
+ };
+
+ _STLP_atomic_freelist() {
+ // Statically assert layout of member is as expected by assembly code
+ _STLP_STATIC_ASSERT(sizeof(_M) == 8)
+ _M._M_data._M_top = 0;
+ _M._M_data._M_sequence = 0;
+ }
+
+ /**
+ * Atomically pushes the specified item onto the freelist.
+ *
+ * @param __item [in] Item to add to the front of the list
+ */
+ void push(item* __item) {
+ // NOTE: GCC uses ebx as the PIC register for globals in shared libraries.
+ // The GCC version I'm using (3.4.1) won't temporarily spill it if it's
+ // used as input, output, or clobber. Instead, it complains with a
+ // "can't find a register in class `BREG' while reloading `asm'" error.
+ // This is probably a compiler bug, but as the cmpxchg8b instruction
+ // requires ebx, I work around this here by using ecx for the '__item'
+ // input and spilling ebx into edi. This also precludes us from using
+ // a "m" operand for the cmpxchg8b argument (GCC might think it can make
+ // it relative to ebx). Instead, we're using esi for the address of _M_data.
+ //
+ int __tmp1; // These dummy variables are used to tell GCC that the eax, ecx,
+ int __tmp2; // and edx registers will not have the same value as their input.
+ int __tmp3; // The optimizer will remove them as their values are not used.
+ __asm__ __volatile__
+ (" movl %%ebx, %%edi\n\t"
+ " movl %%ecx, %%ebx\n\t"
+ "L1_%=: movl %%eax, (%%ebx)\n\t" // __item._M_next = _M._M_data._M_top
+ " leal 1(%%edx),%%ecx\n\t" // new sequence = _M._M_data._M_sequence + 1
+ "lock; cmpxchg8b (%%esi)\n\t"
+ " jne L1_%=\n\t" // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
+ " movl %%edi, %%ebx"
+ :"=a" (__tmp1), "=d" (__tmp2), "=c" (__tmp3)
+ :"a" (_M._M_data._M_top), "d" (_M._M_data._M_sequence), "c" (__item), "S" (&_M._M_data)
+ :"edi", "memory", "cc");
+ }
+
+ /**
+ * Atomically removes the topmost item from the freelist and returns a
+ * pointer to it. Returns NULL if the list is empty.
+ *
+ * @return Item that was removed from front of list; NULL if list empty
+ */
+ item* pop() {
+ item* __result;
+ int __tmp;
+ __asm__ __volatile__
+ (" movl %%ebx, %%edi\n\t"
+ "L1_%=: testl %%eax, %%eax\n\t" // _M_top == NULL?
+ " je L2_%=\n\t" // If yes, we're done
+ " movl (%%eax), %%ebx\n\t" // new top = _M._M_data._M_top->_M_next
+ " leal 1(%%edx),%%ecx\n\t" // new sequence = _M._M_data._M_sequence + 1
+ "lock; cmpxchg8b (%%esi)\n\t"
+ " jne L1_%=\n\t" // We failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
+ "L2_%=: movl %%edi, %%ebx"
+ :"=a" (__result), "=d" (__tmp)
+ :"a" (_M._M_data._M_top), "d" (_M._M_data._M_sequence), "S" (&_M._M_data)
+ :"edi", "ecx", "memory", "cc");
+ return __result;
+ }
+
+ /**
+ * Atomically detaches all items from the list and returns a pointer to the
+ * topmost item. The items are still chained and may be traversed safely as
+ * they're now "owned" by the calling thread.
+ *
+ * @return Pointer to topmost item in the list; NULL if list empty
+ */
+ item* clear() {
+ item* __result;
+ int __tmp;
+ __asm__ __volatile__
+ (" movl %%ebx, %%edi\n\t"
+ "L1_%=: testl %%eax, %%eax\n\t" // _M_top == NULL?
+ " je L2_%=\n\t" // If yes, we're done
+ " xorl %%ebx, %%ebx\n\t" // We're attempting to set _M_top to NULL
+ " leal 1(%%edx),%%ecx\n\t" // new sequence = _M._M_data._M_sequence + 1
+ "lock; cmpxchg8b (%%esi)\n\t"
+ " jne L1_%=\n\t" // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
+ "L2_%=: movl %%edi, %%ebx"
+ :"=a" (__result), "=d" (__tmp)
+ :"a" (_M._M_data._M_top), "d" (_M._M_data._M_sequence), "S" (&_M._M_data)
+ :"edi", "ecx", "memory", "cc");
+ return __result;
+ }
+
+private:
+ union {
+ long long _M_align;
+ struct {
+ item* _M_top; // Topmost element in the freelist
+ unsigned int _M_sequence; // Sequence counter to prevent "ABA problem"
+ } _M_data;
+ } _M;
+
+ _STLP_atomic_freelist(const _STLP_atomic_freelist&);
+ _STLP_atomic_freelist& operator=(const _STLP_atomic_freelist&);
+};
+
+# endif /* if defined(__GNUC__) && defined(__i386__) */
+
+#elif defined (_STLP_WIN32THREADS)
+
+# if !defined (_WIN64)
+# define _STLP_USE_ASM_IMPLEMENTATION
+# endif
+
+// Here are the compiler/platform requirements for the thread safe and
+// lock free singly linked list implementation:
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+// For the asm version:
+# if defined (_STLP_MSVC) && defined (_M_IX86) && (_M_IX86 >= 500)
+# define _STLP_HAS_ATOMIC_FREELIST
+# endif
+# else
+// For the API based version:
+# if defined (_STLP_NEW_PLATFORM_SDK) && (!defined (WINVER) || (WINVER >= 0x0501)) && \
+ (!defined (_WIN32_WINNT) || (_WIN32_WINNT >= 0x0501))
+# define _STLP_HAS_ATOMIC_FREELIST
+# endif
+# endif
+
+# if defined (_STLP_HAS_ATOMIC_FREELIST)
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) || defined (__ICL)
+# pragma warning (push)
+# pragma warning (disable : 4035) //function has no return value
+# endif
+# endif
+/**
+ * Class that implements a non-blocking and thread-safe freelist.
+ * It is used for the lock-free node allocation engine.
+ *
+ * @author felixw@inin.com
+ */
+class _STLP_atomic_freelist {
+public:
+ /**
+ * Type representing items of the freelist
+ */
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+ struct item {
+ item* _M_next;
+ };
+# else
+ typedef SLIST_ENTRY item;
+# endif
+
+ _STLP_atomic_freelist() {
+ // Statically assert layout of member is as expected by assembly code
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+ _STLP_STATIC_ASSERT((sizeof(item) == sizeof(item*)) && (sizeof(_M) == 8))
+ _M._M_data._M_top = 0;
+ _M._M_data._M_sequence = 0;
+# else
+ InitializeSListHead(&_M_head);
+# endif
+ }
+
+ /**
+ * Atomically pushes the specified item onto the freelist.
+ *
+ * @param __item [in] Item to add to the front of the list
+ */
+ void push(item* __item) {
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+ __asm
+ {
+ mov esi, this
+ mov ebx, __item
+ mov eax, [esi] // _M._M_data._M_top
+ mov edx, [esi+4] // _M._M_data._M_sequence
+ L1: mov [ebx], eax // __item._M_next = _M._M_data._M_top
+ lea ecx, [edx+1] // new sequence = _M._M_data._M_sequence + 1
+ lock cmpxchg8b qword ptr [esi]
+ jne L1 // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
+ }
+# else
+ InterlockedPushEntrySList(&_M_head, __item);
+# endif
+ }
+
+ /**
+ * Atomically removes the topmost item from the freelist and returns a
+ * pointer to it. Returns NULL if the list is empty.
+ *
+ * @return Item that was removed from front of list; NULL if list empty
+ */
+ item* pop() {
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+ __asm
+ {
+ mov esi, this
+ mov eax, [esi] // _M._M_data._M_top
+ mov edx, [esi+4] // _M._M_data._M_sequence
+ L1: test eax, eax // _M_top == NULL?
+ je L2 // Yes, we're done
+ mov ebx, [eax] // new top = _M._M_data._M_top->_M_next
+ lea ecx, [edx+1] // new sequence = _M._M_data._M_sequence + 1
+ lock cmpxchg8b qword ptr [esi]
+ jne L1 // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
+ L2:
+ }
+# else
+ return InterlockedPopEntrySList(&_M_head);
+# endif
+ }
+
+ /**
+ * Atomically detaches all items from the list and returns pointer to the
+ * topmost. The items are still chained and may be traversed safely as
+ * they're now "owned" by the calling thread.
+ *
+ * @return Pointer to topmost item in the list; NULL if list empty
+ */
+ item* clear() {
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+ __asm
+ {
+ mov esi, this
+ mov eax, [esi] // _M._M_data._M_top
+ mov edx, [esi+4] // _M._M_data._M_sequence
+ L1: test eax, eax // _M_top == NULL?
+ je L2 // Yes, we're done
+ xor ebx,ebx // We're attempting to set _M._M_data._M_top to NULL
+ lea ecx, [edx+1] // new sequence = _M._M_data._M_sequence + 1
+ lock cmpxchg8b qword ptr [esi]
+ jne L1 // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top)
+ L2:
+ }
+# else
+ return InterlockedFlushSList(&_M_head);
+# endif
+ }
+
+private:
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+ union {
+ __int64 _M_align;
+ struct {
+ item* _M_top; // Topmost element in the freelist
+ unsigned int _M_sequence; // Sequence counter to prevent "ABA problem"
+ } _M_data;
+ } _M;
+# else
+ SLIST_HEADER _M_head;
+# endif
+
+ _STLP_atomic_freelist(const _STLP_atomic_freelist&);
+ _STLP_atomic_freelist& operator = (const _STLP_atomic_freelist&);
+};
+
+# if defined (_STLP_USE_ASM_IMPLEMENTATION)
+# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) || defined (__ICL)
+# pragma warning (pop)
+# endif
+# endif
+
+# endif /* _STLP_HAS_ATOMIC_FREELIST */
+
+#endif
+
+#endif /* _STLP_LOCK_FREE_SLIST_H */
diff --git a/src/message_facets.h b/src/message_facets.h
new file mode 100644
index 0000000..946b529
--- /dev/null
+++ b/src/message_facets.h
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef MESSAGE_FACETS_H
+#define MESSAGE_FACETS_H
+
+#include <string>
+#include <locale>
+#include <hash_map>
+
+#include "c_locale.h"
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Class _Catalog_locale_map. The reason for this is that, internally,
+// a message string is always a char*. We need a ctype facet to convert
+// a string to and from wchar_t, and the user is permitted to provide such
+// a facet when calling open().
+
+struct _Catalog_locale_map {
+ _Catalog_locale_map() : M(0) {}
+ ~_Catalog_locale_map() { if (M) delete M; }
+
+ void insert(nl_catd_type key, const locale& L);
+ locale lookup(nl_catd_type key) const;
+ void erase(nl_catd_type key);
+
+ typedef hash_map<nl_catd_type, locale, hash<nl_catd_type>, equal_to<nl_catd_type>,
+ allocator<pair<_STLP_CONST nl_catd_type, locale> > > map_type;
+ map_type *M;
+
+private: // Invalidate copy constructor and assignment
+ _Catalog_locale_map(const _Catalog_locale_map&);
+ void operator=(const _Catalog_locale_map&);
+};
+
+/*
+ * In glibc nl_catd type is void *, but messages_base::catalog is defined as int
+ * by ISO/IEC 14882; The int may be too short to store pointer on 64-bit platforms;
+ * Another problem, is that do_open() may return negative value to indicate that no
+ * catalog open---this case can't be represented with pointers.
+ * The class _Catalog_nl_catd_map intended to make relation between
+ * messages_base::catalog and nl_catd handler.
+ *
+ */
+
+#if defined (_STLP_USE_GLIBC2_LOCALIZATION)
+# define _STLP_USE_NL_CATD_MAPPING
+#else
+/* If no mapping a message_base::catalog entry, int typedef according C++ Standard 22.2.7.1,
+ * has to be large enough to contain a nl_catd_type value.
+ */
+_STLP_STATIC_ASSERT(sizeof(nl_catd_type) <= sizeof(int))
+#endif
+
+class _STLP_CLASS_DECLSPEC _Catalog_nl_catd_map {
+public:
+ _Catalog_nl_catd_map()
+ {}
+ ~_Catalog_nl_catd_map()
+ {}
+
+ typedef hash_map<messages_base::catalog, nl_catd_type, hash<messages_base::catalog>, equal_to<messages_base::catalog>,
+ allocator<pair<_STLP_CONST messages_base::catalog, nl_catd_type> > > map_type;
+ typedef hash_map<nl_catd_type, messages_base::catalog, hash<nl_catd_type>, equal_to<nl_catd_type>,
+ allocator<pair<_STLP_CONST nl_catd_type, messages_base::catalog> > > rmap_type;
+ // typedef map<messages_base::catalog,nl_catd_type> map_type;
+ // typedef map<nl_catd_type,messages_base::catalog> rmap_type;
+
+ messages_base::catalog insert(nl_catd_type cat)
+#if !defined (_STLP_USE_NL_CATD_MAPPING)
+ { return (messages_base::catalog)cat; }
+#else
+ ;
+#endif
+
+ void erase(messages_base::catalog)
+#if !defined (_STLP_USE_NL_CATD_MAPPING)
+ {}
+#else
+ ;
+#endif
+
+ nl_catd_type operator [] ( messages_base::catalog cat )
+#if !defined (_STLP_USE_NL_CATD_MAPPING)
+ { return cat; }
+#else
+ { return cat < 0 ? 0 : M[cat]; }
+#endif
+
+private:
+ _Catalog_nl_catd_map(const _Catalog_nl_catd_map&);
+ _Catalog_nl_catd_map& operator =(const _Catalog_nl_catd_map&);
+
+#if defined (_STLP_USE_NL_CATD_MAPPING)
+ map_type M;
+ rmap_type Mr;
+ static _STLP_VOLATILE __stl_atomic_t _count;
+#endif
+};
+
+class _Messages {
+public:
+ typedef messages_base::catalog catalog;
+
+ _Messages(bool, const char *name);
+ _Messages(bool, _Locale_messages*);
+
+ catalog do_open(const string& __fn, const locale& __loc) const;
+ string do_get(catalog __c, int __set, int __msgid,
+ const string& __dfault) const;
+#if !defined (_STLP_NO_WCHAR_T)
+ wstring do_get(catalog __c, int __set, int __msgid,
+ const wstring& __dfault) const;
+#endif
+ void do_close(catalog __c) const;
+ ~_Messages();
+
+private:
+ _Locale_messages* _M_message_obj;
+ _Catalog_locale_map* _M_map;
+ mutable _Catalog_nl_catd_map _M_cat;
+
+ //private definition to avoid warning (with ICL)
+ _Messages(const _Messages&);
+ _Messages& operator=(const _Messages&);
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/messages.cpp b/src/messages.cpp
new file mode 100644
index 0000000..ae4669e
--- /dev/null
+++ b/src/messages.cpp
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <typeinfo>
+
+#include "message_facets.h"
+#include "acquire_release.h"
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+void _Catalog_locale_map::insert(nl_catd_type key, const locale& L) {
+ _STLP_TRY {
+#if !defined (_STLP_NO_TYPEINFO) && !defined (_STLP_NO_RTTI)
+ // Don't bother to do anything unless we're using a non-default ctype facet
+# ifdef _STLP_NO_WCHAR_T
+ typedef char _Char;
+# else
+ typedef wchar_t _Char;
+# endif
+
+ typedef ctype<_Char> wctype;
+ wctype const& wct = use_facet<wctype>(L);
+ if (typeid(wct) != typeid(wctype)) {
+#endif
+ if (!M)
+ M = new map_type;
+
+ M->insert(map_type::value_type(key, L));
+#if !defined (_STLP_NO_TYPEINFO) && !defined (_STLP_NO_RTTI)
+ }
+#endif
+ }
+ _STLP_CATCH_ALL {}
+}
+
+void _Catalog_locale_map::erase(nl_catd_type key) {
+ if (M)
+ M->erase(key);
+}
+
+locale _Catalog_locale_map::lookup(nl_catd_type key) const {
+ if (M) {
+ map_type::const_iterator i = M->find(key);
+ return i != M->end() ? (*i).second : locale::classic();
+ }
+ else
+ return locale::classic();
+}
+
+
+#if defined (_STLP_USE_NL_CATD_MAPPING)
+_STLP_VOLATILE __stl_atomic_t _Catalog_nl_catd_map::_count = 0;
+
+messages_base::catalog _Catalog_nl_catd_map::insert(nl_catd_type cat) {
+ messages_base::catalog &res = Mr[cat];
+ if ( res == 0 ) {
+#if defined (_STLP_ATOMIC_INCREMENT)
+ res = __STATIC_CAST(int, _STLP_ATOMIC_INCREMENT(&_count));
+#else
+ static _STLP_STATIC_MUTEX _Count_lock _STLP_MUTEX_INITIALIZER;
+ {
+ _STLP_auto_lock sentry(_Count_lock);
+ res = __STATIC_CAST(int, ++_count);
+ }
+#endif
+ M[res] = cat;
+ }
+ return res;
+}
+
+void _Catalog_nl_catd_map::erase(messages_base::catalog cat) {
+ map_type::iterator mit(M.find(cat));
+ if (mit != M.end()) {
+ Mr.erase((*mit).second);
+ M.erase(mit);
+ }
+}
+#endif
+
+//----------------------------------------------------------------------
+//
+_Messages::_Messages(bool is_wide, const char *name) :
+ _M_message_obj(0), _M_map(0) {
+ if (!name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _M_message_obj = _STLP_PRIV __acquire_messages(name, buf, 0, &__err_code);
+ if (!_M_message_obj)
+ locale::_M_throw_on_creation_failure(__err_code, name, "messages");
+
+ if (is_wide)
+ _M_map = new _Catalog_locale_map;
+}
+
+_Messages::_Messages(bool is_wide, _Locale_messages* msg) :
+ _M_message_obj(msg), _M_map(is_wide ? new _Catalog_locale_map() : 0)
+{}
+
+_Messages::~_Messages() {
+ __release_messages(_M_message_obj);
+ delete _M_map;
+}
+
+_Messages::catalog _Messages::do_open(const string& filename, const locale& L) const {
+ nl_catd_type result = _M_message_obj ? _Locale_catopen(_M_message_obj, filename.c_str())
+ : (nl_catd_type)(-1);
+
+ if ( result != (nl_catd_type)(-1) ) {
+ if ( _M_map != 0 ) {
+ _M_map->insert(result, L);
+ }
+ return _STLP_MUTABLE(_Messages_impl, _M_cat).insert( result );
+ }
+
+ return -1;
+}
+
+string _Messages::do_get(catalog cat,
+ int set, int p_id, const string& dfault) const {
+ return _M_message_obj != 0 && cat >= 0
+ ? string(_Locale_catgets(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[cat],
+ set, p_id, dfault.c_str()))
+ : dfault;
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+wstring
+_Messages::do_get(catalog thecat,
+ int set, int p_id, const wstring& dfault) const {
+ typedef ctype<wchar_t> wctype;
+ const wctype& ct = use_facet<wctype>(_M_map->lookup(_STLP_MUTABLE(_Messages_impl, _M_cat)[thecat]));
+
+ const char* str = _Locale_catgets(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[thecat], set, p_id, "");
+
+ // Verify that the lookup failed; an empty string might represent success.
+ if (!str)
+ return dfault;
+ else if (str[0] == '\0') {
+ const char* str2 = _Locale_catgets(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[thecat], set, p_id, "*");
+ if (!str2 || ((str2[0] == '*') && (str2[1] == '\0')))
+ return dfault;
+ }
+
+ // str is correct. Now we must widen it to get a wstring.
+ size_t n = strlen(str);
+
+ // NOT PORTABLE. What we're doing relies on internal details of the
+ // string implementation. (Contiguity of string elements.)
+ wstring result(n, wchar_t(0));
+ ct.widen(str, str + n, &*result.begin());
+ return result;
+}
+
+#endif
+
+void _Messages::do_close(catalog thecat) const {
+ if (_M_message_obj)
+ _Locale_catclose(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[thecat]);
+ if (_M_map) _M_map->erase(_STLP_MUTABLE(_Messages_impl, _M_cat)[thecat]);
+ _STLP_MUTABLE(_Messages_impl, _M_cat).erase( thecat );
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//----------------------------------------------------------------------
+// messages<char>
+messages<char>::messages(size_t refs)
+ : locale::facet(refs) {}
+
+messages_byname<char>::messages_byname(const char *name, size_t refs)
+ : messages<char>(refs), _M_impl(new _STLP_PRIV _Messages(false, name)) {}
+
+messages_byname<char>::messages_byname(_Locale_messages* msg)
+ : messages<char>(0), _M_impl(new _STLP_PRIV _Messages(false, msg)) {}
+
+messages_byname<char>::~messages_byname()
+{ delete _M_impl; }
+
+messages_byname<char>::catalog
+messages_byname<char>::do_open(const string& filename, const locale& l) const
+{ return _M_impl->do_open(filename, l); }
+
+string
+messages_byname<char>::do_get(catalog cat, int set, int p_id,
+ const string& dfault) const
+{ return _M_impl->do_get(cat, set, p_id, dfault); }
+
+void messages_byname<char>::do_close(catalog cat) const
+{ _M_impl->do_close(cat); }
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+//----------------------------------------------------------------------
+// messages<wchar_t>
+
+messages<wchar_t>::messages(size_t refs)
+ : locale::facet(refs) {}
+
+messages_byname<wchar_t>::messages_byname(const char *name, size_t refs)
+ : messages<wchar_t>(refs), _M_impl(new _STLP_PRIV _Messages(true, name)) {}
+
+messages_byname<wchar_t>::messages_byname(_Locale_messages* msg)
+ : messages<wchar_t>(0), _M_impl(new _STLP_PRIV _Messages(true, msg)) {}
+
+messages_byname<wchar_t>::~messages_byname()
+{ delete _M_impl; }
+
+messages_byname<wchar_t>::catalog
+messages_byname<wchar_t>::do_open(const string& filename, const locale& L) const
+{ return _M_impl->do_open(filename, L); }
+
+wstring
+messages_byname<wchar_t>::do_get(catalog thecat,
+ int set, int p_id, const wstring& dfault) const
+{ return _M_impl->do_get(thecat, set, p_id, dfault); }
+
+void messages_byname<wchar_t>::do_close(catalog cat) const
+{ _M_impl->do_close(cat); }
+
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/monetary.cpp b/src/monetary.cpp
new file mode 100644
index 0000000..d9b213a
--- /dev/null
+++ b/src/monetary.cpp
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <locale>
+#include <istream>
+
+_STLP_BEGIN_NAMESPACE
+
+static void _Init_monetary_formats(money_base::pattern& pos_format,
+ money_base::pattern& neg_format) {
+ pos_format.field[0] = (char) money_base::symbol;
+ pos_format.field[1] = (char) money_base::sign;
+ pos_format.field[2] = (char) money_base::none;
+ pos_format.field[3] = (char) money_base::value;
+
+ neg_format.field[0] = (char) money_base::symbol;
+ neg_format.field[1] = (char) money_base::sign;
+ neg_format.field[2] = (char) money_base::none;
+ neg_format.field[3] = (char) money_base::value;
+}
+
+// This is being used throughout the library
+static const string _S_empty_string;
+#ifndef _STLP_NO_WCHAR_T
+static const wstring _S_empty_wstring;
+#endif
+
+//
+// moneypunct<>
+//
+
+moneypunct<char, true>::moneypunct(size_t __refs) : locale::facet(__refs)
+{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
+moneypunct<char, true>::~moneypunct() {}
+
+char moneypunct<char, true>::do_decimal_point() const {return ' ';}
+char moneypunct<char, true>::do_thousands_sep() const {return ' ';}
+string moneypunct<char, true>::do_grouping() const { return _S_empty_string; }
+string moneypunct<char, true>::do_curr_symbol() const { return _S_empty_string; }
+string moneypunct<char, true>::do_positive_sign() const { return _S_empty_string; }
+string moneypunct<char, true>::do_negative_sign() const { return _S_empty_string; }
+money_base::pattern moneypunct<char, true>::do_pos_format() const {return _M_pos_format;}
+money_base::pattern moneypunct<char, true>::do_neg_format() const {return _M_neg_format;}
+int moneypunct<char, true>::do_frac_digits() const {return 0;}
+
+moneypunct<char, false>::moneypunct(size_t __refs) : locale::facet(__refs)
+{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
+moneypunct<char, false>::~moneypunct() {}
+
+char moneypunct<char, false>::do_decimal_point() const {return ' ';}
+char moneypunct<char, false>::do_thousands_sep() const {return ' ';}
+
+string moneypunct<char, false>::do_grouping() const { return _S_empty_string; }
+string moneypunct<char, false>::do_curr_symbol() const { return _S_empty_string; }
+string moneypunct<char, false>::do_positive_sign() const { return _S_empty_string; }
+string moneypunct<char, false>::do_negative_sign() const { return _S_empty_string; }
+money_base::pattern moneypunct<char, false>::do_pos_format() const {return _M_pos_format;}
+money_base::pattern moneypunct<char, false>::do_neg_format() const {return _M_neg_format;}
+int moneypunct<char, false>::do_frac_digits() const {return 0;}
+
+#ifndef _STLP_NO_WCHAR_T
+moneypunct<wchar_t, true>::moneypunct(size_t __refs) : locale::facet(__refs)
+{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
+moneypunct<wchar_t, true>::~moneypunct() {}
+
+wchar_t moneypunct<wchar_t, true>::do_decimal_point() const {return L' ';}
+wchar_t moneypunct<wchar_t, true>::do_thousands_sep() const {return L' ';}
+string moneypunct<wchar_t, true>::do_grouping() const {return _S_empty_string;}
+
+wstring moneypunct<wchar_t, true>::do_curr_symbol() const
+{return _S_empty_wstring;}
+wstring moneypunct<wchar_t, true>::do_positive_sign() const
+{return _S_empty_wstring;}
+wstring moneypunct<wchar_t, true>::do_negative_sign() const
+{return _S_empty_wstring;}
+int moneypunct<wchar_t, true>::do_frac_digits() const {return 0;}
+money_base::pattern moneypunct<wchar_t, true>::do_pos_format() const
+{return _M_pos_format;}
+money_base::pattern moneypunct<wchar_t, true>::do_neg_format() const
+{return _M_neg_format;}
+
+moneypunct<wchar_t, false>::moneypunct(size_t __refs) : locale::facet(__refs)
+{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
+moneypunct<wchar_t, false>::~moneypunct() {}
+
+wchar_t moneypunct<wchar_t, false>::do_decimal_point() const {return L' ';}
+wchar_t moneypunct<wchar_t, false>::do_thousands_sep() const {return L' ';}
+string moneypunct<wchar_t, false>::do_grouping() const { return _S_empty_string;}
+wstring moneypunct<wchar_t, false>::do_curr_symbol() const
+{return _S_empty_wstring;}
+wstring moneypunct<wchar_t, false>::do_positive_sign() const
+{return _S_empty_wstring;}
+wstring moneypunct<wchar_t, false>::do_negative_sign() const
+{return _S_empty_wstring;}
+int moneypunct<wchar_t, false>::do_frac_digits() const {return 0;}
+
+money_base::pattern moneypunct<wchar_t, false>::do_pos_format() const
+{return _M_pos_format;}
+money_base::pattern moneypunct<wchar_t, false>::do_neg_format() const
+{return _M_neg_format;}
+
+#endif /* WCHAR_T */
+
+//
+// Instantiations
+//
+
+#if !defined (_STLP_NO_FORCE_INSTANTIATE)
+
+template class _STLP_CLASS_DECLSPEC money_get<char, istreambuf_iterator<char, char_traits<char> > >;
+template class _STLP_CLASS_DECLSPEC money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+// template class money_put<char, char*>;
+
+# ifndef _STLP_NO_WCHAR_T
+template class _STLP_CLASS_DECLSPEC money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+template class _STLP_CLASS_DECLSPEC money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+// template class money_put<wchar_t, wchar_t*>;
+// template class money_get<wchar_t, const wchar_t*>;
+# endif
+
+#endif
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+const bool moneypunct<char, true>::intl;
+const bool moneypunct<char, false>::intl;
+# ifndef _STLP_NO_WCHAR_T
+const bool moneypunct<wchar_t, true>::intl;
+const bool moneypunct<wchar_t, false>::intl;
+# endif
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/num_get.cpp b/src/num_get.cpp
new file mode 100644
index 0000000..45901ac
--- /dev/null
+++ b/src/num_get.cpp
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <locale>
+#include <istream>
+#include <algorithm>
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// __valid_grouping compares two strings, one representing the
+// group sizes encountered when reading an integer, and the other
+// representing the valid group sizes as returned by the numpunct
+// grouping() member function. Both are interpreted right-to-left.
+// The grouping string is treated as if it were extended indefinitely
+// with its last value. For a grouping to be valid, each term in
+// the first string must be equal to the corresponding term in the
+// second, except for the last, which must be less than or equal.
+
+// boris : this takes reversed first string !
+bool _STLP_CALL
+__valid_grouping(const char * first1, const char * last1,
+ const char * first2, const char * last2) {
+ if (first1 == last1 || first2 == last2) return true;
+
+ --last1; --last2;
+
+ while (first1 != last1) {
+ if (*last1 != *first2)
+ return false;
+ --last1;
+ if (first2 != last2) ++first2;
+ }
+
+ return *last1 <= *first2;
+}
+
+_STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned __index) {
+ static const unsigned char __val_table[128] = {
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
+ };
+
+ return __val_table[__index];
+}
+
+_STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms()
+{ return "+-0xX"; }
+
+// index is actually a char
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+// Similar, except return the character itself instead of the numeric
+// value. Used for floating-point input.
+bool _STLP_CALL __get_fdigit(wchar_t& c, const wchar_t* digits) {
+ const wchar_t* p = find(digits, digits + 10, c);
+ if (p != digits + 10) {
+ c = (char)('0' + (p - digits));
+ return true;
+ }
+ else
+ return false;
+}
+
+bool _STLP_CALL __get_fdigit_or_sep(wchar_t& c, wchar_t sep,
+ const wchar_t * digits) {
+ if (c == sep) {
+ c = (char)',';
+ return true;
+ }
+ else
+ return __get_fdigit(c, digits);
+}
+
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if !defined(_STLP_NO_FORCE_INSTANTIATE)
+//----------------------------------------------------------------------
+// Force instantiation of num_get<>
+template class _STLP_CLASS_DECLSPEC istreambuf_iterator<char, char_traits<char> >;
+// template class num_get<char, const char*>;
+template class num_get<char, istreambuf_iterator<char, char_traits<char> > >;
+
+# if !defined (_STLP_NO_WCHAR_T)
+template class _STLP_CLASS_DECLSPEC istreambuf_iterator<wchar_t, char_traits<wchar_t> >;
+template class num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+// template class num_get<wchar_t, const wchar_t*>;
+# endif
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/num_get_float.cpp b/src/num_get_float.cpp
new file mode 100644
index 0000000..63e9fed
--- /dev/null
+++ b/src/num_get_float.cpp
@@ -0,0 +1,884 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <limits>
+#include <locale>
+#include <istream>
+
+#if (defined (__GNUC__) && !defined (__sun) && !defined (__hpux)) || \
+ defined (__DMC__)
+# include <stdint.h>
+#endif
+
+#if defined (__linux__) || defined (__MINGW32__) || defined (__CYGWIN__) || \
+ defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC)
+
+# if defined (__BORLANDC__)
+typedef unsigned int uint32_t;
+typedef unsigned __int64 uint64_t;
+# endif
+
+union _ll {
+ uint64_t i64;
+ struct {
+# if defined (_STLP_BIG_ENDIAN)
+ uint32_t hi;
+ uint32_t lo;
+# elif defined (_STLP_LITTLE_ENDIAN)
+ uint32_t lo;
+ uint32_t hi;
+# else
+# error Unknown endianess
+# endif
+ } i32;
+};
+
+# if defined (__linux__) && !defined (ANDROID)
+# include <ieee754.h>
+# else
+union ieee854_long_double {
+ long double d;
+
+ /* This is the IEEE 854 double-extended-precision format. */
+ struct {
+ unsigned int mantissa1:32;
+ unsigned int mantissa0:32;
+ unsigned int exponent:15;
+ unsigned int negative:1;
+ unsigned int empty:16;
+ } ieee;
+};
+
+# define IEEE854_LONG_DOUBLE_BIAS 0x3fff
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//----------------------------------------------------------------------
+// num_get
+
+// Helper functions for _M_do_get_float.
+
+#if !defined (_STLP_NO_WCHAR_T)
+void _STLP_CALL
+_Initialize_get_float( const ctype<wchar_t>& ct,
+ wchar_t& Plus, wchar_t& Minus,
+ wchar_t& pow_e, wchar_t& pow_E,
+ wchar_t* digits) {
+ char ndigits[11] = "0123456789";
+ Plus = ct.widen('+');
+ Minus = ct.widen('-');
+ pow_e = ct.widen('e');
+ pow_E = ct.widen('E');
+ ct.widen(ndigits + 0, ndigits + 10, digits);
+}
+#endif /* WCHAR_T */
+
+/*
+ * __string_to_double is just lifted from atof, the difference being
+ * that we just use '.' for the decimal point, rather than let it
+ * be taken from the current C locale, which of course is not accessible
+ * to us.
+ */
+#if defined (_STLP_MSVC) || defined (__BORLANDC__) || defined (__ICL)
+typedef unsigned long uint32;
+typedef unsigned __int64 uint64;
+# define ULL(x) x##Ui64
+#elif defined (__unix) || defined (__MINGW32__) || \
+ (defined (__DMC__) && (__LONGLONG)) || defined (__WATCOMC__) || \
+ defined (ANDROID)
+typedef uint32_t uint32;
+typedef uint64_t uint64;
+# define ULL(x) x##ULL
+#else
+# error There should be some unsigned 64-bit integer on the system!
+#endif
+
+// Multiplication of two 64-bit integers, giving a 128-bit result.
+// Taken from Algorithm M in Knuth section 4.3.1, with the loop
+// hand-unrolled.
+static void _Stl_mult64(const uint64 u, const uint64 v,
+ uint64& high, uint64& low) {
+ const uint64 low_mask = ULL(0xffffffff);
+ const uint64 u0 = u & low_mask;
+ const uint64 u1 = u >> 32;
+ const uint64 v0 = v & low_mask;
+ const uint64 v1 = v >> 32;
+
+ uint64 t = u0 * v0;
+ low = t & low_mask;
+
+ t = u1 * v0 + (t >> 32);
+ uint64 w1 = t & low_mask;
+ uint64 w2 = t >> 32;
+
+ uint64 x = u0 * v1 + w1;
+ low += (x & low_mask) << 32;
+ high = u1 * v1 + w2 + (x >> 32);
+}
+
+#if !defined (__linux__) || defined (ANDROID)
+
+# define bit11 ULL(0x7ff)
+# define exponent_mask (bit11 << 52)
+
+# if !defined (__GNUC__) || (__GNUC__ != 3) || (__GNUC_MINOR__ != 4) || \
+ (!defined (__CYGWIN__) && !defined (__MINGW32__))
+//Generate bad code when compiled with -O2 option.
+inline
+# endif
+void _Stl_set_exponent(uint64 &val, uint64 exp)
+{ val = (val & ~exponent_mask) | ((exp & bit11) << 52); }
+
+#endif // __linux__
+
+/* Power of ten fractions for tenscale*/
+/* The constants are factored so that at most two constants
+ * and two multiplies are needed. Furthermore, one of the constants
+ * is represented exactly - 10**n where 1<= n <= 27.
+ */
+
+static const uint64 _Stl_tenpow[80] = {
+ULL(0xa000000000000000), /* _Stl_tenpow[0]=(10**1)/(2**4) */
+ULL(0xc800000000000000), /* _Stl_tenpow[1]=(10**2)/(2**7) */
+ULL(0xfa00000000000000), /* _Stl_tenpow[2]=(10**3)/(2**10) */
+ULL(0x9c40000000000000), /* _Stl_tenpow[3]=(10**4)/(2**14) */
+ULL(0xc350000000000000), /* _Stl_tenpow[4]=(10**5)/(2**17) */
+ULL(0xf424000000000000), /* _Stl_tenpow[5]=(10**6)/(2**20) */
+ULL(0x9896800000000000), /* _Stl_tenpow[6]=(10**7)/(2**24) */
+ULL(0xbebc200000000000), /* _Stl_tenpow[7]=(10**8)/(2**27) */
+ULL(0xee6b280000000000), /* _Stl_tenpow[8]=(10**9)/(2**30) */
+ULL(0x9502f90000000000), /* _Stl_tenpow[9]=(10**10)/(2**34) */
+ULL(0xba43b74000000000), /* _Stl_tenpow[10]=(10**11)/(2**37) */
+ULL(0xe8d4a51000000000), /* _Stl_tenpow[11]=(10**12)/(2**40) */
+ULL(0x9184e72a00000000), /* _Stl_tenpow[12]=(10**13)/(2**44) */
+ULL(0xb5e620f480000000), /* _Stl_tenpow[13]=(10**14)/(2**47) */
+ULL(0xe35fa931a0000000), /* _Stl_tenpow[14]=(10**15)/(2**50) */
+ULL(0x8e1bc9bf04000000), /* _Stl_tenpow[15]=(10**16)/(2**54) */
+ULL(0xb1a2bc2ec5000000), /* _Stl_tenpow[16]=(10**17)/(2**57) */
+ULL(0xde0b6b3a76400000), /* _Stl_tenpow[17]=(10**18)/(2**60) */
+ULL(0x8ac7230489e80000), /* _Stl_tenpow[18]=(10**19)/(2**64) */
+ULL(0xad78ebc5ac620000), /* _Stl_tenpow[19]=(10**20)/(2**67) */
+ULL(0xd8d726b7177a8000), /* _Stl_tenpow[20]=(10**21)/(2**70) */
+ULL(0x878678326eac9000), /* _Stl_tenpow[21]=(10**22)/(2**74) */
+ULL(0xa968163f0a57b400), /* _Stl_tenpow[22]=(10**23)/(2**77) */
+ULL(0xd3c21bcecceda100), /* _Stl_tenpow[23]=(10**24)/(2**80) */
+ULL(0x84595161401484a0), /* _Stl_tenpow[24]=(10**25)/(2**84) */
+ULL(0xa56fa5b99019a5c8), /* _Stl_tenpow[25]=(10**26)/(2**87) */
+ULL(0xcecb8f27f4200f3a), /* _Stl_tenpow[26]=(10**27)/(2**90) */
+
+ULL(0xd0cf4b50cfe20766), /* _Stl_tenpow[27]=(10**55)/(2**183) */
+ULL(0xd2d80db02aabd62c), /* _Stl_tenpow[28]=(10**83)/(2**276) */
+ULL(0xd4e5e2cdc1d1ea96), /* _Stl_tenpow[29]=(10**111)/(2**369) */
+ULL(0xd6f8d7509292d603), /* _Stl_tenpow[30]=(10**139)/(2**462) */
+ULL(0xd910f7ff28069da4), /* _Stl_tenpow[31]=(10**167)/(2**555) */
+ULL(0xdb2e51bfe9d0696a), /* _Stl_tenpow[32]=(10**195)/(2**648) */
+ULL(0xdd50f1996b947519), /* _Stl_tenpow[33]=(10**223)/(2**741) */
+ULL(0xdf78e4b2bd342cf7), /* _Stl_tenpow[34]=(10**251)/(2**834) */
+ULL(0xe1a63853bbd26451), /* _Stl_tenpow[35]=(10**279)/(2**927) */
+ULL(0xe3d8f9e563a198e5), /* _Stl_tenpow[36]=(10**307)/(2**1020) */
+
+// /* _Stl_tenpow[36]=(10**335)/(2**) */
+// /* _Stl_tenpow[36]=(10**335)/(2**) */
+
+ULL(0xfd87b5f28300ca0e), /* _Stl_tenpow[37]=(10**-28)/(2**-93) */
+ULL(0xfb158592be068d2f), /* _Stl_tenpow[38]=(10**-56)/(2**-186) */
+ULL(0xf8a95fcf88747d94), /* _Stl_tenpow[39]=(10**-84)/(2**-279) */
+ULL(0xf64335bcf065d37d), /* _Stl_tenpow[40]=(10**-112)/(2**-372) */
+ULL(0xf3e2f893dec3f126), /* _Stl_tenpow[41]=(10**-140)/(2**-465) */
+ULL(0xf18899b1bc3f8ca2), /* _Stl_tenpow[42]=(10**-168)/(2**-558) */
+ULL(0xef340a98172aace5), /* _Stl_tenpow[43]=(10**-196)/(2**-651) */
+ULL(0xece53cec4a314ebe), /* _Stl_tenpow[44]=(10**-224)/(2**-744) */
+ULL(0xea9c227723ee8bcb), /* _Stl_tenpow[45]=(10**-252)/(2**-837) */
+ULL(0xe858ad248f5c22ca), /* _Stl_tenpow[46]=(10**-280)/(2**-930) */
+ULL(0xe61acf033d1a45df), /* _Stl_tenpow[47]=(10**-308)/(2**-1023) */
+ULL(0xe3e27a444d8d98b8), /* _Stl_tenpow[48]=(10**-336)/(2**-1116) */
+ULL(0xe1afa13afbd14d6e) /* _Stl_tenpow[49]=(10**-364)/(2**-1209) */
+};
+
+static const short _Stl_twoexp[80] = {
+4,7,10,14,17,20,24,27,30,34,37,40,44,47,50,54,57,60,64,67,70,74,77,80,84,87,90,
+183,276,369,462,555,648,741,834,927,1020,
+-93,-186,-279,-372,-465,-558,-651,-744,-837,-930,-1023,-1116,-1209
+};
+
+#define TEN_1 0 /* offset to 10 ** 1 */
+#define TEN_27 26 /* offset to 10 ** 27 */
+#define TEN_M28 37 /* offset to 10 ** -28 */
+#define NUM_HI_P 11
+#define NUM_HI_N 13
+
+#define _Stl_HIBITULL (ULL(1) << 63)
+
+static void _Stl_norm_and_round(uint64& p, int& norm, uint64 prodhi, uint64 prodlo) {
+ norm = 0;
+ if ((prodhi & _Stl_HIBITULL) == 0) {
+ /* leading bit is a zero
+ * may have to normalize
+ */
+ if ((prodhi == ~_Stl_HIBITULL) &&
+ ((prodlo >> 62) == 0x3)) { /* normalization followed by round
+ * would cause carry to create
+ * extra bit, so don't normalize
+ */
+ p = _Stl_HIBITULL;
+ return;
+ }
+ p = (prodhi << 1) | (prodlo >> 63); /* normalize */
+ norm = 1;
+ prodlo <<= 1;
+ }
+ else {
+ p = prodhi;
+ }
+
+ if ((prodlo & _Stl_HIBITULL) != 0) { /* first guard bit a one */
+ if (((p & 0x1) != 0) ||
+ prodlo != _Stl_HIBITULL ) { /* not borderline for round to even */
+ /* round */
+ ++p;
+ if (p == 0)
+ ++p;
+ }
+ }
+}
+
+// Convert a 64-bitb fraction * 10^exp to a 64-bit fraction * 2^bexp.
+// p: 64-bit fraction
+// exp: base-10 exponent
+// bexp: base-2 exponent (output parameter)
+static void _Stl_tenscale(uint64& p, int exp, int& bexp) {
+ bexp = 0;
+
+ if ( exp == 0 ) { /* no scaling needed */
+ return;
+ }
+
+ int exp_hi = 0, exp_lo = exp; /* exp = exp_hi*32 + exp_lo */
+ int tlo = TEN_1, thi; /* offsets in power of ten table */
+ int num_hi; /* number of high exponent powers */
+
+ if (exp > 0) { /* split exponent */
+ if (exp_lo > 27) {
+ exp_lo++;
+ while (exp_lo > 27) {
+ exp_hi++;
+ exp_lo -= 28;
+ }
+ }
+ thi = TEN_27;
+ num_hi = NUM_HI_P;
+ } else { // exp < 0
+ while (exp_lo < 0) {
+ exp_hi++;
+ exp_lo += 28;
+ }
+ thi = TEN_M28;
+ num_hi = NUM_HI_N;
+ }
+
+ uint64 prodhi, prodlo; /* 128b product */
+ int norm; /* number of bits of normalization */
+
+ int hi, lo; /* offsets in power of ten table */
+ while (exp_hi) { /* scale */
+ hi = (min) (exp_hi, num_hi); /* only a few large powers of 10 */
+ exp_hi -= hi; /* could iterate in extreme case */
+ hi += thi-1;
+ _Stl_mult64(p, _Stl_tenpow[hi], prodhi, prodlo);
+ _Stl_norm_and_round(p, norm, prodhi, prodlo);
+ bexp += _Stl_twoexp[hi] - norm;
+ }
+
+ if (exp_lo) {
+ lo = tlo + exp_lo -1;
+ _Stl_mult64(p, _Stl_tenpow[lo], prodhi, prodlo);
+ _Stl_norm_and_round(p, norm, prodhi, prodlo);
+ bexp += _Stl_twoexp[lo] - norm;
+ }
+
+ return;
+}
+
+// First argument is a buffer of values from 0 to 9, NOT ascii.
+// Second argument is number of digits in buffer, 1 <= digits <= 17.
+// Third argument is base-10 exponent.
+
+/* IEEE representation */
+#if !defined (__linux__) || defined (ANDROID)
+
+union _Double_rep {
+ uint64 ival;
+ double val;
+};
+
+static double _Stl_atod(char *buffer, ptrdiff_t ndigit, int dexp) {
+ typedef numeric_limits<double> limits;
+ _Double_rep drep;
+ uint64 &value = drep.ival; /* Value develops as follows:
+ * 1) decimal digits as an integer
+ * 2) left adjusted fraction
+ * 3) right adjusted fraction
+ * 4) exponent and fraction
+ */
+
+ uint32 guard; /* First guard bit */
+ uint64 rest; /* Remaining guard bits */
+
+ int bexp; /* binary exponent */
+ int nzero; /* number of non-zero bits */
+ int sexp; /* scaling exponent */
+
+ char *bufferend; /* pointer to char after last digit */
+
+ /* Convert the decimal digits to a binary integer. */
+ bufferend = buffer + ndigit;
+ value = 0;
+
+ while (buffer < bufferend) {
+ value *= 10;
+ value += *buffer++;
+ }
+
+ /* Check for zero and treat it as a special case */
+ if (value == 0) {
+ return 0.0;
+ }
+
+ /* Normalize value */
+ bexp = 64; /* convert from 64b int to fraction */
+
+ /* Count number of non-zeroes in value */
+ nzero = 0;
+ if ((value >> 32) != 0) { nzero = 32; } //*TY 03/25/2000 - added explicit comparison to zero to avoid uint64 to bool conversion operator
+ if ((value >> (16 + nzero)) != 0) { nzero += 16; }
+ if ((value >> ( 8 + nzero)) != 0) { nzero += 8; }
+ if ((value >> ( 4 + nzero)) != 0) { nzero += 4; }
+ if ((value >> ( 2 + nzero)) != 0) { nzero += 2; }
+ if ((value >> ( 1 + nzero)) != 0) { nzero += 1; }
+ if ((value >> ( nzero)) != 0) { nzero += 1; }
+
+ /* Normalize */
+ value <<= /*(uint64)*/ (64 - nzero); //*TY 03/25/2000 - removed extraneous cast to uint64
+ bexp -= 64 - nzero;
+
+ /* At this point we have a 64b fraction and a binary exponent
+ * but have yet to incorporate the decimal exponent.
+ */
+
+ /* multiply by 10^dexp */
+ _Stl_tenscale(value, dexp, sexp);
+ bexp += sexp;
+
+ if (bexp <= -1022) { /* HI denorm or underflow */
+ bexp += 1022;
+ if (bexp < -53) { /* guaranteed underflow */
+ value = 0;
+ }
+ else { /* denorm or possible underflow */
+ int lead0 = 12 - bexp; /* 12 sign and exponent bits */
+
+ /* we must special case right shifts of more than 63 */
+ if (lead0 > 64) {
+ rest = value;
+ guard = 0;
+ value = 0;
+ }
+ else if (lead0 == 64) {
+ rest = value & ((ULL(1)<< 63)-1);
+ guard = (uint32) ((value>> 63) & 1 );
+ value = 0;
+ }
+ else {
+ rest = value & (((ULL(1) << lead0)-1)-1);
+ guard = (uint32) (((value>> lead0)-1) & 1);
+ value >>= /*(uint64)*/ lead0; /* exponent is zero */
+ }
+
+ /* Round */
+ if (guard && ((value & 1) || rest) ) {
+ ++value;
+ if (value == (ULL(1) << (limits::digits - 1))) { /* carry created normal number */
+ value = 0;
+ _Stl_set_exponent(value, 1);
+ }
+ }
+ }
+ }
+ else { /* not zero or denorm */
+ /* Round to 53 bits */
+ rest = value & ((1 << 10) - 1);
+ value >>= 10;
+ guard = (uint32) value & 1;
+ value >>= 1;
+
+ /* value&1 guard rest Action
+ *
+ * dc 0 dc none
+ * 1 1 dc round
+ * 0 1 0 none
+ * 0 1 !=0 round
+ */
+ if (guard) {
+ if (((value&1)!=0) || (rest!=0)) {
+ ++value; /* round */
+ if ((value >> 53) != 0) { /* carry all the way across */
+ value >>= 1; /* renormalize */
+ ++bexp;
+ }
+ }
+ }
+ /*
+ * Check for overflow
+ * IEEE Double Precision Format
+ * (From Table 7-8 of Kane and Heinrich)
+ *
+ * Fraction bits 52
+ * Emax +1023
+ * Emin -1022
+ * Exponent bias +1023
+ * Exponent bits 11
+ * Integer bit hidden
+ * Total width in bits 64
+ */
+
+ if (bexp > limits::max_exponent) { /* overflow */
+ return limits::infinity();
+ }
+ else { /* value is normal */
+ value &= ~(ULL(1) << (limits::digits - 1)); /* hide hidden bit */
+ _Stl_set_exponent(value, bexp + 1022); /* add bias */
+ }
+ }
+
+ _STLP_STATIC_ASSERT(sizeof(uint64) >= sizeof(double))
+ return drep.val;
+}
+
+#endif
+
+#if defined (__linux__) || defined (__MINGW32__) || defined (__CYGWIN__) || \
+ defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC)
+
+template <class D, class IEEE, int M, int BIAS>
+D _Stl_atodT(char *buffer, ptrdiff_t ndigit, int dexp)
+{
+ typedef numeric_limits<D> limits;
+
+ /* Convert the decimal digits to a binary integer. */
+ char *bufferend = buffer + ndigit; /* pointer to char after last digit */
+ _ll vv;
+ vv.i64 = 0L;
+
+ while ( buffer < bufferend ) {
+ vv.i64 *= 10;
+ vv.i64 += *buffer++;
+ }
+
+ if ( vv.i64 == ULL(0) ) { /* Check for zero and treat it as a special case */
+ return D(0.0);
+ }
+
+ /* Normalize value */
+
+ int bexp = 64; /* convert from 64b int to fraction */
+
+ /* Count number of non-zeroes in value */
+ int nzero = 0;
+ if ((vv.i64 >> 32) != 0) { nzero = 32; }
+ if ((vv.i64 >> (16 + nzero)) != 0) { nzero += 16; }
+ if ((vv.i64 >> ( 8 + nzero)) != 0) { nzero += 8; }
+ if ((vv.i64 >> ( 4 + nzero)) != 0) { nzero += 4; }
+ if ((vv.i64 >> ( 2 + nzero)) != 0) { nzero += 2; }
+ if ((vv.i64 >> ( 1 + nzero)) != 0) { nzero += 1; }
+ if ((vv.i64 >> ( nzero)) != 0) { nzero += 1; }
+
+ /* Normalize */
+ nzero = 64 - nzero;
+ vv.i64 <<= nzero; // * TY 03/25/2000 - removed extraneous cast to uint64
+ bexp -= nzero;
+
+ /* At this point we have a 64b fraction and a binary exponent
+ * but have yet to incorporate the decimal exponent.
+ */
+
+ /* multiply by 10^dexp */
+ int sexp;
+ _Stl_tenscale(vv.i64, dexp, sexp);
+ bexp += sexp;
+
+ if ( bexp >= limits::min_exponent ) { /* not zero or denorm */
+ if ( limits::digits < 64 ) {
+ /* Round to (64 - M + 1) bits */
+ uint64_t rest = vv.i64 & ((~ULL(0) / ULL(2)) >> (limits::digits - 1));
+ vv.i64 >>= M - 2;
+ uint32_t guard = (uint32) vv.i64 & 1;
+ vv.i64 >>= 1;
+
+ /* value&1 guard rest Action
+ *
+ * dc 0 dc none
+ * 1 1 dc round
+ * 0 1 0 none
+ * 0 1 !=0 round
+ */
+
+ if (guard) {
+ if ( ((vv.i64 & 1) != 0) || (rest != 0) ) {
+ vv.i64++; /* round */
+ if ( (vv.i64 >> (limits::digits < 64 ? limits::digits : 0)) != 0 ) { /* carry all the way across */
+ vv.i64 >>= 1; /* renormalize */
+ ++bexp;
+ }
+ }
+ }
+
+ vv.i64 &= ~(ULL(1) << (limits::digits - 1)); /* hide hidden bit */
+ }
+ /*
+ * Check for overflow
+ * IEEE Double Precision Format
+ * (From Table 7-8 of Kane and Heinrich)
+ *
+ * Fraction bits 52
+ * Emax +1023
+ * Emin -1022
+ * Exponent bias +1023
+ * Exponent bits 11
+ * Integer bit hidden
+ * Total width in bits 64
+ */
+
+ if (bexp > limits::max_exponent) { /* overflow */
+ return limits::infinity();
+ }
+
+ /* value is normal */
+
+ IEEE v;
+
+ v.ieee.mantissa0 = vv.i32.hi;
+ v.ieee.mantissa1 = vv.i32.lo;
+ v.ieee.negative = 0;
+ v.ieee.exponent = bexp + BIAS - 1;
+
+ return v.d;
+ }
+
+ /* HI denorm or underflow */
+ bexp += BIAS - 1;
+ if (bexp < -limits::digits) { /* guaranteed underflow */
+ vv.i64 = 0;
+ } else { /* denorm or possible underflow */
+
+ /*
+ * Problem point for long double: looks like this code reflect shareing of mantissa
+ * and exponent in 64b int; not so for long double
+ */
+
+ int lead0 = M - bexp; /* M = 12 sign and exponent bits */
+ uint64_t rest;
+ uint32_t guard;
+
+ /* we must special case right shifts of more than 63 */
+
+ if (lead0 > 64) {
+ rest = vv.i64;
+ guard = 0;
+ vv.i64 = 0;
+ } else if (lead0 == 64) {
+ rest = vv.i64 & ((ULL(1) << 63)-1);
+ guard = (uint32) ((vv.i64 >> 63) & 1 );
+ vv.i64 = 0;
+ } else {
+ rest = vv.i64 & (((ULL(1) << lead0)-1)-1);
+ guard = (uint32) (((vv.i64 >> lead0)-1) & 1);
+ vv.i64 >>= /*(uint64)*/ lead0; /* exponent is zero */
+ }
+
+ /* Round */
+ if (guard && ( (vv.i64 & 1) || rest)) {
+ vv.i64++;
+ if (vv.i64 == (ULL(1) << (limits::digits - 1))) { /* carry created normal number */
+ IEEE v;
+
+ v.ieee.mantissa0 = 0;
+ v.ieee.mantissa1 = 0;
+ v.ieee.negative = 0;
+ v.ieee.exponent = 1;
+ return v.d;
+ }
+ }
+ }
+
+ IEEE v;
+
+ v.ieee.mantissa0 = vv.i32.hi;
+ v.ieee.mantissa1 = vv.i32.lo;
+ v.ieee.negative = 0;
+ v.ieee.exponent = 0;
+
+ return v.d;
+}
+#endif // __linux__
+
+#if !defined (__linux__) || defined (ANDROID)
+static double _Stl_string_to_double(const char *s) {
+ typedef numeric_limits<double> limits;
+ const int max_digits = limits::digits10 + 2;
+ unsigned c;
+ unsigned Negate, decimal_point;
+ char *d;
+ int exp;
+ int dpchar;
+ char digits[max_digits];
+
+ c = *s++;
+
+ /* process sign */
+ Negate = 0;
+ if (c == '+') {
+ c = *s++;
+ } else if (c == '-') {
+ Negate = 1;
+ c = *s++;
+ }
+
+ d = digits;
+ dpchar = '.' - '0';
+ decimal_point = 0;
+ exp = 0;
+
+ for (;;) {
+ c -= '0';
+ if (c < 10) {
+ if (d == digits + max_digits) {
+ /* ignore more than max_digits digits, but adjust exponent */
+ exp += (decimal_point ^ 1);
+ } else {
+ if (c == 0 && d == digits) {
+ /* ignore leading zeros */
+ } else {
+ *d++ = (char) c;
+ }
+ exp -= decimal_point;
+ }
+ } else if (c == (unsigned int) dpchar && !decimal_point) { /* INTERNATIONAL */
+ decimal_point = 1;
+ } else {
+ break;
+ }
+ c = *s++;
+ }
+
+ /* strtod cant return until it finds the end of the exponent */
+ if (d == digits) {
+ return 0.0;
+ }
+
+ if (c == 'e' - '0' || c == 'E' - '0') {
+ register unsigned negate_exp = 0;
+ register int e = 0;
+ c = *s++;
+ if (c == '+' || c == ' ') {
+ c = *s++;
+ } else if (c == '-') {
+ negate_exp = 1;
+ c = *s++;
+ }
+ if (c -= '0', c < 10) {
+ do {
+ e = e * 10 + (int)c;
+ c = *s++;
+ } while (c -= '0', c < 10);
+
+ if (negate_exp) {
+ e = -e;
+ }
+ exp += e;
+ }
+ }
+
+ double x;
+ ptrdiff_t n = d - digits;
+ if ((exp + n - 1) < limits::min_exponent10) {
+ x = 0;
+ }
+ else if ((exp + n - 1) > limits::max_exponent10) {
+ x = limits::infinity();
+ }
+ else {
+ /* Let _Stl_atod diagnose under- and over-flows.
+ * If the input was == 0.0, we have already returned,
+ * so retval of +-Inf signals OVERFLOW, 0.0 UNDERFLOW */
+ x = _Stl_atod(digits, n, exp);
+ }
+
+ if (Negate) {
+ x = -x;
+ }
+
+ return x;
+}
+
+#endif
+
+#if defined (__linux__) || defined (__MINGW32__) || defined (__CYGWIN__) || \
+ defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC)
+
+template <class D, class IEEE, int M, int BIAS>
+D _Stl_string_to_doubleT(const char *s)
+{
+ typedef numeric_limits<D> limits;
+ const int max_digits = limits::digits10; /* + 2 17 */;
+ unsigned c;
+ unsigned decimal_point;
+ char *d;
+ int exp;
+ D x;
+ int dpchar;
+ char digits[max_digits];
+
+ c = *s++;
+
+ /* process sign */
+ bool Negate = false;
+ if (c == '+') {
+ c = *s++;
+ } else if (c == '-') {
+ Negate = true;
+ c = *s++;
+ }
+
+ d = digits;
+ dpchar = '.' - '0';
+ decimal_point = 0;
+ exp = 0;
+
+ for (;;) {
+ c -= '0';
+ if (c < 10) {
+ if (d == digits + max_digits) {
+ /* ignore more than max_digits digits, but adjust exponent */
+ exp += (decimal_point ^ 1);
+ } else {
+ if (c == 0 && d == digits) {
+ /* ignore leading zeros */
+ } else {
+ *d++ = (char) c;
+ }
+ exp -= decimal_point;
+ }
+ } else if (c == (unsigned int) dpchar && !decimal_point) { /* INTERNATIONAL */
+ decimal_point = 1;
+ } else {
+ break;
+ }
+ c = *s++;
+ }
+ /* strtod cant return until it finds the end of the exponent */
+ if (d == digits) {
+ return D(0.0);
+ }
+
+ if (c == 'e'-'0' || c == 'E'-'0') {
+ bool negate_exp = false;
+ register int e = 0;
+ c = *s++;
+ if (c == '+' || c == ' ') {
+ c = *s++;
+ } else if (c == '-') {
+ negate_exp = true;
+ c = *s++;
+ }
+ if (c -= '0', c < 10) {
+ do {
+ e = e * 10 + (int)c;
+ c = *s++;
+ } while (c -= '0', c < 10);
+
+ if (negate_exp) {
+ e = -e;
+ }
+ exp += e;
+ }
+ }
+
+ ptrdiff_t n = d - digits;
+ if ((exp + n - 1) < limits::min_exponent10) {
+ return D(0.0); // +0.0 is the same as -0.0
+ } else if ((exp + n - 1) > limits::max_exponent10 ) {
+ // not good, because of x = -x below; this may lead to portability problems
+ x = limits::infinity();
+ } else {
+ /* let _Stl_atod diagnose under- and over-flows */
+ /* if the input was == 0.0, we have already returned,
+ so retval of +-Inf signals OVERFLOW, 0.0 UNDERFLOW
+ */
+ x = _Stl_atodT<D,IEEE,M,BIAS>(digits, n, exp);
+ }
+
+ return Negate ? -x : x;
+}
+
+#endif // __linux__
+
+void _STLP_CALL
+__string_to_float(const __iostring& v, float& val)
+{
+#if !defined (__linux__) || defined (ANDROID)
+ val = (float)_Stl_string_to_double(v.c_str());
+#else
+ val = (float)_Stl_string_to_doubleT<double,ieee754_double,12,IEEE754_DOUBLE_BIAS>(v.c_str());
+#endif
+}
+
+void _STLP_CALL
+__string_to_float(const __iostring& v, double& val)
+{
+#if !defined (__linux__) || defined (ANDROID)
+ val = _Stl_string_to_double(v.c_str());
+#else
+ val = _Stl_string_to_doubleT<double,ieee754_double,12,IEEE754_DOUBLE_BIAS>(v.c_str());
+#endif
+}
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+void _STLP_CALL
+__string_to_float(const __iostring& v, long double& val) {
+#if !defined (__linux__) && !defined (__MINGW32__) && !defined (__CYGWIN__) && \
+ !defined (__BORLANDC__) && !defined (__DMC__) && !defined (__HP_aCC)
+ //The following function is valid only if long double is an alias for double.
+ _STLP_STATIC_ASSERT( sizeof(long double) <= sizeof(double) )
+ val = _Stl_string_to_double(v.c_str());
+#else
+ val = _Stl_string_to_doubleT<long double,ieee854_long_double,16,IEEE854_LONG_DOUBLE_BIAS>(v.c_str());
+#endif
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/num_put.cpp b/src/num_put.cpp
new file mode 100644
index 0000000..e123561
--- /dev/null
+++ b/src/num_put.cpp
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <locale>
+#include <ostream>
+
+_STLP_BEGIN_NAMESPACE
+
+// Note that grouping[0] is the number of digits in the *rightmost* group.
+// We assume, without checking, that *last is null and that there is enough
+// space in the buffer to extend the number past [first, last).
+template <class Char>
+static ptrdiff_t
+__insert_grouping_aux(Char* first, Char* last, const string& grouping,
+ Char separator, Char Plus, Char Minus,
+ int basechars) {
+ typedef string::size_type str_size;
+
+ if (first == last)
+ return 0;
+
+ int sign = 0;
+
+ if (*first == Plus || *first == Minus) {
+ sign = 1;
+ ++first;
+ }
+
+ first += basechars;
+ Char* cur_group = last; // Points immediately beyond the rightmost
+ // digit of the current group.
+ int groupsize = 0; // Size of the current group (if grouping.size() == 0, size
+ // of group unlimited: we force condition (groupsize <= 0))
+
+ for ( str_size n = 0; ; ) { // Index of the current group
+ if ( n < grouping.size() ) {
+ groupsize = __STATIC_CAST(int, grouping[n++] );
+ }
+
+ if ((groupsize <= 0) || (groupsize >= cur_group - first) || (groupsize == CHAR_MAX)) {
+ break;
+ }
+
+ // Insert a separator character just before position cur_group - groupsize
+ cur_group -= groupsize;
+ ++last;
+ copy_backward(cur_group, last, last + 1);
+ *cur_group = separator;
+ }
+
+ return (last - first) + sign + basechars;
+}
+
+//Dynamic output buffer version.
+template <class Char, class Str>
+static void
+__insert_grouping_aux( /* __basic_iostring<Char> */ Str& iostr, size_t __group_pos,
+ const string& grouping,
+ Char separator, Char Plus, Char Minus,
+ int basechars) {
+ typedef string::size_type str_size;
+
+ if (iostr.size() < __group_pos)
+ return;
+
+ int __first_pos = 0;
+ Char __first = *iostr.begin();
+
+ if (__first == Plus || __first == Minus) {
+ ++__first_pos;
+ }
+
+ __first_pos += basechars;
+
+ typename Str::iterator cur_group(iostr.begin() + __group_pos); // Points immediately beyond the rightmost
+ // digit of the current group.
+ int groupsize = 0; // Size of the current group (if grouping.size() == 0, size
+ // of group unlimited: we force condition (groupsize <= 0))
+
+ for ( str_size n = 0; ; ) { // Index of the current group
+ if ( n < grouping.size() ) {
+ groupsize = __STATIC_CAST( int, grouping[n++] );
+ }
+
+ if ( (groupsize <= 0) || (groupsize >= ((cur_group - iostr.begin()) - __first_pos)) ||
+ (groupsize == CHAR_MAX)) {
+ break;
+ }
+
+ // Insert a separator character just before position cur_group - groupsize
+ cur_group -= groupsize;
+ cur_group = iostr.insert(cur_group, separator);
+ }
+}
+
+//----------------------------------------------------------------------
+// num_put
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_lo()
+{ return "0123456789abcdefx"; }
+
+_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_hi()
+{ return "0123456789ABCDEFX"; }
+
+char* _STLP_CALL
+__write_integer(char* buf, ios_base::fmtflags flags, long x) {
+ char tmp[64];
+ char* bufend = tmp+64;
+ char* beg = __write_integer_backward(bufend, flags, x);
+ return copy(beg, bufend, buf);
+}
+
+///-------------------------------------
+
+ptrdiff_t _STLP_CALL
+__insert_grouping(char * first, char * last, const string& grouping,
+ char separator, char Plus, char Minus, int basechars) {
+ return __insert_grouping_aux(first, last, grouping,
+ separator, Plus, Minus, basechars);
+}
+
+void _STLP_CALL
+__insert_grouping(__iostring &str, size_t group_pos, const string& grouping,
+ char separator, char Plus, char Minus, int basechars) {
+ __insert_grouping_aux(str, group_pos, grouping, separator, Plus, Minus, basechars);
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+ptrdiff_t _STLP_CALL
+__insert_grouping(wchar_t* first, wchar_t* last, const string& grouping,
+ wchar_t separator, wchar_t Plus, wchar_t Minus,
+ int basechars) {
+ return __insert_grouping_aux(first, last, grouping, separator,
+ Plus, Minus, basechars);
+}
+
+void _STLP_CALL
+__insert_grouping(__iowstring &str, size_t group_pos, const string& grouping,
+ wchar_t separator, wchar_t Plus, wchar_t Minus,
+ int basechars) {
+ __insert_grouping_aux(str, group_pos, grouping, separator, Plus, Minus, basechars);
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//----------------------------------------------------------------------
+// Force instantiation of num_put<>
+#if !defined(_STLP_NO_FORCE_INSTANTIATE)
+template class _STLP_CLASS_DECLSPEC ostreambuf_iterator<char, char_traits<char> >;
+// template class num_put<char, char*>;
+template class num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+# ifndef _STLP_NO_WCHAR_T
+template class ostreambuf_iterator<wchar_t, char_traits<wchar_t> >;
+template class num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+// template class num_put<wchar_t, wchar_t*>;
+# endif /* INSTANTIATE_WIDE_STREAMS */
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/num_put_float.cpp b/src/num_put_float.cpp
new file mode 100644
index 0000000..cb5c446
--- /dev/null
+++ b/src/num_put_float.cpp
@@ -0,0 +1,918 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <cmath>
+#include <ios>
+#include <locale>
+
+#if defined (__DECCXX)
+# define NDIG 400
+#else
+# define NDIG 82
+#endif
+
+#define todigit(x) ((x)+'0')
+
+#if defined (_STLP_UNIX)
+
+# if defined (__sun)
+# include <floatingpoint.h>
+# endif
+
+# if defined (__sun) || defined (__digital__) || defined (__sgi) || defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
+// DEC, SGI & Solaris need this
+# include <values.h>
+# include <nan.h>
+# endif
+
+# if defined (__QNXNTO__) || ( defined(__GNUC__) && defined(__APPLE__) ) || defined(_STLP_USE_UCLIBC) /* 0.9.26 */ || \
+ defined(__FreeBSD__)
+# define USE_SPRINTF_INSTEAD
+# endif
+
+# if defined (_AIX) // JFA 3-Aug-2000
+# include <math.h>
+# include <float.h>
+# endif
+
+# include <math.h>
+#endif
+
+#include <cstdio>
+#include <cstdlib>
+
+#if defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__) || defined (__DJGPP) || \
+ defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR)
+# include <float.h>
+#endif
+
+#if defined (__MRC__) || defined (__SC__) || defined (_CRAY) //*TY 02/24/2000 - added support for MPW
+# include <fp.h>
+#endif
+
+#if defined (__CYGWIN__)
+# include <ieeefp.h>
+#endif
+
+#if defined (__MSL__)
+# include <cstdlib> // for atoi
+# include <cstdio> // for snprintf
+# include <algorithm>
+# include <cassert>
+#endif
+
+#if defined (__ISCPP__)
+# include <cfloat>
+#endif
+
+#include <algorithm>
+
+#if defined (__DMC__)
+# define snprintf _snprintf
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#if defined (__MWERKS__) || defined(__BEOS__)
+# define USE_SPRINTF_INSTEAD
+#endif
+
+template <int N>
+struct _Dig
+{
+ enum { dig = _Dig<N/10>::dig + 1 };
+};
+
+_STLP_TEMPLATE_NULL
+struct _Dig<0>
+{
+ enum { dig = 0 };
+};
+
+#ifdef _STLP_NO_LONG_DOUBLE
+# define MAXEDIGITS int(_Dig<DBL_MAX_10_EXP>::dig)
+# define MAXFSIG DBL_DIG
+# define MAXFCVT (DBL_DIG + 1)
+#else
+# define MAXEDIGITS int(_Dig<LDBL_MAX_10_EXP>::dig)
+# define MAXFSIG LDBL_DIG
+# define MAXFCVT (LDBL_DIG + 1)
+#endif
+
+// Tests for infinity and NaN differ on different OSs. We encapsulate
+// these differences here.
+#if !defined (USE_SPRINTF_INSTEAD)
+# if defined (__hpux) && defined (__GNUC__)
+# define _STLP_USE_SIGN_HELPER
+# elif defined (__DJGPP) || (defined (_STLP_USE_GLIBC) && ! defined (__MSL__)) || \
+ defined (__CYGWIN__) || \
+ defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || \
+ defined (__HP_aCC)
+static inline bool _Stl_is_nan_or_inf(double x)
+# if defined (isfinite)
+{ return !isfinite(x); }
+# else
+{ return !finite(x); }
+# endif
+static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && ( copysign(1., x) < 0 ); }
+static inline bool _Stl_is_inf(double x) { return isinf(x); }
+// inline bool _Stl_is_neg_inf(double x) { return isinf(x) < 0; }
+static inline bool _Stl_is_neg_inf(double x) { return isinf(x) && x < 0; }
+# elif (defined (__unix) || defined (__unix__)) && \
+ !defined (__APPLE__) && !defined (__DJGPP) && !defined(__osf__) && \
+ !defined (_CRAY)
+static inline bool _Stl_is_nan_or_inf(double x) { return IsNANorINF(x); }
+static inline bool _Stl_is_inf(double x) { return IsNANorINF(x) && IsINF(x); }
+static inline bool _Stl_is_neg_inf(double x) { return (IsINF(x)) && (x < 0.0); }
+static inline bool _Stl_is_neg_nan(double x) { return IsNegNAN(x); }
+# elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__)
+static inline bool _Stl_is_nan_or_inf(double x) { return !_finite(x); }
+# if !defined (__BORLANDC__)
+static inline bool _Stl_is_inf(double x) {
+ int fclass = _fpclass(x);
+ return fclass == _FPCLASS_NINF || fclass == _FPCLASS_PINF;
+}
+static inline bool _Stl_is_neg_inf(double x) { return _fpclass(x) == _FPCLASS_NINF; }
+# else
+static inline bool _Stl_is_inf(double x) { return _Stl_is_nan_or_inf(x) && !_isnan(x);}
+static inline bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && x < 0 ; }
+# endif
+static inline bool _Stl_is_neg_nan(double x) { return _isnan(x) && _copysign(1., x) < 0 ; }
+# if defined (__BORLANDC__)
+static inline bool _Stl_is_nan_or_inf(long double x) { return !_finitel(x); }
+static inline bool _Stl_is_inf(long double x) { return _Stl_is_nan_or_inf(x) && !_isnanl(x);}
+static inline bool _Stl_is_neg_inf(long double x) { return _Stl_is_inf(x) && x < 0 ; }
+static inline bool _Stl_is_neg_nan(long double x) { return _isnanl(x) && _copysignl(1.l, x) < 0 ; }
+# elif !defined (_STLP_NO_LONG_DOUBLE)
+// Simply there to avoid warning long double -> double implicit conversion:
+static inline bool _Stl_is_nan_or_inf(long double x) { return _Stl_is_nan_or_inf(__STATIC_CAST(double, x)); }
+static inline bool _Stl_is_inf(long double x) { return _Stl_is_inf(__STATIC_CAST(double, x));}
+static inline bool _Stl_is_neg_inf(long double x) { return _Stl_is_neg_inf(__STATIC_CAST(double, x)); }
+static inline bool _Stl_is_neg_nan(long double x) { return _Stl_is_neg_nan(__STATIC_CAST(double, x)); }
+# endif
+# elif defined (__MRC__) || defined (__SC__) || defined (__DMC__)
+static bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !isfinite(x); }
+static bool _Stl_is_inf(double x) { return !isfinite(x); }
+static bool _Stl_is_neg_inf(double x) { return !isfinite(x) && signbit(x); }
+static bool _Stl_is_neg_nan(double x) { return isnan(x) && signbit(x); }
+# elif /* defined(__FreeBSD__) || defined(__OpenBSD__) || */ (defined(__GNUC__) && defined(__APPLE__))
+static inline bool _Stl_is_nan_or_inf(double x) { return !finite(x); }
+static inline bool _Stl_is_inf(double x) { return _Stl_is_nan_or_inf(x) && ! isnan(x); }
+static inline bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && x < 0 ; }
+static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && copysign(1., x) < 0 ; }
+# elif defined( _AIX ) // JFA 11-Aug-2000
+static bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !finite(x); }
+static bool _Stl_is_inf(double x) { return !finite(x); }
+// bool _Stl_is_neg_inf(double x) { return _class(x) == FP_MINUS_INF; }
+static bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && ( copysign(1., x) < 0 ); }
+static bool _Stl_is_neg_nan(double x) { return isnan(x) && ( copysign(1., x) < 0 ); }
+# elif defined (__ISCPP__)
+static inline bool _Stl_is_nan_or_inf (double x) { return _fp_isINF(x) || _fp_isNAN(x); }
+static inline bool _Stl_is_inf (double x) { return _fp_isINF(x); }
+static inline bool _Stl_is_neg_inf (double x) { return _fp_isINF(x) && x < 0; }
+static inline bool _Stl_is_neg_nan (double x) { return _fp_isNAN(x) && x < 0; }
+# elif defined (_CRAY)
+# if defined (_CRAYIEEE)
+static inline bool _Stl_is_nan_or_inf(double x) { return isnan(x) || isinf(x); }
+static inline bool _Stl_is_inf(double x) { return isinf(x); }
+static inline bool _Stl_is_neg_inf(double x) { return isinf(x) && signbit(x); }
+static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && signbit(x); }
+# else
+static inline bool _Stl_is_nan_or_inf(double x) { return false; }
+static inline bool _Stl_is_inf(double x) { return false; }
+static inline bool _Stl_is_neg_inf(double x) { return false; }
+static inline bool _Stl_is_neg_nan(double x) { return false; }
+# endif
+# else // nothing from above
+# define USE_SPRINTF_INSTEAD
+# endif
+#endif // !USE_SPRINTF_INSTEAD
+
+#if !defined (USE_SPRINTF_INSTEAD)
+// Reentrant versions of floating-point conversion functions. The argument
+// lists look slightly different on different operating systems, so we're
+// encapsulating the differences here.
+
+# if defined (__CYGWIN__) || defined(__DJGPP)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return ecvtbuf(x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return fcvtbuf(x, n, pt, sign, buf); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# if defined (__CYGWIN__)
+# define _STLP_EMULATE_LONG_DOUBLE_CVT
+# else
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return ecvtbuf(x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return fcvtbuf(x, n, pt, sign, buf); }
+# endif
+# endif
+# elif defined (_STLP_USE_GLIBC)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return ecvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0; }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return fcvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0; }
+# ifndef _STLP_NO_LONG_DOUBLE
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return qecvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0; }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return qfcvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0; }
+# endif
+# define _STLP_NEED_CVT_BUFFER_SIZE
+# elif defined (__sun)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return econvert(x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return fconvert(x, n, pt, sign, buf); }
+# ifndef _STLP_NO_LONG_DOUBLE
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return qeconvert(&x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return qfconvert(&x, n, pt, sign, buf); }
+# endif
+# elif defined (__DECCXX)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return (ecvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return (fcvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0); }
+# ifndef _STLP_NO_LONG_DOUBLE
+// fbp : no "long double" conversions !
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return (ecvt_r((double)x, n, pt, sign, buf, bsize) == 0 ? buf : 0) ; }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf, size_t bsize)
+{ return (fcvt_r((double)x, n, pt, sign, buf, bsize) == 0 ? buf : 0); }
+# endif
+# define _STLP_NEED_CVT_BUFFER_SIZE
+# elif defined (__hpux)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign)
+{ return ecvt(x, n, pt, sign); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign)
+{ return fcvt(x, n, pt, sign); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign)
+{ return _ldecvt(*(long_double*)&x, n, pt, sign); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign)
+{ return _ldfcvt(*(long_double*)&x, n, pt, sign); }
+# endif
+# define _STLP_CVT_NEED_SYNCHRONIZATION
+# elif defined (__unix) && !defined (__APPLE__) && !defined (_CRAY)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return ecvt_r(x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return fcvt_r(x, n, pt, sign, buf); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return qecvt_r(x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return qfcvt_r(x, n, pt, sign, buf); }
+# endif
+# elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__)
+# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+# define _STLP_APPEND(a, b) a##b
+# define _STLP_BUF_PARAMS , char* buf, size_t bsize
+# define _STLP_SECURE_FUN(F, X, N, PT, SIGN) _STLP_APPEND(F, _s)(buf, bsize, X, N, PT, SIGN); return buf
+# else
+# define _STLP_BUF_PARAMS
+# define _STLP_SECURE_FUN(F, X, N, PT, SIGN) return F(X, N, PT, SIGN)
+# define _STLP_CVT_NEED_SYNCHRONIZATION
+# endif
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
+{ _STLP_SECURE_FUN(_ecvt, x, n, pt, sign); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
+{ _STLP_SECURE_FUN(_fcvt, x, n, pt, sign); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+# define _STLP_PARAMS , buf, bsize
+# else
+# define _STLP_PARAMS
+# endif
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
+{ return _Stl_ecvtR(__STATIC_CAST(double, x), n, pt, sign _STLP_PARAMS); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign _STLP_BUF_PARAMS)
+{ return _Stl_fcvtR(__STATIC_CAST(double, x), n, pt, sign _STLP_PARAMS); }
+# undef _STLP_PARAMS
+# endif
+# undef _STLP_SECURE_FUN
+# undef _STLP_BUF_PARAMS
+# undef _STLP_APPEND
+# if defined (__BORLANDC__) /* || defined (__GNUC__) MinGW do not support 'L' modifier so emulation do not work */
+# define _STLP_EMULATE_LONG_DOUBLE_CVT
+# endif
+# elif defined (__ISCPP__)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return _fp_ecvt( x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf)
+{ return _fp_fcvt(x, n, pt, sign, buf); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return _fp_ecvt( x, n, pt, sign, buf); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf)
+{ return _fp_fcvt(x, n, pt, sign, buf); }
+# endif
+# elif defined (_AIX) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || \
+ defined (__MRC__) || defined (__SC__) || defined (_CRAY) || \
+ defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR) || \
+ defined (__DMC__)
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign)
+{ return ecvt(x, n, pt, sign ); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign)
+{ return fcvt(x, n, pt, sign); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign)
+{ return ecvt(x, n, pt, sign ); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign)
+{ return fcvt(x, n, pt, sign); }
+# endif
+# define _STLP_CVT_NEED_SYNCHRONIZATION
+# else
+# error Missing _Stl_ecvtR and _Stl_fcvtR implementations.
+# endif
+
+#if defined (_STLP_CVT_NEED_SYNCHRONIZATION)
+/* STLport synchronize access to *cvt functions but those methods might
+ * be called from outside, in this case we will still have a race condition. */
+# if defined (_STLP_THREADS)
+static _STLP_STATIC_MUTEX& put_float_mutex() {
+ static _STLP_STATIC_MUTEX __put_float_mutex _STLP_MUTEX_INITIALIZER;
+ return __put_float_mutex;
+}
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf) {
+ _STLP_auto_lock lock(put_float_mutex());
+ strcpy(buf, _Stl_ecvtR(x, n, pt, sign)); return buf;
+}
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf) {
+ _STLP_auto_lock lock(put_float_mutex());
+ strcpy(buf, _Stl_fcvtR(x, n, pt, sign)); return buf;
+}
+# if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_EMULATE_LONG_DOUBLE_CVT)
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf) {
+ _STLP_auto_lock lock(put_float_mutex());
+ strcpy(buf, _Stl_ecvtR(x, n, pt, sign)); return buf;
+}
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf) {
+ _STLP_auto_lock lock(put_float_mutex());
+ strcpy(buf, _Stl_fcvtR(x, n, pt, sign)); return buf;
+}
+# endif
+# else
+static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char*)
+{ return _Stl_ecvtR(x, n, pt, sign); }
+static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char*)
+{ return _Stl_fcvtR(x, n, pt, sign); }
+# if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_EMULATE_LONG_DOUBLE_CVT)
+static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char*)
+{ return _Stl_ecvtR(x, n, pt, sign); }
+static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char*)
+{ return _Stl_fcvtR(x, n, pt, sign); }
+# endif
+# endif
+#endif
+
+# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS) && !defined (_STLP_NEED_CVT_BUFFER_SIZE)
+# define _STLP_CVT_BUFFER(B) B
+# else
+# define _STLP_CVT_BUFFER(B) _STLP_ARRAY_AND_SIZE(B)
+# endif
+
+# if defined (_STLP_EMULATE_LONG_DOUBLE_CVT)
+static void __fill_fmtbuf(char* fmtbuf, ios_base::fmtflags flags, char long_modifier);
+
+// Emulation of ecvt/fcvt functions using sprintf:
+static char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf) {
+ // If long double value can be safely converted to double without losing precision
+ // we use the ecvt function for double:
+ double y = __STATIC_CAST(double, x);
+ if (x == y)
+ return _Stl_ecvtR(y, n, pt, sign, buf);
+
+ char fmtbuf[32];
+ __fill_fmtbuf(fmtbuf, 0, 'L');
+ sprintf(buf, fmtbuf, n, x < 0.0l ? -x : x);
+ /* We are waiting for something having the form x.xxxe+yyyy */
+ *pt = 0;
+ *sign = 0;
+ int i = -1;
+ int offset = 0;
+ while (buf[++i] != 0 && n != 0) {
+ if (buf[i] >= '0' && buf[i] <= '9') {
+ --n;
+ if (offset != 0)
+ buf[i - offset] = buf[i];
+ }
+ else {
+ if (offset != 0) break;
+ ++offset;
+ *pt = i;
+ }
+ }
+ if (offset != 0)
+ buf[i - offset] = 0;
+ // Extract exponent part in point position:
+ int e = 0;
+ while (buf[++i] != 0) {
+ if (buf[i] >= '0' && buf[i] <= '9') {
+ e = e * 10 + (buf[i] - '0');
+ }
+ }
+ *pt += e;
+ return buf;
+}
+
+static char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf) {
+ // If long double value can be safely converted to double without losing precision
+ // we use the fcvt function for double:
+ double y = __STATIC_CAST(double, x);
+ if (x == y)
+ return _Stl_fcvtR(y, n, pt, sign, buf);
+
+ char fmtbuf[32];
+ __fill_fmtbuf(fmtbuf, ios_base::fixed, 'L');
+ sprintf(buf, fmtbuf, n, x < 0.0l ? -x : x);
+ *pt = 0;
+ *sign = 0;
+ int i = -1;
+ int offset = 0;
+ while (buf[++i] != 0 && (offset == 0 || n != 0)) {
+ if (buf[i] >= '0' && buf[i] <= '9') {
+ if (offset != 0) {
+ --n;
+ buf[i - offset] = buf[i];
+ }
+ }
+ else {
+ ++offset;
+ *pt = i;
+ }
+ }
+ if (offset != 0)
+ buf[i - offset] = 0;
+ else
+ *pt = i;
+ return buf;
+}
+#endif
+
+//----------------------------------------------------------------------
+// num_put
+
+// __format_float formats a mantissa and exponent as returned by
+// one of the conversion functions (ecvt_r, fcvt_r, qecvt_r, qfcvt_r)
+// according to the specified precision and format flags. This is
+// based on doprnt but is much simpler since it is concerned only
+// with floating point input and does not consider all formats. It
+// also does not deal with blank padding, which is handled by
+// __copy_float_and_fill.
+
+static size_t __format_float_scientific( __iostring& buf, const char *bp,
+ int decpt, int sign, bool is_zero,
+ ios_base::fmtflags flags,
+ int precision) {
+ // sign if required
+ if (sign)
+ buf += '-';
+ else if (flags & ios_base::showpos)
+ buf += '+';
+
+ // first digit of mantissa
+ buf += *bp++;
+
+ // start of grouping position, grouping won't occur in scientific notation
+ // as it is impossible to have something like 1234.0e04 but we return a correct
+ // group position for coherency with __format_float_fixed.
+ size_t __group_pos = buf.size();
+
+ // decimal point if required
+ if (precision != 0 || flags & ios_base::showpoint) {
+ buf += '.';
+ }
+
+ // rest of mantissa
+ while (*bp != 0 && precision--)
+ buf += *bp++;
+
+ // trailing 0 if needed
+ if (precision > 0)
+ buf.append(precision, '0');
+
+ // exponent size = number of digits + exponent sign + exponent symbol + trailing zero
+ char expbuf[MAXEDIGITS + 3];
+ //We start filling at the buffer end
+ char *suffix = expbuf + MAXEDIGITS + 2;
+ *suffix = 0;
+ if (!is_zero) {
+ int nn = decpt - 1;
+ if (nn < 0)
+ nn = -nn;
+ for (; nn > 9; nn /= 10)
+ *--suffix = (char) todigit(nn % 10);
+ *--suffix = (char) todigit(nn);
+ }
+
+ // prepend leading zeros to exponent
+ // C89 Standard says that it should be at least 2 digits, C99 Standard says that
+ // we stop prepend zeros if more than 3 digits. To repect both STLport prepend zeros
+ // until it is 2 digits.
+ while (suffix > &expbuf[MAXEDIGITS])
+ *--suffix = '0';
+
+ // put in the exponent sign
+ *--suffix = (char) ((decpt > 0 || is_zero ) ? '+' : '-');
+
+ // put in the e
+ *--suffix = flags & ios_base::uppercase ? 'E' : 'e';
+
+ // copy the suffix
+ buf += suffix;
+ return __group_pos;
+}
+
+static size_t __format_float_fixed( __iostring &buf, const char *bp,
+ int decpt, int sign,
+ ios_base::fmtflags flags,
+ int precision) {
+ if ( sign && (decpt > -precision) && (*bp != 0) )
+ buf += '-';
+ else if ( flags & ios_base::showpos )
+ buf += '+';
+
+ // digits before decimal point
+ int nnn = decpt;
+ do {
+ buf += (nnn <= 0 || *bp == 0) ? '0' : *bp++;
+ } while ( --nnn > 0 );
+
+ // start of grouping position
+ size_t __group_pos = buf.size();
+
+ // decimal point if needed
+ if ( flags & ios_base::showpoint || precision > 0 ) {
+ buf += '.';
+ }
+
+ // digits after decimal point if any
+ while ( *bp != 0 && --precision >= 0 ) {
+ buf += (++decpt <= 0) ? '0' : *bp++;
+ }
+
+ // trailing zeros if needed
+ if (precision > 0)
+ buf.append(precision, '0');
+
+ return __group_pos;
+}
+
+#if defined (_STLP_USE_SIGN_HELPER)
+template<class _FloatT>
+struct float_sign_helper {
+ float_sign_helper(_FloatT __x)
+ { _M_number._num = __x; }
+
+ bool is_negative() const {
+ const unsigned short sign_mask(1 << (sizeof(unsigned short) * CHAR_BIT - 1));
+ return (get_sign_word() & sign_mask) != 0;
+ }
+private:
+ union {
+ unsigned short _Words[8];
+ _FloatT _num;
+ } _M_number;
+
+ unsigned short get_word_higher() const _STLP_NOTHROW
+ { return _M_number._Words[0]; }
+ unsigned short get_word_lower() const _STLP_NOTHROW
+ { return _M_number._Words[(sizeof(_FloatT) >= 12 ? 10 : sizeof(_FloatT)) / sizeof(unsigned short) - 1]; }
+ unsigned short get_sign_word() const _STLP_NOTHROW
+# if defined (_STLP_BIG_ENDIAN)
+ { return get_word_higher(); }
+# else /* _STLP_LITTLE_ENDIAN */
+ { return get_word_lower(); }
+# endif
+};
+#endif
+
+template <class _FloatT>
+static size_t __format_nan_or_inf(__iostring& buf, _FloatT x, ios_base::fmtflags flags) {
+ static const char* inf[2] = { "inf", "Inf" };
+ static const char* nan[2] = { "nan", "NaN" };
+ const char** inf_or_nan;
+#if !defined (_STLP_USE_SIGN_HELPER)
+ if (_Stl_is_inf(x)) { // Infinity
+ inf_or_nan = inf;
+ if (_Stl_is_neg_inf(x))
+ buf += '-';
+ else if (flags & ios_base::showpos)
+ buf += '+';
+ } else { // NaN
+ inf_or_nan = nan;
+ if (_Stl_is_neg_nan(x))
+ buf += '-';
+ else if (flags & ios_base::showpos)
+ buf += '+';
+ }
+#else
+ typedef numeric_limits<_FloatT> limits;
+ if (x == limits::infinity() || x == -limits::infinity()) {
+ inf_or_nan = inf;
+ } else { // NaN
+ inf_or_nan = nan;
+ }
+ float_sign_helper<_FloatT> helper(x);
+ if (helper.is_negative())
+ buf += '-';
+ else if (flags & ios_base::showpos)
+ buf += '+';
+#endif
+ size_t ret = buf.size();
+ buf += inf_or_nan[flags & ios_base::uppercase ? 1 : 0];
+ return ret;
+}
+
+static inline size_t __format_float(__iostring &buf, const char * bp,
+ int decpt, int sign, bool is_zero,
+ ios_base::fmtflags flags,
+ int precision) {
+ size_t __group_pos = 0;
+ switch (flags & ios_base::floatfield) {
+ case ios_base::scientific:
+ __group_pos = __format_float_scientific( buf, bp, decpt, sign, is_zero,
+ flags, precision);
+ break;
+ case ios_base::fixed:
+ __group_pos = __format_float_fixed( buf, bp, decpt, sign,
+ flags, precision);
+ break;
+ default: // g format
+ // establish default precision
+ if (flags & ios_base::showpoint || precision > 0) {
+ if (precision == 0) precision = 1;
+ } else
+ precision = 6;
+
+ // reset exponent if value is zero
+ if (is_zero)
+ decpt = 1;
+
+ int kk = precision;
+ if (!(flags & ios_base::showpoint)) {
+ size_t n = strlen(bp);
+ if (n < (size_t)kk)
+ kk = (int)n;
+ while (kk >= 1 && bp[kk-1] == '0')
+ --kk;
+ }
+
+ if (decpt < -3 || decpt > precision) {
+ precision = kk - 1;
+ __group_pos = __format_float_scientific( buf, bp, decpt, sign, is_zero,
+ flags, precision);
+ } else {
+ precision = kk - decpt;
+ __group_pos = __format_float_fixed( buf, bp, decpt, sign,
+ flags, precision);
+ }
+ break;
+ } /* switch */
+ return __group_pos;
+}
+
+#endif
+
+#if defined (USE_SPRINTF_INSTEAD) || defined (_STLP_EMULATE_LONG_DOUBLE_CVT)
+struct GroupPos {
+ bool operator () (char __c) const {
+ return __c == '.' ||
+ __c == 'e' || __c == 'E';
+ }
+};
+
+// Creates a format string for sprintf()
+static void __fill_fmtbuf(char* fmtbuf, ios_base::fmtflags flags, char long_modifier) {
+ fmtbuf[0] = '%';
+ int i = 1;
+
+ if (flags & ios_base::showpos)
+ fmtbuf[i++] = '+';
+
+ if (flags & ios_base::showpoint)
+ fmtbuf[i++] = '#';
+
+ fmtbuf[i++] = '.';
+ fmtbuf[i++] = '*';
+
+ if (long_modifier)
+ fmtbuf[i++] = long_modifier;
+
+ switch (flags & ios_base::floatfield)
+ {
+ case ios_base::scientific:
+ fmtbuf[i++] = (flags & ios_base::uppercase) ? 'E' : 'e';
+ break;
+ case ios_base::fixed:
+# if defined (__FreeBSD__)
+ fmtbuf[i++] = 'f';
+# else
+ fmtbuf[i++] = (flags & ios_base::uppercase) ? 'F' : 'f';
+# endif
+ break;
+ default:
+ fmtbuf[i++] = (flags & ios_base::uppercase) ? 'G' : 'g';
+ break;
+ }
+
+ fmtbuf[i] = 0;
+}
+
+#endif /* USE_SPRINTF_INSTEAD */
+
+template <class _FloatT>
+static size_t __write_floatT(__iostring &buf, ios_base::fmtflags flags, int precision,
+ _FloatT x
+#if defined (USE_SPRINTF_INSTEAD)
+ , char modifier) {
+ /* In theory, if we want 'arbitrary' precision, we should use 'arbitrary'
+ * buffer size below, but really we limited by exponent part in double.
+ * - ptr
+ */
+ typedef numeric_limits<_FloatT> limits;
+ char static_buf[limits::max_exponent10 + 6]; // 6: -xxx.yyyE-zzz (sign, dot, E, exp sign, \0)
+ char fmtbuf[32];
+ __fill_fmtbuf(fmtbuf, flags, modifier);
+ snprintf(_STLP_ARRAY_AND_SIZE(static_buf), fmtbuf, precision, x);
+ buf = static_buf;
+ return find_if(buf.begin(), buf.end(), GroupPos()) - buf.begin();
+#else
+ ) {
+ typedef numeric_limits<_FloatT> limits;
+ //If numeric_limits support is correct we use the exposed values to detect NaN and infinity:
+ if (limits::has_infinity && limits::has_quiet_NaN) {
+ if (!(x == x) || // NaN check
+ (x == limits::infinity() || x == -limits::infinity())) {
+ return __format_nan_or_inf(buf, x, flags);
+ }
+ }
+ // numeric_limits support is not good enough, we rely on platform dependent function
+ // _Stl_is_nan_or_inf that do not support long double.
+ else if (_Stl_is_nan_or_inf(x)) {
+ return __format_nan_or_inf(buf, x, flags);
+ }
+# if defined (__MINGW32__)
+ //For the moment MinGW is limited to display at most numeric_limits<double>::max()
+ if (x > numeric_limits<double>::max() ||
+ x < -numeric_limits<double>::max()) {
+ return __format_nan_or_inf(buf, x, flags);
+ }
+# endif
+
+ /* Buffer size is max number of digits which is the addition of:
+ * - max_exponent10: max number of digits in fixed mode
+ * - digits10 + 2: max number of significant digits
+ * - trailing '\0'
+ */
+ char cvtbuf[limits::max_exponent10 + limits::digits10 + 2 + 1];
+ char *bp;
+ int decpt, sign;
+
+ switch (flags & ios_base::floatfield) {
+ case ios_base::fixed:
+ {
+ /* Here, number of digits represents digits _after_ decimal point.
+ * In order to limit static buffer size we have to give 2 different values depending on x value.
+ * For small values (abs(x) < 1) we need as many digits as requested by precision limited by the maximum number of digits
+ * which is min_exponent10 + digits10 + 2
+ * For bigger values we won't have more than limits::digits10 + 2 digits after decimal point. */
+ int digits10 = (x > -1.0 && x < 1.0 ? -limits::min_exponent10 + limits::digits10 + 2
+ : limits::digits10 + 2);
+ bp = _Stl_fcvtR(x, (min) (precision, digits10), &decpt, &sign, _STLP_CVT_BUFFER(cvtbuf) );
+ }
+ break;
+ case ios_base::scientific:
+ default:
+ /* Here, number of digits is total number of digits which is limited to digits10 + 2. */
+ {
+ int digits10 = limits::digits10 + 2;
+ bp = _Stl_ecvtR(x, (min) (precision, digits10), &decpt, &sign, _STLP_CVT_BUFFER(cvtbuf) );
+ }
+ break;
+ }
+ return __format_float(buf, bp, decpt, sign, x == 0.0, flags, precision);
+#endif
+}
+
+size_t _STLP_CALL
+__write_float(__iostring &buf, ios_base::fmtflags flags, int precision,
+ double x) {
+ return __write_floatT(buf, flags, precision, x
+#if defined (USE_SPRINTF_INSTEAD)
+ , 0
+#endif
+ );
+}
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+size_t _STLP_CALL
+__write_float(__iostring &buf, ios_base::fmtflags flags, int precision,
+ long double x) {
+ return __write_floatT(buf, flags, precision, x
+#if defined (USE_SPRINTF_INSTEAD)
+ , 'L'
+#endif
+ );
+}
+#endif
+
+void _STLP_CALL __get_floor_digits(__iostring &out, _STLP_LONGEST_FLOAT_TYPE __x) {
+ typedef numeric_limits<_STLP_LONGEST_FLOAT_TYPE> limits;
+#if defined (USE_SPRINTF_INSTEAD)
+ char cvtbuf[limits::max_exponent10 + 6];
+# if !defined (_STLP_NO_LONG_DOUBLE)
+ snprintf(_STLP_ARRAY_AND_SIZE(cvtbuf), "%Lf", __x); // check for 1234.56!
+# else
+ snprintf(_STLP_ARRAY_AND_SIZE(cvtbuf), "%f", __x); // check for 1234.56!
+# endif
+ char *p = strchr( cvtbuf, '.' );
+ if ( p == 0 ) {
+ out.append( cvtbuf );
+ } else {
+ out.append( cvtbuf, p );
+ }
+#else
+ char cvtbuf[limits::max_exponent10 + 1];
+ char * bp;
+ int decpt, sign;
+ bp = _Stl_fcvtR(__x, 0, &decpt, &sign, _STLP_CVT_BUFFER(cvtbuf));
+
+ if (sign) {
+ out += '-';
+ }
+ out.append(bp, bp + decpt);
+#endif
+}
+
+
+#if !defined (_STLP_NO_WCHAR_T)
+void _STLP_CALL __convert_float_buffer( __iostring const& str, __iowstring &out,
+ const ctype<wchar_t>& ct, wchar_t dot, bool __check_dot) {
+ string::const_iterator str_ite(str.begin()), str_end(str.end());
+
+ //First loop, check the dot char
+ if (__check_dot) {
+ while (str_ite != str_end) {
+ if (*str_ite != '.') {
+ out += ct.widen(*str_ite++);
+ } else {
+ out += dot;
+ break;
+ }
+ }
+ } else {
+ if (str_ite != str_end) {
+ out += ct.widen(*str_ite);
+ }
+ }
+
+ if (str_ite != str_end) {
+ //Second loop, dot has been found, no check anymore
+ while (++str_ite != str_end) {
+ out += ct.widen(*str_ite);
+ }
+ }
+}
+
+#endif
+
+void _STLP_CALL
+__adjust_float_buffer(__iostring &str, char dot) {
+ if ('.' != dot) {
+ size_t __dot_pos = str.find('.');
+ if (__dot_pos != string::npos) {
+ str[__dot_pos] = dot;
+ }
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/numpunct.cpp b/src/numpunct.cpp
new file mode 100644
index 0000000..cbadc7a
--- /dev/null
+++ b/src/numpunct.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <locale>
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// numpunct<char>
+char numpunct<char>::do_decimal_point() const {return '.';}
+char numpunct<char>::do_thousands_sep() const { return ','; }
+string numpunct<char>::do_grouping() const { return string();}
+string numpunct<char>::do_truename() const { return "true";}
+string numpunct<char>::do_falsename() const { return "false"; }
+numpunct<char>::~numpunct() {}
+
+#if !defined (_STLP_NO_WCHAR_T)
+wchar_t numpunct<wchar_t>::do_decimal_point() const { return L'.'; }
+wchar_t numpunct<wchar_t>::do_thousands_sep() const { return L','; }
+string numpunct<wchar_t>::do_grouping() const { return string(); }
+wstring numpunct<wchar_t>::do_truename() const { return L"true"; }
+wstring numpunct<wchar_t>::do_falsename() const { return L"false"; }
+numpunct<wchar_t>::~numpunct() {}
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/ostream.cpp b/src/ostream.cpp
new file mode 100644
index 0000000..96d4737
--- /dev/null
+++ b/src/ostream.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <ostream>
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined(_STLP_NO_FORCE_INSTANTIATE)
+
+// instantiations
+template class _STLP_CLASS_DECLSPEC basic_ostream<char, char_traits<char> >;
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+template class _STLP_CLASS_DECLSPEC _Osentry<char, char_traits<char> >;
+# endif
+
+#ifndef _STLP_NO_WCHAR_T
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+template class _STLP_CLASS_DECLSPEC _Osentry<wchar_t, char_traits<wchar_t> >;
+# endif
+template class _STLP_CLASS_DECLSPEC basic_ostream<wchar_t, char_traits<wchar_t> >;
+#endif
+
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/sparc_atomic.s b/src/sparc_atomic.s
new file mode 100644
index 0000000..67e41d6
--- /dev/null
+++ b/src/sparc_atomic.s
@@ -0,0 +1,68 @@
+ .section ".text",#alloc,#execinstr
+ .align 8
+ .skip 16
+
+
+ /*
+ ** int _STLP_atomic_exchange (void *pvalue, int value)
+ */
+
+ .type _STLP_atomic_exchange,#function
+ .global _STLP_atomic_exchange
+ .align 8
+
+_STLP_atomic_exchange:
+0:
+ ld [%o0], %o2 ! Set the current value
+ mov %o1, %o3 ! Set the new value
+! swap [%o0], %o3 ! Do the compare and swap
+ cas [%o0], %o2, %o3
+ cmp %o2, %o3 ! Check whether successful
+ bne 0b ! Retry upon failure
+ stbar
+ mov %o2, %o0 ! Set the new value
+ retl ! return
+ nop
+ .size _STLP_atomic_exchange,(.-_STLP_atomic_exchange)
+
+ /* int _STLP_atomic_increment (void *pvalue) */
+
+ .type _STLP_atomic_increment,#function
+ .global _STLP_atomic_increment
+ .align 8
+_STLP_atomic_increment:
+1:
+ ld [%o0], %o2 ! set the current
+ add %o2, 0x1, %o3 ! Increment and store current
+! swap [%o0], %o3 ! Do the compare and swap
+ cas [%o0], %o2, %o3
+ cmp %o3, %o2 ! Check whether successful
+ bne 1b ! Retry if we failed.
+ membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
+ ! returning
+ nop
+ retl ! return
+ nop
+
+ .size _STLP_atomic_increment,(.-_STLP_atomic_increment)
+
+
+ /* int _STLP_atomic_decrement (void *pvalue) */
+ .type _STLP_atomic_decrement,#function
+ .global _STLP_atomic_decrement
+ .align 8
+
+_STLP_atomic_decrement:
+2:
+ ld [%o0], %o2 ! set the current
+ sub %o2, 0x1, %o3 ! decrement and store current
+! swap [%o0], %o3 ! Do the compare and swap
+ cas [%o0], %o2, %o3
+ cmp %o3, %o2 ! Check whether successful
+ bne 2b ! Retry if we failed.
+ membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
+ nop
+ ! returning
+ retl ! return
+ nop
+ .size _STLP_atomic_decrement,(.-_STLP_atomic_decrement)
diff --git a/src/sparc_atomic64.s b/src/sparc_atomic64.s
new file mode 100644
index 0000000..ff2c42a
--- /dev/null
+++ b/src/sparc_atomic64.s
@@ -0,0 +1,65 @@
+ .section ".text",#alloc,#execinstr
+ .align 8
+ .skip 16
+
+! int _STLP_atomic_exchange (void *pvalue, int value)
+!
+
+ .type _STLP_atomic_exchange,#function
+ .global _STLP_atomic_exchange
+ .align 8
+
+_STLP_atomic_exchange:
+1:
+ ldx [%o0], %o2 ! Set the current value
+ mov %o1, %o3 ! Set the new value
+ casx [%o0], %o2, %o3 ! Do the compare and swap
+ cmp %o2, %o3 ! Check whether successful
+ bne 1b ! Retry upon failure
+ membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
+ ! returning
+ retl ! return
+ mov %o2, %o0 ! Set the new value
+ .size _STLP_atomic_exchange,(.-_STLP_atomic_exchange)
+
+
+! int _STLP_atomic_increment (void *pvalue)
+
+ .type _STLP_atomic_increment,#function
+ .global _STLP_atomic_increment
+ .align 8
+_STLP_atomic_increment:
+0:
+ ldx [%o0], %o2 ! set the current
+ addx %o2, 0x1, %o3 ! Increment and store current
+ casx [%o0], %o2, %o3 ! Do the compare and swap
+ cmp %o3, %o2 ! Check whether successful
+ bne 0b
+ membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
+ ! returning
+ retl ! return
+ mov %o1, %o0 ! Set the return value
+
+ .size _STLP_atomic_increment,(.-_STLP_atomic_increment)
+
+
+! /* int _STLP_atomic_decrement (void *pvalue) */
+ .type _STLP_atomic_decrement,#function
+ .global _STLP_atomic_decrement
+ .align 8
+
+_STLP_atomic_decrement:
+0:
+ ldx [%o0], %o2 ! set the current
+ subx %o2, 0x1, %o3 ! decrement and store current
+ casx [%o0], %o2, %o3 ! Do the compare and swap
+ cmp %o3, %o2 ! Check whether successful
+ bne 0b
+ membar #LoadLoad | #LoadStore ! Ensure the cas finishes before
+ ! returning
+ retl ! return
+ nop
+ .size _STLP_atomic_decrement,(.-_STLP_atomic_decrement)
+
+
+
diff --git a/src/sstream.cpp b/src/sstream.cpp
new file mode 100644
index 0000000..2d1d652
--- /dev/null
+++ b/src/sstream.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#include "stlport_prefix.h"
+
+#include <sstream>
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_NO_FORCE_INSTANTIATE)
+
+// Force instantiation of stringstream classes.
+template class _STLP_CLASS_DECLSPEC basic_stringbuf<char, char_traits<char>, allocator<char> >;
+template class _STLP_CLASS_DECLSPEC basic_ostringstream<char, char_traits<char>, allocator<char> >;
+template class _STLP_CLASS_DECLSPEC basic_istringstream<char, char_traits<char>, allocator<char> >;
+template class _STLP_CLASS_DECLSPEC basic_stringstream<char, char_traits<char>, allocator<char> >;
+
+# if !defined (_STLP_NO_WCHAR_T)
+template class _STLP_CLASS_DECLSPEC basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+template class _STLP_CLASS_DECLSPEC basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+template class _STLP_CLASS_DECLSPEC basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+template class _STLP_CLASS_DECLSPEC basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+
+#endif
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/stdio_streambuf.cpp b/src/stdio_streambuf.cpp
new file mode 100644
index 0000000..45aad79
--- /dev/null
+++ b/src/stdio_streambuf.cpp
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+#include "stdio_streambuf.h"
+
+#ifdef _STLP_UNIX
+# include <sys/types.h>
+# include <sys/stat.h>
+#endif
+
+#include <fstream>
+#include <limits>
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Compare with streamoff definition in stl/char_traits.h!
+
+#if defined (_STLP_USE_DEFAULT_FILE_OFFSET) || \
+ (!defined(_LARGEFILE_SOURCE) && !defined(_LARGEFILE64_SOURCE))
+# if !defined (_STLP_MSVC) || (_STLP_MSVC < 1400) || defined(_STLP_WCE)
+# define FSEEK fseek
+# else
+# define FSEEK _fseeki64
+# endif
+# define FSETPOS fsetpos
+# define FGETPOS fgetpos
+# define FPOS_T fpos_t
+#else
+# define FSEEK fseeko64
+# define FSETPOS fsetpos64
+# define FGETPOS fgetpos64
+# define FPOS_T fpos64_t
+#endif
+
+//----------------------------------------------------------------------
+// Class stdio_streambuf_base
+
+stdio_streambuf_base::stdio_streambuf_base(FILE* file)
+ : /* _STLP_STD::FILE_basic_streambuf(file, 0), */
+ _M_file(file)
+{}
+
+stdio_streambuf_base::~stdio_streambuf_base() {
+ _STLP_VENDOR_CSTD::fflush(_M_file);
+}
+
+_STLP_STD::streambuf* stdio_streambuf_base::setbuf(char* s, streamsize n) {
+#ifdef _STLP_WCE
+ // no buffering in windows ce .NET
+#else
+ size_t __n_size_t = (sizeof(streamsize) > sizeof(size_t)) ? __STATIC_CAST(size_t, (min)(__STATIC_CAST(streamsize, (numeric_limits<size_t>::max)()), n))
+ : __STATIC_CAST(size_t, n);
+ _STLP_VENDOR_CSTD::setvbuf(_M_file, s, (s == 0 && n == 0) ? _IONBF : _IOFBF, __n_size_t);
+#endif
+ return this;
+}
+
+stdio_streambuf_base::pos_type
+stdio_streambuf_base::seekoff(off_type off, ios_base::seekdir dir,
+ ios_base::openmode /* mode */) {
+ int whence;
+ switch (dir) {
+ case ios_base::beg:
+ whence = SEEK_SET;
+ break;
+ case ios_base::cur:
+ whence = SEEK_CUR;
+ break;
+ case ios_base::end:
+ whence = SEEK_END;
+ break;
+ default:
+ return pos_type(-1);
+ }
+
+ if (off <= numeric_limits<off_type>::max() && FSEEK(_M_file, off, whence) == 0) {
+ FPOS_T pos;
+ FGETPOS(_M_file, &pos);
+ // added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead
+ // of a primitive type
+#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2))))
+ return pos_type((streamoff)pos.__pos);
+#elif defined (__ISCPP__) || defined (__MVS__) || defined (__OS400__)
+ return pos_type(pos.__fpos_elem[ 0 ]);
+#elif defined (__EMX__)
+ return pos_type((streamoff)pos._pos);
+#else
+ return pos_type(pos);
+#endif
+ }
+ else
+ return pos_type(-1);
+}
+
+
+stdio_streambuf_base::pos_type
+stdio_streambuf_base::seekpos(pos_type pos, ios_base::openmode /* mode */) {
+ // added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead
+ // of a primitive type
+#if (defined(__GLIBC__) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) )
+ FPOS_T p;
+ p.__pos = pos;
+# ifdef _STLP_USE_UCLIBC
+# ifdef __STDIO_MBSTATE
+ memset( &(p.__mbstate), 0, sizeof(p.__mbstate) );
+# endif
+# ifdef __STDIO_WIDE
+ p.mblen_pending = 0;
+# endif
+# else
+ memset( &(p.__state), 0, sizeof(p.__state) );
+# endif
+#elif defined (__MVS__) || defined (__OS400__)
+ FPOS_T p;
+ p.__fpos_elem[0] = pos;
+#elif defined (__EMX__)
+ FPOS_T p;
+ p._pos = pos;
+ memset( &(p._mbstate), 0, sizeof(p._mbstate) );
+#else
+ FPOS_T p(pos);
+#endif
+
+ return FSETPOS(_M_file, &p) == 0 ? pos : pos_type(-1);
+}
+
+int stdio_streambuf_base::sync() {
+ return _STLP_VENDOR_CSTD::fflush(_M_file) == 0 ? 0 : -1;
+}
+
+//----------------------------------------------------------------------
+// Class stdio_istreambuf
+
+stdio_istreambuf::~stdio_istreambuf() {}
+
+streamsize stdio_istreambuf::showmanyc()
+{ return 0; }
+
+stdio_istreambuf::int_type stdio_istreambuf::underflow()
+{
+#ifdef _STLP_WCE
+ int c = fgetc(_M_file);
+#else
+ int c = getc(_M_file);
+#endif
+ if (c != EOF) {
+ _STLP_VENDOR_CSTD::ungetc(c, _M_file);
+ return c;
+ }
+ else
+ return traits_type::eof();
+}
+
+stdio_istreambuf::int_type stdio_istreambuf::uflow() {
+#ifdef _STLP_WCE
+ int c = fgetc(_M_file);
+#else
+ int c = getc(_M_file);
+#endif
+ return c != EOF ? c : traits_type::eof();
+}
+
+stdio_istreambuf::int_type stdio_istreambuf::pbackfail(int_type c) {
+ if (c != traits_type::eof()) {
+ int result = _STLP_VENDOR_CSTD::ungetc(c, _M_file);
+ return result != EOF ? result : traits_type::eof();
+ }
+ else{
+ if (this->eback() < this->gptr()) {
+ this->gbump(-1);
+ return traits_type::not_eof(c);
+ }
+ else
+ return traits_type::eof();
+ }
+}
+
+//----------------------------------------------------------------------
+// Class stdio_ostreambuf
+
+stdio_ostreambuf::~stdio_ostreambuf() {}
+
+streamsize stdio_ostreambuf::showmanyc()
+{ return -1; }
+
+stdio_ostreambuf::int_type stdio_ostreambuf::overflow(int_type c) {
+ // Write the existing buffer, without writing any additional character.
+ if (c == traits_type::eof()) {
+ // Do we have a buffer to write?
+ ptrdiff_t unwritten = this->pptr() - this->pbase();
+ if (unwritten != 0) {
+ _STLP_VENDOR_CSTD::fflush(_M_file);
+ // Test if the write succeeded.
+ if (this->pptr() - this->pbase() < unwritten)
+ return traits_type::not_eof(c);
+ else
+ return traits_type::eof();
+ }
+
+ // We always succeed if we don't have to do anything.
+ else
+ return traits_type::not_eof(c);
+ }
+
+ // Write the character c, and whatever else might be in the buffer.
+ else {
+#ifdef _STLP_WCE
+ int result = fputc(c, _M_file);
+#else
+ int result = putc(c, _M_file);
+#endif
+ return result != EOF ? result : traits_type::eof();
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/src/stdio_streambuf.h b/src/stdio_streambuf.h
new file mode 100644
index 0000000..33747b5
--- /dev/null
+++ b/src/stdio_streambuf.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+// This header defines two streambufs:
+// stdio_istreambuf, a read-only streambuf synchronized with a C stdio
+// FILE object
+// stdio_ostreambuf, a write-only streambuf synchronized with a C stdio
+// FILE object.
+// Note that neither stdio_istreambuf nor stdio_ostreambuf is a template;
+// both classes are derived from basic_streambuf<char, char_traits<char> >.
+
+// Note: the imbue() member function is a no-op. In particular, these
+// classes assume that codecvt<char, char, mbstate_t> is always an identity
+// transformation. This is true of the default locale, and of all locales
+// defined for the C I/O library. If you need to use a locale where
+// the codecvt<char, char, mbstate_t> facet performs a nontrivial
+// conversion, then you should use basic_filebuf<> instead of stdio_istreambuf
+// or stdio_ostreambuf. (If you don't understand what any of this means,
+// then it's not a feature you need to worry about. Locales where
+// codecvt<char, char, mbstate_t> does something nontrivial are a rare
+// corner case.)
+
+
+#ifndef _STLP_STDIO_STREAMBUF
+#define _STLP_STDIO_STREAMBUF
+
+#include <streambuf>
+#include <cstdio> // For FILE.
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Base class for features common to stdio_istreambuf and stdio_ostreambuf
+class stdio_streambuf_base :
+ public basic_streambuf<char, char_traits<char> > /* FILE_basic_streambuf */ {
+public: // Constructor, destructor.
+ // The argument may not be null. It must be an open file pointer.
+ stdio_streambuf_base(FILE*);
+
+ // The destructor flushes the stream, but does not close it.
+ ~stdio_streambuf_base();
+
+protected: // Virtual functions from basic_streambuf.
+ streambuf* setbuf(char*, streamsize);
+
+ pos_type seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode
+ = ios_base::in | ios_base::out);
+ pos_type seekpos(pos_type,
+ ios_base::openmode
+ = ios_base::in | ios_base::out);
+ int sync();
+
+protected:
+ FILE* _M_file;
+};
+
+class stdio_istreambuf : public stdio_streambuf_base {
+public: // Constructor, destructor.
+ stdio_istreambuf(FILE* __f) : stdio_streambuf_base(__f) {}
+ ~stdio_istreambuf();
+
+protected: // Virtual functions from basic_streambuf.
+ streamsize showmanyc();
+ int_type underflow();
+ int_type uflow();
+ virtual int_type pbackfail(int_type c = traits_type::eof());
+};
+
+class stdio_ostreambuf : public stdio_streambuf_base {
+public: // Constructor, destructor.
+ stdio_ostreambuf(FILE* __f) : stdio_streambuf_base(__f) {}
+ ~stdio_ostreambuf();
+
+protected: // Virtual functions from basic_streambuf.
+ streamsize showmanyc();
+ int_type overflow(int_type c = traits_type::eof());
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_STDIO_STREAMBUF */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/stlport.rc b/src/stlport.rc
new file mode 100644
index 0000000..3fdb4a7
--- /dev/null
+++ b/src/stlport.rc
@@ -0,0 +1,96 @@
+///////////////////////////
+//
+// Version
+//
+#include <windows.h>
+
+#include <stl/_stlport_version.h>
+
+/* On some evc3/evc4 targets the windows.h doesn't include winver.h or doesn't
+ * define needed file version flags, so we redefine them here.
+ */
+#ifndef VS_FF_DEBUG
+# define VS_FF_DEBUG 0x00000001L
+#endif
+
+#ifndef VOS__WINDOWS32
+# define VOS__WINDOWS32 0x00000004L
+#endif
+
+#ifndef VFT_DLL
+# define VFT_DLL 0x00000002L
+#endif
+
+#ifndef VFT2_UNKNOWN
+# define VFT2_UNKNOWN 0x00000000L
+#endif
+
+#define STRINGIZE(X) STRINGIZE_AUX(X)
+#define STRINGIZE_AUX(X) #X
+
+#define VERSION_ID _STLPORT_MAJOR, _STLPORT_MINOR, _STLPORT_PATCHLEVEL, 0
+#if !defined (__BORLANDC__)
+# define VERSION_STR STRINGIZE(_STLPORT_MAJOR._STLPORT_MINOR._STLPORT_PATCHLEVEL)
+#else
+/* Borland precompiler happen weird character when trying to transform a
+ * macro containing 0 in a character string so we use a workaround for this
+ * value. We do not check the major version that will never be 0 again.
+ */
+# if (_STLPORT_MINOR == 0)
+# define _STLP_MINOR "0"
+# else
+# define _STLP_MINOR STRINGIZE(_STLPORT_MINOR)
+# endif
+# if (_STLPORT_PATCHLEVEL == 0)
+# define _STLP_PATCH "0"
+# else
+# define _STLP_PATCH STRINGIZE(_STLPORT_PATCHLEVEL)
+# endif
+# define VERSION_STR STRINGIZE(_STLPORT_MAJOR) "." _STLP_MINOR "." _STLP_PATCH "\0"
+#endif
+
+#if defined (__GNUC__)
+# define LIB_MOTIF "libstlport"
+#else
+# define LIB_MOTIF "stlport"
+#endif
+#define DLLNAME LIB_MOTIF "." STRINGIZE(_STLPORT_MAJOR) "." STRINGIZE(_STLPORT_MINOR) ".dll\0"
+#define DLLNAME2(buildstr) LIB_MOTIF "" STRINGIZE(buildstr) "." STRINGIZE(_STLPORT_MAJOR) "." STRINGIZE(_STLPORT_MINOR) ".dll\0"
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION VERSION_ID
+PRODUCTVERSION VERSION_ID
+FILEFLAGSMASK 0x3fL
+
+FILEFLAGS VS_FF_DEBUG
+
+FILEOS VOS__WINDOWS32
+FILETYPE VFT_DLL
+FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "CompanyName", "STLport Consulting, Inc.\0"
+ VALUE "FileDescription", "STLport\0"
+ VALUE "FileVersion", VERSION_STR
+ VALUE "InternalName", "STLPORT.DLL\0"
+ VALUE "LegalCopyright", "Copyright (C) Boris Fomitchev\0"
+#if !defined (BUILD)
+ VALUE "OriginalFilename", DLLNAME
+#else
+ VALUE "OriginalFilename", DLLNAME2(BUILD)
+#endif
+ VALUE "ProductName", "STLport Standard ANSI C++ Library\0"
+ VALUE "ProductVersion", VERSION_STR
+#if defined (BUILD_INFOS)
+ VALUE "SpecialBuild", STRINGIZE(COMP) " " STRINGIZE(BUILD_INFOS) "\0"
+#endif
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/src/stlport_prefix.h b/src/stlport_prefix.h
new file mode 100644
index 0000000..4e06b76
--- /dev/null
+++ b/src/stlport_prefix.h
@@ -0,0 +1,43 @@
+#ifndef STLPORT_PREFIX_H
+#define STLPORT_PREFIX_H
+
+#define __BUILDING_STLPORT 1
+
+#if defined (_WIN32) || defined (WIN32)
+# ifdef __cplusplus
+# define WIN32_LEAN_AND_MEAN
+# define NOSERVICE
+# endif
+#endif
+
+#undef _STLP_NO_FORCE_INSTANTIATE
+
+/* Please add extra compilation switches for particular compilers here */
+
+#if defined (_MSC_VER) && !defined (__COMO__) && !defined (__MWERKS__)
+# include "warning_disable.h"
+#endif
+
+#include <stl/config/features.h>
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+#endif
+
+#ifdef __cplusplus
+
+# include <ctime>
+# if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_VENDOR_GLOBAL_CSTD)
+using _STLP_VENDOR_CSTD::time_t;
+# endif
+
+# if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+# define _STLP_OPERATOR_SPEC _STLP_DECLSPEC
+# else
+# define _STLP_OPERATOR_SPEC _STLP_TEMPLATE_NULL _STLP_DECLSPEC
+# endif
+
+#endif /* __cplusplus */
+
+#endif /* PREFIX */
+
diff --git a/src/string.cpp b/src/string.cpp
new file mode 100644
index 0000000..77e2187
--- /dev/null
+++ b/src/string.cpp
@@ -0,0 +1,93 @@
+#include "stlport_prefix.h"
+
+#include <string>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined(_STLP_USE_WIDE_INTERFACE)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+wstring __ASCIIToWide(const char *ascii) {
+ size_t size = strlen(ascii);
+ wchar_t* buff = new wchar_t[size+1];
+ mbstowcs(buff, ascii, size);
+ buff[size] = 0x00;
+ wstring ret(buff);
+ delete[] buff;
+ return ret;
+}
+string __WideToASCII(const wchar_t *wide) {
+ size_t size = wcslen(wide);
+ char* buff = new char[size+1];
+ wcstombs(buff, wide, size);
+ buff[size] = 0;
+ string ret(buff);
+ delete[] buff;
+ return ret;
+}
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if !defined (_STLP_NO_FORCE_INSTANTIATE)
+
+template class _STLP_CLASS_DECLSPEC allocator<char>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<char*, char, allocator<char> >;
+template class _STLP_CLASS_DECLSPEC _String_base<char, allocator<char> >;
+
+# if defined (_STLP_DEBUG) && !defined (__SUNPRO_CC) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NON_DBG_NAME(str)
+
+template class _STLP_CLASS_DECLSPEC basic_string<char, char_traits<char>, allocator<char> >;
+template class _STLP_CLASS_DECLSPEC __construct_checker<basic_string<char, char_traits<char>, allocator<char> > >;
+
+# undef basic_string
+# endif
+
+# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NO_MEM_T_NAME(str)
+# else
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+template class _STLP_CLASS_DECLSPEC basic_string<char, char_traits<char>, allocator<char> >;
+
+# if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+# endif
+
+# if !defined (_STLP_NO_WCHAR_T)
+template class _STLP_CLASS_DECLSPEC allocator<wchar_t>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template class _STLP_CLASS_DECLSPEC _String_base<wchar_t, allocator<wchar_t> >;
+
+# if defined (_STLP_DEBUG) && !defined (__SUNPRO_CC) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NON_DBG_NAME(str)
+
+template class _STLP_CLASS_DECLSPEC basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+template class _STLP_CLASS_DECLSPEC __construct_checker<basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > >;
+
+# undef basic_string
+# endif
+
+# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NO_MEM_T_NAME(str)
+# else
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+template class _STLP_CLASS_DECLSPEC basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+
+# if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+# endif
+# endif
+#endif
+
+_STLP_END_NAMESPACE
diff --git a/src/strstream.cpp b/src/strstream.cpp
new file mode 100644
index 0000000..740e01e
--- /dev/null
+++ b/src/strstream.cpp
@@ -0,0 +1,391 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+// Implementation of the classes in header <strstream>.
+// WARNING: The classes defined in <strstream> are DEPRECATED. This
+// header is defined in section D.7.1 of the C++ standard, and it
+// MAY BE REMOVED in a future standard revision. You should use the
+// header <sstream> instead.
+
+#include "stlport_prefix.h"
+
+#include <strstream>
+#include <algorithm>
+#include <limits>
+
+_STLP_BEGIN_NAMESPACE
+
+// strstreambuf constructor, destructor.
+strstreambuf::strstreambuf(streamsize initial_capacity)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(true), _M_frozen(false), _M_constant(false) {
+ size_t n = (sizeof(streamsize) > sizeof(size_t)) ? __STATIC_CAST(size_t, (min)(__STATIC_CAST(streamsize, (numeric_limits<size_t>::max)()),
+ (max)(initial_capacity, streamsize(16))))
+ : __STATIC_CAST(size_t, (max)(initial_capacity, streamsize(16)));
+
+ char* buf = _M_alloc(n);
+ if (buf) {
+ setp(buf, buf + n);
+ setg(buf, buf, buf);
+ }
+}
+
+strstreambuf::strstreambuf(__alloc_fn alloc_f, __free_fn free_f)
+ : _M_alloc_fun(alloc_f), _M_free_fun(free_f),
+ _M_dynamic(true), _M_frozen(false), _M_constant(false) {
+ size_t n = 16;
+
+ char* buf = _M_alloc(n);
+ if (buf) {
+ setp(buf, buf + n);
+ setg(buf, buf, buf);
+ }
+}
+
+strstreambuf::strstreambuf(char* get, streamsize n, char* put)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(false) {
+ _M_setup(get, put, n);
+}
+
+strstreambuf::strstreambuf(signed char* get, streamsize n, signed char* put)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(false) {
+ _M_setup(__REINTERPRET_CAST(char*,get), __REINTERPRET_CAST(char*,put), n);
+}
+
+strstreambuf::strstreambuf(unsigned char* get, streamsize n,
+ unsigned char* put)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(false) {
+ _M_setup(__REINTERPRET_CAST(char*,get), __REINTERPRET_CAST(char*,put), n);
+}
+
+strstreambuf::strstreambuf(const char* get, streamsize n)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(true) {
+ _M_setup(__CONST_CAST(char*,get), 0, n);
+}
+
+strstreambuf::strstreambuf(const signed char* get, streamsize n)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(true) {
+ _M_setup(__REINTERPRET_CAST(char*, __CONST_CAST(signed char*,get)), 0, n);
+}
+
+strstreambuf::strstreambuf(const unsigned char* get, streamsize n)
+ : _M_alloc_fun(0), _M_free_fun(0),
+ _M_dynamic(false), _M_frozen(false), _M_constant(true) {
+ _M_setup(__REINTERPRET_CAST(char*, __CONST_CAST(unsigned char*,get)), 0, n);
+}
+
+strstreambuf::~strstreambuf() {
+ if (_M_dynamic && !_M_frozen)
+ _M_free(eback());
+}
+
+void strstreambuf::freeze(bool frozenflag) {
+ if (_M_dynamic)
+ _M_frozen = frozenflag;
+}
+
+char* strstreambuf::str() {
+ freeze(true);
+ return eback();
+}
+
+int strstreambuf::pcount() const {
+ return int(pptr() ? pptr() - pbase() : 0);
+}
+
+strstreambuf::int_type strstreambuf::overflow(int_type c) {
+ if (c == traits_type::eof())
+ return traits_type::not_eof(c);
+
+ // Try to expand the buffer.
+ if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant) {
+ ptrdiff_t old_size = epptr() - pbase();
+ ptrdiff_t new_size = (max)(2 * old_size, ptrdiff_t(1));
+
+ char* buf = _M_alloc(new_size);
+ if (buf) {
+ memcpy(buf, pbase(), old_size);
+
+ char* old_buffer = pbase();
+ bool reposition_get = false;
+ ptrdiff_t old_get_offset;
+ if (gptr() != 0) {
+ reposition_get = true;
+ old_get_offset = gptr() - eback();
+ }
+
+ setp(buf, buf + new_size);
+ pbump((int)old_size);
+
+ if (reposition_get)
+ setg(buf, buf + old_get_offset, buf + (max)(old_get_offset, old_size));
+
+ _M_free(old_buffer);
+ }
+ }
+
+ if (pptr() != epptr()) {
+ *pptr() = traits_type::to_char_type(c);
+ pbump(1);
+ return c;
+ }
+ else
+ return traits_type::eof();
+}
+
+strstreambuf::int_type strstreambuf::pbackfail(int_type c) {
+ if (gptr() != eback()) {
+ if (c == traits_type::eof()) {
+ gbump(-1);
+ return traits_type::not_eof(c);
+ }
+ else if (c == gptr()[-1]) {
+ gbump(-1);
+ return c;
+ }
+ else if (!_M_constant) {
+ gbump(-1);
+ *gptr() = traits_type::to_char_type(c);
+ return c;
+ }
+ }
+
+ return traits_type::eof();
+}
+
+strstreambuf::int_type strstreambuf::underflow() {
+ if (gptr() == egptr() && pptr() && pptr() > egptr())
+ setg(eback(), gptr(), pptr());
+
+ if (gptr() != egptr())
+ return (unsigned char) *gptr();
+ else
+ return _Traits::eof();
+}
+
+basic_streambuf<char, char_traits<char> >*
+strstreambuf::setbuf(char*, streamsize) {
+ return this;
+}
+
+strstreambuf::pos_type
+strstreambuf::seekoff(off_type off,
+ ios_base::seekdir dir, ios_base::openmode mode) {
+ bool do_get = false;
+ bool do_put = false;
+
+ if ((mode & (ios_base::in | ios_base::out)) ==
+ (ios_base::in | ios_base::out) &&
+ (dir == ios_base::beg || dir == ios_base::end))
+ do_get = do_put = true;
+ else if (mode & ios_base::in)
+ do_get = true;
+ else if (mode & ios_base::out)
+ do_put = true;
+
+ // !gptr() is here because, according to D.7.1 paragraph 4, the seekable
+ // area is undefined if there is no get area.
+ if ((!do_get && !do_put) || (do_put && !pptr()) || !gptr())
+ return pos_type(off_type(-1));
+
+ char* seeklow = eback();
+ char* seekhigh = epptr() ? epptr() : egptr();
+
+ off_type newoff;
+ switch(dir) {
+ case ios_base::beg:
+ newoff = 0;
+ break;
+ case ios_base::end:
+ newoff = seekhigh - seeklow;
+ break;
+ case ios_base::cur:
+ newoff = do_put ? pptr() - seeklow : gptr() - seeklow;
+ break;
+ default:
+ return pos_type(off_type(-1));
+ }
+
+ off += newoff;
+ if (off < 0 || off > seekhigh - seeklow)
+ return pos_type(off_type(-1));
+
+ if (do_put) {
+ if (seeklow + __STATIC_CAST(ptrdiff_t, off) < pbase()) {
+ setp(seeklow, epptr());
+ pbump((int)off);
+ }
+ else {
+ setp(pbase(), epptr());
+ pbump((int)(off - (pbase() - seeklow)));
+ }
+ }
+ if (do_get) {
+ if (off <= egptr() - seeklow)
+ setg(seeklow, seeklow + __STATIC_CAST(ptrdiff_t, off), egptr());
+ else if (off <= pptr() - seeklow)
+ setg(seeklow, seeklow + __STATIC_CAST(ptrdiff_t, off), pptr());
+ else
+ setg(seeklow, seeklow + __STATIC_CAST(ptrdiff_t, off), epptr());
+ }
+
+ return pos_type(newoff);
+}
+
+strstreambuf::pos_type
+strstreambuf::seekpos(pos_type pos, ios_base::openmode mode) {
+ return seekoff(pos - pos_type(off_type(0)), ios_base::beg, mode);
+}
+
+
+char* strstreambuf::_M_alloc(size_t n) {
+ if (_M_alloc_fun)
+ return __STATIC_CAST(char*,_M_alloc_fun(n));
+ else
+ return new char[n];
+}
+
+void strstreambuf::_M_free(char* p) {
+ if (p) {
+ if (_M_free_fun)
+ _M_free_fun(p);
+ else
+ delete[] p;
+ }
+}
+
+void strstreambuf::_M_setup(char* get, char* put, streamsize n) {
+ if (get) {
+ size_t N = n > 0 ? size_t(n) : n == 0 ? strlen(get) : size_t(INT_MAX);
+
+ if (put) {
+ setg(get, get, get + N);
+ setp(put, put + N);
+ }
+ else {
+ setg(get, get, get + N);
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+// Class istrstream
+
+istrstream::istrstream(char* s)
+ : basic_istream<char, char_traits<char> >(0), _M_buf(s, 0) {
+ this->init(&_M_buf);
+}
+
+istrstream::istrstream(const char* s)
+ : basic_istream<char, char_traits<char> >(0), _M_buf(s, 0) {
+ this->init(&_M_buf);
+}
+
+istrstream::istrstream(char* s, streamsize n)
+ : basic_istream<char, char_traits<char> >(0), _M_buf(s, n) {
+ this->init(&_M_buf);
+}
+
+istrstream::istrstream(const char* s, streamsize n)
+ : basic_istream<char, char_traits<char> >(0), _M_buf(s, n) {
+ this->init(&_M_buf);
+}
+
+istrstream::~istrstream() {}
+
+strstreambuf* istrstream::rdbuf() const {
+ return __CONST_CAST(strstreambuf*,&_M_buf);
+}
+
+char* istrstream::str() { return _M_buf.str(); }
+
+//----------------------------------------------------------------------
+// Class ostrstream
+
+ostrstream::ostrstream()
+ : basic_ostream<char, char_traits<char> >(0), _M_buf() {
+ basic_ios<char, char_traits<char> >::init(&_M_buf);
+}
+
+ostrstream::ostrstream(char* s, int n, ios_base::openmode mode)
+ : basic_ostream<char, char_traits<char> >(0),
+ _M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s) {
+ basic_ios<char, char_traits<char> >::init(&_M_buf);
+}
+
+ostrstream::~ostrstream() {}
+
+strstreambuf* ostrstream::rdbuf() const {
+ return __CONST_CAST(strstreambuf*,&_M_buf);
+}
+
+void ostrstream::freeze(bool freezeflag) {
+ _M_buf.freeze(freezeflag);
+}
+
+char* ostrstream::str() {
+ return _M_buf.str();
+}
+
+int ostrstream::pcount() const {
+ return _M_buf.pcount();
+}
+
+
+//----------------------------------------------------------------------
+// Class strstream
+
+strstream::strstream()
+ : basic_iostream<char, char_traits<char> >(0), _M_buf() {
+ basic_ios<char, char_traits<char> >::init(&_M_buf);
+}
+
+strstream::strstream(char* s, int n, ios_base::openmode mode)
+ : basic_iostream<char, char_traits<char> >(0),
+ _M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s) {
+ basic_ios<char, char_traits<char> >::init(&_M_buf);
+}
+
+strstream::~strstream() {}
+
+strstreambuf* strstream::rdbuf() const {
+ return __CONST_CAST(strstreambuf*,&_M_buf);
+}
+
+void strstream::freeze(bool freezeflag) {
+ _M_buf.freeze(freezeflag);
+}
+
+int strstream::pcount() const {
+ return _M_buf.pcount();
+}
+
+char* strstream::str() {
+ return _M_buf.str();
+}
+
+_STLP_END_NAMESPACE
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/src/time_facets.cpp b/src/time_facets.cpp
new file mode 100644
index 0000000..3e98c70
--- /dev/null
+++ b/src/time_facets.cpp
@@ -0,0 +1,565 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "stlport_prefix.h"
+
+#include <cstdio>
+#include <locale>
+#include <istream>
+
+#include "c_locale.h"
+#include "acquire_release.h"
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// default "C" values for month and day names
+
+const char default_dayname[][14] = {
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
+ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
+ "Friday", "Saturday"};
+
+const char default_monthname[][24] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
+ "January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December"};
+
+#ifndef _STLP_NO_WCHAR_T
+const wchar_t default_wdayname[][14] = {
+ L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat",
+ L"Sunday", L"Monday", L"Tuesday", L"Wednesday", L"Thursday",
+ L"Friday", L"Saturday"};
+
+const wchar_t default_wmonthname[][24] = {
+ L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun",
+ L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec",
+ L"January", L"February", L"March", L"April", L"May", L"June",
+ L"July", L"August", L"September", L"October", L"November", L"December"};
+#endif
+
+#if defined (__BORLANDC__)
+_Time_Info time_init<char>::_M_timeinfo;
+# ifndef _STLP_NO_WCHAR_T
+_WTime_Info time_init<wchar_t>::_M_timeinfo;
+# endif
+#endif
+
+// _Init_time_info: initialize table with
+// "C" values (note these are not defined in the C standard, so this
+// is somewhat arbitrary).
+
+static void _Init_timeinfo_base(_Time_Info_Base& table) {
+ table._M_time_format = "%H:%M:%S";
+ table._M_date_format = "%m/%d/%y";
+ table._M_date_time_format = "%m/%d/%y";
+}
+
+static void _Init_timeinfo(_Time_Info& table) {
+ int i;
+ for (i = 0; i < 14; ++i)
+ table._M_dayname[i] = default_dayname[i];
+ for (i = 0; i < 24; ++i)
+ table._M_monthname[i] = default_monthname[i];
+ table._M_am_pm[0] = "AM";
+ table._M_am_pm[1] = "PM";
+ _Init_timeinfo_base(table);
+}
+
+#ifndef _STLP_NO_WCHAR_T
+static void _Init_timeinfo(_WTime_Info& table) {
+ int i;
+ for (i = 0; i < 14; ++i)
+ table._M_dayname[i] = default_wdayname[i];
+ for (i = 0; i < 24; ++i)
+ table._M_monthname[i] = default_wmonthname[i];
+ table._M_am_pm[0] = L"AM";
+ table._M_am_pm[1] = L"PM";
+ _Init_timeinfo_base(table);
+}
+#endif
+
+static void _Init_timeinfo_base(_Time_Info_Base& table, _Locale_time * time) {
+ table._M_time_format = _Locale_t_fmt(time);
+ if ( table._M_time_format == "%T" ) {
+ table._M_time_format = "%H:%M:%S";
+ } else if ( table._M_time_format == "%r" ) {
+ table._M_time_format = "%I:%M:%S %p";
+ } else if ( table._M_time_format == "%R" ) {
+ table._M_time_format = "%H:%M";
+ }
+ table._M_date_format = _Locale_d_fmt(time);
+ table._M_date_time_format = _Locale_d_t_fmt(time);
+ table._M_long_date_format = _Locale_long_d_fmt(time);
+ table._M_long_date_time_format = _Locale_long_d_t_fmt(time);
+}
+
+static void _Init_timeinfo(_Time_Info& table, _Locale_time * time) {
+ int i;
+ for (i = 0; i < 7; ++i)
+ table._M_dayname[i] = _Locale_abbrev_dayofweek(time, i);
+ for (i = 0; i < 7; ++i)
+ table._M_dayname[i+7] = _Locale_full_dayofweek(time, i);
+ for (i = 0; i < 12; ++i)
+ table._M_monthname[i] = _Locale_abbrev_monthname(time, i);
+ for (i = 0; i < 12; ++i)
+ table._M_monthname[i+12] = _Locale_full_monthname(time, i);
+ table._M_am_pm[0] = _Locale_am_str(time);
+ table._M_am_pm[1] = _Locale_pm_str(time);
+ _Init_timeinfo_base(table, time);
+}
+
+#ifndef _STLP_NO_WCHAR_T
+static void _Init_timeinfo(_WTime_Info& table, _Locale_time * time) {
+ wchar_t buf[128];
+ int i;
+ for (i = 0; i < 7; ++i)
+ table._M_dayname[i] = _WLocale_abbrev_dayofweek(time, i, _STLP_ARRAY_AND_SIZE(buf));
+ for (i = 0; i < 7; ++i)
+ table._M_dayname[i+7] = _WLocale_full_dayofweek(time, i, _STLP_ARRAY_AND_SIZE(buf));
+ for (i = 0; i < 12; ++i)
+ table._M_monthname[i] = _WLocale_abbrev_monthname(time, i, _STLP_ARRAY_AND_SIZE(buf));
+ for (i = 0; i < 12; ++i)
+ table._M_monthname[i+12] = _WLocale_full_monthname(time, i, _STLP_ARRAY_AND_SIZE(buf));
+ table._M_am_pm[0] = _WLocale_am_str(time, _STLP_ARRAY_AND_SIZE(buf));
+ table._M_am_pm[1] = _WLocale_pm_str(time, _STLP_ARRAY_AND_SIZE(buf));
+ _Init_timeinfo_base(table, time);
+}
+#endif
+
+template <class _Ch, class _TimeInfo>
+void __subformat(_STLP_BASIC_IOSTRING(_Ch) &buf, const ctype<_Ch>& ct,
+ const string& format, const _TimeInfo& table, const tm* t) {
+ const char * cp = format.data();
+ const char * cp_end = cp + format.size();
+ while (cp != cp_end) {
+ if (*cp == '%') {
+ char mod = 0;
+ ++cp;
+ if (*cp == '#') {
+ mod = *cp; ++cp;
+ }
+ __write_formatted_timeT(buf, ct, *cp++, mod, table, t);
+ } else
+ buf.append(1, *cp++);
+ }
+}
+
+static void __append(__iostring &buf, const string& name)
+{ buf.append(name.data(), name.data() + name.size()); }
+
+static void __append(__iowstring &buf, const wstring& name)
+{ buf.append(name.data(), name.data() + name.size()); }
+
+static void __append(__iostring &buf, char *first, char *last, const ctype<char>& /* ct */)
+{ buf.append(first, last); }
+
+static void __append(__iowstring &buf, char *first, char *last, const ctype<wchar_t>& ct) {
+ wchar_t _wbuf[64];
+ ct.widen(first, last, _wbuf);
+ buf.append(_wbuf, _wbuf + (last - first));
+}
+
+#if defined (__GNUC__)
+/* The number of days from the first day of the first ISO week of this
+ year to the year day YDAY with week day WDAY. ISO weeks start on
+ Monday; the first ISO week has the year's first Thursday. YDAY may
+ be as small as YDAY_MINIMUM. */
+# define __ISO_WEEK_START_WDAY 1 /* Monday */
+# define __ISO_WEEK1_WDAY 4 /* Thursday */
+# define __YDAY_MINIMUM (-366)
+# define __TM_YEAR_BASE 1900
+static int
+__iso_week_days(int yday, int wday) {
+ /* Add enough to the first operand of % to make it nonnegative. */
+ int big_enough_multiple_of_7 = (-__YDAY_MINIMUM / 7 + 2) * 7;
+ return (yday
+ - (yday - wday + __ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7
+ + __ISO_WEEK1_WDAY - __ISO_WEEK_START_WDAY);
+}
+
+# define __is_leap(year)\
+ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
+
+#endif
+
+#define __hour12(hour) \
+ (((hour) % 12 == 0) ? (12) : (hour) % 12)
+
+#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+# define _STLP_SPRINTF sprintf
+#else
+# define _STLP_SPRINTF sprintf_s
+#endif
+
+template <class _Ch, class _TimeInfo>
+void _STLP_CALL __write_formatted_timeT(_STLP_BASIC_IOSTRING(_Ch) &buf,
+ const ctype<_Ch>& ct,
+ char format, char modifier,
+ const _TimeInfo& table, const tm* t) {
+ char _buf[64];
+ char *_bend;
+
+ switch (format) {
+ case 'a':
+ __append(buf, table._M_dayname[t->tm_wday]);
+ break;
+
+ case 'A':
+ __append(buf, table._M_dayname[t->tm_wday + 7]);
+ break;
+
+ case 'b':
+ __append(buf, table._M_monthname[t->tm_mon]);
+ break;
+
+ case 'B':
+ __append(buf, table._M_monthname[t->tm_mon + 12]);
+ break;
+
+ case 'c':
+ __subformat(buf, ct, (modifier != '#') ? table._M_date_time_format
+ : table._M_long_date_time_format, table, t);
+ break;
+
+ case 'd':
+ _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_mday);
+ __append(buf, _buf, ((long)t->tm_mday < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct);
+ break;
+
+ case 'e':
+ _STLP_SPRINTF(_buf, "%2ld", (long)t->tm_mday);
+ __append(buf, _buf, _buf + 2, ct);
+ break;
+
+ case 'H':
+ _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_hour);
+ __append(buf, _buf, ((long)t->tm_hour < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct);
+ break;
+
+ case 'I':
+ _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)__hour12(t->tm_hour));
+ __append(buf, _buf, ((long)__hour12(t->tm_hour) < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct);
+ break;
+
+ case 'j':
+ _bend = __write_integer(_buf, 0, (long)((long)t->tm_yday + 1));
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case 'm':
+ _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_mon + 1);
+ __append(buf, _buf, ((long)(t->tm_mon + 1) < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct);
+ break;
+
+ case 'M':
+ _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_min);
+ __append(buf, _buf, ((long)t->tm_min < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct);
+ break;
+
+ case 'p':
+ __append(buf, table._M_am_pm[t->tm_hour / 12]);
+ break;
+
+ case 'S': // pad with zeros
+ _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_sec);
+ __append(buf, _buf, ((long)t->tm_sec < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct);
+ break;
+
+ case 'U':
+ _bend = __write_integer(_buf, 0, long((t->tm_yday - t->tm_wday + 7) / 7));
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case 'w':
+ _bend = __write_integer(_buf, 0, (long)t->tm_wday);
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case 'W':
+ _bend = __write_integer(_buf, 0,
+ (long)(t->tm_wday == 0 ? (t->tm_yday + 1) / 7 :
+ (t->tm_yday + 8 - t->tm_wday) / 7));
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case'x':
+ __subformat(buf, ct, (modifier != '#') ? table._M_date_format
+ : table._M_long_date_format, table, t);
+ break;
+
+ case 'X':
+ __subformat(buf, ct, table._M_time_format, table, t);
+ break;
+
+ case 'y':
+ _bend = __write_integer(_buf, 0, (long)((long)(t->tm_year + 1900) % 100));
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case 'Y':
+ _bend = __write_integer(_buf, 0, (long)((long)t->tm_year + 1900));
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case '%':
+ buf.append(1, ct.widen('%'));
+ break;
+
+#if defined (__GNUC__)
+ // fbp : at least on SUN
+# if defined (_STLP_UNIX) && !defined (__linux__)
+# define __USE_BSD 1
+# endif
+
+ /*********************************************
+ * JGS, handle various extensions *
+ *********************************************/
+
+ case 'h': /* POSIX.2 extension */
+ // same as 'b', abbrev month name
+ __append(buf, table._M_monthname[t->tm_mon]);
+ break;
+ case 'C': /* POSIX.2 extension */
+ // same as 'd', the day
+ _STLP_SPRINTF(_buf, "%2ld", (long)t->tm_mday);
+ __append(buf, _buf, _buf + 2, ct);
+ break;
+
+ case 'D': /* POSIX.2 extension */
+ // same as 'x'
+ __subformat(buf, ct, table._M_date_format, table, t);
+ break;
+
+ case 'k': /* GNU extension */
+ _STLP_SPRINTF(_buf, "%2ld", (long)t->tm_hour);
+ __append(buf, _buf, _buf + 2, ct);
+ break;
+
+ case 'l': /* GNU extension */
+ _STLP_SPRINTF(_buf, "%2ld", (long)t->tm_hour % 12);
+ __append(buf, _buf, _buf + 2, ct);
+ break;
+
+ case 'n': /* POSIX.2 extension */
+ buf.append(1, ct.widen('\n'));
+ break;
+
+ case 'R': /* GNU extension */
+ __subformat(buf, ct, "%H:%M", table, t);
+ break;
+
+ case 'r': /* POSIX.2 extension */
+ __subformat(buf, ct, "%I:%M:%S %p", table, t);
+ break;
+
+ case 'T': /* POSIX.2 extension. */
+ __subformat(buf, ct, "%H:%M:%S", table, t);
+ break;
+
+ case 't': /* POSIX.2 extension. */
+ buf.append(1, ct.widen('\t'));
+
+ case 'u': /* POSIX.2 extension. */
+ _bend = __write_integer(_buf, 0, long((t->tm_wday - 1 + 7)) % 7 + 1);
+ __append(buf, _buf, _bend, ct);
+ break;
+
+ case 's': {
+ time_t __t = mktime(__CONST_CAST(tm*, t));
+ _bend = __write_integer(_buf, 0, (long)__t );
+ __append(buf, _buf, _bend, ct);
+ break;
+ }
+ case 'g': /* GNU extension */
+ case 'G': {
+ int year = t->tm_year + __TM_YEAR_BASE;
+ int days = __iso_week_days (t->tm_yday, t->tm_wday);
+ if (days < 0) {
+ /* This ISO week belongs to the previous year. */
+ year--;
+ days = __iso_week_days (t->tm_yday + (365 + __is_leap (year)), t->tm_wday);
+ }
+ else {
+ int d = __iso_week_days (t->tm_yday - (365 + __is_leap (year)), t->tm_wday);
+ if (0 <= d) {
+ /* This ISO week belongs to the next year. */
+ ++year;
+ days = d;
+ }
+ }
+ long val;
+ switch (format) {
+ case 'g':
+ val = (long)(year % 100 + 100) % 100;
+ break;
+ case 'G':
+ val = (long)year;
+ break;
+ default:
+ val = (long)days / 7 + 1;
+ break;
+ }
+ _bend = __write_integer(_buf, 0, val);
+ __append(buf, _buf, _bend, ct);
+ break;
+ }
+
+# if defined (_STLP_USE_GLIBC)
+ case 'z': /* GNU extension. */
+ if (t->tm_isdst < 0)
+ break;
+ {
+ int diff;
+# if defined (__USE_BSD) || defined (__BEOS__)
+ diff = t->tm_gmtoff;
+# else
+ diff = t->__tm_gmtoff;
+# endif
+ if (diff < 0) {
+ buf.append(1, ct.widen('-'));
+ diff = -diff;
+ } else
+ buf.append(1, ct.widen('+'));
+ diff /= 60;
+ _STLP_SPRINTF(_buf, "%.4d", (diff / 60) * 100 + diff % 60);
+ __append(buf, _buf, _buf + 4, ct);
+ break;
+ }
+# endif /* __GLIBC__ */
+#endif /* __GNUC__ */
+
+ default:
+ break;
+ }
+}
+
+void _STLP_CALL __write_formatted_time(__iostring &buf, const ctype<char>& ct,
+ char format, char modifier,
+ const _Time_Info& table, const tm* t)
+{ __write_formatted_timeT(buf, ct, format, modifier, table, t); }
+
+void _STLP_CALL __write_formatted_time(__iowstring &buf, const ctype<wchar_t>& ct,
+ char format, char modifier,
+ const _WTime_Info& table, const tm* t)
+{ __write_formatted_timeT(buf, ct, format, modifier, table, t); }
+
+static time_base::dateorder __get_date_order(_Locale_time* time) {
+ const char * fmt = _Locale_d_fmt(time);
+ char first, second, third;
+
+ while (*fmt != 0 && *fmt != '%') ++fmt;
+ if (*fmt == 0)
+ return time_base::no_order;
+ first = *++fmt;
+ while (*fmt != 0 && *fmt != '%') ++fmt;
+ if (*fmt == 0)
+ return time_base::no_order;
+ second = *++fmt;
+ while (*fmt != 0 && *fmt != '%') ++fmt;
+ if (*fmt == 0)
+ return time_base::no_order;
+ third = *++fmt;
+
+ switch (first) {
+ case 'd':
+ return (second == 'm' && third == 'y') ? time_base::dmy
+ : time_base::no_order;
+ case 'm':
+ return (second == 'd' && third == 'y') ? time_base::mdy
+ : time_base::no_order;
+ case 'y':
+ switch (second) {
+ case 'd':
+ return third == 'm' ? time_base::ydm : time_base::no_order;
+ case 'm':
+ return third == 'd' ? time_base::ymd : time_base::no_order;
+ default:
+ return time_base::no_order;
+ }
+ default:
+ return time_base::no_order;
+ }
+}
+
+time_init<char>::time_init()
+ : _M_dateorder(time_base::no_order)
+{ _Init_timeinfo(_M_timeinfo); }
+
+time_init<char>::time_init(const char* __name) {
+ if (!__name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _Locale_time *__time = __acquire_time(__name, buf, 0, &__err_code);
+ if (!__time)
+ locale::_M_throw_on_creation_failure(__err_code, __name, "time");
+
+ _Init_timeinfo(this->_M_timeinfo, __time);
+ _M_dateorder = __get_date_order(__time);
+ __release_time(__time);
+}
+
+time_init<char>::time_init(_Locale_time *__time) {
+ _Init_timeinfo(this->_M_timeinfo, __time);
+ _M_dateorder = __get_date_order(__time);
+}
+
+#ifndef _STLP_NO_WCHAR_T
+time_init<wchar_t>::time_init()
+ : _M_dateorder(time_base::no_order)
+{ _Init_timeinfo(_M_timeinfo); }
+
+time_init<wchar_t>::time_init(const char* __name) {
+ if (!__name)
+ locale::_M_throw_on_null_name();
+
+ int __err_code;
+ char buf[_Locale_MAX_SIMPLE_NAME];
+ _Locale_time *__time = __acquire_time(__name, buf, 0, &__err_code);
+ if (!__time)
+ locale::_M_throw_on_creation_failure(__err_code, __name, "time");
+
+ _Init_timeinfo(this->_M_timeinfo, __time);
+ _M_dateorder = __get_date_order(__time);
+ __release_time(__time);
+}
+
+time_init<wchar_t>::time_init(_Locale_time *__time) {
+ _Init_timeinfo(this->_M_timeinfo, __time);
+ _M_dateorder = __get_date_order(__time);
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if !defined (_STLP_NO_FORCE_INSTANTIATE)
+template class time_get<char, istreambuf_iterator<char, char_traits<char> > >;
+template class time_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+
+# ifndef _STLP_NO_WCHAR_T
+template class time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+template class time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+# endif
+
+#endif
+
+_STLP_END_NAMESPACE
diff --git a/src/warning_disable.h b/src/warning_disable.h
new file mode 100644
index 0000000..7f0c1c8
--- /dev/null
+++ b/src/warning_disable.h
@@ -0,0 +1,61 @@
+#if !defined (__ICL)
+/* This header is used to turn off warnings of Microsoft compilers generated.
+ * while building STLport.
+ * For compiling user code, see stlport/config/_msvc_warnings_off.h.
+ */
+
+# if (_MSC_VER < 1300) /* VC6/eVC4 */
+# pragma warning( disable : 4097 ) /* typedef-name used as based class of (...) */
+# pragma warning( disable : 4251 ) /* DLL interface needed */
+# pragma warning( disable : 4284 ) /* for -> operator */
+# pragma warning( disable : 4503 ) /* decorated name length exceeded, name was truncated */
+# pragma warning( disable : 4514 ) /* unreferenced inline function has been removed */
+# pragma warning( disable : 4660 ) /* template-class specialization '...' is already instantiated */
+# pragma warning( disable : 4701 ) /* local variable 'base' may be used without having been initialized */
+# pragma warning( disable : 4710 ) /* function (...) not inlined */
+# pragma warning( disable : 4786 ) /* identifier truncated to 255 characters */
+# endif
+
+# if (_MSC_VER <= 1310)
+# pragma warning( disable : 4511 ) /* copy constructor cannot be generated */
+# endif
+
+# if (_MSC_VER < 1300) && defined (UNDER_CE)
+# pragma warning( disable : 4201 ) /* nonstandard extension used : nameless struct/union */
+# pragma warning( disable : 4214 ) /* nonstandard extension used : bit field types other than int */
+# endif
+
+/* Suppress warnings emitted from Windows CE SDK headers. */
+# if (_MSC_VER >= 1400) && defined (UNDER_CE)
+# pragma warning( disable : 4115 ) /* Named type definition in parentheses. */
+# pragma warning( disable : 4201 ) /* Nameless struct/union. */
+# pragma warning( disable : 4214 ) /* Bit field types other than int. */
+# pragma warning( disable : 4290 ) /* C++ exception specification ignored. */
+# pragma warning( disable : 4430 ) /* Missing type specifier, int assumed. */
+# pragma warning( disable : 4431 ) /* Missing type specifier, int assumed. */
+# endif
+
+# pragma warning( disable : 4075 ) /* initializers put in unrecognized initialization area */
+/* This warning is disable only for the c_locale_win32.c file compilation: */
+# pragma warning( disable : 4100 ) /* unreferenced formal parameter */
+# pragma warning( disable : 4127 ) /* conditional expression is constant */
+# pragma warning( disable : 4146 ) /* unary minus applied to unsigned type */
+# pragma warning( disable : 4245 ) /* conversion from 'enum ' to 'unsigned int', signed/unsigned mismatch */
+# pragma warning( disable : 4244 ) /* implicit conversion: possible loss of data */
+# pragma warning( disable : 4512 ) /* assignment operator could not be generated */
+# pragma warning( disable : 4571 ) /* catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions */
+# pragma warning( disable : 4702 ) /* unreachable code (appears in release with warning level4) */
+#else
+# pragma warning( disable : 69 ) /* integer conversion resulted in truncation */
+# pragma warning( disable : 174 ) /* expression has no effect */
+# pragma warning( disable : 279 ) /* controling expression is constant */
+# pragma warning( disable : 383 ) /* reference to temporary used */
+# pragma warning( disable : 444 ) /* destructor for base class "..." is not virtual*/
+# pragma warning( disable : 810 ) /* conversion from "int" to "char" may lose significant bits */
+# pragma warning( disable : 981 ) /* operands are evaluated in unspecified order */
+# pragma warning( disable : 1418 ) /* external definition with no prior declaration */
+# pragma warning( disable : 1419 ) /* external declaration in primary source file */
+# pragma warning( disable : 1572 ) /* floating-point equality and inequality comparisons are unreliable */
+# pragma warning( disable : 1682 ) /* implicit conversion of a 64-bit integral type to a smaller integral type */
+# pragma warning( disable : 1683 ) /* explicit conversion of a 64-bit integral type to a smaller integral type */
+#endif
diff --git a/sstream b/sstream
deleted file mode 100644
index e2b325e..0000000
--- a/sstream
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// This header defines classes basic_stringbuf, basic_istringstream,
-// basic_ostringstream, and basic_stringstream. These classes
-// represent streamsbufs and streams whose sources or destinations are
-// C++ strings.
-
-#ifndef _STLP_SSTREAM
-#define _STLP_SSTREAM
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x1059
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#include <stl/_ioserr.h>
-
-#include <stl/_sstream.h>
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x1059)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_SSTREAM */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stack b/stack
deleted file mode 100644
index d19106b..0000000
--- a/stack
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_STACK
-#define _STLP_STACK
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x60
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#ifndef _STLP_INTERNAL_STACK_H
-# include <stl/_stack.h>
-#endif
-
-#if defined (_STLP_IMPORT_VENDOR_STD)
-# include _STLP_NATIVE_HEADER(stack)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x60)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_STACK */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stdarg.h b/stdarg.h
deleted file mode 100644
index e8605cc..0000000
--- a/stdarg.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* Workaround for a "misbehaviour" when compiling resource scripts using
- * eMbedded Visual C++. The standard .rc file includes windows header files,
- * which in turn include stdarg.h, which results in warnings and errors
- */
-#if !defined (RC_INVOKED)
-
-# if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x261
-# include <stl/_prolog.h>
-# elif (_STLP_OUTERMOST_HEADER_ID == 0x261) && !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-# endif
-
-# if defined(_STLP_WCE_EVC3)
-struct _exception;
-# endif
-
-# include _STLP_NATIVE_C_HEADER(stdarg.h)
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x261)
-# if !defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-# endif
-#endif /* RC_INVOKED */
diff --git a/stddef.h b/stddef.h
deleted file mode 100644
index 01c449f..0000000
--- a/stddef.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x262
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x262) && ! defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-# if defined (_MSC_VER) || defined (__DMC__)
-/* Native stddef.h contains errno macro definition making inclusion of native
- * errno.h in STLport errno.h impossible. We are then forced to include errno.h
- * first.
- */
-# include "errno.h"
-# endif
-
-# include _STLP_NATIVE_C_HEADER(stddef.h)
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x262)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-#endif
-
diff --git a/stdexcept b/stdexcept
deleted file mode 100644
index b00331f..0000000
--- a/stdexcept
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_STDEXCEPT
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x63
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x63) && ! defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-# define _STLP_STDEXCEPT
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x63) || defined (_STLP_DONT_POP_HEADER_ID)
-# include _STLP_NATIVE_HEADER(stdexcept)
-#else
-# ifndef _STLP_INTERNAL_STDEXCEPT
-# include <stl/_stdexcept.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x63)
-# if !defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-#endif
-
-#endif /* _STLP_STDEXCEPT */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stdio.h b/stdio.h
deleted file mode 100644
index 271f37b..0000000
--- a/stdio.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* Workaround for a "misbehaviour" when compiling resource scripts using
- * eMbedded Visual C++. The standard .rc file includes windows header files,
- * which in turn include stdarg.h, which results in warnings and errors
- */
-#if !defined(RC_INVOKED)
-
-# ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x264
-# include <stl/_prolog.h>
-# elif (_STLP_OUTERMOST_HEADER_ID == 0x264) && !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-# endif
-
-# if defined(_STLP_WCE_EVC3)
-struct _exception;
-# endif
-# include _STLP_NATIVE_C_HEADER(stdio.h)
-
-# if defined (__SUNPRO_CC) && !defined (_STRUCT_FILE)
-# define _STRUCT_FILE
-# endif
-
-# if (defined (__MWERKS__) && !defined (N_PLAT_NLM)) || defined (__BORLANDC__)
-# undef stdin
-# undef stdout
-# undef stderr
-# if defined (__MWERKS__)
-# define stdin (&_STLP_VENDOR_CSTD::__files[0])
-# define stdout (&_STLP_VENDOR_CSTD::__files[1])
-# define stderr (&_STLP_VENDOR_CSTD::__files[2])
-# elif defined (__BORLANDC__)
-# define stdin (&_STLP_VENDOR_CSTD::_streams[0])
-# define stdout (&_STLP_VENDOR_CSTD::_streams[1])
-# define stderr (&_STLP_VENDOR_CSTD::_streams[2])
-# endif
-# endif
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x264)
-# if !defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-# endif
-
-#endif /* RC_INVOKED */
diff --git a/stdlib.h b/stdlib.h
deleted file mode 100644
index 3a415ee..0000000
--- a/stdlib.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* Workaround for a "misbehaviour" when compiling resource scripts using
- * eMbedded Visual C++. The standard .rc file includes windows header files,
- * which in turn include stdlib.h, which results in warnings and errors
- */
-#if !defined (RC_INVOKED)
-
-# if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x265
-# include <stl/_prolog.h>
-# elif (_STLP_OUTERMOST_HEADER_ID == 0x265) && !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-# endif
-
-# if defined (_MSC_VER) || (defined (__GNUC__) && defined (__MINGW32__)) || \
- defined (__BORLANDC__) || defined (__DMC__) || \
- (defined (__HP_aCC) && defined (_REENTRANT))
-/* Native stdlib.h contains errno macro definition making inclusion of native
- * errno.h in STLport errno.h impossible. We are then forced to include errno.h
- * first.
- */
-# include "errno.h"
-# endif
-
-/*
- forward-declaration for _exception struct; prevents warning message
- ../include/stdlib.h(817) : warning C4115: '_exception' : named type definition in parentheses
-*/
-# if defined(_STLP_WCE_EVC3)
-struct _exception;
-# endif
-
-# include _STLP_NATIVE_C_HEADER(stdlib.h)
-
-/* on evc3/evc4 including stdlib.h also defines setjmp macro */
-# if defined (_STLP_WCE)
-# define _STLP_NATIVE_SETJMP_H_INCLUDED
-# endif
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x265)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-# endif
-
-#endif /* RC_INVOKED */
-
-/*
- Local Variables:
- mode:C++
- End:
-*/
diff --git a/stl/_algo.c b/stl/_algo.c
deleted file mode 100644
index 79745ba..0000000
--- a/stl/_algo.c
+++ /dev/null
@@ -1,2012 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_ALGO_C
-#define _STLP_ALGO_C
-
-#if !defined (_STLP_INTERNAL_ALGO_H)
-# include <stl/_algo.h>
-#endif
-
-#ifndef _STLP_INTERNAL_TEMPBUF_H
-# include <stl/_tempbuf.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _BidirectionalIter, class _Distance, class _Compare>
-void __merge_without_buffer(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last,
- _Distance __len1, _Distance __len2,
- _Compare __comp);
-
-
-template <class _BidirectionalIter1, class _BidirectionalIter2,
- class _BidirectionalIter3, class _Compare>
-_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1,
- _BidirectionalIter1 __last1,
- _BidirectionalIter2 __first2,
- _BidirectionalIter2 __last2,
- _BidirectionalIter3 __result,
- _Compare __comp);
-
-template <class _Tp>
-#if !(defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x420 ))
-inline
-#endif
-const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) {
- if (__a < __b)
- if (__b < __c)
- return __b;
- else if (__a < __c)
- return __c;
- else
- return __a;
- else if (__a < __c)
- return __a;
- else if (__b < __c)
- return __c;
- else
- return __b;
-}
-
-template <class _Tp, class _Compare>
-#if !(defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x420 ))
-inline
-#endif
-const _Tp&
-__median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp) {
- if (__comp(__a, __b)) {
- _STLP_VERBOSE_ASSERT(!__comp(__b, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- if (__comp(__b, __c)) {
- _STLP_VERBOSE_ASSERT(!__comp(__c, __b), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- return __b;
- }
- else if (__comp(__a, __c)) {
- _STLP_VERBOSE_ASSERT(!__comp(__c, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- return __c;
- }
- else
- return __a;
- }
- else if (__comp(__a, __c)) {
- _STLP_VERBOSE_ASSERT(!__comp(__c, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- return __a;
- }
- else if (__comp(__b, __c)) {
- _STLP_VERBOSE_ASSERT(!__comp(__c, __b), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- return __c;
- }
- else
- return __b;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _ForwardIter1, class _ForwardIter2>
-_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
- // Test for empty ranges
- if (__first1 == __last1 || __first2 == __last2)
- return __first1;
-
- // Test for a pattern of length 1.
- _ForwardIter2 __p1(__first2);
-
- if ( ++__p1 == __last2 )
- return find(__first1, __last1, *__first2);
-
- // General case.
-
- for ( ; ; ) { // __first1 != __last1 will be checked in find below
- __first1 = find(__first1, __last1, *__first2);
- if (__first1 == __last1)
- return __last1;
-
- _ForwardIter2 __p = __p1;
- _ForwardIter1 __current = __first1;
- if (++__current == __last1)
- return __last1;
-
- while (*__current == *__p) {
- if (++__p == __last2)
- return __first1;
- if (++__current == __last1)
- return __last1;
- }
-
- ++__first1;
- }
- return __first1;
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _RandomAccessIter, class _Integer, class _Tp,
- class _BinaryPred, class _Distance>
-_RandomAccessIter __search_n(_RandomAccessIter __first, _RandomAccessIter __last,
- _Integer __count, const _Tp& __val, _BinaryPred __pred,
- _Distance*, const random_access_iterator_tag &)
-{
- _Distance __tailSize = __last - __first;
- const _Distance __pattSize = __count;
- const _Distance __skipOffset = __pattSize - 1;
- _RandomAccessIter __backTrack;
- _Distance __remainder, __prevRemainder;
-
- for ( _RandomAccessIter __lookAhead = __first + __skipOffset; __tailSize >= __pattSize; __lookAhead += __pattSize ) { // the main loop...
- //__lookAhead here is always pointing to the last element of next possible match.
- __tailSize -= __pattSize;
-
- while ( !__pred(*__lookAhead, __val) ) { // the skip loop...
- if (__tailSize < __pattSize)
- return __last;
-
- __lookAhead += __pattSize;
- __tailSize -= __pattSize;
- }
-
- if ( __skipOffset == 0 ) {
- return (__lookAhead - __skipOffset); //Success
- }
-
- __remainder = __skipOffset;
-
- for (__backTrack = __lookAhead; __pred(*--__backTrack, __val); ) {
- if (--__remainder == 0)
- return (__lookAhead - __skipOffset); //Success
- }
-
- if (__remainder > __tailSize)
- return __last; //failure
-
- __lookAhead += __remainder;
- __tailSize -= __remainder;
-
- while ( __pred(*__lookAhead, __val) ) {
- __prevRemainder = __remainder;
- __backTrack = __lookAhead;
-
- do {
- if (--__remainder == 0)
- return (__lookAhead - __skipOffset); //Success
- } while (__pred(*--__backTrack, __val));
-
- //adjust remainder for next comparison
- __remainder += __pattSize - __prevRemainder;
-
- if (__remainder > __tailSize)
- return __last; //failure
-
- __lookAhead += __remainder;
- __tailSize -= __remainder;
- }
-
- //__lookAhead here is always pointing to the element of the last mismatch.
- }
-
- return __last; //failure
-}
-
-template <class _ForwardIter, class _Integer, class _Tp,
- class _Distance, class _BinaryPred>
-_ForwardIter __search_n(_ForwardIter __first, _ForwardIter __last,
- _Integer __count, const _Tp& __val, _BinaryPred __pred,
- _Distance*, const forward_iterator_tag &) {
- for (; (__first != __last) && !__pred(*__first, __val); ++__first) {}
- while (__first != __last) {
- _Integer __n = __count - 1;
- _ForwardIter __i = __first;
- ++__i;
- while (__i != __last && __n != 0 && __pred(*__i, __val)) {
- ++__i;
- --__n;
- }
- if (__n == 0)
- return __first;
- else if (__i != __last)
- for (__first = ++__i; (__first != __last) && !__pred(*__first, __val); ++__first) {}
- else
- break;
- }
- return __last;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-// search_n. Search for __count consecutive copies of __val.
-template <class _ForwardIter, class _Integer, class _Tp>
-_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
- _Integer __count, const _Tp& __val) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__count <= 0)
- return __first;
- if (__count == 1)
- //We use find when __count == 1 to use potential find overload.
- return find(__first, __last, __val);
- return _STLP_PRIV __search_n(__first, __last, __count, __val, equal_to<_Tp>(),
- _STLP_DISTANCE_TYPE(__first, _ForwardIter),
- _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
-}
-
-template <class _ForwardIter, class _Integer, class _Tp, class _BinaryPred>
-_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
- _Integer __count, const _Tp& __val,
- _BinaryPred __binary_pred) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__count <= 0)
- return __first;
- return _STLP_PRIV __search_n(__first, __last, __count, __val, __binary_pred,
- _STLP_DISTANCE_TYPE(__first, _ForwardIter),
- _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
-}
-
-template <class _ForwardIter1, class _ForwardIter2>
-_ForwardIter1
-find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
- return _STLP_PRIV __find_end(__first1, __last1, __first2, __last2,
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
- _STLP_ITERATOR_CATEGORY(__first1, _ForwardIter1),
- _STLP_ITERATOR_CATEGORY(__first2, _ForwardIter2),
-#else
- forward_iterator_tag(),
- forward_iterator_tag(),
-#endif
- _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _ForwardIter1))
- );
-}
-
-// unique and unique_copy
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIterator, class _OutputIterator, class _BinaryPredicate,
- class _Tp>
-_STLP_INLINE_LOOP _OutputIterator
-__unique_copy(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result,
- _BinaryPredicate __binary_pred, _Tp*) {
- _Tp __val = *__first;
- *__result = __val;
- while (++__first != __last)
- if (!__binary_pred(__val, *__first)) {
- __val = *__first;
- *++__result = __val;
- }
- return ++__result;
-}
-
-template <class _InputIter, class _OutputIter, class _BinaryPredicate>
-inline _OutputIter
-__unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
- _BinaryPredicate __binary_pred, const output_iterator_tag &) {
- return __unique_copy(__first, __last, __result, __binary_pred, _STLP_VALUE_TYPE(__first, _InputIter));
-}
-
-template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
-_STLP_INLINE_LOOP _ForwardIter
-__unique_copy(_InputIter __first, _InputIter __last, _ForwardIter __result,
- _BinaryPredicate __binary_pred, const forward_iterator_tag &) {
- *__result = *__first;
- while (++__first != __last)
- if (!__binary_pred(*__result, *__first)) *++__result = *__first;
- return ++__result;
-}
-
-#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
-template <class _InputIterator, class _BidirectionalIterator, class _BinaryPredicate>
-inline _BidirectionalIterator
-__unique_copy(_InputIterator __first, _InputIterator __last,
- _BidirectionalIterator __result, _BinaryPredicate __binary_pred,
- const bidirectional_iterator_tag &) {
- return __unique_copy(__first, __last, __result, __binary_pred, forward_iterator_tag());
-}
-
-template <class _InputIterator, class _RandomAccessIterator, class _BinaryPredicate>
-inline _RandomAccessIterator
-__unique_copy(_InputIterator __first, _InputIterator __last,
- _RandomAccessIterator __result, _BinaryPredicate __binary_pred,
- const random_access_iterator_tag &) {
- return __unique_copy(__first, __last, __result, __binary_pred, forward_iterator_tag());
-}
-#endif /* _STLP_NONTEMPL_BASE_MATCH_BUG */
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter, class _OutputIter>
-_OutputIter
-unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__first == __last) return __result;
- return _STLP_PRIV __unique_copy(__first, __last, __result,
- _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _InputIter)),
- _STLP_ITERATOR_CATEGORY(__result, _OutputIter));
-}
-
-template <class _InputIter, class _OutputIter, class _BinaryPredicate>
-_OutputIter
-unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
- _BinaryPredicate __binary_pred) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__first == __last) return __result;
- return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred,
- _STLP_ITERATOR_CATEGORY(__result, _OutputIter));
-}
-
-// rotate and rotate_copy, and their auxiliary functions
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _ForwardIter, class _Distance>
-_ForwardIter __rotate_aux(_ForwardIter __first,
- _ForwardIter __middle,
- _ForwardIter __last,
- _Distance*,
- const forward_iterator_tag &) {
- if (__first == __middle)
- return __last;
- if (__last == __middle)
- return __first;
-
- _ForwardIter __first2 = __middle;
- do {
- swap(*__first++, *__first2++);
- if (__first == __middle)
- __middle = __first2;
- } while (__first2 != __last);
-
- _ForwardIter __new_middle = __first;
-
- __first2 = __middle;
-
- while (__first2 != __last) {
- swap (*__first++, *__first2++);
- if (__first == __middle)
- __middle = __first2;
- else if (__first2 == __last)
- __first2 = __middle;
- }
-
- return __new_middle;
-}
-
-template <class _BidirectionalIter, class _Distance>
-_BidirectionalIter __rotate_aux(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last,
- _Distance*,
- const bidirectional_iterator_tag &) {
- if (__first == __middle)
- return __last;
- if (__last == __middle)
- return __first;
-
- __reverse(__first, __middle, bidirectional_iterator_tag());
- __reverse(__middle, __last, bidirectional_iterator_tag());
-
- while (__first != __middle && __middle != __last)
- swap (*__first++, *--__last);
-
- if (__first == __middle) {
- __reverse(__middle, __last, bidirectional_iterator_tag());
- return __last;
- }
- else {
- __reverse(__first, __middle, bidirectional_iterator_tag());
- return __first;
- }
-}
-
-template <class _RandomAccessIter, class _Distance, class _Tp>
-_RandomAccessIter __rotate_aux(_RandomAccessIter __first,
- _RandomAccessIter __middle,
- _RandomAccessIter __last,
- _Distance *, _Tp *) {
-
- _Distance __n = __last - __first;
- _Distance __k = __middle - __first;
- _Distance __l = __n - __k;
- _RandomAccessIter __result = __first + (__last - __middle);
-
- if (__k == 0) /* __first == middle */
- return __last;
-
- if (__k == __l) {
- swap_ranges(__first, __middle, __middle);
- return __result;
- }
-
- _Distance __d = __gcd(__n, __k);
-
- for (_Distance __i = 0; __i < __d; __i++) {
- _Tp __tmp = *__first;
- _RandomAccessIter __p = __first;
-
- if (__k < __l) {
- for (_Distance __j = 0; __j < __l/__d; __j++) {
- if (__p > __first + __l) {
- *__p = *(__p - __l);
- __p -= __l;
- }
-
- *__p = *(__p + __k);
- __p += __k;
- }
- }
-
- else {
- for (_Distance __j = 0; __j < __k/__d - 1; __j ++) {
- if (__p < __last - __k) {
- *__p = *(__p + __k);
- __p += __k;
- }
-
- *__p = * (__p - __l);
- __p -= __l;
- }
- }
-
- *__p = __tmp;
- ++__first;
- }
-
- return __result;
-}
-
-template <class _RandomAccessIter, class _Distance>
-inline _RandomAccessIter
-__rotate_aux(_RandomAccessIter __first, _RandomAccessIter __middle, _RandomAccessIter __last,
- _Distance * __dis, const random_access_iterator_tag &) {
- return __rotate_aux(__first, __middle, __last,
- __dis, _STLP_VALUE_TYPE(__first, _RandomAccessIter));
-}
-
-template <class _ForwardIter>
-_ForwardIter
-__rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last) {
- _STLP_DEBUG_CHECK(__check_range(__first, __middle))
- _STLP_DEBUG_CHECK(__check_range(__middle, __last))
- return __rotate_aux(__first, __middle, __last,
- _STLP_DISTANCE_TYPE(__first, _ForwardIter),
- _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _ForwardIter>
-void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last) {
- _STLP_PRIV __rotate(__first, __middle, __last);
-}
-
-// Return a random number in the range [0, __n). This function encapsulates
-// whether we're using rand (part of the standard C library) or lrand48
-// (not standard, but a much better choice whenever it's available).
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Distance>
-inline _Distance __random_number(_Distance __n) {
-#ifdef _STLP_NO_DRAND48
- return rand() % __n;
-#else
- return lrand48() % __n;
-#endif
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _RandomAccessIter>
-void random_shuffle(_RandomAccessIter __first,
- _RandomAccessIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__first == __last) return;
- for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
- iter_swap(__i, __first + _STLP_PRIV __random_number((__i - __first) + 1));
-}
-
-template <class _RandomAccessIter, class _RandomNumberGenerator>
-void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last,
- _RandomNumberGenerator &__rand) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__first == __last) return;
- for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
- iter_swap(__i, __first + __rand((__i - __first) + 1));
-}
-
-#if !defined (_STLP_NO_EXTENSIONS)
-// random_sample and random_sample_n (extensions, not part of the standard).
-template <class _ForwardIter, class _OutputIter, class _Distance>
-_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
- _OutputIter __out_ite, const _Distance __n) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _Distance __remaining = distance(__first, __last);
- _Distance __m = (min) (__n, __remaining);
-
- while (__m > 0) {
- if (_STLP_PRIV __random_number(__remaining) < __m) {
- *__out_ite = *__first;
- ++__out_ite;
- --__m;
- }
-
- --__remaining;
- ++__first;
- }
- return __out_ite;
-}
-
-
-template <class _ForwardIter, class _OutputIter, class _Distance,
- class _RandomNumberGenerator>
-_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
- _OutputIter __out_ite, const _Distance __n,
- _RandomNumberGenerator& __rand) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _Distance __remaining = distance(__first, __last);
- _Distance __m = (min) (__n, __remaining);
-
- while (__m > 0) {
- if (__rand(__remaining) < __m) {
- *__out_ite = *__first;
- ++__out_ite;
- --__m;
- }
-
- --__remaining;
- ++__first;
- }
- return __out_ite;
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter, class _RandomAccessIter, class _Distance>
-_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last,
- _RandomAccessIter __out_ite,
- const _Distance __n) {
- _Distance __m = 0;
- _Distance __t = __n;
- for ( ; __first != __last && __m < __n; ++__m, ++__first)
- __out_ite[__m] = *__first;
-
- while (__first != __last) {
- ++__t;
- _Distance __M = __random_number(__t);
- if (__M < __n)
- __out_ite[__M] = *__first;
- ++__first;
- }
-
- return __out_ite + __m;
-}
-
-template <class _InputIter, class _RandomAccessIter,
- class _RandomNumberGenerator, class _Distance>
-_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last,
- _RandomAccessIter __out_ite,
- _RandomNumberGenerator& __rand,
- const _Distance __n) {
- _Distance __m = 0;
- _Distance __t = __n;
- for ( ; __first != __last && __m < __n; ++__m, ++__first)
- __out_ite[__m] = *__first;
-
- while (__first != __last) {
- ++__t;
- _Distance __M = __rand(__t);
- if (__M < __n)
- __out_ite[__M] = *__first;
- ++__first;
- }
-
- return __out_ite + __m;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter, class _RandomAccessIter>
-_RandomAccessIter
-random_sample(_InputIter __first, _InputIter __last,
- _RandomAccessIter __out_first, _RandomAccessIter __out_last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__out_first, __out_last))
- return _STLP_PRIV __random_sample(__first, __last,
- __out_first, __out_last - __out_first);
-}
-
-template <class _InputIter, class _RandomAccessIter, class _RandomNumberGenerator>
-_RandomAccessIter
-random_sample(_InputIter __first, _InputIter __last,
- _RandomAccessIter __out_first, _RandomAccessIter __out_last,
- _RandomNumberGenerator& __rand) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__out_first, __out_last))
- return _STLP_PRIV __random_sample(__first, __last,
- __out_first, __rand,
- __out_last - __out_first);
-}
-
-#endif /* _STLP_NO_EXTENSIONS */
-
-// partition, stable_partition, and their auxiliary functions
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _ForwardIter, class _Predicate>
-_STLP_INLINE_LOOP _ForwardIter __partition(_ForwardIter __first,
- _ForwardIter __last,
- _Predicate __pred,
- const forward_iterator_tag &) {
- if (__first == __last) return __first;
-
- while (__pred(*__first))
- if (++__first == __last) return __first;
-
- _ForwardIter __next = __first;
-
- while (++__next != __last) {
- if (__pred(*__next)) {
- swap(*__first, *__next);
- ++__first;
- }
- }
- return __first;
-}
-
-template <class _BidirectionalIter, class _Predicate>
-_STLP_INLINE_LOOP _BidirectionalIter __partition(_BidirectionalIter __first,
- _BidirectionalIter __last,
- _Predicate __pred,
- const bidirectional_iterator_tag &) {
- for (;;) {
- for (;;) {
- if (__first == __last)
- return __first;
- else if (__pred(*__first))
- ++__first;
- else
- break;
- }
- --__last;
- for (;;) {
- if (__first == __last)
- return __first;
- else if (!__pred(*__last))
- --__last;
- else
- break;
- }
- iter_swap(__first, __last);
- ++__first;
- }
-}
-
-#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
-template <class _BidirectionalIter, class _Predicate>
-inline
-_BidirectionalIter __partition(_BidirectionalIter __first,
- _BidirectionalIter __last,
- _Predicate __pred,
- const random_access_iterator_tag &) {
- return __partition(__first, __last, __pred, bidirectional_iterator_tag());
-}
-#endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _ForwardIter, class _Predicate>
-_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __partition(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
-}
-
-
-/* __pred_of_first: false if we know that __pred(*__first) is false,
- * true when we don't know the result of __pred(*__first).
- * __not_pred_of_before_last: true if we know that __pred(*--__last) is true,
- * false when we don't know the result of __pred(*--__last).
- */
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _ForwardIter, class _Predicate, class _Distance>
-_ForwardIter __inplace_stable_partition(_ForwardIter __first,
- _ForwardIter __last,
- _Predicate __pred, _Distance __len,
- bool __pred_of_first, bool __pred_of_before_last) {
- if (__len == 1)
- return (__pred_of_first && (__pred_of_before_last || __pred(*__first))) ? __last : __first;
- _ForwardIter __middle = __first;
- _Distance __half_len = __len / 2;
- advance(__middle, __half_len);
- return __rotate(__inplace_stable_partition(__first, __middle, __pred, __half_len, __pred_of_first, false),
- __middle,
- __inplace_stable_partition(__middle, __last, __pred, __len - __half_len, true, __pred_of_before_last));
-}
-
-template <class _ForwardIter, class _Pointer, class _Predicate,
- class _Distance>
-_ForwardIter __stable_partition_adaptive(_ForwardIter __first,
- _ForwardIter __last,
- _Predicate __pred, _Distance __len,
- _Pointer __buffer, _Distance __buffer_size,
- bool __pred_of_first, bool __pred_of_before_last) {
- if (__len <= __buffer_size) {
- _ForwardIter __result1 = __first;
- _Pointer __result2 = __buffer;
- if ((__first != __last) && (!__pred_of_first || __pred(*__first))) {
- *__result2 = *__first;
- ++__result2; ++__first; --__len;
- }
- for (; __first != __last ; ++__first, --__len) {
- if (((__len == 1) && (__pred_of_before_last || __pred(*__first))) ||
- ((__len != 1) && __pred(*__first))){
- *__result1 = *__first;
- ++__result1;
- }
- else {
- *__result2 = *__first;
- ++__result2;
- }
- }
- copy(__buffer, __result2, __result1);
- return __result1;
- }
- else {
- _ForwardIter __middle = __first;
- _Distance __half_len = __len / 2;
- advance(__middle, __half_len);
- return __rotate(__stable_partition_adaptive(
- __first, __middle, __pred,
- __half_len, __buffer, __buffer_size,
- __pred_of_first, false),
- __middle,
- __stable_partition_adaptive(
- __middle, __last, __pred,
- __len - __half_len, __buffer, __buffer_size,
- true, __pred_of_before_last));
- }
-}
-
-template <class _ForwardIter, class _Predicate, class _Tp, class _Distance>
-inline _ForwardIter
-__stable_partition_aux_aux(_ForwardIter __first, _ForwardIter __last,
- _Predicate __pred, _Tp*, _Distance*, bool __pred_of_before_last = false) {
- _Temporary_buffer<_ForwardIter, _Tp> __buf(__first, __last);
- _STLP_MPWFIX_TRY //*TY 06/01/2000 - they forget to call dtor for _Temporary_buffer if no try/catch block is present
- return (__buf.size() > 0) ?
- __stable_partition_adaptive(__first, __last, __pred,
- _Distance(__buf.requested_size()),
- __buf.begin(), __buf.size(),
- false, __pred_of_before_last) :
- __inplace_stable_partition(__first, __last, __pred,
- _Distance(__buf.requested_size()),
- false, __pred_of_before_last);
- _STLP_MPWFIX_CATCH //*TY 06/01/2000 - they forget to call dtor for _Temporary_buffer if no try/catch block is present
-}
-
-template <class _ForwardIter, class _Predicate>
-_ForwardIter
-__stable_partition_aux(_ForwardIter __first, _ForwardIter __last, _Predicate __pred,
- const forward_iterator_tag &) {
- return __stable_partition_aux_aux(__first, __last, __pred,
- _STLP_VALUE_TYPE(__first, _ForwardIter),
- _STLP_DISTANCE_TYPE(__first, _ForwardIter));
-}
-
-template <class _BidirectIter, class _Predicate>
-_BidirectIter
-__stable_partition_aux(_BidirectIter __first, _BidirectIter __last, _Predicate __pred,
- const bidirectional_iterator_tag &) {
- for (--__last;;) {
- if (__first == __last)
- return __first;
- else if (!__pred(*__last))
- --__last;
- else
- break;
- }
- ++__last;
- //Here we know that __pred(*--__last) is true
- return __stable_partition_aux_aux(__first, __last, __pred,
- _STLP_VALUE_TYPE(__first, _BidirectIter),
- _STLP_DISTANCE_TYPE(__first, _BidirectIter), true);
-}
-
-#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
-template <class _BidirectIter, class _Predicate>
-_BidirectIter
-__stable_partition_aux(_BidirectIter __first, _BidirectIter __last, _Predicate __pred,
- const random_access_iterator_tag &) {
- return __stable_partition_aux(__first, __last, __pred, bidirectional_iterator_tag());
-}
-#endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _ForwardIter, class _Predicate>
-_ForwardIter
-stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- for (;;) {
- if (__first == __last)
- return __first;
- else if (__pred(*__first))
- ++__first;
- else
- break;
- }
- return _STLP_PRIV __stable_partition_aux(__first, __last, __pred,
- _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-_RandomAccessIter __unguarded_partition(_RandomAccessIter __first,
- _RandomAccessIter __last,
- _Tp __pivot, _Compare __comp) {
- for (;;) {
- while (__comp(*__first, __pivot)) {
- _STLP_VERBOSE_ASSERT(!__comp(__pivot, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- ++__first;
- }
- --__last;
- while (__comp(__pivot, *__last)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__last, __pivot), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- --__last;
- }
- if (!(__first < __last))
- return __first;
- iter_swap(__first, __last);
- ++__first;
- }
-}
-
-// sort() and its auxiliary functions.
-#define __stl_threshold 16
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val,
- _Compare __comp) {
- _RandomAccessIter __next = __last;
- --__next;
- while (__comp(__val, *__next)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__next, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- *__last = *__next;
- __last = __next;
- --__next;
- }
- *__last = __val;
-}
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-inline void __linear_insert(_RandomAccessIter __first,
- _RandomAccessIter __last, _Tp __val, _Compare __comp) {
- //*TY 12/26/1998 - added __val as a paramter
- // _Tp __val = *__last; //*TY 12/26/1998 - __val supplied by caller
- if (__comp(__val, *__first)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- copy_backward(__first, __last, __last + 1);
- *__first = __val;
- }
- else
- __unguarded_linear_insert(__last, __val, __comp);
-}
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-void __insertion_sort(_RandomAccessIter __first,
- _RandomAccessIter __last,
- _Tp *, _Compare __comp) {
- if (__first == __last) return;
- for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
- __linear_insert<_RandomAccessIter, _Tp, _Compare>(__first, __i, *__i, __comp); //*TY 12/26/1998 - supply *__i as __val
-}
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-void __unguarded_insertion_sort_aux(_RandomAccessIter __first,
- _RandomAccessIter __last,
- _Tp*, _Compare __comp) {
- for (_RandomAccessIter __i = __first; __i != __last; ++__i)
- __unguarded_linear_insert<_RandomAccessIter, _Tp, _Compare>(__i, *__i, __comp);
-}
-
-template <class _RandomAccessIter, class _Compare>
-inline void __unguarded_insertion_sort(_RandomAccessIter __first,
- _RandomAccessIter __last,
- _Compare __comp) {
- __unguarded_insertion_sort_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp);
-}
-
-template <class _RandomAccessIter, class _Compare>
-void __final_insertion_sort(_RandomAccessIter __first,
- _RandomAccessIter __last, _Compare __comp) {
- if (__last - __first > __stl_threshold) {
- __insertion_sort(__first, __first + __stl_threshold, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
- __unguarded_insertion_sort(__first + __stl_threshold, __last, __comp);
- }
- else
- __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
-}
-
-template <class _RandomAccessIter, class _Tp, class _Size, class _Compare>
-void __introsort_loop(_RandomAccessIter __first,
- _RandomAccessIter __last, _Tp*,
- _Size __depth_limit, _Compare __comp) {
- while (__last - __first > __stl_threshold) {
- if (__depth_limit == 0) {
- partial_sort(__first, __last, __last, __comp);
- return;
- }
- --__depth_limit;
- _RandomAccessIter __cut =
- __unguarded_partition(__first, __last,
- _Tp(__median(*__first,
- *(__first + (__last - __first)/2),
- *(__last - 1), __comp)),
- __comp);
- __introsort_loop(__cut, __last, (_Tp*) 0, __depth_limit, __comp);
- __last = __cut;
- }
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _RandomAccessIter>
-void sort(_RandomAccessIter __first, _RandomAccessIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__first != __last) {
- _STLP_PRIV __introsort_loop(__first, __last,
- _STLP_VALUE_TYPE(__first, _RandomAccessIter),
- _STLP_PRIV __lg(__last - __first) * 2,
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
- _STLP_PRIV __final_insertion_sort(__first, __last,
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
- }
-}
-
-template <class _RandomAccessIter, class _Compare>
-void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__first != __last) {
- _STLP_PRIV __introsort_loop(__first, __last,
- _STLP_VALUE_TYPE(__first, _RandomAccessIter),
- _STLP_PRIV __lg(__last - __first) * 2, __comp);
- _STLP_PRIV __final_insertion_sort(__first, __last, __comp);
- }
-}
-
-// stable_sort() and its auxiliary functions.
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _RandomAccessIter, class _Compare>
-void __inplace_stable_sort(_RandomAccessIter __first,
- _RandomAccessIter __last, _Compare __comp) {
- if (__last - __first < 15) {
- __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
- return;
- }
- _RandomAccessIter __middle = __first + (__last - __first) / 2;
- __inplace_stable_sort(__first, __middle, __comp);
- __inplace_stable_sort(__middle, __last, __comp);
- __merge_without_buffer(__first, __middle, __last,
- __middle - __first,
- __last - __middle,
- __comp);
-}
-
-template <class _RandomAccessIter1, class _RandomAccessIter2,
- class _Distance, class _Compare>
-void __merge_sort_loop(_RandomAccessIter1 __first,
- _RandomAccessIter1 __last,
- _RandomAccessIter2 __result, _Distance __step_size,
- _Compare __comp) {
- _Distance __two_step = 2 * __step_size;
-
- while (__last - __first >= __two_step) {
- __result = merge(__first, __first + __step_size,
- __first + __step_size, __first + __two_step,
- __result,
- __comp);
- __first += __two_step;
- }
- __step_size = (min) (_Distance(__last - __first), __step_size);
-
- merge(__first, __first + __step_size,
- __first + __step_size, __last,
- __result,
- __comp);
-}
-
-const int __stl_chunk_size = 7;
-
-template <class _RandomAccessIter, class _Distance, class _Compare>
-void __chunk_insertion_sort(_RandomAccessIter __first,
- _RandomAccessIter __last,
- _Distance __chunk_size, _Compare __comp) {
- while (__last - __first >= __chunk_size) {
- __insertion_sort(__first, __first + __chunk_size,
- _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
- __first += __chunk_size;
- }
- __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
-}
-
-template <class _RandomAccessIter, class _Pointer, class _Distance,
- class _Compare>
-void __merge_sort_with_buffer(_RandomAccessIter __first,
- _RandomAccessIter __last, _Pointer __buffer,
- _Distance*, _Compare __comp) {
- _Distance __len = __last - __first;
- _Pointer __buffer_last = __buffer + __len;
-
- _Distance __step_size = __stl_chunk_size;
- __chunk_insertion_sort(__first, __last, __step_size, __comp);
-
- while (__step_size < __len) {
- __merge_sort_loop(__first, __last, __buffer, __step_size, __comp);
- __step_size *= 2;
- __merge_sort_loop(__buffer, __buffer_last, __first, __step_size, __comp);
- __step_size *= 2;
- }
-}
-
-template <class _BidirectionalIter1, class _BidirectionalIter2,
- class _Distance>
-_BidirectionalIter1 __rotate_adaptive(_BidirectionalIter1 __first,
- _BidirectionalIter1 __middle,
- _BidirectionalIter1 __last,
- _Distance __len1, _Distance __len2,
- _BidirectionalIter2 __buffer,
- _Distance __buffer_size) {
- if (__len1 > __len2 && __len2 <= __buffer_size) {
- _BidirectionalIter2 __buffer_end = copy(__middle, __last, __buffer);
- copy_backward(__first, __middle, __last);
- return copy(__buffer, __buffer_end, __first);
- }
- else if (__len1 <= __buffer_size) {
- _BidirectionalIter2 __buffer_end = copy(__first, __middle, __buffer);
- copy(__middle, __last, __first);
- return copy_backward(__buffer, __buffer_end, __last);
- }
- else
- return __rotate(__first, __middle, __last);
-}
-
-template <class _BidirectionalIter, class _Distance, class _Pointer,
- class _Compare>
-void __merge_adaptive(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last,
- _Distance __len1, _Distance __len2,
- _Pointer __buffer, _Distance __buffer_size,
- _Compare __comp) {
- if (__len1 <= __len2 && __len1 <= __buffer_size) {
- _Pointer __buffer_end = copy(__first, __middle, __buffer);
- merge(__buffer, __buffer_end, __middle, __last, __first, __comp);
- }
- else if (__len2 <= __buffer_size) {
- _Pointer __buffer_end = copy(__middle, __last, __buffer);
- __merge_backward(__first, __middle, __buffer, __buffer_end, __last,
- __comp);
- }
- else {
- _BidirectionalIter __first_cut = __first;
- _BidirectionalIter __second_cut = __middle;
- _Distance __len11 = 0;
- _Distance __len22 = 0;
- if (__len1 > __len2) {
- __len11 = __len1 / 2;
- advance(__first_cut, __len11);
- __second_cut = lower_bound(__middle, __last, *__first_cut, __comp);
- __len22 += distance(__middle, __second_cut);
- }
- else {
- __len22 = __len2 / 2;
- advance(__second_cut, __len22);
- __first_cut = upper_bound(__first, __middle, *__second_cut, __comp);
- __len11 += distance(__first, __first_cut);
- }
- _BidirectionalIter __new_middle =
- __rotate_adaptive(__first_cut, __middle, __second_cut, __len1 - __len11,
- __len22, __buffer, __buffer_size);
- __merge_adaptive(__first, __first_cut, __new_middle, __len11,
- __len22, __buffer, __buffer_size, __comp);
- __merge_adaptive(__new_middle, __second_cut, __last, __len1 - __len11,
- __len2 - __len22, __buffer, __buffer_size, __comp);
- }
-}
-
-template <class _RandomAccessIter, class _Pointer, class _Distance,
- class _Compare>
-void __stable_sort_adaptive(_RandomAccessIter __first,
- _RandomAccessIter __last, _Pointer __buffer,
- _Distance __buffer_size, _Compare __comp) {
- _Distance __len = (__last - __first + 1) / 2;
- _RandomAccessIter __middle = __first + __len;
- if (__len > __buffer_size) {
- __stable_sort_adaptive(__first, __middle, __buffer, __buffer_size,
- __comp);
- __stable_sort_adaptive(__middle, __last, __buffer, __buffer_size,
- __comp);
- }
- else {
- __merge_sort_with_buffer(__first, __middle, __buffer, (_Distance*)0,
- __comp);
- __merge_sort_with_buffer(__middle, __last, __buffer, (_Distance*)0,
- __comp);
- }
- __merge_adaptive(__first, __middle, __last, _Distance(__middle - __first),
- _Distance(__last - __middle), __buffer, __buffer_size,
- __comp);
-}
-
-template <class _RandomAccessIter, class _Tp, class _Distance, class _Compare>
-void __stable_sort_aux(_RandomAccessIter __first,
- _RandomAccessIter __last, _Tp*, _Distance*,
- _Compare __comp) {
- _Temporary_buffer<_RandomAccessIter, _Tp> buf(__first, __last);
- if (buf.begin() == 0)
- __inplace_stable_sort(__first, __last, __comp);
- else
- __stable_sort_adaptive(__first, __last, buf.begin(),
- _Distance(buf.size()),
- __comp);
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _RandomAccessIter>
-void stable_sort(_RandomAccessIter __first,
- _RandomAccessIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _STLP_PRIV __stable_sort_aux(__first, __last,
- _STLP_VALUE_TYPE(__first, _RandomAccessIter),
- _STLP_DISTANCE_TYPE(__first, _RandomAccessIter),
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
-}
-
-template <class _RandomAccessIter, class _Compare>
-void stable_sort(_RandomAccessIter __first,
- _RandomAccessIter __last, _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _STLP_PRIV __stable_sort_aux(__first, __last,
- _STLP_VALUE_TYPE(__first, _RandomAccessIter),
- _STLP_DISTANCE_TYPE(__first, _RandomAccessIter),
- __comp);
-}
-
-// partial_sort, partial_sort_copy, and auxiliary functions.
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-void __partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle,
- _RandomAccessIter __last, _Tp*, _Compare __comp) {
- make_heap(__first, __middle, __comp);
- for (_RandomAccessIter __i = __middle; __i < __last; ++__i) {
- if (__comp(*__i, *__first)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first, *__i), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- __pop_heap(__first, __middle, __i, _Tp(*__i), __comp,
- _STLP_DISTANCE_TYPE(__first, _RandomAccessIter));
- }
- }
- sort_heap(__first, __middle, __comp);
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _RandomAccessIter>
-void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
- _RandomAccessIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
- _STLP_PRIV __partial_sort(__first, __middle, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter),
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
-}
-
-template <class _RandomAccessIter, class _Compare>
-void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
- _RandomAccessIter __last, _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
- _STLP_PRIV __partial_sort(__first, __middle, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp);
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter, class _RandomAccessIter, class _Compare,
- class _Distance, class _Tp>
-_RandomAccessIter __partial_sort_copy(_InputIter __first,
- _InputIter __last,
- _RandomAccessIter __result_first,
- _RandomAccessIter __result_last,
- _Compare __comp, _Distance*, _Tp*) {
- if (__result_first == __result_last) return __result_last;
- _RandomAccessIter __result_real_last = __result_first;
- while(__first != __last && __result_real_last != __result_last) {
- *__result_real_last = *__first;
- ++__result_real_last;
- ++__first;
- }
- make_heap(__result_first, __result_real_last, __comp);
- while (__first != __last) {
- if (__comp(*__first, *__result_first)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__result_first, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- __adjust_heap(__result_first, _Distance(0),
- _Distance(__result_real_last - __result_first),
- _Tp(*__first),
- __comp);
- }
- ++__first;
- }
- sort_heap(__result_first, __result_real_last, __comp);
- return __result_real_last;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter, class _RandomAccessIter>
-_RandomAccessIter
-partial_sort_copy(_InputIter __first, _InputIter __last,
- _RandomAccessIter __result_first, _RandomAccessIter __result_last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__result_first, __result_last))
- return _STLP_PRIV __partial_sort_copy(__first, __last, __result_first, __result_last,
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _InputIter)),
- _STLP_DISTANCE_TYPE(__result_first, _RandomAccessIter),
- _STLP_VALUE_TYPE(__first, _InputIter));
-}
-
-template <class _InputIter, class _RandomAccessIter, class _Compare>
-_RandomAccessIter
-partial_sort_copy(_InputIter __first, _InputIter __last,
- _RandomAccessIter __result_first,
- _RandomAccessIter __result_last, _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__result_first, __result_last))
- return _STLP_PRIV __partial_sort_copy(__first, __last, __result_first, __result_last,
- __comp,
- _STLP_DISTANCE_TYPE(__result_first, _RandomAccessIter),
- _STLP_VALUE_TYPE(__first, _InputIter));
-}
-
-// nth_element() and its auxiliary functions.
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
- _RandomAccessIter __last, _Tp*, _Compare __comp) {
- while (__last - __first > 3) {
- _RandomAccessIter __cut =
- __unguarded_partition(__first, __last,
- _Tp(__median(*__first,
- *(__first + (__last - __first)/2),
- *(__last - 1),
- __comp)),
- __comp);
- if (__cut <= __nth)
- __first = __cut;
- else
- __last = __cut;
- }
- __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _RandomAccessIter>
-void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
- _RandomAccessIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __nth))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__nth, __last))
- _STLP_PRIV __nth_element(__first, __nth, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter),
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
-}
-
-template <class _RandomAccessIter, class _Compare>
-void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
- _RandomAccessIter __last, _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __nth))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__nth, __last))
- _STLP_PRIV __nth_element(__first, __nth, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp);
-}
-
-// Binary search (lower_bound, upper_bound, equal_range, binary_search).
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _ForwardIter, class _Tp,
- class _Compare1, class _Compare2, class _Distance>
-_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
- _Compare1 __comp1, _Compare2 __comp2, _Distance*) {
- _Distance __len = distance(__first, __last);
- _Distance __half;
-
- while (__len > 0) {
- __half = __len >> 1;
- _ForwardIter __middle = __first;
- advance(__middle, __half);
- if (__comp2(__val, *__middle)) {
- _STLP_VERBOSE_ASSERT(!__comp1(*__middle, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- __len = __half;
- }
- else {
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- }
- return __first;
-}
-
-template <class _ForwardIter, class _Tp,
- class _Compare1, class _Compare2, class _Distance>
-pair<_ForwardIter, _ForwardIter>
-__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
- _Compare1 __comp1, _Compare2 __comp2, _Distance* __dist) {
- _Distance __len = distance(__first, __last);
- _Distance __half;
-
- while (__len > 0) {
- __half = __len >> 1;
- _ForwardIter __middle = __first;
- advance(__middle, __half);
- if (__comp1(*__middle, __val)) {
- _STLP_VERBOSE_ASSERT(!__comp2(__val, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- else if (__comp2(__val, *__middle)) {
- _STLP_VERBOSE_ASSERT(!__comp1(*__middle, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- __len = __half;
- }
- else {
- _ForwardIter __left = __lower_bound(__first, __middle, __val, __comp1, __comp2, __dist);
- //Small optim: If lower_bound haven't found an equivalent value
- //there is no need to call upper_bound.
- if (__comp1(*__left, __val)) {
- _STLP_VERBOSE_ASSERT(!__comp2(__val, *__left), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- return pair<_ForwardIter, _ForwardIter>(__left, __left);
- }
- advance(__first, __len);
- _ForwardIter __right = __upper_bound(++__middle, __first, __val, __comp1, __comp2, __dist);
- return pair<_ForwardIter, _ForwardIter>(__left, __right);
- }
- }
- return pair<_ForwardIter, _ForwardIter>(__first, __first);
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
- while (__first1 != __last1 && __first2 != __last2) {
- if (*__first2 < *__first1) {
- *__result = *__first2;
- ++__first2;
- }
- else {
- *__result = *__first1;
- ++__first1;
- }
- ++__result;
- }
- return copy(__first2, __last2, copy(__first1, __last1, __result));
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
- while (__first1 != __last1 && __first2 != __last2) {
- if (__comp(*__first2, *__first1)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- *__result = *__first2;
- ++__first2;
- }
- else {
- *__result = *__first1;
- ++__first1;
- }
- ++__result;
- }
- return copy(__first2, __last2, copy(__first1, __last1, __result));
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _BidirectionalIter, class _Distance, class _Compare>
-void __merge_without_buffer(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last,
- _Distance __len1, _Distance __len2,
- _Compare __comp) {
- if (__len1 == 0 || __len2 == 0)
- return;
- if (__len1 + __len2 == 2) {
- if (__comp(*__middle, *__first)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- iter_swap(__first, __middle);
- }
- return;
- }
- _BidirectionalIter __first_cut = __first;
- _BidirectionalIter __second_cut = __middle;
- _Distance __len11 = 0;
- _Distance __len22 = 0;
- if (__len1 > __len2) {
- __len11 = __len1 / 2;
- advance(__first_cut, __len11);
- __second_cut = lower_bound(__middle, __last, *__first_cut, __comp);
- __len22 += distance(__middle, __second_cut);
- }
- else {
- __len22 = __len2 / 2;
- advance(__second_cut, __len22);
- __first_cut = upper_bound(__first, __middle, *__second_cut, __comp);
- __len11 +=distance(__first, __first_cut);
- }
- _BidirectionalIter __new_middle
- = __rotate(__first_cut, __middle, __second_cut);
- __merge_without_buffer(__first, __first_cut, __new_middle, __len11, __len22,
- __comp);
- __merge_without_buffer(__new_middle, __second_cut, __last, __len1 - __len11,
- __len2 - __len22, __comp);
-}
-
-template <class _BidirectionalIter1, class _BidirectionalIter2,
- class _BidirectionalIter3, class _Compare>
-_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1,
- _BidirectionalIter1 __last1,
- _BidirectionalIter2 __first2,
- _BidirectionalIter2 __last2,
- _BidirectionalIter3 __result,
- _Compare __comp) {
- if (__first1 == __last1)
- return copy_backward(__first2, __last2, __result);
- if (__first2 == __last2)
- return copy_backward(__first1, __last1, __result);
- --__last1;
- --__last2;
- for (;;) {
- if (__comp(*__last2, *__last1)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__last1, *__last2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- *--__result = *__last1;
- if (__first1 == __last1)
- return copy_backward(__first2, ++__last2, __result);
- --__last1;
- }
- else {
- *--__result = *__last2;
- if (__first2 == __last2)
- return copy_backward(__first1, ++__last1, __result);
- --__last2;
- }
- }
-}
-
-template <class _BidirectionalIter, class _Tp,
- class _Distance, class _Compare>
-inline void __inplace_merge_aux(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last, _Tp*, _Distance*,
- _Compare __comp) {
- _Distance __len1 = distance(__first, __middle);
- _Distance __len2 = distance(__middle, __last);
-
- _Temporary_buffer<_BidirectionalIter, _Tp> __buf(__first, __last);
- if (__buf.begin() == 0)
- __merge_without_buffer(__first, __middle, __last, __len1, __len2, __comp);
- else
- __merge_adaptive(__first, __middle, __last, __len1, __len2,
- __buf.begin(), _Distance(__buf.size()),
- __comp);
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _BidirectionalIter>
-void inplace_merge(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
- if (__first == __middle || __middle == __last)
- return;
- _STLP_PRIV __inplace_merge_aux(__first, __middle, __last,
- _STLP_VALUE_TYPE(__first, _BidirectionalIter), _STLP_DISTANCE_TYPE(__first, _BidirectionalIter),
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter)));
-}
-
-template <class _BidirectionalIter, class _Compare>
-void inplace_merge(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last, _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
- if (__first == __middle || __middle == __last)
- return;
- _STLP_PRIV __inplace_merge_aux(__first, __middle, __last,
- _STLP_VALUE_TYPE(__first, _BidirectionalIter), _STLP_DISTANCE_TYPE(__first, _BidirectionalIter),
- __comp);
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter1, class _InputIter2, class _Compare>
-bool __includes(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) {
- _STLP_DEBUG_CHECK(__check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(__check_range(__first2, __last2))
- while (__first1 != __last1 && __first2 != __last2)
- if (__comp(*__first2, *__first1)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- return false;
- }
- else if (__comp(*__first1, *__first2))
- ++__first1;
- else
- ++__first1, ++__first2;
-
- return __first2 == __last2;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter1, class _InputIter2, class _Compare>
-bool includes(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) {
- return _STLP_PRIV __includes(__first1, __last1, __first2, __last2, __comp);
-}
-
-template <class _InputIter1, class _InputIter2>
-bool includes(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2) {
- return _STLP_PRIV __includes(__first1, __last1, __first2, __last2,
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter __set_union(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp) {
- _STLP_DEBUG_CHECK(__check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(__check_range(__first2, __last2))
- while (__first1 != __last1 && __first2 != __last2) {
- if (__comp(*__first1, *__first2)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- *__result = *__first1;
- ++__first1;
- }
- else if (__comp(*__first2, *__first1)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- *__result = *__first2;
- ++__first2;
- }
- else {
- *__result = *__first1;
- ++__first1;
- ++__first2;
- }
- ++__result;
- }
- return copy(__first2, __last2, copy(__first1, __last1, __result));
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result) {
- return _STLP_PRIV __set_union(__first1, __last1, __first2, __last2, __result,
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp) {
- return _STLP_PRIV __set_union(__first1, __last1, __first2, __last2, __result, __comp);
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter __set_intersection(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp) {
- _STLP_DEBUG_CHECK(__check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(__check_range(__first2, __last2))
- while (__first1 != __last1 && __first2 != __last2)
- if (__comp(*__first1, *__first2)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- ++__first1;
- }
- else if (__comp(*__first2, *__first1))
- ++__first2;
- else {
- *__result = *__first1;
- ++__first1;
- ++__first2;
- ++__result;
- }
- return __result;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result) {
- return _STLP_PRIV __set_intersection(__first1, __last1, __first2, __last2, __result,
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp) {
- return _STLP_PRIV __set_intersection(__first1, __last1, __first2, __last2, __result, __comp);
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter __set_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp) {
- _STLP_DEBUG_CHECK(__check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(__check_range(__first2, __last2))
- while (__first1 != __last1 && __first2 != __last2)
- if (__comp(*__first1, *__first2)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- *__result = *__first1;
- ++__first1;
- ++__result;
- }
- else if (__comp(*__first2, *__first1))
- ++__first2;
- else {
- ++__first1;
- ++__first2;
- }
- return copy(__first1, __last1, __result);
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result) {
- return _STLP_PRIV __set_difference(__first1, __last1, __first2, __last2, __result,
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp) {
- return _STLP_PRIV __set_difference(__first1, __last1, __first2, __last2, __result, __comp);
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter1, class _InputIter2, class _OutputIter, class _Compare>
-_OutputIter
-__set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp) {
- _STLP_DEBUG_CHECK(__check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(__check_range(__first2, __last2))
- while (__first1 != __last1 && __first2 != __last2) {
- if (__comp(*__first1, *__first2)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- *__result = *__first1;
- ++__first1;
- ++__result;
- }
- else if (__comp(*__first2, *__first1)) {
- *__result = *__first2;
- ++__first2;
- ++__result;
- }
- else {
- ++__first1;
- ++__first2;
- }
- }
- return copy(__first2, __last2, copy(__first1, __last1, __result));
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter
-set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result) {
- return _STLP_PRIV __set_symmetric_difference(__first1, __last1, __first2, __last2, __result,
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter, class _Compare>
-_OutputIter
-set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result,
- _Compare __comp) {
- return _STLP_PRIV __set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp);
-}
-
-// min_element and max_element, with and without an explicitly supplied
-// comparison function.
-
-template <class _ForwardIter>
-_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__first == __last) return __first;
- _ForwardIter __result = __first;
- while (++__first != __last)
- if (*__result < *__first)
- __result = __first;
- return __result;
-}
-
-template <class _ForwardIter, class _Compare>
-_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last,
- _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__first == __last) return __first;
- _ForwardIter __result = __first;
- while (++__first != __last) {
- if (__comp(*__result, *__first)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first, *__result), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- __result = __first;
- }
- }
- return __result;
-}
-
-template <class _ForwardIter>
-_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__first == __last) return __first;
- _ForwardIter __result = __first;
- while (++__first != __last)
- if (*__first < *__result)
- __result = __first;
- return __result;
-}
-
-template <class _ForwardIter, class _Compare>
-_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last,
- _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__first == __last) return __first;
- _ForwardIter __result = __first;
- while (++__first != __last) {
- if (__comp(*__first, *__result)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__result, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- __result = __first;
- }
- }
- return __result;
-}
-
-// next_permutation and prev_permutation, with and without an explicitly
-// supplied comparison function.
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _BidirectionalIter, class _Compare>
-bool __next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
- _Compare __comp) {
- _STLP_DEBUG_CHECK(__check_range(__first, __last))
- if (__first == __last)
- return false;
- _BidirectionalIter __i = __first;
- ++__i;
- if (__i == __last)
- return false;
- __i = __last;
- --__i;
-
- for(;;) {
- _BidirectionalIter __ii = __i;
- --__i;
- if (__comp(*__i, *__ii)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__ii, *__i), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- _BidirectionalIter __j = __last;
- while (!__comp(*__i, *--__j)) {}
- iter_swap(__i, __j);
- reverse(__ii, __last);
- return true;
- }
- if (__i == __first) {
- reverse(__first, __last);
- return false;
- }
- }
-#if defined (_STLP_NEED_UNREACHABLE_RETURN)
- return false;
-#endif
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _BidirectionalIter>
-bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __next_permutation(__first, __last,
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter)));
-}
-
-template <class _BidirectionalIter, class _Compare>
-bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
- _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __next_permutation(__first, __last, __comp);
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _BidirectionalIter, class _Compare>
-bool __prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
- _Compare __comp) {
- if (__first == __last)
- return false;
- _BidirectionalIter __i = __first;
- ++__i;
- if (__i == __last)
- return false;
- __i = __last;
- --__i;
-
- for(;;) {
- _BidirectionalIter __ii = __i;
- --__i;
- if (__comp(*__ii, *__i)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__i, *__ii), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- _BidirectionalIter __j = __last;
- while (!__comp(*--__j, *__i)) {}
- iter_swap(__i, __j);
- reverse(__ii, __last);
- return true;
- }
- if (__i == __first) {
- reverse(__first, __last);
- return false;
- }
- }
-#if defined (_STLP_NEED_UNREACHABLE_RETURN)
- return false;
-#endif
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _BidirectionalIter>
-bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __prev_permutation(__first, __last,
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter)));
-}
-
-template <class _BidirectionalIter, class _Compare>
-bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
- _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __prev_permutation(__first, __last, __comp);
-}
-
-#if !defined (_STLP_NO_EXTENSIONS)
-
-// is_heap, a predicate testing whether or not a range is
-// a heap. This function is an extension, not part of the C++
-// standard.
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _RandomAccessIter, class _Distance, class _StrictWeakOrdering>
-bool __is_heap(_RandomAccessIter __first, _StrictWeakOrdering __comp,
- _Distance __n) {
- _Distance __parent = 0;
- for (_Distance __child = 1; __child < __n; ++__child) {
- if (__comp(__first[__parent], __first[__child])) {
- _STLP_VERBOSE_ASSERT(!__comp(__first[__child], __first[__parent]), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- return false;
- }
- if ((__child & 1) == 0)
- ++__parent;
- }
- return true;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _RandomAccessIter>
-bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __is_heap(__first, _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)), __last - __first);
-}
-
-template <class _RandomAccessIter, class _StrictWeakOrdering>
-bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last,
- _StrictWeakOrdering __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __is_heap(__first, __comp, __last - __first);
-}
-
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _ForwardIter, class _StrictWeakOrdering>
-bool __is_sorted(_ForwardIter __first, _ForwardIter __last,
- _StrictWeakOrdering __comp) {
- _STLP_DEBUG_CHECK(__check_range(__first, __last))
- if (__first == __last)
- return true;
-
- _ForwardIter __next = __first;
- for (++__next; __next != __last; __first = __next, ++__next) {
- if (__comp(*__next, *__first)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first, *__next), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- return false;
- }
- }
-
- return true;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif /* _STLP_NO_EXTENSIONS */
-
-_STLP_END_NAMESPACE
-
-#undef __stl_threshold
-
-#endif /* _STLP_ALGO_C */
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_algo.h b/stl/_algo.h
deleted file mode 100644
index d6513fc..0000000
--- a/stl/_algo.h
+++ /dev/null
@@ -1,760 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_ALGO_H
-#define _STLP_INTERNAL_ALGO_H
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-#ifndef _STLP_INTERNAL_HEAP_H
-# include <stl/_heap.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ITERATOR_H
-# include <stl/_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
-# include <stl/_function_base.h>
-#endif
-
-#if defined (__SUNPRO_CC) && !defined (_STLP_INTERNAL_CSTDIO)
-// remove() conflict
-# include <stl/_cstdio.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-// for_each. Apply a function to every element of a range.
-template <class _InputIter, class _Function>
-_STLP_INLINE_LOOP _Function
-for_each(_InputIter __first, _InputIter __last, _Function __f) {
- for ( ; __first != __last; ++__first)
- __f(*__first);
- return __f;
-}
-
-// count_if
-template <class _InputIter, class _Predicate>
-_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter)
-count_if(_InputIter __first, _InputIter __last, _Predicate __pred) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0;
- for ( ; __first != __last; ++__first) {
- if (__pred(*__first))
- ++__n;
- }
- return __n;
-}
-
-// adjacent_find.
-
-template <class _ForwardIter, class _BinaryPredicate>
-_STLP_INLINE_LOOP _ForwardIter
-adjacent_find(_ForwardIter __first, _ForwardIter __last,
- _BinaryPredicate __binary_pred) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- if (__first == __last)
- return __last;
- _ForwardIter __next = __first;
- while(++__next != __last) {
- if (__binary_pred(*__first, *__next))
- return __first;
- __first = __next;
- }
- return __last;
-}
-
-template <class _ForwardIter>
-_STLP_INLINE_LOOP _ForwardIter
-adjacent_find(_ForwardIter __first, _ForwardIter __last) {
- return adjacent_find(__first, __last,
- _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _ForwardIter)));
-}
-
-#if !defined (_STLP_NO_ANACHRONISMS)
-template <class _InputIter, class _Tp, class _Size>
-_STLP_INLINE_LOOP void
-count(_InputIter __first, _InputIter __last, const _Tp& __val, _Size& __n) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- for ( ; __first != __last; ++__first)
- if (*__first == __val)
- ++__n;
-}
-
-template <class _InputIter, class _Predicate, class _Size>
-_STLP_INLINE_LOOP void
-count_if(_InputIter __first, _InputIter __last, _Predicate __pred, _Size& __n) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- for ( ; __first != __last; ++__first)
- if (__pred(*__first))
- ++__n;
-}
-#endif
-
-template <class _ForwardIter1, class _ForwardIter2>
-_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2);
-
-// search_n. Search for __count consecutive copies of __val.
-template <class _ForwardIter, class _Integer, class _Tp>
-_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
- _Integer __count, const _Tp& __val);
-template <class _ForwardIter, class _Integer, class _Tp, class _BinaryPred>
-_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
- _Integer __count, const _Tp& __val, _BinaryPred __binary_pred);
-
-template <class _InputIter, class _ForwardIter>
-inline _InputIter find_first_of(_InputIter __first1, _InputIter __last1,
- _ForwardIter __first2, _ForwardIter __last2) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
- return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2,
- _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _InputIter)));
-}
-
-template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
-inline _InputIter
-find_first_of(_InputIter __first1, _InputIter __last1,
- _ForwardIter __first2, _ForwardIter __last2, _BinaryPredicate __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
- return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2, __comp);
-}
-
-template <class _ForwardIter1, class _ForwardIter2>
-_ForwardIter1
-find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2);
-
-// swap_ranges
-template <class _ForwardIter1, class _ForwardIter2>
-_STLP_INLINE_LOOP _ForwardIter2
-swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- for ( ; __first1 != __last1; ++__first1, ++__first2)
- iter_swap(__first1, __first2);
- return __first2;
-}
-
-// transform
-template <class _InputIter, class _OutputIter, class _UnaryOperation>
-_STLP_INLINE_LOOP _OutputIter
-transform(_InputIter __first, _InputIter __last, _OutputIter __result, _UnaryOperation __opr) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- for ( ; __first != __last; ++__first, ++__result)
- *__result = __opr(*__first);
- return __result;
-}
-template <class _InputIter1, class _InputIter2, class _OutputIter, class _BinaryOperation>
-_STLP_INLINE_LOOP _OutputIter
-transform(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _OutputIter __result,_BinaryOperation __binary_op) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- for ( ; __first1 != __last1; ++__first1, ++__first2, ++__result)
- *__result = __binary_op(*__first1, *__first2);
- return __result;
-}
-
-// replace_if, replace_copy, replace_copy_if
-
-template <class _ForwardIter, class _Predicate, class _Tp>
-_STLP_INLINE_LOOP void
-replace_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, const _Tp& __new_value) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- for ( ; __first != __last; ++__first)
- if (__pred(*__first))
- *__first = __new_value;
-}
-
-template <class _InputIter, class _OutputIter, class _Tp>
-_STLP_INLINE_LOOP _OutputIter
-replace_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
- const _Tp& __old_value, const _Tp& __new_value) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- for ( ; __first != __last; ++__first, ++__result)
- *__result = *__first == __old_value ? __new_value : *__first;
- return __result;
-}
-
-template <class _Iterator, class _OutputIter, class _Predicate, class _Tp>
-_STLP_INLINE_LOOP _OutputIter
-replace_copy_if(_Iterator __first, _Iterator __last,
- _OutputIter __result,
- _Predicate __pred, const _Tp& __new_value) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- for ( ; __first != __last; ++__first, ++__result)
- *__result = __pred(*__first) ? __new_value : *__first;
- return __result;
-}
-
-// generate and generate_n
-
-template <class _ForwardIter, class _Generator>
-_STLP_INLINE_LOOP void
-generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- for ( ; __first != __last; ++__first)
- *__first = __gen();
-}
-
-template <class _OutputIter, class _Size, class _Generator>
-_STLP_INLINE_LOOP void
-generate_n(_OutputIter __first, _Size __n, _Generator __gen) {
- for ( ; __n > 0; --__n, ++__first)
- *__first = __gen();
-}
-
-// remove, remove_if, remove_copy, remove_copy_if
-
-template <class _InputIter, class _OutputIter, class _Tp>
-_STLP_INLINE_LOOP _OutputIter
-remove_copy(_InputIter __first, _InputIter __last,_OutputIter __result, const _Tp& __val) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- for ( ; __first != __last; ++__first) {
- if (!(*__first == __val)) {
- *__result = *__first;
- ++__result;
- }
- }
- return __result;
-}
-
-template <class _InputIter, class _OutputIter, class _Predicate>
-_STLP_INLINE_LOOP _OutputIter
-remove_copy_if(_InputIter __first, _InputIter __last, _OutputIter __result, _Predicate __pred) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- for ( ; __first != __last; ++__first) {
- if (!__pred(*__first)) {
- *__result = *__first;
- ++__result;
- }
- }
- return __result;
-}
-
-template <class _ForwardIter, class _Tp>
-_STLP_INLINE_LOOP _ForwardIter
-remove(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- __first = find(__first, __last, __val);
- if (__first == __last)
- return __first;
- else {
- _ForwardIter __next = __first;
- return remove_copy(++__next, __last, __first, __val);
- }
-}
-
-template <class _ForwardIter, class _Predicate>
-_STLP_INLINE_LOOP _ForwardIter
-remove_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- __first = find_if(__first, __last, __pred);
- if ( __first == __last )
- return __first;
- else {
- _ForwardIter __next = __first;
- return remove_copy_if(++__next, __last, __first, __pred);
- }
-}
-
-// unique and unique_copy
-template <class _InputIter, class _OutputIter>
-_OutputIter unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result);
-
-template <class _InputIter, class _OutputIter, class _BinaryPredicate>
-_OutputIter unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
- _BinaryPredicate __binary_pred);
-
-template <class _ForwardIter>
-inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last) {
- __first = adjacent_find(__first, __last);
- return unique_copy(__first, __last, __first);
-}
-
-template <class _ForwardIter, class _BinaryPredicate>
-inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last,
- _BinaryPredicate __binary_pred) {
- __first = adjacent_find(__first, __last, __binary_pred);
- return unique_copy(__first, __last, __first, __binary_pred);
-}
-
-// reverse and reverse_copy, and their auxiliary functions
-
-template <class _BidirectionalIter>
-_STLP_INLINE_LOOP void
-__reverse(_BidirectionalIter __first, _BidirectionalIter __last, const bidirectional_iterator_tag &) {
- for (; __first != __last && __first != --__last; ++__first)
- iter_swap(__first,__last);
-}
-
-
-template <class _RandomAccessIter>
-_STLP_INLINE_LOOP void
-__reverse(_RandomAccessIter __first, _RandomAccessIter __last, const random_access_iterator_tag &) {
- for (; __first < __last; ++__first)
- iter_swap(__first, --__last);
-}
-
-template <class _BidirectionalIter>
-inline void
-reverse(_BidirectionalIter __first, _BidirectionalIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- __reverse(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _BidirectionalIter));
-}
-
-template <class _BidirectionalIter, class _OutputIter>
-_STLP_INLINE_LOOP
-_OutputIter reverse_copy(_BidirectionalIter __first,
- _BidirectionalIter __last,
- _OutputIter __result) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- while (__first != __last) {
- --__last;
- *__result = *__last;
- ++__result;
- }
- return __result;
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// rotate and rotate_copy, and their auxiliary functions
-template <class _EuclideanRingElement>
-_STLP_INLINE_LOOP
-_EuclideanRingElement __gcd(_EuclideanRingElement __m,
- _EuclideanRingElement __n) {
- while (__n != 0) {
- _EuclideanRingElement __t = __m % __n;
- __m = __n;
- __n = __t;
- }
- return __m;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _ForwardIter>
-void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last);
-
-template <class _ForwardIter, class _OutputIter>
-inline _OutputIter rotate_copy(_ForwardIter __first, _ForwardIter __middle,
- _ForwardIter __last, _OutputIter __result) {
- return copy(__first, __middle, copy(__middle, __last, __result));
-}
-
-// random_shuffle
-
-template <class _RandomAccessIter>
-void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last);
-
-template <class _RandomAccessIter, class _RandomNumberGenerator>
-void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last,
- _RandomNumberGenerator& __rand);
-
-#if !defined (_STLP_NO_EXTENSIONS)
-// random_sample and random_sample_n (extensions, not part of the standard).
-
-template <class _ForwardIter, class _OutputIter, class _Distance>
-_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
- _OutputIter __out_ite, const _Distance __n);
-
-template <class _ForwardIter, class _OutputIter, class _Distance,
- class _RandomNumberGenerator>
-_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
- _OutputIter __out_ite, const _Distance __n,
- _RandomNumberGenerator& __rand);
-
-template <class _InputIter, class _RandomAccessIter>
-_RandomAccessIter
-random_sample(_InputIter __first, _InputIter __last,
- _RandomAccessIter __out_first, _RandomAccessIter __out_last);
-
-template <class _InputIter, class _RandomAccessIter,
- class _RandomNumberGenerator>
-_RandomAccessIter
-random_sample(_InputIter __first, _InputIter __last,
- _RandomAccessIter __out_first, _RandomAccessIter __out_last,
- _RandomNumberGenerator& __rand);
-
-#endif /* _STLP_NO_EXTENSIONS */
-
-// partition, stable_partition, and their auxiliary functions
-
-template <class _ForwardIter, class _Predicate>
-_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred);
-
-template <class _ForwardIter, class _Predicate>
-_ForwardIter
-stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred);
-
-// sort() and its auxiliary functions.
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Size>
-inline _Size __lg(_Size __n) {
- _Size __k;
- for (__k = 0; __n != 1; __n >>= 1) ++__k;
- return __k;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _RandomAccessIter>
-void sort(_RandomAccessIter __first, _RandomAccessIter __last);
-template <class _RandomAccessIter, class _Compare>
-void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp);
-
-// stable_sort() and its auxiliary functions.
-template <class _RandomAccessIter>
-void stable_sort(_RandomAccessIter __first,
- _RandomAccessIter __last);
-
-template <class _RandomAccessIter, class _Compare>
-void stable_sort(_RandomAccessIter __first,
- _RandomAccessIter __last, _Compare __comp);
-
-// partial_sort, partial_sort_copy, and auxiliary functions.
-
-template <class _RandomAccessIter>
-void partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle,
- _RandomAccessIter __last);
-
-template <class _RandomAccessIter, class _Compare>
-void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
- _RandomAccessIter __last, _Compare __comp);
-
-template <class _InputIter, class _RandomAccessIter>
-_RandomAccessIter
-partial_sort_copy(_InputIter __first, _InputIter __last,
- _RandomAccessIter __result_first, _RandomAccessIter __result_last);
-
-template <class _InputIter, class _RandomAccessIter, class _Compare>
-_RandomAccessIter
-partial_sort_copy(_InputIter __first, _InputIter __last,
- _RandomAccessIter __result_first,
- _RandomAccessIter __result_last, _Compare __comp);
-
-// nth_element() and its auxiliary functions.
-template <class _RandomAccessIter>
-void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
- _RandomAccessIter __last);
-
-template <class _RandomAccessIter, class _Compare>
-void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
- _RandomAccessIter __last, _Compare __comp);
-
-// auxiliary class for lower_bound, etc.
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _T1, class _T2>
-struct __less_2 {
- bool operator() (const _T1& __x, const _T2& __y) const { return __x < __y ; }
-};
-
-template <class _T1, class _T2>
-__less_2<_T1,_T2> __less2(_T1*, _T2* ) { return __less_2<_T1, _T2>(); }
-
-#if defined (_STLP_FUNCTION_PARTIAL_ORDER)
-template <class _Tp>
-less<_Tp> __less2(_Tp*, _Tp* ) { return less<_Tp>(); }
-#endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-// Binary search (lower_bound, upper_bound, equal_range, binary_search).
-template <class _ForwardIter, class _Tp>
-inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __lower_bound(__first, __last, __val,
- _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
- _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
- _STLP_DISTANCE_TYPE(__first, _ForwardIter));
-}
-
-template <class _ForwardIter, class _Tp, class _Compare>
-inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val, _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp,
- _STLP_DISTANCE_TYPE(__first, _ForwardIter));
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
-_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
- _Compare1 __comp1, _Compare2 __comp2, _Distance*);
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _ForwardIter, class _Tp>
-inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __upper_bound(__first, __last, __val,
- _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
- _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
- _STLP_DISTANCE_TYPE(__first, _ForwardIter));
-}
-
-template <class _ForwardIter, class _Tp, class _Compare>
-inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val, _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __upper_bound(__first, __last, __val, __comp, __comp,
- _STLP_DISTANCE_TYPE(__first, _ForwardIter));
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
-pair<_ForwardIter, _ForwardIter>
-__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
- _Compare1 __comp1, _Compare2 __comp2, _Distance*);
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _ForwardIter, class _Tp>
-inline pair<_ForwardIter, _ForwardIter>
-equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __equal_range(__first, __last, __val,
- _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
- _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
- _STLP_DISTANCE_TYPE(__first, _ForwardIter));
-}
-
-template <class _ForwardIter, class _Tp, class _Compare>
-inline pair<_ForwardIter, _ForwardIter>
-equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
- _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __equal_range(__first, __last, __val, __comp, __comp,
- _STLP_DISTANCE_TYPE(__first, _ForwardIter));
-}
-
-template <class _ForwardIter, class _Tp>
-inline bool binary_search(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val,
- _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
- _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
- _STLP_DISTANCE_TYPE(__first, _ForwardIter));
- return __i != __last && !(__val < *__i);
-}
-
-template <class _ForwardIter, class _Tp, class _Compare>
-inline bool binary_search(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val,
- _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp,
- _STLP_DISTANCE_TYPE(__first, _ForwardIter));
- return __i != __last && !__comp(__val, *__i);
-}
-
-// merge, with and without an explicitly supplied comparison function.
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result);
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp);
-
-
-// inplace_merge and its auxiliary functions.
-
-
-template <class _BidirectionalIter>
-void inplace_merge(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last) ;
-
-template <class _BidirectionalIter, class _Compare>
-void inplace_merge(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last, _Compare __comp);
-
-// Set algorithms: includes, set_union, set_intersection, set_difference,
-// set_symmetric_difference. All of these algorithms have the precondition
-// that their input ranges are sorted and the postcondition that their output
-// ranges are sorted.
-
-template <class _InputIter1, class _InputIter2>
-bool includes(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2);
-
-template <class _InputIter1, class _InputIter2, class _Compare>
-bool includes(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2, _Compare __comp);
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result);
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp);
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result);
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp);
-
-
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result);
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp);
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter
-set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result);
-
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter
-set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result,
- _Compare __comp);
-
-
-// min_element and max_element, with and without an explicitly supplied
-// comparison function.
-
-template <class _ForwardIter>
-_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last);
-template <class _ForwardIter, class _Compare>
-_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last,
- _Compare __comp);
-
-template <class _ForwardIter>
-_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last);
-
-template <class _ForwardIter, class _Compare>
-_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last,
- _Compare __comp);
-
-// next_permutation and prev_permutation, with and without an explicitly
-// supplied comparison function.
-
-template <class _BidirectionalIter>
-bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last);
-
-template <class _BidirectionalIter, class _Compare>
-bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
- _Compare __comp);
-
-
-template <class _BidirectionalIter>
-bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last);
-
-
-template <class _BidirectionalIter, class _Compare>
-bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
- _Compare __comp);
-
-#if !defined (_STLP_NO_EXTENSIONS)
-// is_heap, a predicate testing whether or not a range is
-// a heap. This function is an extension, not part of the C++
-// standard.
-
-template <class _RandomAccessIter>
-bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last);
-
-template <class _RandomAccessIter, class _StrictWeakOrdering>
-bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last,
- _StrictWeakOrdering __comp);
-
-// is_sorted, a predicated testing whether a range is sorted in
-// nondescending order. This is an extension, not part of the C++
-// standard.
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _ForwardIter, class _StrictWeakOrdering>
-bool __is_sorted(_ForwardIter __first, _ForwardIter __last,
- _StrictWeakOrdering __comp);
-
-_STLP_MOVE_TO_STD_NAMESPACE
-template <class _ForwardIter>
-inline bool is_sorted(_ForwardIter __first, _ForwardIter __last) {
- return _STLP_PRIV __is_sorted(__first, __last,
- _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _ForwardIter)));
-}
-
-template <class _ForwardIter, class _StrictWeakOrdering>
-inline bool is_sorted(_ForwardIter __first, _ForwardIter __last,
- _StrictWeakOrdering __comp) {
- return _STLP_PRIV __is_sorted(__first, __last, __comp);
-}
-#endif
-
-_STLP_END_NAMESPACE
-
-#if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_algo.c>
-#endif
-
-#endif /* _STLP_INTERNAL_ALGO_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_algobase.c b/stl/_algobase.c
deleted file mode 100644
index 8a1f657..0000000
--- a/stl/_algobase.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_ALGOBASE_C
-#define _STLP_ALGOBASE_C
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _InputIter1, class _InputIter2>
-bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
- for ( ; __first1 != __last1 && __first2 != __last2
- ; ++__first1, ++__first2) {
- if (*__first1 < *__first2) {
- return true;
- }
- if (*__first2 < *__first1)
- return false;
- }
- return __first1 == __last1 && __first2 != __last2;
-}
-
-template <class _InputIter1, class _InputIter2, class _Compare>
-bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _Compare __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
- for ( ; __first1 != __last1 && __first2 != __last2
- ; ++__first1, ++__first2) {
- if (__comp(*__first1, *__first2)) {
- return true;
- }
- if (__comp(*__first2, *__first1))
- return false;
- }
- return __first1 == __last1 && __first2 != __last2;
-}
-
-#if !defined (_STLP_NO_EXTENSIONS)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter1, class _InputIter2>
-int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2) {
- while (__first1 != __last1 && __first2 != __last2) {
- if (*__first1 < *__first2) {
- _STLP_VERBOSE_ASSERT(!(*__first2 < *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- return -1;
- }
- if (*__first2 < *__first1)
- return 1;
- ++__first1;
- ++__first2;
- }
- if (__first2 == __last2) {
- return !(__first1 == __last1);
- }
- else {
- return -1;
- }
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter1, class _InputIter2>
-int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
- return _STLP_PRIV __lexicographical_compare_3way(__first1, __last1, __first2, __last2);
-}
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _RandomAccessIter, class _Tp>
-_STLP_INLINE_LOOP _RandomAccessIter __find(_RandomAccessIter __first, _RandomAccessIter __last,
- const _Tp& __val,
- const random_access_iterator_tag &) {
- _STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2;
-
- for ( ; __trip_count > 0 ; --__trip_count) {
- if (*__first == __val) return __first;
- ++__first;
-
- if (*__first == __val) return __first;
- ++__first;
-
- if (*__first == __val) return __first;
- ++__first;
-
- if (*__first == __val) return __first;
- ++__first;
- }
-
- switch (__last - __first) {
- case 3:
- if (*__first == __val) return __first;
- ++__first;
- case 2:
- if (*__first == __val) return __first;
- ++__first;
- case 1:
- if (*__first == __val) return __first;
- //++__first;
- case 0:
- default:
- return __last;
- }
-}
-
-inline char*
-__find(char* __first, char* __last, char __val, const random_access_iterator_tag &) {
- void *res = memchr(__first, __val, __last - __first);
- return res != 0 ? __STATIC_CAST(char*, res) : __last;
-}
-inline const char*
-__find(const char* __first, const char* __last, char __val, const random_access_iterator_tag &) {
- const void *res = memchr(__first, __val, __last - __first);
- return res != 0 ? __STATIC_CAST(const char*, res) : __last;
-}
-
-template <class _RandomAccessIter, class _Predicate>
-_STLP_INLINE_LOOP _RandomAccessIter __find_if(_RandomAccessIter __first, _RandomAccessIter __last,
- _Predicate __pred,
- const random_access_iterator_tag &) {
- _STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2;
-
- for ( ; __trip_count > 0 ; --__trip_count) {
- if (__pred(*__first)) return __first;
- ++__first;
-
- if (__pred(*__first)) return __first;
- ++__first;
-
- if (__pred(*__first)) return __first;
- ++__first;
-
- if (__pred(*__first)) return __first;
- ++__first;
- }
-
- switch(__last - __first) {
- case 3:
- if (__pred(*__first)) return __first;
- ++__first;
- case 2:
- if (__pred(*__first)) return __first;
- ++__first;
- case 1:
- if (__pred(*__first)) return __first;
- //++__first;
- case 0:
- default:
- return __last;
- }
-}
-
-template <class _InputIter, class _Tp>
-_STLP_INLINE_LOOP _InputIter __find(_InputIter __first, _InputIter __last,
- const _Tp& __val,
- const input_iterator_tag &) {
- while (__first != __last && !(*__first == __val)) ++__first;
- return __first;
-}
-
-template <class _InputIter, class _Predicate>
-_STLP_INLINE_LOOP _InputIter __find_if(_InputIter __first, _STLP_MPW_EXTRA_CONST _InputIter __last,
- _Predicate __pred,
- const input_iterator_tag &) {
- while (__first != __last && !__pred(*__first))
- ++__first;
- return __first;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter, class _Predicate>
-_InputIter find_if(_InputIter __first, _InputIter __last,
- _Predicate __pred) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __find_if(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
-}
-
-template <class _InputIter, class _Tp>
-_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __find(__first, __last, __val, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
-}
-
-template <class _ForwardIter1, class _ForwardIter2, class _BinaryPred>
-_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2,
- _BinaryPred __pred) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
- // Test for empty ranges
- if (__first1 == __last1 || __first2 == __last2)
- return __first1;
-
- // Test for a pattern of length 1.
- _ForwardIter2 __p1(__first2);
-
- if ( ++__p1 == __last2 ) {
- while (__first1 != __last1 && !__pred(*__first1, *__first2)) {
- ++__first1;
- }
- return __first1;
- }
-
- // General case.
-
- for ( ; ; ) { // __first1 != __last1 will be checked below
- while (__first1 != __last1 && !__pred(*__first1, *__first2)) {
- ++__first1;
- }
- if (__first1 == __last1) {
- return __last1;
- }
- _ForwardIter2 __p = __p1;
- _ForwardIter1 __current = __first1;
- if (++__current == __last1) return __last1;
-
- while (__pred(*__current, *__p)) {
- if (++__p == __last2)
- return __first1;
- if (++__current == __last1)
- return __last1;
- }
-
- ++__first1;
- }
- return __first1;
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// find_first_of, with and without an explicitly supplied comparison function.
-template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
-_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
- _ForwardIter __first2, _ForwardIter __last2,
- _BinaryPredicate __comp) {
- for ( ; __first1 != __last1; ++__first1) {
- for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter) {
- if (__comp(*__first1, *__iter)) {
- return __first1;
- }
- }
- }
- return __last1;
-}
-
-// find_end, with and without an explicitly supplied comparison function.
-// Search [first2, last2) as a subsequence in [first1, last1), and return
-// the *last* possible match. Note that find_end for bidirectional iterators
-// is much faster than for forward iterators.
-
-// find_end for forward iterators.
-template <class _ForwardIter1, class _ForwardIter2,
- class _BinaryPredicate>
-_ForwardIter1 __find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2,
- const forward_iterator_tag &, const forward_iterator_tag &,
- _BinaryPredicate __comp) {
- if (__first2 == __last2)
- return __last1;
- else {
- _ForwardIter1 __result = __last1;
- for (;;) {
- _ForwardIter1 __new_result = search(__first1, __last1, __first2, __last2, __comp);
- if (__new_result == __last1)
- return __result;
- else {
- __result = __new_result;
- __first1 = __new_result;
- ++__first1;
- }
- }
- }
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-// find_end for bidirectional iterators. Requires partial specialization.
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-
-# ifndef _STLP_INTERNAL_ITERATOR_H
-_STLP_END_NAMESPACE
-# include <stl/_iterator.h>
-_STLP_BEGIN_NAMESPACE
-# endif /*_STLP_INTERNAL_ITERATOR_H*/
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _BidirectionalIter1, class _BidirectionalIter2,
- class _BinaryPredicate>
-_BidirectionalIter1
-__find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1,
- _BidirectionalIter2 __first2, _BidirectionalIter2 __last2,
- const bidirectional_iterator_tag &, const bidirectional_iterator_tag &,
- _BinaryPredicate __comp) {
- typedef reverse_iterator<_BidirectionalIter1> _RevIter1;
- typedef reverse_iterator<_BidirectionalIter2> _RevIter2;
-
- _RevIter1 __rlast1(__first1);
- _RevIter2 __rlast2(__first2);
- _RevIter1 __rresult = search(_RevIter1(__last1), __rlast1,
- _RevIter2(__last2), __rlast2,
- __comp);
-
- if (__rresult == __rlast1)
- return __last1;
- else {
- _BidirectionalIter1 __result = __rresult.base();
- advance(__result, -distance(__first2, __last2));
- return __result;
- }
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _ForwardIter1, class _ForwardIter2,
- class _BinaryPredicate>
-_ForwardIter1
-find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2,
- _BinaryPredicate __comp) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
- return _STLP_PRIV __find_end(__first1, __last1, __first2, __last2,
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
- _STLP_ITERATOR_CATEGORY(__first1, _ForwardIter1),
- _STLP_ITERATOR_CATEGORY(__first2, _ForwardIter2),
-#else
- forward_iterator_tag(),
- forward_iterator_tag(),
-#endif
- __comp);
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
-_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
- _Compare1 __comp1, _Compare2 __comp2, _Distance*) {
- _Distance __len = distance(__first, __last);
- _Distance __half;
- _ForwardIter __middle;
-
- while (__len > 0) {
- __half = __len >> 1;
- __middle = __first;
- advance(__middle, __half);
- if (__comp1(*__middle, __val)) {
- _STLP_VERBOSE_ASSERT(!__comp2(__val, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- else
- __len = __half;
- }
- return __first;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_ALGOBASE_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_algobase.h b/stl/_algobase.h
deleted file mode 100644
index 6864223..0000000
--- a/stl/_algobase.h
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-#define _STLP_INTERNAL_ALGOBASE_H
-
-#ifndef _STLP_INTERNAL_CSTDDEF
-# include <stl/_cstddef.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CSTRING
-# include <stl/_cstring.h>
-#endif
-
-#ifndef _STLP_CLIMITS
-# include <climits>
-#endif
-
-#ifndef _STLP_INTERNAL_CSTDLIB
-# include <stl/_cstdlib.h>
-#endif
-
-#ifndef _STLP_INTERNAL_PAIR_H
-# include <stl/_pair.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
-# include <stl/_iterator_base.h>
-#endif
-
-#ifndef _STLP_TYPE_TRAITS_H
-# include <stl/type_traits.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined(_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined(_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-template <class _Tp>
-inline void __swap_aux(_Tp& __a, _Tp& __b, const __true_type& /*SwapImplemented*/) {
- __a.swap(__b);
-}
-
-template <class _Tp>
-inline void __swap_aux(_Tp& __a, _Tp& __b, const __false_type& /*SwapImplemented*/) {
- _Tp __tmp = __a;
- __a = __b;
- __b = __tmp;
-}
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif /* _STLP_USE_PARTIAL_SPEC_WORKAROUND */
-
-// swap and iter_swap
-template <class _Tp>
-inline void swap(_Tp& __a, _Tp& __b) {
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
-# if !defined(__BORLANDC__)
- typedef typename _SwapImplemented<_Tp>::_Ret _Implemented;
-# else
- enum { _Is = _SwapImplemented<_Tp>::_Is };
- typedef typename __bool2type<_Is>::_Ret _Implemented;
-# endif
- _STLP_PRIV __swap_aux(__a, __b, _Implemented());
-#else
- _Tp __tmp = __a;
- __a = __b;
- __b = __tmp;
-#endif /* _STLP_USE_PARTIAL_SPEC_WORKAROUND */
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _ForwardIter1, class _ForwardIter2, class _Value>
-inline void __iter_swap_aux_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, _Value *) {
- _Value tmp = *__i1;
- *__i1 = *__i2;
- *__i2 = tmp;
-}
-
-template <class _ForwardIter1, class _ForwardIter2>
-inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __true_type& /*OKToSwap*/) {
- swap(*__i1, *__i2);
-}
-
-template <class _ForwardIter1, class _ForwardIter2>
-inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __false_type& /*OKToSwap*/) {
- __iter_swap_aux_aux( __i1, __i2, _STLP_VALUE_TYPE(__i1,_ForwardIter1) );
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _ForwardIter1, class _ForwardIter2>
-inline void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2) {
- // swap(*__i1, *__i2);
- _STLP_PRIV __iter_swap_aux( __i1, __i2, _IsOKToSwap(_STLP_VALUE_TYPE(__i1, _ForwardIter1), _STLP_VALUE_TYPE(__i2, _ForwardIter2),
- _STLP_IS_REF_TYPE_REAL_REF(__i1, _ForwardIter1),
- _STLP_IS_REF_TYPE_REAL_REF(__i2, _ForwardIter2))._Answer());
-}
-
-//--------------------------------------------------
-// min and max
-
-#if !defined (__BORLANDC__) || defined (_STLP_USE_OWN_NAMESPACE)
-# if (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) && !defined (__STDC__)
-//In not ANSI mode Borland import min/max in global namespace which conflict
-//with STLport min/max when user does a 'using namespace std' in its code
-//(see test/unit/alg_test.cpp). To avoid this clash we simply import Borland min/max
-//in STLport namespace.
-using _STLP_VENDOR_STD::min;
-using _STLP_VENDOR_STD::max;
-# else
-template <class _Tp>
-inline const _Tp& (min)(const _Tp& __a, const _Tp& __b) { return __b < __a ? __b : __a; }
-template <class _Tp>
-inline const _Tp& (max)(const _Tp& __a, const _Tp& __b) { return __a < __b ? __b : __a; }
-# endif
-#endif
-
-# if defined (__BORLANDC__) && defined (_STLP_USE_OWN_NAMESPACE)
-inline unsigned long (min) (unsigned long __a, unsigned long __b) { return __b < __a ? __b : __a; }
-inline unsigned long (max) (unsigned long __a, unsigned long __b) { return __a < __b ? __b : __a; }
-# endif
-
-template <class _Tp, class _Compare>
-inline const _Tp& (min)(const _Tp& __a, const _Tp& __b, _Compare __comp) {
- return __comp(__b, __a) ? __b : __a;
-}
-
-template <class _Tp, class _Compare>
-inline const _Tp& (max)(const _Tp& __a, const _Tp& __b, _Compare __comp) {
- return __comp(__a, __b) ? __b : __a;
-}
-
-//--------------------------------------------------
-// copy
-
-// All of these auxiliary functions serve two purposes. (1) Replace
-// calls to copy with memmove whenever possible. (Memmove, not memcpy,
-// because the input and output ranges are permitted to overlap.)
-// (2) If we're using random access iterators, then write the loop as
-// a for loop with an explicit count.
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter, class _OutputIter, class _Distance>
-inline _OutputIter __copy(_InputIter __first, _InputIter __last,
- _OutputIter __result, const input_iterator_tag &, _Distance*) {
- for ( ; __first != __last; ++__result, ++__first)
- *__result = *__first;
- return __result;
-}
-
-#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
-template <class _InputIter, class _OutputIter, class _Distance>
-inline _OutputIter __copy(_InputIter __first, _InputIter __last,
- _OutputIter __result, const forward_iterator_tag &, _Distance* ) {
- for ( ; __first != __last; ++__result, ++__first)
- *__result = *__first;
- return __result;
-}
-
-template <class _InputIter, class _OutputIter, class _Distance>
-inline _OutputIter __copy(_InputIter __first, _InputIter __last,
- _OutputIter __result, const bidirectional_iterator_tag &, _Distance* ) {
- for ( ; __first != __last; ++__result, ++__first)
- *__result = *__first;
- return __result;
-}
-#endif
-
-template <class _RandomAccessIter, class _OutputIter, class _Distance>
-inline _OutputIter
-__copy(_RandomAccessIter __first, _RandomAccessIter __last,
- _OutputIter __result, const random_access_iterator_tag &, _Distance*) {
- for (_Distance __n = __last - __first; __n > 0; --__n) {
- *__result = *__first;
- ++__first;
- ++__result;
- }
- return __result;
-}
-
-inline void*
-__copy_trivial(const void* __first, const void* __last, void* __result) {
- size_t __n = (const char*)__last - (const char*)__first;
- return __n ? (void *)((char*)memmove(__result, __first, __n) + __n) : __result;
-}
-
-//--------------------------------------------------
-// copy_backward auxiliary functions
-
-template <class _BidirectionalIter1, class _BidirectionalIter2,
- class _Distance>
-inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first,
- _BidirectionalIter1 __last,
- _BidirectionalIter2 __result,
- const bidirectional_iterator_tag &,
- _Distance*) {
- while (__first != __last)
- *--__result = *--__last;
- return __result;
-}
-
-template <class _RandomAccessIter, class _BidirectionalIter, class _Distance>
-inline _BidirectionalIter __copy_backward(_RandomAccessIter __first,
- _RandomAccessIter __last,
- _BidirectionalIter __result,
- const random_access_iterator_tag &,
- _Distance*) {
- for (_Distance __n = __last - __first; __n > 0; --__n)
- *--__result = *--__last;
- return __result;
-}
-
-inline void*
-__copy_trivial_backward(const void* __first, const void* __last, void* __result) {
- const ptrdiff_t _Num = (const char*)__last - (const char*)__first;
- return (_Num > 0) ? memmove((char*)__result - _Num, __first, _Num) : __result ;
-}
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
- const __false_type& /*IsOKToMemCpy*/) {
- return __copy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0);
-}
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
- const __true_type& /*IsOKToMemCpy*/) {
- // we know they all pointers, so this cast is OK
- // return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result));
- return (_OutputIter)__copy_trivial(__first, __last, __result);
-}
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
- const __true_type& /*BothPtrType*/) {
- return __copy_ptrs(__first, __last, __result,
- _UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter),
- _STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
-}
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
- const __false_type& /*BothPtrType*/) {
- return __copy(__first, __last, __result,
- _STLP_ITERATOR_CATEGORY(__first, _InputIter),
- _STLP_DISTANCE_TYPE(__first, _InputIter));
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter copy(_InputIter __first, _InputIter __last, _OutputIter __result) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __copy_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer());
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last,
- _OutputIter __result, const __false_type& /*TrivialAssignment*/) {
- return __copy_backward(__first, __last, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter), _STLP_DISTANCE_TYPE(__first, _InputIter));
-}
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last,
- _OutputIter __result, const __true_type& /*TrivialAssignment*/) {
- return (_OutputIter)__copy_trivial_backward(__first, __last, __result);
-}
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __false_type&) {
- return __copy_backward(__first, __last, __result, _STLP_ITERATOR_CATEGORY(__first,_InputIter), _STLP_DISTANCE_TYPE(__first, _InputIter));
-}
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __true_type&) {
- return __copy_backward_ptrs(__first, __last, __result,
- _UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter),
- _STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter copy_backward(_InputIter __first, _InputIter __last, _OutputIter __result) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- return _STLP_PRIV __copy_backward_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer() );
-}
-
-#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
-# define _STLP_DECLARE_COPY_TRIVIAL(_Tp) \
-inline _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) \
-{ return (_Tp*)__copy_trivial(__first, __last, __result); } \
-inline _Tp* copy_backward(const _Tp* __first, const _Tp* __last, _Tp* __result) \
-{ return (_Tp*)__copy_trivial_backward(__first, __last, __result); }
-
-_STLP_DECLARE_COPY_TRIVIAL(char)
-# if !defined (_STLP_NO_SIGNED_BUILTINS)
-_STLP_DECLARE_COPY_TRIVIAL(signed char)
-# endif
-_STLP_DECLARE_COPY_TRIVIAL(unsigned char)
-_STLP_DECLARE_COPY_TRIVIAL(short)
-_STLP_DECLARE_COPY_TRIVIAL(unsigned short)
-_STLP_DECLARE_COPY_TRIVIAL(int)
-_STLP_DECLARE_COPY_TRIVIAL(unsigned int)
-_STLP_DECLARE_COPY_TRIVIAL(long)
-_STLP_DECLARE_COPY_TRIVIAL(unsigned long)
-# if !defined(_STLP_NO_WCHAR_T) && !defined (_STLP_WCHAR_T_IS_USHORT)
-_STLP_DECLARE_COPY_TRIVIAL(wchar_t)
-# endif
-# if defined (_STLP_LONG_LONG)
-_STLP_DECLARE_COPY_TRIVIAL(_STLP_LONG_LONG)
-_STLP_DECLARE_COPY_TRIVIAL(unsigned _STLP_LONG_LONG)
-# endif
-_STLP_DECLARE_COPY_TRIVIAL(float)
-_STLP_DECLARE_COPY_TRIVIAL(double)
-# if !defined (_STLP_NO_LONG_DOUBLE)
-_STLP_DECLARE_COPY_TRIVIAL(long double)
-# endif
-# undef _STLP_DECLARE_COPY_TRIVIAL
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-//--------------------------------------------------
-// copy_n (not part of the C++ standard)
-
-#if !defined (_STLP_NO_EXTENSIONS)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter, class _Size, class _OutputIter>
-_STLP_INLINE_LOOP pair<_InputIter, _OutputIter>
-__copy_n(_InputIter __first, _Size __count,
- _OutputIter __result,
- const input_iterator_tag &) {
- for ( ; __count > 0; --__count) {
- *__result = *__first;
- ++__first;
- ++__result;
- }
- return pair<_InputIter, _OutputIter>(__first, __result);
-}
-
-template <class _RAIter, class _Size, class _OutputIter>
-inline pair<_RAIter, _OutputIter>
-__copy_n(_RAIter __first, _Size __count,
- _OutputIter __result,
- const random_access_iterator_tag &) {
- _RAIter __last = __first + __count;
- return pair<_RAIter, _OutputIter>(__last, copy(__first, __last, __result));
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter, class _Size, class _OutputIter>
-inline pair<_InputIter, _OutputIter>
-copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
- _STLP_FIX_LITERAL_BUG(__first)
- return _STLP_PRIV __copy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
-}
-#endif
-
-//--------------------------------------------------
-// fill and fill_n
-template <class _ForwardIter, class _Tp>
-_STLP_INLINE_LOOP
-void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- for ( ; __first != __last; ++__first)
- *__first = __val;
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _OutputIter, class _Size, class _Tp>
-_STLP_INLINE_LOOP
-_OutputIter __fill_n(_OutputIter __first, _Size __n, const _Tp& __val) {
- _STLP_FIX_LITERAL_BUG(__first)
- for ( ; __n > 0; --__n, ++__first)
- *__first = __val;
- return __first;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _OutputIter, class _Size, class _Tp>
-_STLP_INLINE_LOOP
-void fill_n(_OutputIter __first, _Size __n, const _Tp& __val) {
- _STLP_FIX_LITERAL_BUG(__first)
- _STLP_PRIV __fill_n(__first, __n, __val);
-}
-
-// Specialization: for one-byte types we can use memset.
-inline void fill(unsigned char* __first, unsigned char* __last,
- const unsigned char& __val) {
- unsigned char __tmp = __val;
- memset(__first, __tmp, __last - __first);
-}
-#if !defined (_STLP_NO_SIGNED_BUILTINS)
-inline void fill(signed char* __first, signed char* __last,
- const signed char& __val) {
- signed char __tmp = __val;
- memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
-}
-#endif
-inline void fill(char* __first, char* __last, const char& __val) {
- char __tmp = __val;
- memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
-}
-
-#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Size>
-inline unsigned char* __fill_n(unsigned char* __first, _Size __n,
- const unsigned char& __val) {
- fill(__first, __first + __n, __val);
- return __first + __n;
-}
-
-template <class _Size>
-inline signed char* __fill_n(char* __first, _Size __n,
- const signed char& __val) {
- fill(__first, __first + __n, __val);
- return __first + __n;
-}
-
-template <class _Size>
-inline char* __fill_n(char* __first, _Size __n, const char& __val) {
- fill(__first, __first + __n, __val);
- return __first + __n;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
-
-
-//--------------------------------------------------
-// equal and mismatch
-
-template <class _InputIter1, class _InputIter2>
-_STLP_INLINE_LOOP
-pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
- _InputIter1 __last1,
- _InputIter2 __first2) {
- _STLP_FIX_LITERAL_BUG(__first2)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- while (__first1 != __last1 && *__first1 == *__first2) {
- ++__first1;
- ++__first2;
- }
- return pair<_InputIter1, _InputIter2>(__first1, __first2);
-}
-
-template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
-_STLP_INLINE_LOOP
-pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
- _InputIter1 __last1,
- _InputIter2 __first2,
- _BinaryPredicate __binary_pred) {
- _STLP_FIX_LITERAL_BUG(__first2)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) {
- ++__first1;
- ++__first2;
- }
- return pair<_InputIter1, _InputIter2>(__first1, __first2);
-}
-
-template <class _InputIter1, class _InputIter2>
-_STLP_INLINE_LOOP
-bool equal(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2) {
- _STLP_FIX_LITERAL_BUG(__first1) _STLP_FIX_LITERAL_BUG(__last1) _STLP_FIX_LITERAL_BUG(__first2)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- for ( ; __first1 != __last1; ++__first1, ++__first2)
- if (!(*__first1 == *__first2))
- return false;
- return true;
-}
-
-template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
-_STLP_INLINE_LOOP
-bool equal(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _BinaryPredicate __binary_pred) {
- _STLP_FIX_LITERAL_BUG(__first2)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- for ( ; __first1 != __last1; ++__first1, ++__first2)
- if (!__binary_pred(*__first1, *__first2))
- return false;
- return true;
-}
-
-//--------------------------------------------------
-// lexicographical_compare and lexicographical_compare_3way.
-// (the latter is not part of the C++ standard.)
-
-template <class _InputIter1, class _InputIter2>
-bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2);
-
-template <class _InputIter1, class _InputIter2, class _Compare>
-bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _Compare __comp);
-
-inline bool
-lexicographical_compare(const unsigned char* __first1,
- const unsigned char* __last1,
- const unsigned char* __first2,
- const unsigned char* __last2) {
- const size_t __len1 = __last1 - __first1;
- const size_t __len2 = __last2 - __first2;
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
-
- const int __result = memcmp(__first1, __first2, (min) (__len1, __len2));
- return __result != 0 ? (__result < 0) : (__len1 < __len2);
-}
-
-
-#if !(CHAR_MAX == SCHAR_MAX)
-inline bool lexicographical_compare(const char* __first1, const char* __last1,
- const char* __first2, const char* __last2) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
-
- return lexicographical_compare((const unsigned char*) __first1,
- (const unsigned char*) __last1,
- (const unsigned char*) __first2,
- (const unsigned char*) __last2);
-}
-#endif /* CHAR_MAX == SCHAR_MAX */
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter1, class _InputIter2>
-int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2);
-
-inline int
-__lexicographical_compare_3way(const unsigned char* __first1,
- const unsigned char* __last1,
- const unsigned char* __first2,
- const unsigned char* __last2) {
- const ptrdiff_t __len1 = __last1 - __first1;
- const ptrdiff_t __len2 = __last2 - __first2;
- const int __result = memcmp(__first1, __first2, (min) (__len1, __len2));
- return __result != 0 ? __result
- : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
-}
-
-
-#if !(CHAR_MAX == SCHAR_MAX)
-inline int
-__lexicographical_compare_3way(const char* __first1, const char* __last1,
- const char* __first2, const char* __last2) {
- return __lexicographical_compare_3way((const unsigned char*) __first1,
- (const unsigned char*) __last1,
- (const unsigned char*) __first2,
- (const unsigned char*) __last2);
-}
-#endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-#if !defined (_STLP_NO_EXTENSIONS)
-template <class _InputIter1, class _InputIter2>
-int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2);
-
-#endif /* EXTENSIONS */
-
-// count
-template <class _InputIter, class _Tp>
-_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter)
-count(_InputIter __first, _InputIter __last, const _Tp& __val) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0;
- for ( ; __first != __last; ++__first)
- if (*__first == __val)
- ++__n;
- return __n;
-}
-
-// find and find_if. Note find may be expressed in terms of find_if if appropriate binder was available.
-template <class _InputIter, class _Tp>
-_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val);
-
-template <class _InputIter, class _Predicate>
-_InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred);
-
-// search.
-template <class _ForwardIter1, class _ForwardIter2, class _BinaryPred>
-_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2, _BinaryPred __predicate);
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// find_first_of
-template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
-_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
- _ForwardIter __first2, _ForwardIter __last2,
- _BinaryPredicate __comp);
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _ForwardIter1, class _ForwardIter2,
- class _BinaryPredicate>
-_ForwardIter1
-find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2,
- _BinaryPredicate __comp);
-
-// replace
-template <class _ForwardIter, class _Tp>
-_STLP_INLINE_LOOP void
-replace(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __old_value, const _Tp& __new_value) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- for ( ; __first != __last; ++__first)
- if (*__first == __old_value)
- *__first = __new_value;
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
-_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val, _Compare1 __comp1, _Compare2 __comp2, _Distance*);
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_algobase.c>
-#endif
-
-#endif /* _STLP_INTERNAL_ALGOBASE_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_alloc.c b/stl/_alloc.c
deleted file mode 100644
index ad6656c..0000000
--- a/stl/_alloc.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_ALLOC_C
-#define _STLP_ALLOC_C
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-# include <stl/_alloc.h>
-#endif
-
-#if defined (__WATCOMC__)
-# pragma warning 13 9
-# pragma warning 367 9
-# pragma warning 368 9
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _Alloc>
-void * _STLP_CALL __debug_alloc<_Alloc>::allocate(size_t __n) {
- size_t __total_extra = __extra_before_chunk() + __extra_after_chunk();
- size_t __real_n = __n + __total_extra;
- if (__real_n < __n) {
- //It means that we rolled on size_t, __n must be very large, lets hope
- //that allocating it will raised a bad_alloc exception:
- __real_n = __n + (__total_extra - __real_n - 1);
- }
- __alloc_header *__result = (__alloc_header *)__allocator_type::allocate(__real_n);
- memset((char*)__result, __shred_byte, __real_n * sizeof(value_type));
- __result->__magic = __magic;
- __result->__type_size = sizeof(value_type);
- __result->_M_size = (_STLP_UINT32_T)__n;
- return ((char*)__result) + (long)__extra_before;
-}
-
-template <class _Alloc>
-void _STLP_CALL
-__debug_alloc<_Alloc>::deallocate(void *__p, size_t __n) {
- __alloc_header * __real_p = (__alloc_header*)((char *)__p -(long)__extra_before);
- // check integrity
- _STLP_VERBOSE_ASSERT(__real_p->__magic != __deleted_magic, _StlMsg_DBA_DELETED_TWICE)
- _STLP_VERBOSE_ASSERT(__real_p->__magic == __magic, _StlMsg_DBA_NEVER_ALLOCATED)
- _STLP_VERBOSE_ASSERT(__real_p->__type_size == 1,_StlMsg_DBA_TYPE_MISMATCH)
- _STLP_VERBOSE_ASSERT(__real_p->_M_size == __n, _StlMsg_DBA_SIZE_MISMATCH)
- // check pads on both sides
- unsigned char* __tmp;
- for (__tmp = (unsigned char*)(__real_p + 1); __tmp < (unsigned char*)__p; ++__tmp) {
- _STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_UNDERRUN)
- }
-
- size_t __real_n = __n + __extra_before_chunk() + __extra_after_chunk();
-
- for (__tmp= ((unsigned char*)__p) + __n * sizeof(value_type);
- __tmp < ((unsigned char*)__real_p) + __real_n ; ++__tmp) {
- _STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_OVERRUN)
- }
-
- // that may be unfortunate, just in case
- __real_p->__magic = __deleted_magic;
- memset((char*)__p, __shred_byte, __n * sizeof(value_type));
- __allocator_type::deallocate(__real_p, __real_n);
-}
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_ALLOC_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_alloc.h b/stl/_alloc.h
deleted file mode 100644
index 48a875d..0000000
--- a/stl/_alloc.h
+++ /dev/null
@@ -1,675 +0,0 @@
-/*
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-#define _STLP_INTERNAL_ALLOC_H
-
-#ifndef _STLP_INTERNAL_CSTDDEF
-# include <stl/_cstddef.h>
-#endif
-
-#if !defined (_STLP_DEBUG_H) && (defined(_STLP_DEBUG) || defined(_STLP_ASSERTIONS) || defined(_STLP_DEBUG_ALLOC))
-# include <stl/debug/_debug.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CSTDLIB
-# include <stl/_cstdlib.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CSTRING
-# include <stl/_cstring.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-#ifndef __THROW_BAD_ALLOC
-# if !defined(_STLP_USE_EXCEPTIONS)
-# ifndef _STLP_INTERNAL_CSTDIO
-# include <stl/_cstdio.h>
-# endif
-# define __THROW_BAD_ALLOC puts("out of memory\n"); exit(1)
-# else
-# define __THROW_BAD_ALLOC throw _STLP_STD::bad_alloc()
-# endif
-#endif
-
-#ifndef _STLP_INTERNAL_NEW_HEADER
-# include <stl/_new.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CONSTRUCT_H
-# include <stl/_construct.h>
-#endif
-
-#if !defined (__ALLOC)
-# define __ALLOC __sgi_alloc
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_USE_RAW_SGI_ALLOCATORS)
-template <class _Tp, class _Alloc> struct __allocator;
-#endif
-
-// Malloc-based allocator. Typically slower than default alloc below.
-// Typically thread-safe and more storage efficient.
-
-#if !defined (_STLP_USE_NO_IOSTREAMS)
-typedef void (* __oom_handler_type)();
-#endif
-
-class _STLP_CLASS_DECLSPEC __malloc_alloc {
-public:
- // this one is needed for proper simple_alloc wrapping
- typedef char value_type;
-#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
- template <class _Tp1> struct rebind {
- typedef __allocator<_Tp1, __malloc_alloc> other;
- };
-#endif
- static void* _STLP_CALL allocate(size_t& __n)
-#if !defined (_STLP_USE_NO_IOSTREAMS)
- ;
-#else
- {
- void *__result = malloc(__n);
-# if defined (_STLP_MALLOC_USABLE_SIZE)
- if (__result != 0) {
- __n = _STLP_MALLOC_USABLE_SIZE(__result);
- }
-# endif
- if (__result == 0) {
- __THROW_BAD_ALLOC;
- }
- return __result;
- }
-#endif
-
- static void _STLP_CALL deallocate(void* __p, size_t /* __n */) { free((char*)__p); }
-#if !defined (_STLP_USE_NO_IOSTREAMS)
- static __oom_handler_type _STLP_CALL set_malloc_handler(__oom_handler_type __f);
-#endif
-};
-
-// New-based allocator. Typically slower than default alloc below.
-// Typically thread-safe and more storage efficient.
-class _STLP_CLASS_DECLSPEC __new_alloc {
-public:
- // this one is needed for proper simple_alloc wrapping
- typedef char value_type;
-#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
- template <class _Tp1> struct rebind {
- typedef __allocator<_Tp1, __new_alloc > other;
- };
-#endif
- static void* _STLP_CALL allocate(size_t __n) { return __stl_new(__n); }
- static void _STLP_CALL deallocate(void* __p, size_t) { __stl_delete(__p); }
-};
-
-
-// Allocator adaptor to check size arguments for debugging.
-// Reports errors using assert. Checking can be disabled with
-// NDEBUG, but it's far better to just use the underlying allocator
-// instead when no checking is desired.
-// There is some evidence that this can confuse Purify.
-// This adaptor can only be applied to raw allocators
-
-template <class _Alloc>
-class __debug_alloc : public _Alloc {
-public:
- typedef _Alloc __allocator_type;
- typedef typename _Alloc::value_type value_type;
-private:
- struct __alloc_header {
- size_t __magic: 16;
- size_t __type_size:16;
- _STLP_UINT32_T _M_size;
- }; // that is 8 bytes for sure
- // Sunpro CC has bug on enums, so extra_before/after set explicitly
- enum { __pad = 8, __magic = 0xdeba, __deleted_magic = 0xdebd,
- __shred_byte = _STLP_SHRED_BYTE };
-
- enum { __extra_before = 16, __extra_after = 8 };
- // Size of space used to store size. Note
- // that this must be large enough to preserve
- // alignment.
- static size_t _STLP_CALL __extra_before_chunk() {
- return (long)__extra_before / sizeof(value_type) +
- (size_t)((long)__extra_before % sizeof(value_type) > 0);
- }
- static size_t _STLP_CALL __extra_after_chunk() {
- return (long)__extra_after / sizeof(value_type) +
- (size_t)((long)__extra_after % sizeof(value_type) > 0);
- }
-public:
-#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
- template <class _Tp1> struct rebind {
- typedef __allocator< _Tp1, __debug_alloc<_Alloc> > other;
- };
-#endif
- __debug_alloc() {}
- ~__debug_alloc() {}
- static void* _STLP_CALL allocate(size_t);
- static void _STLP_CALL deallocate(void *, size_t);
-};
-
-# if defined (__OS400__) || defined (_WIN64)
-enum {_ALIGN = 16, _ALIGN_SHIFT = 4, _MAX_BYTES = 256};
-# else
-enum {_ALIGN = 8, _ALIGN_SHIFT = 3, _MAX_BYTES = 128};
-# endif /* __OS400__ */
-
-#if !defined (_STLP_USE_NO_IOSTREAMS)
-
-# if !defined (_STLP_USE_SIMPLE_NODE_ALLOC)
-// Default node allocator.
-// With a reasonable compiler, this should be roughly as fast as the
-// original STL class-specific allocators, but with less fragmentation.
-// Define _STLP_USE_SIMPLE_NODE_ALLOC to use __new_alloc instead, which
-// can be implemented without out-of-line functions.
-class _STLP_CLASS_DECLSPEC __node_alloc {
- static void * _STLP_CALL _M_allocate(size_t& __n);
- /* __p may not be 0 */
- static void _STLP_CALL _M_deallocate(void *__p, size_t __n);
-
-public:
- // this one is needed for proper simple_alloc wrapping
- typedef char value_type;
-# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_USE_RAW_SGI_ALLOCATORS)
- template <class _Tp1> struct rebind {
- typedef __allocator<_Tp1, __node_alloc> other;
- };
-# endif
- /* __n must be > 0 */
- static void* _STLP_CALL allocate(size_t& __n)
- { return (__n > (size_t)_MAX_BYTES) ? __stl_new(__n) : _M_allocate(__n); }
- /* __p may not be 0 */
- static void _STLP_CALL deallocate(void *__p, size_t __n)
- { if (__n > (size_t)_MAX_BYTES) __stl_delete(__p); else _M_deallocate(__p, __n); }
-};
-
-# if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__node_alloc>;
-# endif
-
-# else /* _STLP_USE_SIMPLE_NODE_ALLOC */
-// Use __new_alloc instead of __node_alloc. This prevents the need for
-// out-of-line _M_allocate and _M_dealloacte functions.
-typedef __new_alloc __node_alloc;
-
-# endif /* _STLP_USE_SIMPLE_NODE_ALLOC */
-
-#endif /* _STLP_USE_NO_IOSTREAMS */
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__new_alloc>;
-_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__malloc_alloc>;
-#endif
-
-/* macro to convert the allocator for initialization
- * not using MEMBER_TEMPLATE_CLASSES as it should work given template constructor */
-#if defined (_STLP_MEMBER_TEMPLATES) || ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-/* if _STLP_NO_TEMPLATE_CONVERSIONS is set, the member template constructor is
- * not used implicitly to convert allocator parameter, so let us do it explicitly */
-# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_NO_TEMPLATE_CONVERSIONS)
-# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
-# else
-# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __a
-# endif
-/* else convert, but only if partial specialization works, since else
- * Container::allocator_type won't be different */
-#else
-# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
-#endif /* _STLP_MEMBER_TEMPLATES || !_STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-// Another allocator adaptor: _Alloc_traits. This serves two
-// purposes. First, make it possible to write containers that can use
-// either SGI-style allocators or standard-conforming allocator.
-
-// The fully general version.
-template <class _Tp, class _Allocator>
-struct _Alloc_traits {
- typedef _Allocator _Orig;
-#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
- typedef typename _Allocator::_STLP_TEMPLATE rebind<_Tp> _Rebind_type;
- typedef typename _Rebind_type::other allocator_type;
- static allocator_type create_allocator(const _Orig& __a)
- { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); }
-#else
- // this is not actually true, used only to pass this type through
- // to dynamic overload selection in _STLP_alloc_proxy methods
- typedef _Allocator allocator_type;
-#endif /* !_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */
-};
-
-#if defined (_STLP_USE_PERTHREAD_ALLOC)
-
-_STLP_END_NAMESPACE
-
-// include additional header here
-# include <stl/_pthread_alloc.h>
-
-_STLP_BEGIN_NAMESPACE
-
-# if defined (_STLP_DEBUG_ALLOC)
-typedef __debug_alloc<__pthread_alloc> __sgi_alloc;
-# else
-typedef __pthread_alloc __sgi_alloc;
-# endif /* _STLP_DEBUG_ALLOC */
-
-typedef __pthread_alloc __single_client_alloc;
-typedef __pthread_alloc __multithreaded_alloc;
-
-#else /* _STLP_USE_PERTHREAD_ALLOC */
-
-# if defined (_STLP_USE_NEWALLOC)
-
-# if defined (_STLP_DEBUG_ALLOC)
-typedef __debug_alloc<__new_alloc> __sgi_alloc;
-# else
-typedef __new_alloc __sgi_alloc;
-# endif /* _STLP_DEBUG_ALLOC */
-
-typedef __new_alloc __single_client_alloc;
-typedef __new_alloc __multithreaded_alloc;
-
-# elif defined (_STLP_USE_MALLOC)
-
-# if defined (_STLP_DEBUG_ALLOC)
-typedef __debug_alloc<__malloc_alloc> __sgi_alloc;
-# else
-typedef __malloc_alloc __sgi_alloc;
-# endif /* _STLP_DEBUG_ALLOC */
-
-typedef __malloc_alloc __single_client_alloc;
-typedef __malloc_alloc __multithreaded_alloc;
-
-# else
-
-# if defined (_STLP_DEBUG_ALLOC)
-typedef __debug_alloc<__node_alloc> __sgi_alloc;
-# else
-typedef __node_alloc __sgi_alloc;
-# endif
-
-typedef __node_alloc __single_client_alloc;
-typedef __node_alloc __multithreaded_alloc;
-
-# endif /* _STLP_USE_NEWALLOC */
-#endif /* _STLP_USE_PERTHREAD_ALLOC */
-
-// This implements allocators as specified in the C++ standard.
-//
-// Note that standard-conforming allocators use many language features
-// that are not yet widely implemented. In particular, they rely on
-// member templates, partial specialization, partial ordering of function
-// templates, the typename keyword, and the use of the template keyword
-// to refer to a template member of a dependent type.
-
-/*
-template <class _Tp>
-struct _AllocatorAux {
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
-
- pointer address(reference __x) const {return &__x;}
- const_pointer address(const_reference __x) const { return &__x; }
-};
-
-template <class _Tp>
-struct _AllocatorAux<const _Tp> {
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
-
- const_pointer address(const_reference __x) const { return &__x; }
-};
-*/
-
-template <class _Tp>
-class allocator //: public _AllocatorAux<_Tp>
-/* A small helper struct to recognize STLport allocator implementation
- * from any user specialization one.
- */
- : public __stlport_class<allocator<_Tp> > {
-public:
- typedef _Tp value_type;
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
- template <class _Tp1> struct rebind {
- typedef allocator<_Tp1> other;
- };
-#endif
- allocator() _STLP_NOTHROW {}
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _Tp1> allocator(const allocator<_Tp1>&) _STLP_NOTHROW {}
-#endif
- allocator(const allocator<_Tp>&) _STLP_NOTHROW {}
- allocator(__move_source<allocator<_Tp> > src) _STLP_NOTHROW {}
- ~allocator() _STLP_NOTHROW {}
- pointer address(reference __x) const {return &__x;}
- const_pointer address(const_reference __x) const { return &__x; }
- // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0.
- _Tp* allocate(size_type __n, const void* = 0) {
- if (__n > max_size()) {
- __THROW_BAD_ALLOC;
- }
- if (__n != 0) {
- size_type __buf_size = __n * sizeof(value_type);
- _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
-#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
- if (__ret != 0) {
- memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
- }
-#endif
- return __ret;
- }
- else
- return 0;
- }
- // __p is permitted to be a null pointer, only if n==0.
- void deallocate(pointer __p, size_type __n) {
- _STLP_ASSERT( (__p == 0) == (__n == 0) )
- if (__p != 0) {
-#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
- memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
-#endif
- __sgi_alloc::deallocate((void*)__p, __n * sizeof(value_type));
- }
- }
- // backwards compatibility
- void deallocate(pointer __p) const { if (__p != 0) __sgi_alloc::deallocate((void*)__p, sizeof(value_type)); }
- size_type max_size() const _STLP_NOTHROW { return size_t(-1) / sizeof(value_type); }
- void construct(pointer __p, const_reference __val) { _STLP_STD::_Copy_Construct(__p, __val); }
- void destroy(pointer __p) { _STLP_STD::_Destroy(__p); }
-#if defined(__MRC__)||(defined(__SC__) && !defined(__DMC__))
- template <class _T2> bool operator==(const allocator<_T2>&) const _STLP_NOTHROW { return true; }
- template <class _T2> bool operator!=(const allocator<_T2>&) const _STLP_NOTHROW { return false; }
-#endif
-
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
- //This is just to make swap workaround for compiler without template function partial
- //happy.
- void swap(allocator<_Tp>&) {}
-#endif
-
-#if defined (_STLP_NO_EXTENSIONS)
- /* STLport extension giving rounded size of an allocated memory buffer
- * This method do not have to be part of a user defined allocator implementation
- * and won't even be called if such a function was granted.
- */
-protected:
-#endif
- _Tp* allocate(size_type __n, size_type& __allocated_n) {
- if (__n > max_size()) {
- __THROW_BAD_ALLOC;
- }
-
- if (__n != 0) {
- size_type __buf_size = __n * sizeof(value_type);
- _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
-#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
- if (__ret != 0) {
- memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
- }
-#endif
- __allocated_n = __buf_size / sizeof(value_type);
- return __ret;
- }
- else
- return 0;
- }
-};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC allocator<void> {
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef void* pointer;
- typedef const void* const_pointer;
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
- typedef void value_type;
-#endif
-#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
- template <class _Tp1> struct rebind {
- typedef allocator<_Tp1> other;
- };
-#endif
-#if defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__)) //*ty 03/24/2001 - MPW compilers get confused on these operator definitions
- template <class _T2> bool operator==(const allocator<_T2>&) const _STLP_NOTHROW { return true; }
- template <class _T2> bool operator!=(const allocator<_T2>&) const _STLP_NOTHROW { return false; }
-#endif
-};
-
-#if !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__))) //*ty 03/24/2001 - MPW compilers get confused on these operator definitions
-template <class _T1, class _T2> inline bool _STLP_CALL operator==(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW { return true; }
-template <class _T1, class _T2> inline bool _STLP_CALL operator!=(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW { return false; }
-#endif
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS allocator<char>;
-# if defined (_STLP_HAS_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS allocator<wchar_t>;
-# endif
-# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-_STLP_EXPORT_TEMPLATE_CLASS allocator<void*>;
-# endif
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Tp>
-struct __alloc_type_traits {
-#if !defined (__BORLANDC__)
- typedef typename _IsSTLportClass<allocator<_Tp> >::_Ret _STLportAlloc;
-#else
- enum { _Is = _IsSTLportClass<allocator<_Tp> >::_Is };
- typedef typename __bool2type<_Is>::_Ret _STLportAlloc;
-#endif
- //The default allocator implementation which is recognize thanks to the
- //__stlport_class inheritance is a stateless object so:
- typedef _STLportAlloc has_trivial_default_constructor;
- typedef _STLportAlloc has_trivial_copy_constructor;
- typedef _STLportAlloc has_trivial_assignment_operator;
- typedef _STLportAlloc has_trivial_destructor;
- typedef _STLportAlloc is_POD_type;
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp>
-struct __type_traits<allocator<_Tp> > : _STLP_PRIV __alloc_type_traits<_Tp> {};
-#else
-_STLP_TEMPLATE_NULL
-struct __type_traits<allocator<char> > : _STLP_PRIV __alloc_type_traits<char> {};
-# if defined (_STLP_HAS_WCHAR_T)
-_STLP_TEMPLATE_NULL
-struct __type_traits<allocator<wchar_t> > : _STLP_PRIV __alloc_type_traits<wchar_t> {};
-# endif
-# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-_STLP_TEMPLATE_NULL
-struct __type_traits<allocator<void*> > : _STLP_PRIV __alloc_type_traits<void*> {};
-# endif
-#endif
-
-
-#if !defined (_STLP_FORCE_ALLOCATORS)
-# define _STLP_FORCE_ALLOCATORS(a,y)
-#endif
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
-// The version for the default allocator, for rare occasion when we have partial spec w/o member template classes
-template <class _Tp, class _Tp1>
-struct _Alloc_traits<_Tp, allocator<_Tp1> > {
- typedef allocator<_Tp1> _Orig;
- typedef allocator<_Tp> allocator_type;
- static allocator_type create_allocator(const allocator<_Tp1 >& __a)
- { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); }
-};
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) && defined (_STLP_MEMBER_TEMPLATES)
-template <class _Tp, class _Alloc>
-inline _STLP_TYPENAME_ON_RETURN_TYPE _Alloc_traits<_Tp, _Alloc>::allocator_type _STLP_CALL
-__stl_alloc_create(const _Alloc& __a, const _Tp*) {
- typedef typename _Alloc::_STLP_TEMPLATE rebind<_Tp>::other _Rebound_type;
- return _Rebound_type(__a);
-}
-#else
-// If custom allocators are being used without member template classes support :
-// user (on purpose) is forced to define rebind/get operations !!!
-template <class _Tp1, class _Tp2>
-inline allocator<_Tp2>& _STLP_CALL
-__stl_alloc_rebind(allocator<_Tp1>& __a, const _Tp2*) { return (allocator<_Tp2>&)(__a); }
-template <class _Tp1, class _Tp2>
-inline allocator<_Tp2> _STLP_CALL
-__stl_alloc_create(const allocator<_Tp1>&, const _Tp2*) { return allocator<_Tp2>(); }
-#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */
-
-#if defined (_STLP_USE_RAW_SGI_ALLOCATORS)
-// move obsolete stuff out of the way
-# include <stl/_alloc_old.h>
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// inheritance is being used for EBO optimization
-template <class _Value, class _Tp, class _MaybeReboundAlloc>
-class _STLP_alloc_proxy : public _MaybeReboundAlloc {
-private:
- typedef _MaybeReboundAlloc _Base;
- typedef typename _Base::size_type size_type;
- typedef _STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc> _Self;
-public:
- _Value _M_data;
-
- _STLP_alloc_proxy (const _MaybeReboundAlloc& __a, _Value __p) :
- _MaybeReboundAlloc(__a), _M_data(__p) {}
-
- _STLP_alloc_proxy (__move_source<_Self> src) :
- _MaybeReboundAlloc(_STLP_PRIV _AsMoveSource<_Base>(src.get())),
- _M_data(_STLP_PRIV _AsMoveSource<_Value>(src.get()._M_data)) {}
-
-private:
- /* Following are helper methods to detect stateless allocators and avoid
- * swap in this case. For some compilers (VC6) it is a workaround for a
- * compiler bug in the Empty Base class Optimization feature, for others
- * it is a small optimization or nothing if no EBO. */
- void _M_swap_alloc(_Self&, const __true_type& /*_IsStateless*/)
- {}
-
- void _M_swap_alloc(_Self& __x, const __false_type& /*_IsStateless*/) {
- _MaybeReboundAlloc &__base_this = *this;
- _MaybeReboundAlloc &__base_x = __x;
- _STLP_STD::swap(__base_this, __base_x);
- }
-
-public:
- void _M_swap_alloc(_Self& __x) {
-#if !defined (__BORLANDC__)
- typedef typename _IsStateless<_MaybeReboundAlloc>::_Ret _StatelessAlloc;
-#else
- typedef typename __bool2type<_IsStateless<_MaybeReboundAlloc>::_Is>::_Ret _StatelessAlloc;
-#endif
- _M_swap_alloc(__x, _StatelessAlloc());
- }
-
- /* We need to define the following swap implementation for allocator with state
- * as those allocators might have implement a special swap function to correctly
- * move datas from an instance to the oher, _STLP_alloc_proxy should not break
- * this mecanism. */
- void swap(_Self& __x) {
- _M_swap_alloc(__x);
- _STLP_STD::swap(_M_data, __x._M_data);
- }
-
- _Tp* allocate(size_type __n, size_type& __allocated_n) {
-#if !defined (__BORLANDC__)
- typedef typename _IsSTLportClass<_MaybeReboundAlloc>::_Ret _STLportAlloc;
-#else
- typedef typename __bool2type<_IsSTLportClass<_MaybeReboundAlloc>::_Is>::_Ret _STLportAlloc;
-#endif
- return allocate(__n, __allocated_n, _STLportAlloc());
- }
-
- // Unified interface to perform allocate()/deallocate() with limited
- // language support
-#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
- // else it is rebound already, and allocate() member is accessible
- _Tp* allocate(size_type __n)
- { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).allocate(__n, 0); }
- void deallocate(_Tp* __p, size_type __n)
- { __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).deallocate(__p, __n); }
-private:
- _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/)
- { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).allocate(__n, __allocated_n); }
-#else
- //Expose Standard allocate overload (using expression do not work for some compilers (Borland))
- _Tp* allocate(size_type __n)
- { return _Base::allocate(__n); }
-private:
- _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/)
- { return _Base::allocate(__n, __allocated_n); }
-#endif
-
- _Tp* allocate(size_type __n, size_type& __allocated_n, const __false_type& /*STLport allocator*/)
- { __allocated_n = __n; return allocate(__n); }
-};
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<char*, char, allocator<char> >;
-# if defined (_STLP_HAS_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<wchar_t*, wchar_t, allocator<wchar_t> >;
-# endif
-# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<void**, void*, allocator<void*> >;
-# endif
-#endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_alloc.c>
-#endif
-
-#endif /* _STLP_INTERNAL_ALLOC_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_alloc_old.h b/stl/_alloc_old.h
deleted file mode 100644
index 4627243..0000000
--- a/stl/_alloc_old.h
+++ /dev/null
@@ -1,287 +0,0 @@
-template<class _Tp, class _Alloc>
-class __simple_alloc {
- typedef _Alloc __alloc_type;
-public:
- typedef typename _Alloc::value_type __alloc_value_type;
- typedef _Tp value_type;
- static size_t _STLP_CALL __chunk(size_t __n) {
- return (sizeof(__alloc_value_type)==sizeof(value_type)) ? __n :
- ((__n*sizeof(value_type)+sizeof(__alloc_value_type)-1)/sizeof(__alloc_value_type));
- }
- static _Tp* _STLP_CALL allocate(size_t __n) { return 0 == __n ? 0 : (_Tp*) __alloc_type::allocate(__chunk(__n)); }
- static void _STLP_CALL deallocate(_Tp * __p, size_t __n) {
- __alloc_type::deallocate((__alloc_value_type*)__p, __chunk(__n)); }
-};
-
-// Allocator adaptor to turn an SGI-style allocator (e.g. alloc, malloc_alloc)
-// into a standard-conforming allocator. Note that this adaptor does
-// *not* assume that all objects of the underlying alloc class are
-// identical, nor does it assume that all of the underlying alloc's
-// member functions are static member functions. Note, also, that
-// __allocator<_Tp, alloc> is essentially the same thing as allocator<_Tp>.
-
-template <class _Tp, class _Alloc>
-struct __allocator : public _Alloc {
- typedef _Alloc __underlying_alloc;
-
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
- typedef _Tp value_type;
-
-# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
- template <class _Tp1> struct rebind {
- typedef __allocator<_Tp1, _Alloc> other;
- };
-# endif
- __allocator() _STLP_NOTHROW {}
- __allocator(const _Alloc& ) _STLP_NOTHROW {}
- __allocator(const __allocator<_Tp, _Alloc>& __a) _STLP_NOTHROW
- : _Alloc(__a) {}
-# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
- template <class _Tp1>
- __allocator(const __allocator<_Tp1, _Alloc>& __a) _STLP_NOTHROW
- : _Alloc(__a) {}
-# endif
-# ifdef _STLP_TRIVIAL_DESTRUCTOR_BUG
- ~__allocator() _STLP_NOTHROW {}
-# endif
- pointer address(reference __x) const { return &__x; }
-
-# if !defined (__WATCOM_CPLUSPLUS__)
- const_pointer address(const_reference __x) const { return &__x; }
-# endif
-
- // __n is permitted to be 0.
- _Tp* allocate(size_type __n, const void* = 0) {
- if (__n > max_size())
- __THROW_BAD_ALLOC;
- return __n != 0
- ? __STATIC_CAST(_Tp*,__underlying_alloc::allocate(__n * sizeof(_Tp)))
- : 0;
- }
-
- // __p is not permitted to be a null pointer.
- void deallocate(pointer __p, size_type __n)
- { if (__p) __underlying_alloc::deallocate(__p, __n * sizeof(_Tp)); }
-
- size_type max_size() const _STLP_NOTHROW
- { return size_t(-1) / sizeof(_Tp); }
-
- void construct(pointer __p, const_reference __val) { _STLP_STD::_Copy_Construct(__p, __val); }
- void destroy(pointer __p) { _STLP_STD::_Destroy(__p); }
-
- const __underlying_alloc& __get_underlying_alloc() const { return *this; }
-};
-
-#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
-template <class _Alloc>
-class __allocator<void, _Alloc> {
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef void* pointer;
- typedef const void* const_pointer;
- typedef void value_type;
-#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
- template <class _Tp1> struct rebind {
- typedef __allocator<_Tp1, _Alloc> other;
- };
-#endif
-};
-#endif
-
-template <class _Tp, class _Alloc>
-inline bool _STLP_CALL operator==(const __allocator<_Tp, _Alloc>& __a1,
- const __allocator<_Tp, _Alloc>& __a2)
-{
- return __a1.__get_underlying_alloc() == __a2.__get_underlying_alloc();
-}
-
-#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-template <class _Tp, class _Alloc>
-inline bool _STLP_CALL operator!=(const __allocator<_Tp, _Alloc>& __a1,
- const __allocator<_Tp, _Alloc>& __a2)
-{
- return __a1.__get_underlying_alloc() != __a2.__get_underlying_alloc();
-}
-#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
-
-
-// Comparison operators for all of the predifined SGI-style allocators.
-// This ensures that __allocator<malloc_alloc> (for example) will
-// work correctly.
-
-#ifndef _STLP_NON_TYPE_TMPL_PARAM_BUG
-inline bool _STLP_CALL operator==(const __malloc_alloc&, const __malloc_alloc&)
-{ return true; }
-
-# ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
-inline bool _STLP_CALL operator!=(const __malloc_alloc&, const __malloc_alloc&)
-{ return false; }
-# endif
-
-inline bool _STLP_CALL operator==(const __new_alloc&, const __new_alloc&) { return true; }
-
-# ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-inline bool _STLP_CALL operator!=(const __new_alloc&, const __new_alloc&) { return false; }
-# endif
-
-# if !defined (_STLP_USE_NO_IOSTREAMS)
-inline bool _STLP_CALL operator==(const __node_alloc&,
- const __node_alloc&)
-{ return true; }
-
-# if defined( _STLP_FUNCTION_TMPL_PARTIAL_ORDER )
-
-inline bool _STLP_CALL operator!=(const __node_alloc&,
- const __node_alloc&)
-{ return false; }
-# endif
-# endif
-
-#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
-
-template <class _Alloc>
-inline bool _STLP_CALL operator==(const __debug_alloc<_Alloc>&, const __debug_alloc<_Alloc>&) { return true; }
-# ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-template <class _Alloc>
-inline bool _STLP_CALL operator!=(const __debug_alloc<_Alloc>&, const __debug_alloc<_Alloc>&) { return false; }
-# endif
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-
-// Versions for the predefined SGI-style allocators.
-template <class _Tp>
-struct _Alloc_traits<_Tp, __malloc_alloc> {
- typedef __allocator<_Tp, __malloc_alloc> allocator_type;
-};
-
-# if !defined (_STLP_USE_NO_IOSTREAMS)
-template <class _Tp>
-struct _Alloc_traits<_Tp, __node_alloc> {
- typedef __allocator<_Tp, __node_alloc> allocator_type;
-};
-# endif
-
-template <class _Tp, class _Alloc>
-struct _Alloc_traits<_Tp, __debug_alloc<_Alloc> > {
- typedef __allocator<_Tp, __debug_alloc<_Alloc> > allocator_type;
-};
-
-// Versions for the __allocator adaptor used with the predefined
-// SGI-style allocators.
-
-template <class _Tp, class _Tp1, class _Alloc>
-struct _Alloc_traits<_Tp, __allocator<_Tp1, _Alloc > > {
- typedef __allocator<_Tp, _Alloc > allocator_type;
-};
-
-#endif
-
-#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
-
-// Versions for the predefined SGI-style allocators.
-
-
-# if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
-
-typedef __malloc_alloc __malloc_alloc_dfl;
-
-template <class _Tp>
-inline __allocator<_Tp, __malloc_alloc_dfl >& _STLP_CALL
-__stl_alloc_rebind(__malloc_alloc_dfl& __a, const _Tp*) {
- return (__allocator<_Tp, __malloc_alloc_dfl >&)__a;
-}
-
-# if !defined (_STLP_USE_NO_IOSTREAMS)
-template <class _Tp>
-inline __allocator<_Tp, __node_alloc>& _STLP_CALL
-__stl_alloc_rebind(__node_alloc& __a, const _Tp*) {
- return (__allocator<_Tp, __node_alloc>&)__a;
-}
-# endif
-
-template <class _Tp>
-inline __allocator<_Tp, __malloc_alloc_dfl > _STLP_CALL
-__stl_alloc_create(const __malloc_alloc_dfl&, const _Tp*) {
- return __allocator<_Tp, __malloc_alloc_dfl > ();
-}
-
-# if !defined (_STLP_USE_NO_IOSTREAMS)
-template <class _Tp>
-inline __allocator<_Tp, __node_alloc> _STLP_CALL
-__stl_alloc_create(const __node_alloc&, const _Tp*) {
- return __allocator<_Tp, __node_alloc>();
-}
-
-# endif
-
-# else
-
-template <class _Tp>
-inline __allocator<_Tp, __malloc_alloc>& _STLP_CALL
-__stl_alloc_rebind(__malloc_alloc& __a, const _Tp*) {
- return (__allocator<_Tp, __malloc_alloc>&)__a;
-}
-
-# if !defined (_STLP_USE_NO_IOSTREAMS)
-template <class _Tp>
-inline __allocator<_Tp, __node_alloc>& _STLP_CALL
-__stl_alloc_rebind(__node_alloc& __a, const _Tp*) {
- return (__allocator<_Tp, __node_alloc>&)__a;
-}
-# endif
-
-template <class _Tp>
-inline __allocator<_Tp, __malloc_alloc> _STLP_CALL
-__stl_alloc_create(const __malloc_alloc&, const _Tp*) {
- return __allocator<_Tp, __malloc_alloc>();
-}
-
-# if !defined (_STLP_USE_NO_IOSTREAMS)
-template <class _Tp>
-inline __allocator<_Tp, __node_alloc> _STLP_CALL
-__stl_alloc_create(const __node_alloc&, const _Tp*) {
- return __allocator<_Tp, __node_alloc>();
-}
-# endif
-
-# endif
-
-template <class _Tp, class _Alloc>
-inline __allocator<_Tp, __debug_alloc<_Alloc> > _STLP_CALL
-__stl_alloc_create(const __debug_alloc<_Alloc>&, const _Tp*) {
- return __allocator<_Tp, __debug_alloc<_Alloc> >();
-}
-template <class _Tp, class _Alloc>
-inline __allocator<_Tp, __debug_alloc<_Alloc> >& _STLP_CALL
-__stl_alloc_rebind(__debug_alloc<_Alloc>& __a, const _Tp*) {
- return (__allocator<_Tp, __debug_alloc<_Alloc> >&)__a;
-}
-
-template <class _Tp>
-inline __allocator<_Tp, __new_alloc > _STLP_CALL
-__stl_alloc_create(const __new_alloc&, const _Tp*) {
- return __allocator<_Tp, __new_alloc >();
-}
-template <class _Tp>
-inline __allocator<_Tp, __new_alloc >& _STLP_CALL
-__stl_alloc_rebind(__new_alloc& __a, const _Tp*) {
- return (__allocator<_Tp, __new_alloc >&)__a;
-}
-
-template <class _Tp1, class _Alloc, class _Tp2>
-inline __allocator<_Tp2, _Alloc>& _STLP_CALL
-__stl_alloc_rebind(__allocator<_Tp1, _Alloc>& __a, const _Tp2*) {
- return (__allocator<_Tp2, _Alloc>&)__a;
-}
-
-template <class _Tp1, class _Alloc, class _Tp2>
-inline __allocator<_Tp2, _Alloc> _STLP_CALL
-__stl_alloc_create(const __allocator<_Tp1, _Alloc>&, const _Tp2*) {
- return __allocator<_Tp2, _Alloc>();
-}
-#endif
diff --git a/stl/_auto_ptr.h b/stl/_auto_ptr.h
deleted file mode 100644
index 715130a..0000000
--- a/stl/_auto_ptr.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 1997-1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_AUTO_PTR_H
-# define _STLP_AUTO_PTR_H
-
-_STLP_BEGIN_NAMESPACE
-// implementation primitive
-class __ptr_base {
-public:
- void* _M_p;
- void __set(const void* p) { _M_p = __CONST_CAST(void*,p); }
- void __set(void* p) { _M_p = p; }
-};
-
-template <class _Tp>
-class auto_ptr_ref {
-public:
- __ptr_base& _M_r;
- _Tp* const _M_p;
-
- auto_ptr_ref(__ptr_base& __r, _Tp* __p) : _M_r(__r), _M_p(__p) { }
-
- _Tp* release() const { _M_r.__set((void*)0); return _M_p; }
-
-private:
- //explicitely defined as private to avoid warnings:
- typedef auto_ptr_ref<_Tp> _Self;
- _Self& operator = (_Self const&);
-};
-
-template<class _Tp>
-class auto_ptr : public __ptr_base {
-public:
- typedef _Tp element_type;
- typedef auto_ptr<_Tp> _Self;
-
- _Tp* release() _STLP_NOTHROW {
- _Tp* __px = this->get();
- this->_M_p = 0;
- return __px;
- }
-
- void reset(_Tp* __px = 0) _STLP_NOTHROW {
- _Tp* __pt = this->get();
- if (__px != __pt)
- delete __pt;
- this->__set(__px);
- }
-
- _Tp* get() const _STLP_NOTHROW
- { return __REINTERPRET_CAST(_Tp*,__CONST_CAST(void*,_M_p)); }
-
-#if !defined (_STLP_NO_ARROW_OPERATOR)
- _Tp* operator->() const _STLP_NOTHROW {
- _STLP_VERBOSE_ASSERT(get()!=0, _StlMsg_AUTO_PTR_NULL)
- return get();
- }
-#endif
- _Tp& operator*() const _STLP_NOTHROW {
- _STLP_VERBOSE_ASSERT(get()!= 0, _StlMsg_AUTO_PTR_NULL)
- return *get();
- }
-
- explicit auto_ptr(_Tp* __px = 0) _STLP_NOTHROW { this->__set(__px); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-# if !defined (_STLP_NO_TEMPLATE_CONVERSIONS)
- template<class _Tp1> auto_ptr(auto_ptr<_Tp1>& __r) _STLP_NOTHROW {
- _Tp* __conversionCheck = __r.release();
- this->__set(__conversionCheck);
- }
-# endif
- template<class _Tp1> auto_ptr<_Tp>& operator=(auto_ptr<_Tp1>& __r) _STLP_NOTHROW {
- _Tp* __conversionCheck = __r.release();
- reset(__conversionCheck);
- return *this;
- }
-#endif
-
- auto_ptr(_Self& __r) _STLP_NOTHROW { this->__set(__r.release()); }
-
- _Self& operator=(_Self& __r) _STLP_NOTHROW {
- reset(__r.release());
- return *this;
- }
-
- ~auto_ptr() _STLP_NOTHROW { /* boris : reset(0) might be better */ delete this->get(); }
-
- auto_ptr(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW
- { this->__set(__r.release()); }
-
- _Self& operator=(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW {
- reset(__r.release());
- return *this;
- }
-
-#if defined(_STLP_MEMBER_TEMPLATES) && !defined(_STLP_NO_TEMPLATE_CONVERSIONS)
- template<class _Tp1> operator auto_ptr_ref<_Tp1>() _STLP_NOTHROW
- { return auto_ptr_ref<_Tp1>(*this, this->get()); }
- template<class _Tp1> operator auto_ptr<_Tp1>() _STLP_NOTHROW
- { return auto_ptr<_Tp1>(release()); }
-#else
- operator auto_ptr_ref<_Tp>() _STLP_NOTHROW
- { return auto_ptr_ref<_Tp>(*this, this->get()); }
-#endif
-};
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_AUTO_PTR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_bvector.h b/stl/_bvector.h
deleted file mode 100644
index 1943eda..0000000
--- a/stl/_bvector.h
+++ /dev/null
@@ -1,837 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_BVECTOR_H
-#define _STLP_INTERNAL_BVECTOR_H
-
-#ifndef _STLP_INTERNAL_VECTOR_H
-# include <stl/_vector.h>
-#endif
-
-#define _STLP_WORD_BIT (int(CHAR_BIT*sizeof(unsigned int)))
-
-_STLP_BEGIN_NAMESPACE
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-struct _Bit_reference {
- unsigned int* _M_p;
- unsigned int _M_mask;
- _Bit_reference(unsigned int* __x, unsigned int __y)
- : _M_p(__x), _M_mask(__y) {}
-
-public:
- _Bit_reference() : _M_p(0), _M_mask(0) {}
-
- operator bool() const {
- return !(!(*_M_p & _M_mask));
- }
- _Bit_reference& operator = (bool __x) {
- if (__x) *_M_p |= _M_mask;
- else *_M_p &= ~_M_mask;
- return *this;
- }
- _Bit_reference& operator = (const _Bit_reference& __x) {
- return *this = bool(__x);
- }
- bool operator == (const _Bit_reference& __x) const {
- return bool(*this) == bool(__x);
- }
- bool operator < (const _Bit_reference& __x) const {
- return !bool(*this) && bool(__x);
- }
-
- _Bit_reference& operator |= (bool __x) {
- if (__x)
- *_M_p |= _M_mask;
- return *this;
- }
- _Bit_reference& operator &= (bool __x) {
- if (!__x)
- *_M_p &= ~_M_mask;
- return *this;
- }
- void flip() { *_M_p ^= _M_mask; }
-};
-
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-inline void swap(_STLP_PRIV _Bit_reference& __x, _STLP_PRIV _Bit_reference& __y) {
- bool __tmp = (bool)__x;
- __x = __y;
- __y = __tmp;
-}
-
-// Might not be very useful but costs nothing!
-_STLP_TEMPLATE_NULL
-struct __type_traits<_STLP_PRIV _Bit_reference> {
- typedef __false_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __false_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __false_type is_POD_type;
-};
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-struct _Bit_iterator_base {
- typedef ptrdiff_t difference_type;
-
- unsigned int* _M_p;
- unsigned int _M_offset;
-
- void _M_bump_up() {
- if (_M_offset++ == _STLP_WORD_BIT - 1) {
- _M_offset = 0;
- ++_M_p;
- }
- }
-
- void _M_bump_down() {
- if (_M_offset-- == 0) {
- _M_offset = _STLP_WORD_BIT - 1;
- --_M_p;
- }
- }
-
- _Bit_iterator_base() : _M_p(0), _M_offset(0) {}
- _Bit_iterator_base(unsigned int* __x, unsigned int __y) : _M_p(__x), _M_offset(__y) {}
-// see comment in doc/README.evc4 and doc/README.evc8
-#if defined(_MSC_VER) && _MSC_VER<=1401 && defined(MIPS) && defined(NDEBUG)
- _Bit_iterator_base( const _Bit_iterator_base& __x) : _M_p(__x._M_p), _M_offset(__x._M_offset) {}
-#endif
- // _Bit_iterator_base& operator = ( const _Bit_iterator_base& __x) { _M_p = __x._M_p ; _M_offset = __x._M_offset ; return *this; }
-
- void _M_advance (difference_type __i) {
- difference_type __n = __i + _M_offset;
- _M_p += __n / _STLP_WORD_BIT;
- __n = __n % _STLP_WORD_BIT;
- if (__n < 0) {
- _M_offset = (unsigned int) __n + _STLP_WORD_BIT;
- --_M_p;
- } else
- _M_offset = (unsigned int) __n;
- }
-
- difference_type _M_subtract(const _Bit_iterator_base& __x) const {
- return _STLP_WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
- }
-};
-
-inline bool _STLP_CALL operator==(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
- return __y._M_p == __x._M_p && __y._M_offset == __x._M_offset;
-}
-inline bool _STLP_CALL operator!=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
- return __y._M_p != __x._M_p || __y._M_offset != __x._M_offset;
-}
-
-inline bool _STLP_CALL operator<(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
- return __x._M_p < __y._M_p || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset);
-}
-
-inline bool _STLP_CALL operator>(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
- return operator <(__y , __x);
-}
-inline bool _STLP_CALL operator<=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
- return !(__y < __x);
-}
-inline bool _STLP_CALL operator>=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
- return !(__x < __y);
-}
-
-template <class _Ref, class _Ptr>
-struct _Bit_iter : public _Bit_iterator_base {
- typedef _Ref reference;
- typedef _Ptr pointer;
- typedef _Bit_iter<_Ref, _Ptr> _Self;
- typedef random_access_iterator_tag iterator_category;
- typedef bool value_type;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
-
- _Bit_iter(unsigned int* __x, unsigned int __y) : _Bit_iterator_base(__x, __y) {}
- _Bit_iter() {}
-
- _Bit_iter(const _Bit_iter<_Bit_reference, _Bit_reference*>& __x):
- _Bit_iterator_base((const _Bit_iterator_base&)__x) {}
-
- // _Self& operator = (const _Bit_iter<_Bit_reference, _Bit_reference*>& __x)
- // { (_Bit_iterator_base&)*this = (const _Bit_iterator_base&)__x; return *this; }
-
- reference operator*() const {
- return _Bit_reference(_M_p, 1UL << _M_offset);
- }
- _Self& operator++() {
- _M_bump_up();
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- _M_bump_up();
- return __tmp;
- }
- _Self& operator--() {
- _M_bump_down();
- return *this;
- }
- _Self operator--(int) {
- _Self __tmp = *this;
- _M_bump_down();
- return __tmp;
- }
- _Self& operator+=(difference_type __i) {
- _M_advance(__i);
- return *this;
- }
- _Self& operator-=(difference_type __i) {
- *this += -__i;
- return *this;
- }
- _Self operator+(difference_type __i) const {
- _Self __tmp = *this;
- return __tmp += __i;
- }
- _Self operator-(difference_type __i) const {
- _Self __tmp = *this;
- return __tmp -= __i;
- }
- difference_type operator-(const _Self& __x) const {
- return _M_subtract(__x);
- }
- reference operator[](difference_type __i) { return *(*this + __i); }
-};
-
-template <class _Ref, class _Ptr>
-inline _Bit_iter<_Ref,_Ptr> _STLP_CALL
-operator+(ptrdiff_t __n, const _Bit_iter<_Ref, _Ptr>& __x) {
- return __x + __n;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Ref, class _Ptr>
-struct __type_traits< _STLP_PRIV _Bit_iter<_Ref, _Ptr> > {
- typedef __false_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __false_type is_POD_type;
-};
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
-inline random_access_iterator_tag iterator_category(const _STLP_PRIV _Bit_iterator_base&)
-{ return random_access_iterator_tag(); }
-inline ptrdiff_t* distance_type(const _STLP_PRIV _Bit_iterator_base&)
-{ return (ptrdiff_t*)0; }
-inline bool* value_type(const _STLP_PRIV _Bit_iter<_STLP_PRIV _Bit_reference, _STLP_PRIV _Bit_reference*>&)
-{ return (bool*)0; }
-inline bool* value_type(const _STLP_PRIV _Bit_iter<bool, const bool*>&)
-{ return (bool*)0; }
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-typedef _Bit_iter<bool, const bool*> _Bit_const_iterator;
-typedef _Bit_iter<_Bit_reference, _Bit_reference*> _Bit_iterator;
-
-// Bit-vector base class, which encapsulates the difference between
-// old SGI-style allocators and standard-conforming allocators.
-template <class _Alloc>
-class _Bvector_base {
- typedef _Bvector_base<_Alloc> _Self;
-public:
- _STLP_FORCE_ALLOCATORS(bool, _Alloc)
- typedef typename _Alloc_traits<bool, _Alloc>::allocator_type allocator_type;
- typedef unsigned int __chunk_type;
- typedef typename _Alloc_traits<__chunk_type,
- _Alloc>::allocator_type __chunk_allocator_type;
- allocator_type get_allocator() const {
- return _STLP_CONVERT_ALLOCATOR((const __chunk_allocator_type&)_M_end_of_storage, bool);
- }
- static allocator_type __get_dfl_allocator() { return allocator_type(); }
-
- _Bvector_base(const allocator_type& __a)
- : _M_start(), _M_finish(), _M_end_of_storage(_STLP_CONVERT_ALLOCATOR(__a, __chunk_type),
- (__chunk_type*)0)
- {}
- _Bvector_base(__move_source<_Self> src)
- : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
- _M_end_of_storage(src.get()._M_end_of_storage) {
- //Make the source destroyable
- src.get()._M_start._M_p = 0;
- }
-
- ~_Bvector_base() {
- _M_deallocate();
- }
-
-protected:
-
- unsigned int* _M_bit_alloc(size_t __n) {
- return _M_end_of_storage.allocate((__n + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT);
- }
- void _M_deallocate() {
- if (_M_start._M_p)
- _M_end_of_storage.deallocate(_M_start._M_p,
- _M_end_of_storage._M_data - _M_start._M_p);
- }
-
- _Bit_iterator _M_start;
- _Bit_iterator _M_finish;
- _STLP_alloc_proxy<__chunk_type*, __chunk_type, __chunk_allocator_type> _M_end_of_storage;
-};
-
-
-// The next few lines are confusing. What we're doing is declaring a
-// partial specialization of vector<T, Alloc> if we have the necessary
-// compiler support. Otherwise, we define a class bit_vector which uses
-// the default allocator.
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_BOOL) && !defined (__SUNPRO_CC)
-# define _STLP_VECBOOL_TEMPLATE
-# define __BVEC_TMPL_HEADER template <class _Alloc>
-#else
-# undef _STLP_VECBOOL_TEMPLATE
-# ifdef _STLP_NO_BOOL
-# define __BVEC_TMPL_HEADER
-# else
-# define __BVEC_TMPL_HEADER _STLP_TEMPLATE_NULL
-# endif
-# if !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__))) //*TY 12/17/2000 -
-# define _Alloc _STLP_DEFAULT_ALLOCATOR(bool)
-# else
-# define _Alloc allocator<bool>
-# endif
-#endif
-
-#if defined (_STLP_DEBUG)
-# define vector _STLP_NON_DBG_NAME(vector)
-#endif
-
-#ifdef _STLP_NO_BOOL
-# define __BVECTOR_QUALIFIED bit_vector
-# define __BVECTOR bit_vector
-#else
-# ifdef _STLP_VECBOOL_TEMPLATE
-# define __BVECTOR_QUALIFIED vector<bool, _Alloc>
-# else
-# define __BVECTOR_QUALIFIED vector<bool, allocator<bool> >
-# endif
-# if defined (_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS)
-# define __BVECTOR __BVECTOR_QUALIFIED
-# else
-# define __BVECTOR vector
-# endif
-#endif
-
-#if !defined (_STLP_DEBUG) || defined (_STLP_NO_BOOL)
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-__BVEC_TMPL_HEADER
-class __BVECTOR_QUALIFIED : public _STLP_PRIV _Bvector_base<_Alloc >
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_DEBUG)
- , public __stlport_class< __BVECTOR_QUALIFIED >
-#endif
-{
- typedef _STLP_PRIV _Bvector_base<_Alloc > _Base;
- typedef __BVECTOR_QUALIFIED _Self;
-public:
- typedef bool value_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _STLP_PRIV _Bit_reference reference;
- typedef bool const_reference;
- typedef _STLP_PRIV _Bit_reference* pointer;
- typedef const bool* const_pointer;
- typedef random_access_iterator_tag _Iterator_category;
-
- typedef _STLP_PRIV _Bit_iterator iterator;
- typedef _STLP_PRIV _Bit_const_iterator const_iterator;
-
- _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
-
-#ifdef _STLP_VECBOOL_TEMPLATE
- typedef typename _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type;
- typedef typename _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type;
-#else
- typedef _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type;
- typedef _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type;
-#endif
-
-protected:
-
- void _M_initialize(size_type __n) {
- unsigned int* __q = this->_M_bit_alloc(__n);
- this->_M_end_of_storage._M_data = __q + (__n + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
- this->_M_start = iterator(__q, 0);
- this->_M_finish = this->_M_start + difference_type(__n);
- }
- void _M_insert_aux(iterator __position, bool __x) {
- if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
- _STLP_PRIV __copy_backward(__position, this->_M_finish, this->_M_finish + 1,
- random_access_iterator_tag(), (difference_type*)0 );
- *__position = __x;
- ++this->_M_finish;
- }
- else {
- size_type __len = size() ? 2 * size() : _STLP_WORD_BIT;
- unsigned int* __q = this->_M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- *__i++ = __x;
- this->_M_finish = copy(__position, end(), __i);
- this->_M_deallocate();
- this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
- this->_M_start = iterator(__q, 0);
- }
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void _M_initialize_range(_InputIterator __first, _InputIterator __last,
- const input_iterator_tag &) {
- this->_M_start = iterator();
- this->_M_finish = iterator();
- this->_M_end_of_storage._M_data = 0;
- for ( ; __first != __last; ++__first)
- push_back(*__first);
- }
-
- template <class _ForwardIterator>
- void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
- const forward_iterator_tag &) {
- size_type __n = distance(__first, __last);
- _M_initialize(__n);
- copy(__first, __last, this->_M_start);
- }
-
- template <class _InputIterator>
- void _M_insert_range(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- const input_iterator_tag &) {
- for ( ; __first != __last; ++__first) {
- __pos = insert(__pos, *__first);
- ++__pos;
- }
- }
-
- template <class _ForwardIterator>
- void _M_insert_range(iterator __position,
- _ForwardIterator __first, _ForwardIterator __last,
- const forward_iterator_tag &) {
- if (__first != __last) {
- size_type __n = distance(__first, __last);
- if (capacity() - size() >= __n) {
- _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n),
- random_access_iterator_tag(), (difference_type*)0 );
- copy(__first, __last, __position);
- this->_M_finish += difference_type(__n);
- }
- else {
- size_type __len = size() + (max)(size(), __n);
- unsigned int* __q = this->_M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- __i = copy(__first, __last, __i);
- this->_M_finish = copy(__position, end(), __i);
- this->_M_deallocate();
- this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
- this->_M_start = iterator(__q, 0);
- }
- }
- }
-
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-public:
- iterator begin() { return this->_M_start; }
- const_iterator begin() const { return this->_M_start; }
- iterator end() { return this->_M_finish; }
- const_iterator end() const { return this->_M_finish; }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(end());
- }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const {
- return const_reverse_iterator(begin());
- }
-
- size_type size() const { return size_type(end() - begin()); }
- size_type max_size() const { return size_type(-1); }
- size_type capacity() const {
- return size_type(const_iterator(this->_M_end_of_storage._M_data, 0) - begin());
- }
- bool empty() const { return begin() == end(); }
- reference operator[](size_type __n)
- { return *(begin() + difference_type(__n)); }
- const_reference operator[](size_type __n) const
- { return *(begin() + difference_type(__n)); }
-
- void _M_range_check(size_type __n) const {
- if (__n >= this->size())
- __stl_throw_range_error("vector<bool>");
- }
-
- reference at(size_type __n)
- { _M_range_check(__n); return (*this)[__n]; }
- const_reference at(size_type __n) const
- { _M_range_check(__n); return (*this)[__n]; }
-
- explicit __BVECTOR(const allocator_type& __a = allocator_type())
- : _STLP_PRIV _Bvector_base<_Alloc >(__a) {}
-
- __BVECTOR(size_type __n, bool __val,
- const allocator_type& __a = allocator_type())
- : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
- _M_initialize(__n);
- fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __val ? ~0 : 0);
- }
-
- explicit __BVECTOR(size_type __n)
- : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) {
- _M_initialize(__n);
- fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), 0);
- }
-
- __BVECTOR(const _Self& __x)
- : _STLP_PRIV _Bvector_base<_Alloc >(__x.get_allocator()) {
- _M_initialize(__x.size());
- copy(__x.begin(), __x.end(), this->_M_start);
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _Integer>
- void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) {
- _M_initialize(__n);
- fill(this->_M_start._M_p, this->_M_end_of_storage._M_data, __x ? ~0 : 0);
- }
-
- template <class _InputIterator>
- void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
- const __false_type&) {
- _M_initialize_range(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
- }
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- __BVECTOR(_InputIterator __first, _InputIterator __last)
- : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_initialize_dispatch(__first, __last, _Integral());
- }
-# endif
- template <class _InputIterator>
- __BVECTOR(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_initialize_dispatch(__first, __last, _Integral());
- }
-#else /* _STLP_MEMBER_TEMPLATES */
- __BVECTOR(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type())
- : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
- size_type __n = distance(__first, __last);
- _M_initialize(__n);
- copy(__first, __last, this->_M_start);
- }
- __BVECTOR(const bool* __first, const bool* __last,
- const allocator_type& __a = allocator_type())
- : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
- size_type __n = distance(__first, __last);
- _M_initialize(__n);
- copy(__first, __last, this->_M_start);
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- __BVECTOR(__move_source<_Self> src)
- : _STLP_PRIV _Bvector_base<_Alloc >(__move_source<_Base>(src.get())) {}
-
- ~__BVECTOR() {}
-
- __BVECTOR_QUALIFIED& operator=(const __BVECTOR_QUALIFIED& __x) {
- if (&__x == this) return *this;
- if (__x.size() > capacity()) {
- this->_M_deallocate();
- _M_initialize(__x.size());
- }
- copy(__x.begin(), __x.end(), begin());
- this->_M_finish = begin() + difference_type(__x.size());
- return *this;
- }
-
- // assign(), a generalized assignment member function. Two
- // versions: one that takes a count, and one that takes a range.
- // The range version is a member template, so we dispatch on whether
- // or not the type is an integer.
-
- void _M_fill_assign(size_t __n, bool __x) {
- if (__n > size()) {
- fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0);
- insert(end(), __n - size(), __x);
- }
- else {
- erase(begin() + __n, end());
- fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0);
- }
- }
- void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&)
- { _M_fill_assign((size_t) __n, (bool) __val); }
-
- template <class _InputIter>
- void _M_assign_dispatch(_InputIter __first, _InputIter __last, const __false_type&)
- { _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
-
- template <class _InputIterator>
- void _M_assign_aux(_InputIterator __first, _InputIterator __last,
- const input_iterator_tag &) {
- iterator __cur = begin();
- for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
- *__cur = *__first;
- if (__first == __last)
- erase(__cur, end());
- else
- insert(end(), __first, __last);
- }
-
- template <class _ForwardIterator>
- void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
- const forward_iterator_tag &) {
- size_type __len = distance(__first, __last);
- if (__len < size())
- erase(copy(__first, __last, begin()), end());
- else {
- _ForwardIterator __mid = __first;
- advance(__mid, size());
- copy(__first, __mid, begin());
- insert(end(), __mid, __last);
- }
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- void reserve(size_type __n) {
- if (capacity() < __n) {
- if (max_size() < __n)
- __stl_throw_length_error("vector<bool>");
- unsigned int* __q = this->_M_bit_alloc(__n);
- _STLP_PRIV _Bit_iterator __z(__q, 0);
- this->_M_finish = copy(begin(), end(), __z);
- this->_M_deallocate();
- this->_M_start = iterator(__q, 0);
- this->_M_end_of_storage._M_data = __q + (__n + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
- }
- }
-
- reference front() { return *begin(); }
- const_reference front() const { return *begin(); }
- reference back() { return *(end() - 1); }
- const_reference back() const { return *(end() - 1); }
- void push_back(bool __x) {
- if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
- *(this->_M_finish) = __x;
- ++this->_M_finish;
- }
- else
- _M_insert_aux(end(), __x);
- }
- void swap(__BVECTOR_QUALIFIED& __x) {
- _STLP_STD::swap(this->_M_start, __x._M_start);
- _STLP_STD::swap(this->_M_finish, __x._M_finish);
- this->_M_end_of_storage.swap(__x._M_end_of_storage);
- }
- iterator insert(iterator __position, bool __x = bool()) {
- difference_type __n = __position - begin();
- if (this->_M_finish._M_p != this->_M_end_of_storage._M_data && __position == end()) {
- *(this->_M_finish) = __x;
- ++this->_M_finish;
- }
- else
- _M_insert_aux(__position, __x);
- return begin() + __n;
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-
- template <class _Integer>
- void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
- const __true_type&) {
- _M_fill_insert(__pos, (size_type) __n, (bool) __x);
- }
-
- template <class _InputIterator>
- void _M_insert_dispatch(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- const __false_type&) {
- _M_insert_range(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
- }
-
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- void insert(iterator __position,
- _InputIterator __first, _InputIterator __last) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_insert_dispatch(__position, __first, __last, _Integral());
- }
-#else /* _STLP_MEMBER_TEMPLATES */
- void insert(iterator __position,
- const_iterator __first, const_iterator __last) {
- if (__first == __last) return;
- size_type __n = distance(__first, __last);
- if (capacity() - size() >= __n) {
- _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n,
- random_access_iterator_tag(), (difference_type*)0 );
- copy(__first, __last, __position);
- this->_M_finish += __n;
- }
- else {
- size_type __len = size() + (max)(size(), __n);
- unsigned int* __q = this->_M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- __i = copy(__first, __last, __i);
- this->_M_finish = copy(__position, end(), __i);
- this->_M_deallocate();
- this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
- this->_M_start = iterator(__q, 0);
- }
- }
-
- void insert(iterator __position, const bool* __first, const bool* __last) {
- if (__first == __last) return;
- size_type __n = distance(__first, __last);
- if (capacity() - size() >= __n) {
- _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n,
- random_access_iterator_tag(), (difference_type*)0 );
- copy(__first, __last, __position);
- this->_M_finish += __n;
- }
- else {
- size_type __len = size() + (max)(size(), __n);
- unsigned int* __q = this->_M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- __i = copy(__first, __last, __i);
- this->_M_finish = copy(__position, end(), __i);
- this->_M_deallocate();
- this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
- this->_M_start = iterator(__q, 0);
- }
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- void _M_fill_insert(iterator __position, size_type __n, bool __x) {
- if (__n == 0) return;
- if (capacity() - size() >= __n) {
- _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n),
- random_access_iterator_tag(), (difference_type*)0 );
- fill(__position, __position + difference_type(__n), __x);
- this->_M_finish += difference_type(__n);
- }
- else {
- size_type __len = size() + (max)(size(), __n);
- unsigned int* __q = this->_M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- fill_n(__i, __n, __x);
- this->_M_finish = copy(__position, end(), __i + difference_type(__n));
- this->_M_deallocate();
- this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
- this->_M_start = iterator(__q, 0);
- }
- }
-
- void insert(iterator __position, size_type __n, bool __x) {
- _M_fill_insert(__position, __n, __x);
- }
-
- void pop_back() {
- --this->_M_finish;
- }
- iterator erase(iterator __position) {
- if (__position + 1 != end())
- copy(__position + 1, end(), __position);
- --this->_M_finish;
- return __position;
- }
- iterator erase(iterator __first, iterator __last) {
- this->_M_finish = copy(__last, end(), __first);
- return __first;
- }
- void resize(size_type __new_size, bool __x = bool()) {
- if (__new_size < size())
- erase(begin() + difference_type(__new_size), end());
- else
- insert(end(), __new_size - size(), __x);
- }
- void flip() {
- for (unsigned int* __p = this->_M_start._M_p; __p != this->_M_end_of_storage._M_data; ++__p)
- *__p = ~*__p;
- }
-
- void clear() { erase(begin(), end()); }
-};
-
-#if defined (_STLP_NO_BOOL) || defined (__HP_aCC) // fixed soon (03/17/2000)
-# define _STLP_TEMPLATE_HEADER __BVEC_TMPL_HEADER
-# define _STLP_TEMPLATE_CONTAINER __BVECTOR_QUALIFIED
-# include <stl/_relops_cont.h>
-# undef _STLP_TEMPLATE_CONTAINER
-# undef _STLP_TEMPLATE_HEADER
-#endif /* NO_BOOL */
-
-#if defined (_STLP_DEBUG) && !defined (_STLP_NO_BOOL)
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-_STLP_END_NAMESPACE
-
-#undef vector
-#undef _Alloc
-#undef _STLP_VECBOOL_TEMPLATE
-#undef __BVECTOR
-#undef __BVECTOR_QUALIFIED
-#undef __BVEC_TMPL_HEADER
-
-#undef _STLP_WORD_BIT
-
-#endif /* _STLP_INTERNAL_BVECTOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_cctype.h b/stl/_cctype.h
deleted file mode 100644
index 935c936..0000000
--- a/stl/_cctype.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_CCTYPE
-#define _STLP_INTERNAL_CCTYPE
-
-#if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(cctype)
-#else
-# include <ctype.h>
-#endif /* _STLP_USE_NEW_C_HEADERS */
-
-#if ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
-# if defined ( _STLP_IMPORT_VENDOR_CSTD )
-_STLP_BEGIN_NAMESPACE
-using _STLP_VENDOR_CSTD::isalnum;
-using _STLP_VENDOR_CSTD::isalpha;
-using _STLP_VENDOR_CSTD::iscntrl;
-using _STLP_VENDOR_CSTD::isdigit;
-using _STLP_VENDOR_CSTD::isgraph;
-using _STLP_VENDOR_CSTD::islower;
-using _STLP_VENDOR_CSTD::isprint;
-using _STLP_VENDOR_CSTD::ispunct;
-using _STLP_VENDOR_CSTD::isspace;
-using _STLP_VENDOR_CSTD::isupper;
-using _STLP_VENDOR_CSTD::isxdigit;
-using _STLP_VENDOR_CSTD::tolower;
-using _STLP_VENDOR_CSTD::toupper;
-_STLP_END_NAMESPACE
-# endif /* _STLP_IMPORT_VENDOR_CSTD*/
-#endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
-
-#endif
diff --git a/stl/_check_config.h b/stl/_check_config.h
deleted file mode 100644
index 9dab3ca..0000000
--- a/stl/_check_config.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// This file is reserved to site configuration purpose
-// and should NEVER be overridden by user
-
-/*
- * Consistency check : if we use SGI iostreams, we have to use consistent
- * thread model (single-threaded or multi-threaded) with the compiled library
- *
- * Default is multithreaded build. If you want to build and use single-threaded
- * STLport, please change _STLP_NOTHREADS configuration setting above and rebuild the library
- *
- */
-
-# if !defined(_STLP_USE_NO_IOSTREAMS) && !defined(_STLP_NO_THREADS) && !defined(_REENTRANT)
-
-# if defined(_MSC_VER) && !defined(__MWERKS__) && !defined (__COMO__) && !defined(_MT)
-# error "Only multi-threaded runtime library may be linked with STLport!"
-# endif
-
-// boris : you may change that to build non-threadsafe STLport library
-# if defined (__BUILDING_STLPORT) /* || defined (_STLP_DEBUG) */
-# define _REENTRANT 1
-# endif
-
-# endif
diff --git a/stl/_clocale.h b/stl/_clocale.h
deleted file mode 100644
index 4ecdee8..0000000
--- a/stl/_clocale.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_CLOCALE
-#define _STLP_INTERNAL_CLOCALE
-
-#if !defined (_STLP_WCE_EVC3)
-
-# if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(clocale)
-# else
-# include _STLP_NATIVE_C_HEADER(locale.h)
-# endif
-
-# if defined (_STLP_IMPORT_VENDOR_CSTD)
-_STLP_BEGIN_NAMESPACE
-using _STLP_VENDOR_CSTD::lconv;
-# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
-using _STLP_VENDOR_CSTD::localeconv;
-using _STLP_VENDOR_CSTD::setlocale;
-# endif
-_STLP_END_NAMESPACE
-# endif
-
-#endif /* !_STLP_WCE_EVC3 */
-
-#endif
diff --git a/stl/_cmath.h b/stl/_cmath.h
deleted file mode 100644
index a715f00..0000000
--- a/stl/_cmath.h
+++ /dev/null
@@ -1,560 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_CMATH
-#define _STLP_INTERNAL_CMATH
-
-/* gcc do not like when a using directive appear after a function
- * declaration. cmath have abs overloads and cstdlib a using directive
- * so cstdlib has to be included first.
- */
-#if defined (__GNUC__) && defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
-#endif
-
-#if defined (_STLP_USE_NEW_C_HEADERS)
-# if defined (_STLP_HAS_NO_NAMESPACES) && !defined (exception)
-# define exception __math_exception
-# endif
-# include _STLP_NATIVE_CPP_C_HEADER(cmath)
-# if defined (_STLP_HAS_NO_NAMESPACES)
-# undef exception
-# endif
-#else
-# include <math.h>
-#endif
-
-#if (defined (__SUNPRO_CC) && (__SUNPRO_CC > 0x500)) || \
- !(defined (__IBMCPP__) && (__IBMCPP__ >= 500) || !(defined(__HP_aCC) && (__HP_aCC >= 30000) ))
-# ifndef _STLP_HAS_NO_NAMESPACES
-namespace std {
-# endif
-extern "C" double hypot(double x, double y);
-# ifndef _STLP_HAS_NO_NAMESPACES
-}
-# endif
-
-#endif
-
-#if defined (__sun) && defined (__GNUC__)
-extern "C" {
- float __cosf(float v);
- float __sinf(float v);
- float __atan2f(float, float);
- float __coshf(float v);
- float __sinhf(float v);
- float __sqrtf(float v);
- float __expf(float v);
- float __logf(float v);
- float __log10f(float v);
-
- long double __cosl(long double v);
- long double __sinl(long double v);
- long double __atan2l(long double, long double);
- long double __coshl(long double v);
- long double __sinhl(long double v);
- long double __sqrtl(long double v);
- long double __expl(long double v);
- long double __logl(long double v);
- long double __log10l(long double v);
-}
-
-extern "C" {
- inline float cosf(float v) { return __cosf(v); }
- inline float sinf(float v) { return __sinf(v); }
- inline float atan2f(float v1, float v2) { return __atan2f(v1,v2); }
- inline float coshf(float v) { return __coshf(v); }
- inline float sinhf(float v) { return __sinhf(v); }
- inline float sqrtf(float v) { return __sqrtf(v); }
- inline float expf(float v) { return __expf(v); }
- inline float logf(float v) { return __logf(v); }
- inline float log10f(float v) { return __log10f(v); }
-
- inline long double cosl(long double v) { return __cosl(v); }
- inline long double sinl(long double v) { return __sinl(v); }
- inline long double atan2l(long double v1, long double v2) { return __atan2l(v1,v2); }
- inline long double coshl(long double v) { return __coshl(v); }
- inline long double sinhl(long double v) { return __sinhl(v); }
- inline long double sqrtl(long double v) { return __sqrtl(v); }
- inline long double expl(long double v) { return __expl(v); }
- inline long double logl(long double v) { return __logl(v); }
- inline long double log10l(long double v) { return __log10l(v); }
-}
-#endif // __sun && __GNUC__
-
-#if defined (__sun)
-extern "C" {
-extern float __acosf(float);
-extern float __asinf(float);
-extern float __atanf(float);
-extern float __atan2f(float, float);
-extern float __ceilf(float);
-extern float __cosf(float);
-extern float __coshf(float);
-extern float __expf(float);
-extern float __fabsf(float);
-extern float __floorf(float);
-extern float __fmodf(float, float);
-extern float __frexpf(float, int *);
-extern float __ldexpf(float, int);
-extern float __logf(float);
-extern float __log10f(float);
-extern float __modff(float, float *);
-extern float __powf(float, float);
-extern float __sinf(float);
-extern float __sinhf(float);
-extern float __sqrtf(float);
-extern float __tanf(float);
-extern float __tanhf(float);
-
-extern long double __acosl(long double);
-extern long double __asinl(long double);
-extern long double __atanl(long double);
-extern long double __atan2l(long double, long double);
-extern long double __ceill(long double);
-extern long double __cosl(long double);
-extern long double __coshl(long double);
-extern long double __expl(long double);
-extern long double __fabsl(long double);
-extern long double __floorl(long double);
-extern long double __fmodl(long double, long double);
-extern long double __frexpl(long double, int *);
-extern long double __ldexpl(long double, int);
-extern long double __logl(long double);
-extern long double __log10l(long double);
-extern long double __modfl(long double, long double *);
-extern long double __powl(long double, long double);
-extern long double __sinl(long double);
-extern long double __sinhl(long double);
-extern long double __sqrtl(long double);
-extern long double __tanl(long double);
-extern long double __tanhl(long double);
-}
-#endif
-
-#if defined (__BORLANDC__)
-# define _STLP_CMATH_FUNC_NAMESPACE _STLP_VENDOR_CSTD
-#else
-# define _STLP_CMATH_FUNC_NAMESPACE
-#endif
-
-#if !defined (__sun) || defined (__GNUC__)
-# define _STLP_MATH_INLINE(float_type, func, cfunc) \
- inline float_type func (float_type x) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x); }
-# define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
- inline float_type func (float_type x, type y) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x, y); }
-# define _STLP_MATH_INLINE_D(float_type, func, cfunc)
-# define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc)
-#else
-# ifdef __SUNPRO_CC
-# define _STLP_MATH_INLINE(float_type, func, cfunc) \
- inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::__##cfunc(x); }
-# define _STLP_MATH_INLINE_D(float_type, func, cfunc) \
- inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::cfunc(x); }
-# define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
- inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::__##cfunc(x,y); }
-# define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc) \
- inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::cfunc(x,y); }
-# else
-# error Unknown compiler for the Sun platform
-# endif
-#endif
-
-/** macros to define math functions
-These macros (having an X somewhere in the name) forward to the C library's
-double functions but cast the arguments and return values to the given type. */
-
-#define _STLP_MATH_INLINEX(__type,func,cfunc) \
- inline __type func (__type x) \
- { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x)); }
-#define _STLP_MATH_INLINE2X(__type1,__type2,func,cfunc) \
- inline __type1 func (__type1 x, __type2 y) \
- { return __STATIC_CAST(__type1, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, y)); }
-#define _STLP_MATH_INLINE2PX(__type,func,cfunc) \
- inline __type func (__type x, __type *y) { \
- double tmp1, tmp2; \
- tmp1 = _STLP_CMATH_FUNC_NAMESPACE::cfunc(__STATIC_CAST(double, x), &tmp2); \
- *y = __STATIC_CAST(__type, tmp2); \
- return __STATIC_CAST(__type, tmp1); \
- }
-#define _STLP_MATH_INLINE2XX(__type,func,cfunc) \
- inline __type func (__type x, __type y) \
- { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, (double)y)); }
-
-
-/** rough characterization of compiler and native C library
-For the compiler, it can either support long double or not. If it doesn't, the
-macro _STLP_NO_LONG_DOUBLE is not defined and we don't define any long double
-overloads.
-For the native C library the question is whether it has variants with an 'f'
-suffix (for float as opposed to double) or an 'l' suffix (for long double). If
-the float variants are missing, _STLP_NO_VENDOR_MATH_F is defined, when the
-long double variants are missing, _STLP_NO_VENDOR_MATH_L is defined. Of course
-the latter doesn't make sense anyway when the compiler already has no long
-double support.
-
-Those two traits determine a) which overloads get defined and b) how they are
-defined.
-
-Meaning of suffixes:
-"" : function returning and taking a float_type
-"2" : function returning a float_type and taking to float_types
-"2P" : function returning a float_type and taking a float_type and a float_type*
-"2PI": function returning a float_type and taking a float_type and an int*
-"2I" : function returning a float_type and taking a float_Type and an int
-*/
-
-#if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_NO_VENDOR_MATH_L) && !defined (_STLP_NO_VENDOR_MATH_F)
- // long double support and both e.g. sinl(long double) and sinf(float)
- // This is the default for a correct and complete native library.
-# define _STLP_DEF_MATH_INLINE(func,cf) \
- _STLP_MATH_INLINE(float,func,cf##f) \
- _STLP_MATH_INLINE_D(double,func,cf) \
- _STLP_MATH_INLINE(long double,func,cf##l)
-# define _STLP_DEF_MATH_INLINE2(func,cf) \
- _STLP_MATH_INLINE2(float,float,func,cf##f) \
- _STLP_MATH_INLINE2_D(double,double,func,cf) \
- _STLP_MATH_INLINE2(long double,long double,func,cf##l)
-# define _STLP_DEF_MATH_INLINE2P(func,cf) \
- _STLP_MATH_INLINE2(float,float *,func,cf##f) \
- _STLP_MATH_INLINE2_D(double,double *,func,cf) \
- _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
-# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
- _STLP_MATH_INLINE2(float,int *,func,cf##f) \
- _STLP_MATH_INLINE2_D(double,int *,func,cf) \
- _STLP_MATH_INLINE2(long double,int *,func,cf##l)
-# define _STLP_DEF_MATH_INLINE2I(func,cf) \
- _STLP_MATH_INLINE2(float,int,func,cf##f) \
- _STLP_MATH_INLINE2_D(double,int,func,cf) \
- _STLP_MATH_INLINE2(long double,int,func,cf##l)
-#else
-# if !defined (_STLP_NO_LONG_DOUBLE)
-# if !defined (_STLP_NO_VENDOR_MATH_F)
- // long double support and e.g. sinf(float) but not e.g. sinl(long double)
-# define _STLP_DEF_MATH_INLINE(func,cf) \
- _STLP_MATH_INLINE(float,func,cf##f) \
- _STLP_MATH_INLINEX(long double,func,cf)
-# define _STLP_DEF_MATH_INLINE2(func,cf) \
- _STLP_MATH_INLINE2(float,float,func,cf##f) \
- _STLP_MATH_INLINE2XX(long double,func,cf)
-# define _STLP_DEF_MATH_INLINE2P(func,cf) \
- _STLP_MATH_INLINE2(float,float *,func,cf##f) \
- _STLP_MATH_INLINE2PX(long double,func,cf)
-# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
- _STLP_MATH_INLINE2(float,int *,func,cf##f) \
- _STLP_MATH_INLINE2X(long double,int *,func,cf)
-# define _STLP_DEF_MATH_INLINE2I(func,cf) \
- _STLP_MATH_INLINE2(float,int,func,cf##f) \
- _STLP_MATH_INLINE2X(long double,int,func,cf)
-# elif !defined (_STLP_NO_VENDOR_MATH_L)
- // long double support and e.g. sinl(long double) but not e.g. sinf(float)
-# define _STLP_DEF_MATH_INLINE(func,cf) \
- _STLP_MATH_INLINEX(float,func,cf) \
- _STLP_MATH_INLINE(long double,func,cf##l)
-# define _STLP_DEF_MATH_INLINE2(func,cf) \
- _STLP_MATH_INLINE2XX(float,func,cf) \
- _STLP_MATH_INLINE2(long double,long double,func,cf##l)
-# define _STLP_DEF_MATH_INLINE2P(func,cf) \
- _STLP_MATH_INLINE2PX(float,func,cf) \
- _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
-# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
- _STLP_MATH_INLINE2X(float,int *,func,cf) \
- _STLP_MATH_INLINE2(long double,int *,func,cf##l)
-# define _STLP_DEF_MATH_INLINE2I(func,cf) \
- _STLP_MATH_INLINE2X(float,int,func,cf) \
- _STLP_MATH_INLINE2(long double,int,func,cf##l)
-# else
-# define _STLP_DEF_MATH_INLINE(func,cf) \
- _STLP_MATH_INLINEX(float,func,cf) \
- _STLP_MATH_INLINEX(long double,func,cf)
-# define _STLP_DEF_MATH_INLINE2(func,cf) \
- _STLP_MATH_INLINE2XX(float,func,cf) \
- _STLP_MATH_INLINE2XX(long double,func,cf)
-# define _STLP_DEF_MATH_INLINE2P(func,cf) \
- _STLP_MATH_INLINE2PX(float,func,cf) \
- _STLP_MATH_INLINE2PX(long double,func,cf)
-# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
- _STLP_MATH_INLINE2X(float,int *,func,cf) \
- _STLP_MATH_INLINE2X(long double,int *,func,cf)
-# define _STLP_DEF_MATH_INLINE2I(func,cf) \
- _STLP_MATH_INLINE2X(float,int,func,cf) \
- _STLP_MATH_INLINE2X(long double,int,func,cf)
-# endif
-# else
-# if !defined (_STLP_NO_VENDOR_MATH_F)
-# define _STLP_DEF_MATH_INLINE(func,cf) \
- _STLP_MATH_INLINE(float,func,cf##f)
-# define _STLP_DEF_MATH_INLINE2(func,cf) \
- _STLP_MATH_INLINE2(float,float,func,cf##f)
-# define _STLP_DEF_MATH_INLINE2P(func,cf) \
- _STLP_MATH_INLINE2(float,float *,func,cf##f)
-# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
- _STLP_MATH_INLINE2(float,int *,func,cf##f)
-# define _STLP_DEF_MATH_INLINE2I(func,cf) \
- _STLP_MATH_INLINE2(float,int,func,cf##f)
-# else // _STLP_NO_VENDOR_MATH_F
- // neither long double support nor e.g. sinf(float) functions
-# define _STLP_DEF_MATH_INLINE(func,cf) \
- _STLP_MATH_INLINEX(float,func,cf)
-# define _STLP_DEF_MATH_INLINE2(func,cf) \
- _STLP_MATH_INLINE2XX(float,func,cf)
-# define _STLP_DEF_MATH_INLINE2P(func,cf) \
- _STLP_MATH_INLINE2PX(float,func,cf)
-# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
- _STLP_MATH_INLINE2X(float,int *,func,cf)
-# define _STLP_DEF_MATH_INLINE2I(func,cf) \
- _STLP_MATH_INLINE2X(float,int,func,cf)
-# endif // _STLP_NO_VENDOR_MATH_F
-# endif
-#endif
-
-#if defined (_STLP_WCE) || \
- (defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) && defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */)
-/*
- * dums: VC6 has all the required C++ functions but only define them if
- * _MSC_EXTENSIONS is not defined (a bug?). STLport just do the same
- * thing also when _MSC_EXTENSIONS is defined.
- * TODO: above check (_STLP_MSVC <= 1300) also catches VC7.0, is that intended?
- */
-//We have to tell the compilers that abs, acos ... math functions are not intrinsic
-//otherwise we have Internal Compiler Error in release mode...
-# pragma warning(push)
-# pragma warning(disable: 4162) // no function with C linkage found
-# pragma warning(disable: 4163) // not available as an intrinsic function
-# pragma function (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
-# if defined (_STLP_WCE)
-# pragma function (ceil, floor)
-# endif
-# define _STLP_RESTORE_FUNCTION_INTRINSIC
-#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
-
-#if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
-/* In this config Borland native lib only define functions in std namespace.
- * In order to have all overloads in STLport namespace we need to add the
- * double overload in global namespace. We do not use a using statement to avoid
- * import of invalid overload.
- */
-# define _STLP_DMATH_INLINE(func) _STLP_MATH_INLINE(double, func, func)
-# define _STLP_DMATH_INLINE2(func) _STLP_MATH_INLINE2(double, double, func, func)
-
-_STLP_DMATH_INLINE(acos)
-_STLP_DMATH_INLINE(asin)
-_STLP_DMATH_INLINE(atan)
-_STLP_DMATH_INLINE2(atan2)
-_STLP_DMATH_INLINE(ceil)
-_STLP_DMATH_INLINE(cos)
-_STLP_DMATH_INLINE(cosh)
-_STLP_DMATH_INLINE(exp)
-_STLP_DMATH_INLINE(fabs)
-_STLP_DMATH_INLINE(floor)
-_STLP_DMATH_INLINE2(fmod)
-_STLP_MATH_INLINE2X(double, int*, frexp, frexp)
-_STLP_MATH_INLINE2X(double, int, ldexp, ldexp)
-_STLP_DMATH_INLINE(log)
-_STLP_DMATH_INLINE(log10)
-_STLP_MATH_INLINE2PX(double, modf, modf)
-_STLP_DMATH_INLINE(sin)
-_STLP_DMATH_INLINE(sinh)
-_STLP_DMATH_INLINE(sqrt)
-_STLP_DMATH_INLINE(tan)
-_STLP_DMATH_INLINE(tanh)
-_STLP_DMATH_INLINE2(pow)
-_STLP_DMATH_INLINE2(hypot)
-
-# undef _STLP_DMATH_INLINE
-# undef _STLP_DMATH_INLINE2
-#endif
-
-#if defined (__DMC__)
-# if defined (fabs)
-inline double __stlp_fabs(double __x) { return fabs(__x); }
-# undef fabs
-inline double fabs(double __x) { return __stlp_fabs(__x); }
-# endif
-# if defined (cos)
-inline double __stlp_cos(double __x) { return cos(__x); }
-# undef cos
-inline double cos(double __x) { return __stlp_cos(__x); }
-# endif
-# if defined (sin)
-inline double __stlp_sin(double __x) { return sin(__x); }
-# undef sin
-inline double sin(double __x) { return __stlp_sin(__x); }
-# endif
-# if defined (sqrt)
-inline double __stlp_sqrt(double __x) { return sqrt(__x); }
-# undef sqrt
-inline double sqrt(double __x) { return __stlp_sqrt(__x); }
-# endif
-# if defined (ldexp)
-inline double __stlp_ldexp(double __x, int __y) { return ldexp(__x, __y); }
-# undef ldexp
-inline double ldexp(double __x, int __y) { return __stlp_ldexp(__x, __y); }
-# endif
-#endif
-
-/* MSVC native lib starting with .Net 2003 has already all math functions
- * in global namespace.
- * HP-UX native lib has math functions in the global namespace.
- */
-#if (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)) && \
- (!defined (__HP_aCC) || (__HP_aCC < 30000))
-inline double abs(double __x)
-{ return ::fabs(__x); }
-# if !defined (__MVS__)
-_STLP_DEF_MATH_INLINE(abs, fabs)
-# else // __MVS__ has native long double abs?
-inline float abs(float __x) { return ::fabsf(__x); }
-# endif
-
-_STLP_DEF_MATH_INLINE(acos, acos)
-_STLP_DEF_MATH_INLINE(asin, asin)
-_STLP_DEF_MATH_INLINE(atan, atan)
-_STLP_DEF_MATH_INLINE2(atan2, atan2)
-_STLP_DEF_MATH_INLINE(ceil, ceil)
-_STLP_DEF_MATH_INLINE(cos, cos)
-_STLP_DEF_MATH_INLINE(cosh, cosh)
-_STLP_DEF_MATH_INLINE(exp, exp)
-_STLP_DEF_MATH_INLINE(fabs, fabs)
-_STLP_DEF_MATH_INLINE(floor, floor)
-_STLP_DEF_MATH_INLINE2(fmod, fmod)
-_STLP_DEF_MATH_INLINE2PI(frexp, frexp)
-_STLP_DEF_MATH_INLINE2I(ldexp, ldexp)
-_STLP_DEF_MATH_INLINE(log, log)
-_STLP_DEF_MATH_INLINE(log10, log10)
-_STLP_DEF_MATH_INLINE2P(modf, modf)
-_STLP_DEF_MATH_INLINE(sin, sin)
-_STLP_DEF_MATH_INLINE(sinh, sinh)
-_STLP_DEF_MATH_INLINE(sqrt, sqrt)
-_STLP_DEF_MATH_INLINE(tan, tan)
-_STLP_DEF_MATH_INLINE(tanh, tanh)
-_STLP_DEF_MATH_INLINE2(pow, pow)
-
-# if !defined(_STLP_MSVC) /* || (_STLP_MSVC > 1300) */ || defined(_STLP_WCE) || !defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */
-# ifndef _STLP_NO_VENDOR_MATH_F
-# ifndef __sun
-inline float pow(float __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powf(__x, __STATIC_CAST(float,__y)); }
-# else
-inline float pow(float __x, int __y) { return ::__powf(__x, __STATIC_CAST(float,__y)); }
-# endif
-# else
-inline float pow(float __x, int __y) { return __STATIC_CAST(float, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(float,__y))); }
-# endif
-inline double pow(double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(double,__y)); }
-# if !defined (_STLP_NO_LONG_DOUBLE)
-# if !defined(_STLP_NO_VENDOR_MATH_L)
-# ifndef __sun
-inline long double pow(long double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powl(__x, __STATIC_CAST(long double,__y)); }
-# else
-# ifndef __SUNPRO_CC
-inline long double pow(long double __x, int __y) { return ::__powl(__x, __STATIC_CAST(long double,__y)); }
-# else
-inline long double pow(long double __x, int __y) { return _STLP_VENDOR_CSTD::__powl(__x, __STATIC_CAST(long double,__y)); }
-# endif
-# endif
-# else
-inline long double pow(long double __x, int __y) { return __STATIC_CAST(long double, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(long double,__y))); }
-# endif
-# endif
-# else
-//The MS native pow version has a bugged overload so it is not imported
-//in the STLport namespace.
-//Here is the bugged version:
-//inline double pow(int __x, int __y) { return (_Pow_int(__x, __y)); }
-inline double pow(double __x, int __y) { return (_Pow_int(__x, __y)); }
-inline float pow(float __x, int __y) { return (_Pow_int(__x, __y)); }
-inline long double pow(long double __x, int __y) { return (_Pow_int(__x, __y)); }
-# endif
-#endif
-
-#if (defined (_STLP_MSVC) && !defined (_STLP_WCE)) || defined (__ICL) || defined (__sun)
-# if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
-# pragma warning (push)
-# pragma warning (disable : 4996) // hypot is deprecated.
-# endif
-_STLP_MATH_INLINE2XX(float, hypot, hypot)
-inline long double hypot(long double x, long double y) { return sqrt(x * x + y * y); }
-# if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
-# pragma warning (pop)
-# endif
-#else
-# if defined (_STLP_USE_UCLIBC)
-inline double hypot(double x, double y) { return sqrt(x * x + y * y); }
-_STLP_DEF_MATH_INLINE2(hypot, hypot)
-# elif defined (_STLP_WCE)
- /* CE has a double _hypot(double,double) which we use */
-inline double hypot(double __x, double __y) { return _hypot(__x,__y); }
-_STLP_DEF_MATH_INLINE2(hypot, _hypot)
-# endif
-#endif
-
-#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
-//restoration of the default intrinsic status of those functions:
-# pragma intrinsic (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
-# if defined (_STLP_WCE)
-# pragma intrinsic (ceil, floor)
-# endif
-# pragma warning(pop)
-# undef _STLP_RESTORE_FUNCTION_INTRINSIC
-#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
-
-/* C++ Standard is unclear about several call to 'using ::func' if new overloads
- * of ::func appears between 2 successive 'using' calls. To avoid this potential
- * problem we provide all abs overload before the 'using' call.
- * Beware: This header inclusion has to be after all abs overload of this file.
- * The first 'using ::abs' call is going to be in the other header.
- */
-#ifndef _STLP_INTERNAL_CSTDLIB
-# include <stl/_cstdlib.h>
-#endif
-
-#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
-_STLP_BEGIN_NAMESPACE
-using ::abs;
-using ::acos;
-using ::asin;
-using ::atan;
-using ::atan2;
-using ::ceil;
-using ::cos;
-using ::cosh;
-using ::exp;
-using ::fabs;
-using ::floor;
-using ::fmod;
-using ::frexp;
-using ::hypot;
-using ::ldexp;
-using ::log;
-using ::log10;
-using ::modf;
-using ::pow;
-using ::sin;
-using ::sinh;
-using ::sqrt;
-using ::tan;
-using ::tanh;
-_STLP_END_NAMESPACE
-# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x560)
-using _STLP_VENDOR_CSTD::_ecvt;
-using _STLP_VENDOR_CSTD::_fcvt;
-# endif
-#endif
-
-#endif /* _STLP_INTERNAL_CMATH */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_codecvt.h b/stl/_codecvt.h
deleted file mode 100644
index caee7f3..0000000
--- a/stl/_codecvt.h
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// WARNING: This is an internal header file, included by other C++
-// standard library headers. You should not attempt to use this header
-// file directly.
-
-
-#ifndef _STLP_INTERNAL_CODECVT_H
-#define _STLP_INTERNAL_CODECVT_H
-
-#ifndef _STLP_C_LOCALE_H
-# include <stl/c_locale.h>
-#endif
-
-#ifndef _STLP_INTERNAL_LOCALE_H
-# include <stl/_locale.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-class _STLP_CLASS_DECLSPEC codecvt_base {
-public:
- enum result {ok, partial, error, noconv};
-};
-
-template <class _InternT, class _ExternT, class _StateT>
-class codecvt : public locale::facet, public codecvt_base {
-public:
- typedef _InternT intern_type;
- typedef _ExternT extern_type;
- typedef _StateT state_type;
-
-#if defined (_STLP_MSVC) && (_STLP_MSVC < 1300)
- /* For the moment VC6 do not support this facet default implementation
- * because of the static locale::id instance. When VC6 see this definition
- * it goes crasy with locale::id static instances and all the has_facet tests
- * unit tests are failing.
- */
-};
-#else
- explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
-
- result out(state_type& __state,
- const intern_type* __from,
- const intern_type* __from_end,
- const intern_type*& __from_next,
- extern_type* __to,
- extern_type* __to_limit,
- extern_type*& __to_next) const {
- return do_out(__state,
- __from, __from_end, __from_next,
- __to, __to_limit, __to_next);
- }
-
- result unshift(state_type& __state,
- extern_type* __to,
- extern_type* __to_limit,
- extern_type*& __to_next) const {
- return do_unshift(__state, __to, __to_limit, __to_next);
- }
-
- result in(state_type& __state,
- const extern_type* __from,
- const extern_type* __from_end,
- const extern_type*& __from_next,
- intern_type* __to,
- intern_type* __to_limit,
- intern_type*& __to_next) const {
- return do_in(__state,
- __from, __from_end, __from_next,
- __to, __to_limit, __to_next);
- }
-
- int encoding() const _STLP_NOTHROW { return do_encoding(); }
-
- bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
-
- int length(const state_type& __state,
- const extern_type* __from,
- const extern_type* __end,
- size_t __max) const {
- return do_length(__state, __from, __end, __max);
- }
-
- int max_length() const _STLP_NOTHROW { return do_max_length(); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- ~codecvt() {}
-
- virtual result do_out(state_type&,
- const intern_type* __from,
- const intern_type*,
- const intern_type*& __from_next,
- extern_type* __to,
- extern_type*,
- extern_type*& __to_next) const
- { __from_next = __from; __to_next = __to; return noconv; }
-
- virtual result do_in (state_type&,
- const extern_type* __from,
- const extern_type*,
- const extern_type*& __from_next,
- intern_type* __to,
- intern_type*,
- intern_type*& __to_next) const
- { __from_next = __from; __to_next = __to; return noconv; }
-
- virtual result do_unshift(state_type&,
- extern_type* __to,
- extern_type*,
- extern_type*& __to_next) const
- { __to_next = __to; return noconv; }
-
- virtual int do_encoding() const _STLP_NOTHROW
- { return 1; }
-
- virtual bool do_always_noconv() const _STLP_NOTHROW
- { return true; }
-
- virtual int do_length(const state_type&,
- const extern_type* __from,
- const extern_type* __end,
- size_t __max) const
- { return (int)(min) ( __STATIC_CAST(size_t, (__end - __from)), __max); }
-
- virtual int do_max_length() const _STLP_NOTHROW
- { return 1; }
-
-private:
- codecvt(const codecvt<intern_type, extern_type, state_type>&);
- codecvt<intern_type, extern_type, state_type>& operator = (const codecvt<intern_type, extern_type, state_type>&);
-};
-
-# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
-# if (_STLP_STATIC_TEMPLATE_DATA > 0)
-# if !defined (__BORLANDC__)
-template <class _InternT, class _ExternT, class _StateT>
-locale::id codecvt<_InternT, _ExternT, _StateT>::id;
-# endif
-# endif
-# endif
-#endif
-
-template <class _InternT, class _ExternT, class _StateT>
-class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> {};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC codecvt<char, char, mbstate_t>
- : public locale::facet, public codecvt_base
-{
- friend class _Locale_impl;
-
-public:
- typedef char intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
-
- result out(mbstate_t& __state,
- const char* __from,
- const char* __from_end,
- const char*& __from_next,
- char* __to,
- char* __to_limit,
- char*& __to_next) const {
- return do_out(__state,
- __from, __from_end, __from_next,
- __to, __to_limit, __to_next);
- }
-
- result unshift(mbstate_t& __state,
- char* __to, char* __to_limit, char*& __to_next) const
- { return do_unshift(__state, __to, __to_limit, __to_next); }
-
- result in(state_type& __state,
- const char* __from,
- const char* __from_end,
- const char*& __from_next,
- char* __to,
- char* __to_limit,
- char*& __to_next) const {
- return do_in(__state,
- __from, __from_end, __from_next,
- __to, __to_limit, __to_next);
- }
-
- int encoding() const _STLP_NOTHROW { return do_encoding(); }
-
- bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
-
- int length(const state_type& __state,
- const char* __from, const char* __end,
- size_t __max) const
- { return do_length(__state, __from, __end, __max); }
-
- int max_length() const _STLP_NOTHROW { return do_max_length(); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- ~codecvt();
-
- virtual result do_out(mbstate_t& /* __state */,
- const char* __from,
- const char* /* __from_end */,
- const char*& __from_next,
- char* __to,
- char* /* __to_limit */,
- char*& __to_next) const;
-
- virtual result do_in (mbstate_t& /* __state */ ,
- const char* __from,
- const char* /* __from_end */,
- const char*& __from_next,
- char* __to,
- char* /* __to_end */,
- char*& __to_next) const;
-
- virtual result do_unshift(mbstate_t& /* __state */,
- char* __to,
- char* /* __to_limit */,
- char*& __to_next) const;
-
- virtual int do_encoding() const _STLP_NOTHROW;
- virtual bool do_always_noconv() const _STLP_NOTHROW;
- virtual int do_length(const mbstate_t& __state,
- const char* __from,
- const char* __end,
- size_t __max) const;
- virtual int do_max_length() const _STLP_NOTHROW;
-private:
- codecvt(const codecvt<char, char, mbstate_t>&);
- codecvt<char, char, mbstate_t>& operator =(const codecvt<char, char, mbstate_t>&);
-};
-
-# ifndef _STLP_NO_WCHAR_T
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC codecvt<wchar_t, char, mbstate_t>
- : public locale::facet, public codecvt_base
-{
- friend class _Locale_impl;
-public:
- typedef wchar_t intern_type;
- typedef char extern_type;
- typedef mbstate_t state_type;
-
- explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
-
- result out(mbstate_t& __state,
- const wchar_t* __from,
- const wchar_t* __from_end,
- const wchar_t*& __from_next,
- char* __to,
- char* __to_limit,
- char*& __to_next) const {
- return do_out(__state,
- __from, __from_end, __from_next,
- __to, __to_limit, __to_next);
- }
-
- result unshift(mbstate_t& __state,
- char* __to, char* __to_limit, char*& __to_next) const {
- return do_unshift(__state, __to, __to_limit, __to_next);
- }
-
- result in(mbstate_t& __state,
- const char* __from,
- const char* __from_end,
- const char*& __from_next,
- wchar_t* __to,
- wchar_t* __to_limit,
- wchar_t*& __to_next) const {
- return do_in(__state,
- __from, __from_end, __from_next,
- __to, __to_limit, __to_next);
- }
-
- int encoding() const _STLP_NOTHROW { return do_encoding(); }
-
- bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
-
- int length(const mbstate_t& __state,
- const char* __from, const char* __end,
- size_t __max) const
- { return do_length(__state, __from, __end, __max); }
-
- int max_length() const _STLP_NOTHROW { return do_max_length(); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- ~codecvt();
-
- virtual result do_out(mbstate_t& __state,
- const wchar_t* __from,
- const wchar_t* __from_end,
- const wchar_t*& __from_next,
- char* __to,
- char* __to_limit,
- char*& __to_next) const;
-
- virtual result do_in (mbstate_t& __state,
- const char* __from,
- const char* __from_end,
- const char*& __from_next,
- wchar_t* __to,
- wchar_t* __to_limit,
- wchar_t*& __to_next) const;
-
- virtual result do_unshift(mbstate_t& __state,
- char* __to,
- char* __to_limit,
- char*& __to_next) const;
-
- virtual int do_encoding() const _STLP_NOTHROW;
-
- virtual bool do_always_noconv() const _STLP_NOTHROW;
-
- virtual int do_length(const mbstate_t& __state,
- const char* __from,
- const char* __end,
- size_t __max) const;
-
- virtual int do_max_length() const _STLP_NOTHROW;
-
-private:
- codecvt(const codecvt<wchar_t, char, mbstate_t>&);
- codecvt<wchar_t, char, mbstate_t>& operator = (const codecvt<wchar_t, char, mbstate_t>&);
-};
-
-# endif
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC codecvt_byname<char, char, mbstate_t>
- : public codecvt<char, char, mbstate_t> {
-public:
- explicit codecvt_byname(const char* __name, size_t __refs = 0);
- ~codecvt_byname();
-private:
- codecvt_byname(const codecvt_byname<char, char, mbstate_t>&);
- codecvt_byname<char, char, mbstate_t>& operator =(const codecvt_byname<char, char, mbstate_t>&);
-};
-
-# ifndef _STLP_NO_WCHAR_T
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC codecvt_byname<wchar_t, char, mbstate_t>
- : public codecvt<wchar_t, char, mbstate_t>
-{
-public:
- explicit codecvt_byname(const char * __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
-
-protected:
- ~codecvt_byname();
-
- virtual result do_out(mbstate_t& __state,
- const wchar_t* __from,
- const wchar_t* __from_end,
- const wchar_t*& __from_next,
- char* __to,
- char* __to_limit,
- char*& __to_next) const;
-
- virtual result do_in (mbstate_t& __state,
- const char* __from,
- const char* __from_end,
- const char*& __from_next,
- wchar_t* __to,
- wchar_t* __to_limit,
- wchar_t*& __to_next) const;
-
- virtual result do_unshift(mbstate_t& __state,
- char* __to,
- char* __to_limit,
- char*& __to_next) const;
-
- virtual int do_encoding() const _STLP_NOTHROW;
-
- virtual bool do_always_noconv() const _STLP_NOTHROW;
-
- virtual int do_length(const mbstate_t& __state,
- const char* __from,
- const char* __end,
- size_t __max) const;
-
- virtual int do_max_length() const _STLP_NOTHROW;
-
-private:
- _Locale_ctype* _M_ctype;
- codecvt_byname(const codecvt_byname<wchar_t, char, mbstate_t>&);
- codecvt_byname<wchar_t, char, mbstate_t>& operator =(const codecvt_byname<wchar_t, char, mbstate_t>&);
-};
-
-# endif
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_CODECVT_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_collate.h b/stl/_collate.h
deleted file mode 100644
index 63e8f67..0000000
--- a/stl/_collate.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// WARNING: This is an internal header file, included by other C++
-// standard library headers. You should not attempt to use this header
-// file directly.
-
-#ifndef _STLP_INTERNAL_COLLATE_H
-#define _STLP_INTERNAL_COLLATE_H
-
-#ifndef _STLP_C_LOCALE_H
-# include <stl/c_locale.h>
-#endif
-
-#ifndef _STLP_INTERNAL_LOCALE_H
-# include <stl/_locale.h>
-#endif
-
-#ifndef _STLP_INTERNAL_STRING_H
-# include <stl/_string.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _CharT> class collate {};
-template <class _CharT> class collate_byname {};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC collate<char> : public locale::facet
-{
- friend class _Locale_impl;
-
-public:
- typedef char char_type;
- typedef string string_type;
-
- explicit collate(size_t __refs = 0) : locale::facet(__refs) {}
-
- int compare(const char* __low1, const char* __high1,
- const char* __low2, const char* __high2) const {
- return do_compare( __low1, __high1, __low2, __high2);
- }
-
- string_type transform(const char* __low, const char* __high) const {
- return do_transform(__low, __high);
- }
-
- long hash(const char* __low, const char* __high) const
- { return do_hash(__low, __high); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- ~collate();
-
- virtual int do_compare(const char*, const char*,
- const char*, const char*) const;
- virtual string_type do_transform(const char*, const char*) const;
- virtual long do_hash(const char*, const char*) const;
-private:
- collate(const collate<char>&);
- collate<char>& operator =(const collate<char>&);
-};
-
-# ifndef _STLP_NO_WCHAR_T
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC collate<wchar_t> : public locale::facet
-{
- friend class _Locale_impl;
-
-public:
- typedef wchar_t char_type;
- typedef wstring string_type;
-
- explicit collate(size_t __refs = 0) : locale::facet(__refs) {}
-
- int compare(const wchar_t* __low1, const wchar_t* __high1,
- const wchar_t* __low2, const wchar_t* __high2) const {
- return do_compare( __low1, __high1, __low2, __high2);
- }
-
- string_type transform(const wchar_t* __low, const wchar_t* __high) const {
- return do_transform(__low, __high);
- }
-
- long hash(const wchar_t* __low, const wchar_t* __high) const
- { return do_hash(__low, __high); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- ~collate();
-
- virtual int do_compare(const wchar_t*, const wchar_t*,
- const wchar_t*, const wchar_t*) const;
- virtual string_type do_transform(const wchar_t*, const wchar_t*) const;
- virtual long do_hash(const wchar_t* __low, const wchar_t* __high) const;
-private:
- collate(const collate<wchar_t>&);
- collate<wchar_t>& operator = (const collate<wchar_t>&);
-};
-
-# endif /* NO_WCHAR_T */
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC collate_byname<char>: public collate<char>
-{
-public:
- explicit collate_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
-
-protected:
- ~collate_byname();
-
- virtual int do_compare(const char*, const char*,
- const char*, const char*) const;
- virtual string_type do_transform(const char*, const char*) const;
-
-private:
- _Locale_collate* _M_collate;
- collate_byname(const collate_byname<char>&);
- collate_byname<char>& operator =(const collate_byname<char>&);
- friend _Locale_name_hint* _Locale_extract_hint(collate_byname<char>*);
-};
-
-# ifndef _STLP_NO_WCHAR_T
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC collate_byname<wchar_t>: public collate<wchar_t>
-{
-public:
- explicit collate_byname(const char * __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
-
-protected:
- ~collate_byname();
-
- virtual int do_compare(const wchar_t*, const wchar_t*,
- const wchar_t*, const wchar_t*) const;
- virtual string_type do_transform(const wchar_t*, const wchar_t*) const;
-
-private:
- _Locale_collate* _M_collate;
- collate_byname(const collate_byname<wchar_t>&);
- collate_byname<wchar_t>& operator =(const collate_byname<wchar_t>&);
-};
-
-# endif /* NO_WCHAR_T */
-
-template <class _CharT, class _Traits, class _Alloc>
-bool
-__locale_do_operator_call (const locale& __loc,
- const basic_string<_CharT, _Traits, _Alloc>& __x,
- const basic_string<_CharT, _Traits, _Alloc>& __y) {
- collate<_CharT> const& __coll = use_facet<collate<_CharT> >(__loc);
- return __coll.compare(__x.data(), __x.data() + __x.size(),
- __y.data(), __y.data() + __y.size()) < 0;
-}
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_COLLATE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_complex.c b/stl/_complex.c
deleted file mode 100644
index ba3260b..0000000
--- a/stl/_complex.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_COMPLEX_C
-#define _STLP_COMPLEX_C
-
-#ifndef _STLP_INTERNAL_COMPLEX
-# include <stl/_complex.h>
-#endif
-
-#if !defined (_STLP_USE_NO_IOSTREAMS)
-# ifndef _STLP_INTERNAL_ISTREAM
-# include <stl/_istream.h>
-# endif
-
-# ifndef _STLP_INTERNAL_SSTREAM
-# include <stl/_sstream.h>
-# endif
-
-# ifndef _STLP_STRING_IO_H
-# include <stl/_string_io.h>
-# endif
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-// Non-inline member functions.
-
-template <class _Tp>
-void complex<_Tp>::_div(const _Tp& __z1_r, const _Tp& __z1_i,
- const _Tp& __z2_r, const _Tp& __z2_i,
- _Tp& __res_r, _Tp& __res_i) {
- _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
- _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
-
- if (__ar <= __ai) {
- _Tp __ratio = __z2_r / __z2_i;
- _Tp __denom = __z2_i * (1 + __ratio * __ratio);
- __res_r = (__z1_r * __ratio + __z1_i) / __denom;
- __res_i = (__z1_i * __ratio - __z1_r) / __denom;
- }
- else {
- _Tp __ratio = __z2_i / __z2_r;
- _Tp __denom = __z2_r * (1 + __ratio * __ratio);
- __res_r = (__z1_r + __z1_i * __ratio) / __denom;
- __res_i = (__z1_i - __z1_r * __ratio) / __denom;
- }
-}
-
-template <class _Tp>
-void complex<_Tp>::_div(const _Tp& __z1_r,
- const _Tp& __z2_r, const _Tp& __z2_i,
- _Tp& __res_r, _Tp& __res_i) {
- _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
- _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
-
- if (__ar <= __ai) {
- _Tp __ratio = __z2_r / __z2_i;
- _Tp __denom = __z2_i * (1 + __ratio * __ratio);
- __res_r = (__z1_r * __ratio) / __denom;
- __res_i = - __z1_r / __denom;
- }
- else {
- _Tp __ratio = __z2_i / __z2_r;
- _Tp __denom = __z2_r * (1 + __ratio * __ratio);
- __res_r = __z1_r / __denom;
- __res_i = - (__z1_r * __ratio) / __denom;
- }
-}
-
-// I/O.
-#if !defined (_STLP_USE_NO_IOSTREAMS)
-
-// Complex output, in the form (re,im). We use a two-step process
-// involving stringstream so that we get the padding right.
-template <class _Tp, class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& _STLP_CALL
-operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z) {
- basic_ostringstream<_CharT, _Traits, allocator<_CharT> > __tmp;
- __tmp.flags(__os.flags());
- __tmp.imbue(__os.getloc());
- __tmp.precision(__os.precision());
- __tmp << '(' << __z.real() << ',' << __z.imag() << ')';
- return __os << __tmp.str();
-}
-
-// Complex input from arbitrary streams. Note that results in some
-// locales may be confusing, since the decimal character varies with
-// locale and the separator between real and imaginary parts does not.
-
-template <class _Tp, class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& _STLP_CALL
-operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z) {
- _Tp __re = 0;
- _Tp __im = 0;
-
- // typedef ctype<_CharT> _Ctype;
- // locale __loc = __is.getloc();
- //const _Ctype& __c_type = use_facet<_Ctype>(__loc);
- const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __is._M_ctype_facet());
-
- const char __punct[4] = "(,)";
- _CharT __wpunct[3];
- __c_type.widen(__punct, __punct + 3, __wpunct);
-
- _CharT __c;
-
- __is >> __c;
- if (_Traits::eq(__c, __wpunct[0])) { // Left paren
- __is >> __re >> __c;
- if (_Traits::eq(__c, __wpunct[1])) // Comma
- __is >> __im >> __c;
- if (!_Traits::eq(__c, __wpunct[2])) // Right paren
- __is.setstate(ios_base::failbit);
- }
- else {
- __is.putback(__c);
- __is >> __re;
- }
-
- if (__is)
- __z = complex<_Tp>(__re, __im);
- return __is;
-}
-
-#endif /* _STLP_USE_NO_IOSTREAMS */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_COMPLEX_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_complex.h b/stl/_complex.h
deleted file mode 100644
index b320805..0000000
--- a/stl/_complex.h
+++ /dev/null
@@ -1,947 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_INTERNAL_COMPLEX
-#define _STLP_INTERNAL_COMPLEX
-
-// This header declares the template class complex, as described in
-// in the draft C++ standard. Single-precision complex numbers
-// are complex<float>, double-precision are complex<double>, and
-// quad precision are complex<long double>.
-
-// Note that the template class complex is declared within namespace
-// std, as called for by the draft C++ standard.
-
-#ifndef _STLP_INTERNAL_CMATH
-# include <stl/_cmath.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if !defined (_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround
-
-template <class _Tp> struct complex;
-
-_STLP_TEMPLATE_NULL struct complex<float>;
-_STLP_TEMPLATE_NULL struct complex<double>;
-# if !defined (_STLP_NO_LONG_DOUBLE)
-_STLP_TEMPLATE_NULL struct complex<long double>;
-# endif
-#endif /* _STLP_NO_COMPLEX_SPECIALIZATIONS */
-
-template <class _Tp>
-struct complex {
- typedef _Tp value_type;
- typedef complex<_Tp> _Self;
-
- // Constructors, destructor, assignment operator.
- complex() : _M_re(0), _M_im(0) {}
- complex(const value_type& __x)
- : _M_re(__x), _M_im(0) {}
- complex(const value_type& __x, const value_type& __y)
- : _M_re(__x), _M_im(__y) {}
- complex(const _Self& __z)
- : _M_re(__z._M_re), _M_im(__z._M_im) {}
-
- _Self& operator=(const _Self& __z) {
- _M_re = __z._M_re;
- _M_im = __z._M_im;
- return *this;
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES) && (defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined(_STLP_NO_COMPLEX_SPECIALIZATIONS))
- template <class _Tp2>
- explicit complex(const complex<_Tp2>& __z)
- : _M_re(__z._M_re), _M_im(__z._M_im) {}
-
- template <class _Tp2>
- _Self& operator=(const complex<_Tp2>& __z) {
- _M_re = __z._M_re;
- _M_im = __z._M_im;
- return *this;
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- // Element access.
- value_type real() const { return _M_re; }
- value_type imag() const { return _M_im; }
-
- // Arithmetic op= operations involving one real argument.
-
- _Self& operator= (const value_type& __x) {
- _M_re = __x;
- _M_im = 0;
- return *this;
- }
- _Self& operator+= (const value_type& __x) {
- _M_re += __x;
- return *this;
- }
- _Self& operator-= (const value_type& __x) {
- _M_re -= __x;
- return *this;
- }
- _Self& operator*= (const value_type& __x) {
- _M_re *= __x;
- _M_im *= __x;
- return *this;
- }
- _Self& operator/= (const value_type& __x) {
- _M_re /= __x;
- _M_im /= __x;
- return *this;
- }
-
- // Arithmetic op= operations involving two complex arguments.
-
- static void _STLP_CALL _div(const value_type& __z1_r, const value_type& __z1_i,
- const value_type& __z2_r, const value_type& __z2_i,
- value_type& __res_r, value_type& __res_i);
-
- static void _STLP_CALL _div(const value_type& __z1_r,
- const value_type& __z2_r, const value_type& __z2_i,
- value_type& __res_r, value_type& __res_i);
-
-#if defined (_STLP_MEMBER_TEMPLATES) // && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
-
- template <class _Tp2> _Self& operator+= (const complex<_Tp2>& __z) {
- _M_re += __z._M_re;
- _M_im += __z._M_im;
- return *this;
- }
-
- template <class _Tp2> _Self& operator-= (const complex<_Tp2>& __z) {
- _M_re -= __z._M_re;
- _M_im -= __z._M_im;
- return *this;
- }
-
- template <class _Tp2> _Self& operator*= (const complex<_Tp2>& __z) {
- value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
- value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
- template <class _Tp2> _Self& operator/= (const complex<_Tp2>& __z) {
- value_type __r;
- value_type __i;
- _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- _Self& operator+= (const _Self& __z) {
- _M_re += __z._M_re;
- _M_im += __z._M_im;
- return *this;
- }
-
- _Self& operator-= (const _Self& __z) {
- _M_re -= __z._M_re;
- _M_im -= __z._M_im;
- return *this;
- }
-
- _Self& operator*= (const _Self& __z) {
- value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
- value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
- _Self& operator/= (const _Self& __z) {
- value_type __r;
- value_type __i;
- _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
- // Data members.
- value_type _M_re;
- value_type _M_im;
-};
-
-#if !defined (_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround
-// Explicit specializations for float, double, long double. The only
-// reason for these specializations is to enable automatic conversions
-// from complex<float> to complex<double>, and complex<double> to
-// complex<long double>.
-
-_STLP_TEMPLATE_NULL
-struct _STLP_CLASS_DECLSPEC complex<float> {
- typedef float value_type;
- typedef complex<float> _Self;
- // Constructors, destructor, assignment operator.
-
- complex(value_type __x = 0.0f, value_type __y = 0.0f)
- : _M_re(__x), _M_im(__y) {}
-
- complex(const complex<float>& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {}
-
- inline explicit complex(const complex<double>& __z);
-# ifndef _STLP_NO_LONG_DOUBLE
- inline explicit complex(const complex<long double>& __z);
-# endif
- // Element access.
- value_type real() const { return _M_re; }
- value_type imag() const { return _M_im; }
-
- // Arithmetic op= operations involving one real argument.
-
- _Self& operator= (value_type __x) {
- _M_re = __x;
- _M_im = 0.0f;
- return *this;
- }
- _Self& operator+= (value_type __x) {
- _M_re += __x;
- return *this;
- }
- _Self& operator-= (value_type __x) {
- _M_re -= __x;
- return *this;
- }
- _Self& operator*= (value_type __x) {
- _M_re *= __x;
- _M_im *= __x;
- return *this;
- }
- _Self& operator/= (value_type __x) {
- _M_re /= __x;
- _M_im /= __x;
- return *this;
- }
-
- // Arithmetic op= operations involving two complex arguments.
-
- static void _STLP_CALL _div(const float& __z1_r, const float& __z1_i,
- const float& __z2_r, const float& __z2_i,
- float& __res_r, float& __res_i);
-
- static void _STLP_CALL _div(const float& __z1_r,
- const float& __z2_r, const float& __z2_i,
- float& __res_r, float& __res_i);
-
-# if defined (_STLP_MEMBER_TEMPLATES)
- template <class _Tp2>
- complex<float>& operator=(const complex<_Tp2>& __z) {
- _M_re = __z._M_re;
- _M_im = __z._M_im;
- return *this;
- }
-
- template <class _Tp2>
- complex<float>& operator+= (const complex<_Tp2>& __z) {
- _M_re += __z._M_re;
- _M_im += __z._M_im;
- return *this;
- }
-
- template <class _Tp2>
- complex<float>& operator-= (const complex<_Tp2>& __z) {
- _M_re -= __z._M_re;
- _M_im -= __z._M_im;
- return *this;
- }
-
- template <class _Tp2>
- complex<float>& operator*= (const complex<_Tp2>& __z) {
- float __r = _M_re * __z._M_re - _M_im * __z._M_im;
- float __i = _M_re * __z._M_im + _M_im * __z._M_re;
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
- template <class _Tp2>
- complex<float>& operator/= (const complex<_Tp2>& __z) {
- float __r;
- float __i;
- _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
-# endif /* _STLP_MEMBER_TEMPLATES */
-
- _Self& operator=(const _Self& __z) {
- _M_re = __z._M_re;
- _M_im = __z._M_im;
- return *this;
- }
-
- _Self& operator+= (const _Self& __z) {
- _M_re += __z._M_re;
- _M_im += __z._M_im;
- return *this;
- }
-
- _Self& operator-= (const _Self& __z) {
- _M_re -= __z._M_re;
- _M_im -= __z._M_im;
- return *this;
- }
-
- _Self& operator*= (const _Self& __z) {
- value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
- value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
- _Self& operator/= (const _Self& __z) {
- value_type __r;
- value_type __i;
- _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
- // Data members.
- value_type _M_re;
- value_type _M_im;
-};
-
-_STLP_TEMPLATE_NULL
-struct _STLP_CLASS_DECLSPEC complex<double> {
- typedef double value_type;
- typedef complex<double> _Self;
-
- // Constructors, destructor, assignment operator.
-
- complex(value_type __x = 0.0, value_type __y = 0.0)
- : _M_re(__x), _M_im(__y) {}
-
- complex(const complex<double>& __z)
- : _M_re(__z._M_re), _M_im(__z._M_im) {}
- inline complex(const complex<float>& __z);
-# if !defined (_STLP_NO_LONG_DOUBLE)
- explicit inline complex(const complex<long double>& __z);
-# endif
- // Element access.
- value_type real() const { return _M_re; }
- value_type imag() const { return _M_im; }
-
- // Arithmetic op= operations involving one real argument.
-
- _Self& operator= (value_type __x) {
- _M_re = __x;
- _M_im = 0.0;
- return *this;
- }
- _Self& operator+= (value_type __x) {
- _M_re += __x;
- return *this;
- }
- _Self& operator-= (value_type __x) {
- _M_re -= __x;
- return *this;
- }
- _Self& operator*= (value_type __x) {
- _M_re *= __x;
- _M_im *= __x;
- return *this;
- }
- _Self& operator/= (value_type __x) {
- _M_re /= __x;
- _M_im /= __x;
- return *this;
- }
-
- // Arithmetic op= operations involving two complex arguments.
-
- static void _STLP_CALL _div(const double& __z1_r, const double& __z1_i,
- const double& __z2_r, const double& __z2_i,
- double& __res_r, double& __res_i);
- static void _STLP_CALL _div(const double& __z1_r,
- const double& __z2_r, const double& __z2_i,
- double& __res_r, double& __res_i);
-
-# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
- template <class _Tp2>
- complex<double>& operator=(const complex<_Tp2>& __z) {
- _M_re = __z._M_re;
- _M_im = __z._M_im;
- return *this;
- }
-
- template <class _Tp2>
- complex<double>& operator+= (const complex<_Tp2>& __z) {
- _M_re += __z._M_re;
- _M_im += __z._M_im;
- return *this;
- }
-
- template <class _Tp2>
- complex<double>& operator-= (const complex<_Tp2>& __z) {
- _M_re -= __z._M_re;
- _M_im -= __z._M_im;
- return *this;
- }
-
- template <class _Tp2>
- complex<double>& operator*= (const complex<_Tp2>& __z) {
- double __r = _M_re * __z._M_re - _M_im * __z._M_im;
- double __i = _M_re * __z._M_im + _M_im * __z._M_re;
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
- template <class _Tp2>
- complex<double>& operator/= (const complex<_Tp2>& __z) {
- double __r;
- double __i;
- _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
-# endif /* _STLP_MEMBER_TEMPLATES */
-
- _Self& operator=(const _Self& __z) {
- _M_re = __z._M_re;
- _M_im = __z._M_im;
- return *this;
- }
-
- _Self& operator+= (const _Self& __z) {
- _M_re += __z._M_re;
- _M_im += __z._M_im;
- return *this;
- }
-
- _Self& operator-= (const _Self& __z) {
- _M_re -= __z._M_re;
- _M_im -= __z._M_im;
- return *this;
- }
-
- _Self& operator*= (const _Self& __z) {
- value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
- value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
- _Self& operator/= (const _Self& __z) {
- value_type __r;
- value_type __i;
- _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
- // Data members.
- value_type _M_re;
- value_type _M_im;
-};
-
-# if !defined (_STLP_NO_LONG_DOUBLE)
-
-_STLP_TEMPLATE_NULL
-struct _STLP_CLASS_DECLSPEC complex<long double> {
- typedef long double value_type;
- typedef complex<long double> _Self;
-
- // Constructors, destructor, assignment operator.
- complex(value_type __x = 0.0l, value_type __y = 0.0l)
- : _M_re(__x), _M_im(__y) {}
-
- complex(const complex<long double>& __z)
- : _M_re(__z._M_re), _M_im(__z._M_im) {}
- inline complex(const complex<float>& __z);
- inline complex(const complex<double>& __z);
-
- // Element access.
- value_type real() const { return _M_re; }
- value_type imag() const { return _M_im; }
-
- // Arithmetic op= operations involving one real argument.
-
- _Self& operator= (value_type __x) {
- _M_re = __x;
- _M_im = 0.0l;
- return *this;
- }
- _Self& operator+= (value_type __x) {
- _M_re += __x;
- return *this;
- }
- _Self& operator-= (value_type __x) {
- _M_re -= __x;
- return *this;
- }
- _Self& operator*= (value_type __x) {
- _M_re *= __x;
- _M_im *= __x;
- return *this;
- }
- _Self& operator/= (value_type __x) {
- _M_re /= __x;
- _M_im /= __x;
- return *this;
- }
-
- // Arithmetic op= operations involving two complex arguments.
-
- static void _STLP_CALL _div(const long double& __z1_r, const long double& __z1_i,
- const long double& __z2_r, const long double& __z2_i,
- long double& __res_r, long double& __res_i);
-
- static void _STLP_CALL _div(const long double& __z1_r,
- const long double& __z2_r, const long double& __z2_i,
- long double& __res_r, long double& __res_i);
-
-# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
-
- template <class _Tp2>
- complex<long double>& operator=(const complex<_Tp2>& __z) {
- _M_re = __z._M_re;
- _M_im = __z._M_im;
- return *this;
- }
-
- template <class _Tp2>
- complex<long double>& operator+= (const complex<_Tp2>& __z) {
- _M_re += __z._M_re;
- _M_im += __z._M_im;
- return *this;
- }
-
- template <class _Tp2>
- complex<long double>& operator-= (const complex<_Tp2>& __z) {
- _M_re -= __z._M_re;
- _M_im -= __z._M_im;
- return *this;
- }
-
- template <class _Tp2>
- complex<long double>& operator*= (const complex<_Tp2>& __z) {
- long double __r = _M_re * __z._M_re - _M_im * __z._M_im;
- long double __i = _M_re * __z._M_im + _M_im * __z._M_re;
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
- template <class _Tp2>
- complex<long double>& operator/= (const complex<_Tp2>& __z) {
- long double __r;
- long double __i;
- _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
-# endif /* _STLP_MEMBER_TEMPLATES */
-
- _Self& operator=(const _Self& __z) {
- _M_re = __z._M_re;
- _M_im = __z._M_im;
- return *this;
- }
-
- _Self& operator+= (const _Self& __z) {
- _M_re += __z._M_re;
- _M_im += __z._M_im;
- return *this;
- }
-
- _Self& operator-= (const _Self& __z) {
- _M_re -= __z._M_re;
- _M_im -= __z._M_im;
- return *this;
- }
-
- _Self& operator*= (const _Self& __z) {
- value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
- value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
- _Self& operator/= (const _Self& __z) {
- value_type __r;
- value_type __i;
- _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
- _M_re = __r;
- _M_im = __i;
- return *this;
- }
-
- // Data members.
- value_type _M_re;
- value_type _M_im;
-};
-
-# endif /* _STLP_NO_LONG_DOUBLE */
-
-// Converting constructors from one of these three specialized types
-// to another.
-
-inline complex<float>::complex(const complex<double>& __z)
- : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {}
-inline complex<double>::complex(const complex<float>& __z)
- : _M_re(__z._M_re), _M_im(__z._M_im) {}
-# ifndef _STLP_NO_LONG_DOUBLE
-inline complex<float>::complex(const complex<long double>& __z)
- : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {}
-inline complex<double>::complex(const complex<long double>& __z)
- : _M_re((double)__z._M_re), _M_im((double)__z._M_im) {}
-inline complex<long double>::complex(const complex<float>& __z)
- : _M_re(__z._M_re), _M_im(__z._M_im) {}
-inline complex<long double>::complex(const complex<double>& __z)
- : _M_re(__z._M_re), _M_im(__z._M_im) {}
-# endif
-
-#endif /* SPECIALIZATIONS */
-
-// Unary non-member arithmetic operators.
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z)
-{ return __z; }
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z)
-{ return complex<_Tp>(-__z._M_re, -__z._M_im); }
-
-// Non-member arithmetic operations involving one real argument.
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z)
-{ return complex<_Tp>(__x + __z._M_re, __z._M_im); }
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x)
-{ return complex<_Tp>(__z._M_re + __x, __z._M_im); }
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z)
-{ return complex<_Tp>(__x - __z._M_re, -__z._M_im); }
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x)
-{ return complex<_Tp>(__z._M_re - __x, __z._M_im); }
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z)
-{ return complex<_Tp>(__x * __z._M_re, __x * __z._M_im); }
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x)
-{ return complex<_Tp>(__z._M_re * __x, __z._M_im * __x); }
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL operator/(const _Tp& __x, const complex<_Tp>& __z) {
- complex<_Tp> __result;
- complex<_Tp>::_div(__x,
- __z._M_re, __z._M_im,
- __result._M_re, __result._M_im);
- return __result;
-}
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x)
-{ return complex<_Tp>(__z._M_re / __x, __z._M_im / __x); }
-
-// Non-member arithmetic operations involving two complex arguments
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL
-operator+(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
-{ return complex<_Tp>(__z1._M_re + __z2._M_re, __z1._M_im + __z2._M_im); }
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL
-operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
-{ return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im); }
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL
-operator*(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
- return complex<_Tp>(__z1._M_re * __z2._M_re - __z1._M_im * __z2._M_im,
- __z1._M_re * __z2._M_im + __z1._M_im * __z2._M_re);
-}
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL
-operator/(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
- complex<_Tp> __result;
- complex<_Tp>::_div(__z1._M_re, __z1._M_im,
- __z2._M_re, __z2._M_im,
- __result._M_re, __result._M_im);
- return __result;
-}
-
-// Comparison operators.
-
-template <class _Tp>
-inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
-{ return __z1._M_re == __z2._M_re && __z1._M_im == __z2._M_im; }
-
-template <class _Tp>
-inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x)
-{ return __z._M_re == __x && __z._M_im == 0; }
-
-template <class _Tp>
-inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z)
-{ return __x == __z._M_re && 0 == __z._M_im; }
-
-//04/27/04 dums: removal of this check, if it is restablish
-//please explain why the other operators are not macro guarded
-//#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Tp>
-inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
-{ return __z1._M_re != __z2._M_re || __z1._M_im != __z2._M_im; }
-
-//#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
-
-template <class _Tp>
-inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x)
-{ return __z._M_re != __x || __z._M_im != 0; }
-
-template <class _Tp>
-inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z)
-{ return __x != __z._M_re || 0 != __z._M_im; }
-
-// Other basic arithmetic operations
-template <class _Tp>
-inline _Tp _STLP_CALL real(const complex<_Tp>& __z)
-{ return __z._M_re; }
-
-template <class _Tp>
-inline _Tp _STLP_CALL imag(const complex<_Tp>& __z)
-{ return __z._M_im; }
-
-template <class _Tp>
-_Tp _STLP_CALL abs(const complex<_Tp>& __z);
-
-template <class _Tp>
-_Tp _STLP_CALL arg(const complex<_Tp>& __z);
-
-template <class _Tp>
-inline _Tp _STLP_CALL norm(const complex<_Tp>& __z)
-{ return __z._M_re * __z._M_re + __z._M_im * __z._M_im; }
-
-template <class _Tp>
-inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z)
-{ return complex<_Tp>(__z._M_re, -__z._M_im); }
-
-template <class _Tp>
-complex<_Tp> _STLP_CALL polar(const _Tp& __rho)
-{ return complex<_Tp>(__rho, 0); }
-
-template <class _Tp>
-complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi);
-
-_STLP_TEMPLATE_NULL
-_STLP_DECLSPEC float _STLP_CALL abs(const complex<float>&);
-_STLP_TEMPLATE_NULL
-_STLP_DECLSPEC double _STLP_CALL abs(const complex<double>&);
-_STLP_TEMPLATE_NULL
-_STLP_DECLSPEC float _STLP_CALL arg(const complex<float>&);
-_STLP_TEMPLATE_NULL
-_STLP_DECLSPEC double _STLP_CALL arg(const complex<double>&);
-_STLP_TEMPLATE_NULL
-_STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi);
-_STLP_TEMPLATE_NULL
-_STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi);
-
-template <class _Tp>
-_Tp _STLP_CALL abs(const complex<_Tp>& __z)
-{ return _Tp(abs(complex<double>(double(__z.real()), double(__z.imag())))); }
-
-template <class _Tp>
-_Tp _STLP_CALL arg(const complex<_Tp>& __z)
-{ return _Tp(arg(complex<double>(double(__z.real()), double(__z.imag())))); }
-
-template <class _Tp>
-complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) {
- complex<double> __tmp = polar(double(__rho), double(__phi));
- return complex<_Tp>(_Tp(__tmp.real()), _Tp(__tmp.imag()));
-}
-
-#if !defined (_STLP_NO_LONG_DOUBLE)
-_STLP_TEMPLATE_NULL
-_STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>&);
-_STLP_TEMPLATE_NULL
-_STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>&);
-_STLP_TEMPLATE_NULL
-_STLP_DECLSPEC complex<long double> _STLP_CALL polar(const long double&, const long double&);
-#endif
-
-
-#if !defined (_STLP_USE_NO_IOSTREAMS)
-
-_STLP_END_NAMESPACE
-
-# include <iosfwd>
-
-_STLP_BEGIN_NAMESPACE
-
-// Complex output, in the form (re,im). We use a two-step process
-// involving stringstream so that we get the padding right.
-template <class _Tp, class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& _STLP_CALL
-operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z);
-
-template <class _Tp, class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& _STLP_CALL
-operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z);
-
-// Specializations for narrow characters; lets us avoid widen.
-
-_STLP_OPERATOR_TEMPLATE
-_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
-operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z);
-
-_STLP_OPERATOR_TEMPLATE
-_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
-operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z);
-
-_STLP_OPERATOR_TEMPLATE
-_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
-operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<float>& __z);
-
-_STLP_OPERATOR_TEMPLATE
-_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
-operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<double>& __z);
-
-# if !defined (_STLP_NO_LONG_DOUBLE)
-_STLP_OPERATOR_TEMPLATE
-_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
-operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z);
-
-_STLP_OPERATOR_TEMPLATE
-_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
-operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<long double>& __z);
-
-# endif
-
-# if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T)
-
-_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
-operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
-_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
-operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
-_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
-operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
-_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
-operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
-
-# if !defined (_STLP_NO_LONG_DOUBLE)
-_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
-operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
-_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
-operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
-# endif
-# endif
-#endif
-
-
-// Transcendental functions. These are defined only for float,
-// double, and long double. (Sqrt isn't transcendental, of course,
-// but it's included in this section anyway.)
-
-_STLP_DECLSPEC complex<float> _STLP_CALL sqrt(const complex<float>&);
-
-_STLP_DECLSPEC complex<float> _STLP_CALL exp(const complex<float>&);
-_STLP_DECLSPEC complex<float> _STLP_CALL log(const complex<float>&);
-_STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>&);
-
-_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, int);
-_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const float&);
-_STLP_DECLSPEC complex<float> _STLP_CALL pow(const float&, const complex<float>&);
-_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const complex<float>&);
-
-_STLP_DECLSPEC complex<float> _STLP_CALL sin(const complex<float>&);
-_STLP_DECLSPEC complex<float> _STLP_CALL cos(const complex<float>&);
-_STLP_DECLSPEC complex<float> _STLP_CALL tan(const complex<float>&);
-
-_STLP_DECLSPEC complex<float> _STLP_CALL sinh(const complex<float>&);
-_STLP_DECLSPEC complex<float> _STLP_CALL cosh(const complex<float>&);
-_STLP_DECLSPEC complex<float> _STLP_CALL tanh(const complex<float>&);
-
-_STLP_DECLSPEC complex<double> _STLP_CALL sqrt(const complex<double>&);
-
-_STLP_DECLSPEC complex<double> _STLP_CALL exp(const complex<double>&);
-_STLP_DECLSPEC complex<double> _STLP_CALL log(const complex<double>&);
-_STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>&);
-
-_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, int);
-_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const double&);
-_STLP_DECLSPEC complex<double> _STLP_CALL pow(const double&, const complex<double>&);
-_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const complex<double>&);
-
-_STLP_DECLSPEC complex<double> _STLP_CALL sin(const complex<double>&);
-_STLP_DECLSPEC complex<double> _STLP_CALL cos(const complex<double>&);
-_STLP_DECLSPEC complex<double> _STLP_CALL tan(const complex<double>&);
-
-_STLP_DECLSPEC complex<double> _STLP_CALL sinh(const complex<double>&);
-_STLP_DECLSPEC complex<double> _STLP_CALL cosh(const complex<double>&);
-_STLP_DECLSPEC complex<double> _STLP_CALL tanh(const complex<double>&);
-
-#if !defined (_STLP_NO_LONG_DOUBLE)
-_STLP_DECLSPEC complex<long double> _STLP_CALL sqrt(const complex<long double>&);
-_STLP_DECLSPEC complex<long double> _STLP_CALL exp(const complex<long double>&);
-_STLP_DECLSPEC complex<long double> _STLP_CALL log(const complex<long double>&);
-_STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>&);
-
-_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, int);
-_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, const long double&);
-_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const long double&, const complex<long double>&);
-_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&,
- const complex<long double>&);
-
-_STLP_DECLSPEC complex<long double> _STLP_CALL sin(const complex<long double>&);
-_STLP_DECLSPEC complex<long double> _STLP_CALL cos(const complex<long double>&);
-_STLP_DECLSPEC complex<long double> _STLP_CALL tan(const complex<long double>&);
-
-_STLP_DECLSPEC complex<long double> _STLP_CALL sinh(const complex<long double>&);
-_STLP_DECLSPEC complex<long double> _STLP_CALL cosh(const complex<long double>&);
-_STLP_DECLSPEC complex<long double> _STLP_CALL tanh(const complex<long double>&);
-#endif
-
-_STLP_END_NAMESPACE
-
-#ifndef _STLP_LINK_TIME_INSTANTIATION
-# include <stl/_complex.c>
-#endif
-
-#endif
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_config_compat_post.h b/stl/_config_compat_post.h
deleted file mode 100644
index c326ac5..0000000
--- a/stl/_config_compat_post.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*========================================== */
-#if 1 /* def _STLP_3_COMPATIBILITY */
-
-# define __SGI_STL_PORT _STLPORT_VERSION
-
-# if defined (_STLP_DEBUG) && ! defined ( __STL_DEBUG )
-# define __STL_DEBUG _STLP_DEBUG
-# endif
-
-# if defined (_STLP_USE_NAMESPACES)
-# undef __STL_USE_NAMESPACES
-# define __STL_USE_NAMESPACES _STLP_USE_NAMESPACES
-# endif
-
-# if defined (_STLP_USE_EXCEPTIONS)
-# undef __STL_USE_EXCEPTIONS
-# define __STL_USE_EXCEPTIONS _STLP_USE_EXCEPTIONS
-# endif
-
-# if defined (_STLP_BEGIN_NAMESPACE) && ! defined ( __STL_BEGIN_NAMESPACE )
-# define __STL_BEGIN_NAMESPACE _STLP_BEGIN_NAMESPACE
-# define __STL_END_NAMESPACE _STLP_END_NAMESPACE
-# define __STL_VENDOR_STD _STLP_VENDOR_STD
-# define __STL_VENDOR_CSTD _STLP_VENDOR_CSTD
-# endif
-# endif
-
-/*
-# if defined (_STLP_XXX) && ! defined ( __STL_XXX )
-# define __STL_XXX _STLP_XXX
-# endif
-*/
-
-/* 5.0 -> 4.6 compatibility section */
-#if 1 /* def _STLP_46_COMPATIBILITY */
-
-#ifndef _STLP_USING_NAMESPACE_BUG
-# define _STLP_USING_NAMESPACE_BUG
-#endif
-
-/* provide a uniform way to access full funclionality */
-# define __slist__ slist
-# define __map__ map
-# define __multimap__ multimap
-# define __set__ set
-# define __multiset__ multiset
-# define __list__ list
-# define __hash_map__ hash_map
-# define __hash_multimap__ hash_multimap
-# define __hash_set__ hash_set
-# define __hash_multiset__ hash_multiset
-# define __vector__ vector
-
-#endif
-
diff --git a/stl/_construct.h b/stl/_construct.h
deleted file mode 100644
index f828d92..0000000
--- a/stl/_construct.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_CONSTRUCT_H
-#define _STLP_INTERNAL_CONSTRUCT_H
-
-#if !defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_INTERNAL_CSTRING)
-# include <stl/_cstring.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NEW
-# include <stl/_new.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
-# include <stl/_iterator_base.h>
-#endif
-
-#ifndef _STLP_MOVE_CONSTRUCT_FWK_H
-# include <stl/_move_construct_fwk.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _Tp>
-inline void __destroy_aux(_Tp* __pointer, const __false_type& /*_Trivial_destructor*/)
-{ __pointer->~_Tp(); }
-
-template <class _Tp>
-inline void __destroy_aux(_Tp*, const __true_type& /*_Trivial_destructor*/) {}
-
-template <class _Tp>
-inline void _Destroy(_Tp* __pointer) {
-#if defined (_STLP_MSVC) && (_STLP_MSVC <= 1010)
- __pointer;
-#endif
- typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor;
- __destroy_aux(__pointer, _Trivial_destructor());
-#if defined (_STLP_DEBUG_UNINITIALIZED)
- memset(__REINTERPRET_CAST(char*, __pointer), _STLP_SHRED_BYTE, sizeof(_Tp));
-#endif
-}
-
-template <class _Tp>
-inline void _Destroy_Moved(_Tp* __pointer) {
- typedef typename __move_traits<_Tp>::complete _Trivial_destructor;
- __destroy_aux(__pointer, _Trivial_destructor());
-#if defined (_STLP_DEBUG_UNINITIALIZED)
- memset((char*)__pointer, _STLP_SHRED_BYTE, sizeof(_Tp));
-#endif
-}
-
-#if defined (new)
-# define _STLP_NEW_REDEFINE new
-# undef new
-#endif
-
-#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG)
-template <class _T1>
-inline void _Construct_aux (_T1* __p, const __false_type&) {
- _STLP_PLACEMENT_NEW (__p) _T1();
-}
-
-template <class _T1>
-inline void _Construct_aux (_T1* __p, const __true_type&) {
- _STLP_PLACEMENT_NEW (__p) _T1(0);
-}
-#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */
-
-template <class _T1>
-inline void _Construct(_T1* __p) {
-#if defined (_STLP_DEBUG_UNINITIALIZED)
- memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
-#endif
-#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG)
- _Construct_aux (__p, _HasDefaultZeroValue(__p)._Answer() );
-#else
- _STLP_PLACEMENT_NEW (__p) _T1();
-#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */
-}
-
-template <class _Tp>
-inline void _Copy_Construct(_Tp* __p, const _Tp& __val) {
-#if defined (_STLP_DEBUG_UNINITIALIZED)
- memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_Tp));
-#endif
- _STLP_PLACEMENT_NEW (__p) _Tp(__val);
-}
-
-template <class _T1, class _T2>
-inline void _Param_Construct(_T1* __p, const _T2& __val) {
-#if defined (_STLP_DEBUG_UNINITIALIZED)
- memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
-#endif
- _STLP_PLACEMENT_NEW (__p) _T1(__val);
-}
-
-template <class _T1, class _T2>
-inline void _Move_Construct_Aux(_T1* __p, _T2& __val, const __false_type& /*_IsPOD*/) {
- _STLP_PLACEMENT_NEW (__p) _T1(_STLP_PRIV _AsMoveSource(__val));
-}
-
-template <class _T1, class _T2>
-inline void _Move_Construct_Aux(_T1* __p, _T2& __val, const __true_type& /*_IsPOD*/) {
- _STLP_PLACEMENT_NEW (__p) _T1(__val);
-}
-
-template <class _T1, class _T2>
-inline void _Move_Construct(_T1* __p, _T2& __val) {
-#if defined (_STLP_DEBUG_UNINITIALIZED)
- memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
-#endif
- _Move_Construct_Aux(__p, __val, _Is_POD(__p)._Answer());
-}
-
-#if defined(_STLP_NEW_REDEFINE)
-# if defined (DEBUG_NEW)
-# define new DEBUG_NEW
-# endif
-# undef _STLP_NEW_REDEFINE
-#endif
-
-template <class _ForwardIterator, class _Tp>
-_STLP_INLINE_LOOP void
-__destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp*, const __false_type& /*_Trivial_destructor*/) {
- for ( ; __first != __last; ++__first) {
- __destroy_aux(&(*__first), __false_type());
-#if defined (_STLP_DEBUG_UNINITIALIZED)
- memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp));
-#endif
- }
-}
-
-template <class _ForwardIterator, class _Tp>
-#if defined (_STLP_DEBUG_UNINITIALIZED)
-_STLP_INLINE_LOOP void
-__destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp*, const __true_type& /*_Trivial_destructor*/) {
- for ( ; __first != __last; ++__first)
- memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp));
-}
-#else
-inline void
-__destroy_range_aux(_ForwardIterator, _ForwardIterator, _Tp*, const __true_type& /*_Trivial_destructor*/) {}
-#endif
-
-template <class _ForwardIterator, class _Tp>
-inline void
-__destroy_range(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr) {
- typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor;
- __destroy_range_aux(__first, __last, __ptr, _Trivial_destructor());
-}
-
-template <class _ForwardIterator>
-inline void _Destroy_Range(_ForwardIterator __first, _ForwardIterator __last) {
- __destroy_range(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator));
-}
-
-inline void _Destroy_Range(char*, char*) {}
-#if defined (_STLP_HAS_WCHAR_T) // dwa 8/15/97
-inline void _Destroy_Range(wchar_t*, wchar_t*) {}
-inline void _Destroy_Range(const wchar_t*, const wchar_t*) {}
-#endif
-
-template <class _ForwardIterator, class _Tp>
-inline void
-__destroy_mv_srcs(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr) {
- typedef typename __move_traits<_Tp>::complete _CompleteMove;
- __destroy_range_aux(__first, __last, __ptr, _CompleteMove());
-}
-
-template <class _ForwardIterator>
-inline void _Destroy_Moved_Range(_ForwardIterator __first, _ForwardIterator __last) {
- __destroy_mv_srcs(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator));
-}
-
-#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG)
-// Those adaptors are here to fix common compiler bug regarding builtins:
-// expressions like int k = int() should initialize k to 0
-template <class _Tp>
-inline _Tp __default_constructed_aux(_Tp*, const __false_type&) {
- return _Tp();
-}
-template <class _Tp>
-inline _Tp __default_constructed_aux(_Tp*, const __true_type&) {
- return _Tp(0);
-}
-
-template <class _Tp>
-inline _Tp __default_constructed(_Tp* __p) {
- return __default_constructed_aux(__p, _HasDefaultZeroValue(__p)._Answer());
-}
-
-# define _STLP_DEFAULT_CONSTRUCTED(_TTp) __default_constructed((_TTp*)0)
-#else
-# define _STLP_DEFAULT_CONSTRUCTED(_TTp) _TTp()
-#endif /* _STLP_DEF_CONST_DEF_PARAM_BUG */
-
-
-#if !defined (_STLP_NO_ANACHRONISMS)
-// --------------------------------------------------
-// Old names from the HP STL.
-
-template <class _T1, class _T2>
-inline void construct(_T1* __p, const _T2& __val) {_Param_Construct(__p, __val); }
-template <class _T1>
-inline void construct(_T1* __p) { _STLP_STD::_Construct(__p); }
-template <class _Tp>
-inline void destroy(_Tp* __pointer) { _STLP_STD::_Destroy(__pointer); }
-template <class _ForwardIterator>
-inline void destroy(_ForwardIterator __first, _ForwardIterator __last) { _STLP_STD::_Destroy_Range(__first, __last); }
-#endif /* _STLP_NO_ANACHRONISMS */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_CONSTRUCT_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_csetjmp.h b/stl/_csetjmp.h
deleted file mode 100644
index 7bb0018..0000000
--- a/stl/_csetjmp.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_CSETJMP
-#define _STLP_INTERNAL_CSETJMP
-
-// if the macro is on, the header is already there
-#if !defined (setjmp)
-# if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(csetjmp)
-# else
-# define _STLP_NATIVE_SETJMP_H_INCLUDED
-# include _STLP_NATIVE_C_HEADER(setjmp.h)
-# endif
-#endif
-
-#if defined (_STLP_IMPORT_VENDOR_CSTD)
-
-# if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
-/* For Borland, even if stdjmp.h is included symbols won't be in global namespace
- * so we need to reach them in vendor namespace:
- */
-# undef _STLP_NATIVE_SETJMP_H_INCLUDED
-# endif
-
-_STLP_BEGIN_NAMESPACE
-# if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
-using _STLP_VENDOR_CSTD::jmp_buf;
-# else
-// if setjmp.h was included first, this is in global namespace, not in
-// vendor's std. - 2005-08-04, ptr
-using ::jmp_buf;
-# endif
-# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
-# if !defined (setjmp)
-# if !defined (__MSL__) || ((__MSL__ > 0x7001) && (__MSL__ < 0x8000))
-# ifndef _STLP_NATIVE_SETJMP_H_INCLUDED
-using _STLP_VENDOR_CSTD::setjmp;
-# else
-using ::setjmp;
-# endif
-# endif
-# endif
-# if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
-using _STLP_VENDOR_CSTD::longjmp;
-# else
-using ::longjmp;
-# endif
-# endif
-_STLP_END_NAMESPACE
-#endif /* _STLP_IMPORT_VENDOR_CSTD */
-
-#endif
diff --git a/stl/_csignal.h b/stl/_csignal.h
deleted file mode 100644
index 919e9c4..0000000
--- a/stl/_csignal.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_CSIGNAL
-#define _STLP_INTERNAL_CSIGNAL
-
-#if !defined (_STLP_WCE)
-# if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(csignal)
-# else
-# include _STLP_NATIVE_C_HEADER(signal.h)
-# endif
-
-# if defined (_STLP_IMPORT_VENDOR_CSTD)
-_STLP_BEGIN_NAMESPACE
-# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
-using _STLP_VENDOR_CSTD::signal;
-using _STLP_VENDOR_CSTD::raise;
-# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
-using _STLP_VENDOR_CSTD::sig_atomic_t;
-_STLP_END_NAMESPACE
-# endif /* _STLP_IMPORT_VENDOR_CSTD */
-#endif
-
-#endif /* _STLP_INTERNAL_CSIGNAL */
diff --git a/stl/_cstdarg.h b/stl/_cstdarg.h
deleted file mode 100644
index 0e51e62..0000000
--- a/stl/_cstdarg.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-#ifndef _STLP_INTERNAL_CSTDARG
-#define _STLP_INTERNAL_CSTDARG
-
-#if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(cstdarg)
-#else
-# include _STLP_NATIVE_C_HEADER(stdarg.h)
-#endif
-
-#ifdef _STLP_IMPORT_VENDOR_CSTD
-_STLP_BEGIN_NAMESPACE
-using _STLP_VENDOR_CSTD::va_list;
-_STLP_END_NAMESPACE
-#endif /* _STLP_IMPORT_VENDOR_CSTD */
-
-#endif
diff --git a/stl/_cstddef.h b/stl/_cstddef.h
deleted file mode 100644
index d1c1e2d..0000000
--- a/stl/_cstddef.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_CSTDDEF
-#define _STLP_INTERNAL_CSTDDEF
-
-# if (__GNUC__ >= 3) && defined (__CYGWIN__) // this total HACK is the only expedient way I could cygwin to work with GCC 3.0
-# define __need_wint_t // mostly because wint_t didn't seem to get defined otherwise :(
-# define __need_wchar_t
-# define __need_size_t
-# define __need_ptrdiff_t
-# define __need_NULL
-# endif
-
-# if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
-# else
-# include <stddef.h>
-# endif
-
-# ifdef _STLP_IMPORT_VENDOR_CSTD
-_STLP_BEGIN_NAMESPACE
-using _STLP_VENDOR_CSTD::ptrdiff_t;
-using _STLP_VENDOR_CSTD::size_t;
-_STLP_END_NAMESPACE
-# endif /* _STLP_IMPORT_VENDOR_CSTD */
-
-#endif /* _STLP_INTERNAL_CSTDDEF */
diff --git a/stl/_cstdio.h b/stl/_cstdio.h
deleted file mode 100644
index c4afb35..0000000
--- a/stl/_cstdio.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_CSTDIO
-#define _STLP_INTERNAL_CSTDIO
-
-#if defined (__Lynx__)
-# include _STLP_NATIVE_C_HEADER(stdarg.h)
-#endif
-
-#if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(cstdio)
-#else
-# include _STLP_NATIVE_C_HEADER(stdio.h)
-#endif
-
-#if (defined (__MWERKS__) && !defined (N_PLAT_NLM)) || defined (__BORLANDC__)
-# undef stdin
-# undef stdout
-# undef stderr
-# if defined (__MWERKS__)
-# define stdin (&_STLP_VENDOR_CSTD::__files[0])
-# define stdout (&_STLP_VENDOR_CSTD::__files[1])
-# define stderr (&_STLP_VENDOR_CSTD::__files[2])
-# elif defined (__BORLANDC__)
-# define stdin (&_STLP_VENDOR_CSTD::_streams[0])
-# define stdout (&_STLP_VENDOR_CSTD::_streams[1])
-# define stderr (&_STLP_VENDOR_CSTD::_streams[2])
-# endif
-#endif
-
-#if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER)
-inline int vsnprintf(char *s1, size_t n, const char *s2, va_list v)
-{ return _STLP_VENDOR_CSTD::_vsnprintf(s1, n, s2, v); }
-#endif
-
-#if defined (_STLP_IMPORT_VENDOR_CSTD )
-_STLP_BEGIN_NAMESPACE
-using _STLP_VENDOR_CSTD::FILE;
-using _STLP_VENDOR_CSTD::fpos_t;
-using _STLP_VENDOR_CSTD::size_t;
-
-// undef obsolete macros
-# undef putc
-# undef getc
-# undef getchar
-# undef putchar
-# undef feof
-# undef ferror
-
-# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
-using _STLP_VENDOR_CSTD::clearerr;
-using _STLP_VENDOR_CSTD::fclose;
-using _STLP_VENDOR_CSTD::feof;
-using _STLP_VENDOR_CSTD::ferror;
-using _STLP_VENDOR_CSTD::fflush;
-using _STLP_VENDOR_CSTD::fgetc;
-using _STLP_VENDOR_CSTD::fgetpos;
-using _STLP_VENDOR_CSTD::fgets;
-using _STLP_VENDOR_CSTD::fopen;
-using _STLP_VENDOR_CSTD::fprintf;
-using _STLP_VENDOR_CSTD::fputc;
-using _STLP_VENDOR_CSTD::fputs;
-using _STLP_VENDOR_CSTD::fread;
-# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this
-using _STLP_VENDOR_CSTD::freopen;
-# endif
-using _STLP_VENDOR_CSTD::fscanf;
-using _STLP_VENDOR_CSTD::fseek;
-using _STLP_VENDOR_CSTD::fsetpos;
-using _STLP_VENDOR_CSTD::ftell;
-using _STLP_VENDOR_CSTD::fwrite;
-
-# if !(defined (__IBMCPP__) && (__IBMCPP__ >= 500))
-# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this except as macros. TODO: use inline function to redirect to the macros?
- using _STLP_VENDOR_CSTD::getc;
- using _STLP_VENDOR_CSTD::putc;
-# endif
- using _STLP_VENDOR_CSTD::getchar;
- using _STLP_VENDOR_CSTD::putchar;
-# endif
-
-using _STLP_VENDOR_CSTD::gets;
-# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this
-using _STLP_VENDOR_CSTD::perror;
-# endif
-using _STLP_VENDOR_CSTD::printf;
-using _STLP_VENDOR_CSTD::puts;
-# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this
-using _STLP_VENDOR_CSTD::remove;
-using _STLP_VENDOR_CSTD::rename;
-using _STLP_VENDOR_CSTD::rewind;
-using _STLP_VENDOR_CSTD::setbuf;
-using _STLP_VENDOR_CSTD::tmpfile;
-using _STLP_VENDOR_CSTD::tmpnam;
-# endif
-using _STLP_VENDOR_CSTD::scanf;
-using _STLP_VENDOR_CSTD::setvbuf;
-using _STLP_VENDOR_CSTD::sprintf;
-using _STLP_VENDOR_CSTD::sscanf;
-using _STLP_VENDOR_CSTD::ungetc;
-using _STLP_VENDOR_CSTD::vfprintf;
-using _STLP_VENDOR_CSTD::vprintf;
-using _STLP_VENDOR_CSTD::vsprintf;
-# if ((defined (__MWERKS__) && !defined (N_PLAT_NLM)) || (defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400)) || \
- (defined (__BORLANDC__)))
-using _STLP_VENDOR_CSTD::vsnprintf;
-# endif
-# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
-_STLP_END_NAMESPACE
-#endif /* _STLP_IMPORT_VENDOR_CSTD */
-
-#endif /* _STLP_INTERNAL_CSTDIO */
diff --git a/stl/_cstdlib.h b/stl/_cstdlib.h
deleted file mode 100644
index 6c5437d..0000000
--- a/stl/_cstdlib.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_CSTDLIB
-#define _STLP_INTERNAL_CSTDLIB
-
-#if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
-#else
-# include <stdlib.h>
-#endif
-
-#if defined (__BORLANDC__)
-/* Borland process.h header do not bring anything here and is just included
- * in order to avoid inclusion later. This header cannot be included later
- * because Borland compiler consider that for instance the abort function
- * defined as extern "C" cannot be overloaded and it finds 2 "overloads",
- * once in native std namespace and the other in STLport namespace...
- */
-# include <process.h>
-#endif
-
-/* on evc3/evc4 including stdlib.h also defines setjmp macro */
-#if defined (_STLP_WCE)
-# define _STLP_NATIVE_SETJMP_H_INCLUDED
-#endif
-
-#if defined (__MSL__) && (__MSL__ <= 0x5003)
-namespace std {
- typedef ::div_t div_t;
- typedef ::ldiv_t ldiv_t;
-# ifdef __MSL_LONGLONG_SUPPORT__
- typedef ::lldiv_t lldiv_t;
-# endif
-}
-#endif
-
-#ifdef _STLP_IMPORT_VENDOR_CSTD
-_STLP_BEGIN_NAMESPACE
-# if !defined (ANDROID)
-// these types don't exist on Android
-using _STLP_VENDOR_CSTD::div_t;
-using _STLP_VENDOR_CSTD::ldiv_t;
-# endif
-using _STLP_VENDOR_CSTD::size_t;
-
-# ifndef _STLP_NO_CSTD_FUNCTION_IMPORTS
-# ifndef _STLP_WCE
-// these functions just don't exist on Windows CE
-using _STLP_VENDOR_CSTD::abort;
-using _STLP_VENDOR_CSTD::getenv;
-# if !defined (ANDROID)
-// these functions don't exist on Android
-using _STLP_VENDOR_CSTD::mblen;
-using _STLP_VENDOR_CSTD::mbtowc;
-using _STLP_VENDOR_CSTD::system;
-using _STLP_VENDOR_CSTD::bsearch;
-# endif
-# endif
-using _STLP_VENDOR_CSTD::atexit;
-using _STLP_VENDOR_CSTD::exit;
-using _STLP_VENDOR_CSTD::calloc;
-using _STLP_VENDOR_CSTD::free;
-using _STLP_VENDOR_CSTD::malloc;
-using _STLP_VENDOR_CSTD::realloc;
-using _STLP_VENDOR_CSTD::atof;
-using _STLP_VENDOR_CSTD::atoi;
-using _STLP_VENDOR_CSTD::atol;
-# if !defined (ANDROID)
-// this function doesn't exist on Android
-using _STLP_VENDOR_CSTD::mbstowcs;
-# endif
-using _STLP_VENDOR_CSTD::strtod;
-using _STLP_VENDOR_CSTD::strtol;
-using _STLP_VENDOR_CSTD::strtoul;
-
-# if !(defined (_STLP_NO_NATIVE_WIDE_STREAMS) || defined (_STLP_NO_MBSTATE_T))
-using _STLP_VENDOR_CSTD::wcstombs;
-# ifndef _STLP_WCE
-using _STLP_VENDOR_CSTD::wctomb;
-# endif
-# endif
-using _STLP_VENDOR_CSTD::qsort;
-using _STLP_VENDOR_CSTD::labs;
-# if !defined (ANDROID)
-// this function doesn't exist on Android
-using _STLP_VENDOR_CSTD::ldiv;
-# endif
-# if defined (_STLP_LONG_LONG) && !defined (_STLP_NO_VENDOR_STDLIB_L)
-# if !defined(__sun)
-using _STLP_VENDOR_CSTD::llabs;
-# if !defined (ANDROID)
-// these types don't exist on Android
-using _STLP_VENDOR_CSTD::lldiv_t;
-using _STLP_VENDOR_CSTD::lldiv;
-# endif
-# else
-using ::llabs;
-using ::lldiv_t;
-using ::lldiv;
-# endif
-# endif
-using _STLP_VENDOR_CSTD::rand;
-using _STLP_VENDOR_CSTD::srand;
-# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
-_STLP_END_NAMESPACE
-#endif /* _STLP_IMPORT_VENDOR_CSTD */
-
-#if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
-//In this config bcc define everything in std namespace and not in
-//the global one.
-inline int abs(int __x) { return _STLP_VENDOR_CSTD::abs(__x); }
-inline _STLP_VENDOR_CSTD::div_t div(int __x, int __y) { return _STLP_VENDOR_CSTD::div(__x, __y); }
-#endif
-
-#if defined(_MSC_EXTENSIONS) && defined(_STLP_MSVC) && (_STLP_MSVC <= 1300)
-# define _STLP_RESTORE_FUNCTION_INTRINSIC
-# pragma warning (push)
-# pragma warning (disable: 4162)
-# pragma function (abs)
-#endif
-
-//HP-UX native lib has abs() and div() functions in global namespace
-#if !defined (__HP_aCC) || (__HP_aCC < 30000)
-
-//MSVC starting with .Net 2003 already define all math functions in global namespace:
-# if !defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)
-inline long abs(long __x) { return _STLP_VENDOR_CSTD::labs(__x); }
-# endif
-
-/** VC since version 8 has this, the platform SDK and CE SDKs hanging behind.
- * Android doesn't have ldiv_t. */
-# if (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER) || defined(UNDER_CE)) && !defined (ANDROID)
-inline _STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y) { return _STLP_VENDOR_CSTD::ldiv(__x, __y); }
-# endif
-
-#endif
-
-#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
-# pragma intrinsic (abs)
-# pragma warning (pop)
-# undef _STLP_RESTORE_FUNCTION_INTRINSIC
-#endif
-
-#if defined (_STLP_LONG_LONG)
-# if !defined (_STLP_NO_VENDOR_STDLIB_L)
-# if !defined (__sun)
-inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return _STLP_VENDOR_CSTD::llabs(__x); }
-# if !defined (ANDROID)
-// Android doesn't have lldiv_t.
-inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return _STLP_VENDOR_CSTD::lldiv(__x, __y); }
-# endif
-# else
-inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return ::llabs(__x); }
-inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return ::lldiv(__x, __y); }
-# endif
-# else
-inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; }
-# endif
-#endif
-
-/* C++ Standard is unclear about several call to 'using ::func' if new overloads
- * of ::func appears between 2 successive 'using' calls. To avoid this potential
- * problem we provide all abs overload before the 'using' call.
- * Beware: This header inclusion has to be after all abs overload of this file.
- * The first 'using ::abs' call is going to be in the other header.
- */
-#ifndef _STLP_INTERNAL_CMATH
-# include <stl/_cmath.h>
-#endif
-
-#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
-// ad hoc, don't replace with _STLP_VENDOR_CSTD::abs here! - ptr 2005-03-05
-_STLP_BEGIN_NAMESPACE
-using ::abs;
-# if !defined (ANDROID)
-// Android doesn't have div_t or ldiv_t.
-# if !defined (N_PLAT_NLM)
-using ::div;
-# else
-// Don't use div from clib or libc on NetWare---buggy! - ptr 2005-06-06
-inline div_t div(int __x, int __y) { div_t d; d.quot = __x / __y; d.rem = __x % __y; return d; }
-inline ldiv_t div(long __x, long __y) { ldiv_t d; d.quot = __x / __y; d.rem = __x % __y; return d; }
-# endif
-# endif
-_STLP_END_NAMESPACE
-#endif
-
-#endif /* _STLP_INTERNAL_CSTDLIB */
diff --git a/stl/_cstring.h b/stl/_cstring.h
deleted file mode 100644
index 8f39a7a..0000000
--- a/stl/_cstring.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_CSTRING
-#define _STLP_INTERNAL_CSTRING
-
-#if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(cstring)
-#else
-# include _STLP_NATIVE_C_HEADER(string.h)
-#endif
-
-#ifdef _STLP_IMPORT_VENDOR_CSTD
-_STLP_BEGIN_NAMESPACE
-# include <using/cstring>
-_STLP_END_NAMESPACE
-#endif /* _STLP_IMPORT_VENDOR_CSTD */
-
-#endif /* _STLP_INTERNAL_CSTRING */
diff --git a/stl/_ctime.h b/stl/_ctime.h
deleted file mode 100644
index d995d42..0000000
--- a/stl/_ctime.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_CTIME
-#define _STLP_INTERNAL_CTIME
-
-#if !defined (_STLP_WCE_EVC3)
-
-# if defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(ctime)
-# else
-# include _STLP_NATIVE_C_HEADER(time.h)
-# endif
-
-# if defined (_STLP_IMPORT_VENDOR_CSTD)
-_STLP_BEGIN_NAMESPACE
-using _STLP_VENDOR_CSTD::size_t;
-using _STLP_VENDOR_CSTD::clock_t;
-using _STLP_VENDOR_CSTD::time_t;
-using _STLP_VENDOR_CSTD::tm;
-# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
-using _STLP_VENDOR_CSTD::clock;
-using _STLP_VENDOR_CSTD::asctime;
-using _STLP_VENDOR_CSTD::ctime;
-using _STLP_VENDOR_CSTD::gmtime;
-
-# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this
-using _STLP_VENDOR_CSTD::difftime;
-# endif
-using _STLP_VENDOR_CSTD::mktime;
-using _STLP_VENDOR_CSTD::localtime;
-using _STLP_VENDOR_CSTD::strftime;
-using _STLP_VENDOR_CSTD::time;
-# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
-_STLP_END_NAMESPACE
-# endif /* _STLP_IMPORT_VENDOR_CSTD */
-
-#endif
-
-#endif /* _STLP_INTERNAL_CTIME */
diff --git a/stl/_ctype.h b/stl/_ctype.h
deleted file mode 100644
index b110f45..0000000
--- a/stl/_ctype.h
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// WARNING: This is an internal header file, included by other C++
-// standard library headers. You should not attempt to use this header
-// file directly.
-
-#ifndef _STLP_INTERNAL_CTYPE_H
-#define _STLP_INTERNAL_CTYPE_H
-
-#ifndef _STLP_C_LOCALE_H
-# include <stl/c_locale.h>
-#endif
-
-#ifndef _STLP_INTERNAL_LOCALE_H
-# include <stl/_locale.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-class _STLP_CLASS_DECLSPEC ctype_base {
-public:
- enum mask {
- space = _Locale_SPACE,
- print = _Locale_PRINT,
- cntrl = _Locale_CNTRL,
- upper = _Locale_UPPER,
- lower = _Locale_LOWER,
- alpha = _Locale_ALPHA,
- digit = _Locale_DIGIT,
- punct = _Locale_PUNCT,
- xdigit = _Locale_XDIGIT,
- alnum = alpha | digit,
- graph = alnum | punct
- };
-};
-
-// ctype<> template
-
-template <class charT> class ctype {};
-template <class charT> class ctype_byname {};
-
-//ctype specializations
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC ctype<char> : public locale::facet, public ctype_base {
-#ifndef _STLP_NO_WCHAR_T
-# ifdef _STLP_MSVC
- typedef ctype<wchar_t> _Wctype;
- friend _Wctype;
-# else
- friend class ctype<wchar_t>;
-# endif
-#endif
- friend class _Locale_impl;
-public:
-
- typedef char char_type;
-
- explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0);
- bool is(mask __m, char __c) const
- { return ((*(_M_ctype_table+(unsigned char)__c)) & __m) != 0; }
-
- const char* is(const char* __low, const char* __high, mask* __vec) const {
- for (const char* __p = __low;__p != __high; ++__p, ++__vec) {
- *__vec = _M_ctype_table[(unsigned char)*__p];
- }
- return __high;
- }
-
- const char* scan_is(mask __m, const char* __low, const char* __high) const;
- const char* scan_not(mask __m, const char* __low, const char* __high) const;
-
- char (toupper)(char __c) const { return do_toupper(__c); }
- const char* (toupper)(char* __low, const char* __high) const {
- return do_toupper(__low, __high);
- }
-
- char (tolower)(char __c) const { return do_tolower(__c); }
- const char* (tolower)(char* __low, const char* __high) const {
- return do_tolower(__low, __high);
- }
-
- char widen(char __c) const { return do_widen(__c); }
- const char* widen(const char* __low, const char* __high, char* __to) const {
- return do_widen(__low, __high, __to);
- }
-
- char narrow(char __c, char __dfault) const {
- return do_narrow(__c, __dfault);
- }
- const char* narrow(const char* __low, const char* __high,
- char __dfault, char* __to) const {
- return do_narrow(__low, __high, __dfault, __to);
- }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-# if defined(_STLP_STATIC_CONST_INIT_BUG)
- enum __TableSize { table_size = 256 };
-# else
- static const size_t table_size = 256;
-# endif
-
-protected:
- const mask* table() const _STLP_NOTHROW { return _M_ctype_table; }
- static const mask* _STLP_CALL classic_table() _STLP_NOTHROW;
-
- ~ctype();
-
- virtual char do_toupper(char __c) const;
- virtual char do_tolower(char __c) const;
- virtual const char* do_toupper(char* __low, const char* __high) const;
- virtual const char* do_tolower(char* __low, const char* __high) const;
- virtual char do_widen(char __c) const;
- virtual const char* do_widen(const char* __low, const char* __high,
- char* __to) const;
- virtual char do_narrow(char __c, char /* dfault */ ) const;
- virtual const char* do_narrow(const char* __low, const char* __high,
- char /* dfault */, char* __to) const;
-private:
- struct _Is_mask {
- mask __m;
- _Is_mask(mask __x): __m(__x) {}
- bool operator()(char __c) {return (__m & (unsigned char) __c) != 0;}
- };
-
-protected:
- const mask* _M_ctype_table;
-private:
- bool _M_delete;
-};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC ctype_byname<char>: public ctype<char> {
-public:
- explicit ctype_byname(const char*, size_t = 0, _Locale_name_hint* __hint = 0);
- ~ctype_byname();
-
- virtual char do_toupper(char __c) const;
- virtual char do_tolower(char __c) const;
-
- virtual const char* do_toupper(char*, const char*) const;
- virtual const char* do_tolower(char*, const char*) const;
-
-private:
- mask _M_byname_table[table_size];
- _Locale_ctype* _M_ctype;
-
- //explicitely defined as private to avoid warnings:
- typedef ctype_byname<char> _Self;
- ctype_byname(_Self const&);
- _Self& operator = (_Self const&);
- friend _Locale_name_hint* _Locale_extract_hint(ctype_byname<char>*);
-};
-
-# ifndef _STLP_NO_WCHAR_T
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC ctype<wchar_t> : public locale::facet, public ctype_base
-{
- friend class _Locale_impl;
-public:
- typedef wchar_t char_type;
-
- explicit ctype(size_t __refs = 0) : locale::facet(__refs) {}
-
- bool is(mask __m, wchar_t __c) const
- { return do_is(__m, __c); }
-
- const wchar_t* is(const wchar_t* __low, const wchar_t* __high,
- mask* __vec) const
- { return do_is(__low, __high, __vec); }
-
- const wchar_t* scan_is(mask __m,
- const wchar_t* __low, const wchar_t* __high) const
- { return do_scan_is(__m, __low, __high); }
-
- const wchar_t* scan_not (mask __m,
- const wchar_t* __low, const wchar_t* __high) const
- { return do_scan_not(__m, __low, __high); }
-
- wchar_t (toupper)(wchar_t __c) const { return do_toupper(__c); }
- const wchar_t* (toupper)(wchar_t* __low, const wchar_t* __high) const
- { return do_toupper(__low, __high); }
-
- wchar_t (tolower)(wchar_t __c) const { return do_tolower(__c); }
- const wchar_t* (tolower)(wchar_t* __low, const wchar_t* __high) const
- { return do_tolower(__low, __high); }
-
- wchar_t widen(char __c) const { return do_widen(__c); }
- const char* widen(const char* __low, const char* __high,
- wchar_t* __to) const
- { return do_widen(__low, __high, __to); }
-
- char narrow(wchar_t __c, char __dfault) const
- { return do_narrow(__c, __dfault); }
- const wchar_t* narrow(const wchar_t* __low, const wchar_t* __high,
- char __dfault, char* __to) const
- { return do_narrow(__low, __high, __dfault, __to); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- ~ctype();
-
- virtual bool do_is(mask __m, wchar_t __c) const;
- virtual const wchar_t* do_is(const wchar_t*, const wchar_t*, mask*) const;
- virtual const wchar_t* do_scan_is(mask,
- const wchar_t*, const wchar_t*) const;
- virtual const wchar_t* do_scan_not(mask,
- const wchar_t*, const wchar_t*) const;
- virtual wchar_t do_toupper(wchar_t __c) const;
- virtual const wchar_t* do_toupper(wchar_t*, const wchar_t*) const;
- virtual wchar_t do_tolower(wchar_t c) const;
- virtual const wchar_t* do_tolower(wchar_t*, const wchar_t*) const;
- virtual wchar_t do_widen(char c) const;
- virtual const char* do_widen(const char*, const char*, wchar_t*) const;
- virtual char do_narrow(wchar_t __c, char __dfault) const;
- virtual const wchar_t* do_narrow(const wchar_t*, const wchar_t*,
- char, char*) const;
-};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC ctype_byname<wchar_t>: public ctype<wchar_t> {
-public:
- explicit ctype_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
-
-protected:
- ~ctype_byname();
-
- virtual bool do_is(mask __m, wchar_t __c) const;
- virtual const wchar_t* do_is(const wchar_t*, const wchar_t*, mask*) const;
- virtual const wchar_t* do_scan_is(mask,
- const wchar_t*, const wchar_t*) const;
- virtual const wchar_t* do_scan_not(mask,
- const wchar_t*, const wchar_t*) const;
- virtual wchar_t do_toupper(wchar_t __c) const;
- virtual const wchar_t* do_toupper(wchar_t*, const wchar_t*) const;
- virtual wchar_t do_tolower(wchar_t c) const;
- virtual const wchar_t* do_tolower(wchar_t*, const wchar_t*) const;
-
-private:
- _Locale_ctype* _M_ctype;
-
- //explicitely defined as private to avoid warnings:
- typedef ctype_byname<wchar_t> _Self;
- ctype_byname(_Self const&);
- _Self& operator = (_Self const&);
-};
-
-# endif /* WCHAR_T */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_CTYPE_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_cwchar.h b/stl/_cwchar.h
deleted file mode 100644
index 26836ad..0000000
--- a/stl/_cwchar.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_CWCHAR
-#define _STLP_INTERNAL_CWCHAR
-
-#if defined (_STLP_WCE_EVC3)
-# ifndef _STLP_INTERNAL_MBSTATE_T
-# include <stl/_mbstate_t.h>
-# endif
-#else
-# if defined (__GNUC__)
-# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
-# endif
-
-# if !defined (_STLP_NO_CWCHAR) && defined (_STLP_USE_NEW_C_HEADERS)
-# include _STLP_NATIVE_CPP_C_HEADER(cwchar)
-# if defined (__OpenBSD__)
-typedef _BSD_WINT_T_ wint_t;
-# endif /* __OpenBSD__ */
-
-# elif defined (_STLP_NO_WCHAR_T) || defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)) || \
- (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) || \
- defined (__OpenBSD__) || defined (__FreeBSD__) || \
- (defined (__GNUC__) && (defined (__APPLE__) || defined ( __Lynx__ )))
-# include _STLP_NATIVE_C_HEADER(stddef.h)
-# if defined (__Lynx__)
-# ifndef _WINT_T
-typedef long int wint_t;
-# define _WINT_T
-# endif /* _WINT_T */
-# endif
-# if defined(__OpenBSD__)
-typedef _BSD_WINT_T_ wint_t;
-# endif /* __OpenBSD__ */
-# elif defined (__MWERKS__) && defined (N_PLAT_NLM)
-# include <wchar.h>
-# elif !defined (ANDROID)
-// Android doesn't have a working wchar.h
-# include _STLP_NATIVE_C_HEADER(wchar.h)
-
-# if defined (__sun) && (defined (_XOPEN_SOURCE) || (_XOPEN_VERSION - 0 == 4))
-extern wint_t btowc();
-extern int fwprintf();
-extern int fwscanf();
-extern int fwide();
-extern int mbsinit();
-extern size_t mbrlen();
-extern size_t mbrtowc();
-extern size_t mbsrtowcs();
-extern int swprintf();
-extern int swscanf();
-extern int vfwprintf();
-extern int vwprintf();
-extern int vswprintf();
-extern size_t wcrtomb();
-extern size_t wcsrtombs();
-extern wchar_t *wcsstr();
-extern int wctob();
-extern wchar_t *wmemchr();
-extern int wmemcmp();
-extern wchar_t *wmemcpy();
-extern wchar_t *wmemmove();
-extern wchar_t *wmemset();
-extern int wprintf();
-extern int wscanf();
-# endif
-# endif
-
-# if defined (__MSL__) && (__MSL__ <= 0x51FF) /* dwa 2/28/99 - not yet implemented by MSL */
-# define _STLP_WCHAR_MSL_EXCLUDE 1
-namespace std {
- extern "C" size_t wcsftime(wchar_t * str, size_t max_size, const wchar_t * format_str, const struct tm * timeptr);
-}
-# define _STLP_NO_MBSTATE_T 1
-# elif defined (__BORLANDC__)
-# if !defined (_STLP_USE_NO_IOSTREAMS)
-# define _STLP_NO_NATIVE_MBSTATE_T
-# endif
-# define _STLP_WCHAR_BORLAND_EXCLUDE 1
-# endif
-
-# ifndef _STLP_INTERNAL_MBSTATE_T
-# include <stl/_mbstate_t.h>
-# endif
-
-# if !defined (_STLP_NO_WCHAR_T)
-# ifndef WCHAR_MIN
-# define WCHAR_MIN 0
-/* SUNpro has some bugs with casts. wchar_t is size of int there anyway. */
-# if defined (__SUNPRO_CC) || defined (__DJGPP)
-# define WCHAR_MAX (~0)
-# else
-# define WCHAR_MAX ((wchar_t)~0)
-# endif
-# endif
-# if defined (__GNUC__) && defined (__alpha__)
-/* Definition of WCHAR_MIN and MAX are wrong for alpha platform
- * as gcc consider wchar_t as an unsigned type. Static assertion are
- * here to check that a future alpha SDK or a future gcc won't change the
- * situation making this workaround useless.
- */
-_STLP_STATIC_ASSERT(((wchar_t)-1 > 0) && (WCHAR_MIN < 0))
-# undef WCHAR_MIN
-# define WCHAR_MIN 0
-# undef WCHAR_MAX
-# define WCHAR_MAX ((wchar_t)~0)
-# endif
-# if defined(__HP_aCC) && (__HP_aCC >= 60000)
-/* Starting with B.11.31, HP-UX/ia64 provides C99-compliant definitions
- * of WCHAR_MIN/MAX macros without having to define
- * _INCLUDE_STDC__SOURCE_199901 macro (which aCC compiler does not
- * predefine). Let STLport provide B.11.31 definitions on any version of
- * HP-UX/ia64.
- */
-# undef WCHAR_MIN
-# define WCHAR_MIN 0
-# undef WCHAR_MAX
-# define WCHAR_MAX UINT_MAX
-# endif
-# endif
-
-# if defined (_STLP_IMPORT_VENDOR_CSTD)
-
-# if defined (__SUNPRO_CC) && !defined (_STLP_HAS_NO_NEW_C_HEADERS)
-using _STLP_VENDOR_CSTD::wint_t;
-# endif
-
-_STLP_BEGIN_NAMESPACE
-# if defined (_STLP_NO_WCHAR_T)
-typedef int wint_t;
-# else
-// gcc 3.0 has a glitch : wint_t only sucked into the global namespace if _GLIBCPP_USE_WCHAR_T is defined
-// __MWERKS__ has definition in wchar_t.h (MSL C++), but ones differ from definition
-// in stdio.h; I prefer settings from last file.
-# if (defined (__GNUC__) && ! defined (_GLIBCPP_USE_WCHAR_T)) // || (defined(__MWERKS__) && defined(N_PLAT_NLM))
-using ::wint_t;
-# else
-using _STLP_VENDOR_CSTD::wint_t;
-# endif
-# endif
-
-using _STLP_VENDOR_CSTD::size_t;
-
-# if !defined (_STLP_NO_NATIVE_MBSTATE_T) && !defined (_STLP_USE_OWN_MBSTATE_T)
-using _STLP_VENDOR_MB_NAMESPACE::mbstate_t;
-
-# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && \
- (!defined(__MSL__) || __MSL__ > 0x6001)
-# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \
- !(defined (__KCC) || defined (__GNUC__)) && !defined(_STLP_WCE_NET) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
-using _STLP_VENDOR_MB_NAMESPACE::btowc;
-# if (!defined(__MSL__) || __MSL__ > 0x7001)
-using _STLP_VENDOR_MB_NAMESPACE::mbsinit;
-# endif
-# endif
-# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \
- !defined (__GNUC__) && !defined(_STLP_WCE_NET) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
-using _STLP_VENDOR_MB_NAMESPACE::mbrlen;
-using _STLP_VENDOR_MB_NAMESPACE::mbrtowc;
-using _STLP_VENDOR_MB_NAMESPACE::mbsrtowcs;
-using _STLP_VENDOR_MB_NAMESPACE::wcrtomb;
-using _STLP_VENDOR_MB_NAMESPACE::wcsrtombs;
-# endif
-# endif /* BORLAND && !__MSL__ || __MSL__ > 0x6001 */
-
-# endif /* _STLP_NO_NATIVE_MBSTATE_T */
-
-# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
-
-# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
-using _STLP_VENDOR_CSTD::fgetwc;
-using _STLP_VENDOR_CSTD::fgetws;
-using _STLP_VENDOR_CSTD::fputwc;
-using _STLP_VENDOR_CSTD::fputws;
-# endif
-
-# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \
- defined(_STLP_WCHAR_HPACC_EXCLUDE) || (defined(__MWERKS__) && defined(N_PLAT_NLM)))
-# if !defined (__DECCXX)
-using _STLP_VENDOR_CSTD::fwide;
-# endif
-using _STLP_VENDOR_CSTD::fwprintf;
-using _STLP_VENDOR_CSTD::fwscanf;
-using _STLP_VENDOR_CSTD::getwchar;
-# endif
-
-# if !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
-# ifndef _STLP_WCE_NET
-using _STLP_VENDOR_CSTD::getwc;
-# endif
-using _STLP_VENDOR_CSTD::ungetwc;
-# ifndef _STLP_WCE_NET
-using _STLP_VENDOR_CSTD::putwc;
-# endif
-using _STLP_VENDOR_CSTD::putwchar;
-# endif
-
-# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \
- defined (_STLP_WCHAR_HPACC_EXCLUDE) || (defined (__MWERKS__) && defined (N_PLAT_NLM)))
-# if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB <= 1300) || \
- defined (__MINGW32__)
-# undef swprintf
-# define swprintf _snwprintf
-# undef vswprintf
-# define vswprintf _vsnwprintf
-using ::swprintf;
-using ::vswprintf;
-# else
-using _STLP_VENDOR_CSTD::swprintf;
-using _STLP_VENDOR_CSTD::vswprintf;
-# endif
-using _STLP_VENDOR_CSTD::swscanf;
-using _STLP_VENDOR_CSTD::vfwprintf;
-using _STLP_VENDOR_CSTD::vwprintf;
-
-# if (!defined(__MSL__) || __MSL__ > 0x7001 ) && !defined(_STLP_WCE_NET) && \
- !defined(_STLP_USE_UCLIBC) /* at least in uClibc 0.9.26 */
-
-using _STLP_VENDOR_CSTD::wcsftime;
-# endif
-using _STLP_VENDOR_CSTD::wcstok;
-
-# endif
-
-# if !(defined(__MWERKS__) && defined(N_PLAT_NLM))
-# if !defined (_STLP_WCE_NET)
-using _STLP_VENDOR_CSTD::wcscoll;
-using _STLP_VENDOR_CSTD::wcsxfrm;
-# endif
-using _STLP_VENDOR_CSTD::wcscat;
-using _STLP_VENDOR_CSTD::wcsrchr;
-using _STLP_VENDOR_CSTD::wcscmp;
-
-using _STLP_VENDOR_CSTD::wcscpy;
-using _STLP_VENDOR_CSTD::wcscspn;
-
-using _STLP_VENDOR_CSTD::wcslen;
-using _STLP_VENDOR_CSTD::wcsncat;
-using _STLP_VENDOR_CSTD::wcsncmp;
-using _STLP_VENDOR_CSTD::wcsncpy;
-using _STLP_VENDOR_CSTD::wcspbrk;
-using _STLP_VENDOR_CSTD::wcschr;
-
-using _STLP_VENDOR_CSTD::wcsspn;
-# endif
-
-# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && !(defined(__MWERKS__) && defined(N_PLAT_NLM))
-using _STLP_VENDOR_CSTD::wcstod;
-using _STLP_VENDOR_CSTD::wcstol;
-# endif
-
-# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_HPACC_EXCLUDE) || \
- (defined (__MWERKS__) && defined (N_PLAT_NLM)))
-using _STLP_VENDOR_CSTD::wcsstr;
-using _STLP_VENDOR_CSTD::wmemchr;
-
-# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE)
-# if !defined (_STLP_WCE_NET)
-using _STLP_VENDOR_CSTD::wctob;
-# endif
-# if !defined (__DMC__)
-using _STLP_VENDOR_CSTD::wmemcmp;
-using _STLP_VENDOR_CSTD::wmemmove;
-# endif
-using _STLP_VENDOR_CSTD::wprintf;
-using _STLP_VENDOR_CSTD::wscanf;
-# endif
-
-# if defined (__BORLANDC__)
-inline wchar_t* _STLP_wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n)
-{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::wmemcpy(__wdst, __wsrc, __n)); }
-inline wchar_t* _STLP_wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
-{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::memset(__wdst, __wc, __n)); }
-# undef wmemcpy
-# undef wmemset
-inline wchar_t* wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n)
-{ return _STLP_wmemcpy(__wdst, __wsrc, __n); }
-inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
-{ return _STLP_wmemset(__wdst, __wc, __n); }
-# elif defined (__DMC__)
-inline wchar_t* wmemcpy(wchar_t* __RESTRICT __wdst, const wchar_t* __RESTRICT __wsrc, size_t __n)
-{ return __STATIC_CAST(wchar_t*, memcpy(__wdst, __wsrc, __n * sizeof(wchar_t))); }
-inline wchar_t* wmemmove(wchar_t* __RESTRICT __wdst, const wchar_t * __RESTRICT __wc, size_t __n)
-{ return __STATIC_CAST(wchar_t*, memmove(__wdst, __wc, __n * sizeof(wchar_t))); }
-inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
-{ for (size_t i = 0; i < __n; i++) __wdst[i] = __wc; return __wdst; }
-# else
-using _STLP_VENDOR_CSTD::wmemcpy;
-using _STLP_VENDOR_CSTD::wmemset;
-# endif
-# endif
-
-# elif defined (__MWERKS__) && defined (N_PLAT_NLM) /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */
-using _STLP_VENDOR_CSTD::wcslen;
-using _STLP_VENDOR_CSTD::wcscmp;
-using _STLP_VENDOR_CSTD::wcscpy;
-using _STLP_VENDOR_CSTD::wcsstr;
-using _STLP_VENDOR_CSTD::wcschr;
-using _STLP_VENDOR_CSTD::wcsrchr;
-using _STLP_VENDOR_CSTD::wcspbrk;
-# endif /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */
-_STLP_END_NAMESPACE
-
-# endif /* _STLP_IMPORT_VENDOR_CSTD */
-
-# undef _STLP_WCHAR_SUNPRO_EXCLUDE
-# undef _STLP_WCHAR_MSL_EXCLUDE
-
-# endif /* !defined(_STLP_WCE_EVC3) */
-
-#endif /* _STLP_INTERNAL_CWCHAR */
diff --git a/stl/_cwctype.h b/stl/_cwctype.h
deleted file mode 100644
index 32db7ef..0000000
--- a/stl/_cwctype.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_CWCTYPE
-#define _STLP_INTERNAL_CWCTYPE
-
-#if defined (__BORLANDC__) && !defined (_STLP_INTERNAL_CCTYPE)
-# include <stl/_cctype.h>
-#endif
-
-#if !defined (_STLP_WCE_EVC3)
-# if defined (_STLP_USE_NEW_C_HEADERS)
-# if !defined (N_PLAT_NLM)
-# include _STLP_NATIVE_CPP_C_HEADER(cwctype)
-# else
- // see comments in stlport/cwchar about wint_t on Novell
-# include _STLP_NATIVE_CPP_C_HEADER(wchar_t.h)
-# include _STLP_NATIVE_C_HEADER(stddef.h)
-# include _STLP_NATIVE_C_HEADER(stdio.h)
-# endif
-# if defined (__MSL__) && !defined (N_PLAT_NLM)
-namespace std {
- typedef wchar_t wctrans_t;
- wint_t towctrans(wint_t c, wctrans_t value);
- wctrans_t wctrans(const char *name);
-}
-using std::wctrans_t;
-using std::towctrans;
-using std::wctrans;
-# endif
-# else
-# include _STLP_NATIVE_C_HEADER(wctype.h)
-# endif
-
-# if defined (_STLP_IMPORT_VENDOR_CSTD)
-
-# if defined (_STLP_USE_GLIBC) && !(defined (_GLIBCPP_USE_WCHAR_T) || defined (_GLIBCXX_USE_WCHAR_T)) || \
- defined (__sun) || defined (__FreeBSD__) || \
- defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION < 3) || (__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION <= 0))
-//We take wide functions from global namespace:
-# define _STLP_VENDOR_CSTD_WFUNC
-# else
-# define _STLP_VENDOR_CSTD_WFUNC _STLP_VENDOR_CSTD
-# endif
-
-_STLP_BEGIN_NAMESPACE
-using _STLP_VENDOR_CSTD_WFUNC::wctype_t;
-using _STLP_VENDOR_CSTD_WFUNC::wint_t;
-# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
-# if !defined (__BORLANDC__) && !defined (__MSL__)
-using _STLP_VENDOR_CSTD_WFUNC::wctrans_t;
-# if !defined (__DMC__) && (!defined(_WIN32_WCE) || _WIN32_WCE<0x500)
-using _STLP_VENDOR_CSTD_WFUNC::towctrans;
-using _STLP_VENDOR_CSTD_WFUNC::wctrans;
-using _STLP_VENDOR_CSTD_WFUNC::wctype;
-# endif
-using _STLP_VENDOR_CSTD_WFUNC::iswctype;
-# endif
-# if !defined(N_PLAT_NLM)
-using _STLP_VENDOR_CSTD_WFUNC::iswalnum;
-using _STLP_VENDOR_CSTD_WFUNC::iswalpha;
-using _STLP_VENDOR_CSTD_WFUNC::iswcntrl;
-
-using _STLP_VENDOR_CSTD_WFUNC::iswdigit;
-using _STLP_VENDOR_CSTD_WFUNC::iswgraph;
-using _STLP_VENDOR_CSTD_WFUNC::iswlower;
-using _STLP_VENDOR_CSTD_WFUNC::iswprint;
-using _STLP_VENDOR_CSTD_WFUNC::iswpunct;
-using _STLP_VENDOR_CSTD_WFUNC::iswspace;
-using _STLP_VENDOR_CSTD_WFUNC::iswupper;
-using _STLP_VENDOR_CSTD_WFUNC::iswxdigit;
-
-using _STLP_VENDOR_CSTD_WFUNC::towlower;
-using _STLP_VENDOR_CSTD_WFUNC::towupper;
-# endif /* !N_PLAT_NLM */
-# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
-_STLP_END_NAMESPACE
-# endif /* _STLP_IMPORT_VENDOR_CSTD */
-#endif /* _STLP_WCE_EVC3 */
-
-#endif /* _STLP_INTERNAL_CWCTYPE */
diff --git a/stl/_deque.c b/stl/_deque.c
deleted file mode 100644
index 52d6fc9..0000000
--- a/stl/_deque.c
+++ /dev/null
@@ -1,814 +0,0 @@
-/*
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_DEQUE_C
-#define _STLP_DEQUE_C
-
-#ifndef _STLP_INTERNAL_DEQUE_H
-# include <stl/_deque.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// Non-inline member functions from _Deque_base.
-
-template <class _Tp, class _Alloc >
-_Deque_base<_Tp,_Alloc >::~_Deque_base() {
- if (_M_map._M_data) {
- _M_destroy_nodes(_M_start._M_node, this->_M_finish._M_node + 1);
- _M_map.deallocate(_M_map._M_data, _M_map_size._M_data);
- }
-}
-
-template <class _Tp, class _Alloc >
-void _Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t __num_elements) {
- size_t __num_nodes = __num_elements / this->buffer_size() + 1 ;
-
- _M_map_size._M_data = (max)((size_t) _S_initial_map_size, __num_nodes + 2);
- _M_map._M_data = _M_map.allocate(_M_map_size._M_data);
-
- _Tp** __nstart = _M_map._M_data + (_M_map_size._M_data - __num_nodes) / 2;
- _Tp** __nfinish = __nstart + __num_nodes;
-
- _STLP_TRY {
- _M_create_nodes(__nstart, __nfinish);
- }
- _STLP_UNWIND((_M_map.deallocate(_M_map._M_data, _M_map_size._M_data),
- _M_map._M_data = 0, _M_map_size._M_data = 0))
- _M_start._M_set_node(__nstart);
- this->_M_finish._M_set_node(__nfinish - 1);
- _M_start._M_cur = _M_start._M_first;
- this->_M_finish._M_cur = this->_M_finish._M_first + __num_elements % this->buffer_size();
-}
-
-template <class _Tp, class _Alloc >
-void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart,
- _Tp** __nfinish) {
- _Tp** __cur = __nstart;
- _STLP_TRY {
- for (; __cur < __nfinish; ++__cur)
- *__cur = _M_map_size.allocate(this->buffer_size());
- }
- _STLP_UNWIND(_M_destroy_nodes(__nstart, __cur))
-}
-
-template <class _Tp, class _Alloc >
-void _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart,
- _Tp** __nfinish) {
- for (_Tp** __n = __nstart; __n < __nfinish; ++__n)
- _M_map_size.deallocate(*__n, this->buffer_size());
-}
-
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-# define deque _STLP_PTR_IMPL_NAME(deque)
-#elif defined (_STLP_DEBUG)
-# define deque _STLP_NON_DBG_NAME(deque)
-#else
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
-// qualified references
-# define __iterator__ _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >
-# define const_iterator _Deque_iterator<_Tp, _Const_traits<_Tp> >
-# define iterator __iterator__
-# define size_type size_t
-# define value_type _Tp
-#else
-# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE deque<_Tp, _Alloc>::iterator
-#endif
-
-template <class _Tp, class _Alloc >
-deque<_Tp, _Alloc >&
-deque<_Tp, _Alloc >::operator= (const deque<_Tp, _Alloc >& __x) {
- const size_type __len = size();
- if (&__x != this) {
- if (__len >= __x.size())
- erase(copy(__x.begin(), __x.end(), this->_M_start), this->_M_finish);
- else {
- const_iterator __mid = __x.begin() + difference_type(__len);
- copy(__x.begin(), __mid, this->_M_start);
- insert(this->_M_finish, __mid, __x.end());
- }
- }
- return *this;
-}
-
-template <class _Tp, class _Alloc >
-void deque<_Tp, _Alloc >::_M_fill_insert(iterator __pos,
- size_type __n, const value_type& __x) {
- if (__pos._M_cur == this->_M_start._M_cur) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- _STLP_TRY {
- uninitialized_fill(__new_start, this->_M_start, __x);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
- this->_M_start = __new_start;
- }
- else if (__pos._M_cur == this->_M_finish._M_cur) {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- _STLP_TRY {
- uninitialized_fill(this->_M_finish, __new_finish, __x);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node+1, __new_finish._M_node+1))
- this->_M_finish = __new_finish;
- }
- else
- _M_fill_insert_aux(__pos, __n, __x, _Movable());
-}
-
-#if !defined (_STLP_MEMBER_TEMPLATES)
-
-template <class _Tp, class _Alloc >
-void deque<_Tp, _Alloc>::insert(iterator __pos,
- const value_type* __first, const value_type* __last) {
- size_type __n = __last - __first;
- if (__pos._M_cur == this->_M_start._M_cur) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- _STLP_TRY {
- _STLP_PRIV __ucopy(__first, __last, __new_start);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
- this->_M_start = __new_start;
- }
- else if (__pos._M_cur == this->_M_finish._M_cur) {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- _STLP_TRY {
- _STLP_PRIV __ucopy(__first, __last, this->_M_finish);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1,
- __new_finish._M_node + 1))
- this->_M_finish = __new_finish;
- }
- else
- _M_insert_range_aux(__pos, __first, __last, __n, _Movable());
-}
-
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::insert(iterator __pos,
- const_iterator __first, const_iterator __last) {
- size_type __n = __last - __first;
- if (__pos._M_cur == this->_M_start._M_cur) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- _STLP_TRY {
- _STLP_PRIV __ucopy(__first, __last, __new_start);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
- this->_M_start = __new_start;
- }
- else if (__pos._M_cur == this->_M_finish._M_cur) {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- _STLP_TRY {
- _STLP_PRIV __ucopy(__first, __last, this->_M_finish);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1,
- __new_finish._M_node + 1))
- this->_M_finish = __new_finish;
- }
- else
- _M_insert_range_aux(__pos, __first, __last, __n, _Movable());
-}
-
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc >
-__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __pos,
- const __true_type& /*_Movable*/) {
- difference_type __index = __pos - this->_M_start;
- if (size_type(__index) < this->size() >> 1) {
- //We move the start of the deque one position to the right
- //starting from the rightmost element to move.
- iterator __src = __pos, __dst = __pos;
- _STLP_STD::_Destroy(&(*__dst));
- if (__src != this->_M_start) {
- for (--__src; __dst != this->_M_start; --__src, --__dst) {
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- _STLP_STD::_Destroy_Moved(&(*__src));
- }
- }
- _M_pop_front_aux();
- }
- else {
- iterator __src = __pos, __dst = __pos;
- _STLP_STD::_Destroy(&(*__dst));
- for (++__src; __src != this->_M_finish; ++__src, ++__dst) {
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- _STLP_STD::_Destroy_Moved(&(*__src));
- }
- //Duplication of the pop_back code without the destroy which has already been done:
- if (this->_M_finish._M_cur != this->_M_finish._M_first) {
- --this->_M_finish._M_cur;
- }
- else {
- _M_pop_back_aux();
- }
- }
- return this->_M_start + __index;
-}
-
-template <class _Tp, class _Alloc >
-__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __pos,
- const __false_type& /*_Movable*/) {
- iterator __next = __pos;
- ++__next;
- difference_type __index = __pos - this->_M_start;
- if (size_type(__index) < this->size() >> 1) {
- copy_backward(this->_M_start, __pos, __next);
- pop_front();
- }
- else {
- copy(__next, this->_M_finish, __pos);
- pop_back();
- }
- return this->_M_start + __index;
-}
-
-template <class _Tp, class _Alloc >
-__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __first, iterator __last,
- const __true_type& /*_Movable*/) {
- difference_type __n = __last - __first;
- difference_type __elems_before = __first - this->_M_start;
- if (__elems_before <= difference_type(this->size() - __n) / 2) {
- iterator __src = __first, __dst = __last;
- if (__src != this->_M_start) {
- for (--__src, --__dst; (__src >= this->_M_start) && (__dst >= __first); --__src, --__dst) {
- _STLP_STD::_Destroy(&(*__dst));
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- }
- if (__dst >= __first) {
- //There are more elements to erase than elements to move
- _STLP_STD::_Destroy_Range(__first, ++__dst);
- _STLP_STD::_Destroy_Moved_Range(this->_M_start, __first);
- }
- else {
- //There are more elements to move than elements to erase
- for (; __src >= this->_M_start; --__src, --__dst) {
- _STLP_STD::_Destroy_Moved(&(*__dst));
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- }
- _STLP_STD::_Destroy_Moved_Range(this->_M_start, ++__dst);
- }
- }
- else {
- _STLP_STD::_Destroy_Range(this->_M_start, __last);
- }
- iterator __new_start = this->_M_start + __n;
- this->_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node);
- this->_M_start = __new_start;
- }
- else {
- if (__last != this->_M_finish) {
- iterator __src = __last, __dst = __first;
- for (; (__src != this->_M_finish) && (__dst != __last); ++__src, ++__dst) {
- _STLP_STD::_Destroy(&(*__dst));
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- }
- if (__dst != __last) {
- //There are more elements to erase than elements to move
- _STLP_STD::_Destroy_Range(__dst, __last);
- _STLP_STD::_Destroy_Moved_Range(__last, this->_M_finish);
- }
- else {
- //There are more elements to move than elements to erase
- for (; __src != this->_M_finish; ++__src, ++__dst) {
- _STLP_STD::_Destroy_Moved(&(*__dst));
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- }
- _STLP_STD::_Destroy_Moved_Range(__dst, this->_M_finish);
- }
- }
- else {
- _STLP_STD::_Destroy_Range(__first, this->_M_finish);
- }
- iterator __new_finish = this->_M_finish - __n;
- this->_M_destroy_nodes(__new_finish._M_node + 1, this->_M_finish._M_node + 1);
- this->_M_finish = __new_finish;
- }
- return this->_M_start + __elems_before;
-}
-
-template <class _Tp, class _Alloc >
-__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __first, iterator __last,
- const __false_type& /*_Movable*/) {
- difference_type __n = __last - __first;
- difference_type __elems_before = __first - this->_M_start;
- if (__elems_before <= difference_type(this->size() - __n) / 2) {
- copy_backward(this->_M_start, __first, __last);
- iterator __new_start = this->_M_start + __n;
- _STLP_STD::_Destroy_Range(this->_M_start, __new_start);
- this->_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node);
- this->_M_start = __new_start;
- }
- else {
- copy(__last, this->_M_finish, __first);
- iterator __new_finish = this->_M_finish - __n;
- _STLP_STD::_Destroy_Range(__new_finish, this->_M_finish);
- this->_M_destroy_nodes(__new_finish._M_node + 1, this->_M_finish._M_node + 1);
- this->_M_finish = __new_finish;
- }
- return this->_M_start + __elems_before;
-}
-
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::clear() {
- for (_Map_pointer __node = this->_M_start._M_node + 1;
- __node < this->_M_finish._M_node;
- ++__node) {
- _STLP_STD::_Destroy_Range(*__node, *__node + this->buffer_size());
- this->_M_map_size.deallocate(*__node, this->buffer_size());
- }
-
- if (this->_M_start._M_node != this->_M_finish._M_node) {
- _STLP_STD::_Destroy_Range(this->_M_start._M_cur, this->_M_start._M_last);
- _STLP_STD::_Destroy_Range(this->_M_finish._M_first, this->_M_finish._M_cur);
- this->_M_map_size.deallocate(this->_M_finish._M_first, this->buffer_size());
- }
- else
- _STLP_STD::_Destroy_Range(this->_M_start._M_cur, this->_M_finish._M_cur);
-
- this->_M_finish = this->_M_start;
-}
-
-// Precondition: this->_M_start and this->_M_finish have already been initialized,
-// but none of the deque's elements have yet been constructed.
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_fill_initialize(const value_type& __val,
- const __false_type& /*_TrivialInit*/) {
- _Map_pointer __cur = this->_M_start._M_node;
- _STLP_TRY {
- for (; __cur < this->_M_finish._M_node; ++__cur)
- uninitialized_fill(*__cur, *__cur + this->buffer_size(), __val);
- uninitialized_fill(this->_M_finish._M_first, this->_M_finish._M_cur, __val);
- }
- _STLP_UNWIND(_STLP_STD::_Destroy_Range(this->_M_start, iterator(*__cur, __cur)))
-}
-
-
-// Called only if this->_M_finish._M_cur == this->_M_finish._M_last - 1.
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_push_back_aux_v(const value_type& __t) {
- _M_reserve_map_at_back();
- *(this->_M_finish._M_node + 1) = this->_M_map_size.allocate(this->buffer_size());
- _STLP_TRY {
- _Copy_Construct(this->_M_finish._M_cur, __t);
- this->_M_finish._M_set_node(this->_M_finish._M_node + 1);
- this->_M_finish._M_cur = this->_M_finish._M_first;
- }
- _STLP_UNWIND(this->_M_map_size.deallocate(*(this->_M_finish._M_node + 1),
- this->buffer_size()))
-}
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
-// Called only if this->_M_finish._M_cur == this->_M_finish._M_last - 1.
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_push_back_aux() {
- _M_reserve_map_at_back();
- *(this->_M_finish._M_node + 1) = this->_M_map_size.allocate(this->buffer_size());
- _STLP_TRY {
- _STLP_STD::_Construct(this->_M_finish._M_cur);
- this->_M_finish._M_set_node(this->_M_finish._M_node + 1);
- this->_M_finish._M_cur = this->_M_finish._M_first;
- }
- _STLP_UNWIND(this->_M_map_size.deallocate(*(this->_M_finish._M_node + 1),
- this->buffer_size()))
-}
-#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
-// Called only if this->_M_start._M_cur == this->_M_start._M_first.
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_push_front_aux_v(const value_type& __t) {
- _M_reserve_map_at_front();
- *(this->_M_start._M_node - 1) = this->_M_map_size.allocate(this->buffer_size());
- _STLP_TRY {
- this->_M_start._M_set_node(this->_M_start._M_node - 1);
- this->_M_start._M_cur = this->_M_start._M_last - 1;
- _Copy_Construct(this->_M_start._M_cur, __t);
- }
- _STLP_UNWIND((++this->_M_start,
- this->_M_map_size.deallocate(*(this->_M_start._M_node - 1), this->buffer_size())))
-}
-
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
-// Called only if this->_M_start._M_cur == this->_M_start._M_first.
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_push_front_aux() {
- _M_reserve_map_at_front();
- *(this->_M_start._M_node - 1) = this->_M_map_size.allocate(this->buffer_size());
- _STLP_TRY {
- this->_M_start._M_set_node(this->_M_start._M_node - 1);
- this->_M_start._M_cur = this->_M_start._M_last - 1;
- _STLP_STD::_Construct(this->_M_start._M_cur);
- }
- _STLP_UNWIND((++this->_M_start, this->_M_map_size.deallocate(*(this->_M_start._M_node - 1),
- this->buffer_size())))
-}
-#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
-// Called only if this->_M_finish._M_cur == this->_M_finish._M_first.
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_pop_back_aux() {
- this->_M_map_size.deallocate(this->_M_finish._M_first, this->buffer_size());
- this->_M_finish._M_set_node(this->_M_finish._M_node - 1);
- this->_M_finish._M_cur = this->_M_finish._M_last - 1;
-}
-
-// Note that if the deque has at least one element (a precondition for this member
-// function), and if this->_M_start._M_cur == this->_M_start._M_last, then the deque
-// must have at least two nodes.
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_pop_front_aux() {
- if (this->_M_start._M_cur != this->_M_start._M_last - 1)
- ++this->_M_start._M_cur;
- else {
- this->_M_map_size.deallocate(this->_M_start._M_first, this->buffer_size());
- this->_M_start._M_set_node(this->_M_start._M_node + 1);
- this->_M_start._M_cur = this->_M_start._M_first;
- }
-}
-
-template <class _Tp, class _Alloc >
-__iterator__ deque<_Tp,_Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n,
- const value_type& __x,
- const __true_type& /*_Movable*/) {
- const difference_type __elems_before = __pos - this->_M_start;
- size_type __length = this->size();
- value_type __x_copy = __x;
- if (__elems_before <= difference_type(__length / 2)) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- __pos = this->_M_start + __elems_before;
- _STLP_TRY {
- iterator __dst = __new_start;
- iterator __src = this->_M_start;
- for (; __src != __pos; ++__dst, ++__src) {
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- _STLP_STD::_Destroy_Moved(&(*__src));
- }
- this->_M_start = __new_start;
- uninitialized_fill(__dst, __src, __x_copy);
- __pos = __dst;
- }
- _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- const difference_type __elems_after = difference_type(__length) - __elems_before;
- __pos = this->_M_finish - __elems_after;
- _STLP_TRY {
- iterator __dst = __new_finish;
- iterator __src = this->_M_finish;
- for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- _STLP_STD::_Destroy_Moved(&(*__src));
- }
- this->_M_finish = __new_finish;
- uninitialized_fill(__pos, __pos + __n, __x_copy);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
- }
- return __pos;
-}
-
-template <class _Tp, class _Alloc >
-__iterator__ deque<_Tp,_Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n,
- const value_type& __x,
- const __false_type& /*_Movable*/) {
- const difference_type __elems_before = __pos - this->_M_start;
- size_type __length = this->size();
- value_type __x_copy = __x;
- if (__elems_before <= difference_type(__length / 2)) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- iterator __old_start = this->_M_start;
- __pos = this->_M_start + __elems_before;
- _STLP_TRY {
- if (__elems_before >= difference_type(__n)) {
- iterator __start_n = this->_M_start + difference_type(__n);
- _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start);
- this->_M_start = __new_start;
- copy(__start_n, __pos, __old_start);
- fill(__pos - difference_type(__n), __pos, __x_copy);
- __pos -= difference_type(__n);
- }
- else {
- _STLP_PRIV __uninitialized_copy_fill(this->_M_start, __pos, __new_start,
- this->_M_start, __x_copy);
- this->_M_start = __new_start;
- fill(__old_start, __pos, __x_copy);
- }
- }
- _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- iterator __old_finish = this->_M_finish;
- const difference_type __elems_after =
- difference_type(__length) - __elems_before;
- __pos = this->_M_finish - __elems_after;
- _STLP_TRY {
- if (__elems_after > difference_type(__n)) {
- iterator __finish_n = this->_M_finish - difference_type(__n);
- _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish);
- this->_M_finish = __new_finish;
- copy_backward(__pos, __finish_n, __old_finish);
- fill(__pos, __pos + difference_type(__n), __x_copy);
- }
- else {
- _STLP_PRIV __uninitialized_fill_copy(this->_M_finish, __pos + difference_type(__n),
- __x_copy, __pos, this->_M_finish);
- this->_M_finish = __new_finish;
- fill(__pos, __old_finish, __x_copy);
- }
- }
- _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
- }
- return __pos;
-}
-
-#if !defined (_STLP_MEMBER_TEMPLATES)
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
- const value_type* __first, const value_type* __last,
- size_type __n, const __true_type& /*_Movable*/) {
- const difference_type __elems_before = __pos - this->_M_start;
- size_type __length = size();
- if (__elems_before <= difference_type(__length / 2)) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- __pos = this->_M_start + __elems_before;
- _STLP_TRY {
- iterator __dst = __new_start;
- iterator __src = this->_M_start;
- for (; __src != __pos; ++__dst, ++__src) {
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- _STLP_STD::_Destroy_Moved(&(*__src));
- }
- this->_M_start = __new_start;
- _STLP_PRIV __ucopy(__first, __last, __dst);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- const difference_type __elems_after = difference_type(__length) - __elems_before;
- __pos = this->_M_finish - __elems_after;
- _STLP_TRY {
- iterator __dst = __new_finish;
- iterator __src = this->_M_finish;
- for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- _STLP_STD::_Destroy_Moved(&(*__src));
- }
- this->_M_finish = __new_finish;
- _STLP_PRIV __ucopy(__first, __last, __pos);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
- }
-}
-
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
- const value_type* __first, const value_type* __last,
- size_type __n, const __false_type& /*_Movable*/) {
- const difference_type __elems_before = __pos - this->_M_start;
- size_type __length = size();
- if (__elems_before <= difference_type(__length / 2)) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- iterator __old_start = this->_M_start;
- __pos = this->_M_start + __elems_before;
- _STLP_TRY {
- if (__elems_before >= difference_type(__n)) {
- iterator __start_n = this->_M_start + difference_type(__n);
- _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start);
- this->_M_start = __new_start;
- copy(__start_n, __pos, __old_start);
- copy(__first, __last, __pos - difference_type(__n));
- }
- else {
- const value_type* __mid = __first + (difference_type(__n) - __elems_before);
- __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
- this->_M_start = __new_start;
- copy(__mid, __last, __old_start);
- }
- }
- _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- iterator __old_finish = this->_M_finish;
- const difference_type __elems_after =
- difference_type(__length) - __elems_before;
- __pos = this->_M_finish - __elems_after;
- _STLP_TRY {
-
- if (__elems_after > difference_type(__n)) {
- iterator __finish_n = this->_M_finish - difference_type(__n);
- _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish);
- this->_M_finish = __new_finish;
- copy_backward(__pos, __finish_n, __old_finish);
- copy(__first, __last, __pos);
- }
- else {
- const value_type* __mid = __first + __elems_after;
- __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
- this->_M_finish = __new_finish;
- copy(__first, __mid, __pos);
- }
- }
- _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
- }
-}
-
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
- const_iterator __first, const_iterator __last,
- size_type __n, const __true_type& /*_Movable*/) {
- const difference_type __elems_before = __pos - this->_M_start;
- size_type __length = size();
- if (__elems_before <= difference_type(__length / 2)) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- __pos = this->_M_start + __elems_before;
- _STLP_TRY {
- iterator __dst = __new_start;
- iterator __src = this->_M_start;
- for (; __src != __pos; ++__dst, ++__src) {
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- _STLP_STD::_Destroy_Moved(&(*__src));
- }
- this->_M_start = __new_start;
- _STLP_PRIV __ucopy(__first, __last, __dst);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- const difference_type __elems_after = difference_type(__length) - __elems_before;
- __pos = this->_M_finish - __elems_after;
- _STLP_TRY {
- iterator __dst = __new_finish;
- iterator __src = this->_M_finish;
- for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- _STLP_STD::_Destroy_Moved(&(*__src));
- }
- this->_M_finish = __new_finish;
- _STLP_PRIV __ucopy(__first, __last, __pos);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
- }
-}
-
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
- const_iterator __first, const_iterator __last,
- size_type __n, const __false_type& /*_Movable*/) {
- const difference_type __elems_before = __pos - this->_M_start;
- size_type __length = size();
- if (__elems_before < difference_type(__length / 2)) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- iterator __old_start = this->_M_start;
- __pos = this->_M_start + __elems_before;
- _STLP_TRY {
- if (__elems_before >= difference_type(__n)) {
- iterator __start_n = this->_M_start + __n;
- _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start);
- this->_M_start = __new_start;
- copy(__start_n, __pos, __old_start);
- copy(__first, __last, __pos - difference_type(__n));
- }
- else {
- const_iterator __mid = __first + (__n - __elems_before);
- __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
- this->_M_start = __new_start;
- copy(__mid, __last, __old_start);
- }
- }
- _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- iterator __old_finish = this->_M_finish;
- const difference_type __elems_after = __length - __elems_before;
- __pos = this->_M_finish - __elems_after;
- _STLP_TRY {
- if (__elems_after > difference_type(__n)) {
- iterator __finish_n = this->_M_finish - difference_type(__n);
- _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish);
- this->_M_finish = __new_finish;
- copy_backward(__pos, __finish_n, __old_finish);
- copy(__first, __last, __pos);
- }
- else {
- const_iterator __mid = __first + __elems_after;
- __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
- this->_M_finish = __new_finish;
- copy(__first, __mid, __pos);
- }
- }
- _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
- }
-}
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_new_elements_at_front(size_type __new_elems) {
- size_type __new_nodes
- = (__new_elems + this->buffer_size() - 1) / this->buffer_size();
- _M_reserve_map_at_front(__new_nodes);
- size_type __i = 1;
- _STLP_TRY {
- for (; __i <= __new_nodes; ++__i)
- *(this->_M_start._M_node - __i) = this->_M_map_size.allocate(this->buffer_size());
- }
- _STLP_UNWIND(for (size_type __j = 1; __j < __i; ++__j)
- this->_M_map_size.deallocate(*(this->_M_start._M_node - __j), this->buffer_size()))
-}
-
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_new_elements_at_back(size_type __new_elems) {
- size_type __new_nodes
- = (__new_elems + this->buffer_size() - 1) / this->buffer_size();
- _M_reserve_map_at_back(__new_nodes);
- size_type __i = 1;
- _STLP_TRY {
- for (; __i <= __new_nodes; ++__i)
- *(this->_M_finish._M_node + __i) = this->_M_map_size.allocate(this->buffer_size());
- }
- _STLP_UNWIND(for (size_type __j = 1; __j < __i; ++__j)
- this->_M_map_size.deallocate(*(this->_M_finish._M_node + __j), this->buffer_size()))
-}
-
-template <class _Tp, class _Alloc >
-void deque<_Tp,_Alloc>::_M_reallocate_map(size_type __nodes_to_add,
- bool __add_at_front) {
- size_type __old_num_nodes = this->_M_finish._M_node - this->_M_start._M_node + 1;
- size_type __new_num_nodes = __old_num_nodes + __nodes_to_add;
-
- _Map_pointer __new_nstart;
- if (this->_M_map_size._M_data > 2 * __new_num_nodes) {
- __new_nstart = this->_M_map._M_data + (this->_M_map_size._M_data - __new_num_nodes) / 2
- + (__add_at_front ? __nodes_to_add : 0);
- if (__new_nstart < this->_M_start._M_node)
- copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart);
- else
- copy_backward(this->_M_start._M_node, this->_M_finish._M_node + 1,
- __new_nstart + __old_num_nodes);
- }
- else {
- size_type __new_map_size =
- this->_M_map_size._M_data + (max)((size_t)this->_M_map_size._M_data, __nodes_to_add) + 2;
-
- _Map_pointer __new_map = this->_M_map.allocate(__new_map_size);
- __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2
- + (__add_at_front ? __nodes_to_add : 0);
- copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart);
- this->_M_map.deallocate(this->_M_map._M_data, this->_M_map_size._M_data);
-
- this->_M_map._M_data = __new_map;
- this->_M_map_size._M_data = __new_map_size;
- }
-
- this->_M_start._M_set_node(__new_nstart);
- this->_M_finish._M_set_node(__new_nstart + __old_num_nodes - 1);
-}
-
-#if defined (deque)
-# undef deque
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-_STLP_END_NAMESPACE
-
-#undef __iterator__
-#undef iterator
-#undef const_iterator
-#undef size_type
-#undef value_type
-
-#endif /* _STLP_DEQUE_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_deque.h b/stl/_deque.h
deleted file mode 100644
index 6b8b938..0000000
--- a/stl/_deque.h
+++ /dev/null
@@ -1,1097 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_DEQUE_H
-#define _STLP_INTERNAL_DEQUE_H
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-# include <stl/_alloc.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ITERATOR_H
-# include <stl/_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_UNINITIALIZED_H
-# include <stl/_uninitialized.h>
-#endif
-
-#ifndef _STLP_RANGE_ERRORS_H
-# include <stl/_range_errors.h>
-#endif
-
-/* Class invariants:
- * For any nonsingular iterator i:
- * i.node is the address of an element in the map array. The
- * contents of i.node is a pointer to the beginning of a node.
- * i.first == *(i.node)
- * i.last == i.first + node_size
- * i.cur is a pointer in the range [i.first, i.last). NOTE:
- * the implication of this is that i.cur is always a dereferenceable
- * pointer, even if i is a past-the-end iterator.
- * Start and Finish are always nonsingular iterators. NOTE: this means
- * that an empty deque must have one node, and that a deque
- * with N elements, where N is the buffer size, must have two nodes.
- * For every node other than start.node and finish.node, every element
- * in the node is an initialized object. If start.node == finish.node,
- * then [start.cur, finish.cur) are initialized objects, and
- * the elements outside that range are uninitialized storage. Otherwise,
- * [start.cur, start.last) and [finish.first, finish.cur) are initialized
- * objects, and [start.first, start.cur) and [finish.cur, finish.last)
- * are uninitialized storage.
- * [map, map + map_size) is a valid, non-empty range.
- * [start.node, finish.node] is a valid range contained within
- * [map, map + map_size).
- * A pointer in the range [map, map + map_size) points to an allocated node
- * if and only if the pointer is in the range [start.node, finish.node].
- */
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Tp>
-struct _Deque_iterator_base {
-
- enum _Constants {
- _blocksize = _MAX_BYTES,
- __buffer_size = (sizeof(_Tp) < (size_t)_blocksize ?
- ( (size_t)_blocksize / sizeof(_Tp)) : size_t(1))
- };
-
- typedef random_access_iterator_tag iterator_category;
-
- typedef _Tp value_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- typedef value_type** _Map_pointer;
-
- typedef _Deque_iterator_base< _Tp > _Self;
-
- value_type* _M_cur;
- value_type* _M_first;
- value_type* _M_last;
- _Map_pointer _M_node;
-
- _Deque_iterator_base(value_type* __x, _Map_pointer __y)
- : _M_cur(__x), _M_first(*__y),
- _M_last(*__y + __buffer_size), _M_node(__y) {}
-
- _Deque_iterator_base() : _M_cur(0), _M_first(0), _M_last(0), _M_node(0) {}
-
-// see comment in doc/README.evc4 and doc/README.evc8
-#if defined (_STLP_MSVC) && (_STLP_MSVC <= 1401) && defined (MIPS) && defined (NDEBUG)
- _Deque_iterator_base(_Deque_iterator_base const& __other)
- : _M_cur(__other._M_cur), _M_first(__other._M_first),
- _M_last(__other._M_last), _M_node(__other._M_node) {}
-#endif
-
- difference_type _M_subtract(const _Self& __x) const {
- return difference_type(__buffer_size) * (_M_node - __x._M_node - 1) +
- (_M_cur - _M_first) + (__x._M_last - __x._M_cur);
- }
-
- void _M_increment() {
- if (++_M_cur == _M_last) {
- _M_set_node(_M_node + 1);
- _M_cur = _M_first;
- }
- }
-
- void _M_decrement() {
- if (_M_cur == _M_first) {
- _M_set_node(_M_node - 1);
- _M_cur = _M_last;
- }
- --_M_cur;
- }
-
- void _M_advance(difference_type __n) {
- difference_type __offset = __n + (_M_cur - _M_first);
- if (__offset >= 0 && __offset < difference_type(__buffer_size))
- _M_cur += __n;
- else {
- difference_type __node_offset =
- __offset > 0 ? __offset / __buffer_size
- : -difference_type((-__offset - 1) / __buffer_size) - 1;
- _M_set_node(_M_node + __node_offset);
- _M_cur = _M_first +
-
- (__offset - __node_offset * difference_type(__buffer_size));
- }
- }
-
- void _M_set_node(_Map_pointer __new_node) {
- _M_last = (_M_first = *(_M_node = __new_node)) + difference_type(__buffer_size);
- }
-};
-
-
-template <class _Tp, class _Traits>
-struct _Deque_iterator : public _Deque_iterator_base< _Tp> {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef typename _Traits::reference reference;
- typedef typename _Traits::pointer pointer;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef value_type** _Map_pointer;
-
- typedef _Deque_iterator_base< _Tp > _Base;
- typedef _Deque_iterator<_Tp, _Traits> _Self;
- typedef typename _Traits::_NonConstTraits _NonConstTraits;
- typedef _Deque_iterator<_Tp, _NonConstTraits> iterator;
- typedef typename _Traits::_ConstTraits _ConstTraits;
- typedef _Deque_iterator<_Tp, _ConstTraits> const_iterator;
-
- _Deque_iterator(value_type* __x, _Map_pointer __y) :
- _Deque_iterator_base<value_type>(__x,__y) {}
-
- _Deque_iterator() {}
- //copy constructor for iterator and constructor from iterator for const_iterator
- _Deque_iterator(const iterator& __x) :
- _Deque_iterator_base<value_type>(__x) {}
-
- reference operator*() const {
- return *this->_M_cur;
- }
-
- _STLP_DEFINE_ARROW_OPERATOR
-
- difference_type operator-(const const_iterator& __x) const { return this->_M_subtract(__x); }
-
- _Self& operator++() { this->_M_increment(); return *this; }
- _Self operator++(int) {
- _Self __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _Self& operator--() { this->_M_decrement(); return *this; }
- _Self operator--(int) {
- _Self __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _Self& operator+=(difference_type __n) { this->_M_advance(__n); return *this; }
- _Self operator+(difference_type __n) const {
- _Self __tmp = *this;
- return __tmp += __n;
- }
-
- _Self& operator-=(difference_type __n) { return *this += -__n; }
- _Self operator-(difference_type __n) const {
- _Self __tmp = *this;
- return __tmp -= __n;
- }
-
- reference operator[](difference_type __n) const { return *(*this + __n); }
-};
-
-
-template <class _Tp, class _Traits>
-inline _Deque_iterator<_Tp, _Traits> _STLP_CALL
-operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Traits>& __x)
-{ return __x + __n; }
-
-
-#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
-template <class _Tp>
-inline bool _STLP_CALL
-operator==(const _Deque_iterator_base<_Tp >& __x,
- const _Deque_iterator_base<_Tp >& __y)
-{ return __x._M_cur == __y._M_cur; }
-
-template <class _Tp>
-inline bool _STLP_CALL
-operator < (const _Deque_iterator_base<_Tp >& __x,
- const _Deque_iterator_base<_Tp >& __y) {
- return (__x._M_node == __y._M_node) ?
- (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node);
-}
-
-template <class _Tp>
-inline bool _STLP_CALL
-operator!=(const _Deque_iterator_base<_Tp >& __x,
- const _Deque_iterator_base<_Tp >& __y)
-{ return __x._M_cur != __y._M_cur; }
-
-template <class _Tp>
-inline bool _STLP_CALL
-operator>(const _Deque_iterator_base<_Tp >& __x,
- const _Deque_iterator_base<_Tp >& __y)
-{ return __y < __x; }
-
-template <class _Tp>
-inline bool _STLP_CALL operator>=(const _Deque_iterator_base<_Tp >& __x,
- const _Deque_iterator_base<_Tp >& __y)
-{ return !(__x < __y); }
-
-template <class _Tp>
-inline bool _STLP_CALL operator<=(const _Deque_iterator_base<_Tp >& __x,
- const _Deque_iterator_base<_Tp >& __y)
-{ return !(__y < __x); }
-
-#else /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
-
-template <class _Tp, class _Traits1, class _Traits2>
-inline bool _STLP_CALL
-operator==(const _Deque_iterator<_Tp, _Traits1 >& __x,
- const _Deque_iterator<_Tp, _Traits2 >& __y)
-{ return __x._M_cur == __y._M_cur; }
-
-template <class _Tp, class _Traits1, class _Traits2>
-inline bool _STLP_CALL
-operator < (const _Deque_iterator<_Tp, _Traits1 >& __x,
- const _Deque_iterator<_Tp, _Traits2 >& __y) {
- return (__x._M_node == __y._M_node) ?
- (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node);
-}
-
-template <class _Tp>
-inline bool _STLP_CALL
-operator!=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
- const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
-{ return __x._M_cur != __y._M_cur; }
-
-template <class _Tp>
-inline bool _STLP_CALL
-operator>(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
- const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
-{ return __y < __x; }
-
-template <class _Tp>
-inline bool _STLP_CALL
-operator>=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
- const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
-{ return !(__x < __y); }
-
-template <class _Tp>
-inline bool _STLP_CALL
-operator<=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
- const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
-{ return !(__y < __x); }
-#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-_STLP_MOVE_TO_STD_NAMESPACE
-template <class _Tp, class _Traits>
-struct __type_traits<_STLP_PRIV _Deque_iterator<_Tp, _Traits> > {
- typedef __false_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __false_type is_POD_type;
-};
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
-_STLP_MOVE_TO_STD_NAMESPACE
-template <class _Tp, class _Traits> inline _Tp* _STLP_CALL
-value_type(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return (_Tp*)0; }
-template <class _Tp, class _Traits> inline random_access_iterator_tag _STLP_CALL
-iterator_category(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return random_access_iterator_tag(); }
-template <class _Tp, class _Traits> inline ptrdiff_t* _STLP_CALL
-distance_type(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return 0; }
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-/* Deque base class. It has two purposes. First, its constructor
- * and destructor allocate (but don't initialize) storage. This makes
- * exception safety easier. Second, the base class encapsulates all of
- * the differences between SGI-style allocators and standard-conforming
- * allocators.
- */
-
-template <class _Tp, class _Alloc>
-class _Deque_base {
- typedef _Deque_base<_Tp, _Alloc> _Self;
-public:
- typedef _Tp value_type;
- _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
- typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type;
- typedef _STLP_alloc_proxy<size_t, value_type, allocator_type> _Alloc_proxy;
-
- typedef typename _Alloc_traits<_Tp*, _Alloc>::allocator_type _Map_alloc_type;
- typedef _STLP_alloc_proxy<value_type**, value_type*, _Map_alloc_type> _Map_alloc_proxy;
-
- typedef _Deque_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
- typedef _Deque_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
-
- static size_t _STLP_CALL buffer_size() { return (size_t)_Deque_iterator_base<_Tp>::__buffer_size; }
-
- _Deque_base(const allocator_type& __a, size_t __num_elements)
- : _M_start(), _M_finish(), _M_map(_STLP_CONVERT_ALLOCATOR(__a, _Tp*), 0),
- _M_map_size(__a, (size_t)0)
- { _M_initialize_map(__num_elements); }
-
- _Deque_base(const allocator_type& __a)
- : _M_start(), _M_finish(), _M_map(_STLP_CONVERT_ALLOCATOR(__a, _Tp*), 0),
- _M_map_size(__a, (size_t)0) {}
-
- _Deque_base(__move_source<_Self> src)
- : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
- _M_map(__move_source<_Map_alloc_proxy>(src.get()._M_map)),
- _M_map_size(__move_source<_Alloc_proxy>(src.get()._M_map_size)) {
- src.get()._M_map._M_data = 0;
- src.get()._M_map_size._M_data = 0;
- src.get()._M_finish = src.get()._M_start;
- }
-
- ~_Deque_base();
-
-protected:
- void _M_initialize_map(size_t);
- void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish);
- void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish);
- enum { _S_initial_map_size = 8 };
-
-protected:
- iterator _M_start;
- iterator _M_finish;
- _Map_alloc_proxy _M_map;
- _Alloc_proxy _M_map_size;
-};
-
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-# define deque _STLP_PTR_IMPL_NAME(deque)
-#elif defined (_STLP_DEBUG)
-# define deque _STLP_NON_DBG_NAME(deque)
-#else
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
-class deque : protected _STLP_PRIV _Deque_base<_Tp, _Alloc>
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (deque)
- , public __stlport_class<deque<_Tp, _Alloc> >
-#endif
-{
- typedef _STLP_PRIV _Deque_base<_Tp, _Alloc> _Base;
- typedef deque<_Tp, _Alloc> _Self;
-public: // Basic types
- typedef _Tp value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef random_access_iterator_tag _Iterator_category;
- _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
- typedef typename _Base::allocator_type allocator_type;
-
-public: // Iterators
- typedef typename _Base::iterator iterator;
- typedef typename _Base::const_iterator const_iterator;
-
- _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
-
-protected: // Internal typedefs
- typedef pointer* _Map_pointer;
- typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialAss;
- typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialCpy;
- typedef typename _TrivialInit<_Tp>::_Ret _TrivialInit;
-#if !defined (_STLP_NO_MOVE_SEMANTIC)
- typedef typename __move_traits<_Tp>::implemented _Movable;
-#else
- typedef __false_type _Movable;
-#endif
-
-public: // Basic accessors
- iterator begin() { return this->_M_start; }
- iterator end() { return this->_M_finish; }
- const_iterator begin() const { return const_iterator(this->_M_start); }
- const_iterator end() const { return const_iterator(this->_M_finish); }
-
- reverse_iterator rbegin() { return reverse_iterator(this->_M_finish); }
- reverse_iterator rend() { return reverse_iterator(this->_M_start); }
- const_reverse_iterator rbegin() const
- { return const_reverse_iterator(this->_M_finish); }
- const_reverse_iterator rend() const
- { return const_reverse_iterator(this->_M_start); }
-
- reference operator[](size_type __n)
- { return this->_M_start[difference_type(__n)]; }
- const_reference operator[](size_type __n) const
- { return this->_M_start[difference_type(__n)]; }
-
- void _M_range_check(size_type __n) const {
- if (__n >= this->size())
- __stl_throw_out_of_range("deque");
- }
- reference at(size_type __n)
- { _M_range_check(__n); return (*this)[__n]; }
- const_reference at(size_type __n) const
- { _M_range_check(__n); return (*this)[__n]; }
-
- reference front() { return *this->_M_start; }
- reference back() {
- iterator __tmp = this->_M_finish;
- --__tmp;
- return *__tmp;
- }
- const_reference front() const { return *this->_M_start; }
- const_reference back() const {
- const_iterator __tmp = this->_M_finish;
- --__tmp;
- return *__tmp;
- }
-
- size_type size() const { return this->_M_finish - this->_M_start; }
- size_type max_size() const { return size_type(-1); }
- bool empty() const { return this->_M_finish == this->_M_start; }
- allocator_type get_allocator() const { return this->_M_map_size; }
-
-public: // Constructor, destructor.
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit deque(const allocator_type& __a = allocator_type())
-#else
- deque()
- : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), 0) {}
- deque(const allocator_type& __a)
-#endif
- : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, 0) {}
-
- deque(const _Self& __x)
- : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__x.get_allocator(), __x.size())
- { _STLP_PRIV __ucopy(__x.begin(), __x.end(), this->_M_start); }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
-private:
- void _M_initialize(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(_Tp))
- { _M_fill_initialize(__val, _TrivialInit()); }
-public:
- explicit deque(size_type __n)
- : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n)
- { _M_initialize(__n); }
- deque(size_type __n, const value_type& __val, const allocator_type& __a = allocator_type())
-#else
- explicit deque(size_type __n)
- : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n)
- { _M_fill_initialize(_STLP_DEFAULT_CONSTRUCTED(_Tp), _TrivialInit()); }
- deque(size_type __n, const value_type& __val)
- : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n)
- { _M_fill_initialize(__val, __false_type()); }
- deque(size_type __n, const value_type& __val, const allocator_type& __a)
-#endif
- : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __n)
- { _M_fill_initialize(__val, __false_type()); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-protected:
- template <class _Integer>
- void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) {
- this->_M_initialize_map(__n);
- _M_fill_initialize(__x, __false_type());
- }
-
- template <class _InputIter>
- void _M_initialize_dispatch(_InputIter __first, _InputIter __last,
- const __false_type&) {
- _M_range_initialize(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
- }
-
-public:
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- deque(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_initialize_dispatch(__first, __last, _Integral());
- }
-
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- deque(_InputIterator __first, _InputIterator __last)
- : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type()) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_initialize_dispatch(__first, __last, _Integral());
- }
-# endif
-
-#else
- deque(const value_type* __first, const value_type* __last,
- const allocator_type& __a = allocator_type() )
- : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __last - __first)
- { _STLP_PRIV __ucopy(__first, __last, this->_M_start); }
-
- deque(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type() )
- : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __last - __first)
- { _STLP_PRIV __ucopy(__first, __last, this->_M_start); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- deque(__move_source<_Self> src)
- : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__move_source<_Base>(src.get()))
- {}
-
- ~deque()
- { _STLP_STD::_Destroy_Range(this->_M_start, this->_M_finish); }
-
- _Self& operator= (const _Self& __x);
-
- void swap(_Self& __x) {
- _STLP_STD::swap(this->_M_start, __x._M_start);
- _STLP_STD::swap(this->_M_finish, __x._M_finish);
- this->_M_map.swap(__x._M_map);
- this->_M_map_size.swap(__x._M_map_size);
- }
-
-public:
- // assign(), a generalized assignment member function. Two
- // versions: one that takes a count, and one that takes a range.
- // The range version is a member template, so we dispatch on whether
- // or not the type is an integer.
-
- void _M_fill_assign(size_type __n, const _Tp& __val) {
- if (__n > size()) {
- _STLP_STD::fill(begin(), end(), __val);
- insert(end(), __n - size(), __val);
- }
- else {
- erase(begin() + __n, end());
- _STLP_STD::fill(begin(), end(), __val);
- }
- }
-
- void assign(size_type __n, const _Tp& __val) {
- _M_fill_assign(__n, __val);
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-
-private: // helper functions for assign()
-
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val,
- const __true_type& /*_IsIntegral*/)
- { _M_fill_assign((size_type) __n, (_Tp) __val); }
-
- template <class _InputIterator>
- void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
- const __false_type& /*_IsIntegral*/) {
- _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
- }
-
- template <class _InputIter>
- void _M_assign_aux(_InputIter __first, _InputIter __last, const input_iterator_tag &) {
- iterator __cur = begin();
- for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
- *__cur = *__first;
- if (__first == __last)
- erase(__cur, end());
- else
- insert(end(), __first, __last);
- }
-
- template <class _ForwardIterator>
- void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
- const forward_iterator_tag &) {
-#else
- void assign(const value_type *__first, const value_type *__last) {
- size_type __size = size();
- size_type __len = __last - __first;
- if (__len > __size) {
- const value_type *__mid = __first + __size;
- copy(__first, __mid, begin());
- insert(end(), __mid, __last);
- }
- else {
- erase(copy(__first, __last, begin()), end());
- }
- }
- void assign(const_iterator __first, const_iterator __last) {
- typedef const_iterator _ForwardIterator;
-#endif /* _STLP_MEMBER_TEMPLATES */
- size_type __len = distance(__first, __last);
- if (__len > size()) {
- _ForwardIterator __mid = __first;
- advance(__mid, size());
- copy(__first, __mid, begin());
- insert(end(), __mid, __last);
- }
- else {
- erase(copy(__first, __last, begin()), end());
- }
- }
-
-
-public: // push_* and pop_*
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
-#else
- void push_back(const value_type& __t) {
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) {
- _Copy_Construct(this->_M_finish._M_cur, __t);
- ++this->_M_finish._M_cur;
- }
- else
- _M_push_back_aux_v(__t);
- }
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
-#else
- void push_front(const value_type& __t) {
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- if (this->_M_start._M_cur != this->_M_start._M_first) {
- _Copy_Construct(this->_M_start._M_cur - 1, __t);
- --this->_M_start._M_cur;
- }
- else
- _M_push_front_aux_v(__t);
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_back() {
- if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) {
- _STLP_STD::_Construct(this->_M_finish._M_cur);
- ++this->_M_finish._M_cur;
- }
- else
- _M_push_back_aux();
- }
- void push_front() {
- if (this->_M_start._M_cur != this->_M_start._M_first) {
- _STLP_STD::_Construct(this->_M_start._M_cur - 1);
- --this->_M_start._M_cur;
- }
- else
- _M_push_front_aux();
- }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
- void pop_back() {
- if (this->_M_finish._M_cur != this->_M_finish._M_first) {
- --this->_M_finish._M_cur;
- _STLP_STD::_Destroy(this->_M_finish._M_cur);
- }
- else {
- _M_pop_back_aux();
- _STLP_STD::_Destroy(this->_M_finish._M_cur);
- }
- }
-
- void pop_front() {
- _STLP_STD::_Destroy(this->_M_start._M_cur);
- _M_pop_front_aux();
- }
-
-public: // Insert
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
-#else
- iterator insert(iterator __pos, const value_type& __x) {
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- if (__pos._M_cur == this->_M_start._M_cur) {
- push_front(__x);
- return this->_M_start;
- }
- else if (__pos._M_cur == this->_M_finish._M_cur) {
- push_back(__x);
- iterator __tmp = this->_M_finish;
- --__tmp;
- return __tmp;
- }
- else {
- return _M_fill_insert_aux(__pos, 1, __x, _Movable());
- }
- }
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos)
- { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
- void insert(iterator __pos, size_type __n, const value_type& __x)
- { _M_fill_insert(__pos, __n, __x); }
-
-protected:
- iterator _M_fill_insert_aux(iterator __pos, size_type __n, const value_type& __x, const __true_type& /*_Movable*/);
- iterator _M_fill_insert_aux(iterator __pos, size_type __n, const value_type& __x, const __false_type& /*_Movable*/);
-
- void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _Integer>
- void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
- const __true_type& /*_IsIntegral*/) {
- _M_fill_insert(__pos, (size_type) __n, (value_type) __x);
- }
-
- template <class _InputIterator>
- void _M_insert_dispatch(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- const __false_type& /*_IsIntegral*/) {
- _M_insert(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
- }
-
-public:
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_insert_dispatch(__pos, __first, __last, _Integral());
- }
-
-#else /* _STLP_MEMBER_TEMPLATES */
- void _M_insert_range_aux(iterator __pos,
- const value_type* __first, const value_type* __last,
- size_type __n, const __true_type& /*_Movable*/);
- void _M_insert_range_aux(iterator __pos,
- const value_type* __first, const value_type* __last,
- size_type __n, const __false_type& /*_Movable*/);
- void _M_insert_range_aux(iterator __pos,
- const_iterator __first, const_iterator __last,
- size_type __n, const __true_type& /*_Movable*/);
- void _M_insert_range_aux(iterator __pos,
- const_iterator __first, const_iterator __last,
- size_type __n, const __false_type& /*_Movable*/);
-public:
- void insert(iterator __pos,
- const value_type* __first, const value_type* __last);
- void insert(iterator __pos,
- const_iterator __first, const_iterator __last);
-
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-public:
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size,
- const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
-#else
- void resize(size_type __new_size, const value_type& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- const size_type __len = size();
- if (__new_size < __len)
- erase(this->_M_start + __new_size, this->_M_finish);
- else
- insert(this->_M_finish, __new_size - __len, __x);
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size)
- { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
-protected:
- iterator _M_erase(iterator __pos, const __true_type& /*_Movable*/);
- iterator _M_erase(iterator __pos, const __false_type& /*_Movable*/);
-
- iterator _M_erase(iterator __first, iterator __last, const __true_type& /*_Movable*/);
- iterator _M_erase(iterator __first, iterator __last, const __false_type& /*_Movable*/);
-public: // Erase
- iterator erase(iterator __pos) {
- return _M_erase(__pos, _Movable());
- }
- iterator erase(iterator __first, iterator __last) {
- if (__first == this->_M_start && __last == this->_M_finish) {
- clear();
- return this->_M_finish;
- }
- else {
- if (__first == __last)
- return __first;
- return _M_erase(__first, __last, _Movable());
- }
- }
- void clear();
-
-protected: // Internal construction/destruction
-
- void _M_fill_initialize(const value_type& __val, const __true_type& /*_TrivialInit*/)
- {}
- void _M_fill_initialize(const value_type& __val, const __false_type& /*_TrivialInit*/);
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void _M_range_initialize(_InputIterator __first, _InputIterator __last,
- const input_iterator_tag &) {
- this->_M_initialize_map(0);
- _STLP_TRY {
- for ( ; __first != __last; ++__first)
- push_back(*__first);
- }
- _STLP_UNWIND(clear())
- }
- template <class _ForwardIterator>
- void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
- const forward_iterator_tag &) {
- size_type __n = distance(__first, __last);
- this->_M_initialize_map(__n);
- _Map_pointer __cur_node = this->_M_start._M_node;
- _STLP_TRY {
- for (; __cur_node < this->_M_finish._M_node; ++__cur_node) {
- _ForwardIterator __mid = __first;
- advance(__mid, this->buffer_size());
- uninitialized_copy(__first, __mid, *__cur_node);
- __first = __mid;
- }
- uninitialized_copy(__first, __last, this->_M_finish._M_first);
- }
- _STLP_UNWIND(_STLP_STD::_Destroy_Range(this->_M_start, iterator(*__cur_node, __cur_node)))
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-protected: // Internal push_* and pop_*
-
- void _M_push_back_aux_v(const value_type&);
- void _M_push_front_aux_v(const value_type&);
-#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void _M_push_back_aux();
- void _M_push_front_aux();
-#endif /*_STLP_DONT_SUP_DFLT_PARAM !_STLP_NO_ANACHRONISMS*/
- void _M_pop_back_aux();
- void _M_pop_front_aux();
-
-protected: // Internal insert functions
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-
- template <class _InputIterator>
- void _M_insert(iterator __pos,
- _InputIterator __first,
- _InputIterator __last,
- const input_iterator_tag &) {
- copy(__first, __last, inserter(*this, __pos));
- }
-
- template <class _ForwardIterator>
- void _M_insert(iterator __pos,
- _ForwardIterator __first, _ForwardIterator __last,
- const forward_iterator_tag &) {
- size_type __n = distance(__first, __last);
- if (__pos._M_cur == this->_M_start._M_cur) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- _STLP_TRY {
- uninitialized_copy(__first, __last, __new_start);
- this->_M_start = __new_start;
- }
- _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
- }
- else if (__pos._M_cur == this->_M_finish._M_cur) {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- _STLP_TRY {
- uninitialized_copy(__first, __last, this->_M_finish);
- this->_M_finish = __new_finish;
- }
- _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
- }
- else
- _M_insert_range_aux(__pos, __first, __last, __n, _Movable());
- }
-
- template <class _ForwardIterator>
- void _M_insert_range_aux(iterator __pos,
- _ForwardIterator __first, _ForwardIterator __last,
- size_type __n, const __true_type& /*_Movable*/) {
- const difference_type __elemsbefore = __pos - this->_M_start;
- size_type __length = size();
- if (__elemsbefore <= difference_type(__length / 2)) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- __pos = this->_M_start + __elemsbefore;
- _STLP_TRY {
- iterator __dst = __new_start;
- iterator __src = this->_M_start;
- for (; __src != __pos; ++__dst, ++__src) {
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- _STLP_STD::_Destroy_Moved(&(*__src));
- }
- this->_M_start = __new_start;
- uninitialized_copy(__first, __last, __dst);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- const difference_type __elemsafter = difference_type(__length) - __elemsbefore;
- __pos = this->_M_finish - __elemsafter;
- _STLP_TRY {
- iterator __dst = __new_finish;
- iterator __src = this->_M_finish;
- for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
- _STLP_STD::_Move_Construct(&(*__dst), *__src);
- _STLP_STD::_Destroy_Moved(&(*__src));
- }
- this->_M_finish = __new_finish;
- uninitialized_copy(__first, __last, __pos);
- }
- _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
- }
- }
-
- template <class _ForwardIterator>
- void _M_insert_range_aux(iterator __pos,
- _ForwardIterator __first, _ForwardIterator __last,
- size_type __n, const __false_type& /*_Movable*/) {
- const difference_type __elemsbefore = __pos - this->_M_start;
- size_type __length = size();
- if (__elemsbefore <= difference_type(__length / 2)) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- iterator __old_start = this->_M_start;
- __pos = this->_M_start + __elemsbefore;
- _STLP_TRY {
- if (__elemsbefore >= difference_type(__n)) {
- iterator __start_n = this->_M_start + difference_type(__n);
- uninitialized_copy(this->_M_start, __start_n, __new_start);
- this->_M_start = __new_start;
- copy(__start_n, __pos, __old_start);
- copy(__first, __last, __pos - difference_type(__n));
- }
- else {
- _ForwardIterator __mid = __first;
- advance(__mid, difference_type(__n) - __elemsbefore);
- _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
- this->_M_start = __new_start;
- copy(__mid, __last, __old_start);
- }
- }
- _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- iterator __old_finish = this->_M_finish;
- const difference_type __elemsafter = difference_type(__length) - __elemsbefore;
- __pos = this->_M_finish - __elemsafter;
- _STLP_TRY {
- if (__elemsafter > difference_type(__n)) {
- iterator __finish_n = this->_M_finish - difference_type(__n);
- uninitialized_copy(__finish_n, this->_M_finish, this->_M_finish);
- this->_M_finish = __new_finish;
- copy_backward(__pos, __finish_n, __old_finish);
- copy(__first, __last, __pos);
- }
- else {
- _ForwardIterator __mid = __first;
- advance(__mid, __elemsafter);
- _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
- this->_M_finish = __new_finish;
- copy(__first, __mid, __pos);
- }
- }
- _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
- }
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- iterator _M_reserve_elements_at_front(size_type __n) {
- size_type __vacancies = this->_M_start._M_cur - this->_M_start._M_first;
- if (__n > __vacancies)
- _M_new_elements_at_front(__n - __vacancies);
- return this->_M_start - difference_type(__n);
- }
-
- iterator _M_reserve_elements_at_back(size_type __n) {
- size_type __vacancies = (this->_M_finish._M_last - this->_M_finish._M_cur) - 1;
- if (__n > __vacancies)
- _M_new_elements_at_back(__n - __vacancies);
- return this->_M_finish + difference_type(__n);
- }
-
- void _M_new_elements_at_front(size_type __new_elements);
- void _M_new_elements_at_back(size_type __new_elements);
-
-protected: // Allocation of _M_map and nodes
-
- // Makes sure the _M_map has space for new nodes. Does not actually
- // add the nodes. Can invalidate _M_map pointers. (And consequently,
- // deque iterators.)
-
- void _M_reserve_map_at_back (size_type __nodes_to_add = 1) {
- if (__nodes_to_add + 1 > this->_M_map_size._M_data - (this->_M_finish._M_node - this->_M_map._M_data))
- _M_reallocate_map(__nodes_to_add, false);
- }
-
- void _M_reserve_map_at_front (size_type __nodes_to_add = 1) {
- if (__nodes_to_add > size_type(this->_M_start._M_node - this->_M_map._M_data))
- _M_reallocate_map(__nodes_to_add, true);
- }
-
- void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front);
-};
-
-#if defined (deque)
-# undef deque
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-_STLP_END_NAMESPACE
-
-#if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_deque.c>
-#endif
-
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-# include <stl/pointers/_deque.h>
-#endif
-
-#if defined (_STLP_DEBUG)
-# include <stl/debug/_deque.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#define _STLP_TEMPLATE_CONTAINER deque<_Tp, _Alloc>
-#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
-#include <stl/_relops_cont.h>
-#undef _STLP_TEMPLATE_CONTAINER
-#undef _STLP_TEMPLATE_HEADER
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp, class _Alloc>
-struct __move_traits<deque<_Tp, _Alloc> > {
- typedef __stlp_movable implemented;
- typedef typename __move_traits<_Alloc>::complete complete;
-};
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_DEQUE_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_exception.h b/stl/_exception.h
deleted file mode 100644
index f1fdc4c..0000000
--- a/stl/_exception.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-// The header <exception> contains low-level functions that interact
-// with a compiler's exception-handling mechanism. It is assumed to
-// be supplied with the compiler, rather than with the library, because
-// it is inherently tied very closely to the compiler itself.
-
-// On platforms where <exception> does not exist, this header defines
-// an exception base class. This is *not* a substitute for everything
-// in <exception>, but it suffices to support a bare minimum of STL
-// functionality.
-
-#ifndef _STLP_INTERNAL_EXCEPTION
-#define _STLP_INTERNAL_EXCEPTION
-
-#if !defined (_STLP_NO_EXCEPTION_HEADER)
-
-# if defined ( _UNCAUGHT_EXCEPTION )
-# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
-# endif
-
-# if defined (_STLP_BROKEN_EXCEPTION_CLASS)
-# define exception _STLP_NULLIFIED_BROKEN_EXCEPTION_CLASS
-# define bad_exception _STLP_NULLIFIED_BROKEN_BAD_EXCEPTION_CLASS
-# if defined (_STLP_NO_NEW_NEW_HEADER)
-# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h)
-# else
-# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception)
-# endif
-# undef exception
-# undef bad_exception
-# else
-# if defined (_STLP_NO_NEW_NEW_HEADER)
-# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
-# else
-# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
-# endif
-# endif
-
-# if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) && (defined (_STLP_MSVC) || defined (__ICL))
-// dwa 02/04/00 - here I'm assuming that __ICL uses the same library headers as vc6.
-// the header <yvals.h> which ships with vc6 and is included by its native <exception>
-// actually turns on warnings, so we have to turn them back off.
-# include <stl/config/_warnings_off.h>
-# endif
-
-# if defined (_STLP_USE_OWN_NAMESPACE)
-
-_STLP_BEGIN_NAMESPACE
-# if !defined (_STLP_BROKEN_EXCEPTION_CLASS)
-# if !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64)
-using _STLP_VENDOR_EXCEPT_STD::exception;
-# else
-using ::exception;
-# endif
-using _STLP_VENDOR_EXCEPT_STD::bad_exception;
-# endif
-
-# if !defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS)
-// fbp : many platforms present strange mix of
-// those in various namespaces
-# if !defined (_STLP_VENDOR_UNEXPECTED_STD)
-# define _STLP_VENDOR_UNEXPECTED_STD _STLP_VENDOR_EXCEPT_STD
-# else
-/* The following definitions are for backward compatibility as _STLP_VENDOR_TERMINATE_STD
- * and _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD has been introduce after _STLP_VENDOR_UNEXPECTED_STD
- * and _STLP_VENDOR_UNEXPECTED_STD was the macro used in their place before that introduction.
- */
-# if !defined (_STLP_VENDOR_TERMINATE_STD)
-# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_UNEXPECTED_STD
-# endif
-# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
-# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_UNEXPECTED_STD
-# endif
-# endif
-# if !defined (_STLP_VENDOR_TERMINATE_STD)
-# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
-# endif
-# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
-# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
-# endif
-# if !defined (_STLP_VENDOR_TERMINATE_STD)
-# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
-# endif
-# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
-# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
-# endif
-// weird errors
-# if !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
-# if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
-//See config/_intel.h for reason about this workaround
-using std::unexpected;
-# else
-using _STLP_VENDOR_UNEXPECTED_STD::unexpected;
-# endif
-using _STLP_VENDOR_UNEXPECTED_STD::unexpected_handler;
-using _STLP_VENDOR_UNEXPECTED_STD::set_unexpected;
-# endif
-using _STLP_VENDOR_TERMINATE_STD::terminate;
-using _STLP_VENDOR_TERMINATE_STD::terminate_handler;
-using _STLP_VENDOR_TERMINATE_STD::set_terminate;
-
-# if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
-using _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD::uncaught_exception;
-# endif
-# endif /* !_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS */
-_STLP_END_NAMESPACE
-# endif /* _STLP_OWN_NAMESPACE */
-#else /* _STLP_NO_EXCEPTION_HEADER */
-
-/* fbp : absence of <exception> usually means that those
- * functions are not going to be called by compiler.
- * Still, define them for the user.
- * dums: Policy modification, if the function do not behave like the Standard
- * defined it we do not grant it in the STLport namespace. We will have
- * compile time error rather than runtime error.
- */
-#if 0
-/*
-typedef void (*unexpected_handler)();
-unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY;
-void unexpected();
-
-typedef void (*terminate_handler)();
-terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY;
-void terminate();
-
-bool uncaught_exception(); // not implemented under mpw as of Jan/1999
-*/
-#endif
-
-#endif /* _STLP_NO_EXCEPTION_HEADER */
-
-#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
-_STLP_BEGIN_NAMESPACE
-
-// section 18.6.1
-class _STLP_CLASS_DECLSPEC exception {
-public:
-# if !defined(_STLP_USE_NO_IOSTREAMS) && !defined(_STLP_INLINE_EXCEPTION_CLASS)
- exception() _STLP_NOTHROW;
- virtual ~exception() _STLP_NOTHROW;
- virtual const char* what() const _STLP_NOTHROW;
-# else
- exception() _STLP_NOTHROW {}
- virtual ~exception() _STLP_NOTHROW {}
- virtual const char* what() const _STLP_NOTHROW {return "class exception";}
-# endif
-};
-
-// section 18.6.2.1
-class _STLP_CLASS_DECLSPEC bad_exception : public exception {
-public:
-# if !defined(_STLP_USE_NO_IOSTREAMS) && !defined(_STLP_INLINE_EXCEPTION_CLASS)
- bad_exception() _STLP_NOTHROW;
- ~bad_exception() _STLP_NOTHROW;
- const char* what() const _STLP_NOTHROW;
-# else
- bad_exception() _STLP_NOTHROW {}
- ~bad_exception() _STLP_NOTHROW {}
- const char* what() const _STLP_NOTHROW {return "class bad_exception";}
-# endif
-};
-
-// forward declaration
-class __Named_exception;
-_STLP_END_NAMESPACE
-#endif
-
-#endif /* _STLP_INTERNAL_EXCEPTION */
diff --git a/stl/_fstream.c b/stl/_fstream.c
deleted file mode 100644
index d41685d..0000000
--- a/stl/_fstream.c
+++ /dev/null
@@ -1,737 +0,0 @@
-/*
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_FSTREAM_C
-#define _STLP_FSTREAM_C
-
-#ifndef _STLP_INTERNAL_FSTREAM_H
-# include <stl/_fstream.h>
-#endif
-
-#ifndef _STLP_INTERNAL_LIMITS
-# include <stl/_limits.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
-// no wchar_t is supported for this mode
-# define __BF_int_type__ int
-# define __BF_pos_type__ streampos
-# define __BF_off_type__ streamoff
-# else
-# define __BF_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::int_type
-# define __BF_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::pos_type
-# define __BF_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::off_type
-# endif
-
-
-//----------------------------------------------------------------------
-// Public basic_filebuf<> member functions
-
-template <class _CharT, class _Traits>
-basic_filebuf<_CharT, _Traits>::basic_filebuf()
- : basic_streambuf<_CharT, _Traits>(), _M_base(),
- _M_constant_width(false), _M_always_noconv(false),
- _M_int_buf_dynamic(false),
- _M_in_input_mode(false), _M_in_output_mode(false),
- _M_in_error_mode(false), _M_in_putback_mode(false),
- _M_int_buf(0), _M_int_buf_EOS(0),
- _M_ext_buf(0), _M_ext_buf_EOS(0),
- _M_ext_buf_converted(0), _M_ext_buf_end(0),
- _M_state(_STLP_DEFAULT_CONSTRUCTED(_State_type)),
- _M_end_state(_STLP_DEFAULT_CONSTRUCTED(_State_type)),
- _M_mmap_base(0), _M_mmap_len(0),
- _M_saved_eback(0), _M_saved_gptr(0), _M_saved_egptr(0),
- _M_codecvt(0),
- _M_width(1), _M_max_width(1)
-{
- this->_M_setup_codecvt(locale(), false);
-}
-
-template <class _CharT, class _Traits>
-basic_filebuf<_CharT, _Traits>::~basic_filebuf() {
- this->close();
- _M_deallocate_buffers();
-}
-
-
-template <class _CharT, class _Traits>
-_STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::int_type
-basic_filebuf<_CharT, _Traits>::underflow() {
- return _Underflow<_CharT, _Traits>::_M_doit(this);
-}
-
-template <class _CharT, class _Traits>
-basic_filebuf<_CharT, _Traits>*
-basic_filebuf<_CharT, _Traits>::close() {
- bool __ok = this->is_open();
-
- if (_M_in_output_mode) {
- __ok = __ok && !_Traits::eq_int_type(this->overflow(traits_type::eof()),
- traits_type::eof());
- __ok == __ok && this->_M_unshift();
- }
- else if (_M_in_input_mode)
- this->_M_exit_input_mode();
-
- // Note order of arguments. We close the file even if __ok is false.
- __ok = _M_base._M_close() && __ok;
-
- // Restore the initial state, except that we don't deallocate the buffer
- // or mess with the cached codecvt information.
- _M_state = _M_end_state = _State_type();
- _M_ext_buf_converted = _M_ext_buf_end = 0;
-
- _M_mmap_base = 0;
- _M_mmap_len = 0;
-
- this->setg(0, 0, 0);
- this->setp(0, 0);
-
- _M_saved_eback = _M_saved_gptr = _M_saved_egptr = 0;
-
- _M_in_input_mode = _M_in_output_mode = _M_in_error_mode = _M_in_putback_mode
- = false;
-
- return __ok ? this : 0;
-}
-
-// This member function is called whenever we exit input mode.
-// It unmaps the memory-mapped file, if any, and sets
-// _M_in_input_mode to false.
-template <class _CharT, class _Traits>
-void basic_filebuf<_CharT, _Traits>::_M_exit_input_mode() {
- if (_M_mmap_base != 0)
- _M_base._M_unmap(_M_mmap_base, _M_mmap_len);
- _M_in_input_mode = false;
- _M_mmap_base = 0;
-}
-
-
-//----------------------------------------------------------------------
-// basic_filebuf<> overridden protected virtual member functions
-
-template <class _CharT, class _Traits>
-streamsize basic_filebuf<_CharT, _Traits>::showmanyc() {
- // Is there any possibility that reads can succeed?
- if (!this->is_open() || _M_in_output_mode || _M_in_error_mode)
- return -1;
- else if (_M_in_putback_mode)
- return this->egptr() - this->gptr();
- else if (_M_constant_width) {
- streamoff __pos = _M_base._M_seek(0, ios_base::cur);
- streamoff __size = _M_base._M_file_size();
- return __pos >= 0 && __size > __pos ? __size - __pos : 0;
- }
- else
- return 0;
-}
-
-
-// Make a putback position available, if necessary, by switching to a
-// special internal buffer used only for putback. The buffer is
-// [_M_pback_buf, _M_pback_buf + _S_pback_buf_size), but the base
-// class only sees a piece of it at a time. (We want to make sure
-// that we don't try to read a character that hasn't been initialized.)
-// The end of the putback buffer is always _M_pback_buf + _S_pback_buf_size,
-// but the beginning is usually not _M_pback_buf.
-template <class _CharT, class _Traits>
-__BF_int_type__
-basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c) {
- const int_type __eof = traits_type::eof();
-
- // If we aren't already in input mode, pushback is impossible.
- if (!_M_in_input_mode)
- return __eof;
-
- // We can use the ordinary get buffer if there's enough space, and
- // if it's a buffer that we're allowed to write to.
- if (this->gptr() != this->eback() &&
- (traits_type::eq_int_type(__c, __eof) ||
- traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]) ||
- !_M_mmap_base)) {
- this->gbump(-1);
- if (traits_type::eq_int_type(__c, __eof) ||
- traits_type::eq(traits_type::to_char_type(__c), *this->gptr()))
- return traits_type::to_int_type(*this->gptr());
- }
- else if (!traits_type::eq_int_type(__c, __eof)) {
- // Are we in the putback buffer already?
- _CharT* __pback_end = _M_pback_buf + __STATIC_CAST(int,_S_pback_buf_size);
- if (_M_in_putback_mode) {
- // Do we have more room in the putback buffer?
- if (this->eback() != _M_pback_buf)
- this->setg(this->egptr() - 1, this->egptr() - 1, __pback_end);
- else
- return __eof; // No more room in the buffer, so fail.
- }
- else { // We're not yet in the putback buffer.
- _M_saved_eback = this->eback();
- _M_saved_gptr = this->gptr();
- _M_saved_egptr = this->egptr();
- this->setg(__pback_end - 1, __pback_end - 1, __pback_end);
- _M_in_putback_mode = true;
- }
- }
- else
- return __eof;
-
- // We have made a putback position available. Assign to it, and return.
- *this->gptr() = traits_type::to_char_type(__c);
- return __c;
-}
-
-// This member function flushes the put area, and also outputs the
-// character __c (unless __c is eof). Invariant: we always leave room
-// in the internal buffer for one character more than the base class knows
-// about. We see the internal buffer as [_M_int_buf, _M_int_buf_EOS), but
-// the base class only sees [_M_int_buf, _M_int_buf_EOS - 1).
-template <class _CharT, class _Traits>
-__BF_int_type__
-basic_filebuf<_CharT, _Traits>::overflow(int_type __c) {
- // Switch to output mode, if necessary.
- if (!_M_in_output_mode)
- if (!_M_switch_to_output_mode())
- return traits_type::eof();
-
- _CharT* __ibegin = this->_M_int_buf;
- _CharT* __iend = this->pptr();
- this->setp(_M_int_buf, _M_int_buf_EOS - 1);
-
- // Put __c at the end of the internal buffer.
- if (!traits_type::eq_int_type(__c, traits_type::eof()))
- *__iend++ = _Traits::to_char_type(__c);
-
- // For variable-width encodings, output may take more than one pass.
- while (__ibegin != __iend) {
- const _CharT* __inext = __ibegin;
- char* __enext = _M_ext_buf;
- typename _Codecvt::result __status
- = _M_codecvt->out(_M_state, __ibegin, __iend, __inext,
- _M_ext_buf, _M_ext_buf_EOS, __enext);
- if (__status == _Codecvt::noconv) {
- return _Noconv_output<_Traits>::_M_doit(this, __ibegin, __iend)
- ? traits_type::not_eof(__c)
- : _M_output_error();
- }
-
- // For a constant-width encoding we know that the external buffer
- // is large enough, so failure to consume the entire internal buffer
- // or to produce the correct number of external characters, is an error.
- // For a variable-width encoding, however, we require only that we
- // consume at least one internal character
- else if (__status != _Codecvt::error &&
- (((__inext == __iend) &&
- (__enext - _M_ext_buf == _M_width * (__iend - __ibegin))) ||
- (!_M_constant_width && __inext != __ibegin))) {
- // We successfully converted part or all of the internal buffer.
- ptrdiff_t __n = __enext - _M_ext_buf;
- if (_M_write(_M_ext_buf, __n))
- __ibegin += __inext - __ibegin;
- else
- return _M_output_error();
- }
- else
- return _M_output_error();
- }
-
- return traits_type::not_eof(__c);
-}
-
-// This member function must be called before any I/O has been
-// performed on the stream, otherwise it has no effect.
-//
-// __buf == 0 && __n == 0 means to make this stream unbuffered.
-// __buf != 0 && __n > 0 means to use __buf as the stream's internal
-// buffer, rather than the buffer that would otherwise be allocated
-// automatically. __buf must be a pointer to an array of _CharT whose
-// size is at least __n.
-template <class _CharT, class _Traits>
-basic_streambuf<_CharT, _Traits>*
-basic_filebuf<_CharT, _Traits>::setbuf(_CharT* __buf, streamsize __n) {
- if (!_M_in_input_mode &&! _M_in_output_mode && !_M_in_error_mode &&
- _M_int_buf == 0) {
- if (__buf == 0 && __n == 0)
- _M_allocate_buffers(0, 1);
- else if (__buf != 0 && __n > 0)
- _M_allocate_buffers(__buf, __n);
- }
- return this;
-}
-
-template <class _CharT, class _Traits>
-__BF_pos_type__
-basic_filebuf<_CharT, _Traits>::seekoff(off_type __off,
- ios_base::seekdir __whence,
- ios_base::openmode /* dummy */) {
- if (this->is_open() &&
- (__off == 0 || (_M_constant_width && this->_M_base._M_in_binary_mode()))) {
-
- if (!_M_seek_init(__off != 0 || __whence != ios_base::cur))
- return pos_type(-1);
-
- // Seek to beginning or end, regardless of whether we're in input mode.
- if (__whence == ios_base::beg || __whence == ios_base::end)
- return _M_seek_return(_M_base._M_seek(_M_width * __off, __whence),
- _State_type());
-
- // Seek relative to current position. Complicated if we're in input mode.
- else if (__whence == ios_base::cur) {
- if (!_M_in_input_mode)
- return _M_seek_return(_M_base._M_seek(_M_width * __off, __whence),
- _State_type());
- else if (_M_mmap_base != 0) {
- // __off is relative to gptr(). We need to do a bit of arithmetic
- // to get an offset relative to the external file pointer.
- streamoff __adjust = _M_mmap_len - (this->gptr() - (_CharT*) _M_mmap_base);
-
- // if __off == 0, we do not need to exit input mode and to shift file pointer
- return __off == 0 ? pos_type(_M_base._M_seek(0, ios_base::cur) - __adjust)
- : _M_seek_return(_M_base._M_seek(__off - __adjust, ios_base::cur), _State_type());
- }
- else if (_M_constant_width) { // Get or set the position.
- streamoff __iadj = _M_width * (this->gptr() - this->eback());
-
- // Compensate for offset relative to gptr versus offset relative
- // to external pointer. For a text-oriented stream, where the
- // compensation is more than just pointer arithmetic, we may get
- // but not set the current position.
-
- if (__iadj <= _M_ext_buf_end - _M_ext_buf) {
- streamoff __eadj = _M_base._M_get_offset(_M_ext_buf + __STATIC_CAST(ptrdiff_t, __iadj), _M_ext_buf_end);
-
- return __off == 0 ? pos_type(_M_base._M_seek(0, ios_base::cur) - __eadj)
- : _M_seek_return(_M_base._M_seek(__off - __eadj, ios_base::cur), _State_type());
- }
- } else { // Get the position. Encoding is var width.
- // Get position in internal buffer.
- ptrdiff_t __ipos = this->gptr() - this->eback();
-
- // Get corresponding position in external buffer.
- _State_type __state = _M_state;
- int __epos = _M_codecvt->length(__state, _M_ext_buf, _M_ext_buf_end,
- __ipos);
-
- if (__epos >= 0) {
- // Sanity check (expensive): make sure __epos is the right answer.
- _State_type __tmp_state = _M_state;
- _Filebuf_Tmp_Buf<_CharT> __buf(__ipos);
- _CharT* __ibegin = __buf._M_ptr;
- _CharT* __inext = __ibegin;
-
- const char* __dummy;
- typename _Codecvt::result __status
- = _M_codecvt->in(__tmp_state,
- _M_ext_buf, _M_ext_buf + __epos, __dummy,
- __ibegin, __ibegin + __ipos, __inext);
- if (__status != _Codecvt::error &&
- (__status == _Codecvt::noconv ||
- (__inext == __ibegin + __ipos &&
- equal(this->eback(), this->gptr(), __ibegin, _STLP_PRIV _Eq_traits<traits_type>())))) {
- // Get the current position (at the end of the external buffer),
- // then adjust it. Again, it might be a text-oriented stream.
- streamoff __cur = _M_base._M_seek(0, ios_base::cur);
- streamoff __adj =
- _M_base._M_get_offset(_M_ext_buf, _M_ext_buf + __epos) -
- _M_base._M_get_offset(_M_ext_buf, _M_ext_buf_end);
- if (__cur != -1 && __cur + __adj >= 0)
- return __off == 0 ? pos_type(__cur + __adj)
- : _M_seek_return(__cur + __adj, __state);
- //return _M_seek_return(__cur + __adj, __state);
- }
- // We failed the sanity check here.
- }
- }
- }
- // Unrecognized value for __whence here.
- }
-
- return pos_type(-1);
-}
-
-
-template <class _CharT, class _Traits>
-__BF_pos_type__
-basic_filebuf<_CharT, _Traits>::seekpos(pos_type __pos,
- ios_base::openmode /* dummy */) {
- if (this->is_open()) {
- if (!_M_seek_init(true))
- return pos_type(-1);
-
- streamoff __off = off_type(__pos);
- if (__off != -1 && _M_base._M_seek(__off, ios_base::beg) != -1) {
- _M_state = __pos.state();
- return _M_seek_return(__off, __pos.state());
- }
- }
-
- return pos_type(-1);
-}
-
-
-template <class _CharT, class _Traits>
-int basic_filebuf<_CharT, _Traits>::sync() {
- if (_M_in_output_mode)
- return traits_type::eq_int_type(this->overflow(traits_type::eof()),
- traits_type::eof()) ? -1 : 0;
- return 0;
-}
-
-
-// Change the filebuf's locale. This member function has no effect
-// unless it is called before any I/O is performed on the stream.
-template <class _CharT, class _Traits>
-void basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) {
- if (!_M_in_input_mode && !_M_in_output_mode && !_M_in_error_mode) {
- this->_M_setup_codecvt(__loc);
- }
-}
-
-//----------------------------------------------------------------------
-// basic_filebuf<> helper functions.
-
-//----------------------------------------
-// Helper functions for switching between modes.
-
-// This member function is called if we're performing the first I/O
-// operation on a filebuf, or if we're performing an input operation
-// immediately after a seek.
-template <class _CharT, class _Traits>
-bool basic_filebuf<_CharT, _Traits>::_M_switch_to_input_mode() {
- if (this->is_open() && (((int)_M_base.__o_mode() & (int)ios_base::in) != 0)
- && (_M_in_output_mode == 0) && (_M_in_error_mode == 0)) {
- if (!_M_int_buf && !_M_allocate_buffers())
- return false;
-
- _M_ext_buf_converted = _M_ext_buf;
- _M_ext_buf_end = _M_ext_buf;
-
- _M_end_state = _M_state;
-
- _M_in_input_mode = true;
- return true;
- }
-
- return false;
-}
-
-
-// This member function is called if we're performing the first I/O
-// operation on a filebuf, or if we're performing an output operation
-// immediately after a seek.
-template <class _CharT, class _Traits>
-bool basic_filebuf<_CharT, _Traits>::_M_switch_to_output_mode() {
- if (this->is_open() && (_M_base.__o_mode() & (int)ios_base::out) &&
- _M_in_input_mode == 0 && _M_in_error_mode == 0) {
-
- if (!_M_int_buf && !_M_allocate_buffers())
- return false;
-
- // In append mode, every write does an implicit seek to the end
- // of the file. Whenever leaving output mode, the end of file
- // get put in the initial shift state.
- if (_M_base.__o_mode() & ios_base::app)
- _M_state = _State_type();
-
- this->setp(_M_int_buf, _M_int_buf_EOS - 1);
- _M_in_output_mode = true;
- return true;
- }
-
- return false;
-}
-
-
-//----------------------------------------
-// Helper functions for input
-
-// This member function is called if there is an error during input.
-// It puts the filebuf in error mode, clear the get area buffer, and
-// returns eof.
-// returns eof. Error mode is sticky; it is cleared only by close or
-// seek.
-
-template <class _CharT, class _Traits>
-__BF_int_type__
-basic_filebuf<_CharT, _Traits>::_M_input_error() {
- this->_M_exit_input_mode();
- _M_in_output_mode = false;
- _M_in_error_mode = true;
- this->setg(0, 0, 0);
- return traits_type::eof();
-}
-
-template <class _CharT, class _Traits>
-__BF_int_type__
-basic_filebuf<_CharT, _Traits>::_M_underflow_aux() {
- // We have the state and file position from the end of the internal
- // buffer. This round, they become the beginning of the internal buffer.
- _M_state = _M_end_state;
-
- // Fill the external buffer. Start with any leftover characters that
- // didn't get converted last time.
- if (_M_ext_buf_end > _M_ext_buf_converted)
-
- _M_ext_buf_end = copy(_M_ext_buf_converted, _M_ext_buf_end, _M_ext_buf);
- // boris : copy_backward did not work
- //_M_ext_buf_end = copy_backward(_M_ext_buf_converted, _M_ext_buf_end,
- //_M_ext_buf+ (_M_ext_buf_end - _M_ext_buf_converted));
- else
- _M_ext_buf_end = _M_ext_buf;
-
- // Now fill the external buffer with characters from the file. This is
- // a loop because occasionally we don't get enough external characters
- // to make progress.
- for (;;) {
- ptrdiff_t __n = _M_base._M_read(_M_ext_buf_end, _M_ext_buf_EOS - _M_ext_buf_end);
-
- // Don't enter error mode for a failed read. Error mode is sticky,
- // and we might succeed if we try again.
- if (__n <= 0)
- return traits_type::eof();
-
- // Convert the external buffer to internal characters.
- _M_ext_buf_end += __n;
- const char* __enext;
- _CharT* __inext;
-
- typename _Codecvt::result __status
- = _M_codecvt->in(_M_end_state,
- _M_ext_buf, _M_ext_buf_end, __enext,
- _M_int_buf, _M_int_buf_EOS, __inext);
-
- // Error conditions: (1) Return value of error. (2) Producing internal
- // characters without consuming external characters. (3) In fixed-width
- // encodings, producing an internal sequence whose length is inconsistent
- // with that of the internal sequence. (4) Failure to produce any
- // characters if we have enough characters in the external buffer, where
- // "enough" means the largest possible width of a single character.
- if (__status == _Codecvt::noconv)
- return _Noconv_input<_Traits>::_M_doit(this);
- else if (__status == _Codecvt::error ||
- (__inext != _M_int_buf && __enext == _M_ext_buf) ||
- (_M_constant_width &&
- // __inext - _M_int_buf != _M_width * (__enext - _M_ext_buf)) ||
- (__inext - _M_int_buf) * _M_width != (__enext - _M_ext_buf)) ||
- (__inext == _M_int_buf && __enext - _M_ext_buf >= _M_max_width))
- return _M_input_error();
- else if (__inext != _M_int_buf) {
- _M_ext_buf_converted = _M_ext_buf + (__enext - _M_ext_buf);
- this->setg(_M_int_buf, _M_int_buf, __inext);
- return traits_type::to_int_type(*_M_int_buf);
- }
- // We need to go around the loop again to get more external characters.
- }
-}
-
-//----------------------------------------
-// Helper functions for output
-
-// This member function is called if there is an error during output.
-// It puts the filebuf in error mode, clear the put area buffer, and
-// returns eof. Error mode is sticky; it is cleared only by close or
-// seek.
-template <class _CharT, class _Traits>
-__BF_int_type__
-basic_filebuf<_CharT, _Traits>::_M_output_error() {
- _M_in_output_mode = false;
- _M_in_input_mode = false;
- _M_in_error_mode = true;
- this->setp(0, 0);
- return traits_type::eof();
-}
-
-
-// Write whatever sequence of characters is necessary to get back to
-// the initial shift state. This function overwrites the external
-// buffer, changes the external file position, and changes the state.
-// Precondition: the internal buffer is empty.
-template <class _CharT, class _Traits>
-bool basic_filebuf<_CharT, _Traits>::_M_unshift() {
- if (_M_in_output_mode && !_M_constant_width) {
- typename _Codecvt::result __status;
- do {
- char* __enext = _M_ext_buf;
- __status = _M_codecvt->unshift(_M_state,
- _M_ext_buf, _M_ext_buf_EOS, __enext);
- if (__status == _Codecvt::noconv ||
- (__enext == _M_ext_buf && __status == _Codecvt::ok))
- return true;
- else if (__status == _Codecvt::error)
- return false;
- else if (!_M_write(_M_ext_buf, __enext - _M_ext_buf))
- return false;
- } while (__status == _Codecvt::partial);
- }
-
- return true;
-}
-
-
-//----------------------------------------
-// Helper functions for buffer allocation and deallocation
-
-// This member function is called when we're initializing a filebuf's
-// internal and external buffers. The argument is the size of the
-// internal buffer; the external buffer is sized using the character
-// width in the current encoding. Preconditions: the buffers are currently
-// null. __n >= 1. __buf is either a null pointer or a pointer to an
-// array show size is at least __n.
-
-// We need __n >= 1 for two different reasons. For input, the base
-// class always needs a buffer because of the semantics of underflow().
-// For output, we want to have an internal buffer that's larger by one
-// element than the buffer that the base class knows about. (See
-// basic_filebuf<>::overflow() for the reason.)
-template <class _CharT, class _Traits>
-bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers(_CharT* __buf, streamsize __n) {
- //The major hypothesis in the following implementation is that size_t is unsigned.
- //We also need streamsize byte representation to be larger or equal to the int
- //representation to correctly store the encoding information.
- _STLP_STATIC_ASSERT(!numeric_limits<size_t>::is_signed &&
- sizeof(streamsize) >= sizeof(int))
-
- if (__buf == 0) {
- streamsize __bufsize = __n * sizeof(_CharT);
- //We first check that the streamsize representation can't overflow a size_t one.
- //If it can, we check that __bufsize is not higher than the size_t max value.
- if ((sizeof(streamsize) > sizeof(size_t)) &&
- (__bufsize > __STATIC_CAST(streamsize, (numeric_limits<size_t>::max)())))
- return false;
- _M_int_buf = __STATIC_CAST(_CharT*, malloc(__STATIC_CAST(size_t, __bufsize)));
- if (!_M_int_buf)
- return false;
- _M_int_buf_dynamic = true;
- }
- else {
- _M_int_buf = __buf;
- _M_int_buf_dynamic = false;
- }
-
- streamsize __ebufsiz = (max)(__n * __STATIC_CAST(streamsize, _M_width),
- __STATIC_CAST(streamsize, _M_codecvt->max_length()));
- _M_ext_buf = 0;
- if ((sizeof(streamsize) < sizeof(size_t)) ||
- ((sizeof(streamsize) == sizeof(size_t)) && numeric_limits<streamsize>::is_signed) ||
- (__ebufsiz <= __STATIC_CAST(streamsize, (numeric_limits<size_t>::max)()))) {
- _M_ext_buf = __STATIC_CAST(char*, malloc(__STATIC_CAST(size_t, __ebufsiz)));
- }
-
- if (!_M_ext_buf) {
- _M_deallocate_buffers();
- return false;
- }
-
- _M_int_buf_EOS = _M_int_buf + __STATIC_CAST(ptrdiff_t, __n);
- _M_ext_buf_EOS = _M_ext_buf + __STATIC_CAST(ptrdiff_t, __ebufsiz);
- return true;
-}
-
-// Abbreviation for the most common case.
-template <class _CharT, class _Traits>
-bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers() {
- // Choose a buffer that's at least 4096 characters long and that's a
- // multiple of the page size.
- streamsize __default_bufsiz =
- ((_M_base.__page_size() + 4095UL) / _M_base.__page_size()) * _M_base.__page_size();
- return _M_allocate_buffers(0, __default_bufsiz);
-}
-
-template <class _CharT, class _Traits>
-void basic_filebuf<_CharT, _Traits>::_M_deallocate_buffers() {
- if (_M_int_buf_dynamic)
- free(_M_int_buf);
- free(_M_ext_buf);
- _M_int_buf = 0;
- _M_int_buf_EOS = 0;
- _M_ext_buf = 0;
- _M_ext_buf_EOS = 0;
-}
-
-
-//----------------------------------------
-// Helper functiosn for seek and imbue
-
-template <class _CharT, class _Traits>
-bool basic_filebuf<_CharT, _Traits>::_M_seek_init(bool __do_unshift) {
- // If we're in error mode, leave it.
- _M_in_error_mode = false;
-
- // Flush the output buffer if we're in output mode, and (conditionally)
- // emit an unshift sequence.
- if (_M_in_output_mode) {
- bool __ok = !traits_type::eq_int_type(this->overflow(traits_type::eof()),
- traits_type::eof());
- if (__do_unshift)
- __ok = __ok && this->_M_unshift();
- if (!__ok) {
- _M_in_output_mode = false;
- _M_in_error_mode = true;
- this->setp(0, 0);
- return false;
- }
- }
-
- // Discard putback characters, if any.
- if (_M_in_input_mode && _M_in_putback_mode)
- _M_exit_putback_mode();
-
- return true;
-}
-
-
-/* Change the filebuf's locale. This member function has no effect
- * unless it is called before any I/O is performed on the stream.
- * This function is called on construction and on an imbue call. In the
- * case of the construction the codecvt facet might be a custom one if
- * the basic_filebuf user has instanciate it with a custom char_traits.
- * The user will have to call imbue before any I/O operation.
- */
-template <class _CharT, class _Traits>
-void basic_filebuf<_CharT, _Traits>::_M_setup_codecvt(const locale& __loc, bool __on_imbue) {
- if (has_facet<_Codecvt>(__loc)) {
- _M_codecvt = &use_facet<_Codecvt>(__loc) ;
- int __encoding = _M_codecvt->encoding();
-
- _M_width = (max)(__encoding, 1);
- _M_max_width = _M_codecvt->max_length();
- _M_constant_width = __encoding > 0;
- _M_always_noconv = _M_codecvt->always_noconv();
- }
- else {
- _M_codecvt = 0;
- _M_width = _M_max_width = 1;
- _M_constant_width = _M_always_noconv = false;
- if (__on_imbue) {
- //This call will generate an exception reporting the problem.
- use_facet<_Codecvt>(__loc);
- }
- }
-}
-
-_STLP_END_NAMESPACE
-
-# undef __BF_int_type__
-# undef __BF_pos_type__
-# undef __BF_off_type__
-
-#endif /* _STLP_FSTREAM_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_fstream.h b/stl/_fstream.h
deleted file mode 100644
index b3b643c..0000000
--- a/stl/_fstream.h
+++ /dev/null
@@ -1,757 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// This header defines classes basic_filebuf, basic_ifstream,
-// basic_ofstream, and basic_fstream. These classes represent
-// streambufs and streams whose sources or destinations are files.
-
-#ifndef _STLP_INTERNAL_FSTREAM_H
-#define _STLP_INTERNAL_FSTREAM_H
-
-#if defined(__sgi) && !defined(__GNUC__) && !defined(_STANDARD_C_PLUS_PLUS)
-# error This header file requires the -LANG:std option
-#endif
-
-#ifndef _STLP_INTERNAL_STREAMBUF
-# include <stl/_streambuf.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ISTREAM
-# include <stl/_istream.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CODECVT_H
-# include <stl/_codecvt.h>
-#endif
-
-#if !defined (_STLP_USE_UNIX_IO) && !defined(_STLP_USE_WIN32_IO) && \
- !defined (_STLP_USE_UNIX_EMULATION_IO) && !defined (_STLP_USE_STDIO_IO)
-
-# if defined (_STLP_UNIX) || defined (__CYGWIN__) || defined (__amigaos__) || defined (__EMX__)
-// open/close/read/write
-# define _STLP_USE_UNIX_IO
-# elif defined (_STLP_WIN32)
-// CreateFile/ReadFile/WriteFile
-# define _STLP_USE_WIN32_IO
-# elif defined (_STLP_WIN16) || defined (_STLP_MAC)
-// _open/_read/_write
-# define _STLP_USE_UNIX_EMULATION_IO
-# else
-// fopen/fread/fwrite
-# define _STLP_USE_STDIO_IO
-# endif /* _STLP_UNIX */
-#endif /* mode selection */
-
-#if defined (_STLP_USE_WIN32_IO)
-typedef void* _STLP_fd;
-#elif defined (_STLP_USE_UNIX_EMULATION_IO) || defined (_STLP_USE_STDIO_IO) || defined (_STLP_USE_UNIX_IO)
-typedef int _STLP_fd;
-#else
-# error "Configure i/o !"
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//----------------------------------------------------------------------
-// Class _Filebuf_base, a private base class to factor out the system-
-// dependent code from basic_filebuf<>.
-
-class _STLP_CLASS_DECLSPEC _Filebuf_base {
-public: // Opening and closing files.
- _Filebuf_base();
-
- bool _M_open(const char*, ios_base::openmode, long __protection);
- bool _M_open(const char*, ios_base::openmode);
- bool _M_open(int __id, ios_base::openmode = ios_base::__default_mode);
-#if defined (_STLP_USE_WIN32_IO)
- bool _M_open(_STLP_fd __id, ios_base::openmode = ios_base::__default_mode);
-#endif /* _STLP_USE_WIN32_IO */
- bool _M_close();
-
-public: // Low-level I/O, like Unix read/write
- ptrdiff_t _M_read(char* __buf, ptrdiff_t __n);
- streamoff _M_seek(streamoff __offset, ios_base::seekdir __dir);
- streamoff _M_file_size();
- bool _M_write(char* __buf, ptrdiff_t __n);
-
-public: // Memory-mapped I/O.
- void* _M_mmap(streamoff __offset, streamoff __len);
- void _M_unmap(void* __mmap_base, streamoff __len);
-
-public:
- // Returns a value n such that, if pos is the file pointer at the
- // beginning of the range [first, last), pos + n is the file pointer at
- // the end. On many operating systems n == __last - __first.
- // In Unix, writing n characters always bumps the file position by n.
- // In Windows text mode, however, it bumps the file position by n + m,
- // where m is the number of newlines in the range. That's because an
- // internal \n corresponds to an external two-character sequence.
- streamoff _M_get_offset(char* __first, char* __last) {
-#if defined (_STLP_UNIX) || defined (_STLP_MAC)
- return __last - __first;
-#else // defined (_STLP_WIN32) || defined (_STLP_WIN16) || defined (_STLP_DOS) || defined(N_PLAT_NLM)
- return ( (_M_openmode & ios_base::binary) != 0 )
- ? (__last - __first)
- : count(__first, __last, '\n') + (__last - __first);
-#endif
- }
-
- // Returns true if we're in binary mode or if we're using an OS or file
- // system where there is no distinction between text and binary mode.
- bool _M_in_binary_mode() const {
-#if defined (_STLP_UNIX) || defined (_STLP_MAC) || defined(__BEOS__) || defined (__amigaos__)
- return true;
-#elif defined (_STLP_WIN32) || defined (_STLP_WIN16) || defined (_STLP_DOS) || defined (_STLP_VM) || defined (__EMX__) || defined(N_PLAT_NLM)
- return (_M_openmode & ios_base::binary) != 0;
-#else
-# error "Port!"
-#endif
- }
-
- static void _S_initialize();
-
-protected: // Static data members.
- static size_t _M_page_size;
-
-protected: // Data members.
- _STLP_fd _M_file_id;
-#if defined (_STLP_USE_STDIO_IO)
- // for stdio, the whole FILE* is being kept here
- FILE* _M_file;
-#endif
-#if defined (_STLP_USE_WIN32_IO)
- _STLP_fd _M_view_id;
-#endif
-
- ios_base::openmode _M_openmode ;
- unsigned char _M_is_open ;
- unsigned char _M_should_close ;
- unsigned char _M_regular_file ;
-
-public :
- static size_t _STLP_CALL __page_size() { return _M_page_size; }
- int __o_mode() const { return (int)_M_openmode; }
- bool __is_open() const { return (_M_is_open !=0 ); }
- bool __should_close() const { return (_M_should_close != 0); }
- bool __regular_file() const { return (_M_regular_file != 0); }
- _STLP_fd __get_fd() const { return _M_file_id; }
-};
-
-//----------------------------------------------------------------------
-// Class basic_filebuf<>.
-
-// Forward declaration of two helper classes.
-template <class _Traits> class _Noconv_input;
-_STLP_TEMPLATE_NULL
-class _Noconv_input<char_traits<char> >;
-
-template <class _Traits> class _Noconv_output;
-_STLP_TEMPLATE_NULL
-class _Noconv_output< char_traits<char> >;
-
-// There is a specialized version of underflow, for basic_filebuf<char>,
-// in fstream.cxx.
-
-template <class _CharT, class _Traits>
-class _Underflow;
-
-_STLP_TEMPLATE_NULL class _Underflow< char, char_traits<char> >;
-
-template <class _CharT, class _Traits>
-class basic_filebuf : public basic_streambuf<_CharT, _Traits> {
-public: // Types.
- typedef _CharT char_type;
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::pos_type pos_type;
- typedef typename _Traits::off_type off_type;
- typedef _Traits traits_type;
-
- typedef typename _Traits::state_type _State_type;
- typedef basic_streambuf<_CharT, _Traits> _Base;
- typedef basic_filebuf<_CharT, _Traits> _Self;
-
-public: // Constructors, destructor.
- basic_filebuf();
- ~basic_filebuf();
-
-public: // Opening and closing files.
- bool is_open() const { return _M_base.__is_open(); }
-
- _Self* open(const char* __s, ios_base::openmode __m) {
- return _M_base._M_open(__s, __m) ? this : 0;
- }
-
-#if !defined (_STLP_NO_EXTENSIONS)
- // These two version of open() and file descriptor getter are extensions.
- _Self* open(const char* __s, ios_base::openmode __m,
- long __protection) {
- return _M_base._M_open(__s, __m, __protection) ? this : 0;
- }
-
- _STLP_fd fd() const { return _M_base.__get_fd(); }
-
- _Self* open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
- return this->_M_open(__id, _Init_mode);
- }
-
-# if defined (_STLP_USE_WIN32_IO)
- _Self* open(_STLP_fd __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
- return _M_base._M_open(__id, _Init_mode) ? this : 0;
- }
-# endif /* _STLP_USE_WIN32_IO */
-
-#endif
-
- _Self* _M_open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
- return _M_base._M_open(__id, _Init_mode) ? this : 0;
- }
-
- _Self* close();
-
-protected: // Virtual functions from basic_streambuf.
- virtual streamsize showmanyc();
- virtual int_type underflow();
-
- virtual int_type pbackfail(int_type = traits_type::eof());
- virtual int_type overflow(int_type = traits_type::eof());
-
- virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize);
- virtual pos_type seekoff(off_type, ios_base::seekdir,
- ios_base::openmode = ios_base::in | ios_base::out);
- virtual pos_type seekpos(pos_type,
- ios_base::openmode = ios_base::in | ios_base::out);
-
- virtual int sync();
- virtual void imbue(const locale&);
-
-private: // Helper functions.
-
- // Precondition: we are currently in putback input mode. Effect:
- // switches back to ordinary input mode.
- void _M_exit_putback_mode() {
- this->setg(_M_saved_eback, _M_saved_gptr, _M_saved_egptr);
- _M_in_putback_mode = false;
- }
- bool _M_switch_to_input_mode();
- void _M_exit_input_mode();
- bool _M_switch_to_output_mode();
-
- int_type _M_input_error();
- int_type _M_underflow_aux();
- // friend class _Noconv_input<_Traits>;
- // friend class _Noconv_output<_Traits>;
- friend class _Underflow<_CharT, _Traits>;
-
- int_type _M_output_error();
- bool _M_unshift();
-
- bool _M_allocate_buffers(_CharT* __buf, streamsize __n);
- bool _M_allocate_buffers();
- void _M_deallocate_buffers();
-
- pos_type _M_seek_return(off_type __off, _State_type __state) {
- if (__off != -1) {
- if (_M_in_input_mode)
- _M_exit_input_mode();
- _M_in_input_mode = false;
- _M_in_output_mode = false;
- _M_in_putback_mode = false;
- _M_in_error_mode = false;
- this->setg(0, 0, 0);
- this->setp(0, 0);
- }
-
- pos_type __result(__off);
- __result.state(__state);
- return __result;
- }
-
- bool _M_seek_init(bool __do_unshift);
-
- void _M_setup_codecvt(const locale&, bool __on_imbue = true);
-
-private: // Data members used in all modes.
-
- _Filebuf_base _M_base;
-
-private: // Locale-related information.
-
- unsigned char _M_constant_width;
- unsigned char _M_always_noconv;
-
- // private: // Mode flags.
- unsigned char _M_int_buf_dynamic; // True if internal buffer is heap allocated,
- // false if it was supplied by the user.
- unsigned char _M_in_input_mode;
- unsigned char _M_in_output_mode;
- unsigned char _M_in_error_mode;
- unsigned char _M_in_putback_mode;
-
- // Internal buffer: characters seen by the filebuf's clients.
- _CharT* _M_int_buf;
- _CharT* _M_int_buf_EOS;
-
- // External buffer: characters corresponding to the external file.
- char* _M_ext_buf;
- char* _M_ext_buf_EOS;
-
- // The range [_M_ext_buf, _M_ext_buf_converted) contains the external
- // characters corresponding to the sequence in the internal buffer. The
- // range [_M_ext_buf_converted, _M_ext_buf_end) contains characters that
- // have been read into the external buffer but have not been converted
- // to an internal sequence.
- char* _M_ext_buf_converted;
- char* _M_ext_buf_end;
-
- // State corresponding to beginning of internal buffer.
- _State_type _M_state;
-
-private: // Data members used only in input mode.
-
- // Similar to _M_state except that it corresponds to
- // the end of the internal buffer instead of the beginning.
- _State_type _M_end_state;
-
- // This is a null pointer unless we are in mmap input mode.
- void* _M_mmap_base;
- streamoff _M_mmap_len;
-
-private: // Data members used only in putback mode.
- _CharT* _M_saved_eback;
- _CharT* _M_saved_gptr;
- _CharT* _M_saved_egptr;
-
- typedef codecvt<_CharT, char, _State_type> _Codecvt;
- const _Codecvt* _M_codecvt;
-
- int _M_width; // Width of the encoding (if constant), else 1
- int _M_max_width; // Largest possible width of single character.
-
-
- enum { _S_pback_buf_size = 8 };
- _CharT _M_pback_buf[_S_pback_buf_size];
-
- // for _Noconv_output
-public:
- bool _M_write(char* __buf, ptrdiff_t __n) {return _M_base._M_write(__buf, __n); }
-
-public:
- int_type
- _M_do_noconv_input() {
- _M_ext_buf_converted = _M_ext_buf_end;
- /* this-> */ _Base::setg((char_type*)_M_ext_buf, (char_type*)_M_ext_buf, (char_type*)_M_ext_buf_end);
- return traits_type::to_int_type(*_M_ext_buf);
- }
-};
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS basic_filebuf<char, char_traits<char> >;
-# if ! defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS basic_filebuf<wchar_t, char_traits<wchar_t> >;
-# endif
-#endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-// public:
-// helper class.
-template <class _CharT>
-struct _Filebuf_Tmp_Buf {
- _CharT* _M_ptr;
- _Filebuf_Tmp_Buf(ptrdiff_t __n) : _M_ptr(0) { _M_ptr = new _CharT[__n]; }
- ~_Filebuf_Tmp_Buf() { delete[] _M_ptr; }
-};
-
-
-//
-// This class had to be designed very carefully to work
-// with Visual C++.
-//
-template <class _Traits>
-class _Noconv_output {
-public:
- typedef typename _Traits::char_type char_type;
- static bool _STLP_CALL _M_doit(basic_filebuf<char_type, _Traits >*,
- char_type*, char_type*)
- { return false; }
-};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC _Noconv_output< char_traits<char> > {
-public:
- static bool _STLP_CALL
- _M_doit(basic_filebuf<char, char_traits<char> >* __buf,
- char* __first, char* __last) {
- ptrdiff_t __n = __last - __first;
- return (__buf->_M_write(__first, __n));
- }
-};
-
-//----------------------------------------------------------------------
-// basic_filebuf<> helper functions.
-
-
-//----------------------------------------
-// Helper functions for switching between modes.
-
-//
-// This class had to be designed very carefully to work
-// with Visual C++.
-//
-template <class _Traits>
-class _Noconv_input {
-public:
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::char_type char_type;
-
- static inline int_type _STLP_CALL
- _M_doit(basic_filebuf<char_type, _Traits>*)
- { return _Traits::eof(); }
-};
-
-_STLP_TEMPLATE_NULL
-class _Noconv_input<char_traits<char> > {
-public:
- static inline int _STLP_CALL
- _M_doit(basic_filebuf<char, char_traits<char> >* __buf) {
- return __buf->_M_do_noconv_input();
- }
-};
-
-// underflow() may be called for one of two reasons. (1) We've
-// been going through the special putback buffer, and we need to move back
-// to the regular internal buffer. (2) We've exhausted the internal buffer,
-// and we need to replentish it.
-template <class _CharT, class _Traits>
-class _Underflow {
-public:
- typedef typename _Traits::int_type int_type;
- typedef _Traits traits_type;
-
- static int_type _STLP_CALL _M_doit(basic_filebuf<_CharT, _Traits>* __this);
-};
-
-
-// Specialization of underflow: if the character type is char, maybe
-// we can use mmap instead of read.
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC _Underflow< char, char_traits<char> > {
-public:
- typedef char_traits<char>::int_type int_type;
- typedef char_traits<char> traits_type;
- static int _STLP_CALL _M_doit(basic_filebuf<char, traits_type >* __this);
-};
-
-// There is a specialized version of underflow, for basic_filebuf<char>,
-// in fstream.cxx.
-
-template <class _CharT, class _Traits>
-_STLP_TYPENAME_ON_RETURN_TYPE _Underflow<_CharT, _Traits>::int_type // _STLP_CALL
- _Underflow<_CharT, _Traits>::_M_doit(basic_filebuf<_CharT, _Traits>* __this) {
- if (!__this->_M_in_input_mode) {
- if (!__this->_M_switch_to_input_mode())
- return traits_type::eof();
- }
- else if (__this->_M_in_putback_mode) {
- __this->_M_exit_putback_mode();
- if (__this->gptr() != __this->egptr()) {
- int_type __c = traits_type::to_int_type(*__this->gptr());
- return __c;
- }
- }
-
- return __this->_M_underflow_aux();
-}
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS _Underflow<wchar_t, char_traits<wchar_t> >;
-#endif
-
-//----------------------------------------------------------------------
-// Class basic_ifstream<>
-
-template <class _CharT, class _Traits>
-class basic_ifstream : public basic_istream<_CharT, _Traits> {
-public: // Types
- typedef _CharT char_type;
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::pos_type pos_type;
- typedef typename _Traits::off_type off_type;
- typedef _Traits traits_type;
-
- typedef basic_ios<_CharT, _Traits> _Basic_ios;
- typedef basic_istream<_CharT, _Traits> _Base;
- typedef basic_filebuf<_CharT, _Traits> _Buf;
-
-public: // Constructors, destructor.
-
- basic_ifstream() :
- basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
- this->init(&_M_buf);
- }
-
- explicit basic_ifstream(const char* __s, ios_base::openmode __mod = ios_base::in) :
- basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0),
- _M_buf() {
- this->init(&_M_buf);
- if (!_M_buf.open(__s, __mod | ios_base::in))
- this->setstate(ios_base::failbit);
- }
-
-#if !defined (_STLP_NO_EXTENSIONS)
- explicit basic_ifstream(int __id, ios_base::openmode __mod = ios_base::in) :
- basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
- this->init(&_M_buf);
- if (!_M_buf.open(__id, __mod | ios_base::in))
- this->setstate(ios_base::failbit);
- }
- basic_ifstream(const char* __s, ios_base::openmode __m,
- long __protection) :
- basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
- this->init(&_M_buf);
- if (!_M_buf.open(__s, __m | ios_base::in, __protection))
- this->setstate(ios_base::failbit);
- }
-
-# if defined (_STLP_USE_WIN32_IO)
- explicit basic_ifstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::in) :
- basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
- this->init(&_M_buf);
- if (!_M_buf.open(__id, __mod | ios_base::in))
- this->setstate(ios_base::failbit);
- }
-# endif /* _STLP_USE_WIN32_IO */
-#endif
-
- ~basic_ifstream() {}
-
-public: // File and buffer operations.
- basic_filebuf<_CharT, _Traits>* rdbuf() const
- { return __CONST_CAST(_Buf*,&_M_buf); }
-
- bool is_open() {
- return this->rdbuf()->is_open();
- }
-
- void open(const char* __s, ios_base::openmode __mod = ios_base::in) {
- if (!this->rdbuf()->open(__s, __mod | ios_base::in))
- this->setstate(ios_base::failbit);
- }
-
- void close() {
- if (!this->rdbuf()->close())
- this->setstate(ios_base::failbit);
- }
-
-private:
- basic_filebuf<_CharT, _Traits> _M_buf;
-};
-
-
-//----------------------------------------------------------------------
-// Class basic_ofstream<>
-
-template <class _CharT, class _Traits>
-class basic_ofstream : public basic_ostream<_CharT, _Traits> {
-public: // Types
- typedef _CharT char_type;
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::pos_type pos_type;
- typedef typename _Traits::off_type off_type;
- typedef _Traits traits_type;
-
- typedef basic_ios<_CharT, _Traits> _Basic_ios;
- typedef basic_ostream<_CharT, _Traits> _Base;
- typedef basic_filebuf<_CharT, _Traits> _Buf;
-
-public: // Constructors, destructor.
- basic_ofstream() :
- basic_ios<_CharT, _Traits>(),
- basic_ostream<_CharT, _Traits>(0), _M_buf() {
- this->init(&_M_buf);
- }
- explicit basic_ofstream(const char* __s, ios_base::openmode __mod = ios_base::out)
- : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() {
- this->init(&_M_buf);
- if (!_M_buf.open(__s, __mod | ios_base::out))
- this->setstate(ios_base::failbit);
- }
-
-#if !defined (_STLP_NO_EXTENSIONS)
- explicit basic_ofstream(int __id, ios_base::openmode __mod = ios_base::out)
- : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0),
- _M_buf() {
- this->init(&_M_buf);
- if (!_M_buf.open(__id, __mod | ios_base::out))
- this->setstate(ios_base::failbit);
- }
- basic_ofstream(const char* __s, ios_base::openmode __m, long __protection) :
- basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() {
- this->init(&_M_buf);
- if (!_M_buf.open(__s, __m | ios_base::out, __protection))
- this->setstate(ios_base::failbit);
- }
-# if defined (_STLP_USE_WIN32_IO)
- explicit basic_ofstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::out)
- : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0),
- _M_buf() {
- this->init(&_M_buf);
- if (!_M_buf.open(__id, __mod | ios_base::out))
- this->setstate(ios_base::failbit);
- }
-# endif /* _STLP_USE_WIN32_IO */
-#endif
-
- ~basic_ofstream() {}
-
-public: // File and buffer operations.
- basic_filebuf<_CharT, _Traits>* rdbuf() const
- { return __CONST_CAST(_Buf*,&_M_buf); }
-
- bool is_open() {
- return this->rdbuf()->is_open();
- }
-
- void open(const char* __s, ios_base::openmode __mod= ios_base::out) {
- if (!this->rdbuf()->open(__s, __mod | ios_base::out))
- this->setstate(ios_base::failbit);
- }
-
- void close() {
- if (!this->rdbuf()->close())
- this->setstate(ios_base::failbit);
- }
-
-private:
- basic_filebuf<_CharT, _Traits> _M_buf;
-};
-
-
-//----------------------------------------------------------------------
-// Class basic_fstream<>
-
-template <class _CharT, class _Traits>
-class basic_fstream : public basic_iostream<_CharT, _Traits> {
-public: // Types
- typedef _CharT char_type;
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::pos_type pos_type;
- typedef typename _Traits::off_type off_type;
- typedef _Traits traits_type;
-
- typedef basic_ios<_CharT, _Traits> _Basic_ios;
- typedef basic_iostream<_CharT, _Traits> _Base;
- typedef basic_filebuf<_CharT, _Traits> _Buf;
-
-public: // Constructors, destructor.
-
- basic_fstream()
- : basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
- this->init(&_M_buf);
- }
-
- explicit basic_fstream(const char* __s,
- ios_base::openmode __mod = ios_base::in | ios_base::out) :
- basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
- this->init(&_M_buf);
- if (!_M_buf.open(__s, __mod))
- this->setstate(ios_base::failbit);
- }
-
-#if !defined (_STLP_NO_EXTENSIONS)
- explicit basic_fstream(int __id,
- ios_base::openmode __mod = ios_base::in | ios_base::out) :
- basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
- this->init(&_M_buf);
- if (!_M_buf.open(__id, __mod))
- this->setstate(ios_base::failbit);
- }
- basic_fstream(const char* __s, ios_base::openmode __m, long __protection) :
- basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
- this->init(&_M_buf);
- if (!_M_buf.open(__s, __m, __protection))
- this->setstate(ios_base::failbit);
- }
-# if defined (_STLP_USE_WIN32_IO)
- explicit basic_fstream(_STLP_fd __id,
- ios_base::openmode __mod = ios_base::in | ios_base::out) :
- basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
- this->init(&_M_buf);
- if (!_M_buf.open(__id, __mod))
- this->setstate(ios_base::failbit);
- }
-# endif /* _STLP_USE_WIN32_IO */
-#endif
- ~basic_fstream() {}
-
-public: // File and buffer operations.
-
- basic_filebuf<_CharT, _Traits>* rdbuf() const
- { return __CONST_CAST(_Buf*,&_M_buf); }
-
- bool is_open() {
- return this->rdbuf()->is_open();
- }
-
- void open(const char* __s,
- ios_base::openmode __mod =
- ios_base::in | ios_base::out) {
- if (!this->rdbuf()->open(__s, __mod))
- this->setstate(ios_base::failbit);
- }
-
- void close() {
- if (!this->rdbuf()->close())
- this->setstate(ios_base::failbit);
- }
-
-private:
- basic_filebuf<_CharT, _Traits> _M_buf;
-
-#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
- typedef basic_fstream<_CharT, _Traits> _Self;
- //explicitely defined as private to avoid warnings:
- basic_fstream(_Self const&);
- _Self& operator = (_Self const&);
-#endif
-};
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_fstream.c>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS basic_ifstream<char, char_traits<char> >;
-_STLP_EXPORT_TEMPLATE_CLASS basic_ofstream<char, char_traits<char> >;
-_STLP_EXPORT_TEMPLATE_CLASS basic_fstream<char, char_traits<char> >;
-# if ! defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS basic_ifstream<wchar_t, char_traits<wchar_t> >;
-_STLP_EXPORT_TEMPLATE_CLASS basic_ofstream<wchar_t, char_traits<wchar_t> >;
-_STLP_EXPORT_TEMPLATE_CLASS basic_fstream<wchar_t, char_traits<wchar_t> >;
-# endif
-#endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_FSTREAM */
-
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_function.h b/stl/_function.h
deleted file mode 100644
index c9d7888..0000000
--- a/stl/_function.h
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_FUNCTION_H
-#define _STLP_INTERNAL_FUNCTION_H
-
-#ifndef _STLP_TYPE_TRAITS_H
-# include <stl/type_traits.h>
-#endif
-
-#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
-# include <stl/_function_base.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _Tp>
-struct not_equal_to : public binary_function<_Tp, _Tp, bool> {
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; }
-};
-
-template <class _Tp>
-struct greater : public binary_function<_Tp, _Tp, bool> {
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; }
-};
-
-template <class _Tp>
-struct greater_equal : public binary_function<_Tp, _Tp, bool> {
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; }
-};
-
-template <class _Tp>
-struct less_equal : public binary_function<_Tp, _Tp, bool> {
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; }
-};
-
-template <class _Tp>
-struct divides : public binary_function<_Tp, _Tp, _Tp> {
- _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; }
-};
-
-template <class _Tp>
-struct modulus : public binary_function<_Tp, _Tp, _Tp> {
- _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; }
-};
-
-template <class _Tp>
-struct negate : public unary_function<_Tp, _Tp> {
- _Tp operator()(const _Tp& __x) const { return -__x; }
-};
-
-template <class _Tp>
-struct logical_and : public binary_function<_Tp, _Tp, bool> {
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; }
-};
-
-template <class _Tp>
-struct logical_or : public binary_function<_Tp, _Tp,bool> {
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; }
-};
-
-template <class _Tp>
-struct logical_not : public unary_function<_Tp, bool> {
- bool operator()(const _Tp& __x) const { return !__x; }
-};
-
-#if !defined (_STLP_NO_EXTENSIONS)
-// identity_element (not part of the C++ standard).
-template <class _Tp> inline _Tp identity_element(plus<_Tp>) { return _Tp(0); }
-template <class _Tp> inline _Tp identity_element(multiplies<_Tp>) { return _Tp(1); }
-#endif
-
-#if defined (_STLP_BASE_TYPEDEF_BUG)
-// this workaround is needed for SunPro 4.0.1
-// suggested by "Martin Abernethy" <gma@paston.co.uk>:
-
-// We have to introduce the XXary_predicate_aux structures in order to
-// access the argument and return types of predicate functions supplied
-// as type parameters. SUN C++ 4.0.1 compiler gives errors for template type parameters
-// of the form 'name1::name2', where name1 is itself a type parameter.
-template <class _Pair>
-struct __pair_aux : private _Pair {
- typedef typename _Pair::first_type first_type;
- typedef typename _Pair::second_type second_type;
-};
-
-template <class _Operation>
-struct __unary_fun_aux : private _Operation {
- typedef typename _Operation::argument_type argument_type;
- typedef typename _Operation::result_type result_type;
-};
-
-template <class _Operation>
-struct __binary_fun_aux : private _Operation {
- typedef typename _Operation::first_argument_type first_argument_type;
- typedef typename _Operation::second_argument_type second_argument_type;
- typedef typename _Operation::result_type result_type;
-};
-
-# define __UNARY_ARG(__Operation,__type) __unary_fun_aux<__Operation>::__type
-# define __BINARY_ARG(__Operation,__type) __binary_fun_aux<__Operation>::__type
-# define __PAIR_ARG(__Pair,__type) __pair_aux<__Pair>::__type
-#else
-# define __UNARY_ARG(__Operation,__type) __Operation::__type
-# define __BINARY_ARG(__Operation,__type) __Operation::__type
-# define __PAIR_ARG(__Pair,__type) __Pair::__type
-#endif
-
-template <class _Predicate>
-class unary_negate
- : public unary_function<typename __UNARY_ARG(_Predicate, argument_type), bool> {
- typedef unary_function<typename __UNARY_ARG(_Predicate, argument_type), bool> _Base;
-public:
- typedef typename _Base::argument_type argument_type;
-private:
- typedef typename __call_traits<argument_type>::param_type _ArgParamType;
-protected:
- _Predicate _M_pred;
-public:
- explicit unary_negate(const _Predicate& __x) : _M_pred(__x) {}
- bool operator()(_ArgParamType __x) const {
- return !_M_pred(__x);
- }
-};
-
-template <class _Predicate>
-inline unary_negate<_Predicate>
-not1(const _Predicate& __pred) {
- return unary_negate<_Predicate>(__pred);
-}
-
-template <class _Predicate>
-class binary_negate
- : public binary_function<typename __BINARY_ARG(_Predicate, first_argument_type),
- typename __BINARY_ARG(_Predicate, second_argument_type),
- bool> {
- typedef binary_function<typename __BINARY_ARG(_Predicate, first_argument_type),
- typename __BINARY_ARG(_Predicate, second_argument_type),
- bool> _Base;
-public:
- typedef typename _Base::first_argument_type first_argument_type;
- typedef typename _Base::second_argument_type second_argument_type;
-private:
- typedef typename __call_traits<first_argument_type>::param_type _FstArgParamType;
- typedef typename __call_traits<second_argument_type>::param_type _SndArgParamType;
-protected:
- _Predicate _M_pred;
-public:
- explicit binary_negate(const _Predicate& __x) : _M_pred(__x) {}
- bool operator()(_FstArgParamType __x, _SndArgParamType __y) const {
- return !_M_pred(__x, __y);
- }
-};
-
-template <class _Predicate>
-inline binary_negate<_Predicate>
-not2(const _Predicate& __pred) {
- return binary_negate<_Predicate>(__pred);
-}
-
-template <class _Operation>
-class binder1st :
- public unary_function<typename __BINARY_ARG(_Operation, second_argument_type),
- typename __BINARY_ARG(_Operation, result_type) > {
- typedef unary_function<typename __BINARY_ARG(_Operation, second_argument_type),
- typename __BINARY_ARG(_Operation, result_type) > _Base;
-public:
- typedef typename _Base::argument_type argument_type;
- typedef typename _Base::result_type result_type;
-private:
- typedef typename __call_traits<argument_type>::param_type _ArgParamType;
- typedef typename __call_traits<typename _Operation::first_argument_type>::param_type _ValueParamType;
-protected:
- //op is a Standard name (20.3.6.1), do no make it STLport naming convention compliant.
- _Operation op;
- typename _Operation::first_argument_type _M_value;
-public:
- binder1st(const _Operation& __x, _ValueParamType __y)
- : op(__x), _M_value(__y) {}
-
- result_type operator()(_ArgParamType __x) const {
- return op(_M_value, __x);
- }
-};
-
-template <class _Operation, class _Tp>
-inline binder1st<_Operation>
-bind1st(const _Operation& __fn, const _Tp& __x) {
- typedef typename _Operation::first_argument_type _Arg1_type;
- return binder1st<_Operation>(__fn, _Arg1_type(__x));
-}
-
-template <class _Operation>
-class binder2nd
- : public unary_function<typename __BINARY_ARG(_Operation, first_argument_type),
- typename __BINARY_ARG(_Operation, result_type)> {
- typedef unary_function<typename __BINARY_ARG(_Operation, first_argument_type),
- typename __BINARY_ARG(_Operation, result_type)> _Base;
-public:
- typedef typename _Base::argument_type argument_type;
- typedef typename _Base::result_type result_type;
-private:
- typedef typename __call_traits<argument_type>::param_type _ArgParamType;
- typedef typename __call_traits<typename _Operation::second_argument_type>::param_type _ValueParamType;
-protected:
- //op is a Standard name (20.3.6.3), do no make it STLport naming convention compliant.
- _Operation op;
- typename _Operation::second_argument_type value;
-public:
- binder2nd(const _Operation& __x, _ValueParamType __y)
- : op(__x), value(__y) {}
-
- result_type operator()(_ArgParamType __x) const {
- return op(__x, value);
- }
-};
-
-template <class _Operation, class _Tp>
-inline binder2nd<_Operation>
-bind2nd(const _Operation& __fn, const _Tp& __x) {
- typedef typename _Operation::second_argument_type _Arg2_type;
- return binder2nd<_Operation>(__fn, _Arg2_type(__x));
-}
-
-#if !defined (_STLP_NO_EXTENSIONS)
-// unary_compose and binary_compose (extensions, not part of the standard).
-
-template <class _Operation1, class _Operation2>
-class unary_compose :
- public unary_function<typename __UNARY_ARG(_Operation2, argument_type),
- typename __UNARY_ARG(_Operation1, result_type)> {
- typedef unary_function<typename __UNARY_ARG(_Operation2, argument_type),
- typename __UNARY_ARG(_Operation1, result_type)> _Base;
-public:
- typedef typename _Base::argument_type argument_type;
- typedef typename _Base::result_type result_type;
-private:
- typedef typename __call_traits<argument_type>::param_type _ArgParamType;
-protected:
- _Operation1 _M_fn1;
- _Operation2 _M_fn2;
-public:
- unary_compose(const _Operation1& __x, const _Operation2& __y)
- : _M_fn1(__x), _M_fn2(__y) {}
-
- result_type operator()(_ArgParamType __x) const {
- return _M_fn1(_M_fn2(__x));
- }
-};
-
-template <class _Operation1, class _Operation2>
-inline unary_compose<_Operation1,_Operation2>
-compose1(const _Operation1& __fn1, const _Operation2& __fn2) {
- return unary_compose<_Operation1,_Operation2>(__fn1, __fn2);
-}
-
-template <class _Operation1, class _Operation2, class _Operation3>
-class binary_compose :
- public unary_function<typename __UNARY_ARG(_Operation2, argument_type),
- typename __BINARY_ARG(_Operation1, result_type)> {
- typedef unary_function<typename __UNARY_ARG(_Operation2, argument_type),
- typename __BINARY_ARG(_Operation1, result_type)> _Base;
-public:
- typedef typename _Base::argument_type argument_type;
- typedef typename _Base::result_type result_type;
-private:
- typedef typename __call_traits<argument_type>::param_type _ArgParamType;
-protected:
- _Operation1 _M_fn1;
- _Operation2 _M_fn2;
- _Operation3 _M_fn3;
-public:
- binary_compose(const _Operation1& __x, const _Operation2& __y,
- const _Operation3& __z)
- : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
-
- result_type operator()(_ArgParamType __x) const {
- return _M_fn1(_M_fn2(__x), _M_fn3(__x));
- }
-};
-
-template <class _Operation1, class _Operation2, class _Operation3>
-inline binary_compose<_Operation1, _Operation2, _Operation3>
-compose2(const _Operation1& __fn1, const _Operation2& __fn2,
- const _Operation3& __fn3) {
- return binary_compose<_Operation1,_Operation2,_Operation3>(__fn1, __fn2, __fn3);
-}
-
-// identity is an extension: it is not part of the standard.
-template <class _Tp> struct identity : public _STLP_PRIV _Identity<_Tp> {};
-// select1st and select2nd are extensions: they are not part of the standard.
-template <class _Pair> struct select1st : public _STLP_PRIV _Select1st<_Pair> {};
-template <class _Pair> struct select2nd : public _STLP_PRIV _Select2nd<_Pair> {};
-
-template <class _Arg1, class _Arg2>
-struct project1st : public _STLP_PRIV _Project1st<_Arg1, _Arg2> {};
-
-template <class _Arg1, class _Arg2>
-struct project2nd : public _STLP_PRIV _Project2nd<_Arg1, _Arg2> {};
-
-
-// constant_void_fun, constant_unary_fun, and constant_binary_fun are
-// extensions: they are not part of the standard. (The same, of course,
-// is true of the helper functions constant0, constant1, and constant2.)
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Result>
-struct _Constant_void_fun {
- typedef _Result result_type;
- result_type _M_val;
-
- _Constant_void_fun(const result_type& __v) : _M_val(__v) {}
- const result_type& operator()() const { return _M_val; }
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _Result>
-struct constant_void_fun : public _STLP_PRIV _Constant_void_fun<_Result> {
- constant_void_fun(const _Result& __v)
- : _STLP_PRIV _Constant_void_fun<_Result>(__v) {}
-};
-
-template <class _Result, _STLP_DFL_TMPL_PARAM( _Argument , _Result) >
-struct constant_unary_fun : public _STLP_PRIV _Constant_unary_fun<_Result, _Argument> {
- constant_unary_fun(const _Result& __v)
- : _STLP_PRIV _Constant_unary_fun<_Result, _Argument>(__v) {}
-};
-
-template <class _Result, _STLP_DFL_TMPL_PARAM( _Arg1 , _Result), _STLP_DFL_TMPL_PARAM( _Arg2 , _Arg1) >
-struct constant_binary_fun
- : public _STLP_PRIV _Constant_binary_fun<_Result, _Arg1, _Arg2> {
- constant_binary_fun(const _Result& __v)
- : _STLP_PRIV _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
-};
-
-template <class _Result>
-inline constant_void_fun<_Result> constant0(const _Result& __val) {
- return constant_void_fun<_Result>(__val);
-}
-
-template <class _Result>
-inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val) {
- return constant_unary_fun<_Result,_Result>(__val);
-}
-
-template <class _Result>
-inline constant_binary_fun<_Result,_Result,_Result>
-constant2(const _Result& __val) {
- return constant_binary_fun<_Result,_Result,_Result>(__val);
-}
-
-// subtractive_rng is an extension: it is not part of the standard.
-// Note: this code assumes that int is 32 bits.
-class subtractive_rng : public unary_function<_STLP_UINT32_T, _STLP_UINT32_T> {
-private:
- _STLP_UINT32_T _M_table[55];
- _STLP_UINT32_T _M_index1;
- _STLP_UINT32_T _M_index2;
-public:
- _STLP_UINT32_T operator()(_STLP_UINT32_T __limit) {
- _M_index1 = (_M_index1 + 1) % 55;
- _M_index2 = (_M_index2 + 1) % 55;
- _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
- return _M_table[_M_index1] % __limit;
- }
-
- void _M_initialize(_STLP_UINT32_T __seed) {
- _STLP_UINT32_T __k = 1;
- _M_table[54] = __seed;
- _STLP_UINT32_T __i;
- for (__i = 0; __i < 54; __i++) {
- _STLP_UINT32_T __ii = (21 * (__i + 1) % 55) - 1;
- _M_table[__ii] = __k;
- __k = __seed - __k;
- __seed = _M_table[__ii];
- }
- for (int __loop = 0; __loop < 4; __loop++) {
- for (__i = 0; __i < 55; __i++)
- _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
- }
- _M_index1 = 0;
- _M_index2 = 31;
- }
-
- subtractive_rng(unsigned int __seed) { _M_initialize(__seed); }
- subtractive_rng() { _M_initialize(161803398ul); }
-};
-
-#endif /* _STLP_NO_EXTENSIONS */
-
-_STLP_END_NAMESPACE
-
-#include <stl/_function_adaptors.h>
-
-#endif /* _STLP_INTERNAL_FUNCTION_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_function_adaptors.h b/stl/_function_adaptors.h
deleted file mode 100644
index 1eb85e7..0000000
--- a/stl/_function_adaptors.h
+++ /dev/null
@@ -1,802 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * Copyright (c) 2000
- * Pavel Kuznetsov
- *
- * Copyright (c) 2001
- * Meridian'93
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-// This file has noo macro protection as it is meant to be included several times
-// from other header.
-// Adaptor function objects: pointers to member functions.
-
-// There are a total of 16 = 2^4 function objects in this family.
-// (1) Member functions taking no arguments vs member functions taking
-// one argument.
-// (2) Call through pointer vs call through reference.
-// (3) Member function with void return type vs member function with
-// non-void return type.
-// (4) Const vs non-const member function.
-
-// Note that choice (3) is nothing more than a workaround: according
-// to the draft, compilers should handle void and non-void the same way.
-// This feature is not yet widely implemented, though. You can only use
-// member functions returning void if your compiler supports partial
-// specialization.
-
-// All of this complexity is in the function objects themselves. You can
-// ignore it by using the helper function mem_fun and mem_fun_ref,
-// which create whichever type of adaptor is appropriate.
-
-_STLP_BEGIN_NAMESPACE
-
-//This implementation will only be used if needed, that is to say when there is the return void bug
-//and when there is no partial template specialization
-#if defined(_STLP_DONT_RETURN_VOID) && defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined(_STLP_MEMBER_TEMPLATE_CLASSES)
-
-template<class _Result, class _Tp>
-class _Mem_fun0_ptr : public unary_function<_Tp*, _Result> {
-protected:
- typedef _Result (_Tp::*__fun_type) ();
- explicit _Mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
-
-public:
- _Result operator ()(_Tp* __p) const { return (__p->*_M_f)(); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Result, class _Tp, class _Arg>
-class _Mem_fun1_ptr : public binary_function<_Tp*,_Arg,_Result> {
-protected:
- typedef _Result (_Tp::*__fun_type) (_Arg);
- explicit _Mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
-
-public:
- _Result operator ()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Result, class _Tp>
-class _Const_mem_fun0_ptr : public unary_function<const _Tp*,_Result> {
-protected:
- typedef _Result (_Tp::*__fun_type) () const;
- explicit _Const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
-
-public:
- _Result operator ()(const _Tp* __p) const { return (__p->*_M_f)(); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Result, class _Tp, class _Arg>
-class _Const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,_Result> {
-protected:
- typedef _Result (_Tp::*__fun_type) (_Arg) const;
- explicit _Const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
-
-public:
- _Result operator ()(const _Tp* __p, _Arg __x) const {
- return (__p->*_M_f)(__x); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Result, class _Tp>
-class _Mem_fun0_ref : public unary_function<_Tp&,_Result> {
-protected:
- typedef _Result (_Tp::*__fun_type) ();
- explicit _Mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
-
-public:
- _Result operator ()(_Tp& __p) const { return (__p.*_M_f)(); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Result, class _Tp, class _Arg>
-class _Mem_fun1_ref : public binary_function<_Tp&,_Arg,_Result> {
-protected:
- typedef _Result (_Tp::*__fun_type) (_Arg);
- explicit _Mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
-
-public:
- _Result operator ()(_Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Result, class _Tp>
-class _Const_mem_fun0_ref : public unary_function<const _Tp&,_Result> {
-protected:
- typedef _Result (_Tp::*__fun_type) () const;
- explicit _Const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
-
-public:
- _Result operator ()(const _Tp& __p) const { return (__p.*_M_f)(); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Result, class _Tp, class _Arg>
-class _Const_mem_fun1_ref : public binary_function<const _Tp&,_Arg,_Result> {
-protected:
- typedef _Result (_Tp::*__fun_type) (_Arg) const;
- explicit _Const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
-
-public:
- _Result operator ()(const _Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Result>
-struct _Mem_fun_traits {
- template<class _Tp>
- struct _Args0 {
- typedef _Mem_fun0_ptr<_Result,_Tp> _Ptr;
- typedef _Const_mem_fun0_ptr<_Result,_Tp> _Ptr_const;
- typedef _Mem_fun0_ref<_Result,_Tp> _Ref;
- typedef _Const_mem_fun0_ref<_Result,_Tp> _Ref_const;
- };
-
- template<class _Tp, class _Arg>
- struct _Args1 {
- typedef _Mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr;
- typedef _Const_mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr_const;
- typedef _Mem_fun1_ref<_Result,_Tp,_Arg> _Ref;
- typedef _Const_mem_fun1_ref<_Result,_Tp,_Arg> _Ref_const;
- };
-};
-
-template<class _Arg, class _Result>
-class _Ptr_fun1_base : public unary_function<_Arg, _Result> {
-protected:
- typedef _Result (*__fun_type) (_Arg);
- explicit _Ptr_fun1_base(__fun_type __f) : _M_f(__f) {}
-
-public:
- _Result operator()(_Arg __x) const { return _M_f(__x); }
-
-private:
- __fun_type _M_f;
-};
-
-template <class _Arg1, class _Arg2, class _Result>
-class _Ptr_fun2_base : public binary_function<_Arg1,_Arg2,_Result> {
-protected:
- typedef _Result (*__fun_type) (_Arg1, _Arg2);
- explicit _Ptr_fun2_base(__fun_type __f) : _M_f(__f) {}
-
-public:
- _Result operator()(_Arg1 __x, _Arg2 __y) const { return _M_f(__x, __y); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Result>
-struct _Ptr_fun_traits {
- template<class _Arg> struct _Args1 {
- typedef _Ptr_fun1_base<_Arg,_Result> _Fun;
- };
-
- template<class _Arg1, class _Arg2> struct _Args2 {
- typedef _Ptr_fun2_base<_Arg1,_Arg2,_Result> _Fun;
- };
-};
-
-/*Specialization for void return type
-*/
-template<class _Tp>
-class _Void_mem_fun0_ptr : public unary_function<_Tp*,void> {
-protected:
- typedef void (_Tp::*__fun_type) ();
- explicit _Void_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
-
-public:
- void operator ()(_Tp* __p) const { (__p->*_M_f)(); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Tp, class _Arg>
-class _Void_mem_fun1_ptr : public binary_function<_Tp*,_Arg,void> {
-protected:
- typedef void (_Tp::*__fun_type) (_Arg);
- explicit _Void_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
-
-public:
- void operator ()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Tp>
-class _Void_const_mem_fun0_ptr : public unary_function<const _Tp*,void> {
-protected:
- typedef void (_Tp::*__fun_type) () const;
- explicit _Void_const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
-
-public:
- void operator ()(const _Tp* __p) const { (__p->*_M_f)(); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Tp, class _Arg>
-class _Void_const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,void> {
-protected:
- typedef void (_Tp::*__fun_type) (_Arg) const;
- explicit _Void_const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
-
-public:
- void operator ()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Tp>
-class _Void_mem_fun0_ref : public unary_function<_Tp&,void> {
-protected:
- typedef void (_Tp::*__fun_type) ();
- explicit _Void_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
-
-public:
- void operator ()(_Tp& __p) const { (__p.*_M_f)(); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Tp, class _Arg>
-class _Void_mem_fun1_ref : public binary_function<_Tp&,_Arg,void> {
-protected:
- typedef void (_Tp::*__fun_type) (_Arg);
- explicit _Void_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
-
-public:
- void operator ()(_Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Tp>
-class _Void_const_mem_fun0_ref : public unary_function<const _Tp&,void> {
-protected:
- typedef void (_Tp::*__fun_type) () const;
- explicit _Void_const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
-
-public:
- void operator ()(const _Tp& __p) const { (__p.*_M_f)(); }
-
-private:
- __fun_type _M_f;
-};
-
-template<class _Tp, class _Arg>
-class _Void_const_mem_fun1_ref : public binary_function<const _Tp&,_Arg,void> {
-protected:
- typedef void (_Tp::*__fun_type) (_Arg) const;
- explicit _Void_const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
-
-public:
- void operator ()(const _Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
-
-private:
- __fun_type _M_f;
-};
-
-_STLP_TEMPLATE_NULL
-struct _Mem_fun_traits<void> {
- template<class _Tp> struct _Args0 {
- typedef _Void_mem_fun0_ptr<_Tp> _Ptr;
- typedef _Void_const_mem_fun0_ptr<_Tp> _Ptr_const;
- typedef _Void_mem_fun0_ref<_Tp> _Ref;
- typedef _Void_const_mem_fun0_ref<_Tp> _Ref_const;
- };
-
- template<class _Tp, class _Arg> struct _Args1 {
- typedef _Void_mem_fun1_ptr<_Tp,_Arg> _Ptr;
- typedef _Void_const_mem_fun1_ptr<_Tp,_Arg> _Ptr_const;
- typedef _Void_mem_fun1_ref<_Tp,_Arg> _Ref;
- typedef _Void_const_mem_fun1_ref<_Tp,_Arg> _Ref_const;
- };
-};
-
-template<class _Arg>
-class _Ptr_void_fun1_base : public unary_function<_Arg, void> {
-protected:
- typedef void (*__fun_type) (_Arg);
- explicit _Ptr_void_fun1_base(__fun_type __f) : _M_f(__f) {}
-
-public:
- void operator()(_Arg __x) const { _M_f(__x); }
-
-private:
- __fun_type _M_f;
-};
-
-template <class _Arg1, class _Arg2>
-class _Ptr_void_fun2_base : public binary_function<_Arg1,_Arg2,void> {
-protected:
- typedef void (*__fun_type) (_Arg1, _Arg2);
- explicit _Ptr_void_fun2_base(__fun_type __f) : _M_f(__f) {}
-
-public:
- void operator()(_Arg1 __x, _Arg2 __y) const { _M_f(__x, __y); }
-
-private:
- __fun_type _M_f;
-};
-
-_STLP_TEMPLATE_NULL
-struct _Ptr_fun_traits<void> {
- template<class _Arg> struct _Args1 {
- typedef _Ptr_void_fun1_base<_Arg> _Fun;
- };
-
- template<class _Arg1, class _Arg2> struct _Args2 {
- typedef _Ptr_void_fun2_base<_Arg1,_Arg2> _Fun;
- };
-};
-
-// pavel: need extra level of inheritance here since MSVC++ does not
-// accept traits-based fake partial specialization for template
-// arguments other than first
-
-template<class _Result, class _Arg>
-class _Ptr_fun1 :
- public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun {
-protected:
- typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun _Base;
- explicit _Ptr_fun1(typename _Base::__fun_type __f) : _Base(__f) {}
-};
-
-template<class _Result, class _Arg1, class _Arg2>
-class _Ptr_fun2 :
- public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun {
-protected:
- typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun _Base;
- explicit _Ptr_fun2(typename _Base::__fun_type __f) : _Base(__f) {}
-};
-
-
-#endif /*_STLP_DONT_RETURN_VOID && _STLP_NO_CLASS_PARTIAL_SPECIALIZATION && _STLP_MEMBER_TEMPLATE_CLASSES*/
-
-
-#if !defined(_STLP_DONT_RETURN_VOID) || !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) || !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
-
-template <class _Ret, class _Tp>
-class mem_fun_t : public unary_function<_Tp*,_Ret> {
- typedef _Ret (_Tp::*__fun_type)(void);
-public:
- explicit mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
- _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Ret, class _Tp>
-class const_mem_fun_t : public unary_function<const _Tp*,_Ret> {
- typedef _Ret (_Tp::*__fun_type)(void) const;
-public:
- explicit const_mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
- _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); }
-private:
- __fun_type _M_f;
-};
-
-
-template <class _Ret, class _Tp>
-class mem_fun_ref_t : public unary_function<_Tp,_Ret> {
- typedef _Ret (_Tp::*__fun_type)(void);
-public:
- explicit mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
- _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Ret, class _Tp>
-class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> {
- typedef _Ret (_Tp::*__fun_type)(void) const;
-public:
- explicit const_mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
- _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Ret, class _Tp, class _Arg>
-class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> {
- typedef _Ret (_Tp::*__fun_type)(_Arg);
-public:
- explicit mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
- _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Ret, class _Tp, class _Arg>
-class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> {
- typedef _Ret (_Tp::*__fun_type)(_Arg) const;
-public:
- explicit const_mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
- _Ret operator()(const _Tp* __p, _Arg __x) const
- { return (__p->*_M_f)(__x); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Ret, class _Tp, class _Arg>
-class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
- typedef _Ret (_Tp::*__fun_type)(_Arg);
-public:
- explicit mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
- _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Ret, class _Tp, class _Arg>
-class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
- typedef _Ret (_Tp::*__fun_type)(_Arg) const;
-public:
- explicit const_mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
- _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Arg, class _Result>
-class pointer_to_unary_function : public unary_function<_Arg, _Result> {
-protected:
- _Result (*_M_ptr)(_Arg);
-public:
- pointer_to_unary_function() {}
- explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {}
- _Result operator()(_Arg __x) const { return _M_ptr(__x); }
-};
-
-template <class _Arg1, class _Arg2, class _Result>
-class pointer_to_binary_function :
- public binary_function<_Arg1,_Arg2,_Result> {
-protected:
- _Result (*_M_ptr)(_Arg1, _Arg2);
-public:
- pointer_to_binary_function() {}
- explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))
- : _M_ptr(__x) {}
- _Result operator()(_Arg1 __x, _Arg2 __y) const {
- return _M_ptr(__x, __y);
- }
-};
-
-
-#if defined(_STLP_DONT_RETURN_VOID) && !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION)
-//Partial specialization for the void type
-template <class _Tp>
-class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {
- typedef void (_Tp::*__fun_type)(void);
-public:
- explicit mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
- void operator()(_Tp* __p) const { (__p->*_M_f)(); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Tp>
-class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> {
- typedef void (_Tp::*__fun_type)(void) const;
-public:
- explicit const_mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
- void operator()(const _Tp* __p) const { (__p->*_M_f)(); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Tp>
-class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
- typedef void (_Tp::*__fun_type)(void);
-public:
- explicit mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
- void operator()(_Tp& __r) const { (__r.*_M_f)(); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Tp>
-class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
- typedef void (_Tp::*__fun_type)(void) const;
-public:
- explicit const_mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
- void operator()(const _Tp& __r) const { (__r.*_M_f)(); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Tp, class _Arg>
-class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> {
- typedef void (_Tp::*__fun_type)(_Arg);
-public:
- explicit mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
- void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Tp, class _Arg>
-class const_mem_fun1_t<void, _Tp, _Arg>
- : public binary_function<const _Tp*,_Arg,void> {
- typedef void (_Tp::*__fun_type)(_Arg) const;
-public:
- explicit const_mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
- void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Tp, class _Arg>
-class mem_fun1_ref_t<void, _Tp, _Arg>
- : public binary_function<_Tp,_Arg,void> {
- typedef void (_Tp::*__fun_type)(_Arg);
-public:
- explicit mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
- void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Tp, class _Arg>
-class const_mem_fun1_ref_t<void, _Tp, _Arg>
- : public binary_function<_Tp,_Arg,void> {
- typedef void (_Tp::*__fun_type)(_Arg) const;
-public:
- explicit const_mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
- void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
-private:
- __fun_type _M_f;
-};
-
-template <class _Arg>
-class pointer_to_unary_function<_Arg, void> : public unary_function<_Arg, void> {
- typedef void (*__fun_type)(_Arg);
- __fun_type _M_ptr;
-public:
- pointer_to_unary_function() {}
- explicit pointer_to_unary_function(__fun_type __x) : _M_ptr(__x) {}
- void operator()(_Arg __x) const { _M_ptr(__x); }
-};
-
-template <class _Arg1, class _Arg2>
-class pointer_to_binary_function<_Arg1, _Arg2, void> : public binary_function<_Arg1,_Arg2,void> {
- typedef void (*__fun_type)(_Arg1, _Arg2);
- __fun_type _M_ptr;
-public:
- pointer_to_binary_function() {}
- explicit pointer_to_binary_function(__fun_type __x) : _M_ptr(__x) {}
- void operator()(_Arg1 __x, _Arg2 __y) const { _M_ptr(__x, __y); }
-};
-
-#endif /*_STLP_DONT_RETURN_VOID && !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION*/
-
-#else /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/
-
-//mem_fun_t
-template <class _Result, class _Tp>
-class mem_fun_t :
- public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr {
- typedef typename
- _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr _Base;
-public:
- explicit mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
-};
-
-//const_mem_fun_t
-template <class _Result, class _Tp>
-class const_mem_fun_t :
- public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const {
- typedef typename
- _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const _Base;
-public:
- explicit const_mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
-};
-
-//mem_fun_ref_t
-template <class _Result, class _Tp>
-class mem_fun_ref_t :
- public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref {
- typedef typename
- _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref _Base;
-public:
- explicit mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
-};
-
-//const_mem_fun_ref_t
-template <class _Result, class _Tp>
-class const_mem_fun_ref_t :
- public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const {
- typedef typename
- _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const _Base;
-public:
- explicit const_mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
-};
-
-//mem_fun1_t
-template <class _Result, class _Tp, class _Arg>
-class mem_fun1_t :
- public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr {
- typedef typename
- _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr _Base;
-public:
- explicit mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
-};
-
-//const_mem_fun1_t
-template <class _Result, class _Tp, class _Arg>
-class const_mem_fun1_t :
- public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const {
- typedef typename
- _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const _Base;
-public:
- explicit const_mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
-};
-
-//mem_fun1_ref_t
-template <class _Result, class _Tp, class _Arg>
-class mem_fun1_ref_t :
- public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref {
- typedef typename
- _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref _Base;
-public:
- explicit mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
-};
-
-//const_mem_fun1_t
-template <class _Result, class _Tp, class _Arg>
-class const_mem_fun1_ref_t :
- public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const {
- typedef typename
- _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const _Base;
-public:
- explicit const_mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
-};
-
-
-template <class _Arg, class _Result>
-class pointer_to_unary_function :
-public _Ptr_fun1<_Result,_Arg> {
- typedef typename
- _Ptr_fun1<_Result,_Arg>::__fun_type __fun_type;
-public:
- explicit pointer_to_unary_function(__fun_type __f)
- : _Ptr_fun1<_Result,_Arg>(__f) {}
-};
-
-template <class _Arg1, class _Arg2, class _Result>
-class pointer_to_binary_function :
-public _Ptr_fun2<_Result,_Arg1,_Arg2> {
- typedef typename
- _Ptr_fun2<_Result,_Arg1,_Arg2>::__fun_type __fun_type;
-public:
- explicit pointer_to_binary_function(__fun_type __f)
- : _Ptr_fun2<_Result,_Arg1,_Arg2>(__f) {}
-};
-
-#endif /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/
-
-
-# if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
-// Mem_fun adaptor helper functions. There are only two:
-// mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref
-// are provided for backward compatibility, but they are no longer
-// part of the C++ standard.)
-
-template <class _Result, class _Tp>
-inline mem_fun_t<_Result,_Tp>
-mem_fun(_Result (_Tp::*__f)()) { return mem_fun_t<_Result,_Tp>(__f); }
-
-template <class _Result, class _Tp>
-inline const_mem_fun_t<_Result,_Tp>
-mem_fun(_Result (_Tp::*__f)() const) { return const_mem_fun_t<_Result,_Tp>(__f); }
-
-template <class _Result, class _Tp>
-inline mem_fun_ref_t<_Result,_Tp>
-mem_fun_ref(_Result (_Tp::*__f)()) { return mem_fun_ref_t<_Result,_Tp>(__f); }
-
-template <class _Result, class _Tp>
-inline const_mem_fun_ref_t<_Result,_Tp>
-mem_fun_ref(_Result (_Tp::*__f)() const) { return const_mem_fun_ref_t<_Result,_Tp>(__f); }
-
-template <class _Result, class _Tp, class _Arg>
-inline mem_fun1_t<_Result,_Tp,_Arg>
-mem_fun(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
-
-template <class _Result, class _Tp, class _Arg>
-inline const_mem_fun1_t<_Result,_Tp,_Arg>
-mem_fun(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
-
-template <class _Result, class _Tp, class _Arg>
-inline mem_fun1_ref_t<_Result,_Tp,_Arg>
-mem_fun_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
-
-template <class _Result, class _Tp, class _Arg>
-inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
-mem_fun_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
-
-# if !(defined (_STLP_NO_EXTENSIONS) || defined (_STLP_NO_ANACHRONISMS))
-// mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,
-// but they are provided for backward compatibility.
-template <class _Result, class _Tp, class _Arg>
-inline mem_fun1_t<_Result,_Tp,_Arg>
-mem_fun1(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
-
-template <class _Result, class _Tp, class _Arg>
-inline const_mem_fun1_t<_Result,_Tp,_Arg>
-mem_fun1(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
-
-template <class _Result, class _Tp, class _Arg>
-inline mem_fun1_ref_t<_Result,_Tp,_Arg>
-mem_fun1_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
-
-template <class _Result, class _Tp, class _Arg>
-inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
-mem_fun1_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
-
-# endif /* _STLP_NO_EXTENSIONS */
-
-# endif /* _STLP_MEMBER_POINTER_PARAM_BUG */
-
-template <class _Arg, class _Result>
-inline pointer_to_unary_function<_Arg, _Result>
-ptr_fun(_Result (*__f)(_Arg))
-{ return pointer_to_unary_function<_Arg, _Result>(__f); }
-
-template <class _Arg1, class _Arg2, class _Result>
-inline pointer_to_binary_function<_Arg1,_Arg2,_Result>
-ptr_fun(_Result (*__f)(_Arg1, _Arg2))
-{ return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f); }
-
-_STLP_END_NAMESPACE
diff --git a/stl/_function_base.h b/stl/_function_base.h
deleted file mode 100644
index 5bb9b94..0000000
--- a/stl/_function_base.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
-#define _STLP_INTERNAL_FUNCTION_BASE_H
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_TYPE_TRAITS_H)
-# include <stl/type_traits.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _Arg, class _Result>
-struct unary_function {
- typedef _Arg argument_type;
- typedef _Result result_type;
-};
-
-template <class _Arg1, class _Arg2, class _Result>
-struct binary_function {
- typedef _Arg1 first_argument_type;
- typedef _Arg2 second_argument_type;
- typedef _Result result_type;
-};
-
-template <class _Tp>
-struct equal_to : public binary_function<_Tp, _Tp, bool> {
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; }
-};
-
-template <class _Tp>
-struct less : public binary_function<_Tp,_Tp,bool>
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-/* less is the default template parameter for many STL containers, to fully use
- * the move constructor feature we need to know that the default less is just a
- * functor.
- */
- , public __stlport_class<less<_Tp> >
-#endif
-{
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; }
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- //This is for a very special compiler config: partial template specialization
- //but no template function partial ordering.
- void swap(less<_Tp>&) {}
-#endif
-};
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp>
-struct __type_traits<less<_Tp> > {
-#if !defined (__BORLANDC__)
- typedef typename _IsSTLportClass<less<_Tp> >::_Ret _STLportLess;
-#else
- enum { _Is = _IsSTLportClass<less<_Tp> >::_Is };
- typedef typename __bool2type<_Is>::_Ret _STLportLess;
-#endif
- typedef _STLportLess has_trivial_default_constructor;
- typedef _STLportLess has_trivial_copy_constructor;
- typedef _STLportLess has_trivial_assignment_operator;
- typedef _STLportLess has_trivial_destructor;
- typedef _STLportLess is_POD_type;
-};
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Tp>
-less<_Tp> __less(_Tp* ) { return less<_Tp>(); }
-
-template <class _Tp>
-equal_to<_Tp> __equal_to(_Tp* ) { return equal_to<_Tp>(); }
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _Tp>
-struct plus : public binary_function<_Tp, _Tp, _Tp> {
- _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; }
-};
-
-template <class _Tp>
-struct minus : public binary_function<_Tp, _Tp, _Tp> {
- _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; }
-};
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Tp>
-plus<_Tp> __plus(_Tp* ) { return plus<_Tp>(); }
-
-template <class _Tp>
-minus<_Tp> __minus(_Tp* ) { return minus<_Tp>(); }
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _Tp>
-struct multiplies : public binary_function<_Tp, _Tp, _Tp> {
- _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; }
-};
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Pair>
-struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> {
- const typename _Pair::first_type& operator()(const _Pair& __x) const {
- return __x.first;
- }
-};
-
-template <class _Pair>
-struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> {
- const typename _Pair::second_type& operator()(const _Pair& __x) const {
- return __x.second;
- }
-};
-
-// project1st and project2nd are extensions: they are not part of the standard
-template <class _Arg1, class _Arg2>
-struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> {
- _Arg1 operator()(const _Arg1& __x, const _Arg2&) const { return __x; }
-};
-
-template <class _Arg1, class _Arg2>
-struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> {
- _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; }
-};
-
-#if defined (_STLP_MULTI_CONST_TEMPLATE_ARG_BUG)
-// fbp : sort of select1st just for maps
-template <class _Pair, class _Whatever>
-// JDJ (CW Pro1 doesn't like const when first_type is also const)
-struct __Select1st_hint : public unary_function<_Pair, _Whatever> {
- const _Whatever& operator () (const _Pair& __x) const { return __x.first; }
-};
-# define _STLP_SELECT1ST(__x,__y) _STLP_PRIV __Select1st_hint< __x, __y >
-#else
-# define _STLP_SELECT1ST(__x, __y) _STLP_PRIV _Select1st< __x >
-#endif
-
-template <class _Tp>
-struct _Identity : public unary_function<_Tp,_Tp> {
- const _Tp& operator()(const _Tp& __x) const { return __x; }
-};
-
-template <class _Result, class _Argument>
-struct _Constant_unary_fun {
- typedef _Argument argument_type;
- typedef _Result result_type;
- result_type _M_val;
-
- _Constant_unary_fun(const result_type& __v) : _M_val(__v) {}
- const result_type& operator()(const _Argument&) const { return _M_val; }
-};
-
-template <class _Result, class _Arg1, class _Arg2>
-struct _Constant_binary_fun {
- typedef _Arg1 first_argument_type;
- typedef _Arg2 second_argument_type;
- typedef _Result result_type;
- _Result _M_val;
-
- _Constant_binary_fun(const _Result& __v) : _M_val(__v) {}
- const result_type& operator()(const _Arg1&, const _Arg2&) const {
- return _M_val;
- }
-};
-
-// identity_element (not part of the C++ standard).
-template <class _Tp> inline _Tp __identity_element(plus<_Tp>) { return _Tp(0); }
-template <class _Tp> inline _Tp __identity_element(multiplies<_Tp>) { return _Tp(1); }
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_FUNCTION_BASE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_hash_fun.h b/stl/_hash_fun.h
deleted file mode 100644
index b069ff0..0000000
--- a/stl/_hash_fun.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 1996-1998
- * 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 (c) 1994
- * Hewlett-Packard Company
- *
- * 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. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_HASH_FUN_H
-#define _STLP_HASH_FUN_H
-
-#ifndef _STLP_INTERNAL_CSTDDEF
-# include <stl/_cstddef.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _Key> struct hash { };
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-inline size_t __stl_hash_string(const char* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- unsigned long __h = 0;
- for ( ; *__s; ++__s)
- __h = 5*__h + *__s;
-
- return size_t(__h);
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_TEMPLATE_NULL
-struct hash<char*> {
- size_t operator()(const char* __s) const {
- _STLP_FIX_LITERAL_BUG(__s)
- return _STLP_PRIV __stl_hash_string(__s);
- }
-};
-
-_STLP_TEMPLATE_NULL
-struct hash<const char*> {
- size_t operator()(const char* __s) const {
- _STLP_FIX_LITERAL_BUG(__s)
- return _STLP_PRIV __stl_hash_string(__s);
- }
-};
-
-_STLP_TEMPLATE_NULL struct hash<char> {
- size_t operator()(char __x) const { return __x; }
-};
-_STLP_TEMPLATE_NULL struct hash<unsigned char> {
- size_t operator()(unsigned char __x) const { return __x; }
-};
-#if !defined (_STLP_NO_SIGNED_BUILTINS)
-_STLP_TEMPLATE_NULL struct hash<signed char> {
- size_t operator()(unsigned char __x) const { return __x; }
-};
-#endif
-_STLP_TEMPLATE_NULL struct hash<short> {
- size_t operator()(short __x) const { return __x; }
-};
-_STLP_TEMPLATE_NULL struct hash<unsigned short> {
- size_t operator()(unsigned short __x) const { return __x; }
-};
-_STLP_TEMPLATE_NULL struct hash<int> {
- size_t operator()(int __x) const { return __x; }
-};
-
-#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300)
-_STLP_TEMPLATE_NULL struct hash<unsigned int> {
- size_t operator()(unsigned int __x) const { return __x; }
-};
-#else
-/* MSVC .Net since 2002 has a 64 bits portability warning feature. typedef
- * like size_t are tagged as potential 64 bits variables making them different from
- * unsigned int. To avoid the warning when a hash container is instanciated with
- * the size_t key we prefer to grant the size_t specialization rather than the
- * unsigned int one.
- */
-_STLP_TEMPLATE_NULL struct hash<size_t> {
- size_t operator()(size_t __x) const { return __x; }
-};
-#endif
-
-_STLP_TEMPLATE_NULL struct hash<long> {
- size_t operator()(long __x) const { return __x; }
-};
-_STLP_TEMPLATE_NULL struct hash<unsigned long> {
- size_t operator()(unsigned long __x) const { return __x; }
-};
-
-#if defined (_STLP_LONG_LONG)
-_STLP_TEMPLATE_NULL struct hash<_STLP_LONG_LONG> {
- size_t operator()(_STLP_LONG_LONG x) const { return (size_t)x; }
-};
-_STLP_TEMPLATE_NULL struct hash<unsigned _STLP_LONG_LONG> {
- size_t operator()(unsigned _STLP_LONG_LONG x) const { return (size_t)x; }
-};
-#endif
-
-_STLP_TEMPLATE_NULL
-struct hash<void *>
-{
- union __vp {
- size_t s;
- void *p;
- };
-
- size_t operator()(void *__x) const
- {
- __vp vp;
- vp.p = __x;
- return vp.s;
- }
-};
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_HASH_FUN_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_hash_map.h b/stl/_hash_map.h
deleted file mode 100644
index accf3e5..0000000
--- a/stl/_hash_map.h
+++ /dev/null
@@ -1,500 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_HASH_MAP_H
-#define _STLP_INTERNAL_HASH_MAP_H
-
-#ifndef _STLP_INTERNAL_HASHTABLE_H
-# include <stl/_hashtable.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//Specific iterator traits creation
-_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMapTraitsT, traits)
-
-template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
- _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
- _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) >
-class hash_map
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
-#endif
-{
-private:
- typedef hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
-public:
- typedef _Key key_type;
- typedef _Tp data_type;
- typedef _Tp mapped_type;
-#if !defined (__DMC__)
- typedef pair<const key_type, data_type> value_type;
-#else
- /* DMC goes too far in template instanciation and tries to fully instanciate
- * slist<pair<const int, string> > for instance. The generation of assignment
- * operator fails of course so we are force to use mutable key for this compiler.
- */
- typedef pair<key_type, data_type> value_type;
-#endif
-private:
- //Specific iterator traits creation
- typedef _STLP_PRIV _HashMapTraitsT<value_type> _HashMapTraits;
-
-public:
- typedef hashtable<value_type, key_type, _HashFcn, _HashMapTraits,
- _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
-
- typedef typename _Ht::hasher hasher;
- typedef typename _Ht::key_equal key_equal;
-
- typedef typename _Ht::size_type size_type;
- typedef typename _Ht::difference_type difference_type;
- typedef typename _Ht::pointer pointer;
- typedef typename _Ht::const_pointer const_pointer;
- typedef typename _Ht::reference reference;
- typedef typename _Ht::const_reference const_reference;
-
- typedef typename _Ht::iterator iterator;
- typedef typename _Ht::const_iterator const_iterator;
-
- typedef typename _Ht::allocator_type allocator_type;
-
- hasher hash_funct() const { return _M_ht.hash_funct(); }
- key_equal key_eq() const { return _M_ht.key_eq(); }
- allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-private:
- _Ht _M_ht;
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-public:
- hash_map() : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
- explicit hash_map(size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
- hash_map(size_type __n, const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
- hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a) {}
-
- hash_map(__move_source<_Self> src)
- : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {
- }
-
-#ifdef _STLP_MEMBER_TEMPLATES
- template <class _InputIterator>
- hash_map(_InputIterator __f, _InputIterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- template <class _InputIterator>
- hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- template <class _InputIterator>
- hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
-# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
- template <class _InputIterator>
- hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : _M_ht(__n, __hf, __eql, allocator_type())
- { _M_ht.insert_unique(__f, __l); }
-# endif
- template <class _InputIterator>
- hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-
-#else
- hash_map(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-
- hash_map(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#endif /*_STLP_MEMBER_TEMPLATES */
-
-public:
- size_type size() const { return _M_ht.size(); }
- size_type max_size() const { return _M_ht.max_size(); }
- bool empty() const { return _M_ht.empty(); }
- void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
- iterator begin() { return _M_ht.begin(); }
- iterator end() { return _M_ht.end(); }
- const_iterator begin() const { return _M_ht.begin(); }
- const_iterator end() const { return _M_ht.end(); }
-
-public:
- pair<iterator,bool> insert(const value_type& __obj)
- { return _M_ht.insert_unique(__obj); }
-#ifdef _STLP_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert(_InputIterator __f, _InputIterator __l)
- { _M_ht.insert_unique(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l)
- { _M_ht.insert_unique(__f,__l); }
- void insert(const_iterator __f, const_iterator __l)
- { _M_ht.insert_unique(__f, __l); }
-#endif /*_STLP_MEMBER_TEMPLATES */
- pair<iterator,bool> insert_noresize(const value_type& __obj)
- { return _M_ht.insert_unique_noresize(__obj); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __key) { return _M_ht.find(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- _Tp& operator[](const _KT& __key) {
- iterator __it = _M_ht.find(__key);
- return (__it == _M_ht.end() ?
- _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second :
- (*__it).second );
- }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __key) const { return _M_ht.count(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __key)
- { return _M_ht.equal_range(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
- { return _M_ht.equal_range(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
- void erase(iterator __it) { _M_ht.erase(__it); }
- void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
- void clear() { _M_ht.clear(); }
-
- void resize(size_type __hint) { _M_ht.resize(__hint); }
- size_type bucket_count() const { return _M_ht.bucket_count(); }
- size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
- size_type elems_in_bucket(size_type __n) const
- { return _M_ht.elems_in_bucket(__n); }
-};
-
-//Specific iterator traits creation
-_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultimapTraitsT, traits)
-
-template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
- _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
- _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) >
-class hash_multimap
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
-#endif
-{
-private:
- typedef hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
-public:
- typedef _Key key_type;
- typedef _Tp data_type;
- typedef _Tp mapped_type;
-#if !defined (__DMC__)
- typedef pair<const key_type, data_type> value_type;
-#else
- typedef pair<key_type, data_type> value_type;
-#endif
-private:
- //Specific iterator traits creation
- typedef _STLP_PRIV _HashMultimapTraitsT<value_type> _HashMultimapTraits;
-
-public:
- typedef hashtable<value_type, key_type, _HashFcn, _HashMultimapTraits,
- _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
-
- typedef typename _Ht::hasher hasher;
- typedef typename _Ht::key_equal key_equal;
-
- typedef typename _Ht::size_type size_type;
- typedef typename _Ht::difference_type difference_type;
- typedef typename _Ht::pointer pointer;
- typedef typename _Ht::const_pointer const_pointer;
- typedef typename _Ht::reference reference;
- typedef typename _Ht::const_reference const_reference;
-
- typedef typename _Ht::iterator iterator;
- typedef typename _Ht::const_iterator const_iterator;
-
- typedef typename _Ht::allocator_type allocator_type;
-
- hasher hash_funct() const { return _M_ht.hash_funct(); }
- key_equal key_eq() const { return _M_ht.key_eq(); }
- allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-private:
- _Ht _M_ht;
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-public:
- hash_multimap() : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
- explicit hash_multimap(size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
- hash_multimap(size_type __n, const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
- hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a) {}
-
- hash_multimap(__move_source<_Self> src)
- : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {
- }
-
-#ifdef _STLP_MEMBER_TEMPLATES
- template <class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- template <class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- template <class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
-# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
- template <class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : _M_ht(__n, __hf, __eql, allocator_type())
- { _M_ht.insert_equal(__f, __l); }
-# endif
- template <class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-
-#else
- hash_multimap(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-
- hash_multimap(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*_STLP_MEMBER_TEMPLATES */
-
-public:
- size_type size() const { return _M_ht.size(); }
- size_type max_size() const { return _M_ht.max_size(); }
- bool empty() const { return _M_ht.empty(); }
- void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
-
- iterator begin() { return _M_ht.begin(); }
- iterator end() { return _M_ht.end(); }
- const_iterator begin() const { return _M_ht.begin(); }
- const_iterator end() const { return _M_ht.end(); }
-
-public:
- iterator insert(const value_type& __obj)
- { return _M_ht.insert_equal(__obj); }
-#ifdef _STLP_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert(_InputIterator __f, _InputIterator __l)
- { _M_ht.insert_equal(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_equal(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*_STLP_MEMBER_TEMPLATES */
- iterator insert_noresize(const value_type& __obj)
- { return _M_ht.insert_equal_noresize(__obj); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __key) { return _M_ht.find(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __key) const { return _M_ht.count(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator>
- equal_range(const _KT& __key) { return _M_ht.equal_range(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator>
- equal_range(const _KT& __key) const { return _M_ht.equal_range(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
- void erase(iterator __it) { _M_ht.erase(__it); }
- void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
- void clear() { _M_ht.clear(); }
-
-public:
- void resize(size_type __hint) { _M_ht.resize(__hint); }
- size_type bucket_count() const { return _M_ht.bucket_count(); }
- size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
- size_type elems_in_bucket(size_type __n) const
- { return _M_ht.elems_in_bucket(__n); }
-};
-
-#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
-#define _STLP_TEMPLATE_CONTAINER hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
-#include <stl/_relops_hash_cont.h>
-#undef _STLP_TEMPLATE_CONTAINER
-#define _STLP_TEMPLATE_CONTAINER hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
-#include <stl/_relops_hash_cont.h>
-#undef _STLP_TEMPLATE_CONTAINER
-#undef _STLP_TEMPLATE_HEADER
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
-struct __move_traits<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
- _STLP_PRIV __move_traits_help<typename hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
-{};
-
-template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
-struct __move_traits<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
- _STLP_PRIV __move_traits_help<typename hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
-{};
-
-// Specialization of insert_iterator so that it will work for hash_map
-// and hash_multimap.
-template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
-class insert_iterator<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
-protected:
- typedef hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
- _Container* container;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- insert_iterator(_Container& __x) : container(&__x) {}
- insert_iterator(_Container& __x, typename _Container::iterator)
- : container(&__x) {}
- insert_iterator<_Container>&
- operator=(const typename _Container::value_type& __val) {
- container->insert(__val);
- return *this;
- }
- insert_iterator<_Container>& operator*() { return *this; }
- insert_iterator<_Container>& operator++() { return *this; }
- insert_iterator<_Container>& operator++(int) { return *this; }
-};
-
-template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
-class insert_iterator<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
-protected:
- typedef hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
- _Container* container;
- typename _Container::iterator iter;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- insert_iterator(_Container& __x) : container(&__x) {}
- insert_iterator(_Container& __x, typename _Container::iterator)
- : container(&__x) {}
- insert_iterator<_Container>&
- operator=(const typename _Container::value_type& __val) {
- container->insert(__val);
- return *this;
- }
- insert_iterator<_Container>& operator*() { return *this; }
- insert_iterator<_Container>& operator++() { return *this; }
- insert_iterator<_Container>& operator++(int) { return *this; }
-};
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_HASH_MAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_hash_set.h b/stl/_hash_set.h
deleted file mode 100644
index b800dc1..0000000
--- a/stl/_hash_set.h
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_HASH_SET_H
-#define _STLP_INTERNAL_HASH_SET_H
-
-#ifndef _STLP_INTERNAL_HASHTABLE_H
-# include <stl/_hashtable.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//Specific iterator traits creation
-_STLP_CREATE_HASH_ITERATOR_TRAITS(HashSetTraitsT, Const_traits)
-
-template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
- _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>),
- _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) >
-class hash_set
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> >
-#endif
-{
- typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
- //Specific iterator traits creation
- typedef _STLP_PRIV _HashSetTraitsT<_Value> _HashSetTraits;
-public:
- typedef hashtable<_Value, _Value, _HashFcn,
- _HashSetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
-public:
- typedef typename _Ht::key_type key_type;
- typedef typename _Ht::value_type value_type;
- typedef typename _Ht::hasher hasher;
- typedef typename _Ht::key_equal key_equal;
-
- typedef typename _Ht::size_type size_type;
- typedef typename _Ht::difference_type difference_type;
- typedef typename _Ht::pointer pointer;
- typedef typename _Ht::const_pointer const_pointer;
- typedef typename _Ht::reference reference;
- typedef typename _Ht::const_reference const_reference;
-
- typedef typename _Ht::iterator iterator;
- typedef typename _Ht::const_iterator const_iterator;
-
- typedef typename _Ht::allocator_type allocator_type;
-
- hasher hash_funct() const { return _M_ht.hash_funct(); }
- key_equal key_eq() const { return _M_ht.key_eq(); }
- allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-private:
- _Ht _M_ht;
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-public:
- hash_set()
- : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
- explicit hash_set(size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
- hash_set(size_type __n, const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
-#else
- hash_set(size_type __n, const hasher& __hf, const key_equal& __eql)
- : _M_ht(__n, __hf, __eql, allocator_type()) {}
- hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
-#endif
- : _M_ht(__n, __hf, __eql, __a) {}
-
- hash_set(__move_source<_Self> src)
- : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- hash_set(_InputIterator __f, _InputIterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- template <class _InputIterator>
- hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- template <class _InputIterator>
- hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- template <class _InputIterator>
- hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : _M_ht(__n, __hf, __eql, allocator_type())
- { _M_ht.insert_unique(__f, __l); }
-# endif
-#else
- hash_set(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-
- hash_set(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#endif /*_STLP_MEMBER_TEMPLATES */
-
-public:
- size_type size() const { return _M_ht.size(); }
- size_type max_size() const { return _M_ht.max_size(); }
- bool empty() const { return _M_ht.empty(); }
- void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
-
- iterator begin() { return _M_ht.begin(); }
- iterator end() { return _M_ht.end(); }
- const_iterator begin() const { return _M_ht.begin(); }
- const_iterator end() const { return _M_ht.end(); }
-
-public:
- pair<iterator, bool> insert(const value_type& __obj)
- { return _M_ht.insert_unique(__obj); }
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(_InputIterator __f, _InputIterator __l)
-#else
- void insert(const_iterator __f, const_iterator __l)
- {_M_ht.insert_unique(__f, __l); }
- void insert(const value_type* __f, const value_type* __l)
-#endif
- { _M_ht.insert_unique(__f,__l); }
-
- pair<iterator, bool> insert_noresize(const value_type& __obj)
- { return _M_ht.insert_unique_noresize(__obj); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __key) { return _M_ht.find(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __key) const { return _M_ht.count(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __key)
- { return _M_ht.equal_range(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
- { return _M_ht.equal_range(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
- void erase(iterator __it) { _M_ht.erase(__it); }
- void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
- void clear() { _M_ht.clear(); }
-
-public:
- void resize(size_type __hint) { _M_ht.resize(__hint); }
- size_type bucket_count() const { return _M_ht.bucket_count(); }
- size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
- size_type elems_in_bucket(size_type __n) const
- { return _M_ht.elems_in_bucket(__n); }
-};
-
-//Specific iterator traits creation
-_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultisetTraitsT, Const_traits)
-
-template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
- _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>),
- _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) >
-class hash_multiset
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> >
-#endif
-{
- typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
- //Specific iterator traits creation
- typedef _STLP_PRIV _HashMultisetTraitsT<_Value> _HashMultisetTraits;
-public:
- typedef hashtable<_Value, _Value, _HashFcn,
- _HashMultisetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
-
- typedef typename _Ht::key_type key_type;
- typedef typename _Ht::value_type value_type;
- typedef typename _Ht::hasher hasher;
- typedef typename _Ht::key_equal key_equal;
-
- typedef typename _Ht::size_type size_type;
- typedef typename _Ht::difference_type difference_type;
- typedef typename _Ht::pointer pointer;
- typedef typename _Ht::const_pointer const_pointer;
- typedef typename _Ht::reference reference;
- typedef typename _Ht::const_reference const_reference;
-
- typedef typename _Ht::iterator iterator;
- typedef typename _Ht::const_iterator const_iterator;
-
- typedef typename _Ht::allocator_type allocator_type;
-
- hasher hash_funct() const { return _M_ht.hash_funct(); }
- key_equal key_eq() const { return _M_ht.key_eq(); }
- allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-private:
- _Ht _M_ht;
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-public:
- hash_multiset()
- : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
- explicit hash_multiset(size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
- hash_multiset(size_type __n, const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
- hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql)
- : _M_ht(__n, __hf, __eql, allocator_type()) {}
- hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a)
- : _M_ht(__n, __hf, __eql, __a) {}
-
- hash_multiset(__move_source<_Self> src)
- : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- hash_multiset(_InputIterator __f, _InputIterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- template <class _InputIterator>
- hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- template <class _InputIterator>
- hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
-
- template <class _InputIterator>
- hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql)
- : _M_ht(__n, __hf, __eql, allocator_type())
- { _M_ht.insert_equal(__f, __l); }
-# endif
-#else
- hash_multiset(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-
- hash_multiset(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*_STLP_MEMBER_TEMPLATES */
-
-public:
- size_type size() const { return _M_ht.size(); }
- size_type max_size() const { return _M_ht.max_size(); }
- bool empty() const { return _M_ht.empty(); }
- void swap(_Self& hs) { _M_ht.swap(hs._M_ht); }
-
- iterator begin() { return _M_ht.begin(); }
- iterator end() { return _M_ht.end(); }
- const_iterator begin() const { return _M_ht.begin(); }
- const_iterator end() const { return _M_ht.end(); }
-
-public:
- iterator insert(const value_type& __obj) { return _M_ht.insert_equal(__obj); }
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(_InputIterator __f, _InputIterator __l)
- { _M_ht.insert_equal(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l)
- { _M_ht.insert_equal(__f,__l); }
- void insert(const_iterator __f, const_iterator __l)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*_STLP_MEMBER_TEMPLATES */
- iterator insert_noresize(const value_type& __obj)
- { return _M_ht.insert_equal_noresize(__obj); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __key) { return _M_ht.find(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __key) const { return _M_ht.count(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __key)
- { return _M_ht.equal_range(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
- { return _M_ht.equal_range(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
- void erase(iterator __it) { _M_ht.erase(__it); }
- void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
- void clear() { _M_ht.clear(); }
-
-public:
- void resize(size_type __hint) { _M_ht.resize(__hint); }
- size_type bucket_count() const { return _M_ht.bucket_count(); }
- size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
- size_type elems_in_bucket(size_type __n) const
- { return _M_ht.elems_in_bucket(__n); }
-};
-
-#define _STLP_TEMPLATE_HEADER template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-#define _STLP_TEMPLATE_CONTAINER hash_set<_Value,_HashFcn,_EqualKey,_Alloc>
-
-#include <stl/_relops_hash_cont.h>
-
-#undef _STLP_TEMPLATE_CONTAINER
-#define _STLP_TEMPLATE_CONTAINER hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc>
-#include <stl/_relops_hash_cont.h>
-
-#undef _STLP_TEMPLATE_CONTAINER
-#undef _STLP_TEMPLATE_HEADER
-
-// Specialization of insert_iterator so that it will work for hash_set
-// and hash_multiset.
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-struct __move_traits<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > :
- _STLP_PRIV __move_traits_aux<typename hash_set<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
-{};
-
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-struct __move_traits<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > :
- _STLP_PRIV __move_traits_aux<typename hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
-{};
-
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-class insert_iterator<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
-protected:
- typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
- _Container* container;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- insert_iterator(_Container& __x) : container(&__x) {}
- insert_iterator(_Container& __x, typename _Container::iterator)
- : container(&__x) {}
- insert_iterator<_Container>&
- operator=(const typename _Container::value_type& __val) {
- container->insert(__val);
- return *this;
- }
- insert_iterator<_Container>& operator*() { return *this; }
- insert_iterator<_Container>& operator++() { return *this; }
- insert_iterator<_Container>& operator++(int) { return *this; }
-};
-
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-class insert_iterator<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > {
-protected:
- typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
- _Container* container;
- typename _Container::iterator iter;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- insert_iterator(_Container& __x) : container(&__x) {}
- insert_iterator(_Container& __x, typename _Container::iterator)
- : container(&__x) {}
- insert_iterator<_Container>&
- operator=(const typename _Container::value_type& __val) {
- container->insert(__val);
- return *this;
- }
- insert_iterator<_Container>& operator*() { return *this; }
- insert_iterator<_Container>& operator++() { return *this; }
- insert_iterator<_Container>& operator++(int) { return *this; }
-};
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_HASH_SET_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_hashtable.c b/stl/_hashtable.c
deleted file mode 100644
index c9dafa2..0000000
--- a/stl/_hashtable.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_HASHTABLE_C
-#define _STLP_HASHTABLE_C
-
-#ifndef _STLP_INTERNAL_HASHTABLE_H
-# include <stl/_hashtable.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-# define __PRIME_LIST_BODY { \
- 7ul, 23ul, \
- 53ul, 97ul, 193ul, 389ul, 769ul, \
- 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, \
- 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, \
- 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, \
- 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,\
- 1610612741ul, 3221225473ul, 4294967291ul \
-}
-
-template <class _Dummy>
-size_t _STLP_CALL
-_Stl_prime<_Dummy>::_S_max_nb_buckets() {
- const size_t _list[] = __PRIME_LIST_BODY;
-# ifndef __MWERKS__
- return _list[(sizeof(_list)/sizeof(_list[0])) - 1];
-# else
- return _list[30/sizeof(size_t) - 1]; // stupid MWERKS!
-# endif
-}
-
-template <class _Dummy>
-size_t _STLP_CALL
-_Stl_prime<_Dummy>::_S_next_size(size_t __n) {
- static const size_t _list[] = __PRIME_LIST_BODY;
- const size_t* __first = _list;
-# ifndef __MWERKS__
- const size_t* __last = _list + (sizeof(_list)/sizeof(_list[0]));
-# else
- const size_t* __last = _list + (30/sizeof(size_t)); // stupid MWERKS
-# endif
- const size_t* pos = __lower_bound(__first, __last, __n,
- __less((size_t*)0), __less((size_t*)0), (ptrdiff_t*)0);
- return (pos == __last ? *(__last - 1) : *pos);
-}
-
-# undef __PRIME_LIST_BODY
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-#endif
-
-#if defined (_STLP_DEBUG)
-# define hashtable _STLP_NON_DBG_NAME(hashtable)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-// fbp: these defines are for outline methods definitions.
-// needed to definitions to be portable. Should not be used in method bodies.
-
-#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
-# define __size_type__ size_t
-# define size_type size_t
-# define value_type _Val
-# define key_type _Key
-# define __reference__ _Val&
-
-# define __iterator__ _Ht_iterator<_Val, _STLP_HEADER_TYPENAME _Traits::_NonConstTraits, \
- _Key, _HF, _ExK, _EqK, _All>
-# define __const_iterator__ _Ht_iterator<_Val, _STLP_HEADER_TYPENAME _Traits::_ConstTraits, \
- _Key, _HF, _ExK, _EqK, _All>
-#else
-# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::size_type
-# define __reference__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::reference
-# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::iterator
-# define __const_iterator__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::const_iterator
-#endif
-
-/*
- * This method is too difficult to implement for hashtable that do not
- * require a sorted operation on the stored type.
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-bool hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::_M_equal(
- const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht1,
- const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht2) {
- return __ht1._M_buckets == __ht2._M_buckets &&
- __ht1._M_elems == __ht2._M_elems;
-}
-*/
-
-/* Returns the iterator before the first iterator of the bucket __n and set
- * __n to the first previous bucket having the same first iterator as bucket
- * __n.
- */
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-__iterator__
-hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::_M_before_begin(size_type &__n) const {
- return _S_before_begin(_M_elems, _M_buckets, __n);
-}
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-__iterator__
-hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::_S_before_begin(const _ElemsCont& __elems, const _BucketVector& __buckets,
- size_type &__n) {
- _ElemsCont &__mutable_elems = __CONST_CAST(_ElemsCont&, __elems);
- typename _BucketVector::const_iterator __bpos(__buckets.begin() + __n);
-
- _ElemsIte __pos(*__bpos);
- if (__pos == __mutable_elems.begin()) {
- __n = 0;
- return __mutable_elems.before_begin();
- }
-
- typename _BucketVector::const_iterator __bcur(__bpos);
- _BucketType *__pos_node = __pos._M_node;
- for (--__bcur; __pos_node == *__bcur; --__bcur);
-
- __n = __bcur - __buckets.begin() + 1;
- _ElemsIte __cur(*__bcur);
- _ElemsIte __prev = __cur++;
- for (; __cur != __pos; ++__prev, ++__cur);
- return __prev;
-}
-
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-__iterator__
-hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::_M_insert_noresize(size_type __n, const value_type& __obj) {
- //We always insert this element as 1st in the bucket to not break
- //the elements order as equal elements must be kept next to each other.
- size_type __prev = __n;
- _ElemsIte __pos = _M_before_begin(__prev)._M_ite;
-
- fill(_M_buckets.begin() + __prev, _M_buckets.begin() + __n + 1,
- _M_elems.insert_after(__pos, __obj)._M_node);
- ++_M_num_elements;
- return iterator(_ElemsIte(_M_buckets[__n]));
-}
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-pair<__iterator__, bool>
-hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::insert_unique_noresize(const value_type& __obj) {
- const size_type __n = _M_bkt_num(__obj);
- _ElemsIte __cur(_M_buckets[__n]);
- _ElemsIte __last(_M_buckets[__n + 1]);
-
- if (__cur != __last) {
- for (; __cur != __last; ++__cur) {
- if (_M_equals(_M_get_key(*__cur), _M_get_key(__obj))) {
- //We check that equivalent keys have equals hash code as otherwise, on resize,
- //equivalent value might not be in the same bucket
- _STLP_ASSERT(_M_hash(_M_get_key(*__cur)) == _M_hash(_M_get_key(__obj)))
- return pair<iterator, bool>(iterator(__cur), false);
- }
- }
- /* Here we do not rely on the _M_insert_noresize method as we know
- * that we cannot break element orders, elements are unique, and
- * insertion after the first bucket element is faster than what is
- * done in _M_insert_noresize.
- */
- __cur = _M_elems.insert_after(_ElemsIte(_M_buckets[__n]), __obj);
- ++_M_num_elements;
- return pair<iterator, bool>(iterator(__cur), true);
- }
-
- return pair<iterator, bool>(_M_insert_noresize(__n, __obj), true);
-}
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-__iterator__
-hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::insert_equal_noresize(const value_type& __obj) {
- const size_type __n = _M_bkt_num(__obj);
- {
- _ElemsIte __cur(_M_buckets[__n]);
- _ElemsIte __last(_M_buckets[__n + 1]);
-
- for (; __cur != __last; ++__cur) {
- if (_M_equals(_M_get_key(*__cur), _M_get_key(__obj))) {
- //We check that equivalent keys have equals hash code as otherwise, on resize,
- //equivalent value might not be in the same bucket
- _STLP_ASSERT(_M_hash(_M_get_key(*__cur)) == _M_hash(_M_get_key(__obj)))
- ++_M_num_elements;
- return _M_elems.insert_after(__cur, __obj);
- }
- }
- }
-
- return _M_insert_noresize(__n, __obj);
-}
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-__reference__
-hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::_M_insert(const value_type& __obj) {
- resize(_M_num_elements + 1);
- return *insert_unique_noresize(__obj).first;
-}
-
-/*
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-__reference__
-hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::find_or_insert(const value_type& __obj) {
- _Node* __first = _M_find(_M_get_key(__obj));
- if (__first)
- return __first->_M_val;
- else
- return _M_insert(__obj);
-}
-*/
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-__size_type__
-hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::erase(const key_type& __key) {
- const size_type __n = _M_bkt_num_key(__key);
-
- _ElemsIte __cur(_M_buckets[__n]);
- _ElemsIte __last(_M_buckets[__n + 1]);
- if (__cur == __last)
- return 0;
-
- size_type __erased = 0;
- if (_M_equals(_M_get_key(*__cur), __key)) {
- //We look for the pos before __cur:
- size_type __prev_b = __n;
- _ElemsIte __prev = _M_before_begin(__prev_b)._M_ite;
- do {
- __cur = _M_elems.erase_after(__prev);
- ++__erased;
- } while ((__cur != __last) && _M_equals(_M_get_key(*__cur), __key));
- fill(_M_buckets.begin() + __prev_b, _M_buckets.begin() + __n + 1, __cur._M_node);
- }
- else {
- _ElemsIte __prev = __cur++;
- for (; __cur != __last; ++__prev, ++__cur) {
- if (_M_equals(_M_get_key(*__cur), __key)) {
- do {
- __cur = _M_elems.erase_after(__prev);
- ++__erased;
- } while ((__cur != __last) && _M_equals(_M_get_key(*__cur), __key));
- break;
- }
- }
- }
-
- _M_num_elements -= __erased;
- return __erased;
-}
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::erase(const_iterator __it) {
- const size_type __n = _M_bkt_num(*__it);
- _ElemsIte __cur(_M_buckets[__n]);
-
- if (__cur == __it._M_ite) {
- size_type __prev_b = __n;
- _ElemsIte __prev = _M_before_begin(__prev_b)._M_ite;
- fill(_M_buckets.begin() + __prev_b, _M_buckets.begin() + __n + 1,
- _M_elems.erase_after(__prev)._M_node);
- --_M_num_elements;
- }
- else {
- _ElemsIte __prev = __cur++;
- _ElemsIte __last(_M_buckets[__n + 1]);
- for (; __cur != __last; ++__prev, ++__cur) {
- if (__cur == __it._M_ite) {
- _M_elems.erase_after(__prev);
- --_M_num_elements;
- break;
- }
- }
- }
-}
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::erase(const_iterator __first, const_iterator __last) {
- if (__first == __last)
- return;
- size_type __f_bucket = _M_bkt_num(*__first);
- size_type __l_bucket = __last != end() ? _M_bkt_num(*__last) : (_M_buckets.size() - 1);
-
- _ElemsIte __cur(_M_buckets[__f_bucket]);
- _ElemsIte __prev;
- if (__cur == __first._M_ite) {
- __prev = _M_before_begin(__f_bucket)._M_ite;
- }
- else {
- _ElemsIte __last(_M_buckets[++__f_bucket]);
- __prev = __cur++;
- for (; (__cur != __last) && (__cur != __first._M_ite); ++__prev, ++__cur);
- }
- //We do not use the slist::erase_after method taking a range to count the
- //number of erased elements:
- while (__cur != __last._M_ite) {
- __cur = _M_elems.erase_after(__prev);
- --_M_num_elements;
- }
- fill(_M_buckets.begin() + __f_bucket, _M_buckets.begin() + __l_bucket + 1, __cur._M_node);
-}
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::rehash(size_type __num_buckets_hint) {
- if ((bucket_count() >= __num_buckets_hint) &&
- (max_load_factor() > load_factor()))
- return;
-
- //Here if max_load_factor is lower than 1.0 the resulting value might not be representable
- //as a size_type. The result concerning the respect of the max_load_factor will then be
- //undefined.
- __num_buckets_hint = (max) (__num_buckets_hint, (size_type)((float)size() / max_load_factor()));
- size_type __num_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__num_buckets_hint);
- _M_rehash(__num_buckets);
-}
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::resize(size_type __num_elements_hint) {
- if (((float)__num_elements_hint / (float)bucket_count() <= max_load_factor()) &&
- (max_load_factor() >= load_factor())) {
- return;
- }
-
- size_type __num_buckets_hint = (size_type)((float)(max) (__num_elements_hint, size()) / max_load_factor());
- size_type __num_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__num_buckets_hint);
-#if defined (_STLP_DEBUG)
- _M_check();
-#endif
- _M_rehash(__num_buckets);
-}
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::_M_rehash(size_type __num_buckets) {
- _ElemsCont __tmp_elems(_M_elems.get_allocator());
- _BucketVector __tmp(__num_buckets + 1, __STATIC_CAST(_BucketType*, 0), _M_buckets.get_allocator());
- _ElemsIte __cur, __last(_M_elems.end());
- while (!_M_elems.empty()) {
- __cur = _M_elems.begin();
- size_type __new_bucket = _M_bkt_num(*__cur, __num_buckets);
- _ElemsIte __ite(__cur), __before_ite(__cur);
- for (++__ite;
- __ite != __last && _M_equals(_M_get_key(*__cur), _M_get_key(*__ite));
- ++__ite, ++__before_ite);
- size_type __prev_bucket = __new_bucket;
- _ElemsIte __prev = _S_before_begin(__tmp_elems, __tmp, __prev_bucket)._M_ite;
- __tmp_elems.splice_after(__prev, _M_elems, _M_elems.before_begin(), __before_ite);
- fill(__tmp.begin() + __prev_bucket, __tmp.begin() + __new_bucket + 1, __cur._M_node);
- }
- _M_elems.swap(__tmp_elems);
- _M_buckets.swap(__tmp);
-}
-
-#if defined (_STLP_DEBUG)
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::_M_check() const {
- //We check that hash code of stored keys haven't change and also that equivalent
- //relation hasn't been modified
- size_t __num_buckets = bucket_count();
- for (size_t __b = 0; __b < __num_buckets; ++__b) {
- _ElemsIte __cur(_M_buckets[__b]), __last(_M_buckets[__b + 1]);
- _ElemsIte __fst(__cur), __snd(__cur);
- for (; __cur != __last; ++__cur) {
- _STLP_ASSERT( _M_bkt_num(*__cur, __num_buckets) == __b )
- _STLP_ASSERT( !_M_equals(_M_get_key(*__fst), _M_get_key(*__cur)) || _M_equals(_M_get_key(*__snd), _M_get_key(*__cur)) )
- if (__fst != __snd)
- ++__fst;
- if (__snd != __cur)
- ++__snd;
- }
- }
-}
-#endif
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::clear() {
- _M_elems.clear();
- _M_buckets.assign(_M_buckets.size(), __STATIC_CAST(_BucketType*, 0));
- _M_num_elements = 0;
-}
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
- ::_M_copy_from(const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht) {
- _M_elems.clear();
- _M_elems.insert(_M_elems.end(), __ht._M_elems.begin(), __ht._M_elems.end());
- _M_buckets.resize(__ht._M_buckets.size());
- _ElemsConstIte __src(__ht._M_elems.begin()), __src_end(__ht._M_elems.end());
- _ElemsIte __dst(_M_elems.begin());
- typename _BucketVector::const_iterator __src_b(__ht._M_buckets.begin()),
- __src_end_b(__ht._M_buckets.end());
- typename _BucketVector::iterator __dst_b(_M_buckets.begin()), __dst_end_b(_M_buckets.end());
- for (; __src != __src_end; ++__src, ++__dst) {
- for (; __src_b != __src_end_b; ++__src_b, ++__dst_b) {
- if (*__src_b == __src._M_node) {
- *__dst_b = __dst._M_node;
- }
- else
- break;
- }
- }
- fill(__dst_b, __dst_end_b, __STATIC_CAST(_BucketType*, 0));
- _M_num_elements = __ht._M_num_elements;
- _M_max_load_factor = __ht._M_max_load_factor;
-}
-
-#undef __iterator__
-#undef const_iterator
-#undef __size_type__
-#undef __reference__
-#undef size_type
-#undef value_type
-#undef key_type
-#undef __stl_num_primes
-
-#if defined (_STLP_DEBUG)
-# undef hashtable
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_HASHTABLE_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_hashtable.h b/stl/_hashtable.h
deleted file mode 100644
index 6653931..0000000
--- a/stl/_hashtable.h
+++ /dev/null
@@ -1,682 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_HASHTABLE_H
-#define _STLP_INTERNAL_HASHTABLE_H
-
-#ifndef _STLP_INTERNAL_VECTOR_H
-# include <stl/_vector.h>
-#endif
-
-#ifndef _STLP_INTERNAL_SLIST_H
-# include <stl/_slist.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ITERATOR_H
-# include <stl/_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
-# include <stl/_function_base.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-#ifndef _STLP_HASH_FUN_H
-# include <stl/_hash_fun.h>
-#endif
-
-/*
- * Hashtable class, used to implement the hashed associative containers
- * hash_set, hash_map, hash_multiset, hash_multimap,
- * unordered_set, unordered_map, unordered_multiset, unordered_multimap.
- */
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-//Export of the classes used to represent buckets in the hashtable implementation.
-# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
-//If pointer specialization is enabled vector<_Slist_node_base*> will use the void*
-//storage type for which internal classes have already been exported.
-_STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _Slist_node_base*>;
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
- allocator<_Slist_node_base*> >;
-_STLP_EXPORT_TEMPLATE_CLASS _Vector_base<_Slist_node_base*,
- allocator<_Slist_node_base*> >;
-_STLP_MOVE_TO_STD_NAMESPACE
-# endif
-
-# if defined (_STLP_DEBUG)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
-_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_VECTOR<_Slist_node_base*, allocator<_Slist_node_base*> > >;
-_STLP_EXPORT_TEMPLATE_CLASS _STLP_NON_DBG_VECTOR<_Slist_node_base*, allocator<_Slist_node_base*> >;
-# undef _STLP_NON_DBG_VECTOR
-_STLP_MOVE_TO_STD_NAMESPACE
-# endif
-
-_STLP_EXPORT_TEMPLATE_CLASS vector<_STLP_PRIV _Slist_node_base*,
- allocator<_STLP_PRIV _Slist_node_base*> >;
-#endif
-
-#if defined (_STLP_DEBUG)
-# define hashtable _STLP_NON_DBG_NAME(hashtable)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-// some compilers require the names of template parameters to be the same
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-class hashtable;
-
-#if !defined (_STLP_DEBUG)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-template <class _BaseIte, class _Traits>
-struct _Ht_iterator {
- typedef typename _Traits::_ConstTraits _ConstTraits;
- typedef typename _Traits::_NonConstTraits _NonConstTraits;
-
- typedef _Ht_iterator<_BaseIte,_Traits> _Self;
-
- typedef typename _Traits::value_type value_type;
- typedef typename _Traits::pointer pointer;
- typedef typename _Traits::reference reference;
- typedef forward_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
-
- typedef _Ht_iterator<_BaseIte, _NonConstTraits> iterator;
- typedef _Ht_iterator<_BaseIte, _ConstTraits> const_iterator;
-
- _Ht_iterator() {}
- //copy constructor for iterator and constructor from iterator for const_iterator
- _Ht_iterator(const iterator& __it) : _M_ite(__it._M_ite) {}
- _Ht_iterator(_BaseIte __it) : _M_ite(__it) {}
-
- reference operator*() const {
- return *_M_ite;
- }
- _STLP_DEFINE_ARROW_OPERATOR
-
- _Self& operator++() {
- ++_M_ite;
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- bool operator == (const_iterator __rhs) const {
- return _M_ite == __rhs._M_ite;
- }
- bool operator != (const_iterator __rhs) const {
- return _M_ite != __rhs._M_ite;
- }
-
- _BaseIte _M_ite;
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _BaseIte, class _Traits>
-struct __type_traits<_STLP_PRIV _Ht_iterator<_BaseIte, _Traits> > {
- typedef __false_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __false_type is_POD_type;
-};
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
-template <class _BaseIte, class _Traits>
-inline
-# if defined (_STLP_NESTED_TYPE_PARAM_BUG)
-_STLP_TYPENAME_ON_RETURN_TYPE _Traits::value_type *
-# else
-_STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>::value_type *
-# endif
-value_type(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&) {
- typedef typename _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>::value_type _Val;
- return (_Val*) 0;
-}
-template <class _BaseIte, class _Traits>
-inline forward_iterator_tag iterator_category(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&)
-{ return forward_iterator_tag(); }
-template <class _BaseIte, class _Traits>
-inline ptrdiff_t* distance_type(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&)
-{ return (ptrdiff_t*) 0; }
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Dummy>
-class _Stl_prime {
-public:
- //Returns the maximum number of buckets handled by the hashtable implementation
- static size_t _STLP_CALL _S_max_nb_buckets();
-
- //Returns the bucket size next to a required size
- static size_t _STLP_CALL _S_next_size(size_t);
-};
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS _Stl_prime<bool>;
-#endif
-
-typedef _Stl_prime<bool> _Stl_prime_type;
-
-#if !defined (_STLP_DEBUG)
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-/*
- * Hashtables handle allocators a bit differently than other containers
- * do. If we're using standard-conforming allocators, then a hashtable
- * unconditionally has a member variable to hold its allocator, even if
- * it so happens that all instances of the allocator type are identical.
- * This is because, for hashtables, this extra storage is negligible.
- * Additionally, a base class wouldn't serve any other purposes; it
- * wouldn't, for example, simplify the exception-handling code.
- */
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-class hashtable {
- typedef hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> _Self;
- typedef typename _Traits::_NonConstTraits _NonConstTraits;
- typedef typename _Traits::_ConstTraits _ConstTraits;
- typedef typename _Traits::_NonConstLocalTraits _NonConstLocalTraits;
- typedef typename _Traits::_ConstLocalTraits _ConstLocalTraits;
-
-public:
- typedef _Key key_type;
- typedef _Val value_type;
- typedef _HF hasher;
- typedef _EqK key_equal;
-
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef typename _NonConstTraits::pointer pointer;
- typedef const value_type* const_pointer;
- typedef typename _NonConstTraits::reference reference;
- typedef const value_type& const_reference;
- typedef forward_iterator_tag _Iterator_category;
-
- hasher hash_funct() const { return _M_hash; }
- key_equal key_eq() const { return _M_equals; }
-
-private:
- _STLP_FORCE_ALLOCATORS(_Val, _All)
-#if defined (_STLP_DEBUG)
- typedef _STLP_PRIV _STLP_NON_DBG_NAME(slist)<value_type, _All> _ElemsCont;
-#else
- typedef slist<value_type, _All> _ElemsCont;
-#endif
- typedef typename _ElemsCont::iterator _ElemsIte;
- typedef typename _ElemsCont::const_iterator _ElemsConstIte;
- typedef _STLP_PRIV _Slist_node_base _BucketType;
- typedef typename _Alloc_traits<_BucketType*, _All>::allocator_type _M_bucket_allocator_type;
- /*
- * We are going to use vector of _Slist_node_base pointers for 2 reasons:
- * - limit code bloat, all hashtable instanciation use the same buckets representation.
- * - avoid _STLP_DEBUG performance trouble: with a vector of iterator on slist the resize
- * method would be too slow because the slist::splice_after method become linear on
- * the number of iterators in the buckets rather than constant in time as the iterator
- * has to be move from a slist to the other.
- */
-#if defined (_STLP_DEBUG)
- typedef _STLP_PRIV _STLP_NON_DBG_NAME(vector)<_BucketType*, _M_bucket_allocator_type> _BucketVector;
-#else
- typedef vector<_BucketType*, _M_bucket_allocator_type> _BucketVector;
-#endif
-
- hasher _M_hash;
- key_equal _M_equals;
- _ExK _M_get_key;
- _ElemsCont _M_elems;
- _BucketVector _M_buckets;
- size_type _M_num_elements;
- float _M_max_load_factor;
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-public:
- typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _NonConstTraits> iterator;
- typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _ConstTraits> const_iterator;
- //TODO: Avoids this debug check and make the local_iterator different from
- //iterator in debug mode too.
-#if !defined (_STLP_DEBUG)
- typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _NonConstLocalTraits> local_iterator;
- typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _ConstLocalTraits> const_local_iterator;
-#else
- typedef iterator local_iterator;
- typedef const_iterator const_local_iterator;
-#endif
-
- typedef typename _Alloc_traits<_Val, _All>::allocator_type allocator_type;
- allocator_type get_allocator() const { return _M_elems.get_allocator(); }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- hashtable(size_type __n,
- const _HF& __hf,
- const _EqK& __eql,
- const _ExK& __ext,
- const allocator_type& __a = allocator_type())
-#else
- hashtable(size_type __n,
- const _HF& __hf,
- const _EqK& __eql,
- const _ExK& __ext)
- : _M_hash(__hf),
- _M_equals(__eql),
- _M_get_key(__ext),
- _M_elems(allocator_type()),
- _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)),
- _M_num_elements(0),
- _M_max_load_factor(1.0f)
- { _M_initialize_buckets(__n); }
-
- hashtable(size_type __n,
- const _HF& __hf,
- const _EqK& __eql,
- const _ExK& __ext,
- const allocator_type& __a)
-#endif
- : _M_hash(__hf),
- _M_equals(__eql),
- _M_get_key(__ext),
- _M_elems(__a),
- _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)),
- _M_num_elements(0),
- _M_max_load_factor(1.0f)
- { _M_initialize_buckets(__n); }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- hashtable(size_type __n,
- const _HF& __hf,
- const _EqK& __eql,
- const allocator_type& __a = allocator_type())
-#else
- hashtable(size_type __n,
- const _HF& __hf,
- const _EqK& __eql)
- : _M_hash(__hf),
- _M_equals(__eql),
- _M_get_key(_ExK()),
- _M_elems(allocator_type()),
- _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)),
- _M_num_elements(0),
- _M_max_load_factor(1.0f)
- { _M_initialize_buckets(__n); }
-
- hashtable(size_type __n,
- const _HF& __hf,
- const _EqK& __eql,
- const allocator_type& __a)
-#endif
- : _M_hash(__hf),
- _M_equals(__eql),
- _M_get_key(_ExK()),
- _M_elems(__a),
- _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)),
- _M_num_elements(0),
- _M_max_load_factor(1.0f)
- { _M_initialize_buckets(__n); }
-
- hashtable(const _Self& __ht)
- : _M_hash(__ht._M_hash),
- _M_equals(__ht._M_equals),
- _M_get_key(__ht._M_get_key),
- _M_elems(__ht.get_allocator()),
- _M_buckets(_STLP_CONVERT_ALLOCATOR(__ht.get_allocator(), _BucketType*)),
- _M_num_elements(0),
- _M_max_load_factor(1.0f)
- { _M_copy_from(__ht); }
-
- hashtable(__move_source<_Self> src)
- : _M_hash(_STLP_PRIV _AsMoveSource(src.get()._M_hash)),
- _M_equals(_STLP_PRIV _AsMoveSource(src.get()._M_equals)),
- _M_get_key(_STLP_PRIV _AsMoveSource(src.get()._M_get_key)),
- _M_elems(__move_source<_ElemsCont>(src.get()._M_elems)),
- _M_buckets(__move_source<_BucketVector>(src.get()._M_buckets)),
- _M_num_elements(src.get()._M_num_elements),
- _M_max_load_factor(src.get()._M_max_load_factor) {}
-
- _Self& operator= (const _Self& __ht) {
- if (&__ht != this) {
- clear();
- _M_hash = __ht._M_hash;
- _M_equals = __ht._M_equals;
- _M_get_key = __ht._M_get_key;
- _M_copy_from(__ht);
- }
- return *this;
- }
-
- ~hashtable() { clear(); }
-
- size_type size() const { return _M_num_elements; }
- size_type max_size() const { return size_type(-1); }
- bool empty() const { return size() == 0; }
-
- void swap(_Self& __ht) {
- _STLP_STD::swap(_M_hash, __ht._M_hash);
- _STLP_STD::swap(_M_equals, __ht._M_equals);
- _STLP_STD::swap(_M_get_key, __ht._M_get_key);
- _M_elems.swap(__ht._M_elems);
- _M_buckets.swap(__ht._M_buckets);
- _STLP_STD::swap(_M_num_elements, __ht._M_num_elements);
- _STLP_STD::swap(_M_max_load_factor, __ht._M_max_load_factor);
- }
-
- iterator begin() { return _M_elems.begin(); }
- iterator end() { return _M_elems.end(); }
- local_iterator begin(size_type __n) { return _ElemsIte(_M_buckets[__n]); }
- local_iterator end(size_type __n) { return _ElemsIte(_M_buckets[__n + 1]); }
-
- const_iterator begin() const { return __CONST_CAST(_ElemsCont&, _M_elems).begin(); }
- const_iterator end() const { return __CONST_CAST(_ElemsCont&, _M_elems).end(); }
- const_local_iterator begin(size_type __n) const { return _ElemsIte(_M_buckets[__n]); }
- const_local_iterator end(size_type __n) const { return _ElemsIte(_M_buckets[__n + 1]); }
-
- //static bool _STLP_CALL _M_equal (const _Self&, const _Self&);
-
-public:
- //The number of buckets is size() - 1 because the last bucket always contains
- //_M_elems.end() to make algo easier to implement.
- size_type bucket_count() const { return _M_buckets.size() - 1; }
- size_type max_bucket_count() const { return _STLP_PRIV _Stl_prime_type::_S_max_nb_buckets(); }
- size_type elems_in_bucket(size_type __bucket) const
- { return distance(_ElemsIte(_M_buckets[__bucket]), _ElemsIte(_M_buckets[__bucket + 1])); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type bucket(const _KT& __k) const { return _M_bkt_num_key(__k); }
-
- // hash policy
- float load_factor() const { return (float)size() / (float)bucket_count(); }
- float max_load_factor() const { return _M_max_load_factor; }
- void max_load_factor(float __z) { _M_max_load_factor = __z;}
-
- pair<iterator, bool> insert_unique(const value_type& __obj) {
- resize(_M_num_elements + 1);
- return insert_unique_noresize(__obj);
- }
-
- iterator insert_equal(const value_type& __obj) {
- resize(_M_num_elements + 1);
- return insert_equal_noresize(__obj);
- }
-
-protected:
- iterator _M_insert_noresize(size_type __n, const value_type& __obj);
-public:
- pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
- iterator insert_equal_noresize(const value_type& __obj);
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert_unique(_InputIterator __f, _InputIterator __l)
- { insert_unique(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator)); }
-
- template <class _InputIterator>
- void insert_equal(_InputIterator __f, _InputIterator __l)
- { insert_equal(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator)); }
-
- template <class _InputIterator>
- void insert_unique(_InputIterator __f, _InputIterator __l,
- const input_iterator_tag &) {
- for ( ; __f != __l; ++__f)
- insert_unique(*__f);
- }
-
- template <class _InputIterator>
- void insert_equal(_InputIterator __f, _InputIterator __l,
- const input_iterator_tag &) {
- for ( ; __f != __l; ++__f)
- insert_equal(*__f);
- }
-
- template <class _ForwardIterator>
- void insert_unique(_ForwardIterator __f, _ForwardIterator __l,
- const forward_iterator_tag &) {
- size_type __n = distance(__f, __l);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_unique_noresize(*__f);
- }
-
- template <class _ForwardIterator>
- void insert_equal(_ForwardIterator __f, _ForwardIterator __l,
- const forward_iterator_tag &) {
- size_type __n = distance(__f, __l);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_equal_noresize(*__f);
- }
-
-#else /* _STLP_MEMBER_TEMPLATES */
- void insert_unique(const value_type* __f, const value_type* __l) {
- size_type __n = __l - __f;
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_unique_noresize(*__f);
- }
-
- void insert_equal(const value_type* __f, const value_type* __l) {
- size_type __n = __l - __f;
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_equal_noresize(*__f);
- }
-
- void insert_unique(const_iterator __f, const_iterator __l) {
- size_type __n = distance(__f, __l);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_unique_noresize(*__f);
- }
-
- void insert_equal(const_iterator __f, const_iterator __l) {
- size_type __n = distance(__f, __l);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_equal_noresize(*__f);
- }
-#endif /*_STLP_MEMBER_TEMPLATES */
-
- //reference find_or_insert(const value_type& __obj);
-
-private:
- _STLP_TEMPLATE_FOR_CONT_EXT
- _ElemsIte _M_find(const _KT& __key) const {
- size_type __n = _M_bkt_num_key(__key);
- _ElemsIte __first(_M_buckets[__n]);
- _ElemsIte __last(_M_buckets[__n + 1]);
- for ( ; (__first != __last) && !_M_equals(_M_get_key(*__first), __key); ++__first);
- if (__first != __last)
- return __first;
- else
- return __CONST_CAST(_ElemsCont&, _M_elems).end();
- }
-
-public:
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __key) { return _M_find(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __key) const { return _M_find(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __key) const {
- const size_type __n = _M_bkt_num_key(__key);
-
- _ElemsIte __cur(_M_buckets[__n]);
- _ElemsIte __last(_M_buckets[__n + 1]);
- for (; __cur != __last; ++__cur) {
- if (_M_equals(_M_get_key(*__cur), __key)) {
- size_type __result = 1;
- for (++__cur;
- __cur != __last && _M_equals(_M_get_key(*__cur), __key);
- ++__result, ++__cur);
- return __result;
- }
- }
- return 0;
- }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __key) {
- typedef pair<iterator, iterator> _Pii;
- const size_type __n = _M_bkt_num_key(__key);
-
- for (_ElemsIte __first(_M_buckets[__n]), __last(_M_buckets[__n + 1]);
- __first != __last; ++__first) {
- if (_M_equals(_M_get_key(*__first), __key)) {
- _ElemsIte __cur(__first);
- for (++__cur; (__cur != __last) && _M_equals(_M_get_key(*__cur), __key); ++__cur);
- return _Pii(__first, __cur);
- }
- }
- return _Pii(end(), end());
- }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __key) const {
- typedef pair<const_iterator, const_iterator> _Pii;
- const size_type __n = _M_bkt_num_key(__key);
-
- for (_ElemsIte __first(_M_buckets[__n]), __last(_M_buckets[__n + 1]);
- __first != __last; ++__first) {
- if (_M_equals(_M_get_key(*__first), __key)) {
- _ElemsIte __cur(__first);
- for (++__cur; (__cur != __last) && _M_equals(_M_get_key(*__cur), __key); ++__cur);
- return _Pii(__first, __cur);
- }
- }
- return _Pii(end(), end());
- }
-
- size_type erase(const key_type& __key);
- void erase(const_iterator __it);
- void erase(const_iterator __first, const_iterator __last);
-
-private:
- void _M_rehash(size_type __num_buckets);
-#if defined (_STLP_DEBUG)
- void _M_check() const;
-#endif
-
-public:
- void rehash(size_type __num_buckets_hint);
- void resize(size_type __num_elements_hint);
- void clear();
-
- // this is for hash_map::operator[]
- reference _M_insert(const value_type& __obj);
-
-private:
- //__n is set to the first bucket that has to be modified if any
- //erase/insert operation is done after the returned iterator.
- iterator _M_before_begin(size_type &__n) const;
-
- static iterator _S_before_begin(const _ElemsCont& __elems, const _BucketVector& __buckets,
- size_type &__n);
-
- void _M_initialize_buckets(size_type __n) {
- const size_type __n_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__n) + 1;
- _M_buckets.reserve(__n_buckets);
- _M_buckets.assign(__n_buckets, __STATIC_CAST(_BucketType*, 0));
- }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type _M_bkt_num_key(const _KT& __key) const
- { return _M_bkt_num_key(__key, bucket_count()); }
-
- size_type _M_bkt_num(const value_type& __obj) const
- { return _M_bkt_num_key(_M_get_key(__obj)); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type _M_bkt_num_key(const _KT& __key, size_type __n) const
- { return _M_hash(__key) % __n; }
-
- size_type _M_bkt_num(const value_type& __obj, size_t __n) const
- { return _M_bkt_num_key(_M_get_key(__obj), __n); }
-
- void _M_copy_from(const _Self& __ht);
-};
-
-#if defined (_STLP_DEBUG)
-# undef hashtable
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-_STLP_END_NAMESPACE
-
-#if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_hashtable.c>
-#endif
-
-#if defined (_STLP_DEBUG)
-# include <stl/debug/_hashtable.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#define _STLP_TEMPLATE_HEADER template <class _Val, class _Key, class _HF, class _Traits, class _ExK, class _EqK, class _All>
-#define _STLP_TEMPLATE_CONTAINER hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
-#include <stl/_relops_hash_cont.h>
-#undef _STLP_TEMPLATE_CONTAINER
-#undef _STLP_TEMPLATE_HEADER
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Val, class _Key, class _HF, class _Traits, class _ExK, class _EqK, class _All>
-struct __move_traits<hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> > {
- //Hashtables are movable:
- typedef __stlp_movable implemented;
-
- //Completeness depends on many template parameters, for the moment we consider it not complete:
- typedef __false_type complete;
-};
-#endif
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_HASHTABLE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_ios.c b/stl/_ios.c
deleted file mode 100644
index 99e477b..0000000
--- a/stl/_ios.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_IOS_C
-#define _STLP_IOS_C
-
-#ifndef _STLP_INTERNAL_IOS_H
-# include <stl/_ios.h>
-#endif
-
-#ifndef _STLP_INTERNAL_STREAMBUF
-# include <stl/_streambuf.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NUMPUNCT_H
-# include <stl/_numpunct.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-// basic_ios<>'s non-inline member functions
-
-// Public constructor, taking a streambuf.
-template <class _CharT, class _Traits>
-basic_ios<_CharT, _Traits>
- ::basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf)
- : ios_base(),
- _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) {
- basic_ios<_CharT, _Traits>::init(__streambuf);
-}
-
-template <class _CharT, class _Traits>
-basic_streambuf<_CharT, _Traits>*
-basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf) {
- basic_streambuf<_CharT, _Traits>* __tmp = _M_streambuf;
- _M_streambuf = __buf;
- this->clear();
- return __tmp;
-}
-
-template <class _CharT, class _Traits>
-basic_ios<_CharT, _Traits>&
-basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x) {
- _M_invoke_callbacks(erase_event);
- _M_copy_state(__x); // Inherited from ios_base.
- _M_fill = __x._M_fill;
- _M_tied_ostream = __x._M_tied_ostream;
- _M_invoke_callbacks(copyfmt_event);
- this->_M_set_exception_mask(__x.exceptions());
- return *this;
-}
-
-template <class _CharT, class _Traits>
-locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) {
- locale __tmp = ios_base::imbue(__loc);
- _STLP_TRY {
- if (_M_streambuf)
- _M_streambuf->pubimbue(__loc);
-
- // no throwing here
- this->_M_cached_ctype = __loc._M_get_facet(ctype<char_type>::id);
- this->_M_cached_numpunct = __loc._M_get_facet(numpunct<char_type>::id);
- this->_M_cached_grouping = ((numpunct<char_type>*)_M_cached_numpunct)->grouping();
- }
- _STLP_CATCH_ALL {
- __tmp = ios_base::imbue(__tmp);
- _M_handle_exception(ios_base::failbit);
- }
- return __tmp;
-}
-
-// Protected constructor and initialization functions. The default
-// constructor creates an uninitialized basic_ios, and init() initializes
-// all of the members to the values in Table 89 of the C++ standard.
-
-template <class _CharT, class _Traits>
-basic_ios<_CharT, _Traits>::basic_ios()
- : ios_base(),
- _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0)
-{}
-
-template <class _CharT, class _Traits>
-void
-basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)
-{
- this->rdbuf(__sb);
- this->imbue(locale());
- this->tie(0);
- this->_M_set_exception_mask(ios_base::goodbit);
- this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit);
- ios_base::flags(ios_base::skipws | ios_base::dec);
- ios_base::width(0);
- ios_base::precision(6);
- this->fill(widen(' '));
- // We don't need to worry about any of the three arrays: they are
- // initialized correctly in ios_base's constructor.
-}
-
-// This is never called except from within a catch clause.
-template <class _CharT, class _Traits>
-void basic_ios<_CharT, _Traits>::_M_handle_exception(ios_base::iostate __flag)
-{
- this->_M_setstate_nothrow(__flag);
- if (this->_M_get_exception_mask() & __flag)
- _STLP_RETHROW;
-}
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_IOS_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_ios.h b/stl/_ios.h
deleted file mode 100644
index 8e6da2d..0000000
--- a/stl/_ios.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_INTERNAL_IOS_H
-#define _STLP_INTERNAL_IOS_H
-
-
-#ifndef _STLP_IOS_BASE_H
-# include <stl/_ios_base.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CTYPE_H
-# include <stl/_ctype.h>
-#endif
-#ifndef _STLP_INTERNAL_NUMPUNCT_H
-# include <stl/_numpunct.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-// ----------------------------------------------------------------------
-
-// Class basic_ios, a subclass of ios_base. The only important difference
-// between the two is that basic_ios is a class template, parameterized
-// by the character type. ios_base exists to factor out all of the
-// common properties that don't depend on the character type.
-
-// The second template parameter, _Traits, defaults to char_traits<_CharT>.
-// The default is declared in header <iosfwd>, and it isn't declared here
-// because C++ language rules do not allow it to be declared twice.
-
-template <class _CharT, class _Traits>
-class basic_ios : public ios_base {
- friend class ios_base;
-public: // Synonyms for types.
- typedef _CharT char_type;
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::pos_type pos_type;
- typedef typename _Traits::off_type off_type;
- typedef _Traits traits_type;
-
-public: // Constructor, destructor.
- explicit basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf);
- virtual ~basic_ios() {}
-
-public: // Members from clause 27.4.4.2
- basic_ostream<_CharT, _Traits>* tie() const {
- return _M_tied_ostream;
- }
- basic_ostream<_CharT, _Traits>*
- tie(basic_ostream<char_type, traits_type>* __new_tied_ostream) {
- basic_ostream<char_type, traits_type>* __tmp = _M_tied_ostream;
- _M_tied_ostream = __new_tied_ostream;
- return __tmp;
- }
-
- basic_streambuf<_CharT, _Traits>* rdbuf() const
- { return _M_streambuf; }
-
- basic_streambuf<_CharT, _Traits>*
- rdbuf(basic_streambuf<char_type, traits_type>*);
-
- // Copies __x's state to *this.
- basic_ios<_CharT, _Traits>& copyfmt(const basic_ios<_CharT, _Traits>& __x);
-
- char_type fill() const { return _M_fill; }
- char_type fill(char_type __fill) {
- char_type __tmp(_M_fill);
- _M_fill = __fill;
- return __tmp;
- }
-
-public: // Members from 27.4.4.3. These four functions
- // can almost be defined in ios_base.
-
- void clear(iostate __state = goodbit) {
- _M_clear_nothrow(this->rdbuf() ? __state : iostate(__state|ios_base::badbit));
- _M_check_exception_mask();
- }
- void setstate(iostate __state) { this->clear(rdstate() | __state); }
-
- iostate exceptions() const { return this->_M_get_exception_mask(); }
- void exceptions(iostate __mask) {
- this->_M_set_exception_mask(__mask);
- this->clear(this->rdstate());
- }
-
-public: // Locale-related member functions.
- locale imbue(const locale&);
-
- inline char narrow(_CharT, char) const ;
- inline _CharT widen(char) const;
-
- // Helper function that makes testing for EOF more convenient.
- static bool _STLP_CALL _S_eof(int_type __c) {
- const int_type __eof = _Traits::eof();
- return _Traits::eq_int_type(__c, __eof);
- }
-
-protected:
- basic_ios();
-
- void init(basic_streambuf<_CharT, _Traits>* __streambuf);
-
-public:
-
- // Helper function used in istream and ostream. It is called only from
- // a catch clause.
- void _M_handle_exception(ios_base::iostate __flag);
-
-private: // Data members
- char_type _M_fill; // The fill character, used for padding.
-
- basic_streambuf<_CharT, _Traits>* _M_streambuf;
- basic_ostream<_CharT, _Traits>* _M_tied_ostream;
-
-};
-
-
-template <class _CharT, class _Traits>
-inline char
-basic_ios<_CharT, _Traits>::narrow(_CharT __c, char __default) const
-{ return __STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())->narrow(__c, __default); }
-
-template <class _CharT, class _Traits>
-inline _CharT
-basic_ios<_CharT, _Traits>::widen(char __c) const
-{ return __STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())->widen(__c); }
-
-# if !defined (_STLP_NO_METHOD_SPECIALIZATION)
-_STLP_TEMPLATE_NULL
-inline char
-basic_ios<char, char_traits<char> >::narrow(char __c, char) const
-{
- return __c;
-}
-
-_STLP_TEMPLATE_NULL
-inline char
-basic_ios<char, char_traits<char> >::widen(char __c) const
-{
- return __c;
-}
-# endif /* _STLP_NO_METHOD_SPECIALIZATION */
-
-# if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS basic_ios<char, char_traits<char> >;
-# if ! defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS basic_ios<wchar_t, char_traits<wchar_t> >;
-# endif
-# endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_ios.c>
-#endif
-
-#endif /* _STLP_IOS */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_ios_base.h b/stl/_ios_base.h
deleted file mode 100644
index b90606a..0000000
--- a/stl/_ios_base.h
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_IOS_BASE_H
-#define _STLP_IOS_BASE_H
-
-#ifndef _STLP_INTERNAL_STDEXCEPT_BASE
-# include <stl/_stdexcept_base.h>
-#endif
-
-#ifndef _STLP_UTILITY
-# include <utility>
-#endif
-
-#ifndef _STLP_INTERNAL_LOCALE_H
-# include <stl/_locale.h>
-#endif
-
-#ifndef _STLP_INTERNAL_STRING_H
-# include <stl/_string.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-// ----------------------------------------------------------------------
-
-// Class ios_base. This is the base class of the ios hierarchy, which
-// includes basic_istream and basic_ostream. Classes in the ios
-// hierarchy are actually quite simple: they are just glorified
-// wrapper classes. They delegate buffering and physical character
-// manipulation to the streambuf classes, and they delegate most
-// formatting tasks to a locale.
-
-class _STLP_CLASS_DECLSPEC ios_base {
-public:
-
- class _STLP_CLASS_DECLSPEC failure : public __Named_exception {
- public:
- explicit failure(const string&);
- virtual ~failure() _STLP_NOTHROW_INHERENTLY;
- };
-
- typedef int fmtflags;
- typedef int iostate;
- typedef int openmode;
- typedef int seekdir;
-
-# ifndef _STLP_NO_ANACHRONISMS
- typedef fmtflags fmt_flags;
-# endif
-
- // Formatting flags.
-#if defined (_STLP_STATIC_CONST_INIT_BUG)
- enum {
-#else
- // boris : type for all those constants is int
- static const int
-#endif
- left = 0x0001,
- right = 0x0002,
- internal = 0x0004,
- dec = 0x0008,
- hex = 0x0010,
- oct = 0x0020,
- fixed = 0x0040,
- scientific = 0x0080,
- boolalpha = 0x0100,
- showbase = 0x0200,
- showpoint = 0x0400,
- showpos = 0x0800,
- skipws = 0x1000,
- unitbuf = 0x2000,
- uppercase = 0x4000,
- adjustfield = left | right | internal,
- basefield = dec | hex | oct,
- floatfield = scientific | fixed,
-
- // State flags.
- goodbit = 0x00,
- badbit = 0x01,
- eofbit = 0x02,
- failbit = 0x04,
-
- // Openmode flags.
- __default_mode = 0x0, /* implementation detail */
- app = 0x01,
- ate = 0x02,
- binary = 0x04,
- in = 0x08,
- out = 0x10,
- trunc = 0x20,
-
- // Seekdir flags
-
- beg = 0x01,
- cur = 0x02,
- end = 0x04
-# ifdef _STLP_STATIC_CONST_INIT_BUG
- }
-# endif
- ;
-
-public: // Flag-manipulation functions.
- fmtflags flags() const { return _M_fmtflags; }
- fmtflags flags(fmtflags __flags) {
- fmtflags __tmp = _M_fmtflags;
- _M_fmtflags = __flags;
- return __tmp;
- }
-
- fmtflags setf(fmtflags __flag) {
- fmtflags __tmp = _M_fmtflags;
- _M_fmtflags |= __flag;
- return __tmp;
- }
- fmtflags setf(fmtflags __flag, fmtflags __mask) {
- fmtflags __tmp = _M_fmtflags;
- _M_fmtflags &= ~__mask;
- _M_fmtflags |= __flag & __mask;
- return __tmp;
- }
- void unsetf(fmtflags __mask) { _M_fmtflags &= ~__mask; }
-
- streamsize precision() const { return _M_precision; }
- streamsize precision(streamsize __newprecision) {
- streamsize __tmp = _M_precision;
- _M_precision = __newprecision;
- return __tmp;
- }
-
- streamsize width() const { return _M_width; }
- streamsize width(streamsize __newwidth) {
- streamsize __tmp = _M_width;
- _M_width = __newwidth;
- return __tmp;
- }
-
-public: // Locales
- locale imbue(const locale&);
- locale getloc() const { return _M_locale; }
-
-public: // Auxiliary storage.
- static int _STLP_CALL xalloc();
- long& iword(int __index);
- void*& pword(int __index);
-
-public: // Destructor.
- virtual ~ios_base();
-
-public: // Callbacks.
- enum event { erase_event, imbue_event, copyfmt_event };
- typedef void (*event_callback)(event, ios_base&, int __index);
- void register_callback(event_callback __fn, int __index);
-
-public: // This member function affects only
- // the eight predefined ios objects:
- // cin, cout, etc.
- static bool _STLP_CALL sync_with_stdio(bool __sync = true);
-
-public: // The C++ standard requires only that these
- // member functions be defined in basic_ios.
- // We define them in the non-template
- // base class to avoid code duplication.
- operator void*() const { return !fail() ? (void*) __CONST_CAST(ios_base*,this) : (void*) 0; }
- bool operator!() const { return fail(); }
-
- iostate rdstate() const { return _M_iostate; }
-
- bool good() const { return _M_iostate == 0; }
- bool eof() const { return (_M_iostate & eofbit) != 0; }
- bool fail() const { return (_M_iostate & (failbit | badbit)) != 0; }
- bool bad() const { return (_M_iostate & badbit) != 0; }
-
-protected: // The functional protected interface.
-
- // Copies the state of __x to *this. This member function makes it
- // possible to implement basic_ios::copyfmt without having to expose
- // ios_base's private data members. Does not copy _M_exception_mask
- // or _M_iostate.
- void _M_copy_state(const ios_base& __x);
-
- void _M_setstate_nothrow(iostate __state) { _M_iostate |= __state; }
- void _M_clear_nothrow(iostate __state) { _M_iostate = __state; }
- iostate _M_get_exception_mask() const { return _M_exception_mask; }
- void _M_set_exception_mask(iostate __mask) { _M_exception_mask = __mask; }
- void _M_check_exception_mask() {
- if (_M_iostate & _M_exception_mask)
- _M_throw_failure();
- }
-
- void _M_invoke_callbacks(event);
- void _STLP_FUNCTION_THROWS _M_throw_failure();
-
- ios_base(); // Default constructor.
-
-protected: // Initialization of the I/O system
- static void _STLP_CALL _S_initialize();
- static void _STLP_CALL _S_uninitialize();
- static bool _S_was_synced;
-
-private: // Invalidate the copy constructor and
- // assignment operator.
- ios_base(const ios_base&);
- void operator=(const ios_base&);
-
-private: // Data members.
-
- fmtflags _M_fmtflags; // Flags
- iostate _M_iostate;
- openmode _M_openmode;
- seekdir _M_seekdir;
- iostate _M_exception_mask;
-
- streamsize _M_precision;
- streamsize _M_width;
-
- locale _M_locale;
-
- pair<event_callback, int>* _M_callbacks;
- size_t _M_num_callbacks; // Size of the callback array.
- size_t _M_callback_index; // Index of the next available callback;
- // initially zero.
-
- long* _M_iwords; // Auxiliary storage. The count is zero
- size_t _M_num_iwords; // if and only if the pointer is null.
-
- void** _M_pwords;
- size_t _M_num_pwords;
-
-protected:
- // Cached copies of the curent locale's facets. Set by init() and imbue().
- locale::facet* _M_cached_ctype;
- locale::facet* _M_cached_numpunct;
- string _M_cached_grouping;
-public:
- // Equivalent to &use_facet< Facet >(getloc()), but faster.
- const locale::facet* _M_ctype_facet() const { return _M_cached_ctype; }
- const locale::facet* _M_numpunct_facet() const { return _M_cached_numpunct; }
- const string& _M_grouping() const { return _M_cached_grouping; }
-public:
-
- // ----------------------------------------------------------------------
- // Nested initializer class. This is an implementation detail, but it's
- // prescribed by the standard. The static initializer object (on
- // implementations where such a thing is required) is declared in
- // <iostream>
-
- class _STLP_CLASS_DECLSPEC Init
- {
- public:
- Init();
- ~Init();
- private:
- static long _S_count;
- friend class ios_base;
- };
-
- friend class Init;
-
-public:
-# ifndef _STLP_NO_ANACHRONISMS
- // 31.6 Old iostreams members [depr.ios.members]
- typedef iostate io_state;
- typedef openmode open_mode;
- typedef seekdir seek_dir;
- typedef _STLP_STD::streamoff streamoff;
- typedef _STLP_STD::streampos streampos;
-# endif
-};
-
-// ----------------------------------------------------------------------
-// ios_base manipulator functions, from section 27.4.5 of the C++ standard.
-// All of them are trivial one-line wrapper functions.
-
-// fmtflag manipulators, section 27.4.5.1
-inline ios_base& _STLP_CALL boolalpha(ios_base& __s)
- { __s.setf(ios_base::boolalpha); return __s;}
-
-inline ios_base& _STLP_CALL noboolalpha(ios_base& __s)
- { __s.unsetf(ios_base::boolalpha); return __s;}
-
-inline ios_base& _STLP_CALL showbase(ios_base& __s)
- { __s.setf(ios_base::showbase); return __s;}
-
-inline ios_base& _STLP_CALL noshowbase(ios_base& __s)
- { __s.unsetf(ios_base::showbase); return __s;}
-
-inline ios_base& _STLP_CALL showpoint(ios_base& __s)
- { __s.setf(ios_base::showpoint); return __s;}
-
-inline ios_base& _STLP_CALL noshowpoint(ios_base& __s)
- { __s.unsetf(ios_base::showpoint); return __s;}
-
-inline ios_base& _STLP_CALL showpos(ios_base& __s)
- { __s.setf(ios_base::showpos); return __s;}
-
-inline ios_base& _STLP_CALL noshowpos(ios_base& __s)
- { __s.unsetf(ios_base::showpos); return __s;}
-
-inline ios_base& _STLP_CALL skipws(ios_base& __s)
- { __s.setf(ios_base::skipws); return __s;}
-
-inline ios_base& _STLP_CALL noskipws(ios_base& __s)
- { __s.unsetf(ios_base::skipws); return __s;}
-
-inline ios_base& _STLP_CALL uppercase(ios_base& __s)
- { __s.setf(ios_base::uppercase); return __s;}
-
-inline ios_base& _STLP_CALL nouppercase(ios_base& __s)
- { __s.unsetf(ios_base::uppercase); return __s;}
-
-inline ios_base& _STLP_CALL unitbuf(ios_base& __s)
- { __s.setf(ios_base::unitbuf); return __s;}
-
-inline ios_base& _STLP_CALL nounitbuf(ios_base& __s)
- { __s.unsetf(ios_base::unitbuf); return __s;}
-
-
-// adjustfield manipulators, section 27.4.5.2
-inline ios_base& _STLP_CALL internal(ios_base& __s)
- { __s.setf(ios_base::internal, ios_base::adjustfield); return __s; }
-
-inline ios_base& _STLP_CALL left(ios_base& __s)
- { __s.setf(ios_base::left, ios_base::adjustfield); return __s; }
-
-inline ios_base& _STLP_CALL right(ios_base& __s)
- { __s.setf(ios_base::right, ios_base::adjustfield); return __s; }
-
-// basefield manipulators, section 27.4.5.3
-inline ios_base& _STLP_CALL dec(ios_base& __s)
- { __s.setf(ios_base::dec, ios_base::basefield); return __s; }
-
-inline ios_base& _STLP_CALL hex(ios_base& __s)
- { __s.setf(ios_base::hex, ios_base::basefield); return __s; }
-
-inline ios_base& _STLP_CALL oct(ios_base& __s)
- { __s.setf(ios_base::oct, ios_base::basefield); return __s; }
-
-
-// floatfield manipulators, section 27.4.5.3
-inline ios_base& _STLP_CALL fixed(ios_base& __s)
- { __s.setf(ios_base::fixed, ios_base::floatfield); return __s; }
-
-inline ios_base& _STLP_CALL scientific(ios_base& __s)
- { __s.setf(ios_base::scientific, ios_base::floatfield); return __s; }
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_IOS_BASE */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_iosfwd.h b/stl/_iosfwd.h
deleted file mode 100644
index 64c6430..0000000
--- a/stl/_iosfwd.h
+++ /dev/null
@@ -1,159 +0,0 @@
-#ifndef _STLP_INTERNAL_IOSFWD
-#define _STLP_INTERNAL_IOSFWD
-
-#if defined (__sgi) && !defined (__GNUC__) && !defined (_STANDARD_C_PLUS_PLUS)
-# error This header file requires the -LANG:std option
-#endif
-
-// This file provides forward declarations of the most important I/O
-// classes. Note that almost all of those classes are class templates,
-// with default template arguments. According to the C++ standard,
-// if a class template is declared more than once in the same scope
-// then only one of those declarations may have default arguments.
-
-// <iosfwd> contains the same declarations as other headers, and including
-// both <iosfwd> and (say) <iostream> is permitted. This means that only
-// one header may contain those default template arguments.
-
-// In this implementation, the declarations in <iosfwd> contain default
-// template arguments. All of the other I/O headers include <iosfwd>.
-
-#ifndef _STLP_CHAR_TRAITS_H
-# include <stl/char_traits.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-class ios_base;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
-class basic_ios;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
-class basic_streambuf;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
-class basic_istream;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
-class basic_ostream;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
-class basic_iostream;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM( _Traits , char_traits<_CharT>),
- _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
-class basic_stringbuf;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>),
- _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
-class basic_istringstream;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>),
- _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
-class basic_ostringstream;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>),
- _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
-class basic_stringstream;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
-class basic_filebuf;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
-class basic_ifstream;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
-class basic_ofstream;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
-class basic_fstream;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
-class istreambuf_iterator;
-
-template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
-class ostreambuf_iterator;
-
-typedef basic_ios<char, char_traits<char> > ios;
-
-#if !defined (_STLP_NO_WCHAR_T)
-typedef basic_ios<wchar_t, char_traits<wchar_t> > wios;
-#endif
-
-// Forward declaration of class locale, and of the most important facets.
-class locale;
-#if defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)
-template <class _Facet>
-struct _Use_facet {
- const locale& __loc;
- _Use_facet(const locale& __p_loc) : __loc(__p_loc) {}
- inline const _Facet& operator *() const;
-};
-# define use_facet *_Use_facet
-#else
-template <class _Facet> inline const _Facet& use_facet(const locale&);
-#endif
-
-template <class _CharT> class ctype;
-template <class _CharT> class ctype_byname;
-template <class _CharT> class collate;
-template <class _CharT> class collate_byname;
-
-_STLP_TEMPLATE_NULL class ctype<char>;
-_STLP_TEMPLATE_NULL class ctype_byname<char>;
-_STLP_TEMPLATE_NULL class collate<char>;
-_STLP_TEMPLATE_NULL class collate_byname<char>;
-
-#if !defined (_STLP_NO_WCHAR_T)
-_STLP_TEMPLATE_NULL class ctype<wchar_t>;
-_STLP_TEMPLATE_NULL class ctype_byname<wchar_t>;
-_STLP_TEMPLATE_NULL class collate<wchar_t>;
-_STLP_TEMPLATE_NULL class collate_byname<wchar_t>;
-#endif
-
-#if !(defined (__SUNPRO_CC) && __SUNPRO_CC < 0x500 )
-// Typedefs for ordinary (narrow-character) streams.
-//_STLP_TEMPLATE_NULL class basic_streambuf<char, char_traits<char> >;
-#endif
-
-typedef basic_istream<char, char_traits<char> > istream;
-typedef basic_ostream<char, char_traits<char> > ostream;
-typedef basic_iostream<char, char_traits<char> > iostream;
-typedef basic_streambuf<char,char_traits<char> > streambuf;
-
-typedef basic_stringbuf<char, char_traits<char>, allocator<char> > stringbuf;
-typedef basic_istringstream<char, char_traits<char>, allocator<char> > istringstream;
-typedef basic_ostringstream<char, char_traits<char>, allocator<char> > ostringstream;
-typedef basic_stringstream<char, char_traits<char>, allocator<char> > stringstream;
-
-typedef basic_filebuf<char, char_traits<char> > filebuf;
-typedef basic_ifstream<char, char_traits<char> > ifstream;
-typedef basic_ofstream<char, char_traits<char> > ofstream;
-typedef basic_fstream<char, char_traits<char> > fstream;
-
-#if !defined (_STLP_NO_WCHAR_T)
-// Typedefs for wide-character streams.
-typedef basic_streambuf<wchar_t, char_traits<wchar_t> > wstreambuf;
-typedef basic_istream<wchar_t, char_traits<wchar_t> > wistream;
-typedef basic_ostream<wchar_t, char_traits<wchar_t> > wostream;
-typedef basic_iostream<wchar_t, char_traits<wchar_t> > wiostream;
-
-typedef basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstringbuf;
-typedef basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wistringstream;
-typedef basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wostringstream;
-typedef basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstringstream;
-
-typedef basic_filebuf<wchar_t, char_traits<wchar_t> > wfilebuf;
-typedef basic_ifstream<wchar_t, char_traits<wchar_t> > wifstream;
-typedef basic_ofstream<wchar_t, char_traits<wchar_t> > wofstream;
-typedef basic_fstream<wchar_t, char_traits<wchar_t> > wfstream;
-#endif
-
-_STLP_END_NAMESPACE
-
-#endif
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_istream.c b/stl/_istream.c
deleted file mode 100644
index 292cab1..0000000
--- a/stl/_istream.c
+++ /dev/null
@@ -1,1429 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_ISTREAM_C
-#define _STLP_ISTREAM_C
-
-#ifndef _STLP_INTERNAL_ISTREAM
-# include <stl/_istream.h>
-#endif
-
-#ifndef _STLP_INTERNAL_LIMITS
-# include <stl/_limits.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NUM_GET_H
-# include <stl/_num_get.h>
-#endif
-
-#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
-// no wchar_t is supported for this mode
-# define __BIS_int_type__ int
-# define __BIS_pos_type__ streampos
-# define __BIS_off_type__ streamoff
-#else
-# define __BIS_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::int_type
-# define __BIS_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::pos_type
-# define __BIS_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::off_type
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//----------------------------------------------------------------------
-// Function object structs used by some member functions.
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Traits>
-struct _Is_not_wspace {
- typedef typename _Traits::char_type argument_type;
- typedef bool result_type;
-
- const ctype<argument_type>* _M_ctype;
-
- _Is_not_wspace(const ctype<argument_type>* __c_type) : _M_ctype(__c_type) {}
- bool operator()(argument_type __c) const
- { return !_M_ctype->is(ctype_base::space, __c); }
-};
-
-template <class _Traits>
-struct _Is_wspace_null {
- typedef typename _Traits::char_type argument_type;
- typedef bool result_type;
-
- const ctype<argument_type>* _M_ctype;
-
- _Is_wspace_null(const ctype<argument_type>* __c_type) : _M_ctype(__c_type) {}
- bool operator()(argument_type __c) const {
- return _Traits::eq(__c, argument_type()) ||
- _M_ctype->is(ctype_base::space, __c);
- }
-};
-
-template <class _Traits>
-struct _Scan_for_wspace {
- typedef typename _Traits::char_type char_type;
- typedef char_type* first_argument_type;
- typedef char_type* second_argument_type;
- typedef char_type* result_type;
-
- const ctype<char_type>* _M_ctype;
-
- _Scan_for_wspace(const ctype<char_type>* __ctype) : _M_ctype(__ctype) {}
- const char_type*
- operator()(const char_type* __first, const char_type* __last) const {
- return _M_ctype->scan_is(ctype_base::space, __first, __last);
- }
-};
-
-template <class _Traits>
-struct _Scan_wspace_null {
- typedef typename _Traits::char_type char_type;
- typedef char_type* first_argument_type;
- typedef char_type* second_argument_type;
- typedef char_type* result_type;
-
- const ctype<char_type>* _M_ctype;
-
- _Scan_wspace_null(const ctype<char_type>* __c_type) : _M_ctype(__c_type) {}
- const char_type*
- operator()(const char_type* __first, const char_type* __last) const {
- __last = find_if(__first, __last,
- _Eq_char_bound<_Traits>(char_type()));
- return _M_ctype->scan_is(ctype_base::space, __first, __last);
- }
-};
-
-template <class _Traits>
-struct _Scan_for_not_wspace {
- typedef typename _Traits::char_type char_type;
- typedef char_type* first_argument_type;
- typedef char_type* second_argument_type;
- typedef char_type* result_type;
-
- const ctype<char_type>* _M_ctype;
-
- _Scan_for_not_wspace(const ctype<char_type>* __c_type) : _M_ctype(__c_type) {}
- const char_type*
- operator()(const char_type* __first, const char_type* __last) const {
- return _M_ctype->scan_not(ctype_base::space, __first, __last);
- }
-};
-
-template <class _Traits>
-struct _Scan_for_char_val {
- typedef typename _Traits::char_type char_type;
- typedef char_type* first_argument_type;
- typedef char_type* second_argument_type;
- typedef char_type* result_type;
-
- char_type _M_val;
-
- _Scan_for_char_val(char_type __val) : _M_val(__val) {}
-
- const char_type*
- operator()(const char_type* __first, const char_type* __last) const {
- return find_if(__first, __last, _Eq_char_bound<_Traits>(_M_val));
- }
-};
-
-template <class _Traits>
-struct _Scan_for_int_val {
- typedef typename _Traits::char_type char_type;
- typedef typename _Traits::int_type int_type;
- typedef char_type* first_argument_type;
- typedef char_type* second_argument_type;
- typedef char_type* result_type;
-
- int_type _M_val;
-
- _Scan_for_int_val(int_type __val) : _M_val(__val) {}
-
- const char_type*
- operator()(const char_type* __first, const char_type* __last) const {
- return find_if(__first, __last,
- _Eq_int_bound<_Traits>(_M_val));
- }
-};
-
-// Helper function: try to push back a character to a streambuf,
-// return true if the pushback succeeded. Does not throw.
-
-template <class _CharT, class _Traits>
-bool _STLP_CALL
-__pushback(basic_streambuf<_CharT, _Traits>* __buf, _CharT __c) {
- bool ret;
- _STLP_TRY {
- const typename _Traits::int_type __eof = _Traits::eof();
- ret = !_Traits::eq_int_type(__buf->sputbackc(__c), __eof);
- }
- _STLP_CATCH_ALL {
- ret = false;
- }
- return ret;
-}
-
-//----------------------------------------------------------------------
-// Definitions of basic_istream<>'s noninline member functions.
-
-// Helper function for formatted input of numbers.
-template <class _CharT, class _Traits, class _Number>
-ios_base::iostate _STLP_CALL
-__get_num(basic_istream<_CharT, _Traits>& __that, _Number& __val) {
- typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
- ios_base::iostate __err = 0;
- _Sentry __sentry( __that ); // Skip whitespace.
- if (__sentry) {
- typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > _Num_get;
- _STLP_TRY {
- ((const _Num_get&)use_facet<_Num_get>(__that.getloc())).get(istreambuf_iterator<_CharT, _Traits>(__that.rdbuf()),
- 0, __that, __err, __val);
- }
- _STLP_CATCH_ALL {
- __that._M_handle_exception(ios_base::badbit);
- }
- if (__err) __that.setstate(__err);
- }
- return __err;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (short& __val) {
- long __lval;
- _STLP_PRIV __get_num(*this, __lval);
- if ( this->fail() ) {
- return *this;
- }
- short __tmp = __STATIC_CAST(short, __lval);
- unsigned short __uval = __STATIC_CAST(unsigned short, __lval);
- // check if we lose digits
- // if ((__val != __lval) && ((unsigned short)__val != __lval))
- if ((__tmp != __lval) && ((long)__uval != __lval))
- this->setstate(ios_base::failbit);
- else
- __val = __tmp;
- return *this;
-}
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (int& __val) {
- long __lval;
- _STLP_PRIV __get_num(*this, __lval);
- if ( this->fail() ) {
- return *this;
- }
- int __tmp = __lval;
- unsigned int __uval = __lval;
- // check if we lose digits
- // if ((__val != __lval) && ((unsigned int)__val != __lval))
- if ((__tmp != __lval) && ((long)__uval != __lval))
- this->setstate(ios_base::failbit);
- else
- __val = __tmp;
- return *this;
-}
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned short& __val) {
- _STLP_PRIV __get_num(*this, __val);
- return *this;
-}
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned int& __val) {
- _STLP_PRIV __get_num(*this, __val);
- return *this;
-}
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (long& __val) {
- _STLP_PRIV __get_num(*this, __val);
- return *this;
-}
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned long& __val) {
- _STLP_PRIV __get_num(*this, __val);
- return *this;
-}
-
-#if defined (_STLP_LONG_LONG)
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (_STLP_LONG_LONG& __val) {
- _STLP_PRIV __get_num(*this, __val);
- return *this;
-}
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned _STLP_LONG_LONG& __val) {
- _STLP_PRIV __get_num(*this, __val);
- return *this;
-}
-#endif
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (float& __val) {
- _STLP_PRIV __get_num(*this, __val);
- return *this;
-}
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (double& __val) {
- _STLP_PRIV __get_num(*this, __val);
- return *this;
-}
-#if !defined (_STLP_NO_LONG_DOUBLE)
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (long double& __val) {
- _STLP_PRIV __get_num(*this, __val);
- return *this;
-}
-#endif
-#if !defined (_STLP_NO_BOOL)
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (bool& __val) {
- _STLP_PRIV __get_num(*this, __val);
- return *this;
-}
-#endif
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (void*& __val) {
- _STLP_PRIV __get_num(*this, __val);
- return *this;
-}
-
-// Unformatted input
-
-template <class _CharT, class _Traits>
-__BIS_int_type__
-basic_istream<_CharT, _Traits>::peek() {
- typename _Traits::int_type __tmp = _Traits::eof();
-
- this->_M_gcount = 0;
- sentry __sentry(*this, _No_Skip_WS());
-
- if (__sentry) {
- _STLP_TRY {
- __tmp = this->rdbuf()->sgetc();
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- }
- if (this->_S_eof(__tmp))
- this->setstate(ios_base::eofbit);
- }
-
- return __tmp;
-}
-
-
-template <class _CharT, class _Traits>
-__BIS_int_type__
-basic_istream<_CharT, _Traits>::get() {
- typename _Traits::int_type __tmp = _Traits::eof();
- sentry __sentry(*this, _No_Skip_WS());
- this->_M_gcount = 0;
-
- if (__sentry) {
- _STLP_TRY {
- __tmp = this->rdbuf()->sbumpc();
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- }
-
- if (!this->_S_eof(__tmp))
- this->_M_gcount = 1;
- }
-
- if (_M_gcount == 0)
- this->setstate(ios_base::eofbit | ios_base::failbit);
-
- return __tmp;
-}
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::get(_CharT& __c) {
- sentry __sentry(*this, _No_Skip_WS());
- this->_M_gcount = 0;
-
- if (__sentry) {
- typename _Traits::int_type __tmp = _Traits::eof();
- _STLP_TRY {
- __tmp = this->rdbuf()->sbumpc();
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- }
-
- if (!this->_S_eof(__tmp)) {
- this->_M_gcount = 1;
- __c = _Traits::to_char_type(__tmp);
- }
- }
-
- if (this->_M_gcount == 0)
- this->setstate(ios_base::eofbit | ios_base::failbit);
-
- return *this;
-}
-
-
-// Read characters and discard them. The standard specifies a single
-// function with two arguments, each with a default. We instead use
-// three overloded functions, because it's possible to implement the
-// first two more efficiently than the fully general third version.
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore() {
- sentry __sentry(*this, _No_Skip_WS());
- this->_M_gcount = 0;
-
- if (__sentry) {
- int_type __c;
- _STLP_TRY {
- __c = this->rdbuf()->sbumpc();
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- return *this;
- }
-
- if (!this->_S_eof(__c))
- this->_M_gcount = 1;
- else
- this->setstate(ios_base::eofbit);
- }
-
- return *this;
-}
-
-// Putback
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::putback(_CharT __c) {
- this->_M_gcount = 0;
- sentry __sentry(*this, _No_Skip_WS());
-
- if (__sentry) {
- typename _Traits::int_type __tmp = _Traits::eof();
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
-// if (!__buf || this->_S_eof(__buf->sputbackc(__c)))
- if (__buf) {
- _STLP_TRY {
- __tmp = __buf->sputbackc(__c);
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- }
- }
- if (this->_S_eof(__tmp))
- this->setstate(ios_base::badbit);
- }
- else
- this->setstate(ios_base::failbit);
-
- return *this;
-}
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() {
- this->_M_gcount = 0;
-
- sentry __sentry(*this, _No_Skip_WS());
-
- if (__sentry) {
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
- // if (!__buf || _Traits::eq_int_type(__buf->sungetc(), _Traits::eof()))
- if (__buf) {
- _STLP_TRY {
- if (this->_S_eof(__buf->sungetc()))
- this->setstate(ios_base::badbit);
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- }
- } else
- this->setstate(ios_base::badbit);
- }
- else
- this->setstate(ios_base::failbit);
-
- return *this;
-}
-
-// Positioning and buffer control.
-
-template <class _CharT, class _Traits>
-int basic_istream<_CharT, _Traits>::sync() {
- sentry __sentry(*this, _No_Skip_WS());
-
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
- if (__buf) {
- if (__buf->pubsync() == -1) {
- this->setstate(ios_base::badbit);
- return -1;
- }
- else
- return 0;
- }
- else
- return -1;
-}
-
-template <class _CharT, class _Traits>
-__BIS_pos_type__
-basic_istream<_CharT, _Traits>::tellg() {
- sentry __sentry(*this, _No_Skip_WS());
-
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
- return (__buf && !this->fail()) ? __buf->pubseekoff(0, ios_base::cur, ios_base::in)
- : pos_type(-1);
-}
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::seekg(pos_type __pos) {
- sentry __sentry(*this, _No_Skip_WS());
-
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
- if (!this->fail() && __buf) {
- if (__buf->pubseekpos(__pos) == pos_type(-1)) {
- this->setstate(ios_base::failbit);
- }
- }
- return *this;
-}
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) {
- sentry __sentry(*this, _No_Skip_WS());
-
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
- if (!this->fail() && __buf)
- __buf->pubseekoff(__off, __dir);
- return *this;
-}
-
-// Formatted input of characters and character arrays.
-
-template <class _CharT, class _Traits>
-void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT& __c) {
-// typename _Traits::int_type __tmp = _Traits::eof();
-
- sentry __sentry(*this); // Skip whitespace.
-
- if (__sentry) {
- typename _Traits::int_type __tmp;// = _Traits::eof();
-
- _STLP_TRY {
- __tmp = this->rdbuf()->sbumpc();
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- return;
- }
-
- if (!this->_S_eof(__tmp))
- __c = _Traits::to_char_type(__tmp);
- else
- this->setstate(ios_base::eofbit | ios_base::failbit);
- }
-}
-
-
-//---------------------------------------------------------------------------
-// istream's helper functions.
-
-// A generic function for unbuffered input. We stop when we reach EOF,
-// or when we have extracted _Num characters, or when the function object
-// __is_delim return true. In the last case, it extracts the character
-// for which __is_delim is true, if and only if __extract_delim is true.
-// It appends a null character to the end of the string; this means that
-// it may store up to _Num + 1 characters.
-//
-// __is_getline governs two corner cases: reading _Num characters without
-// encountering delim or eof (in which case failbit is set if __is_getline
-// is true); and reading _Num characters where the _Num+1'st character is
-// eof (in which case eofbit is set if __is_getline is true).
-//
-// It is assumed that __is_delim never throws.
-//
-// Return value is the number of characters extracted, including the
-// delimiter if it is extracted. Note that the number of characaters
-// extracted isn't necessarily the same as the number stored.
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template < class _CharT, class _Traits, class _Is_Delim>
-streamsize _STLP_CALL
-__read_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf,
- streamsize _Num, _CharT* __s,
- _Is_Delim __is_delim,
- bool __extract_delim, bool __append_null,
- bool __is_getline) {
- streamsize __n = 0;
- ios_base::iostate __status = 0;
-
- typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
- // The operations that can potentially throw are sbumpc, snextc, and sgetc.
- _STLP_TRY {
- for (;;) {
- int_type __c = __buf->sbumpc(); // sschwarz
-
- if (__that->_S_eof(__c)) {
- if (__n < _Num || __is_getline)
- __status |= ios_base::eofbit;
- break;
- }
- else if (__is_delim(_Traits::to_char_type(__c))) {
- if (__extract_delim) { // Extract and discard current character.
- ++__n;
- } else if ( !__pushback(__buf, _Traits::to_char_type(__c)) ) { // leave delimiter
- __status |= ios_base::failbit;
- }
- break;
- }
- else { // regular character
- *__s++ = _Traits::to_char_type(__c);
- ++__n;
- }
-
- if (__n == _Num) {
- if (__is_getline) // didn't find delimiter as one of the _Num chars
- __status |= ios_base::failbit;
- break;
- }
- }
- }
- _STLP_CATCH_ALL {
- __that->_M_handle_exception(ios_base::badbit);
- *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
- return __n;
- }
-
- if (__append_null)
- *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
- if (__status)
- __that->setstate(__status); // This might throw.
- return __n;
-}
-
-// Much like __read_unbuffered, but with one additional function object:
-// __scan_delim(first, last) returns the first pointer p in [first, last)
-// such that __is_delim(p) is true.
-
-template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
-streamsize _STLP_CALL
-__read_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf,
- streamsize _Num, _CharT* __s,
- _Is_Delim __is_delim, _Scan_Delim __scan_delim,
- bool __extract_delim, bool __append_null,
- bool __is_getline) {
- streamsize __n = 0;
- ios_base::iostate __status = 0;
- bool __done = false;
-
- _STLP_TRY {
- while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) {
- const _CharT* __first = __buf->_M_gptr();
- const _CharT* __last = __buf->_M_egptr();
- //casting numeric_limits<ptrdiff_t>::max to streamsize only works is ptrdiff_t is signed or streamsize representation
- //is larger than ptrdiff_t one.
- _STLP_STATIC_ASSERT(((sizeof(streamsize) > sizeof(ptrdiff_t)) ||
- (sizeof(streamsize) == sizeof(ptrdiff_t))) && numeric_limits<ptrdiff_t>::is_signed)
- ptrdiff_t __request = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()), _Num - __n));
-
- const _CharT* __p = __scan_delim(__first, __last);
- ptrdiff_t __chunk = (min) (ptrdiff_t(__p - __first), __request);
- _Traits::copy(__s, __first, __chunk);
- __s += __chunk;
- __n += __chunk;
- __buf->_M_gbump((int)__chunk);
-
- // We terminated by finding delim.
- if (__p != __last && __p - __first <= __request) {
- if (__extract_delim) {
- __n += 1;
- __buf->_M_gbump(1);
- }
- __done = true;
- }
-
- // We terminated by reading all the characters we were asked for.
- else if (__n == _Num) {
-
- // Find out if we have reached eof. This matters for getline.
- if (__is_getline) {
- if (__chunk == __last - __first) {
- if (__that->_S_eof(__buf->sgetc()))
- __status |= ios_base::eofbit;
- }
- else
- __status |= ios_base::failbit;
- }
- __done = true;
- }
-
- // The buffer contained fewer than _Num - __n characters. Either we're
- // at eof, or we should refill the buffer and try again.
- else {
- if (__that->_S_eof(__buf->sgetc())) {
- __status |= ios_base::eofbit;
- __done = true;
- }
- }
- } // Close the while loop.
- }
- _STLP_CATCH_ALL {
- __that->_M_handle_exception(ios_base::badbit);
- __done = true;
- }
-
- if (__done) {
- if (__append_null)
- *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
- if (__status != 0)
- __that->setstate(__status); // This might throw.
- return __n;
- }
-
- // If execution has reached this point, then we have an empty buffer but
- // we have not reached eof. What that means is that the streambuf has
- // decided to switch from buffered to unbuffered input. We switch to
- // to __read_unbuffered.
-
- return __n + __read_unbuffered(__that, __buf, _Num - __n, __s, __is_delim,
- __extract_delim,__append_null,__is_getline);
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::get(_CharT* __s, streamsize __n,
- _CharT __delim) {
- sentry __sentry(*this, _No_Skip_WS());
- this->_M_gcount = 0;
-
- if (__sentry) {
- if (__n > 0) {
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
-
- if (__buf->egptr() != __buf->gptr())
- this->_M_gcount =
- _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s,
- _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
- _STLP_PRIV _Scan_for_char_val<_Traits>(__delim),
- false, true, false);
- else
- this->_M_gcount =
- _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s,
- _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
- false, true, false);
- }
- }
-
- if (this->_M_gcount == 0)
- this->setstate(ios_base::failbit);
-
- return *this;
-}
-
-// Getline is essentially identical to get, except that it extracts
-// the delimiter.
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::getline(_CharT* __s, streamsize __n,
- _CharT __delim) {
- sentry __sentry(*this, _No_Skip_WS());
- this->_M_gcount = 0;
-
- if (__sentry) {
- if (__n > 0) {
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
- this->_M_gcount = __buf->egptr() != __buf->gptr()
- ? _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s,
- _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
- _STLP_PRIV _Scan_for_char_val<_Traits>(__delim),
- true, true, true)
- : _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s,
- _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
- true, true, true);
- }
- }
-
- if (this->_M_gcount == 0)
- this->setstate(ios_base::failbit);
-
- return *this;
-}
-
-// Read n characters. We don't look for any delimiter, and we don't
-// put in a terminating null character.
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) {
- sentry __sentry(*this, _No_Skip_WS());
- this->_M_gcount = 0;
-
- if (__sentry && !this->eof()) {
- basic_streambuf<_CharT, _Traits>*__buf = this->rdbuf();
- if (__buf->gptr() != __buf->egptr())
- _M_gcount
- = _STLP_PRIV __read_buffered(this, __buf, __n, __s,
- _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
- _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
- false, false, false);
- else
- _M_gcount
- = _STLP_PRIV __read_unbuffered(this, __buf, __n, __s,
- _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
- false, false, false);
- }
- else
- this->setstate(ios_base::failbit);
-
- if (this->eof())
- this->setstate(ios_base::eofbit | ios_base::failbit);
-
- return *this;
-}
-
-
-// Read n or fewer characters. We don't look for any delimiter, and
-// we don't put in a terminating null character.
-template <class _CharT, class _Traits>
-streamsize
-basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __nmax) {
- sentry __sentry(*this, _No_Skip_WS());
- this->_M_gcount = 0;
-
- if (__sentry && !this->eof() && __nmax >= 0) {
-
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
- streamsize __avail = __buf->in_avail();
-
- // fbp : isn't full-blown setstate required here ?
- if (__avail == -1)
- this->_M_setstate_nothrow(ios_base::eofbit);
-
- else if (__avail != 0) {
-
- if (__buf->gptr() != __buf->egptr())
- _M_gcount
- = _STLP_PRIV __read_buffered(this, __buf, (min) (__avail, __nmax), __s,
- _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
- _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
- false, false, false);
- else
- _M_gcount
- = _STLP_PRIV __read_unbuffered(this, __buf, (min) (__avail, __nmax), __s,
- _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
- false, false, false);
- }
- }
- else {
- // fbp : changed so that failbit is set only there, to pass Dietmar's test
- if (this->eof())
- this->setstate(ios_base::eofbit | ios_base::failbit);
- else
- this->setstate(ios_base::failbit);
- }
-
- // if (this->eof())
- // this->setstate(ios_base::eofbit | ios_base::failbit);
-
- return _M_gcount;
-}
-
-template <class _CharT, class _Traits>
-void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT* __s) {
- sentry __sentry(*this); // Skip whitespace.
-
- if (__sentry) {
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
- streamsize __nmax = this->width() > 0
- ? this->width() - 1
- : ((numeric_limits<streamsize>::max)() / sizeof(_CharT)) - 1;
-
- streamsize __n = __buf->gptr() != __buf->egptr()
- ? _STLP_PRIV __read_buffered(this, __buf, __nmax, __s,
- _STLP_PRIV _Is_wspace_null<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())),
- _STLP_PRIV _Scan_wspace_null<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())),
- false, true, false)
- : _STLP_PRIV __read_unbuffered(this, __buf, __nmax, __s,
- _STLP_PRIV _Is_wspace_null<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())),
- false, true, false);
- if (__n == 0)
- this->setstate(ios_base::failbit);
- }
- this->width(0);
-}
-
-// A generic unbuffered function for ignoring characters. We stop
-// when we reach EOF, or when the function object __is_delim returns
-// true. In the last case, it extracts the character for which
-// __is_delim is true, if and only if __extract_delim is true.
-
-template < class _CharT, class _Traits, class _Is_Delim>
-void _STLP_CALL
-_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that,
- basic_streambuf<_CharT, _Traits>* __buf,
- _Is_Delim __is_delim,
- bool __extract_delim, bool __set_failbit) {
- bool __done = false;
- ios_base::iostate __status = 0;
- typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
-
- _STLP_TRY {
- while (!__done) {
- int_type __c = __buf->sbumpc();
-
- if (__that->_S_eof(__c)) {
- __done = true;
- __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
- : ios_base::eofbit;
- }
-
- else if (__is_delim(_Traits::to_char_type(__c))) {
- __done = true;
- if (!__extract_delim)
- if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c))))
- __status |= ios_base::failbit;
- }
- }
- }
- _STLP_CATCH_ALL {
- __that->_M_handle_exception(ios_base::badbit);
- }
-
- __that->setstate(__status);
-}
-
-// A generic buffered function for ignoring characters. Much like
-// _M_ignore_unbuffered, but with one additional function object:
-// __scan_delim(first, last) returns the first pointer p in [first,
-// last) such that __is_delim(p) is true.
-
-template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
-void _STLP_CALL
-_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that,
- basic_streambuf<_CharT, _Traits>* __buf,
- _Is_Delim __is_delim, _Scan_Delim __scan_delim,
- bool __extract_delim, bool __set_failbit) {
- bool __at_eof = false;
- bool __found_delim = false;
-
- _STLP_TRY {
- while (__buf->_M_egptr() != __buf->_M_gptr() && !__at_eof && !__found_delim) {
- const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr());
- __buf->_M_gbump((int)(__p - __buf->_M_gptr()));
-
- if (__p != __buf->_M_egptr()) { // We found delim, so we're done.
- if (__extract_delim)
- __buf->_M_gbump(1);
- __found_delim = true;
- }
-
- else // No delim. Try to refil the buffer.
- __at_eof = __that->_S_eof(__buf->sgetc());
- } // Close the while loop.
- }
- _STLP_CATCH_ALL {
- __that->_M_handle_exception(ios_base::badbit);
- return;
- }
-
- if (__at_eof) {
- __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
- : ios_base::eofbit);
- return;
- }
- if (__found_delim)
- return;
-
- // If execution has reached this point, then we have an empty buffer but
- // we have not reached eof. What that means is that the streambuf has
- // decided to switch from a buffered to an unbuffered mode. We switch
- // to _M_ignore_unbuffered.
- _M_ignore_unbuffered(__that, __buf, __is_delim, __extract_delim, __set_failbit);
-}
-
-// Overloaded versions of _M_ignore_unbuffered and _M_ignore_unbuffered
-// with an explicit count _Num. Return value is the number of
-// characters extracted.
-//
-// The function object __max_chars takes two arguments, _Num and __n
-// (the latter being the number of characters we have already read),
-// and returns the maximum number of characters to read from the buffer.
-// We parameterize _M_ignore_buffered so that we can use it for both
-// bounded and unbounded input; for the former the function object should
-// be minus<>, and for the latter it should return a constant maximum value.
-
-template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim>
-streamsize _STLP_CALL
-_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that,
- basic_streambuf<_CharT, _Traits>* __buf,
- streamsize _Num, _Max_Chars __max_chars,
- _Is_Delim __is_delim,
- bool __extract_delim, bool __set_failbit) {
- streamsize __n = 0;
- ios_base::iostate __status = 0;
- typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
-
- _STLP_TRY {
- while (__max_chars(_Num, __n) > 0) {
- int_type __c = __buf->sbumpc();
-
- if (__that->_S_eof(__c)) {
- __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
- : ios_base::eofbit;
- break;
- }
-
- else if (__is_delim(_Traits::to_char_type(__c))) {
- if (__extract_delim)
- ++__n;
- else if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c))))
- __status |= ios_base::failbit;
-
- break;
- }
- // fbp : added counter increment to pass Dietmar's test
- ++__n;
- }
- }
- _STLP_CATCH_ALL {
- __that->_M_handle_exception(ios_base::badbit);
- }
-
- if (__status)
- __that->setstate(__status); // This might throw.
- return __n;
-}
-
-template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim, class _Scan_Delim>
-streamsize _STLP_CALL
-_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that,
- basic_streambuf<_CharT, _Traits>* __buf,
- streamsize _Num,
- _Max_Chars __max_chars,
- _Is_Delim __is_delim, _Scan_Delim __scan_delim,
- bool __extract_delim, bool __set_failbit) {
- streamsize __n = 0;
- bool __at_eof = false;
- bool __done = false;
-
- _STLP_TRY {
- while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) {
- ptrdiff_t __avail = __buf->_M_egptr() - __buf->_M_gptr();
- streamsize __m = __max_chars(_Num, __n);
-
- if (__avail >= __m) { // We have more characters than we need.
- const _CharT* __last = __buf->_M_gptr() + __STATIC_CAST(ptrdiff_t, __m);
- const _CharT* __p = __scan_delim(__buf->_M_gptr(), __last);
- ptrdiff_t __chunk = __p - __buf->_M_gptr();
- __n += __chunk;
- __buf->_M_gbump((int)__chunk);
-
- if (__extract_delim && __p != __last) {
- __n += 1;
- __buf->_M_gbump(1);
- }
-
- __done = true;
- }
-
- else {
- const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr());
- ptrdiff_t __chunk = __p - __buf->_M_gptr();
- __n += __chunk;
- __buf->_M_gbump((int)__chunk);
-
- if (__p != __buf->_M_egptr()) { // We found delim.
- if (__extract_delim) {
- __n += 1;
- __buf->_M_gbump(1);
- }
-
- __done = true;
- }
-
- // We didn't find delim. Try to refill the buffer.
- else if (__that->_S_eof(__buf->sgetc())) {
- __done = true;
- __at_eof = true;
- }
- }
- } // Close the while loop.
- }
- _STLP_CATCH_ALL {
- __that->_M_handle_exception(ios_base::badbit);
- return __n;
- }
-
- if (__at_eof)
- __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
- : ios_base::eofbit);
-
- if (__done)
- return __n;
-
- // If execution has reached this point, then we have an empty buffer but
- // we have not reached eof. What that means is that the streambuf has
- // decided to switch from buffered to unbuffered input. We switch to
- // to _M_ignore_unbuffered.
-
- return __n + _M_ignore_unbuffered(__that, __buf, _Num, __max_chars,
- __is_delim, __extract_delim, __set_failbit);
-}
-
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::ignore(streamsize __n) {
- sentry __sentry(*this, _No_Skip_WS());
- this->_M_gcount = 0;
-
- if (__sentry) {
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
- typedef _STLP_PRIV _Constant_unary_fun<bool, int_type> _Const_bool;
- typedef _STLP_PRIV _Constant_binary_fun<streamsize, streamsize, streamsize> _Const_streamsize;
- const streamsize __maxss = (numeric_limits<streamsize>::max)();
-
- if (__n == (numeric_limits<int>::max)()) {
- if (__buf->gptr() != __buf->egptr())
- _M_gcount = _M_ignore_buffered(this, __buf,
- __maxss, _Const_streamsize(__maxss),
- _Const_bool(false),
- _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
- false, false);
- else
- _M_gcount = _M_ignore_unbuffered(this, __buf,
- __maxss, _Const_streamsize(__maxss),
- _Const_bool(false), false, false);
- }
- else {
- if (__buf->gptr() != __buf->egptr())
- _M_gcount = _M_ignore_buffered(this, __buf,
- __n, minus<streamsize>(),
- _Const_bool(false),
- _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
- false, false);
- else
- _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus<streamsize>(),
- _Const_bool(false), false, false);
- }
- }
-
- return *this;
-}
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __delim) {
- sentry __sentry(*this, _No_Skip_WS());
- this->_M_gcount = 0;
-
- if (__sentry) {
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
- typedef _STLP_PRIV _Constant_unary_fun<bool, int_type> _Const_bool;
- typedef _STLP_PRIV _Constant_binary_fun<streamsize, streamsize, streamsize>
- _Const_streamsize;
- const streamsize __maxss = (numeric_limits<streamsize>::max)();
-
- if (__n == (numeric_limits<int>::max)()) {
- if (__buf->gptr() != __buf->egptr())
- _M_gcount = _M_ignore_buffered(this, __buf,
- __maxss, _Const_streamsize(__maxss),
- _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
- _STLP_PRIV _Scan_for_int_val<_Traits>(__delim),
- true, false);
- else
- _M_gcount = _M_ignore_unbuffered(this, __buf,
- __maxss, _Const_streamsize(__maxss),
- _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
- true, false);
- }
- else {
- if (__buf->gptr() != __buf->egptr())
- _M_gcount = _M_ignore_buffered(this, __buf,
- __n, minus<streamsize>(),
- _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
- _STLP_PRIV _Scan_for_int_val<_Traits>(__delim),
- true, false);
- else
- _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus<streamsize>(),
- _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
- true, false);
- }
- }
-
- return *this;
-}
-
-// This member function does not construct a sentry object, because
-// it is called from sentry's constructor.
-template <class _CharT, class _Traits>
-void basic_istream<_CharT, _Traits>::_M_skip_whitespace(bool __set_failbit) {
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
- if (!__buf)
- this->setstate(ios_base::badbit);
- else if (__buf->gptr() != __buf->egptr())
- _M_ignore_buffered(this, __buf,
- _STLP_PRIV _Is_not_wspace<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())),
- _STLP_PRIV _Scan_for_not_wspace<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())),
- false, __set_failbit);
- else
- _M_ignore_unbuffered(this, __buf,
- _STLP_PRIV _Is_not_wspace<_Traits>(__STATIC_CAST(const ctype<_CharT>*, this->_M_ctype_facet())),
- false, __set_failbit);
-}
-
-
-// This is a very simple loop that reads characters from __src and puts
-// them into __dest. It looks complicated because of the (standard-
-// mandated) exception handling policy.
-//
-// We stop when we get an exception, when we fail to insert into the
-// output streambuf, or when __is_delim is true.
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template < class _CharT, class _Traits, class _Is_Delim>
-streamsize _STLP_CALL
-__copy_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src,
- basic_streambuf<_CharT, _Traits>* __dest,
- _Is_Delim __is_delim,
- bool __extract_delim, bool __rethrow) {
- streamsize __extracted = 0;
- ios_base::iostate __status = 0;
- typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
- int_type __c;
-
- _STLP_TRY {
- for (;;) {
- // Get a character. If there's an exception, catch and (maybe) rethrow it.
- __c = __src->sbumpc();
-
- // If we failed to get a character, then quit.
- if (__that->_S_eof(__c)) {
- __status |= ios_base::eofbit;
- break;
- }
- // If it's the delimiter, then quit.
- else if (__is_delim(_Traits::to_char_type(__c))) {
- if (!__extract_delim && !__pushback(__src, _Traits::to_char_type(__c)))
- __status |= ios_base::failbit;
- break;
- }
- else {
- // Try to put the character in the output streambuf.
- bool __failed = false;
- _STLP_TRY {
- if (!__that->_S_eof(__dest->sputc(_Traits::to_char_type(__c))))
- ++__extracted;
- else
- __failed = true;
- }
- _STLP_CATCH_ALL {
- __failed = true;
- }
-
- // If we failed to put the character in the output streambuf, then
- // try to push it back to the input streambuf.
- if (__failed && !__pushback(__src, _Traits::to_char_type(__c)))
- __status |= ios_base::failbit;
-
- // fbp : avoiding infinite loop in io-27-6-1-2-3.exp
- if (__failed)
- break;
- }
-
- } /* for (;;) */
-
- }
- // fbp : this try/catch moved here in reasonable assumption
- // __is_delim never throw (__pushback is guaranteed not to)
- _STLP_CATCH_ALL {
- // See 27.6.1.2.3, paragraph 13.
- if (__rethrow && __extracted == 0)
- __that->_M_handle_exception(ios_base::failbit);
- }
- __that->setstate(__status);
- return __extracted;
-}
-
-// Buffered copying from one streambuf to another. We copy the characters
-// in chunks, rather than one at a time. We still have to worry about all
-// of the error conditions we checked in __copy_unbuffered, plus one more:
-// the streambuf might decide to switch from a buffered to an unbuffered mode.
-
-template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
-streamsize _STLP_CALL
-__copy_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src,
- basic_streambuf<_CharT, _Traits>* __dest,
- _Scan_Delim __scan_delim, _Is_Delim __is_delim,
- bool __extract_delim, bool __rethrow) {
- streamsize __extracted = 0;
- ios_base::iostate __status = 0;
- typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
- //Borland compiler generates a warning if assignment because value is never used:
- int_type __c /*= _Traits::eof()*/;
- _CharT* __first = __src->_M_gptr();
- ptrdiff_t __avail = __src->_M_egptr() - __first;
- // fbp : introduced to move catch/try blocks out of the loop
- bool __do_handle_exceptions = false;
-
- _STLP_TRY {
- for (;;) {
- const _CharT* __last = __scan_delim(__first, __src->_M_egptr());
-
- // Try to copy the entire input buffer to the output buffer.
- streamsize __n = __dest->sputn(__first, __extract_delim && __last != __src->_M_egptr()
- ? (__last - __first) + 1
- : (__last - __first));
- __src->_M_gbump((int)__n);
- __extracted += __n;
-
- // from this on, catch() will call _M_handle_exceptions()
- __do_handle_exceptions = true;
-
- if (__n < __avail) // We found the delimiter, or else failed to
- break; // copy some characters.
-
- __c = __src->sgetc();
-
- // Three possibilities: we succeeded in refilling the buffer, or
- // we got EOF, or the streambuf has switched to unbuffered mode.
- __first = __src->_M_gptr();
- __avail = __src->_M_egptr() - __first;
-
- if (__avail > 0)
- {} // dwa 1/16/00 -- suppress a Metrowerks warning
- else if (__that->_S_eof(__c)) {
- __status |= ios_base::eofbit;
- break;
- }
- else {
- return __extracted + __copy_unbuffered(__that, __src, __dest, __is_delim,
- __extract_delim, __rethrow);
- }
-
- __do_handle_exceptions = false;
- }
- }
-
- _STLP_CATCH_ALL {
- // See 27.6.1.2.3, paragraph 13.
- if (__rethrow && __do_handle_exceptions && __extracted == 0)
- __that->_M_handle_exception(ios_base::failbit);
- }
-
- if (__status)
- __that->setstate(__status); // This might throw.
- return __extracted;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>
- ::get(basic_streambuf<_CharT, _Traits>& __dest, _CharT __delim) {
- sentry __sentry(*this, _No_Skip_WS());
- this->_M_gcount = 0;
-
- if (__sentry) {
- basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
-
- if (__src)
- this->_M_gcount = __src->egptr() != __src->gptr()
- ? _STLP_PRIV __copy_buffered(this, __src, &__dest,
- _STLP_PRIV _Scan_for_char_val<_Traits>(__delim),
- _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
- false, false)
- : _STLP_PRIV __copy_unbuffered(this, __src, &__dest,
- _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
- false, false);
- }
-
- if (this->_M_gcount == 0)
- this->setstate(ios_base::failbit);
-
- return *this;
-}
-
-// Copying characters into a streambuf.
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>&
-basic_istream<_CharT, _Traits>
- ::operator>>(basic_streambuf<_CharT, _Traits>* __dest) {
- streamsize __n = 0;
- typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
- _Sentry __sentry(*this);
- if (__sentry) {
- basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
- if (__src && __dest)
- __n = __src->egptr() != __src->gptr()
- ? _STLP_PRIV __copy_buffered(this, __src, __dest,
- _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
- _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
- false, true)
- : _STLP_PRIV __copy_unbuffered(this, __src, __dest,
- _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
- false, true);
- }
-
- if (__n == 0)
- this->setstate(ios_base::failbit);
-
- return *this;
-}
-
-// ----------------------------------------------------------------
-// basic_iostream<> class
-// ----------------------------------------------------------------
-
-template <class _CharT, class _Traits>
-basic_iostream<_CharT, _Traits>
- ::basic_iostream(basic_streambuf<_CharT, _Traits>* __buf)
- : basic_ios<_CharT, _Traits>(),
- basic_istream<_CharT, _Traits>(__buf),
- basic_ostream<_CharT, _Traits>(__buf) {
- this->init(__buf);
-}
-
-template <class _CharT, class _Traits>
-basic_iostream<_CharT, _Traits>::~basic_iostream()
-{}
-
-_STLP_END_NAMESPACE
-
-#undef __BIS_int_type__
-#undef __BIS_pos_type__
-#undef __BIS_off_type__
-
-#endif /* _STLP_ISTREAM_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_istream.h b/stl/_istream.h
deleted file mode 100644
index 9292cce..0000000
--- a/stl/_istream.h
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_INTERNAL_ISTREAM
-#define _STLP_INTERNAL_ISTREAM
-
-// this block is included by _ostream.h, we include it here to lower #include level
-#if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR)
-# include <stl/_cwchar.h>
-#endif
-
-#ifndef _STLP_INTERNAL_IOS_H
-# include <stl/_ios.h> // For basic_ios<>. Includes <iosfwd>.
-#endif
-
-#ifndef _STLP_INTERNAL_OSTREAM_H
-# include <stl/_ostream.h> // Needed as a base class of basic_iostream.
-#endif
-
-#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
-# include <stl/_istreambuf_iterator.h>
-#endif
-
-#include <stl/_ctraits_fns.h> // Helper functions that allow char traits
- // to be used as function objects.
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-template <class _CharT, class _Traits>
-class _Isentry;
-#endif
-
-struct _No_Skip_WS {}; // Dummy class used by sentry.
-
-template <class _CharT, class _Traits>
-bool _M_init_skip(basic_istream<_CharT, _Traits>& __istr);
-template <class _CharT, class _Traits>
-bool _M_init_noskip(basic_istream<_CharT, _Traits>& __istr);
-
-//----------------------------------------------------------------------
-// Class basic_istream, a class that performs formatted input through
-// a stream buffer.
-
-// The second template parameter, _Traits, defaults to char_traits<_CharT>.
-// The default is declared in header <iosfwd>, and it isn't declared here
-// because C++ language rules do not allow it to be declared twice.
-
-template <class _CharT, class _Traits>
-class basic_istream : virtual public basic_ios<_CharT, _Traits> {
- typedef basic_istream<_CharT, _Traits> _Self;
-
-#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
- //explicitely defined as private to avoid warnings:
- basic_istream(_Self const&);
- _Self& operator = (_Self const&);
-#endif
-
-public:
- // Types
- typedef _CharT char_type;
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::pos_type pos_type;
- typedef typename _Traits::off_type off_type;
- typedef _Traits traits_type;
- typedef basic_ios<_CharT, _Traits> _Basic_ios;
-
- typedef basic_ios<_CharT, _Traits>& (_STLP_CALL *__ios_fn)(basic_ios<_CharT, _Traits>&);
- typedef ios_base& (_STLP_CALL *__ios_base_fn)(ios_base&);
- typedef _Self& (_STLP_CALL *__istream_fn)(_Self&);
-
-public: // Constructor and destructor.
- explicit basic_istream(basic_streambuf<_CharT, _Traits>* __buf) :
- basic_ios<_CharT, _Traits>(), _M_gcount(0) {
- this->init(__buf);
- }
- ~basic_istream() {};
-
-public: // Nested sentry class.
-
-public: // Hooks for manipulators. The arguments are
- // function pointers.
- _Self& operator>> (__istream_fn __f) { return __f(*this); }
- _Self& operator>> (__ios_fn __f) { __f(*this); return *this; }
- _Self& operator>> (__ios_base_fn __f) { __f(*this); return *this; }
-
-public: // Formatted input of numbers.
- _Self& operator>> (short& __val);
- _Self& operator>> (int& __val);
- _Self& operator>> (unsigned short& __val);
- _Self& operator>> (unsigned int& __val);
- _Self& operator>> (long& __val);
- _Self& operator>> (unsigned long& __val);
-#ifdef _STLP_LONG_LONG
- _Self& operator>> (_STLP_LONG_LONG& __val);
- _Self& operator>> (unsigned _STLP_LONG_LONG& __val);
-#endif
- _Self& operator>> (float& __val);
- _Self& operator>> (double& __val);
-# ifndef _STLP_NO_LONG_DOUBLE
- _Self& operator>> (long double& __val);
-# endif
-# ifndef _STLP_NO_BOOL
- _Self& operator>> (bool& __val);
-# endif
- _Self& operator>> (void*& __val);
-
-public: // Copying characters into a streambuf.
- _Self& operator>>(basic_streambuf<_CharT, _Traits>*);
-
-public: // Unformatted input.
- streamsize gcount() const { return _M_gcount; }
- int_type peek();
-
-public: // get() for single characters
- int_type get();
- _Self& get(char_type& __c);
-
-public: // get() for character arrays.
- _Self& get(char_type* __s, streamsize __n, char_type __delim);
- _Self& get(char_type* __s, streamsize __n)
- { return get(__s, __n, this->widen('\n')); }
-
-public: // get() for streambufs
- _Self& get(basic_streambuf<_CharT, _Traits>& __buf,
- char_type __delim);
- _Self& get(basic_streambuf<_CharT, _Traits>& __buf)
- { return get(__buf, this->widen('\n')); }
-
-public: // getline()
- _Self& getline(char_type* __s, streamsize __n, char_type delim);
- _Self& getline(char_type* __s, streamsize __n)
- { return getline(__s, __n, this->widen('\n')); }
-
-public: // read(), readsome(), ignore()
- _Self& ignore();
- _Self& ignore(streamsize __n);
-#if (defined (_STLP_MSVC) && _STLP_MSVC < 1200)
- inline
-#endif
- _Self& ignore(streamsize __n, int_type __delim);
-
- _Self& read(char_type* __s, streamsize __n);
- streamsize readsome(char_type* __s, streamsize __n);
-
-public: // putback
- _Self& putback(char_type __c);
- _Self& unget();
-
-public: // Positioning and buffer control.
- int sync();
-
- pos_type tellg();
- _Self& seekg(pos_type __pos);
- _Self& seekg(off_type, ios_base::seekdir);
-
-public: // Helper functions for non-member extractors.
- void _M_formatted_get(_CharT& __c);
- void _M_formatted_get(_CharT* __s);
- void _M_skip_whitespace(bool __set_failbit);
-
-private: // Number of characters extracted by the
- streamsize _M_gcount; // most recent unformatted input function.
-
-public:
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
- // If we are using DLL specs, we have not to use inner classes
- // end class declaration here
- typedef _Isentry<_CharT, _Traits> sentry;
-};
-# define sentry _Isentry
-template <class _CharT, class _Traits>
-class _Isentry {
- typedef _Isentry<_CharT, _Traits> _Self;
-# else
- class sentry {
- typedef sentry _Self;
-#endif
-
- private:
- const bool _M_ok;
- // basic_streambuf<_CharT, _Traits>* _M_buf;
-
- public:
- typedef _Traits traits_type;
-
- explicit sentry(basic_istream<_CharT, _Traits>& __istr,
- bool __noskipws = false) :
- _M_ok((__noskipws || !(__istr.flags() & ios_base::skipws)) ? _M_init_noskip(__istr) : _M_init_skip(__istr) )
- /* , _M_buf(__istr.rdbuf()) */
- {}
-
- // Calling this constructor is the same as calling the previous one with
- // __noskipws = true, except that it doesn't require a runtime test.
- sentry(basic_istream<_CharT, _Traits>& __istr, _No_Skip_WS) : /* _M_buf(__istr.rdbuf()), */
- _M_ok(_M_init_noskip(__istr)) {}
-
- ~sentry() {}
-
- operator bool() const { return _M_ok; }
-
- private: // Disable assignment and copy constructor.
- //Implementation is here only to avoid warning with some compilers.
- sentry(const _Self&) : _M_ok(false) {}
- _Self& operator=(const _Self&) { return *this; }
- };
-
-# if defined (_STLP_USE_TEMPLATE_EXPORT)
-# undef sentry
-# else
- // close basic_istream class definition here
-};
-# endif
-
-# if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS _Isentry<char, char_traits<char> >;
-_STLP_EXPORT_TEMPLATE_CLASS basic_istream<char, char_traits<char> >;
-# if ! defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS _Isentry<wchar_t, char_traits<wchar_t> >;
-_STLP_EXPORT_TEMPLATE_CLASS basic_istream<wchar_t, char_traits<wchar_t> >;
-# endif
-# endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-// Non-member character and string extractor functions.
-template <class _CharT, class _Traits>
-inline basic_istream<_CharT, _Traits>& _STLP_CALL
-operator>>(basic_istream<_CharT, _Traits>& __in_str, _CharT& __c) {
- __in_str._M_formatted_get(__c);
- return __in_str;
-}
-
-template <class _Traits>
-inline basic_istream<char, _Traits>& _STLP_CALL
-operator>>(basic_istream<char, _Traits>& __in_str, unsigned char& __c) {
- __in_str._M_formatted_get(__REINTERPRET_CAST(char&,__c));
- return __in_str;
-}
-
-template <class _Traits>
-inline basic_istream<char, _Traits>& _STLP_CALL
-operator>>(basic_istream<char, _Traits>& __in_str, signed char& __c) {
- __in_str._M_formatted_get(__REINTERPRET_CAST(char&,__c));
- return __in_str;
-}
-
-template <class _CharT, class _Traits>
-inline basic_istream<_CharT, _Traits>& _STLP_CALL
-operator>>(basic_istream<_CharT, _Traits>& __in_str, _CharT* __s) {
- __in_str._M_formatted_get(__s);
- return __in_str;
-}
-
-template <class _Traits>
-inline basic_istream<char, _Traits>& _STLP_CALL
-operator>>(basic_istream<char, _Traits>& __in_str, unsigned char* __s) {
- __in_str._M_formatted_get(__REINTERPRET_CAST(char*,__s));
- return __in_str;
-}
-
-template <class _Traits>
-inline basic_istream<char, _Traits>& _STLP_CALL
-operator>>(basic_istream<char, _Traits>& __in_str, signed char* __s) {
- __in_str._M_formatted_get(__REINTERPRET_CAST(char*,__s));
- return __in_str;
-}
-
-//----------------------------------------------------------------------
-// istream manipulator.
-template <class _CharT, class _Traits>
-basic_istream<_CharT, _Traits>& _STLP_CALL
-ws(basic_istream<_CharT, _Traits>& __istr) {
- if (!__istr.eof()) {
- typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
- _Sentry __sentry(__istr, _No_Skip_WS()); // Don't skip whitespace.
- if (__sentry)
- __istr._M_skip_whitespace(false);
- }
- return __istr;
-}
-
-// Helper functions for istream<>::sentry constructor.
-template <class _CharT, class _Traits>
-inline bool _M_init_skip(basic_istream<_CharT, _Traits>& __istr) {
- if (__istr.good()) {
- if (__istr.tie())
- __istr.tie()->flush();
-
- __istr._M_skip_whitespace(true);
- }
-
- if (!__istr.good()) {
- __istr.setstate(ios_base::failbit);
- return false;
- } else
- return true;
-}
-
-template <class _CharT, class _Traits>
-inline bool _M_init_noskip(basic_istream<_CharT, _Traits>& __istr) {
- if (__istr.good()) {
- if (__istr.tie())
- __istr.tie()->flush();
-
- if (!__istr.rdbuf())
- __istr.setstate(ios_base::badbit);
- }
- else
- __istr.setstate(ios_base::failbit);
- return __istr.good();
-}
-
-//----------------------------------------------------------------------
-// Class iostream.
-template <class _CharT, class _Traits>
-class basic_iostream
- : public basic_istream<_CharT, _Traits>,
- public basic_ostream<_CharT, _Traits>
-{
-public:
- typedef basic_ios<_CharT, _Traits> _Basic_ios;
-
- explicit basic_iostream(basic_streambuf<_CharT, _Traits>* __buf);
- virtual ~basic_iostream();
-};
-
-# if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS basic_iostream<char, char_traits<char> >;
-
-# if ! defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS basic_iostream<wchar_t, char_traits<wchar_t> >;
-# endif
-# endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-template <class _CharT, class _Traits>
-basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& __istr)
-{ return __istr.rdbuf(); }
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_istream.c>
-#endif
-
-#endif /* _STLP_INTERNAL_ISTREAM */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_istreambuf_iterator.h b/stl/_istreambuf_iterator.h
deleted file mode 100644
index a1578eb..0000000
--- a/stl/_istreambuf_iterator.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// WARNING: This is an internal header file, included by other C++
-// standard library headers. You should not attempt to use this header
-// file directly.
-
-
-#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
-#define _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
-
-#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
-# include <stl/_iterator_base.h>
-#endif
-
-#ifndef _STLP_INTERNAL_STREAMBUF
-# include <stl/_streambuf.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-// defined in _istream.h
-template <class _CharT, class _Traits>
-extern basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& ) ;
-
-// We do not read any characters until operator* is called. operator* calls sgetc
-// unless the iterator is unchanged from the last call in which case a cached value is
-// used. Calls to operator++ use sbumpc.
-
-template<class _CharT, class _Traits>
-class istreambuf_iterator :
- public iterator<input_iterator_tag, _CharT, typename _Traits::off_type, _CharT*, _CharT&>
-{
-public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef typename _Traits::int_type int_type;
- typedef basic_streambuf<_CharT, _Traits> streambuf_type;
- typedef basic_istream<_CharT, _Traits> istream_type;
-
- typedef input_iterator_tag iterator_category;
- typedef _CharT value_type;
- typedef typename _Traits::off_type difference_type;
- typedef const _CharT* pointer;
- typedef const _CharT& reference;
-
-public:
- istreambuf_iterator(streambuf_type* __p = 0) { this->_M_init(__p); }
- // istreambuf_iterator(basic_istream<_CharT, _Traits>& __is) { this->_M_init(_M_get_istreambuf(__is)); }
- inline istreambuf_iterator(basic_istream<_CharT, _Traits>& __is);
-
- char_type operator*() const { this->_M_getc(); return _M_c; }
- istreambuf_iterator<_CharT, _Traits>& operator++()
- {
- _M_buf->sbumpc();
- _M_have_c = false;
- return *this;
- }
- istreambuf_iterator<_CharT, _Traits> operator++(int);
-
- bool equal(const istreambuf_iterator<_CharT, _Traits>& __i) const {
- if (this->_M_buf)
- this->_M_getc();
- if (__i._M_buf)
- __i._M_getc();
- return this->_M_eof == __i._M_eof;
- }
-
-private:
- void _M_init(streambuf_type* __p) {
- _M_buf = __p;
- _M_eof = (__p == 0);
- _M_have_c = false;
- }
-
- void _M_getc() const {
- if (_M_have_c)
- return;
- int_type __c = _M_buf->sgetc();
-# if !defined (_STLP_NEED_MUTABLE) /* && ! defined (__SUNPRO_CC) */
- _M_c = traits_type::to_char_type(__c);
- _M_eof = traits_type::eq_int_type(__c, traits_type::eof());
- _M_have_c = true;
-# else
- typedef istreambuf_iterator<_CharT,_Traits> _Self;
- _Self* __that = __CONST_CAST(_Self*, this);
- __that->_M_c = __STATIC_CAST(_CharT, traits_type::to_char_type(__c));
- __that->_M_eof = traits_type::eq_int_type(__c, traits_type::eof());
- __that->_M_have_c = true;
-# endif
- }
-
-private:
- streambuf_type* _M_buf;
- mutable _CharT _M_c;
- mutable bool _M_eof;
- mutable bool _M_have_c;
-};
-
-template<class _CharT, class _Traits>
-inline istreambuf_iterator<_CharT, _Traits>::istreambuf_iterator(basic_istream<_CharT, _Traits>& __is)
-{ this->_M_init(_M_get_istreambuf(__is)); }
-
-template<class _CharT, class _Traits>
-inline bool _STLP_CALL operator==(const istreambuf_iterator<_CharT, _Traits>& __x,
- const istreambuf_iterator<_CharT, _Traits>& __y) {
- return __x.equal(__y);
-}
-
-#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-
-template<class _CharT, class _Traits>
-inline bool _STLP_CALL operator!=(const istreambuf_iterator<_CharT, _Traits>& __x,
- const istreambuf_iterator<_CharT, _Traits>& __y) {
- return !__x.equal(__y);
-}
-
-#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
-
-# if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator<char, char_traits<char> >;
-# if defined (INSTANTIATE_WIDE_STREAMS)
-_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator<wchar_t, char_traits<wchar_t> >;
-# endif
-# endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
-template <class _CharT, class _Traits>
-inline input_iterator_tag _STLP_CALL iterator_category(const istreambuf_iterator<_CharT, _Traits>&) { return input_iterator_tag(); }
-template <class _CharT, class _Traits>
-inline streamoff* _STLP_CALL
-distance_type(const istreambuf_iterator<_CharT, _Traits>&) { return (streamoff*)0; }
-template <class _CharT, class _Traits>
-inline _CharT* _STLP_CALL value_type(const istreambuf_iterator<_CharT, _Traits>&) { return (_CharT*)0; }
-# endif
-
-template <class _CharT, class _Traits>
-istreambuf_iterator<_CharT, _Traits>
-istreambuf_iterator<_CharT, _Traits>::operator++(int) {
- _M_getc(); // __tmp should avoid any future actions under
- // underlined buffer---during call of operator *()
- // (due to buffer for *this and __tmp are the same).
- istreambuf_iterator<_CharT, _Traits> __tmp = *this;
- _M_buf->sbumpc();
- _M_have_c = false;
- return __tmp;
-}
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_iterator.h b/stl/_iterator.h
deleted file mode 100644
index ad23faa..0000000
--- a/stl/_iterator.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_ITERATOR_H
-#define _STLP_INTERNAL_ITERATOR_H
-
-#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
-# include <stl/_iterator_base.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-// This is the new version of reverse_iterator, as defined in the
-// draft C++ standard. It relies on the iterator_traits template,
-// which in turn relies on partial specialization. The class
-// reverse_bidirectional_iterator is no longer part of the draft
-// standard, but it is retained for backward compatibility.
-
-template <class _Iterator>
-class reverse_iterator :
- public iterator<typename iterator_traits<_Iterator>::iterator_category,
- typename iterator_traits<_Iterator>::value_type,
- typename iterator_traits<_Iterator>::difference_type,
- typename iterator_traits<_Iterator>::pointer,
- typename iterator_traits<_Iterator>::reference> {
-protected:
- _Iterator current;
- typedef reverse_iterator<_Iterator> _Self;
-public:
- typedef typename iterator_traits<_Iterator>::iterator_category iterator_category;
- typedef typename iterator_traits<_Iterator>::value_type value_type;
- typedef typename iterator_traits<_Iterator>::difference_type difference_type;
- typedef typename iterator_traits<_Iterator>::pointer pointer;
- typedef typename iterator_traits<_Iterator>::reference reference;
- typedef _Iterator iterator_type;
-public:
- reverse_iterator() {}
- explicit reverse_iterator(iterator_type __x) : current(__x) {}
- reverse_iterator(const _Self& __x) : current(__x.current) {}
- _Self& operator = (const _Self& __x) { current = __x.base(); return *this; }
-# if defined (_STLP_MEMBER_TEMPLATES)
- template <class _Iter>
- reverse_iterator(const reverse_iterator<_Iter>& __x) : current(__x.base()) {}
- template <class _Iter>
- _Self& operator = (const reverse_iterator<_Iter>& __x) { current = __x.base(); return *this; }
-# endif /* _STLP_MEMBER_TEMPLATES */
-
- iterator_type base() const { return current; }
- reference operator*() const {
- _Iterator __tmp = current;
- return *--__tmp;
- }
- _STLP_DEFINE_ARROW_OPERATOR
- _Self& operator++() {
- --current;
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- --current;
- return __tmp;
- }
- _Self& operator--() {
- ++current;
- return *this;
- }
- _Self operator--(int) {
- _Self __tmp = *this;
- ++current;
- return __tmp;
- }
-
- _Self operator+(difference_type __n) const { return _Self(current - __n); }
- _Self& operator+=(difference_type __n) {
- current -= __n;
- return *this;
- }
- _Self operator-(difference_type __n) const { return _Self(current + __n); }
- _Self& operator-=(difference_type __n) {
- current += __n;
- return *this;
- }
- reference operator[](difference_type __n) const { return *(*this + __n); }
-};
-
-template <class _Iterator>
-inline bool _STLP_CALL operator==(const reverse_iterator<_Iterator>& __x,
- const reverse_iterator<_Iterator>& __y)
-{ return __x.base() == __y.base(); }
-
-template <class _Iterator>
-inline bool _STLP_CALL operator<(const reverse_iterator<_Iterator>& __x,
- const reverse_iterator<_Iterator>& __y)
-{ return __y.base() < __x.base(); }
-
-# if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
-template <class _Iterator>
-inline bool _STLP_CALL operator!=(const reverse_iterator<_Iterator>& __x,
- const reverse_iterator<_Iterator>& __y)
-{ return !(__x == __y); }
-
-template <class _Iterator>
-inline bool _STLP_CALL operator>(const reverse_iterator<_Iterator>& __x,
- const reverse_iterator<_Iterator>& __y)
-{ return __y < __x; }
-
-template <class _Iterator>
-inline bool _STLP_CALL operator<=(const reverse_iterator<_Iterator>& __x,
- const reverse_iterator<_Iterator>& __y)
-{ return !(__y < __x); }
-
-template <class _Iterator>
-inline bool _STLP_CALL operator>=(const reverse_iterator<_Iterator>& __x,
- const reverse_iterator<_Iterator>& __y)
-{ return !(__x < __y); }
-# endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
-
-template <class _Iterator>
-# if defined (__SUNPRO_CC)
-inline ptrdiff_t _STLP_CALL
-# else
-inline typename reverse_iterator<_Iterator>::difference_type _STLP_CALL
-# endif
-operator-(const reverse_iterator<_Iterator>& __x,
- const reverse_iterator<_Iterator>& __y)
-{ return __y.base() - __x.base(); }
-
-template <class _Iterator, class _DifferenceType>
-inline reverse_iterator<_Iterator> _STLP_CALL
-operator+(_DifferenceType n,const reverse_iterator<_Iterator>& x)
-{ return x.operator+(n); }
-#endif
-
-template <class _Container>
-class back_insert_iterator
- : public iterator<output_iterator_tag, void, void, void, void> {
- typedef back_insert_iterator<_Container> _Self;
-protected:
- //c is a Standard name (24.4.2.1), do no make it STLport naming convention compliant.
- _Container *container;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
-
- explicit back_insert_iterator(_Container& __x) : container(&__x) {}
-
- _Self& operator=(const _Self& __other) {
- container = __other.container;
- return *this;
- }
- _Self& operator=(const typename _Container::value_type& __val) {
- container->push_back(__val);
- return *this;
- }
- _Self& operator*() { return *this; }
- _Self& operator++() { return *this; }
- _Self operator++(int) { return *this; }
-};
-
-template <class _Container>
-inline back_insert_iterator<_Container> _STLP_CALL back_inserter(_Container& __x)
-{ return back_insert_iterator<_Container>(__x); }
-
-template <class _Container>
-class front_insert_iterator
- : public iterator<output_iterator_tag, void, void, void, void> {
- typedef front_insert_iterator<_Container> _Self;
-protected:
- //c is a Standard name (24.4.2.3), do no make it STLport naming convention compliant.
- _Container *container;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- explicit front_insert_iterator(_Container& __x) : container(&__x) {}
-
- _Self& operator=(const _Self& __other) {
- container = __other.container;
- return *this;
- }
- _Self& operator=(const typename _Container::value_type& __val) {
- container->push_front(__val);
- return *this;
- }
- _Self& operator*() { return *this; }
- _Self& operator++() { return *this; }
- _Self operator++(int) { return *this; }
-};
-
-template <class _Container>
-inline front_insert_iterator<_Container> _STLP_CALL front_inserter(_Container& __x)
-{ return front_insert_iterator<_Container>(__x); }
-
-template <class _Container>
-class insert_iterator
- : public iterator<output_iterator_tag, void, void, void, void> {
- typedef insert_iterator<_Container> _Self;
-protected:
- //container is a Standard name (24.4.2.5), do no make it STLport naming convention compliant.
- _Container *container;
- typename _Container::iterator _M_iter;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- insert_iterator(_Container& __x, typename _Container::iterator __i)
- : container(&__x), _M_iter(__i) {}
-
- _Self& operator=(_Self const& __other) {
- container = __other.container;
- _M_iter = __other._M_iter;
- return *this;
- }
- _Self& operator=(const typename _Container::value_type& __val) {
- _M_iter = container->insert(_M_iter, __val);
- ++_M_iter;
- return *this;
- }
- _Self& operator*() { return *this; }
- _Self& operator++() { return *this; }
- _Self& operator++(int) { return *this; }
-};
-
-template <class _Container, class _Iterator>
-inline insert_iterator<_Container> _STLP_CALL
-inserter(_Container& __x, _Iterator __i) {
- typedef typename _Container::iterator __iter;
- return insert_iterator<_Container>(__x, __iter(__i));
-}
-
-_STLP_END_NAMESPACE
-
-#if ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
-# include <stl/_iterator_old.h>
-#endif
-
-#endif /* _STLP_INTERNAL_ITERATOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_iterator_base.h b/stl/_iterator_base.h
deleted file mode 100644
index 75fe492..0000000
--- a/stl/_iterator_base.h
+++ /dev/null
@@ -1,541 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
-#define _STLP_INTERNAL_ITERATOR_BASE_H
-
-#ifndef _STLP_INTERNAL_CSTDDEF
-# include <stl/_cstddef.h>
-#endif
-
-//# if defined (_STLP_IMPORT_VENDOR_CSTD) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
-//_STLP_BEGIN_NAMESPACE
-//using namespace _STLP_VENDOR_CSTD;
-//_STLP_END_NAMESPACE
-//#endif /* _STLP_IMPORT_VENDOR_CSTD */
-
-#if !defined(_STLP_USE_OLD_HP_ITERATOR_QUERIES) && !defined(_STLP_CLASS_PARTIAL_SPECIALIZATION)
-# ifndef _STLP_TYPE_TRAITS_H
-# include <stl/type_traits.h>
-# endif
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-struct input_iterator_tag {};
-struct output_iterator_tag {};
-struct forward_iterator_tag : public input_iterator_tag {};
-struct bidirectional_iterator_tag : public forward_iterator_tag {};
-struct random_access_iterator_tag : public bidirectional_iterator_tag {};
-
-
-template <class _Category, class _Tp, _STLP_DFL_TMPL_PARAM(_Distance,ptrdiff_t),
- _STLP_DFL_TMPL_PARAM(_Pointer,_Tp*), _STLP_DFL_TMPL_PARAM(_Reference,_Tp&) >
-struct iterator {
- typedef _Category iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Pointer pointer;
- typedef _Reference reference;
-};
-_STLP_TEMPLATE_NULL
-struct iterator<output_iterator_tag, void, void, void, void> {
- typedef output_iterator_tag iterator_category;
-#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-#endif
-};
-
-#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
-# define _STLP_ITERATOR_CATEGORY(_It, _Tp) iterator_category(_It)
-# define _STLP_DISTANCE_TYPE(_It, _Tp) distance_type(_It)
-# define _STLP_VALUE_TYPE(_It, _Tp) value_type(_It)
-//Old HP iterator queries do not give information about the iterator
-//associated reference type so we consider that it is not a real reference.
-# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type()
-#else
-# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-# define _STLP_VALUE_TYPE(_It, _Tp) (typename iterator_traits< _Tp >::value_type*)0
-# define _STLP_DISTANCE_TYPE(_It, _Tp) (typename iterator_traits< _Tp >::difference_type*)0
-# if defined (__BORLANDC__) || defined (__SUNPRO_CC) || ( defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || ( defined (__sgi) && defined (_COMPILER_VERSION)) || defined (__DMC__)
-# define _STLP_ITERATOR_CATEGORY(_It, _Tp) iterator_traits< _Tp >::iterator_category()
-# else
-# define _STLP_ITERATOR_CATEGORY(_It, _Tp) typename iterator_traits< _Tp >::iterator_category()
-# endif
-# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) _IsRefType< typename iterator_traits< _Tp >::reference >::_Ret()
-# else
-# define _STLP_ITERATOR_CATEGORY(_It, _Tp) __iterator_category(_It, _IsPtrType<_Tp>::_Ret())
-# define _STLP_DISTANCE_TYPE(_It, _Tp) (ptrdiff_t*)0
-# define _STLP_VALUE_TYPE(_It, _Tp) __value_type(_It, _IsPtrType<_Tp>::_Ret() )
-# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type()
-# endif
-#endif
-
-template <class _Iterator>
-struct iterator_traits {
- typedef typename _Iterator::iterator_category iterator_category;
- typedef typename _Iterator::value_type value_type;
- typedef typename _Iterator::difference_type difference_type;
- typedef typename _Iterator::pointer pointer;
- typedef typename _Iterator::reference reference;
-};
-
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && ! defined (__SUNPRO_CC)
-# define _STLP_DIFFERENCE_TYPE(_Iterator) typename iterator_traits<_Iterator>::difference_type
-#else
-# define _STLP_DIFFERENCE_TYPE(_Iterator) ptrdiff_t
-#endif
-
-#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
-
-// fbp : this order keeps gcc happy
-template <class _Tp>
-struct iterator_traits<const _Tp*> {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef ptrdiff_t difference_type;
- typedef const _Tp* pointer;
- typedef const _Tp& reference;
-};
-
-template <class _Tp>
-struct iterator_traits<_Tp*> {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-# if defined (__BORLANDC__)
-template <class _Tp>
-struct iterator_traits<_Tp* const> {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef ptrdiff_t difference_type;
- typedef const _Tp* pointer;
- typedef const _Tp& reference;
-};
-# endif
-
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || \
- (defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && ! defined (_STLP_NO_ARROW_OPERATOR))
-# define _STLP_POINTERS_SPECIALIZE( _TpP )
-# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); }
-#else
-# include <stl/_ptrs_specialize.h>
-#endif
-
-#ifndef _STLP_USE_OLD_HP_ITERATOR_QUERIES
-// The overloaded functions iterator_category, distance_type, and
-// value_type are not part of the C++ standard. (They have been
-// replaced by struct iterator_traits.) They are included for
-// backward compatibility with the HP STL.
-// We introduce internal names for these functions.
-
-# ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::iterator_category __iterator_category(const _Iter&) {
- typedef typename iterator_traits<_Iter>::iterator_category _Category;
- return _Category();
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::difference_type* __distance_type(const _Iter&) {
- typedef typename iterator_traits<_Iter>::difference_type _diff_type;
- return __STATIC_CAST(_diff_type*,0);
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::value_type* __value_type(const _Iter&) {
- typedef typename iterator_traits<_Iter>::value_type _value_type;
- return __STATIC_CAST(_value_type*,0);
-}
-
-# else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _Iter>
-inline random_access_iterator_tag
-__iterator_category(const _Iter&, const __true_type&) {
- return random_access_iterator_tag();
-}
-
-template <class _Iter>
-inline _STLP_TYPENAME_ON_RETURN_TYPE iterator_traits<_Iter>::iterator_category
-__iterator_category(const _Iter&, const __false_type&) {
- typedef typename iterator_traits<_Iter>::iterator_category _Category;
- return _Category();
-}
-
-
-template <class _Iter>
-inline ptrdiff_t* _STLP_CALL __distance_type(const _Iter&) { return __STATIC_CAST(ptrdiff_t*, 0); }
-
-template <class _Iter>
-inline _STLP_TYPENAME_ON_RETURN_TYPE iterator_traits<_Iter>::value_type*
-__value_type(const _Iter&, const __false_type&) {
- typedef typename iterator_traits<_Iter>::value_type _value_type;
- return __STATIC_CAST(_value_type*,0);
-}
-
-template <class _Tp>
-inline _Tp*
-__value_type(const _Tp*, const __true_type&) {
- return __STATIC_CAST(_Tp*, 0);
-}
-
-# endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-#else /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
-template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
-inline _Category _STLP_CALL iterator_category(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return _Category(); }
-template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
-inline _Tp* _STLP_CALL value_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Tp*, 0); }
-template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
-inline _Distance* _STLP_CALL distance_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Distance*, 0); }
-template <class _Tp>
-inline random_access_iterator_tag _STLP_CALL iterator_category(const _Tp*) { return random_access_iterator_tag(); }
-template <class _Tp>
-inline _Tp* _STLP_CALL value_type(const _Tp*) { return __STATIC_CAST(_Tp*, 0); }
-template <class _Tp>
-inline ptrdiff_t* _STLP_CALL distance_type(const _Tp*) { return __STATIC_CAST(ptrdiff_t*, 0); }
-#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
-
-# if ! defined (_STLP_NO_ANACHRONISMS)
-// The base classes input_iterator, output_iterator, forward_iterator,
-// bidirectional_iterator, and random_access_iterator are not part of
-// the C++ standard. (They have been replaced by struct iterator.)
-// They are included for backward compatibility with the HP STL.
-template <class _Tp, class _Distance> struct input_iterator :
- public iterator <input_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
-struct output_iterator : public iterator <output_iterator_tag, void, void, void, void> {};
-template <class _Tp, class _Distance> struct forward_iterator :
- public iterator<forward_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
-template <class _Tp, class _Distance> struct bidirectional_iterator :
- public iterator<bidirectional_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
-template <class _Tp, class _Distance> struct random_access_iterator :
- public iterator<random_access_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
-
-# if defined (_STLP_BASE_MATCH_BUG) && defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
-template <class _Tp, class _Distance>
-inline input_iterator_tag _STLP_CALL
-iterator_category(const input_iterator<_Tp, _Distance>&) { return input_iterator_tag(); }
-inline output_iterator_tag _STLP_CALL
-iterator_category(const output_iterator&) { return output_iterator_tag(); }
-template <class _Tp, class _Distance>
-inline forward_iterator_tag _STLP_CALL
-iterator_category(const forward_iterator<_Tp, _Distance>&) { return forward_iterator_tag(); }
-template <class _Tp, class _Distance>
-inline bidirectional_iterator_tag _STLP_CALL
-iterator_category(const bidirectional_iterator<_Tp, _Distance>&) { return bidirectional_iterator_tag(); }
-template <class _Tp, class _Distance>
-inline random_access_iterator_tag _STLP_CALL
-iterator_category(const random_access_iterator<_Tp, _Distance>&) { return random_access_iterator_tag(); }
-template <class _Tp, class _Distance>
-inline _Tp* _STLP_CALL value_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
-template <class _Tp, class _Distance>
-inline _Tp* _STLP_CALL value_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
-template <class _Tp, class _Distance>
-inline _Tp* _STLP_CALL value_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
-template <class _Tp, class _Distance>
-inline _Tp* _STLP_CALL value_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
-template <class _Tp, class _Distance>
-inline _Distance* _STLP_CALL distance_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
-template <class _Tp, class _Distance>
-inline _Distance* _STLP_CALL distance_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
-template <class _Tp, class _Distance>
-inline _Distance* _STLP_CALL distance_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0);}
-template <class _Tp, class _Distance>
-inline _Distance* _STLP_CALL distance_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
-# endif /* BASE_MATCH */
-
-#endif /* _STLP_NO_ANACHRONISMS */
-
-template <class _InputIterator, class _Distance>
-inline void _STLP_CALL __distance(const _InputIterator& __first, const _InputIterator& __last,
- _Distance& __n, const input_iterator_tag &) {
- _InputIterator __it(__first);
- while (__it != __last) { ++__it; ++__n; }
-}
-
-
-# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
-template <class _ForwardIterator, class _Distance>
-inline void _STLP_CALL __distance(const _ForwardIterator& __first, const _ForwardIterator& __last,
- _Distance& __n, const forward_iterator_tag &) {
- _ForwardIterator __it(__first);
- while (__it != __last) { ++__first; ++__n; }
-}
-
-template <class _BidirectionalIterator, class _Distance>
-_STLP_INLINE_LOOP void _STLP_CALL __distance(const _BidirectionalIterator& __first,
- const _BidirectionalIterator& __last,
- _Distance& __n, const bidirectional_iterator_tag &) {
- _BidirectionalIterator __it(__first);
- while (__it != __last) { ++__it; ++__n; }
-}
-# endif
-
-template <class _RandomAccessIterator, class _Distance>
-inline void _STLP_CALL __distance(const _RandomAccessIterator& __first,
- const _RandomAccessIterator& __last,
- _Distance& __n, const random_access_iterator_tag &) {
- __n += __last - __first;
-}
-
-#ifndef _STLP_NO_ANACHRONISMS
-template <class _InputIterator, class _Distance>
-inline void _STLP_CALL distance(const _InputIterator& __first,
- const _InputIterator& __last, _Distance& __n) {
- __distance(__first, __last, __n, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
-}
-#endif
-
-template <class _InputIterator>
-inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
-__distance(const _InputIterator& __first, const _InputIterator& __last, const input_iterator_tag &) {
- _STLP_DIFFERENCE_TYPE(_InputIterator) __n = 0;
- _InputIterator __it(__first);
- while (__it != __last) {
- ++__it; ++__n;
- }
- return __n;
-}
-
-# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
-template <class _ForwardIterator>
-inline _STLP_DIFFERENCE_TYPE(_ForwardIterator) _STLP_CALL
-__distance(const _ForwardIterator& __first, const _ForwardIterator& __last,
- const forward_iterator_tag &)
-{
- _STLP_DIFFERENCE_TYPE(_ForwardIterator) __n = 0;
- _ForwardIterator __it(__first);
- while (__it != __last) {
- ++__it; ++__n;
- }
- return __n;
-
-}
-
-template <class _BidirectionalIterator>
-_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) _STLP_CALL
-__distance(const _BidirectionalIterator& __first,
- const _BidirectionalIterator& __last,
- const bidirectional_iterator_tag &) {
- _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) __n = 0;
- _BidirectionalIterator __it(__first);
- while (__it != __last) {
- ++__it; ++__n;
- }
- return __n;
-}
-# endif
-
-template <class _RandomAccessIterator>
-inline _STLP_DIFFERENCE_TYPE(_RandomAccessIterator) _STLP_CALL
-__distance(const _RandomAccessIterator& __first, const _RandomAccessIterator& __last,
- const random_access_iterator_tag &) {
- return __last - __first;
-}
-
-template <class _InputIterator>
-inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
-distance(_InputIterator __first, _InputIterator __last) {
- return __distance(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
-}
-
-// fbp: those are being used for iterator/const_iterator definitions everywhere
-template <class _Tp>
-struct _Nonconst_traits;
-
-template <class _Tp>
-struct _Const_traits {
- typedef _Tp value_type;
- typedef const _Tp& reference;
- typedef const _Tp* pointer;
- typedef _Const_traits<_Tp> _ConstTraits;
- typedef _Nonconst_traits<_Tp> _NonConstTraits;
-};
-
-template <class _Tp>
-struct _Nonconst_traits {
- typedef _Tp value_type;
- typedef _Tp& reference;
- typedef _Tp* pointer;
- typedef _Const_traits<_Tp> _ConstTraits;
- typedef _Nonconst_traits<_Tp> _NonConstTraits;
-};
-
-/*
- * dums: A special iterator/const_iterator traits for set and multiset for which even
- * the iterator is not mutable
- */
-template <class _Tp>
-struct _Nonconst_Const_traits;
-
-template <class _Tp>
-struct _Const_Const_traits {
- typedef _Tp value_type;
- typedef const _Tp& reference;
- typedef const _Tp* pointer;
- typedef _Const_Const_traits<_Tp> _ConstTraits;
- typedef _Nonconst_Const_traits<_Tp> _NonConstTraits;
-};
-
-template <class _Tp>
-struct _Nonconst_Const_traits {
- typedef _Tp value_type;
- typedef const _Tp& reference;
- typedef const _Tp* pointer;
- typedef _Const_Const_traits<_Tp> _ConstTraits;
- typedef _Nonconst_Const_traits<_Tp> _NonConstTraits;
-};
-
-/*
- * A macro to generate a new iterator traits from one of the
- * previous one. Changing the iterator traits type make iterators
- * from different containers not comparable.
- */
-#define _STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits) \
-template <class _Tp> \
-struct _##Motif; \
-template <class _Tp> \
-struct _Const##Motif : public _STLP_STD::_Const_##Traits<_Tp> { \
- typedef _Const##Motif<_Tp> _ConstTraits; \
- typedef _##Motif<_Tp> _NonConstTraits; \
-}; \
-template <class _Tp> \
-struct _##Motif : public _STLP_STD::_Nonconst_##Traits<_Tp> { \
- typedef _Const##Motif<_Tp> _ConstTraits; \
- typedef _##Motif<_Tp> _NonConstTraits; \
-};
-
-#define _STLP_CREATE_ITERATOR_TRAITS(Motif, Traits) \
-_STLP_MOVE_TO_PRIV_NAMESPACE \
-_STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits) \
-_STLP_MOVE_TO_STD_NAMESPACE
-
-#define _STLP_CREATE_HASH_ITERATOR_TRAITS(Motif, Traits) \
-_STLP_MOVE_TO_PRIV_NAMESPACE \
-_STLP_CREATE_ITERATOR_TRAITS_BASE(NonLocal##Motif, Traits) \
-_STLP_CREATE_ITERATOR_TRAITS_BASE(Local##Motif, Traits) \
-template <class _Tp> \
-struct _##Motif { \
- typedef _ConstNonLocal##Motif<_Tp> _ConstTraits; \
- typedef _NonLocal##Motif<_Tp> _NonConstTraits; \
- typedef _ConstLocal##Motif<_Tp> _ConstLocalTraits; \
- typedef _Local##Motif<_Tp> _NonConstLocalTraits; \
-}; \
-_STLP_MOVE_TO_STD_NAMESPACE
-
-/*
-# if defined (_STLP_BASE_TYPEDEF_BUG)
-// this workaround is needed for SunPro 4.0.1
-template <class _Traits>
-struct __cnst_traits_aux : private _Traits {
- typedef typename _Traits::value_type value_type;
-};
-# define __TRAITS_VALUE_TYPE(_Traits) __cnst_traits_aux<_Traits>::value_type
-# else
-# define __TRAITS_VALUE_TYPE(_Traits) _Traits::value_type
-# endif
-*/
-
-#if defined (_STLP_MSVC)
-// MSVC specific
-template <class _InputIterator, class _Dist>
-inline void _STLP_CALL _Distance(_InputIterator __first,
- _InputIterator __last, _Dist& __n) {
- __distance(__first, __last, __n, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
-}
-#endif
-
-template <class _InputIter, class _Distance>
-_STLP_INLINE_LOOP void _STLP_CALL
-__advance(_InputIter& __i, _Distance __n, const input_iterator_tag &) {
- while (__n--) ++__i;
-}
-
-// fbp : added output iterator tag variant
-template <class _InputIter, class _Distance>
-_STLP_INLINE_LOOP void _STLP_CALL
-__advance(_InputIter& __i, _Distance __n, const output_iterator_tag &) {
- while (__n--) ++__i;
-}
-
-#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
-template <class _ForwardIterator, class _Distance>
-_STLP_INLINE_LOOP void _STLP_CALL
-__advance(_ForwardIterator& i, _Distance n, const forward_iterator_tag &) {
- while (n--) ++i;
-}
-#endif
-
-template <class _BidirectionalIterator, class _Distance>
-_STLP_INLINE_LOOP void _STLP_CALL
-__advance(_BidirectionalIterator& __i, _Distance __n,
- const bidirectional_iterator_tag &) {
- if (__n > 0)
- while (__n--) ++__i;
- else
- while (__n++) --__i;
-}
-
-template <class _RandomAccessIterator, class _Distance>
-inline void _STLP_CALL
-__advance(_RandomAccessIterator& __i, _Distance __n,
- const random_access_iterator_tag &) {
- __i += __n;
-}
-
-template <class _InputIterator, class _Distance>
-inline void _STLP_CALL advance(_InputIterator& __i, _Distance __n) {
- __advance(__i, __n, _STLP_ITERATOR_CATEGORY(__i, _InputIterator));
-}
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_H)
-# include <stl/debug/_debug.h>
-#endif
-
-#endif /* _STLP_INTERNAL_ITERATOR_BASE_H */
-
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_iterator_old.h b/stl/_iterator_old.h
deleted file mode 100644
index d20a11f..0000000
--- a/stl/_iterator_old.h
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_ITERATOR_OLD_H
-#define _STLP_INTERNAL_ITERATOR_OLD_H
-
-#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
-# include <stl/_iterator_base.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
-
-template <class _Container>
-inline output_iterator_tag _STLP_CALL
-iterator_category(const back_insert_iterator<_Container>&) { return output_iterator_tag(); }
-template <class _Container>
-inline output_iterator_tag _STLP_CALL
-iterator_category(const front_insert_iterator<_Container>&) { return output_iterator_tag(); }
-template <class _Container>
-inline output_iterator_tag _STLP_CALL
-iterator_category(const insert_iterator<_Container>&) { return output_iterator_tag(); }
-
-# endif
-
-# if defined (_STLP_MSVC50_COMPATIBILITY)
-# define __Reference _Reference, class _Pointer
-# define Reference__ _Reference, _Pointer
-template <class _BidirectionalIterator, class _Tp,
- _STLP_DFL_TMPL_PARAM(_Reference, _Tp& ),
- _STLP_DFL_TMPL_PARAM(_Pointer, _Tp*),
- _STLP_DFL_TYPE_PARAM(_Distance, ptrdiff_t)>
-# else
-# define __Reference _Reference
-# define Reference__ _Reference
-template <class _BidirectionalIterator, class _Tp, _STLP_DFL_TMPL_PARAM(_Reference, _Tp& ),
- _STLP_DFL_TYPE_PARAM(_Distance, ptrdiff_t)>
-# endif
-class reverse_bidirectional_iterator {
- typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
- Reference__, _Distance> _Self;
- // friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& x, const _Self& y);
-protected:
- _BidirectionalIterator current;
-public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
-# if defined (_STLP_MSVC50_COMPATIBILITY)
- typedef _Pointer pointer;
-# else
- typedef _Tp* pointer;
-# endif
- typedef _Reference reference;
-
- reverse_bidirectional_iterator() {}
- explicit reverse_bidirectional_iterator(_BidirectionalIterator __x)
- : current(__x) {}
- _BidirectionalIterator base() const { return current; }
- _Reference operator*() const {
- _BidirectionalIterator __tmp = current;
- return *(--__tmp);
- }
-# if !(defined _STLP_NO_ARROW_OPERATOR)
- _STLP_DEFINE_ARROW_OPERATOR
-# endif
- _Self& operator++() {
- --current;
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- --current;
- return __tmp;
- }
- _Self& operator--() {
- ++current;
- return *this;
- }
- _Self operator--(int) {
- _Self __tmp = *this;
- ++current;
- return __tmp;
- }
-};
-
-# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
-template <class _BidirectionalIterator, class _Tp, class __Reference,
- class _Distance>
-inline bidirectional_iterator_tag _STLP_CALL
-iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
-{ return bidirectional_iterator_tag(); }
-template <class _BidirectionalIterator, class _Tp, class __Reference,
- class _Distance>
-inline _Tp* _STLP_CALL
-value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
-{ return (_Tp*) 0; }
-template <class _BidirectionalIterator, class _Tp, class __Reference,
- class _Distance>
-inline _Distance* _STLP_CALL
-distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
-{ return (_Distance*) 0; }
-#endif
-
-template <class _BidirectionalIterator, class _Tp, class __Reference,
- class _Distance>
-inline bool _STLP_CALL operator==(
- const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
- Reference__, _Distance>& __x,
- const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
- Reference__, _Distance>& __y)
-{
- return __x.base() == __y.base();
-}
-
-#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-
-template <class _BiIter, class _Tp, class __Reference, class _Distance>
-inline bool _STLP_CALL operator!=(
- const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __x,
- const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __y)
-{
- return !(__x == __y);
-}
-
-#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
-
-#if ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION )
-
-// This is the old version of reverse_iterator, as found in the original
-// HP STL. It does not use partial specialization.
-
-template <class _RandomAccessIterator,
-# if defined (__MSL__) && (__MSL__ >= 0x2405) \
- || defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)) //*ty 03/22/2001 - give the default to the secont param under MPW.
- // I believe giving the default will cause any harm even though the 2nd type parameter
- // still have to be provided for T* type iterators.
- _STLP_DFL_TMPL_PARAM(_Tp,iterator_traits<_RandomAccessIterator>::value_type),
-# else
- class _Tp,
-#endif
- _STLP_DFL_TMPL_PARAM(_Reference,_Tp&),
-# if defined (_STLP_MSVC50_COMPATIBILITY)
- _STLP_DFL_TMPL_PARAM(_Pointer, _Tp*),
-# endif
- _STLP_DFL_TYPE_PARAM(_Distance,ptrdiff_t)>
-class reverse_iterator {
- typedef reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>
- _Self;
-protected:
- _RandomAccessIterator __current;
-public:
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
-# if defined (_STLP_MSVC50_COMPATIBILITY)
- typedef _Pointer pointer;
-# else
- typedef _Tp* pointer;
-# endif
- typedef _Reference reference;
-
- reverse_iterator() {}
- reverse_iterator(const _Self& __x) : __current(__x.base()) {}
- explicit reverse_iterator(_RandomAccessIterator __x) : __current(__x) {}
- _Self& operator=(const _Self& __x) {__current = __x.base(); return *this; }
-
- _RandomAccessIterator base() const { return __current; }
- _Reference operator*() const { return *(__current - (difference_type)1); }
-
-# if !(defined _STLP_NO_ARROW_OPERATOR)
- _STLP_DEFINE_ARROW_OPERATOR
-# endif
-
- _Self& operator++() {
- --__current;
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- --__current;
- return __tmp;
- }
- _Self& operator--() {
- ++__current;
- return *this;
- }
- _Self operator--(int) {
- _Self __tmp = *this;
- ++__current;
- return __tmp;
- }
- _Self operator+(_Distance __n) const {
- return _Self(__current - __n);
- }
- _Self& operator+=(_Distance __n) {
- __current -= __n;
- return *this;
- }
- _Self operator-(_Distance __n) const {
- return _Self(__current + __n);
- }
- _Self& operator-=(_Distance __n) {
- __current += __n;
- return *this;
- }
- _Reference operator[](_Distance __n) const { return *(*this + __n); }
-};
-
-# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
-template <class _RandomAccessIterator, class _Tp,
- class __Reference, class _Distance>
-inline random_access_iterator_tag _STLP_CALL
-iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
-{ return random_access_iterator_tag(); }
-template <class _RandomAccessIterator, class _Tp,
- class __Reference, class _Distance>
-inline _Tp* _STLP_CALL value_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
-{ return (_Tp*) 0; }
-template <class _RandomAccessIterator, class _Tp,
- class __Reference, class _Distance>
-inline _Distance* _STLP_CALL
-distance_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
-{ return (_Distance*) 0; }
-#endif
-
-template <class _RandomAccessIterator, class _Tp,
- class __Reference, class _Distance>
-inline bool _STLP_CALL
-operator==(const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __y)
-{
- return __x.base() == __y.base();
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class __Reference, class _Distance>
-inline bool _STLP_CALL
-operator<(const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __y)
-{
- return __y.base() < __x.base();
-}
-
-#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-
-template <class _RandomAccessIterator, class _Tp,
- class __Reference, class _Distance>
-inline bool _STLP_CALL
-operator!=(const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __y) {
- return !(__x == __y);
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class __Reference, class _Distance>
-inline bool _STLP_CALL
-operator>(const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __y) {
- return __y < __x;
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class __Reference, class _Distance>
-inline bool _STLP_CALL
-operator<=(const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __y) {
- return !(__y < __x);
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class __Reference, class _Distance>
-inline bool _STLP_CALL
-operator>=(const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __y) {
- return !(__x < __y);
-}
-
-#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
-
-template <class _RandomAccessIterator, class _Tp,
- class __Reference, class _Distance>
-inline _Distance _STLP_CALL
-operator-(const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __y)
-{
- return __y.base() - __x.base();
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class __Reference, class _Distance>
-inline reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance> _STLP_CALL
-operator+(_Distance __n,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>& __x)
-{
- return reverse_iterator<_RandomAccessIterator, _Tp,
- Reference__, _Distance>(__x.base() - __n);
-}
-
-#endif /* ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_ITERATOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_limits.c b/stl/_limits.c
deleted file mode 100644
index f56489b..0000000
--- a/stl/_limits.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Copyright (c) 1998,1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_LIMITS_C
-#define _STLP_LIMITS_C
-
-#ifndef _STLP_INTERNAL_LIMITS
-# include <stl/_limits.h>
-#endif
-
-//==========================================================
-// numeric_limits static members
-//==========================================================
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-#if !defined (_STLP_STATIC_CONST_INIT_BUG)
-
-# define __declare_numeric_base_member(__type, __mem, _Init) \
-template <class __number> \
- const __type _Numeric_limits_base<__number>:: __mem
-
-__declare_numeric_base_member(bool, is_specialized, false);
-__declare_numeric_base_member(int, digits, 0);
-__declare_numeric_base_member(int, digits10, 0);
-__declare_numeric_base_member(bool, is_signed, false);
-__declare_numeric_base_member(bool, is_integer, false);
-__declare_numeric_base_member(bool, is_exact, false);
-__declare_numeric_base_member(int, radix, 0);
-__declare_numeric_base_member(int, min_exponent, 0);
-__declare_numeric_base_member(int, max_exponent, 0);
-__declare_numeric_base_member(int, min_exponent10, 0);
-__declare_numeric_base_member(int, max_exponent10, 0);
-__declare_numeric_base_member(bool, has_infinity, false);
-__declare_numeric_base_member(bool, has_quiet_NaN, false);
-__declare_numeric_base_member(bool, has_signaling_NaN, false);
-__declare_numeric_base_member(float_denorm_style, has_denorm, denorm_absent);
-__declare_numeric_base_member(bool, has_denorm_loss, false);
-__declare_numeric_base_member(bool, is_iec559, false);
-__declare_numeric_base_member(bool, is_bounded, false);
-__declare_numeric_base_member(bool, is_modulo, false);
-__declare_numeric_base_member(bool, traps, false);
-__declare_numeric_base_member(bool, tinyness_before, false);
-__declare_numeric_base_member(float_round_style, round_style, round_toward_zero);
-
-# undef __declare_numeric_base_member
-
-# define __declare_integer_limits_member(__type, __mem, _Init) \
-template <class _Int, _STLP_LIMITS_MIN_TYPE __imin, _STLP_LIMITS_MAX_TYPE __imax, int __idigits, bool __ismod> \
- const __type _Integer_limits<_Int, __imin, __imax, __idigits, __ismod>:: __mem
-
-__declare_integer_limits_member(bool, is_specialized, true);
-__declare_integer_limits_member(int, digits, (__idigits < 0) ? \
- ((int)((sizeof(_Int) * (CHAR_BIT))) - ((__imin == 0) ? 0 : 1)) \
- : (__idigits) );
-__declare_integer_limits_member(int, digits10, (int)(301UL * digits) /1000);
-__declare_integer_limits_member(bool, is_signed, __imin != 0);
-__declare_integer_limits_member(bool, is_integer, true);
-__declare_integer_limits_member(bool, is_exact, true);
-__declare_integer_limits_member(int, radix, 2);
-__declare_integer_limits_member(bool, is_bounded, true);
-__declare_integer_limits_member(bool, is_modulo, true);
-# undef __declare_integer_limits_member
-
-# define __declare_float_limits_member(__type, __mem, _Init) \
-template <class __number, \
- int __Digits, int __Digits10, \
- int __MinExp, int __MaxExp, \
- int __MinExp10, int __MaxExp10, \
- bool __IsIEC559, \
- float_round_style __RoundStyle> \
-const __type _Floating_limits< __number, __Digits, __Digits10, \
- __MinExp, __MaxExp, __MinExp10, __MaxExp10, \
- __IsIEC559, __RoundStyle>::\
- __mem
-
-__declare_float_limits_member(bool, is_specialized, true);
-__declare_float_limits_member(int, digits, __Digits);
-__declare_float_limits_member(int, digits10, __Digits10);
-__declare_float_limits_member(bool, is_signed, true);
-__declare_float_limits_member(int, radix, FLT_RADIX);
-__declare_float_limits_member(int, min_exponent, __MinExp);
-__declare_float_limits_member(int, max_exponent, __MaxExp);
-__declare_float_limits_member(int, min_exponent10, __MinExp10);
-__declare_float_limits_member(int, max_exponent10, __MaxExp10);
-__declare_float_limits_member(bool, has_infinity, true);
-__declare_float_limits_member(bool, has_quiet_NaN, true);
-__declare_float_limits_member(bool, has_signaling_NaN, true);
-__declare_float_limits_member(float_denorm_style, has_denorm, denorm_indeterminate);
-__declare_float_limits_member(bool, has_denorm_loss, false);
-__declare_float_limits_member(bool, is_iec559, __IsIEC559);
-__declare_float_limits_member(bool, is_bounded, true);
-__declare_float_limits_member(bool, traps, true);
-__declare_float_limits_member(bool, tinyness_before, false);
-__declare_float_limits_member(float_round_style, round_style, __RoundStyle);
-# undef __declare_float_limits_member
-
-#endif /* _STLP_STATIC_CONST_INIT_BUG */
-
-
-#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
-
-# if defined (_STLP_BIG_ENDIAN)
-# if defined (__OS400__)
-# define _STLP_FLOAT_INF_REP { 0x7f80, 0 }
-# define _STLP_FLOAT_QNAN_REP { 0xffc0, 0 }
-# define _STLP_FLOAT_SNAN_REP { 0xff80, 0 }
-# define _STLP_DOUBLE_INF_REP { 0x7ff0, 0, 0, 0 }
-# define _STLP_DOUBLE_QNAN_REP { 0xfff8, 0, 0, 0 }
-# define _STLP_DOUBLE_SNAN_REP { 0xfff0, 0, 0, 0 }
-# define _STLP_LDOUBLE_INF_REP { 0x7ff0, 0, 0, 0, 0, 0, 0, 0 }
-# define _STLP_LDOUBLE_QNAN_REP { 0xfff8, 0, 0, 0, 0, 0, 0, 0 }
-# define _STLP_LDOUBLE_SNAN_REP { 0xfff0, 0, 0, 0, 0, 0, 0, 0 }
-# else /* __OS400__ */
-# define _STLP_FLOAT_INF_REP { 0x7f80, 0 }
-# define _STLP_FLOAT_QNAN_REP { 0x7fc1, 0 }
-# define _STLP_FLOAT_SNAN_REP { 0x7f81, 0 }
-# define _STLP_DOUBLE_INF_REP { 0x7ff0, 0, 0, 0 }
-# define _STLP_DOUBLE_QNAN_REP { 0x7ff9, 0, 0, 0 }
-# define _STLP_DOUBLE_SNAN_REP { 0x7ff1, 0, 0, 0 }
-# define _STLP_LDOUBLE_INF_REP { 0x7ff0, 0, 0, 0, 0, 0, 0, 0 }
-# define _STLP_LDOUBLE_QNAN_REP { 0x7ff1, 0, 0, 0, 0, 0, 0, 0 }
-# define _STLP_LDOUBLE_SNAN_REP { 0x7ff9, 0, 0, 0, 0, 0, 0, 0 }
-# endif /* __OS400__ */
-
-# elif defined (_STLP_LITTLE_ENDIAN)
-
-# if 0 /* defined(_STLP_MSVC) || defined(__linux__) */
-// some IA-32 platform ??
-/*
-# define _STLP_FLOAT_INF_REP { 0, 0x7f80 }
-# define _STLP_FLOAT_QNAN_REP { 0, 0xffc0 }
-# define _STLP_FLOAT_SNAN_REP { 0, 0xff80 }
-
-# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 }
-# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0xfff8 }
-# define _STLP_DOUBLE_SNAN_REP { 0, 0, 0, 0xfff0 }
-# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x7FF0, 0 } // ????
-# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xFFF8, 0 } // ????
-# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xFFF0, 0 } // ????
-*/
-# elif defined(__DECCXX)
-
-# define _STLP_FLOAT_INF_REP { 0, 0x7f80 }
-# define _STLP_FLOAT_QNAN_REP { 0, 0xffc0 }
-# define _STLP_FLOAT_SNAN_REP { 0x5555, 0x7f85 }
-
-# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 }
-# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0xfff8 }
-# define _STLP_DOUBLE_SNAN_REP { 0x5555, 0x5555, 0x5555, 0x7ff5 }
-
-# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0, 0, 0, 0, 0x7fff }
-# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0, 0, 0, 0x8000, 0xffff }
-# define _STLP_LDOUBLE_SNAN_REP { 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x7fff}
-# else
-# define _STLP_FLOAT_INF_REP { 0, 0x7f80 }
-# define _STLP_FLOAT_QNAN_REP { 0, 0x7fc0 }
-# define _STLP_FLOAT_SNAN_REP { 0, 0x7fa0 }
-# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 }
-# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0x7ff8 }
-# define _STLP_DOUBLE_SNAN_REP { 0, 0, 0, 0x7ff4 }
-# if defined (_STLP_MSVC) || defined (__ICL)
-# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x7FF0, 0 }
-# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xFFF8, 0 }
-# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xFFF8, 0 }
-# elif defined (__BORLANDC__)
-# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff }
-# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xc000, 0x7fff }
-# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xa000, 0x7fff }
-# else
-# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff, 0 }
-# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xa000, 0x7fff, 0 }
-# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xc000, 0x7fff, 0 }
-# endif
-# endif
-# else
-/* This is an architecture we don't know how to handle. Return some
-obviously wrong values. */
-# define _STLP_FLOAT_INF_REP { 0, 0 }
-# define _STLP_FLOAT_QNAN_REP { 0, 0 }
-# define _STLP_FLOAT_SNAN_REP { 0, 0 }
-# define _STLP_DOUBLE_INF_REP { 0, 0 }
-# define _STLP_DOUBLE_QNAN_REP { 0, 0 }
-# define _STLP_DOUBLE_SNAN_REP { 0, 0 }
-# define _STLP_LDOUBLE_INF_REP { 0 }
-# define _STLP_LDOUBLE_QNAN_REP { 0 }
-# define _STLP_LDOUBLE_SNAN_REP { 0 }
-
-# endif
-
-# if 0
-/*
-# if defined(_STLP_BIG_ENDIAN)
-
-# elif defined (_STLP_LITTLE_ENDIAN)
-# else
-
-//This is an architecture we don't know how to handle. Return some
-//obviously wrong values.
-# define _STLP_FLOAT_INF_REP { 0, 0 }
-# define _STLP_FLOAT_QNAN_REP { 0, 0 }
-# define _STLP_FLOAT_SNAN_REP { 0, 0 }
-# define _STLP_DOUBLE_INF_REP { 0, 0 }
-# define _STLP_DOUBLE_QNAN_REP { 0, 0 }
-# define _STLP_DOUBLE_SNAN_REP { 0, 0 }
-# define _STLP_LDOUBLE_INF_REP { 0 }
-# define _STLP_LDOUBLE_QNAN_REP { 0 }
-# define _STLP_LDOUBLE_SNAN_REP { 0 }
-# endif
-*/
-# endif
-
-union _F_rep {
- unsigned short rep[2];
- float val;
-};
-union _D_rep {
- unsigned short rep[4];
- double val;
-};
-
-# ifndef _STLP_NO_LONG_DOUBLE
-union _LD_rep {
- unsigned short rep[8];
- long double val;
-};
-# endif
-
-template <class __dummy>
-float _STLP_CALL _LimG<__dummy>::get_F_inf() {
- _F_rep _F_inf = {_STLP_FLOAT_INF_REP};
- return _F_inf.val;
-}
-template <class __dummy>
-float _STLP_CALL _LimG<__dummy>::get_F_qNaN() {
- _F_rep _F_qNaN = {_STLP_FLOAT_QNAN_REP};
- return _F_qNaN.val;
-}
-template <class __dummy>
-float _STLP_CALL _LimG<__dummy>::get_F_sNaN() {
- _F_rep _F_sNaN = {_STLP_FLOAT_SNAN_REP};
- return _F_sNaN.val;
-}
-
-template <class __dummy>
-double _STLP_CALL _LimG<__dummy>::get_D_inf() {
- _D_rep _D_inf = {_STLP_DOUBLE_INF_REP};
- return _D_inf.val;
-}
-template <class __dummy>
-double _STLP_CALL _LimG<__dummy>::get_D_qNaN() {
- _D_rep _D_qNaN = {_STLP_DOUBLE_QNAN_REP};
- return _D_qNaN.val;
-}
-template <class __dummy>
-double _STLP_CALL _LimG<__dummy>::get_D_sNaN() {
- _D_rep _D_sNaN = {_STLP_DOUBLE_SNAN_REP};
- return _D_sNaN.val;
-}
-
-# if !defined (_STLP_NO_LONG_DOUBLE)
-template <class __dummy>
-long double _STLP_CALL _LimG<__dummy>::get_LD_inf() {
- _LD_rep _LD_inf = {_STLP_LDOUBLE_INF_REP};
- return _LD_inf.val;
-}
-template <class __dummy>
-long double _STLP_CALL _LimG<__dummy>::get_LD_qNaN() {
- _LD_rep _LD_qNaN = {_STLP_LDOUBLE_QNAN_REP};
- return _LD_qNaN.val;
-}
-template <class __dummy>
-long double _STLP_CALL _LimG<__dummy>::get_LD_sNaN() {
- _LD_rep _LD_sNaN = {_STLP_LDOUBLE_SNAN_REP};
- return _LD_sNaN.val;
-}
-# endif /* _STLP_NO_LONG_DOUBLE */
-
-#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
-
-#undef _STLP_LIMITS_MIN_TYPE
-#undef _STLP_LIMITS_MAX_TYPE
-
-#undef _STLP_FLOAT_INF_REP
-#undef _STLP_FLOAT_QNAN_REP
-#undef _STLP_FLOAT_SNAN_REP
-#undef _STLP_DOUBLE_INF_REP
-#undef _STLP_DOUBLE_QNAN_REP
-#undef _STLP_DOUBLE_SNAN_REP
-#undef _STLP_LDOUBLE_INF_REP
-#undef _STLP_LDOUBLE_QNAN_REP
-#undef _STLP_LDOUBLE_SNAN_REP
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_LIMITS_C_INCLUDED */
diff --git a/stl/_limits.h b/stl/_limits.h
deleted file mode 100644
index 0d4202d..0000000
--- a/stl/_limits.h
+++ /dev/null
@@ -1,538 +0,0 @@
-/*
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This may be not portable code. Parts of numeric_limits<> are
- * inherently machine-dependent. At present this file is suitable
- * for the MIPS, SPARC, Alpha and ia32 architectures.
- */
-
-#ifndef _STLP_INTERNAL_LIMITS
-#define _STLP_INTERNAL_LIMITS
-
-#ifndef _STLP_CLIMITS
-# include <climits>
-#endif
-
-#ifndef _STLP_CFLOAT
-# include <cfloat>
-#endif
-
-#if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR)
-# include <stl/_cwchar.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-enum float_round_style {
- round_indeterminate = -1,
- round_toward_zero = 0,
- round_to_nearest = 1,
- round_toward_infinity = 2,
- round_toward_neg_infinity = 3
-};
-
-enum float_denorm_style {
- denorm_indeterminate = -1,
- denorm_absent = 0,
- denorm_present = 1
-};
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// Base class for all specializations of numeric_limits.
-template <class __number>
-class _Numeric_limits_base {
-public:
-
- static __number (_STLP_CALL min)() _STLP_NOTHROW { return __number(); }
- static __number (_STLP_CALL max)() _STLP_NOTHROW { return __number(); }
-
-#if defined ( _STLP_STATIC_CONST_INIT_BUG)
- enum {
-#else
- static const int
-#endif
-
- digits = 0,
- digits10 = 0,
- radix = 0,
- min_exponent = 0,
- min_exponent10 = 0,
- max_exponent = 0,
- max_exponent10 = 0
-
-#if defined ( _STLP_STATIC_CONST_INIT_BUG)
- ,
- has_denorm = denorm_absent,
- round_style = round_toward_zero,
-#else
- ;
- static const float_denorm_style has_denorm = denorm_absent;
- static const float_round_style round_style = round_toward_zero;
- static const bool
-#endif
-
- is_specialized = false,
- is_signed = false,
- is_integer = false,
- is_exact = false,
- has_infinity = false,
- has_quiet_NaN = false,
- has_signaling_NaN = false,
- has_denorm_loss = false,
- is_iec559 = false,
- is_bounded = false,
- is_modulo = false,
- traps = false,
- tinyness_before = false
-#if defined ( _STLP_STATIC_CONST_INIT_BUG)
- }
-#endif
- ;
-
- static __number _STLP_CALL epsilon() _STLP_NOTHROW { return __number(); }
- static __number _STLP_CALL round_error() _STLP_NOTHROW { return __number(); }
-
- static __number _STLP_CALL infinity() _STLP_NOTHROW { return __number(); }
- static __number _STLP_CALL quiet_NaN() _STLP_NOTHROW { return __number(); }
- static __number _STLP_CALL signaling_NaN() _STLP_NOTHROW { return __number(); }
- static __number _STLP_CALL denorm_min() _STLP_NOTHROW { return __number(); }
-};
-
-// Base class for integers.
-
-#ifdef _STLP_LIMITED_DEFAULT_TEMPLATES
-# ifdef _STLP_LONG_LONG
-# define _STLP_LIMITS_MIN_TYPE _STLP_LONG_LONG
-# define _STLP_LIMITS_MAX_TYPE unsigned _STLP_LONG_LONG
-# else
-# define _STLP_LIMITS_MIN_TYPE long
-# define _STLP_LIMITS_MAX_TYPE unsigned long
-# endif
-#else
-# define _STLP_LIMITS_MIN_TYPE _Int
-# define _STLP_LIMITS_MAX_TYPE _Int
-#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
-
-template <class _Int,
- _STLP_LIMITS_MIN_TYPE __imin,
- _STLP_LIMITS_MAX_TYPE __imax,
- int __idigits, bool __ismod>
-class _Integer_limits : public _Numeric_limits_base<_Int> {
-public:
-
- static _Int (_STLP_CALL min) () _STLP_NOTHROW { return (_Int)__imin; }
- static _Int (_STLP_CALL max) () _STLP_NOTHROW { return (_Int)__imax; }
-
-#if defined (_STLP_STATIC_CONST_INIT_BUG)
- enum {
-#else
- static const int
-#endif
- digits = (__idigits < 0) ?
- ((int)((sizeof(_Int) * (CHAR_BIT))) - ((__imin == 0) ? 0 : 1))
- : (__idigits),
- digits10 = (digits * 301UL) / 1000,
- radix = 2
-#if !defined (_STLP_STATIC_CONST_INIT_BUG)
- ;
- static const bool
-#else
- ,
-#endif
- is_specialized = true,
- is_signed = (__imin != 0),
- is_integer = true,
- is_exact = true,
- is_bounded = true,
- is_modulo = __ismod
-#if defined ( _STLP_STATIC_CONST_INIT_BUG)
- }
-#endif
- ;
-};
-
-// Base class for floating-point numbers.
-template <class __number,
- int __Digits, int __Digits10,
- int __MinExp, int __MaxExp,
- int __MinExp10, int __MaxExp10,
- bool __IsIEC559,
- float_round_style __RoundStyle>
-class _Floating_limits : public _Numeric_limits_base<__number> {
-public:
-
-#if defined (_STLP_STATIC_CONST_INIT_BUG)
- enum {
-#else
- static const int
-#endif
-
- digits = __Digits,
- digits10 = __Digits10,
-
- radix = ( FLT_RADIX /* 2 */ ),
- min_exponent = __MinExp,
- max_exponent = __MaxExp,
- min_exponent10 = __MinExp10,
- max_exponent10 = __MaxExp10
-
-#if defined (_STLP_STATIC_CONST_INIT_BUG)
- ,
- has_denorm = denorm_indeterminate,
- round_style = __RoundStyle,
-#else
- ;
- static const float_denorm_style has_denorm = denorm_indeterminate;
- static const float_round_style round_style = __RoundStyle;
- static const bool
-#endif
-
- is_specialized = true,
- is_signed = true,
-
- //IEC 559 specify the floating point representation of
- //infinity, quiet and signaling Not a Number. Not supporting
- //it is consider as not being able to grant those values.
-#if (defined (_STLP_MSVC) && (_STLP_MSVC < 1300))
- //MSVC 6 do not fully support IEC 599 but grant a good infinity value.
- has_infinity = true,
-#else
- has_infinity = __IsIEC559,
-#endif
- has_quiet_NaN = __IsIEC559,
- has_signaling_NaN = __IsIEC559,
-
- has_denorm_loss = false,
- is_iec559 = __IsIEC559,
- is_bounded = true,
- traps = true,
- tinyness_before= false
-
-#if defined (_STLP_STATIC_CONST_INIT_BUG)
- }
-#endif
- ;
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-// Class numeric_limits
-
-// The unspecialized class.
-
-template<class _Tp>
-class numeric_limits : public _STLP_PRIV _Numeric_limits_base<_Tp> {};
-
-// Specializations for all built-in integral types.
-
-#if !defined (_STLP_NO_BOOL)
-_STLP_TEMPLATE_NULL
-class numeric_limits<bool>
- : public _STLP_PRIV _Integer_limits<bool, false, true, 1, false>
-{};
-#endif /* _STLP_NO_BOOL */
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<char>
- : public _STLP_PRIV _Integer_limits<char, CHAR_MIN, CHAR_MAX, -1, true>
-{};
-
-#if !defined (_STLP_NO_SIGNED_BUILTINS)
-_STLP_TEMPLATE_NULL
-class numeric_limits<signed char>
- : public _STLP_PRIV _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX, -1, true>
-{};
-#endif
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<unsigned char>
- : public _STLP_PRIV _Integer_limits<unsigned char, 0, UCHAR_MAX, -1, true>
-{};
-
-#if !(defined (_STLP_NO_WCHAR_T) || defined (_STLP_WCHAR_T_IS_USHORT))
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<wchar_t>
- : public _STLP_PRIV _Integer_limits<wchar_t, WCHAR_MIN, WCHAR_MAX, -1, true>
-{};
-
-#endif
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<short>
- : public _STLP_PRIV _Integer_limits<short, SHRT_MIN, SHRT_MAX, -1, true>
-{};
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<unsigned short>
- : public _STLP_PRIV _Integer_limits<unsigned short, 0, USHRT_MAX, -1, true>
-{};
-
-#if defined (__xlC__) && (__xlC__ == 0x500)
-# undef INT_MIN
-# define INT_MIN -2147483648
-#endif
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<int>
- : public _STLP_PRIV _Integer_limits<int, INT_MIN, INT_MAX, -1, true>
-{};
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<unsigned int>
- : public _STLP_PRIV _Integer_limits<unsigned int, 0, UINT_MAX, -1, true>
-{};
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<long>
- : public _STLP_PRIV _Integer_limits<long, LONG_MIN, LONG_MAX, -1, true>
-{};
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<unsigned long>
- : public _STLP_PRIV _Integer_limits<unsigned long, 0, ULONG_MAX, -1, true>
-{};
-
-#if defined (_STLP_LONG_LONG)
-
-# if defined (_STLP_MSVC) || defined (__BORLANDC__)
-# define LONGLONG_MAX 0x7fffffffffffffffi64
-# define LONGLONG_MIN (-LONGLONG_MAX-1i64)
-# define ULONGLONG_MAX 0xffffffffffffffffUi64
-# else
-# ifndef LONGLONG_MAX
-# define LONGLONG_MAX 0x7fffffffffffffffLL
-# endif
-# ifndef LONGLONG_MIN
-# define LONGLONG_MIN (-LONGLONG_MAX-1LL)
-# endif
-# ifndef ULONGLONG_MAX
-# define ULONGLONG_MAX 0xffffffffffffffffULL
-# endif
-# endif
-
-# if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ <= 96)
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<_STLP_LONG_LONG>
- : public _STLP_PRIV _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true>
-{};
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<unsigned _STLP_LONG_LONG>
- : public _STLP_PRIV _Integer_limits<unsigned _STLP_LONG_LONG, 0, ULONGLONG_MAX, -1, true>
-{};
-# else /* gcc 2.97 (after 2000-11-01), 2.98, 3.0 */
-/*
- newest gcc has new mangling scheme, that has problem
- with generating name [instantiated] of template specialization like
- _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true>
- ~~~~~~~~~~~~ ~~~~~~~~~~~~
- Below is code that solve this problem.
- - ptr
- */
-_STLP_TEMPLATE_NULL
-class numeric_limits<_STLP_LONG_LONG>
- : public _STLP_PRIV _Numeric_limits_base<_STLP_LONG_LONG> {
-public:
-
- static _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return LONGLONG_MIN; }
- static _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return LONGLONG_MAX; }
-
-# if defined ( _STLP_STATIC_CONST_INIT_BUG)
- enum {
-# else
- static const int
-# endif
- digits = ((int)((sizeof(_STLP_LONG_LONG) * (CHAR_BIT))) - 1),
- digits10 = (digits * 301UL) / 1000,
- radix = 2
-# if ! defined (_STLP_STATIC_CONST_INIT_BUG)
- ;
- static const bool
-# else
- ,
-# endif
- is_specialized = true,
- is_signed = true,
- is_integer = true,
- is_exact = true,
- is_bounded = true,
- is_modulo = true
-# if defined (_STLP_STATIC_CONST_INIT_BUG)
- }
-# endif
- ;
-};
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<unsigned _STLP_LONG_LONG>
- : public _STLP_PRIV _Numeric_limits_base<unsigned _STLP_LONG_LONG> {
-public:
-
- static unsigned _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return 0ULL; }
- static unsigned _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return ULONGLONG_MAX; }
-
-# if defined (_STLP_STATIC_CONST_INIT_BUG)
- enum {
-# else
- static const int
-# endif
- digits = ((int)((sizeof(unsigned _STLP_LONG_LONG) * (CHAR_BIT)))),
- digits10 = (digits * 301UL) / 1000,
- radix = 2
-# if ! defined (_STLP_STATIC_CONST_INIT_BUG)
- ;
- static const bool
-# else
- ,
-# endif
- is_specialized = true,
- is_signed = false,
- is_integer = true,
- is_exact = true,
- is_bounded = true,
- is_modulo = true
-# if defined ( _STLP_STATIC_CONST_INIT_BUG)
- }
-# endif
- ;
-};
-
-# endif /* __GNUC__ > 2000-11-01 */
-
-#endif /* _STLP_LONG_LONG */
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// Specializations for all built-in floating-point types.
-template <class __dummy>
-class _LimG {
-public:
- static float _STLP_CALL get_F_inf();
- static float _STLP_CALL get_F_qNaN();
- static float _STLP_CALL get_F_sNaN();
- static double _STLP_CALL get_D_inf();
- static double _STLP_CALL get_D_qNaN();
- static double _STLP_CALL get_D_sNaN();
-
-#if !defined (_STLP_NO_LONG_DOUBLE)
- static long double _STLP_CALL get_LD_inf();
- static long double _STLP_CALL get_LD_qNaN();
- static long double _STLP_CALL get_LD_sNaN();
-#endif
-};
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS _LimG<bool>;
-#endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<float>
- : public _STLP_PRIV _Floating_limits<float,
- FLT_MANT_DIG, // Binary digits of precision
- FLT_DIG, // Decimal digits of precision
- FLT_MIN_EXP, // Minimum exponent
- FLT_MAX_EXP, // Maximum exponent
- FLT_MIN_10_EXP, // Minimum base 10 exponent
- FLT_MAX_10_EXP, // Maximum base 10 exponent
-#if defined (_STLP_NO_IEC559_SUPPORT)
- false, // do not conform to iec559
-#else
- true, // conforms to iec559
-#endif
- round_to_nearest> {
-public:
- static float (_STLP_CALL min) () _STLP_NOTHROW { return FLT_MIN; }
- static float _STLP_CALL denorm_min() _STLP_NOTHROW { return FLT_MIN; }
- static float (_STLP_CALL max) () _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return FLT_MAX; }
- static float _STLP_CALL epsilon() _STLP_NOTHROW { return FLT_EPSILON; }
- static float _STLP_CALL round_error() _STLP_NOTHROW { return 0.5f; } // Units: ulps.
- static float _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_inf(); }
- static float _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_qNaN(); }
- static float _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_sNaN(); }
-};
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<double>
- : public _STLP_PRIV _Floating_limits<double,
- DBL_MANT_DIG, // Binary digits of precision
- DBL_DIG, // Decimal digits of precision
- DBL_MIN_EXP, // Minimum exponent
- DBL_MAX_EXP, // Maximum exponent
- DBL_MIN_10_EXP, // Minimum base 10 exponent
- DBL_MAX_10_EXP, // Maximum base 10 exponent
-#if defined (_STLP_NO_IEC559_SUPPORT)
- false, // do not conform to iec559
-#else
- true, // conforms to iec559
-#endif
- round_to_nearest> {
-public:
- static double (_STLP_CALL min)() _STLP_NOTHROW { return DBL_MIN; }
- static double _STLP_CALL denorm_min() _STLP_NOTHROW { return DBL_MIN; }
- static double (_STLP_CALL max)() _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return DBL_MAX; }
- static double _STLP_CALL epsilon() _STLP_NOTHROW { return DBL_EPSILON; }
- static double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5; } // Units: ulps.
- static double _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_inf(); }
- static double _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_qNaN(); }
- static double _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_sNaN(); }
-};
-
-#if !defined (_STLP_NO_LONG_DOUBLE)
-
-_STLP_TEMPLATE_NULL
-class numeric_limits<long double>
- : public _STLP_PRIV _Floating_limits<long double,
- LDBL_MANT_DIG, // Binary digits of precision
- LDBL_DIG, // Decimal digits of precision
- LDBL_MIN_EXP, // Minimum exponent
- LDBL_MAX_EXP, // Maximum exponent
- LDBL_MIN_10_EXP,// Minimum base 10 exponent
- LDBL_MAX_10_EXP,// Maximum base 10 exponent
- false, // do not conform to iec559
- round_to_nearest> {
-public:
- static long double (_STLP_CALL min) () _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return LDBL_MIN; }
- static long double _STLP_CALL denorm_min() _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return LDBL_MIN; }
- static long double (_STLP_CALL max) () _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return LDBL_MAX; }
- static long double _STLP_CALL epsilon() _STLP_NOTHROW { return LDBL_EPSILON; }
- static long double _STLP_CALL round_error() _STLP_NOTHROW { return 4; } // Units: ulps.
- static long double _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_LD_inf(); }
- static long double _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_LD_qNaN(); }
- static long double _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_LD_sNaN(); }
-};
-
-#endif
-
-// We write special values (Inf and NaN) as bit patterns and
-// cast the the appropriate floating-point types.
-_STLP_END_NAMESPACE
-
-#if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_limits.c>
-#endif
-
-#endif
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_list.c b/stl/_list.c
deleted file mode 100644
index a1376c2..0000000
--- a/stl/_list.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_LIST_C
-#define _STLP_LIST_C
-
-#ifndef _STLP_INTERNAL_LIST_H
-# include <stl/_list.h>
-#endif
-
-#ifndef _STLP_CARRAY_H
-# include <stl/_carray.h>
-#endif
-
-#ifndef _STLP_RANGE_ERRORS_H
-# include <stl/_range_errors.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
-template <class _Dummy>
-void _STLP_CALL
-_List_global<_Dummy>::_Transfer(_List_node_base* __position,
- _List_node_base* __first, _List_node_base* __last) {
- if (__position != __last) {
- // Remove [first, last) from its old position.
- __last->_M_prev->_M_next = __position;
- __first->_M_prev->_M_next = __last;
- __position->_M_prev->_M_next = __first;
-
- // Splice [first, last) into its new position.
- _Node_base* __tmp = __position->_M_prev;
- __position->_M_prev = __last->_M_prev;
- __last->_M_prev = __first->_M_prev;
- __first->_M_prev = __tmp;
- }
-}
-#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
-
-template <class _Tp, class _Alloc>
-void _List_base<_Tp,_Alloc>::clear() {
- _Node* __cur = __STATIC_CAST(_Node*, _M_node._M_data._M_next);
- while (__cur != &(_M_node._M_data)) {
- _Node* __tmp = __cur;
- __cur = __STATIC_CAST(_Node*, __cur->_M_next);
- _STLP_STD::_Destroy(&__tmp->_M_data);
- this->_M_node.deallocate(__tmp, 1);
- }
- _M_node._M_data._M_next = &_M_node._M_data;
- _M_node._M_data._M_prev = &_M_node._M_data;
-}
-
-#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
-# define size_type size_t
-#endif
-
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-# define list _STLP_PTR_IMPL_NAME(list)
-#elif defined (_STLP_DEBUG)
-# define list _STLP_NON_DBG_NAME(list)
-#else
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-template <class _Tp, class _Alloc>
-void list<_Tp, _Alloc>::resize(size_type __new_size, const _Tp& __x) {
- iterator __i = begin();
- size_type __len = 0;
- for ( ; __i != end() && __len < __new_size; ++__i, ++__len);
-
- if (__len == __new_size)
- erase(__i, end());
- else // __i == end()
- insert(end(), __new_size - __len, __x);
-}
-
-template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list<_Tp, _Alloc>& __x) {
- if (this != &__x) {
- iterator __first1 = begin();
- iterator __last1 = end();
- const_iterator __first2 = __x.begin();
- const_iterator __last2 = __x.end();
- while (__first1 != __last1 && __first2 != __last2)
- *__first1++ = *__first2++;
- if (__first2 == __last2)
- erase(__first1, __last1);
- else
- insert(__last1, __first2, __last2);
- }
- return *this;
-}
-
-template <class _Tp, class _Alloc>
-void list<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) {
- iterator __i = begin();
- for ( ; __i != end() && __n > 0; ++__i, --__n)
- *__i = __val;
- if (__n > 0)
- insert(end(), __n, __val);
- else
- erase(__i, end());
-}
-
-#if !defined (list)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-template <class _Tp, class _Alloc, class _Predicate>
-void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred) {
- typedef typename list<_Tp, _Alloc>::iterator _Literator;
- _Literator __first = __that.begin();
- _Literator __last = __that.end();
- while (__first != __last) {
- _Literator __next = __first;
- ++__next;
- if (__pred(*__first)) __that.erase(__first);
- __first = __next;
- }
-}
-
-template <class _Tp, class _Alloc, class _BinaryPredicate>
-void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred) {
- typedef typename list<_Tp, _Alloc>::iterator _Literator;
- _Literator __first = __that.begin();
- _Literator __last = __that.end();
- if (__first == __last) return;
- _Literator __next = __first;
- while (++__next != __last) {
- if (__binary_pred(*__first, *__next))
- __that.erase(__next);
- else
- __first = __next;
- __next = __first;
- }
-}
-
-template <class _Tp, class _Alloc, class _StrictWeakOrdering>
-void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x,
- _StrictWeakOrdering __comp) {
- typedef typename list<_Tp, _Alloc>::iterator _Literator;
- _Literator __first1 = __that.begin();
- _Literator __last1 = __that.end();
- _Literator __first2 = __x.begin();
- _Literator __last2 = __x.end();
- if (__that.get_allocator() == __x.get_allocator()) {
- while (__first1 != __last1 && __first2 != __last2) {
- if (__comp(*__first2, *__first1)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- _Literator __next = __first2;
- _List_global_inst::_Transfer(__first1._M_node, __first2._M_node, (++__next)._M_node);
- __first2 = __next;
- }
- else
- ++__first1;
- }
- if (__first2 != __last2)
- _List_global_inst::_Transfer(__last1._M_node, __first2._M_node, __last2._M_node);
- }
- else {
- while (__first1 != __last1 && __first2 != __last2) {
- if (__comp(*__first2, *__first1)) {
- _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- __first1 = __that.insert(__first1, *__first2);
- }
- else
- ++__first1;
- }
- if (__first2 != __last2) {
- __that.insert(__first1, __first2, __last2);
- }
- __x.clear();
- }
-}
-
-template <class _Tp, class _Alloc, class _StrictWeakOrdering>
-void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp) {
- // Do nothing if the list has length 0 or 1.
- if (__that._M_node._M_data._M_next == &__that._M_node._M_data ||
- __that._M_node._M_data._M_next->_M_next == &__that._M_node._M_data)
- return;
-
- list<_Tp, _Alloc> __carry(__that.get_allocator());
- const int NB = 64;
- _STLP_PRIV _CArray<list<_Tp, _Alloc>, NB> __counter(__carry);
- int __fill = 0;
- while (!__that.empty()) {
- __carry.splice(__carry.begin(), __that, __that.begin());
- int __i = 0;
- while (__i < __fill && !__counter[__i].empty()) {
- _S_merge(__counter[__i], __carry, __comp);
- __carry.swap(__counter[__i++]);
- }
- __carry.swap(__counter[__i]);
- if (__i == __fill) {
- ++__fill;
- if (__fill >= NB) {
- //Looks like the list has too many elements to be sorted with this algorithm:
- __stl_throw_overflow_error("list::sort");
- }
- }
- }
-
- for (int __i = 1; __i < __fill; ++__i)
- _S_merge(__counter[__i], __counter[__i - 1], __comp);
- __that.swap(__counter[__fill - 1]);
-}
-
-#if defined (list)
-# undef list
-#endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_LIST_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_list.h b/stl/_list.h
deleted file mode 100644
index d7fb9ba..0000000
--- a/stl/_list.h
+++ /dev/null
@@ -1,732 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_LIST_IMPL_H
-#define _STLP_INTERNAL_LIST_IMPL_H
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-# include <stl/_alloc.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ITERATOR_H
-# include <stl/_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CONSTRUCT_H
-# include <stl/_construct.h>
-#endif
-
-#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
-# include <stl/_function_base.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-struct _List_node_base {
- _List_node_base* _M_next;
- _List_node_base* _M_prev;
-};
-
-template <class _Dummy>
-class _List_global {
-public:
- typedef _List_node_base _Node_base;
- static void _STLP_CALL _Transfer(_Node_base* __pos,
- _Node_base* __first, _Node_base* __last);
-};
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS _List_global<bool>;
-#endif
-typedef _List_global<bool> _List_global_inst;
-
-template <class _Tp>
-class _List_node : public _List_node_base {
-public:
- _Tp _M_data;
- __TRIVIAL_STUFF(_List_node)
-};
-
-struct _List_iterator_base {
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef bidirectional_iterator_tag iterator_category;
-
- _List_node_base* _M_node;
-
- _List_iterator_base(_List_node_base* __x) : _M_node(__x) {}
-
- void _M_incr() { _M_node = _M_node->_M_next; }
- void _M_decr() { _M_node = _M_node->_M_prev; }
-};
-
-
-template<class _Tp, class _Traits>
-struct _List_iterator : public _List_iterator_base {
- typedef _Tp value_type;
- typedef typename _Traits::pointer pointer;
- typedef typename _Traits::reference reference;
-
- typedef _List_iterator<_Tp, _Traits> _Self;
- typedef typename _Traits::_NonConstTraits _NonConstTraits;
- typedef _List_iterator<_Tp, _NonConstTraits> iterator;
- typedef typename _Traits::_ConstTraits _ConstTraits;
- typedef _List_iterator<_Tp, _ConstTraits> const_iterator;
-
- typedef bidirectional_iterator_tag iterator_category;
- typedef _List_node<_Tp> _Node;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- explicit _List_iterator(_List_node_base* __x) : _List_iterator_base(__x) {}
- _List_iterator() : _List_iterator_base(0) {}
- //copy constructor for iterator and constructor from iterator for const_iterator
- _List_iterator(const iterator& __x) : _List_iterator_base(__x._M_node) {}
-
- reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; }
-
- _STLP_DEFINE_ARROW_OPERATOR
-
- _Self& operator++() {
- this->_M_incr();
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- this->_M_incr();
- return __tmp;
- }
- _Self& operator--() {
- this->_M_decr();
- return *this;
- }
- _Self operator--(int) {
- _Self __tmp = *this;
- this->_M_decr();
- return __tmp;
- }
- bool operator==(const_iterator __y ) const {
- return this->_M_node == __y._M_node;
- }
- bool operator!=(const_iterator __y ) const {
- return this->_M_node != __y._M_node;
- }
-};
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-_STLP_MOVE_TO_STD_NAMESPACE
-template <class _Tp, class _Traits>
-struct __type_traits<_STLP_PRIV _List_iterator<_Tp, _Traits> > {
- typedef __false_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __false_type is_POD_type;
-};
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
-_STLP_MOVE_TO_STD_NAMESPACE
-template <class _Tp, class _Traits>
-inline _Tp* value_type(const _STLP_PRIV _List_iterator<_Tp, _Traits>&) { return 0; }
-inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _List_iterator_base&) { return bidirectional_iterator_tag();}
-inline ptrdiff_t* distance_type(const _STLP_PRIV _List_iterator_base&) { return 0; }
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-// Base class that encapsulates details of allocators and helps
-// to simplify EH
-
-template <class _Tp, class _Alloc>
-class _List_base {
-protected:
- _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
- typedef _List_node_base _Node_base;
- typedef _List_node<_Tp> _Node;
- typedef _List_base<_Tp, _Alloc> _Self;
- typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _Node_allocator_type;
-public:
- typedef _STLP_alloc_proxy<_Node_base, _Node, _Node_allocator_type> _AllocProxy;
- typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type;
-
- allocator_type get_allocator() const
- { return _STLP_CONVERT_ALLOCATOR((const _Node_allocator_type&)_M_node, _Tp); }
-
- _List_base(const allocator_type& __a) : _M_node(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base())
- { _M_empty_initialize(); }
- _List_base(__move_source<_Self> src) :
- _M_node(__move_source<_AllocProxy>(src.get()._M_node)) {
- if (src.get().empty())
- //We force this to empty.
- _M_empty_initialize();
- else {
- src.get()._M_empty_initialize();
- _M_node._M_data._M_prev->_M_next = _M_node._M_data._M_next->_M_prev = &_M_node._M_data;
- }
- }
-
- ~_List_base()
- { clear(); }
-
- void clear();
- bool empty() const { return _M_node._M_data._M_next == &_M_node._M_data; }
-
- void _M_empty_initialize() {
- _M_node._M_data._M_next = &_M_node._M_data;
- _M_node._M_data._M_prev = _M_node._M_data._M_next;
- }
-
-public:
- _AllocProxy _M_node;
-};
-
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-# define list _STLP_PTR_IMPL_NAME(list)
-#elif defined (_STLP_DEBUG)
-# define list _STLP_NON_DBG_NAME(list)
-#else
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
-class list;
-
-#if !defined (list)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-// helper functions to reduce code duplication
-template <class _Tp, class _Alloc, class _Predicate>
-void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred);
-
-template <class _Tp, class _Alloc, class _BinaryPredicate>
-void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred);
-
-template <class _Tp, class _Alloc, class _StrictWeakOrdering>
-void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x,
- _StrictWeakOrdering __comp);
-
-template <class _Tp, class _Alloc, class _StrictWeakOrdering>
-void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp);
-
-#if !defined (list)
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-template <class _Tp, class _Alloc>
-class list : public _STLP_PRIV _List_base<_Tp, _Alloc>
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list)
- , public __stlport_class<list<_Tp, _Alloc> >
-#endif
-{
- typedef _STLP_PRIV _List_base<_Tp, _Alloc> _Base;
- typedef list<_Tp, _Alloc> _Self;
- typedef _STLP_PRIV _List_node<_Tp> _Node;
- typedef _STLP_PRIV _List_node_base _Node_base;
-public:
- typedef _Tp value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
- typedef typename _Base::allocator_type allocator_type;
- typedef bidirectional_iterator_tag _Iterator_category;
-
-public:
- typedef _STLP_PRIV _List_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
- typedef _STLP_PRIV _List_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
- _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
-
-protected:
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- _Node_base* _M_create_node(const_reference __x = value_type()) {
-#else
- _Node_base* _M_create_node(const_reference __x) {
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
- _Node* __p = this->_M_node.allocate(1);
- _STLP_TRY {
- _Copy_Construct(&__p->_M_data, __x);
- }
- _STLP_UNWIND(this->_M_node.deallocate(__p, 1))
- return __p;
- }
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- _Node_base* _M_create_node() {
- _Node* __p = this->_M_node.allocate(1);
- _STLP_TRY {
- _STLP_STD::_Construct(&__p->_M_data);
- }
- _STLP_UNWIND(this->_M_node.deallocate(__p, 1))
- return __p;
- }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
-public:
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit list(size_type __n, const_reference __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
- const allocator_type& __a = allocator_type())
-#else
- explicit list(size_type __n)
- : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
- { this->insert(begin(), __n, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
- list(size_type __n, const_reference __val)
- : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
- { this->insert(begin(), __n, __val); }
- list(size_type __n, const_reference __val, const allocator_type& __a)
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
- { this->insert(begin(), __n, __val); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- // We don't need any dispatching tricks here, because insert does all of
- // that anyway.
- template <class _InputIterator>
- list(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
- { _M_insert(begin(), __first, __last); }
-
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- list(_InputIterator __first, _InputIterator __last)
- : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
- { _M_insert(begin(), __first, __last); }
-# endif
-#else /* _STLP_MEMBER_TEMPLATES */
- list(const value_type* __first, const value_type* __last,
- const allocator_type& __a = allocator_type())
- : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
- { _M_insert(begin(), __first, __last); }
- list(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type())
- : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
- { _M_insert(begin(), __first, __last); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit list(const allocator_type& __a = allocator_type())
-#else
- list()
- : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) {}
- list(const allocator_type& __a)
-#endif
- : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) {}
-
- list(const _Self& __x) : _STLP_PRIV _List_base<_Tp, _Alloc>(__x.get_allocator())
- { _M_insert(begin(), __x.begin(), __x.end()); }
-
- list(__move_source<_Self> src)
- : _STLP_PRIV _List_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {}
-
- ~list() {}
-
- _Self& operator = (const _Self& __x);
-
- iterator begin() { return iterator(this->_M_node._M_data._M_next); }
- const_iterator begin() const { return const_iterator(this->_M_node._M_data._M_next); }
-
- iterator end() { return iterator(&this->_M_node._M_data); }
- const_iterator end() const { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_node._M_data)); }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
-
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
-
- size_type size() const {
- size_type __result = distance(begin(), end());
- return __result;
- }
- size_type max_size() const { return size_type(-1); }
-
- reference front() { return *begin(); }
- const_reference front() const { return *begin(); }
- reference back() { return *(--end()); }
- const_reference back() const { return *(--end()); }
-
-private:
- void _M_swap_aux(_Self& __x) {
- __x._M_node._M_swap_alloc(this->_M_node);
- __x._M_node._M_data._M_next = this->_M_node._M_data._M_next;
- __x._M_node._M_data._M_next->_M_prev = &__x._M_node._M_data;
- __x._M_node._M_data._M_prev = this->_M_node._M_data._M_prev;
- __x._M_node._M_data._M_prev->_M_next = &__x._M_node._M_data;
- this->_M_empty_initialize();
- }
-
-public:
- void swap(_Self& __x) {
- if (__x.empty()) {
- if (this->empty()) {
- return;
- }
- this->_M_swap_aux(__x);
- } else if (this->empty()) {
- __x._M_swap_aux(*this);
- } else {
- this->_M_node.swap(__x._M_node);
- _STLP_STD::swap(this->_M_node._M_data._M_prev->_M_next, __x._M_node._M_data._M_prev->_M_next);
- _STLP_STD::swap(this->_M_node._M_data._M_next->_M_prev, __x._M_node._M_data._M_next->_M_prev);
- }
- }
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos, const_reference __x = value_type()) {
-#else
- iterator insert(iterator __pos, const_reference __x) {
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- _Node_base* __tmp = _M_create_node(__x);
- _Node_base* __n = __pos._M_node;
- _Node_base* __p = __n->_M_prev;
- __tmp->_M_next = __n;
- __tmp->_M_prev = __p;
- __p->_M_next = __tmp;
- __n->_M_prev = __tmp;
- return iterator(__tmp);
- }
-
-private:
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void _M_insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_insert_dispatch(__pos, __first, __last, _Integral());
- }
-
- // Check whether it's an integral type. If so, it's not an iterator.
- template<class _Integer>
- void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
- const __true_type& /*_IsIntegral*/) {
- _M_fill_insert(__pos, __n, __x);
- }
- template <class _InputIter>
- void _M_insert_dispatch(iterator __pos,
- _InputIter __first, _InputIter __last,
- const __false_type& /*_IsIntegral*/) {
-#else /* _STLP_MEMBER_TEMPLATES */
- void _M_insert(iterator __pos, const value_type* __first, const value_type* __last) {
- for (; __first != __last; ++__first)
- insert(__pos, *__first);
- }
- void _M_insert(iterator __pos, const_iterator __first, const_iterator __last) {
-#endif /* _STLP_MEMBER_TEMPLATES */
- //We use a temporary list to avoid the auto reference troubles (infinite loop)
- for (; __first != __last; ++__first)
- insert(__pos, *__first);
- }
-
-public:
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_splice_insert_dispatch(__pos, __first, __last, _Integral());
- }
-
-private:
- // Check whether it's an integral type. If so, it's not an iterator.
- template<class _Integer>
- void _M_splice_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
- const __true_type& /*_IsIntegral*/) {
- _M_fill_insert(__pos, __n, __x);
- }
- template <class _InputIter>
- void _M_splice_insert_dispatch(iterator __pos,
- _InputIter __first, _InputIter __last,
- const __false_type& /*_IsIntegral*/) {
-#else /* _STLP_MEMBER_TEMPLATES */
- void insert(iterator __pos, const value_type* __first, const value_type* __last) {
- _Self __tmp(__first, __last, this->get_allocator());
- splice(__pos, __tmp);
- }
- void insert(iterator __pos, const_iterator __first, const_iterator __last) {
-#endif /* _STLP_MEMBER_TEMPLATES */
- //We use a temporary list to avoid the auto reference troubles (infinite loop)
- _Self __tmp(__first, __last, this->get_allocator());
- splice(__pos, __tmp);
- }
-
-public:
- void insert(iterator __pos, size_type __n, const_reference __x)
- { _M_fill_insert(__pos, __n, __x); }
-
-private:
- void _M_fill_insert(iterator __pos, size_type __n, const_reference __x) {
- for ( ; __n > 0; --__n)
- insert(__pos, __x);
- }
-
-public:
- void push_front(const_reference __x) { insert(begin(), __x); }
- void push_back (const_reference __x) { insert(end(), __x); }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos)
- { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
- void push_front() {insert(begin());}
- void push_back() {insert(end());}
-# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
- iterator erase(iterator __pos) {
- _Node_base* __next_node = __pos._M_node->_M_next;
- _Node_base* __prev_node = __pos._M_node->_M_prev;
- _Node* __n = __STATIC_CAST(_Node*, __pos._M_node);
- __prev_node->_M_next = __next_node;
- __next_node->_M_prev = __prev_node;
- _STLP_STD::_Destroy(&__n->_M_data);
- this->_M_node.deallocate(__n, 1);
- return iterator(__next_node);
- }
-
- iterator erase(iterator __first, iterator __last) {
- while (__first != __last)
- erase(__first++);
- return __last;
- }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size, const_reference __x = value_type());
-#else
- void resize(size_type __new_size, const_reference __x);
- void resize(size_type __new_size)
- { this->resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
-
- void pop_front() { erase(begin()); }
- void pop_back() {
- iterator __tmp = end();
- erase(--__tmp);
- }
-
-public:
- // assign(), a generalized assignment member function. Two
- // versions: one that takes a count, and one that takes a range.
- // The range version is a member template, so we dispatch on whether
- // or not the type is an integer.
-
- void assign(size_type __n, const_reference __val) { _M_fill_assign(__n, __val); }
-
- void _M_fill_assign(size_type __n, const_reference __val);
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val,
- const __true_type& /*_IsIntegral*/) {
- _M_fill_assign(__n, __val);
- }
-
- template <class _InputIterator>
- void _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,
- const __false_type& /*_IsIntegral*/) {
-#else
- void assign(const value_type *__first2, const value_type *__last2) {
- iterator __first1 = begin();
- iterator __last1 = end();
- for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
- *__first1 = *__first2;
- if (__first2 == __last2)
- erase(__first1, __last1);
- else
- insert(__last1, __first2, __last2);
- }
- void assign(const_iterator __first2, const_iterator __last2) {
-#endif /* _STLP_MEMBER_TEMPLATES */
- iterator __first1 = begin();
- iterator __last1 = end();
- for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
- *__first1 = *__first2;
- if (__first2 == __last2)
- erase(__first1, __last1);
- else
- insert(__last1, __first2, __last2);
- }
-
-public:
- void splice(iterator __pos, _Self& __x) {
- if (!__x.empty()) {
- if (this->get_allocator() == __x.get_allocator()) {
- _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __x.begin()._M_node, __x.end()._M_node);
- }
- else {
- insert(__pos, __x.begin(), __x.end());
- __x.clear();
- }
- }
- }
- void splice(iterator __pos, _Self& __x, iterator __i) {
- iterator __j = __i;
- ++__j;
- if (__pos == __i || __pos == __j) return;
- if (this->get_allocator() == __x.get_allocator()) {
- _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __i._M_node, __j._M_node);
- }
- else {
- insert(__pos, *__i);
- __x.erase(__i);
- }
- }
- void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
- if (__first != __last) {
- if (this->get_allocator() == __x.get_allocator()) {
- _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __first._M_node, __last._M_node);
- }
- else {
- insert(__pos, __first, __last);
- __x.erase(__first, __last);
- }
- }
- }
-
- void remove(const_reference __val) {
- iterator __first = begin();
- iterator __last = end();
- while (__first != __last) {
- iterator __next = __first;
- ++__next;
- if (__val == *__first) erase(__first);
- __first = __next;
- }
- }
-
- void unique()
- { _STLP_PRIV _S_unique(*this, equal_to<value_type>()); }
-
- void merge(_Self& __x)
- { _STLP_PRIV _S_merge(*this, __x, less<value_type>()); }
-
- void reverse() {
- _Node_base* __p = &this->_M_node._M_data;
- _Node_base* __tmp = __p;
- do {
- _STLP_STD::swap(__tmp->_M_next, __tmp->_M_prev);
- __tmp = __tmp->_M_prev; // Old next node is now prev.
- } while (__tmp != __p);
- }
-
- void sort()
- { _STLP_PRIV _S_sort(*this, less<value_type>()); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _Predicate>
- void remove_if(_Predicate __pred)
- { _STLP_PRIV _S_remove_if(*this, __pred); }
- template <class _BinaryPredicate>
- void unique(_BinaryPredicate __binary_pred)
- { _STLP_PRIV _S_unique(*this, __binary_pred); }
-
- template <class _StrictWeakOrdering>
- void merge(_Self& __x,
- _StrictWeakOrdering __comp) {
- _STLP_PRIV _S_merge(*this, __x, __comp);
- }
-
- template <class _StrictWeakOrdering>
- void sort(_StrictWeakOrdering __comp)
- { _STLP_PRIV _S_sort(*this, __comp); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-};
-
-#if defined (list)
-# undef list
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-_STLP_END_NAMESPACE
-
-#if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_list.c>
-#endif
-
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-# include <stl/pointers/_list.h>
-#endif
-
-#if defined (_STLP_DEBUG)
-# include <stl/debug/_list.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _Tp, class _Alloc>
-_STLP_INLINE_LOOP bool _STLP_CALL
-operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) {
- typedef typename list<_Tp,_Alloc>::const_iterator const_iterator;
- const_iterator __end1 = __x.end();
- const_iterator __end2 = __y.end();
-
- const_iterator __i1 = __x.begin();
- const_iterator __i2 = __y.begin();
- while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
- ++__i1;
- ++__i2;
- }
- return __i1 == __end1 && __i2 == __end2;
-}
-
-#define _STLP_EQUAL_OPERATOR_SPECIALIZED
-#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
-#define _STLP_TEMPLATE_CONTAINER list<_Tp, _Alloc>
-#include <stl/_relops_cont.h>
-#undef _STLP_TEMPLATE_CONTAINER
-#undef _STLP_TEMPLATE_HEADER
-#undef _STLP_EQUAL_OPERATOR_SPECIALIZED
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp, class _Alloc>
-struct __move_traits<list<_Tp, _Alloc> > {
- typedef __stlp_movable implemented;
- typedef typename __move_traits<_Alloc>::complete complete;
-};
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_LIST_IMPL_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_locale.h b/stl/_locale.h
deleted file mode 100644
index 454fa43..0000000
--- a/stl/_locale.h
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// WARNING: This is an internal header file, included by other C++
-// standard library headers. You should not attempt to use this header
-// file directly.
-
-
-#ifndef _STLP_INTERNAL_LOCALE_H
-#define _STLP_INTERNAL_LOCALE_H
-
-#ifndef _STLP_INTERNAL_CSTDLIB
-# include <stl/_cstdlib.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CWCHAR
-# include <stl/_cwchar.h>
-#endif
-
-#ifndef _STLP_INTERNAL_THREADS_H
-# include <stl/_threads.h>
-#endif
-
-#ifndef _STLP_STRING_FWD_H
-# include <stl/_string_fwd.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-class _Locale_impl; // Forward declaration of opaque type.
-class ios_base;
-class locale;
-
-template <class _CharT, class _Traits, class _Alloc>
-bool __locale_do_operator_call (const locale& __loc,
- const basic_string<_CharT, _Traits, _Alloc>& __x,
- const basic_string<_CharT, _Traits, _Alloc>& __y);
-
-_STLP_DECLSPEC _Locale_impl * _STLP_CALL _get_Locale_impl( _Locale_impl *locimpl );
-_STLP_DECLSPEC _Locale_impl * _STLP_CALL _copy_Nameless_Locale_impl( _Locale_impl *locimpl );
-
-template <class _Facet>
-bool _HasFacet(const locale& __loc, const _Facet* __facet) _STLP_NOTHROW;
-
-template <class _Facet>
-_Facet* _UseFacet(const locale& __loc, const _Facet* __facet);
-
-#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-# define locale _STLP_NO_MEM_T_NAME(loc)
-#endif
-
-class _STLP_CLASS_DECLSPEC locale {
-public:
- // types:
- class _STLP_CLASS_DECLSPEC facet : protected _Refcount_Base {
- protected:
- /* Here we filter __init_count user value to 0 or 1 because __init_count is a
- * size_t instance and _Refcount_Base use __stl_atomic_t instances that might
- * have lower sizeof and generate roll issues. 1 is enough to keep the facet
- * alive when required.
- */
- explicit facet(size_t __init_count = 0) : _Refcount_Base( __init_count == 0 ? 0 : 1 ) {}
- virtual ~facet();
- friend class locale;
- friend class _Locale_impl;
- friend facet * _STLP_CALL _get_facet( facet * );
- friend void _STLP_CALL _release_facet( facet *& );
-
- private: // Invalidate assignment and copying.
- facet(const facet& ) /* : _Refcount_Base(1) {} */;
- void operator=(const facet&);
- };
-
-#if defined (__MVS__) || defined (__OS400__)
- struct
-#else
- class
-#endif
- _STLP_CLASS_DECLSPEC id {
- friend class locale;
- friend class _Locale_impl;
- public:
- size_t _M_index;
- static size_t _S_max;
- };
-
- typedef int category;
-#if defined (_STLP_STATIC_CONST_INIT_BUG)
- enum _Category {
-#else
- static const category
-#endif
- none = 0x000,
- collate = 0x010,
- ctype = 0x020,
- monetary = 0x040,
- numeric = 0x100,
- time = 0x200,
- messages = 0x400,
- all = collate | ctype | monetary | numeric | time | messages
-#if defined (_STLP_STATIC_CONST_INIT_BUG)
- }
-#endif
- ;
-
- // construct/copy/destroy:
- locale() _STLP_NOTHROW;
- locale(const locale&) _STLP_NOTHROW;
- explicit locale(const char *);
- locale(const locale&, const char*, category);
-
-#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
- template <class _Facet>
- locale(const locale& __loc, _Facet* __f) {
- if ( __f != 0 ) {
- this->_M_impl = _get_Locale_impl( _copy_Nameless_Locale_impl( __loc._M_impl ) );
- this->_M_insert(__f, _Facet::id);
- } else {
- this->_M_impl = _get_Locale_impl( __loc._M_impl );
- }
- }
-#endif // _STLP_MEMBER_TEMPLATES
-
-protected:
- // those are for internal use
- locale(_Locale_impl*);
-
-public:
-
- locale(const locale&, const locale&, category);
- const locale& operator=(const locale&) _STLP_NOTHROW;
-
-#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
- virtual
-#endif
- ~locale() _STLP_NOTHROW;
-
-#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) && \
- !defined(_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
- template <class _Facet>
- locale combine(const locale& __loc) const {
- _Facet *__facet = 0;
- if (!_HasFacet(__loc, __facet))
- _M_throw_runtime_error();
-
- return locale(*this, _UseFacet(__loc, __facet));
- }
-#endif // _STLP_MEMBER_TEMPLATES && !_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
-
- // locale operations:
- string name() const;
-
- bool operator==(const locale&) const;
- bool operator!=(const locale&) const;
-
-#if !defined (_STLP_MEMBER_TEMPLATES) || defined (_STLP_INLINE_MEMBER_TEMPLATES) || (defined(__MWERKS__) && __MWERKS__ <= 0x2301)
- bool operator()(const string& __x, const string& __y) const;
-# ifndef _STLP_NO_WCHAR_T
- bool operator()(const wstring& __x, const wstring& __y) const;
-# endif
-#elif !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
- template <class _CharT, class _Traits, class _Alloc>
- bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x,
- const basic_string<_CharT, _Traits, _Alloc>& __y) const
- { return __locale_do_operator_call(*this, __x, __y); }
-#endif
-
- // global locale objects:
- static locale _STLP_CALL global(const locale&);
- static const locale& _STLP_CALL classic();
-
-//protected: // Helper functions for locale globals.
- facet* _M_get_facet(const id&) const;
- // same, but throws
- facet* _M_use_facet(const id&) const;
- static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_runtime_error(const char* = 0);
-
-protected: // More helper functions.
- void _M_insert(facet* __f, id& __id);
-
- // friends:
- friend class _Locale_impl;
- friend class ios_base;
-
-protected: // Data members
- _Locale_impl* _M_impl;
- _Locale_impl* _M_get_impl() const { return _M_impl; }
-};
-
-#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-# undef locale
-# define _Locale _STLP_NO_MEM_T_NAME(loc)
-
-class locale : public _Locale {
-public:
-
- // construct/copy/destroy:
- locale() _STLP_NOTHROW {}
- locale(const locale& __loc) _STLP_NOTHROW : _Locale(__loc) {}
- explicit locale(const char *__str) : _Locale(__str) {}
- locale(const locale& __loc, const char* __str, category __cat)
- : _Locale(__loc, __str, __cat) {}
-
- template <class _Facet>
- locale(const locale& __loc, _Facet* __f) {
- if ( __f != 0 ) {
- this->_M_impl = _get_Locale_impl( _copy_Nameless_Locale_impl( __loc._M_impl ) );
- this->_M_insert(__f, _Facet::id);
- } else {
- this->_M_impl = _get_Locale_impl( __loc._M_impl );
- }
- }
-
-private:
- // those are for internal use
- locale(_Locale_impl* __impl) : _Locale(__impl) {}
- locale(const _Locale& __loc) : _Locale(__loc) {}
-
-public:
-
- locale(const locale& __loc1, const locale& __loc2, category __cat)
- : _Locale(__loc1, __loc2, __cat) {}
-
- const locale& operator=(const locale& __loc) _STLP_NOTHROW {
- _Locale::operator=(__loc);
- return *this;
- }
-
- template <class _Facet>
- locale combine(const locale& __loc) const {
- _Facet *__facet = 0;
- if (!_HasFacet(__loc, __facet))
- _M_throw_runtime_error();
-
- return locale(*this, _UseFacet(__loc, __facet));
- }
-
- // locale operations:
- bool operator==(const locale& __loc) const { return _Locale::operator==(__loc); }
- bool operator!=(const locale& __loc) const { return _Locale::operator!=(__loc); }
-
- template <class _CharT, class _Traits, class _Alloc>
- bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x,
- const basic_string<_CharT, _Traits, _Alloc>& __y) const
- { return __locale_do_operator_call(*this, __x, __y); }
-
- // global locale objects:
- static locale _STLP_CALL global(const locale& __loc) {
- return _Locale::global(__loc);
- }
- static const locale& _STLP_CALL classic() {
- return __STATIC_CAST(const locale&, _Locale::classic());
- }
-
- // friends:
- friend class _Locale_impl;
- friend class ios_base;
-};
-
-#endif /* _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND */
-
-//----------------------------------------------------------------------
-// locale globals
-
-#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
-template <class _Facet>
-inline const _Facet&
-_Use_facet<_Facet>::operator *() const
-#else
-template <class _Facet> inline const _Facet& use_facet(const locale& __loc)
-#endif
-{
- _Facet *__facet = 0;
- return *_UseFacet(__loc, __facet);
-}
-
-
-#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
-template <class _Facet>
-struct has_facet {
- const locale& __loc;
- has_facet(const locale& __p_loc) : __loc(__p_loc) {}
- operator bool() const _STLP_NOTHROW
-#else
-template <class _Facet> inline bool has_facet(const locale& __loc) _STLP_NOTHROW
-#endif
-{
- _Facet *__facet = 0;
- return _HasFacet(__loc, __facet);
-}
-
-#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
-}; // close class definition
-#endif
-
-template <class _Facet>
-bool _HasFacet(const locale& __loc, const _Facet* __facet) _STLP_NOTHROW
-{ return (__loc._M_get_facet(_Facet::id) != 0); }
-
-template <class _Facet>
-_Facet* _UseFacet(const locale& __loc, const _Facet* __facet)
-{ return __STATIC_CAST(_Facet*, __loc._M_use_facet(_Facet::id)); }
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_LOCALE_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_map.h b/stl/_map.h
deleted file mode 100644
index 15d2e3f..0000000
--- a/stl/_map.h
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_MAP_H
-#define _STLP_INTERNAL_MAP_H
-
-#ifndef _STLP_INTERNAL_TREE_H
-# include <stl/_tree.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//Specific iterator traits creation
-_STLP_CREATE_ITERATOR_TRAITS(MapTraitsT, traits)
-
-template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key> ),
- _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) >
-class map
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<map<_Key, _Tp, _Compare, _Alloc> >
-#endif
-{
- typedef map<_Key, _Tp, _Compare, _Alloc> _Self;
-public:
-
-// typedefs:
-
- typedef _Key key_type;
- typedef _Tp data_type;
- typedef _Tp mapped_type;
- typedef pair<const _Key, _Tp> value_type;
- typedef _Compare key_compare;
-
- class value_compare
- : public binary_function<value_type, value_type, bool> {
- friend class map<_Key,_Tp,_Compare,_Alloc>;
- protected :
- //c is a Standard name (23.3.1), do no make it STLport naming convention compliant.
- _Compare comp;
- value_compare(_Compare __c) : comp(__c) {}
- public:
- bool operator()(const value_type& __x, const value_type& __y) const
- { return comp(__x.first, __y.first); }
- };
-
-protected:
- typedef _STLP_PRIV _MapTraitsT<value_type> _MapTraits;
-
-public:
- //Following typedef have to be public for __move_traits specialization.
- typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
- value_type, _STLP_SELECT1ST(value_type, _Key),
- _MapTraits, _Alloc> _Rep_type;
-
- typedef typename _Rep_type::pointer pointer;
- typedef typename _Rep_type::const_pointer const_pointer;
- typedef typename _Rep_type::reference reference;
- typedef typename _Rep_type::const_reference const_reference;
- typedef typename _Rep_type::iterator iterator;
- typedef typename _Rep_type::const_iterator const_iterator;
- typedef typename _Rep_type::reverse_iterator reverse_iterator;
- typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
- typedef typename _Rep_type::size_type size_type;
- typedef typename _Rep_type::difference_type difference_type;
- typedef typename _Rep_type::allocator_type allocator_type;
-
-private:
- _Rep_type _M_t; // red-black tree representing map
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-public:
- // allocation/deallocation
- map() : _M_t(_Compare(), allocator_type()) {}
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit map(const _Compare& __comp,
- const allocator_type& __a = allocator_type())
-#else
- explicit map(const _Compare& __comp)
- : _M_t(__comp, allocator_type()) {}
- explicit map(const _Compare& __comp, const allocator_type& __a)
-#endif
- : _M_t(__comp, __a) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- map(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- template <class _InputIterator>
- map(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- map(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
- : _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); }
-# endif
-
-#else
- map(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- map(const value_type* __first,
- const value_type* __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-
- map(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- map(const_iterator __first, const_iterator __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- map(const _Self& __x) : _M_t(__x._M_t) {}
-
- map(__move_source<_Self> src)
- : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
-
- _Self& operator=(const _Self& __x) {
- _M_t = __x._M_t;
- return *this;
- }
-
- // accessors:
- key_compare key_comp() const { return _M_t.key_comp(); }
- value_compare value_comp() const { return value_compare(_M_t.key_comp()); }
- allocator_type get_allocator() const { return _M_t.get_allocator(); }
-
- iterator begin() { return _M_t.begin(); }
- const_iterator begin() const { return _M_t.begin(); }
- iterator end() { return _M_t.end(); }
- const_iterator end() const { return _M_t.end(); }
- reverse_iterator rbegin() { return _M_t.rbegin(); }
- const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
- reverse_iterator rend() { return _M_t.rend(); }
- const_reverse_iterator rend() const { return _M_t.rend(); }
- bool empty() const { return _M_t.empty(); }
- size_type size() const { return _M_t.size(); }
- size_type max_size() const { return _M_t.max_size(); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- _Tp& operator[](const _KT& __k) {
- iterator __i = lower_bound(__k);
- // __i->first is greater than or equivalent to __k.
- if (__i == end() || key_comp()(__k, (*__i).first))
- __i = insert(__i, value_type(__k, _STLP_DEFAULT_CONSTRUCTED(_Tp)));
- return (*__i).second;
- }
- void swap(_Self& __x) { _M_t.swap(__x._M_t); }
-
- // insert/erase
- pair<iterator,bool> insert(const value_type& __x)
- { return _M_t.insert_unique(__x); }
- iterator insert(iterator __pos, const value_type& __x)
- { return _M_t.insert_unique(__pos, __x); }
-#ifdef _STLP_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert(_InputIterator __first, _InputIterator __last)
- { _M_t.insert_unique(__first, __last); }
-#else
- void insert(const value_type* __first, const value_type* __last)
- { _M_t.insert_unique(__first, __last); }
- void insert(const_iterator __first, const_iterator __last)
- { _M_t.insert_unique(__first, __last); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- void erase(iterator __pos) { _M_t.erase(__pos); }
- size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); }
- void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); }
- void clear() { _M_t.clear(); }
-
- // map operations:
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __x) { return _M_t.find(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __x) const { return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator,iterator> equal_range(const _KT& __x)
- { return _M_t.equal_range_unique(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator,const_iterator> equal_range(const _KT& __x) const
- { return _M_t.equal_range_unique(__x); }
-};
-
-//Specific iterator traits creation
-_STLP_CREATE_ITERATOR_TRAITS(MultimapTraitsT, traits)
-
-template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key> ),
- _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) >
-class multimap
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<multimap<_Key, _Tp, _Compare, _Alloc> >
-#endif
-{
- typedef multimap<_Key, _Tp, _Compare, _Alloc> _Self;
-public:
-
-// typedefs:
-
- typedef _Key key_type;
- typedef _Tp data_type;
- typedef _Tp mapped_type;
- typedef pair<const _Key, _Tp> value_type;
- typedef _Compare key_compare;
-
- class value_compare : public binary_function<value_type, value_type, bool> {
- friend class multimap<_Key,_Tp,_Compare,_Alloc>;
- protected:
- //comp is a Standard name (23.3.2), do no make it STLport naming convention compliant.
- _Compare comp;
- value_compare(_Compare __c) : comp(__c) {}
- public:
- bool operator()(const value_type& __x, const value_type& __y) const
- { return comp(__x.first, __y.first); }
- };
-
-protected:
- //Specific iterator traits creation
- typedef _STLP_PRIV _MultimapTraitsT<value_type> _MultimapTraits;
-
-public:
- //Following typedef have to be public for __move_traits specialization.
- typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
- value_type, _STLP_SELECT1ST(value_type, _Key),
- _MultimapTraits, _Alloc> _Rep_type;
-
- typedef typename _Rep_type::pointer pointer;
- typedef typename _Rep_type::const_pointer const_pointer;
- typedef typename _Rep_type::reference reference;
- typedef typename _Rep_type::const_reference const_reference;
- typedef typename _Rep_type::iterator iterator;
- typedef typename _Rep_type::const_iterator const_iterator;
- typedef typename _Rep_type::reverse_iterator reverse_iterator;
- typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
- typedef typename _Rep_type::size_type size_type;
- typedef typename _Rep_type::difference_type difference_type;
- typedef typename _Rep_type::allocator_type allocator_type;
-
-private:
- _Rep_type _M_t; // red-black tree representing multimap
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-public:
- // allocation/deallocation
- multimap() : _M_t(_Compare(), allocator_type()) { }
- explicit multimap(const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { }
-
-#ifdef _STLP_MEMBER_TEMPLATES
- template <class _InputIterator>
- multimap(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
-# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
- template <class _InputIterator>
- multimap(_InputIterator __first, _InputIterator __last,
- const _Compare& __comp)
- : _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); }
-# endif
- template <class _InputIterator>
- multimap(_InputIterator __first, _InputIterator __last,
- const _Compare& __comp,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-#else
- multimap(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
- multimap(const value_type* __first, const value_type* __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-
- multimap(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
- multimap(const_iterator __first, const_iterator __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- multimap(const _Self& __x) : _M_t(__x._M_t) {}
-
- multimap(__move_source<_Self> src)
- : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
-
- _Self& operator=(const _Self& __x) {
- _M_t = __x._M_t;
- return *this;
- }
-
- // accessors:
-
- key_compare key_comp() const { return _M_t.key_comp(); }
- value_compare value_comp() const { return value_compare(_M_t.key_comp()); }
- allocator_type get_allocator() const { return _M_t.get_allocator(); }
-
- iterator begin() { return _M_t.begin(); }
- const_iterator begin() const { return _M_t.begin(); }
- iterator end() { return _M_t.end(); }
- const_iterator end() const { return _M_t.end(); }
- reverse_iterator rbegin() { return _M_t.rbegin(); }
- const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
- reverse_iterator rend() { return _M_t.rend(); }
- const_reverse_iterator rend() const { return _M_t.rend(); }
- bool empty() const { return _M_t.empty(); }
- size_type size() const { return _M_t.size(); }
- size_type max_size() const { return _M_t.max_size(); }
- void swap(_Self& __x) { _M_t.swap(__x._M_t); }
-
- // insert/erase
- iterator insert(const value_type& __x) { return _M_t.insert_equal(__x); }
- iterator insert(iterator __pos, const value_type& __x) { return _M_t.insert_equal(__pos, __x); }
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(_InputIterator __first, _InputIterator __last)
- { _M_t.insert_equal(__first, __last); }
-#else
- void insert(const value_type* __first, const value_type* __last)
- { _M_t.insert_equal(__first, __last); }
- void insert(const_iterator __first, const_iterator __last)
- { _M_t.insert_equal(__first, __last); }
-#endif /* _STLP_MEMBER_TEMPLATES */
- void erase(iterator __pos) { _M_t.erase(__pos); }
- size_type erase(const key_type& __x) { return _M_t.erase(__x); }
- void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); }
- void clear() { _M_t.clear(); }
-
- // multimap operations:
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __x) { return _M_t.find(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __x) const { return _M_t.count(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator,iterator> equal_range(const _KT& __x)
- { return _M_t.equal_range(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator,const_iterator> equal_range(const _KT& __x) const
- { return _M_t.equal_range(__x); }
-};
-
-#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _Compare, class _Alloc>
-#define _STLP_TEMPLATE_CONTAINER map<_Key,_Tp,_Compare,_Alloc>
-#include <stl/_relops_cont.h>
-#undef _STLP_TEMPLATE_CONTAINER
-#define _STLP_TEMPLATE_CONTAINER multimap<_Key,_Tp,_Compare,_Alloc>
-#include <stl/_relops_cont.h>
-#undef _STLP_TEMPLATE_CONTAINER
-#undef _STLP_TEMPLATE_HEADER
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Key, class _Tp, class _Compare, class _Alloc>
-struct __move_traits<map<_Key,_Tp,_Compare,_Alloc> > :
- _STLP_PRIV __move_traits_aux<typename map<_Key,_Tp,_Compare,_Alloc>::_Rep_type>
-{};
-
-template <class _Key, class _Tp, class _Compare, class _Alloc>
-struct __move_traits<multimap<_Key,_Tp,_Compare,_Alloc> > :
- _STLP_PRIV __move_traits_aux<typename multimap<_Key,_Tp,_Compare,_Alloc>::_Rep_type>
-{};
-#endif
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_MAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_mbstate_t.h b/stl/_mbstate_t.h
deleted file mode 100644
index 4aa936f..0000000
--- a/stl/_mbstate_t.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_MBSTATE_T
-#define _STLP_INTERNAL_MBSTATE_T
-
-#if (defined (__OpenBSD__) || defined (__FreeBSD__)) && defined (__GNUC__) && !defined (_GLIBCPP_HAVE_MBSTATE_T)
-# define __mbstate_t_defined /* mbstate_t defined in native <cwchar>, so not defined in C! */
-#endif
-
-#if defined (_STLP_NO_NATIVE_MBSTATE_T) && !defined (_STLP_NO_MBSTATE_T) && !defined (_MBSTATE_T) && !defined (__mbstate_t_defined)
-# define _STLP_USE_OWN_MBSTATE_T
-# define _MBSTATE_T
-#endif
-
-#if defined (_STLP_USE_OWN_MBSTATE_T)
-typedef int mbstate_t;
-
-# if defined (__cplusplus)
-_STLP_BEGIN_NAMESPACE
-using ::mbstate_t;
-_STLP_END_NAMESPACE
-# endif
-
-#endif /* _STLP_USE_OWN_MBSTATE_T */
-
-#endif /* _STLP_INTERNAL_MBSTATE_T */
diff --git a/stl/_messages_facets.h b/stl/_messages_facets.h
deleted file mode 100644
index eb4f869..0000000
--- a/stl/_messages_facets.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-// WARNING: This is an internal header file, included by other C++
-// standard library headers. You should not attempt to use this header
-// file directly.
-
-
-#ifndef _STLP_INTERNAL_MESSAGES_H
-#define _STLP_INTERNAL_MESSAGES_H
-
-#ifndef _STLP_IOS_BASE_H
-# include <stl/_ios_base.h>
-#endif
-
-#ifndef _STLP_C_LOCALE_H
-# include <stl/c_locale.h>
-#endif
-
-#ifndef _STLP_INTERNAL_STRING_H
-# include <stl/_string.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-// messages facets
-
-class messages_base {
- public:
- typedef int catalog;
-};
-
-template <class _CharT> class messages {};
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-class _Messages;
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC messages<char> : public locale::facet, public messages_base {
- friend class _Locale_impl;
-public:
- typedef messages_base::catalog catalog;
- typedef char char_type;
- typedef string string_type;
-
- explicit messages(size_t __refs = 0);
-
- catalog open(const string& __fn, const locale& __loc) const
- { return do_open(__fn, __loc); }
- string_type get(catalog __c, int __set, int __msgid,
- const string_type& __dfault) const
- { return do_get(__c, __set, __msgid, __dfault); }
- inline void close(catalog __c) const
- { do_close(__c); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-private:
- messages(_STLP_PRIV _Messages*);
-
-protected:
- messages(size_t, _Locale_messages*);
- ~messages();
-
- virtual catalog do_open(const string& __fn, const locale& __loc) const;
- virtual string_type do_get(catalog __c, int __set, int __msgid,
- const string_type& __dfault) const;
- virtual void do_close(catalog __c) const;
-
- void _M_initialize(const char* __name);
-
-private:
- _STLP_PRIV _Messages* _M_impl;
-};
-
-#if !defined (_STLP_NO_WCHAR_T)
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC messages<wchar_t> : public locale::facet, public messages_base {
- friend class _Locale_impl;
-public:
- typedef messages_base::catalog catalog;
- typedef wchar_t char_type;
- typedef wstring string_type;
-
- explicit messages(size_t __refs = 0);
-
- inline catalog open(const string& __fn, const locale& __loc) const
- { return do_open(__fn, __loc); }
- inline string_type get(catalog __c, int __set, int __msgid,
- const string_type& __dfault) const
- { return do_get(__c, __set, __msgid, __dfault); }
- inline void close(catalog __c) const
- { do_close(__c); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-private:
- messages(_STLP_PRIV _Messages*);
-
-protected:
- messages(size_t, _Locale_messages*);
- ~messages();
-
- virtual catalog do_open(const string& __fn, const locale& __loc) const;
- virtual string_type do_get(catalog __c, int __set, int __msgid,
- const string_type& __dfault) const;
- virtual void do_close(catalog __c) const;
-
- void _M_initialize(const char* __name);
-
-private:
- _STLP_PRIV _Messages* _M_impl;
-};
-
-#endif
-
-template <class _CharT> class messages_byname {};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC messages_byname<char> : public messages<char> {
-public:
- typedef messages_base::catalog catalog;
- typedef string string_type;
-
- explicit messages_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
-
-protected:
- ~messages_byname();
-
-private:
- typedef messages_byname<char> _Self;
- //explicitely defined as private to avoid warnings:
- messages_byname(_Self const&);
- _Self& operator = (_Self const&);
-};
-
-#if !defined (_STLP_NO_WCHAR_T)
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC messages_byname<wchar_t> : public messages<wchar_t> {
-public:
- typedef messages_base::catalog catalog;
- typedef wstring string_type;
-
- explicit messages_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
-
-protected:
- ~messages_byname();
-
-private:
- typedef messages_byname<wchar_t> _Self;
- //explicitely defined as private to avoid warnings:
- messages_byname(_Self const&);
- _Self& operator = (_Self const&);
-};
-#endif /* WCHAR_T */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_MESSAGES_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_monetary.c b/stl/_monetary.c
deleted file mode 100644
index f801128..0000000
--- a/stl/_monetary.c
+++ /dev/null
@@ -1,604 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_MONETARY_C
-#define _STLP_MONETARY_C
-
-# ifndef _STLP_INTERNAL_MONETARY_H
-# include <stl/_monetary.h>
-# endif
-
-#ifndef _STLP_INTERNAL_IOS_H
-# include <stl/_ios.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NUM_PUT_H
-# include <stl/_num_put.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NUM_GET_H
-# include <stl/_num_get.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if (_STLP_STATIC_TEMPLATE_DATA > 0)
-
-# if !defined (__BORLANDC__)
-template <class _CharT, class _InputIterator>
-locale::id money_get<_CharT, _InputIterator>::id;
-
-template <class _CharT, class _OutputIterator>
-locale::id money_put<_CharT, _OutputIterator>::id;
-# endif
-
-# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \
- defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)
-/*
- * Under cygwin, when STLport is used as a shared library, the id needs
- * to be specified as imported otherwise they will be duplicated in the
- * calling executable.
- */
-template <>
-_STLP_DECLSPEC locale::id money_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
-/*
-template <>
-_STLP_DECLSPEC locale::id money_get<char, const char*>::id;
-*/
-
-template <>
-_STLP_DECLSPEC locale::id money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
-template <>
-_STLP_DECLSPEC locale::id money_put<char, char*>::id;
-
-# if !defined (_STLP_NO_WCHAR_T)
-template <>
-_STLP_DECLSPEC locale::id money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
-template <>
-_STLP_DECLSPEC locale::id money_get<wchar_t, const wchar_t*>::id;
-
-template <>
-_STLP_DECLSPEC locale::id money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
-template <>
-_STLP_DECLSPEC locale::id money_put<wchar_t, wchar_t*>::id;
-# endif
-
-# endif
-
-#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
-
-//typedef money_get<char, const char*> money_get_char;
-//typedef money_put<char, char*> money_put_char;
-typedef money_get<char, istreambuf_iterator<char, char_traits<char> > > money_get_char_2;
-typedef money_put<char, ostreambuf_iterator<char, char_traits<char> > > money_put_char_2;
-
-//__DECLARE_INSTANCE(locale::id, money_get_char::id, );
-//__DECLARE_INSTANCE(locale::id, money_put_char::id, );
-__DECLARE_INSTANCE(locale::id, money_get_char_2::id, );
-__DECLARE_INSTANCE(locale::id, money_put_char_2::id, );
-
-# ifndef _STLP_NO_WCHAR_T
-
-//typedef money_get<wchar_t, const wchar_t*> money_get_wchar_t;
-//typedef money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_get_wchar_t_2;
-typedef money_put<wchar_t, wchar_t*> money_put_wchar_t;
-typedef money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_put_wchar_t_2;
-
-//__DECLARE_INSTANCE(locale::id, money_get_wchar_t::id, );
-//__DECLARE_INSTANCE(locale::id, money_put_wchar_t::id, );
-__DECLARE_INSTANCE(locale::id, money_get_wchar_t_2::id, );
-__DECLARE_INSTANCE(locale::id, money_put_wchar_t_2::id, );
-
-# endif
-#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
-
-// money_get facets
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// helper functions for do_get
-template <class _InIt1, class _InIt2>
-pair<_InIt1, bool> __get_string( _InIt1 __first, _InIt1 __last,
- _InIt2 __str_first, _InIt2 __str_last) {
- while ( __first != __last && __str_first != __str_last && *__first == *__str_first ) {
- ++__first;
- ++__str_first;
- }
- return make_pair(__first, __str_first == __str_last);
-}
-
-template <class _InIt, class _OuIt, class _CharT>
-bool
-__get_monetary_value(_InIt& __first, _InIt __last, _OuIt __out_ite,
- const ctype<_CharT>& _c_type,
- _CharT __point, int __frac_digits, _CharT __sep,
- const string& __grouping, bool &__syntax_ok) {
- if (__first == __last || !_c_type.is(ctype_base::digit, *__first))
- return false;
-
- char __group_sizes[128];
- char* __group_sizes_end = __grouping.empty()? 0 : __group_sizes;
- char __current_group_size = 0;
-
- while (__first != __last) {
- if (_c_type.is(ctype_base::digit, *__first)) {
- ++__current_group_size;
- *__out_ite++ = *__first++;
- }
- else if (__group_sizes_end) {
- if (*__first == __sep) {
- *__group_sizes_end++ = __current_group_size;
- __current_group_size = 0;
- ++__first;
- }
- else break;
- }
- else
- break;
- }
-
- if (__grouping.empty())
- __syntax_ok = true;
- else {
- if (__group_sizes_end != __group_sizes)
- *__group_sizes_end++ = __current_group_size;
-
- __syntax_ok = __valid_grouping(__group_sizes, __group_sizes_end,
- __grouping.data(), __grouping.data()+ __grouping.size());
-
- if (__first == __last || *__first != __point) {
- for (int __digits = 0; __digits != __frac_digits; ++__digits)
- *__out_ite++ = _CharT('0');
- return true; // OK not to have decimal point
- }
- }
-
- ++__first;
-
- int __digits = 0;
-
- while (__first != __last && _c_type.is(ctype_base::digit, *__first)) {
- *__out_ite++ = *__first++;
- ++__digits;
- }
-
- __syntax_ok = __syntax_ok && (__digits == __frac_digits);
-
- return true;
-}
-
-
-template <class _CharT, class _InputIter, class _StrType>
-_InputIter __money_do_get(_InputIter __s, _InputIter __end, bool __intl,
- ios_base& __str, ios_base::iostate& __err,
- _StrType& __digits, bool &__is_positive, _CharT* /*__dummy*/) {
- if (__s == __end) {
- __err |= ios_base::eofbit;
- return __s;
- }
-
- typedef _CharT char_type;
- typedef _StrType string_type;
- typedef _InputIter iter_type;
- typedef moneypunct<char_type, false> _Punct;
- typedef moneypunct<char_type, true> _Punct_intl;
- typedef ctype<char_type> _Ctype;
-
- locale __loc = __str.getloc();
- const _Punct& __punct = use_facet<_Punct>(__loc) ;
- const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
- const _Ctype& __c_type = use_facet<_Ctype>(__loc) ;
-
- money_base::pattern __format = __intl ? __punct_intl.neg_format()
- : __punct.neg_format();
- string_type __ns = __intl ? __punct_intl.negative_sign()
- : __punct.negative_sign();
- string_type __ps = __intl ? __punct_intl.positive_sign()
- : __punct.positive_sign();
- int __i;
- bool __symbol_required = (__str.flags() & ios_base::showbase) != 0;
- string_type __buf;
- back_insert_iterator<string_type> __out_ite(__buf);
-
- for (__i = 0; __i < 4; ++__i) {
- switch (__format.field[__i]) {
- case money_base::none:
- if (__i == 3) {
- if (__c_type.is(ctype_base::space, *__s)) {
- __err = ios_base::failbit;
- return __s;
- }
- break;
- }
- while (__s != __end && __c_type.is(ctype_base::space, *__s))
- ++__s;
- break;
- case money_base::space:
- if (!__c_type.is(ctype_base::space, *__s)) {
- __err = ios_base::failbit;
- return __s;
- }
- ++__s;
- while (__s != __end && __c_type.is(ctype_base::space, *__s))
- ++__s;
- break;
- case money_base::symbol: {
- string_type __curs = __intl ? __punct_intl.curr_symbol()
- : __punct.curr_symbol();
- pair<iter_type, bool>
- __result = __get_string(__s, __end, __curs.begin(), __curs.end());
- if (!__result.second && __symbol_required)
- __err = ios_base::failbit;
- __s = __result.first;
- break;
- }
- case money_base::sign: {
- if (__s == __end) {
- if (__ps.empty())
- break;
- if (__ns.empty()) {
- __is_positive = false;
- break;
- }
- __err = ios_base::failbit;
- return __s;
- }
- else {
- if (__ps.empty()) {
- if (__ns.empty())
- break;
- if (*__s == __ns[0]) {
- ++__s;
- __is_positive = false;
- }
- break;
- }
- else {
- if (*__s == __ps[0]) {
- ++__s;
- break;
- }
- if (__ns.empty())
- break;
- if (*__s == __ns[0]) {
- ++__s;
- __is_positive = false;
- break;
- }
- __err = ios_base::failbit;
- }
- }
- return __s;
- }
- case money_base::value: {
- char_type __point = __intl ? __punct_intl.decimal_point()
- : __punct.decimal_point();
- int __frac_digits = __intl ? __punct_intl.frac_digits()
- : __punct.frac_digits();
- string __grouping = __intl ? __punct_intl.grouping()
- : __punct.grouping();
- bool __syntax_ok = true;
-
- bool __result;
-
- char_type __sep = __grouping.empty() ? char_type() :
- __intl ? __punct_intl.thousands_sep() : __punct.thousands_sep();
-
- __result = __get_monetary_value(__s, __end, __out_ite, __c_type,
- __point, __frac_digits,
- __sep,
- __grouping, __syntax_ok);
-
- if (!__syntax_ok)
- __err |= ios_base::failbit;
- if (!__result) {
- __err = ios_base::failbit;
- return __s;
- }
- break;
-
- } // Close money_base::value case
- } // Close switch statement
- } // Close for loop
-
- if (__is_positive) {
- if (__ps.size() > 1) {
- pair<_InputIter, bool>
- __result = __get_string(__s, __end, __ps.begin() + 1, __ps.end());
- __s = __result.first;
- if (!__result.second)
- __err |= ios::failbit;
- }
- if (!(__err & ios_base::failbit))
- __digits = __buf;
- }
- else {
- if (__ns.size() > 1) {
- pair<_InputIter, bool>
- __result = __get_string(__s, __end, __ns.begin() + 1, __ns.end());
- __s = __result.first;
- if (!__result.second)
- __err |= ios::failbit;
- }
- if (!(__err & ios::failbit)) {
- __digits = __c_type.widen('-');
- __digits += __buf;
- }
- }
- if (__s == __end)
- __err |= ios::eofbit;
-
- return __s;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-//===== methods ======
-template <class _CharT, class _InputIter>
-_InputIter
-money_get<_CharT, _InputIter>::do_get(_InputIter __s, _InputIter __end, bool __intl,
- ios_base& __str, ios_base::iostate& __err,
- _STLP_LONGEST_FLOAT_TYPE& __units) const {
- string_type __buf;
- bool __is_positive = true;
- __s = _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __buf, __is_positive, (_CharT*)0);
-
- if (__err == ios_base::goodbit || __err == ios_base::eofbit) {
- typename string_type::iterator __b = __buf.begin(), __e = __buf.end();
-
- if (!__is_positive) ++__b;
- // Can't use atold, since it might be wchar_t. Don't get confused by name below :
- // it's perfectly capable of reading long double.
- _STLP_PRIV __get_decimal_integer(__b, __e, __units, (_CharT*)0);
-
- if (!__is_positive) {
- __units = -__units;
- }
- }
-
- return __s;
-}
-
-template <class _CharT, class _InputIter>
-_InputIter
-money_get<_CharT, _InputIter>::do_get(iter_type __s, iter_type __end, bool __intl,
- ios_base& __str, ios_base::iostate& __err,
- string_type& __digits) const {
- bool __is_positive = true;
- return _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __digits, __is_positive, (_CharT*)0);
-}
-
-// money_put facets
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _CharT, class _OutputIter, class _Str_Type, class _Str>
-_OutputIter __money_do_put(_OutputIter __s, bool __intl, ios_base& __str,
- _CharT __fill, const _Str& __digits, bool __check_digits,
- _Str_Type * /*__dummy*/) {
- typedef _CharT char_type;
- typedef _Str_Type string_type;
- typedef ctype<char_type> _Ctype;
- typedef moneypunct<char_type, false> _Punct;
- typedef moneypunct<char_type, true> _Punct_intl;
-
- locale __loc = __str.getloc();
- const _Ctype& __c_type = use_facet<_Ctype>(__loc) ;
- const _Punct& __punct = use_facet<_Punct>(__loc) ;
- const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
-
- // some special characters
- char_type __minus = __c_type.widen('-');
- char_type __plus = __c_type.widen('+');
- char_type __space = __c_type.widen(' ');
- char_type __zero = __c_type.widen('0');
- char_type __point = __intl ? __punct_intl.decimal_point()
- : __punct.decimal_point();
-
- char_type __sep = __intl ? __punct_intl.thousands_sep()
- : __punct.thousands_sep();
-
- string __grouping = __intl ? __punct_intl.grouping()
- : __punct.grouping();
-
- int __frac_digits = __intl ? __punct_intl.frac_digits()
- : __punct.frac_digits();
-
- string_type __curr_sym = __intl ? __punct_intl.curr_symbol()
- : __punct.curr_symbol();
-
- // if there are no digits we are going to return __s. If there
- // are digits, but not enough to fill the frac_digits, we are
- // going to add zeros. I don't know whether this is right or
- // not.
- if (__digits.empty())
- return __s;
-
- typename string_type::const_iterator __digits_first = __digits.begin();
- typename string_type::const_iterator __digits_last = __digits.end();
-
- bool __is_negative = *__digits_first == __minus;
- if (__is_negative)
- ++__digits_first;
-
-#if !defined (__BORLANDC__)
- string_type __sign = __intl ? __is_negative ? __punct_intl.negative_sign()
- : __punct_intl.positive_sign()
- : __is_negative ? __punct.negative_sign()
- : __punct.positive_sign();
-#else
- string_type __sign;
- if (__intl) {
- if (__is_negative)
- __sign = __punct_intl.negative_sign();
- else
- __sign = __punct_intl.positive_sign();
- }
- else {
- if (__is_negative)
- __sign = __punct.negative_sign();
- else
- __sign = __punct.positive_sign();
- }
-#endif
-
- if (__check_digits) {
- typename string_type::const_iterator __cp = __digits_first;
- while (__cp != __digits_last && __c_type.is(ctype_base::digit, *__cp))
- ++__cp;
- if (__cp == __digits_first)
- return __s;
- __digits_last = __cp;
- }
-
- // If grouping is required, we make a copy of __digits and
- // insert the grouping.
- _STLP_BASIC_IOSTRING(char_type) __new_digits;
- if (!__grouping.empty()) {
- __new_digits.assign(__digits_first, __digits_last);
- __insert_grouping(__new_digits,
- __new_digits.size() - __frac_digits,
- __grouping,
- __sep, __plus, __minus, 0);
- __digits_first = __new_digits.begin(); // <<--
- __digits_last = __new_digits.end(); // <<--
- }
-
- // Determine the amount of padding required, if any.
- streamsize __width = __str.width();
-
-#if defined (_STLP_DEBUG) && (defined(__HP_aCC) && (__HP_aCC <= 1))
- size_t __value_length = operator -(__digits_last, __digits_first);
-#else
- size_t __value_length = __digits_last - __digits_first;
-#endif
-
- size_t __length = __value_length + __sign.size();
-
- if (__frac_digits != 0)
- ++__length;
-
- bool __generate_curr = (__str.flags() & ios_base::showbase) !=0;
- if (__generate_curr)
- __length += __curr_sym.size();
- money_base::pattern __format = __intl ? (__is_negative ? __punct_intl.neg_format()
- : __punct_intl.pos_format())
- : (__is_negative ? __punct.neg_format()
- : __punct.pos_format());
- {
- //For the moment the following is commented for decoding reason.
- //No reason to add a space last if the money symbol do not have to be display
- //if (__format.field[3] == (char) money_base::symbol && !__generate_curr) {
- // if (__format.field[2] == (char) money_base::space) {
- // __format.field[2] = (char) money_base::none;
- // }
- //}
- //space can only be second or third and only once (22.2.6.3-1):
- if ((__format.field[1] == (char) money_base::space) ||
- (__format.field[2] == (char) money_base::space))
- ++__length;
- }
-
- const bool __need_fill = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __length) < __width)) ||
- ((sizeof(streamsize) <= sizeof(size_t)) && (__length < __STATIC_CAST(size_t, __width))));
- streamsize __fill_amt = __need_fill ? __width - __length : 0;
-
- ios_base::fmtflags __fill_pos = __str.flags() & ios_base::adjustfield;
-
- if (__fill_amt != 0 &&
- !(__fill_pos & (ios_base::left | ios_base::internal)))
- __s = __fill_n(__s, __fill_amt, __fill);
-
- for (int __i = 0; __i < 4; ++__i) {
- char __ffield = __format.field[__i];
- switch (__ffield) {
- case money_base::none:
- if (__fill_amt != 0 && __fill_pos == ios_base::internal)
- __s = __fill_n(__s, __fill_amt, __fill);
- break;
- case money_base::space:
- *__s++ = __space;
- if (__fill_amt != 0 && __fill_pos == ios_base::internal)
- __s = __fill_n(__s, __fill_amt, __fill);
- break;
- case money_base::symbol:
- if (__generate_curr)
- __s = copy(__curr_sym.begin(), __curr_sym.end(), __s);
- break;
- case money_base::sign:
- if (!__sign.empty())
- *__s++ = __sign[0];
- break;
- case money_base::value:
- if (__frac_digits == 0) {
- __s = copy(__digits_first, __digits_last, __s);
- } else {
- if ((int)__value_length <= __frac_digits) {
- // if we see '9' here, we should out 0.09
- *__s++ = __zero; // integer part is zero
- *__s++ = __point; // decimal point
- __s = __fill_n(__s, __frac_digits - __value_length, __zero); // zeros
- __s = copy(__digits_first, __digits_last, __s); // digits
- } else {
- __s = copy(__digits_first, __digits_last - __frac_digits, __s);
- if (__frac_digits != 0) {
- *__s++ = __point;
- __s = copy(__digits_last - __frac_digits, __digits_last, __s);
- }
- }
- }
- break;
- } //Close for switch
- } // Close for loop
-
- // Ouput rest of sign if necessary.
- if (__sign.size() > 1)
- __s = copy(__sign.begin() + 1, __sign.end(), __s);
- if (__fill_amt != 0 &&
- !(__fill_pos & (ios_base::right | ios_base::internal)))
- __s = __fill_n(__s, __fill_amt, __fill);
-
- return __s;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _CharT, class _OutputIter>
-_OutputIter
-money_put<_CharT, _OutputIter>
- ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
- char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const {
- _STLP_BASIC_IOSTRING(char_type) __digits;
- _STLP_PRIV __get_money_digits(__digits, __str, __units);
- return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, false, __STATIC_CAST(string_type*, 0));
-}
-
-template <class _CharT, class _OutputIter>
-_OutputIter
-money_put<_CharT, _OutputIter>
- ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
- char_type __fill, const string_type& __digits) const {
- return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, true, __STATIC_CAST(string_type*, 0));
-}
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_MONETARY_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_monetary.h b/stl/_monetary.h
deleted file mode 100644
index 906f2e8..0000000
--- a/stl/_monetary.h
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// WARNING: This is an internal header file, included by other C++
-// standard library headers. You should not attempt to use this header
-// file directly.
-
-
-#ifndef _STLP_INTERNAL_MONETARY_H
-#define _STLP_INTERNAL_MONETARY_H
-
-#ifndef _STLP_INTERNAL_CTYPE_H
-# include <stl/_ctype.h>
-#endif
-
-#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
-# include <stl/_ostreambuf_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
-# include <stl/_istreambuf_iterator.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-class money_base {
-public:
- enum part {none, space, symbol, sign, value};
- struct pattern {
- char field[4];
- };
-};
-
-// moneypunct facets: forward declaration
-template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool, _International, false) > class moneypunct {};
-
-// money_get facets
-
-#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-template <class _CharT, class _InputIter>
-#else
-template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
-#endif
-class money_get : public locale::facet {
- friend class _Locale_impl;
-
-public:
- typedef _CharT char_type;
- typedef _InputIter iter_type;
- typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
-
- money_get(size_t __refs = 0) : locale::facet(__refs) {}
- iter_type get(iter_type __s, iter_type __end, bool __intl,
- ios_base& __str, ios_base::iostate& __err,
- _STLP_LONGEST_FLOAT_TYPE& __units) const
- { return do_get(__s, __end, __intl, __str, __err, __units); }
- iter_type get(iter_type __s, iter_type __end, bool __intl,
- ios_base& __str, ios_base::iostate& __err,
- string_type& __digits) const
- { return do_get(__s, __end, __intl, __str, __err, __digits); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- ~money_get() {}
- virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
- ios_base& __str, ios_base::iostate& __err,
- _STLP_LONGEST_FLOAT_TYPE& __units) const;
- virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
- ios_base& __str, ios_base::iostate& __err,
- string_type& __digits) const;
-};
-
-
-// moneypunct facets: definition of specializations
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC moneypunct<char, true> : public locale::facet, public money_base {
-
-public:
- typedef char char_type;
- typedef string string_type;
- explicit moneypunct _STLP_PSPEC2(char, true) (size_t __refs = 0);
-
- char decimal_point() const { return do_decimal_point(); }
- char thousands_sep() const { return do_thousands_sep(); }
- string grouping() const { return do_grouping(); }
- string_type curr_symbol() const { return do_curr_symbol(); }
- string_type positive_sign() const { return do_positive_sign(); }
- string_type negative_sign() const { return do_negative_sign(); }
- int frac_digits() const { return do_frac_digits(); }
- pattern pos_format() const { return do_pos_format(); }
- pattern neg_format() const { return do_neg_format(); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-# if defined (_STLP_STATIC_CONST_INIT_BUG)
- enum _IntlVal { intl = 1 } ;
-# else
- static const bool intl = true;
-# endif
-
-protected:
- pattern _M_pos_format;
- pattern _M_neg_format;
-
- ~moneypunct _STLP_PSPEC2(char, true) ();
-
- virtual char do_decimal_point() const;
- virtual char do_thousands_sep() const;
- virtual string do_grouping() const;
-
- virtual string do_curr_symbol() const;
-
- virtual string do_positive_sign() const;
- virtual string do_negative_sign() const;
- virtual int do_frac_digits() const;
- virtual pattern do_pos_format() const;
- virtual pattern do_neg_format() const;
-
- friend class _Locale_impl;
-};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC moneypunct<char, false> : public locale::facet, public money_base
-{
-public:
- typedef char char_type;
- typedef string string_type;
-
- explicit moneypunct _STLP_PSPEC2(char, false) (size_t __refs = 0);
-
- char decimal_point() const { return do_decimal_point(); }
- char thousands_sep() const { return do_thousands_sep(); }
- string grouping() const { return do_grouping(); }
- string_type curr_symbol() const { return do_curr_symbol(); }
- string_type positive_sign() const { return do_positive_sign(); }
- string_type negative_sign() const { return do_negative_sign(); }
- int frac_digits() const { return do_frac_digits(); }
- pattern pos_format() const { return do_pos_format(); }
- pattern neg_format() const { return do_neg_format(); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-# if defined (_STLP_STATIC_CONST_INIT_BUG)
- enum _IntlVal { intl = 0 } ;
-# else
- static const bool intl = false;
-# endif
-
-protected:
- pattern _M_pos_format;
- pattern _M_neg_format;
-
- ~moneypunct _STLP_PSPEC2(char, false) ();
-
- virtual char do_decimal_point() const;
- virtual char do_thousands_sep() const;
- virtual string do_grouping() const;
-
- virtual string do_curr_symbol() const;
-
- virtual string do_positive_sign() const;
- virtual string do_negative_sign() const;
- virtual int do_frac_digits() const;
- virtual pattern do_pos_format() const;
- virtual pattern do_neg_format() const;
-
- friend class _Locale_impl;
-};
-
-
-# ifndef _STLP_NO_WCHAR_T
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, true> : public locale::facet, public money_base
-{
- friend class _Locale_impl;
-public:
- typedef wchar_t char_type;
- typedef wstring string_type;
- explicit moneypunct _STLP_PSPEC2(wchar_t, true) (size_t __refs = 0);
- wchar_t decimal_point() const { return do_decimal_point(); }
- wchar_t thousands_sep() const { return do_thousands_sep(); }
- string grouping() const { return do_grouping(); }
- string_type curr_symbol() const { return do_curr_symbol(); }
- string_type positive_sign() const { return do_positive_sign(); }
- string_type negative_sign() const { return do_negative_sign(); }
- int frac_digits() const { return do_frac_digits(); }
- pattern pos_format() const { return do_pos_format(); }
- pattern neg_format() const { return do_neg_format(); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-# if defined (_STLP_STATIC_CONST_INIT_BUG)
- enum _IntlVal { intl = 1 } ;
-# else
- static const bool intl = true;
-# endif
-
-protected:
- pattern _M_pos_format;
- pattern _M_neg_format;
-
- ~moneypunct _STLP_PSPEC2(wchar_t, true) ();
-
- virtual wchar_t do_decimal_point() const;
- virtual wchar_t do_thousands_sep() const;
- virtual string do_grouping() const;
-
- virtual string_type do_curr_symbol() const;
-
- virtual string_type do_positive_sign() const;
- virtual string_type do_negative_sign() const;
- virtual int do_frac_digits() const;
- virtual pattern do_pos_format() const;
- virtual pattern do_neg_format() const;
-};
-
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, false> : public locale::facet, public money_base
-{
- friend class _Locale_impl;
-public:
- typedef wchar_t char_type;
- typedef wstring string_type;
- explicit moneypunct _STLP_PSPEC2(wchar_t, false) (size_t __refs = 0);
- wchar_t decimal_point() const { return do_decimal_point(); }
- wchar_t thousands_sep() const { return do_thousands_sep(); }
- string grouping() const { return do_grouping(); }
- string_type curr_symbol() const { return do_curr_symbol(); }
- string_type positive_sign() const { return do_positive_sign(); }
- string_type negative_sign() const { return do_negative_sign(); }
- int frac_digits() const { return do_frac_digits(); }
- pattern pos_format() const { return do_pos_format(); }
- pattern neg_format() const { return do_neg_format(); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-# if defined (_STLP_STATIC_CONST_INIT_BUG)
- enum _IntlVal { intl = 0 } ;
-# else
- static const bool intl = false;
-# endif
-
-protected:
- pattern _M_pos_format;
- pattern _M_neg_format;
-
- ~moneypunct _STLP_PSPEC2(wchar_t, false) ();
-
- virtual wchar_t do_decimal_point() const;
- virtual wchar_t do_thousands_sep() const;
- virtual string do_grouping() const;
-
- virtual string_type do_curr_symbol() const;
-
- virtual string_type do_positive_sign() const;
- virtual string_type do_negative_sign() const;
- virtual int do_frac_digits() const;
- virtual pattern do_pos_format() const;
- virtual pattern do_neg_format() const;
-};
-
-# endif
-
-template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool , _International , false) > class moneypunct_byname {};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC moneypunct_byname<char, true> : public moneypunct<char, true> {
-public:
- typedef money_base::pattern pattern;
- typedef char char_type;
- typedef string string_type;
-
- explicit moneypunct_byname _STLP_PSPEC2(char, true) (const char * __name, size_t __refs = 0,
- _Locale_name_hint* __hint = 0);
-
-protected:
- _Locale_monetary* _M_monetary;
- ~moneypunct_byname _STLP_PSPEC2(char, true) ();
- virtual char do_decimal_point() const;
- virtual char do_thousands_sep() const;
- virtual string do_grouping() const;
-
- virtual string_type do_curr_symbol() const;
-
- virtual string_type do_positive_sign() const;
- virtual string_type do_negative_sign() const;
- virtual int do_frac_digits() const;
-
-private:
- typedef moneypunct_byname<char, true> _Self;
- //explicitely defined as private to avoid warnings:
- moneypunct_byname(_Self const&);
- _Self& operator = (_Self const&);
-};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC moneypunct_byname<char, false> : public moneypunct<char, false>
-{
-public:
- typedef money_base::pattern pattern;
- typedef char char_type;
- typedef string string_type;
-
- explicit moneypunct_byname _STLP_PSPEC2(char, false) (const char * __name, size_t __refs = 0,
- _Locale_name_hint* __hint = 0);
-
-protected:
- _Locale_monetary* _M_monetary;
- ~moneypunct_byname _STLP_PSPEC2(char, false) ();
- virtual char do_decimal_point() const;
- virtual char do_thousands_sep() const;
- virtual string do_grouping() const;
-
- virtual string_type do_curr_symbol() const;
-
- virtual string_type do_positive_sign() const;
- virtual string_type do_negative_sign() const;
- virtual int do_frac_digits() const;
-
-private:
- typedef moneypunct_byname<char, false> _Self;
- //explicitely defined as private to avoid warnings:
- moneypunct_byname(_Self const&);
- _Self& operator = (_Self const&);
- friend _Locale_name_hint* _Locale_extract_hint(moneypunct_byname<char, false>*);
-};
-
-#if !defined (_STLP_NO_WCHAR_T)
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, true> : public moneypunct<wchar_t, true>
-{
-public:
- typedef money_base::pattern pattern;
- typedef wchar_t char_type;
- typedef wstring string_type;
-
- explicit moneypunct_byname _STLP_PSPEC2(wchar_t, true) (const char * __name, size_t __refs = 0,
- _Locale_name_hint* __hint = 0);
-
-protected:
- _Locale_monetary* _M_monetary;
- ~moneypunct_byname _STLP_PSPEC2(wchar_t, true) ();
- virtual wchar_t do_decimal_point() const;
- virtual wchar_t do_thousands_sep() const;
- virtual string do_grouping() const;
-
- virtual string_type do_curr_symbol() const;
-
- virtual string_type do_positive_sign() const;
- virtual string_type do_negative_sign() const;
- virtual int do_frac_digits() const;
-
-private:
- typedef moneypunct_byname<wchar_t, true> _Self;
- //explicitely defined as private to avoid warnings:
- moneypunct_byname(_Self const&);
- _Self& operator = (_Self const&);
-};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, false> : public moneypunct<wchar_t, false>
-{
-public:
- typedef money_base::pattern pattern;
- typedef wchar_t char_type;
- typedef wstring string_type;
-
- explicit moneypunct_byname _STLP_PSPEC2(wchar_t, false) (const char * __name, size_t __refs = 0,
- _Locale_name_hint* __hint = 0);
-
-protected:
- _Locale_monetary* _M_monetary;
- ~moneypunct_byname _STLP_PSPEC2(wchar_t, false) ();
- virtual wchar_t do_decimal_point() const;
- virtual wchar_t do_thousands_sep() const;
- virtual string do_grouping() const;
-
- virtual string_type do_curr_symbol() const;
-
- virtual string_type do_positive_sign() const;
- virtual string_type do_negative_sign() const;
- virtual int do_frac_digits() const;
-
-private:
- typedef moneypunct_byname<wchar_t, false> _Self;
- //explicitely defined as private to avoid warnings:
- moneypunct_byname(_Self const&);
- _Self& operator = (_Self const&);
-};
-#endif
-
-//===== methods ======
-
-
-// money_put facets
-
-#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-template <class _CharT, class _OutputIter>
-#else
-template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
-#endif
-class money_put : public locale::facet {
- friend class _Locale_impl;
-
-public:
- typedef _CharT char_type;
- typedef _OutputIter iter_type;
- typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
-
- money_put(size_t __refs = 0) : locale::facet(__refs) {}
- iter_type put(iter_type __s, bool __intl, ios_base& __str,
- char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const
- { return do_put(__s, __intl, __str, __fill, __units); }
- iter_type put(iter_type __s, bool __intl, ios_base& __str,
- char_type __fill,
- const string_type& __digits) const
- { return do_put(__s, __intl, __str, __fill, __digits); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- ~money_put() {}
- virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
- char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const;
- virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
- char_type __fill,
- const string_type& __digits) const;
-};
-
-# if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS money_get<char, istreambuf_iterator<char, char_traits<char> > >;
-_STLP_EXPORT_TEMPLATE_CLASS money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
-//_STLP_EXPORT_TEMPLATE_CLASS money_get<char, const char* >;
-//_STLP_EXPORT_TEMPLATE_CLASS money_put<char, char* >;
-# if ! defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
-_STLP_EXPORT_TEMPLATE_CLASS money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
-// _STLP_EXPORT_TEMPLATE_CLASS money_get<wchar_t, const wchar_t* >;
-// _STLP_EXPORT_TEMPLATE_CLASS money_put<wchar_t, wchar_t* >;
-# endif
-# endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_monetary.c>
-#endif
-
-#endif /* _STLP_INTERNAL_MONETARY_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
-
diff --git a/stl/_move_construct_fwk.h b/stl/_move_construct_fwk.h
deleted file mode 100644
index 5f65a9d..0000000
--- a/stl/_move_construct_fwk.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- *
- * Copyright (c) 2003
- * François Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_MOVE_CONSTRUCT_FWK_H
-#define _STLP_MOVE_CONSTRUCT_FWK_H
-
-#ifndef _STLP_TYPE_TRAITS_H
-# include <stl/type_traits.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-/*************************************************************
- * Move constructor framework
- *************************************************************/
-
-/*************************************************************
- *Partial move:
- *The source HAS to be a valid instance after the move!
- *************************************************************/
-template <class _Tp>
-class __move_source {
-public:
- explicit __move_source (_Tp &_src) : _M_data(_src)
- {}
-
- _Tp& get() const
- { return _M_data; }
-private:
- _Tp &_M_data;
-
- //We explicitely forbid assignment to avoid warning:
- typedef __move_source<_Tp> _Self;
- _Self& operator = (_Self const&);
-};
-
-//Class used to signal move constructor support, implementation and type.
-template <class _Tp>
-struct __move_traits {
- /*
- * implemented tells if a the special move constructor has to be called or the classic
- * copy constructor is just fine. Most of the time the copy constructor is fine only
- * if the following info is true.
- */
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && \
- !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && \
- !defined (_STLP_NO_MOVE_SEMANTIC)
- typedef typename _IsSTLportClass<_Tp>::_Ret implemented;
-#else
- typedef __false_type implemented;
-#endif
- /*
- * complete tells if the move is complete or partial, that is to say, does the source
- * needs to be destroyed once it has been moved.
- */
- typedef typename __type_traits<_Tp>::has_trivial_destructor complete;
-};
-
-#if !defined (_STLP_NO_MOVE_SEMANTIC)
-typedef __true_type __stlp_movable;
-#else
-typedef __false_type __stlp_movable;
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-/*
- * This struct should never be used if the user has not explicitely stipulated
- * that its class support the full move concept. To check that the return type
- * in such a case will be __invalid_source<_Tp> to generate a compile error
- * revealing the configuration problem.
- */
-template <class _Tp>
-struct _MoveSourceTraits {
- typedef typename __move_traits<_Tp>::implemented _MvImpRet;
-#if defined (__BORLANDC__)
- typedef typename __selectT<_MvImpRet,
-#else
- enum {_MvImp = __type2bool<_MvImpRet>::_Ret};
- typedef typename __select<_MvImp,
-#endif
- __move_source<_Tp>,
- _Tp const&>::_Ret _Type;
-};
-
-//The helper function
-template <class _Tp>
-inline _STLP_TYPENAME_ON_RETURN_TYPE _MoveSourceTraits<_Tp>::_Type
-_AsMoveSource (_Tp &src) {
- typedef typename _MoveSourceTraits<_Tp>::_Type _SrcType;
- return _SrcType(src);
-}
-
-//Helper structs used for many class.
-template <class _Tp>
-struct __move_traits_aux {
- typedef typename __move_traits<_Tp>::implemented implemented;
- typedef typename __move_traits<_Tp>::complete complete;
-};
-
-template <class _Tp1, class _Tp2>
-struct __move_traits_aux2 {
- typedef __move_traits<_Tp1> _MoveTraits1;
- typedef __move_traits<_Tp2> _MoveTraits2;
-
- typedef typename _Lor2<typename _MoveTraits1::implemented,
- typename _MoveTraits2::implemented>::_Ret implemented;
- typedef typename _Land2<typename _MoveTraits1::complete,
- typename _MoveTraits2::complete>::_Ret complete;
-};
-
-/*
- * Most of the time a class implement a move constructor but its use depends
- * on a third party, this is what the following struct are for.
- */
-template <class _Tp>
-struct __move_traits_help {
- typedef __true_type implemented;
- typedef typename __move_traits<_Tp>::complete complete;
-};
-
-template <class _Tp1, class _Tp2>
-struct __move_traits_help1 {
- typedef __move_traits<_Tp1> _MoveTraits1;
- typedef __move_traits<_Tp2> _MoveTraits2;
-
- typedef typename _Lor2<typename _MoveTraits1::implemented,
- typename _MoveTraits2::implemented>::_Ret implemented;
- typedef typename _Land2<typename _MoveTraits1::complete,
- typename _MoveTraits2::complete>::_Ret complete;
-};
-
-template <class _Tp1, class _Tp2>
-struct __move_traits_help2 {
- typedef __move_traits<_Tp1> _MoveTraits1;
- typedef __move_traits<_Tp2> _MoveTraits2;
-
- typedef __stlp_movable implemented;
- typedef typename _Land2<typename _MoveTraits1::complete,
- typename _MoveTraits2::complete>::_Ret complete;
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_MOVE_CONSTRUCT_FWK_H */
diff --git a/stl/_new.h b/stl/_new.h
deleted file mode 100644
index dabc5fa..0000000
--- a/stl/_new.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_NEW
-#define _STLP_INTERNAL_NEW
-
-#ifndef _STLP_INTERNAL_CSTDDEF
-// size_t
-# include <stl/_cstddef.h>
-#endif
-
-#if defined (__BORLANDC__) && (__BORLANDC__ < 0x580)
-// new.h uses ::malloc ;(
-# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
-using _STLP_VENDOR_CSTD::malloc;
-#endif
-
-#if !defined (_STLP_NO_NEW_NEW_HEADER)
-# if defined (_STLP_BROKEN_BAD_ALLOC_CLASS)
-# define bad_alloc _STLP_NULLIFIED_BROKEN_BAD_ALLOC_CLASS
-# define nothrow_t _STLP_NULLIFIED_BROKEN_BAD_NOTHROW_T_CLASS
-# define nothrow _STLP_NULLIFIED_BROKEN_BAD_NOTHROW
-# endif
-
-// eMbedded Visual C++ .NET unfortunately uses _INC_NEW for both <new.h> and <new>
-// we undefine the symbol to get the stuff in the SDK's <new>
-# if defined (_STLP_WCE_NET) && defined (_INC_NEW)
-# undef _INC_NEW
-# endif
-
-# if defined (new)
-/* STLport cannot replace native Std library new header if new is a macro,
- * please define new macro after <new> header inclusion.
- */
-# error Cannot include native new header as new is a macro.
-# endif
-
-# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new)
-
-# if defined (_STLP_BROKEN_BAD_ALLOC_CLASS)
-# undef bad_alloc
-# undef nothrow_t
-# undef nothrow
-# undef _STLP_NULLIFIED_BROKEN_BAD_ALLOC_CLASS
-# undef _STLP_NULLIFIED_BROKEN_BAD_NOTHROW_T_CLASS
-# undef _STLP_NULLIFIED_BROKEN_BAD_NOTHROW
-# endif
-#else
-# include <new.h>
-#endif
-
-#if defined (_STLP_NO_BAD_ALLOC) && !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
-# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
-#endif
-
-#if defined (_STLP_USE_EXCEPTIONS) && defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
-
-# ifndef _STLP_INTERNAL_EXCEPTION
-# include <stl/_exception.h>
-# endif
-
-_STLP_BEGIN_NAMESPACE
-
-# if defined (_STLP_NO_BAD_ALLOC)
-struct nothrow_t {};
-# define nothrow nothrow_t()
-# endif
-
-/*
- * STLport own bad_alloc exception to be used if the native C++ library
- * do not define it or when the new operator do not throw it to avoid
- * a useless library dependency.
- */
-class bad_alloc : public exception {
-public:
- bad_alloc () _STLP_NOTHROW_INHERENTLY { }
- bad_alloc(const bad_alloc&) _STLP_NOTHROW_INHERENTLY { }
- bad_alloc& operator=(const bad_alloc&) _STLP_NOTHROW_INHERENTLY {return *this;}
- ~bad_alloc () _STLP_NOTHROW_INHERENTLY { }
- const char* what() const _STLP_NOTHROW_INHERENTLY { return "bad alloc"; }
-};
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_USE_EXCEPTIONS && (_STLP_NO_BAD_ALLOC || _STLP_NEW_DONT_THROW_BAD_ALLOC) */
-
-#if defined (_STLP_RTTI_BUG)
-_STLP_BEGIN_NAMESPACE
-
-inline void* _STLP_CALL __stl_new(size_t __n)
-{ return ::malloc(__n); }
-
-inline void _STLP_CALL __stl_delete(void* __p)
-{ ::free(__p); }
-_STLP_END_NAMESPACE
-
-#else /* _STLP_RTTI_BUG */
-
-# if defined (_STLP_USE_OWN_NAMESPACE)
-
-_STLP_BEGIN_NAMESPACE
-
-# if !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
-using _STLP_VENDOR_EXCEPT_STD::bad_alloc;
-# endif
-
-# if !defined (_STLP_NO_BAD_ALLOC)
-using _STLP_VENDOR_EXCEPT_STD::nothrow_t;
-using _STLP_VENDOR_EXCEPT_STD::nothrow;
-# if defined (_STLP_GLOBAL_NEW_HANDLER)
-using ::new_handler;
-using ::set_new_handler;
-# else
-using _STLP_VENDOR_EXCEPT_STD::new_handler;
-using _STLP_VENDOR_EXCEPT_STD::set_new_handler;
-# endif
-# endif /* !_STLP_NO_BAD_ALLOC */
-
-_STLP_END_NAMESPACE
-# endif /* _STLP_USE_OWN_NAMESPACE */
-
-# if defined (_STLP_USE_EXCEPTIONS) && \
- (defined (_STLP_NO_NEW_NEW_HEADER) || defined (_STLP_NEW_DONT_THROW_BAD_ALLOC))
-# define _STLP_CHECK_NULL_ALLOC(__x) void* __y = __x; if (__y == 0) { _STLP_THROW(_STLP_STD::bad_alloc()); } return __y
-# else
-# define _STLP_CHECK_NULL_ALLOC(__x) return __x
-# endif
-
-_STLP_BEGIN_NAMESPACE
-
-# if ((defined (__IBMCPP__) || defined (__OS400__) || defined (__xlC__) || defined (qTidyHeap)) && defined (__DEBUG_ALLOC__))
-inline void* _STLP_CALL __stl_new(size_t __n) { _STLP_CHECK_NULL_ALLOC(::operator _STLP_NEW(__n, __FILE__, __LINE__)); }
-inline void _STLP_CALL __stl_delete(void* __p) { ::operator delete(__p, __FILE__, __LINE__); }
-# else
-inline void* _STLP_CALL __stl_new(size_t __n) { _STLP_CHECK_NULL_ALLOC(::operator _STLP_NEW(__n)); }
-inline void _STLP_CALL __stl_delete(void* __p) { ::operator delete(__p); }
-# endif
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_RTTI_BUG */
-
-#endif /* _STLP_INTERNAL_NEW */
-
-
-/*
- * Local Variables:
- * mode:C++
- * End:
- */
diff --git a/stl/_null_stream.h b/stl/_null_stream.h
deleted file mode 100644
index ecdb7a2..0000000
--- a/stl/_null_stream.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2000
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_NULL_STREAM_H
-# define _STLP_NULL_STREAM_H
-
-_STLP_BEGIN_NAMESPACE
-
-struct __null_stream
-{
- void flush() { }
-};
-
-template <class _Tp>
-__null_stream& operator <<(__null_stream& __x, const _Tp& )
-{
- return __x;
-}
-
-template <class _Tp>
-__null_stream& operator >>(const _Tp&, __null_stream& __x )
-{
- return __x;
-}
-
-extern __null_stream cin, cout, cerr, endl, ws, hex, dec;
-
-_STLP_END_NAMESPACE
-
-# endif
diff --git a/stl/_num_get.c b/stl/_num_get.c
deleted file mode 100644
index da12993..0000000
--- a/stl/_num_get.c
+++ /dev/null
@@ -1,679 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_NUM_GET_C
-#define _STLP_NUM_GET_C
-
-#ifndef _STLP_INTERNAL_NUM_GET_H
-# include <stl/_num_get.h>
-#endif
-
-#ifndef _STLP_INTERNAL_LIMITS
-# include <stl/_limits.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-_STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned);
-_STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms();
-
-template < class _InputIter, class _Integer, class _CharT>
-_InputIter _STLP_CALL
-__do_get_integer(_InputIter&, _InputIter&, ios_base&, ios_base::iostate&, _Integer&, _CharT*);
-
-// __do_get_integer and its helper functions.
-
-inline bool _STLP_CALL __get_fdigit(char __c, const char*)
-{ return __c >= '0' && __c <= '9'; }
-
-inline bool _STLP_CALL __get_fdigit_or_sep(char& __c, char __sep, const char *__digits) {
- if (__c == __sep) {
- __c = ',' ;
- return true ;
- }
- else
- return __get_fdigit(__c, __digits);
-}
-
-inline int _STLP_CALL
-__get_digit_from_table(unsigned __index)
-{ return (__index > 127 ? 0xFF : __digit_val_table(__index)); }
-
-template <class _InputIter, class _CharT>
-int
-__get_base_or_zero(_InputIter& __in_ite, _InputIter& __end, ios_base& __str, _CharT*) {
- _CharT __atoms[5];
- const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __str._M_ctype_facet());
-
- __c_type.widen(__narrow_atoms(), __narrow_atoms() + 5, __atoms);
-
- bool __negative = false;
- _CharT __c = *__in_ite;
-
- if (__c == __atoms[1] /* __xminus_char */ ) {
- __negative = true;
- ++__in_ite;
- }
- else if (__c == __atoms[0] /* __xplus_char */ )
- ++__in_ite;
-
- int __base;
- int __valid_zero = 0;
-
- ios_base::fmtflags __basefield = __str.flags() & ios_base::basefield;
-
- switch (__basefield) {
- case ios_base::oct:
- __base = 8;
- break;
- case ios_base::dec:
- __base = 10;
- break;
- case ios_base::hex:
- __base = 16;
- if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
- ++__in_ite;
- if (__in_ite != __end &&
- (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ ))
- ++__in_ite;
- else
- __valid_zero = 1; // That zero is valid by itself.
- }
- break;
- default:
- if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
- ++__in_ite;
- if (__in_ite != __end &&
- (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) {
- ++__in_ite;
- __base = 16;
- }
- else
- {
- __base = 8;
- __valid_zero = 1; // That zero is still valid by itself.
- }
- }
- else
- __base = 10;
- break;
- }
- return (__base << 2) | ((int)__negative << 1) | __valid_zero;
-}
-
-
-template <class _InputIter, class _Integer, class _CharT>
-bool _STLP_CALL
-__get_integer(_InputIter& __first, _InputIter& __last,
- int __base, _Integer& __val,
- int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __true_type& /*_IsSigned*/) {
- bool __ovflow = false;
- _Integer __result = 0;
- bool __is_group = !__grouping.empty();
- char __group_sizes[64];
- char __current_group_size = 0;
- char* __group_sizes_end = __group_sizes;
-
- _Integer __over_base = (numeric_limits<_Integer>::min)() / __STATIC_CAST(_Integer, __base);
-
- for ( ; __first != __last ; ++__first) {
-
- const _CharT __c = *__first;
-
- if (__is_group && __c == __separator) {
- *__group_sizes_end++ = __current_group_size;
- __current_group_size = 0;
- continue;
- }
-
- int __n = __get_digit_from_table(__c);
-
- if (__n >= __base)
- break;
-
- ++__got;
- ++__current_group_size;
-
- if (__result < __over_base)
- __ovflow = true; // don't need to keep accumulating
- else {
- _Integer __next = __STATIC_CAST(_Integer, __base * __result - __n);
- if (__result != 0)
- __ovflow = __ovflow || __next >= __result;
- __result = __next;
- }
- }
-
- if (__is_group && __group_sizes_end != __group_sizes) {
- *__group_sizes_end++ = __current_group_size;
- }
-
- // fbp : added to not modify value if nothing was read
- if (__got > 0) {
- __val = __ovflow ? __is_negative ? (numeric_limits<_Integer>::min)()
- : (numeric_limits<_Integer>::max)()
- : __is_negative ? __result
- : __STATIC_CAST(_Integer, -__result);
- }
- // overflow is being treated as failure
- return ((__got > 0) && !__ovflow) &&
- (__is_group == 0 ||
- __valid_grouping(__group_sizes, __group_sizes_end,
- __grouping.data(), __grouping.data()+ __grouping.size()));
-}
-
-template <class _InputIter, class _Integer, class _CharT>
-bool _STLP_CALL
-__get_integer(_InputIter& __first, _InputIter& __last,
- int __base, _Integer& __val,
- int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __false_type& /*_IsSigned*/) {
- bool __ovflow = false;
- _Integer __result = 0;
- bool __is_group = !__grouping.empty();
- char __group_sizes[64];
- char __current_group_size = 0;
- char* __group_sizes_end = __group_sizes;
-
- _Integer __over_base = (numeric_limits<_Integer>::max)() / __STATIC_CAST(_Integer, __base);
-
- for ( ; __first != __last ; ++__first) {
-
- const _CharT __c = *__first;
-
- if (__is_group && __c == __separator) {
- *__group_sizes_end++ = __current_group_size;
- __current_group_size = 0;
- continue;
- }
-
- int __n = __get_digit_from_table(__c);
-
- if (__n >= __base)
- break;
-
- ++__got;
- ++__current_group_size;
-
- if (__result > __over_base)
- __ovflow = true; //don't need to keep accumulating
- else {
- _Integer __next = __STATIC_CAST(_Integer, __base * __result + __n);
- if (__result != 0)
- __ovflow = __ovflow || __next <= __result;
- __result = __next;
- }
- }
-
- if (__is_group && __group_sizes_end != __group_sizes) {
- *__group_sizes_end++ = __current_group_size;
- }
-
- // fbp : added to not modify value if nothing was read
- if (__got > 0) {
- __val = __ovflow ? (numeric_limits<_Integer>::max)()
- : (__is_negative ? __STATIC_CAST(_Integer, -__result)
- : __result);
- }
-
- // overflow is being treated as failure
- return ((__got > 0) && !__ovflow) &&
- (__is_group == 0 ||
- __valid_grouping(__group_sizes, __group_sizes_end,
- __grouping.data(), __grouping.data()+ __grouping.size()));
-}
-
-
-template <class _InputIter, class _Integer, class _CharT>
-bool _STLP_CALL
-__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT* /*dummy*/) {
- string __grp;
- //Here there is no grouping so separator is not important, we just pass the default charater.
- return __get_integer(__first, __last, 10, __val, 0, false, _CharT() /*separator*/, __grp, __false_type());
-}
-
-template <class _InputIter, class _Integer, class _CharT>
-_InputIter _STLP_CALL
-__do_get_integer(_InputIter& __in_ite, _InputIter& __end, ios_base& __str,
- ios_base::iostate& __err, _Integer& __val, _CharT* __pc) {
-#if defined (__HP_aCC) && (__HP_aCC == 1)
- bool _IsSigned = !((_Integer)(-1) > 0);
-#else
- typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
-#endif
-
- const numpunct<_CharT>& __numpunct = *__STATIC_CAST(const numpunct<_CharT>*, __str._M_numpunct_facet());
- const string& __grouping = __str._M_grouping(); // cached copy
-
- const int __base_or_zero = __get_base_or_zero(__in_ite, __end, __str, __pc);
- int __got = __base_or_zero & 1;
-
- bool __result;
-
- if (__in_ite == __end) { // We may have already read a 0. If so,
-
- if (__got > 0) { // the result is 0 even if we're at eof.
- __val = 0;
- __result = true;
- }
- else
- __result = false;
- }
- else {
- const bool __negative = (__base_or_zero & 2) != 0;
- const int __base = __base_or_zero >> 2;
-
-#if defined (__HP_aCC) && (__HP_aCC == 1)
- if (_IsSigned)
- __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, __true_type() );
- else
- __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, __false_type() );
-#else
- __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __numpunct.thousands_sep(), __grouping, _IsSigned());
-# endif
- }
-
- __err = __STATIC_CAST(ios_base::iostate, __result ? ios_base::goodbit : ios_base::failbit);
-
- if (__in_ite == __end)
- __err |= ios_base::eofbit;
- return __in_ite;
-}
-
-// __read_float and its helper functions.
-template <class _InputIter, class _CharT>
-_InputIter _STLP_CALL
-__copy_sign(_InputIter __first, _InputIter __last, __iostring& __v,
- _CharT __xplus, _CharT __xminus) {
- if (__first != __last) {
- _CharT __c = *__first;
- if (__c == __xplus)
- ++__first;
- else if (__c == __xminus) {
- __v.push_back('-');
- ++__first;
- }
- }
- return __first;
-}
-
-
-template <class _InputIter, class _CharT>
-bool _STLP_CALL
-__copy_digits(_InputIter& __first, _InputIter __last,
- __iostring& __v, const _CharT* __digits) {
- bool __ok = false;
-
- for ( ; __first != __last; ++__first) {
- _CharT __c = *__first;
- if (__get_fdigit(__c, __digits)) {
- __v.push_back((char)__c);
- __ok = true;
- }
- else
- break;
- }
- return __ok;
-}
-
-template <class _InputIter, class _CharT>
-bool _STLP_CALL
-__copy_grouped_digits(_InputIter& __first, _InputIter __last,
- __iostring& __v, const _CharT * __digits,
- _CharT __sep, const string& __grouping,
- bool& __grouping_ok) {
- bool __ok = false;
- char __group_sizes[64];
- char*__group_sizes_end = __group_sizes;
- char __current_group_size = 0;
-
- for ( ; __first != __last; ++__first) {
- _CharT __c = *__first;
- bool __tmp = __get_fdigit_or_sep(__c, __sep, __digits);
- if (__tmp) {
- if (__c == ',') {
- *__group_sizes_end++ = __current_group_size;
- __current_group_size = 0;
- }
- else {
- __ok = true;
- __v.push_back((char)__c);
- ++__current_group_size;
- }
- }
- else
- break;
- }
-
- if (__group_sizes_end != __group_sizes)
- *__group_sizes_end++ = __current_group_size;
- __grouping_ok = __valid_grouping(__group_sizes, __group_sizes_end, __grouping.data(), __grouping.data() + __grouping.size());
- return __ok;
-}
-
-
-template <class _InputIter, class _CharT>
-bool _STLP_CALL
-__read_float(__iostring& __buf, _InputIter& __in_ite, _InputIter& __end, ios_base& __s, _CharT*) {
- // Create a string, copying characters of the form
- // [+-]? [0-9]* .? [0-9]* ([eE] [+-]? [0-9]+)?
-
- bool __digits_before_dot /* = false */;
- bool __digits_after_dot = false;
- bool __ok;
-
- bool __grouping_ok = true;
-
- const ctype<_CharT>& __ct = *__STATIC_CAST(const ctype<_CharT>*, __s._M_ctype_facet());
- const numpunct<_CharT>& __numpunct = *__STATIC_CAST(const numpunct<_CharT>*, __s._M_numpunct_facet());
- const string& __grouping = __s._M_grouping(); // cached copy
-
- _CharT __dot = __numpunct.decimal_point();
- _CharT __sep = __numpunct.thousands_sep();
-
- _CharT __digits[10];
- _CharT __xplus;
- _CharT __xminus;
-
- _CharT __pow_e;
- _CharT __pow_E;
-
- _Initialize_get_float(__ct, __xplus, __xminus, __pow_e, __pow_E, __digits);
-
- // Get an optional sign
- __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
-
- // Get an optional string of digits.
- if (!__grouping.empty())
- __digits_before_dot = __copy_grouped_digits(__in_ite, __end, __buf, __digits,
- __sep, __grouping, __grouping_ok);
- else
- __digits_before_dot = __copy_digits(__in_ite, __end, __buf, __digits);
-
- // Get an optional decimal point, and an optional string of digits.
- if (__in_ite != __end && *__in_ite == __dot) {
- __buf.push_back('.');
- ++__in_ite;
- __digits_after_dot = __copy_digits(__in_ite, __end, __buf, __digits);
- }
-
- // There have to be some digits, somewhere.
- __ok = __digits_before_dot || __digits_after_dot;
-
- // Get an optional exponent.
- if (__ok && __in_ite != __end && (*__in_ite == __pow_e || *__in_ite == __pow_E)) {
- __buf.push_back('e');
- ++__in_ite;
- __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
- __ok = __copy_digits(__in_ite, __end, __buf, __digits);
- // If we have an exponent then the sign
- // is optional but the digits aren't.
- }
-
- return __ok;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-//
-// num_get<>, num_put<>
-//
-
-#if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
-# if !defined (__BORLANDC__)
-template <class _CharT, class _InputIterator>
-locale::id num_get<_CharT, _InputIterator>::id;
-# endif
-
-# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \
- defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)
-/*
- * Under cygwin, when STLport is used as a shared library, the id needs
- * to be specified as imported otherwise they will be duplicated in the
- * calling executable.
- */
-template <>
-_STLP_DECLSPEC locale::id num_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
-/*
-template <>
-_STLP_DECLSPEC locale::id num_get<char, const char*>::id;
-*/
-
-# if !defined (STLP_NO_WCHAR_T)
-template <>
-_STLP_DECLSPEC locale::id num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
-/*
-template <>
-_STLP_DECLSPEC locale::id num_get<wchar_t, const wchar_t*>::id;
-*/
-# endif
-
-# endif /* __CYGWIN__ && _STLP_USE_DYNAMIC_LIB */
-
-#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
-
-//typedef num_get<char, const char*> num_get_char;
-typedef num_get<char, istreambuf_iterator<char, char_traits<char> > > num_get_char_2;
-
-//__DECLARE_INSTANCE(locale::id, num_get_char::id, );
-__DECLARE_INSTANCE(locale::id, num_get_char_2::id, );
-
-# if !defined (_STLP_NO_WCHAR_T)
-
-//typedef num_get<wchar_t, const wchar_t*> num_get_wchar_t;
-typedef num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > num_get_wchar_t_2;
-
-//__DECLARE_INSTANCE(locale::id, num_get_wchar_t::id, );
-__DECLARE_INSTANCE(locale::id, num_get_wchar_t_2::id, );
-
-# endif
-
-#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
-
-#if !defined (_STLP_NO_BOOL)
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end,
- ios_base& __s,
- ios_base::iostate& __err, bool& __x) const {
- if (__s.flags() & ios_base::boolalpha) {
- locale __loc = __s.getloc();
- const _Numpunct& __np = *__STATIC_CAST(const _Numpunct*, __s._M_numpunct_facet());
- // const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc) ;
-// const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc) ;
-
- const basic_string<_CharT> __truename = __np.truename();
- const basic_string<_CharT> __falsename = __np.falsename();
- bool __true_ok = true;
- bool __false_ok = true;
-
- size_t __n = 0;
- for ( ; __in_ite != __end; ++__in_ite) {
- _CharT __c = *__in_ite;
- __true_ok = __true_ok && (__c == __truename[__n]);
- __false_ok = __false_ok && (__c == __falsename[__n]);
- ++__n;
-
- if ((!__true_ok && !__false_ok) ||
- (__true_ok && __n >= __truename.size()) ||
- (__false_ok && __n >= __falsename.size())) {
- ++__in_ite;
- break;
- }
- }
- if (__true_ok && __n < __truename.size()) __true_ok = false;
- if (__false_ok && __n < __falsename.size()) __false_ok = false;
-
- if (__true_ok || __false_ok) {
- __err = ios_base::goodbit;
- __x = __true_ok;
- }
- else
- __err = ios_base::failbit;
-
- if (__in_ite == __end)
- __err |= ios_base::eofbit;
-
- return __in_ite;
- }
-
- else {
- long __lx;
- _InputIter __tmp = this->do_get(__in_ite, __end, __s, __err, __lx);
- if (!(__err & ios_base::failbit)) {
- if (__lx == 0)
- __x = false;
- else if (__lx == 1)
- __x = true;
- else
- __err |= ios_base::failbit;
- }
- return __tmp;
- }
-}
-
-#endif /* _STLP_NO_BOOL */
-
-#if defined (_STLP_FIX_LIBRARY_ISSUES)
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, short& __val) const
-{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
-
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, int& __val) const
-{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
-
-#endif
-
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, long& __val) const
-{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
-
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err,
- unsigned short& __val) const
-{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
-
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err,
- unsigned int& __val) const
-{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
-
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err,
- unsigned long& __val) const
-{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
-
-
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err,
- float& __val) const {
- _STLP_PRIV __iostring __buf ;
- bool __ok = _STLP_PRIV __read_float(__buf, __in_ite, __end, __str, (_CharT*)0 );
- _STLP_PRIV __string_to_float(__buf, __val);
- __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit);
- if (__in_ite == __end)
- __err |= ios_base::eofbit;
- return __in_ite;
-}
-
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err,
- double& __val) const {
- _STLP_PRIV __iostring __buf ;
- bool __ok = _STLP_PRIV __read_float(__buf, __in_ite, __end, __str, (_CharT*)0 );
- _STLP_PRIV __string_to_float(__buf, __val);
- __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit);
- if (__in_ite == __end)
- __err |= ios_base::eofbit;
- return __in_ite;
-}
-
-#if !defined (_STLP_NO_LONG_DOUBLE)
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err,
- long double& __val) const {
- _STLP_PRIV __iostring __buf ;
- bool __ok = _STLP_PRIV __read_float(__buf, __in_ite, __end, __str, (_CharT*)0 );
- _STLP_PRIV __string_to_float(__buf, __val);
- __err = __STATIC_CAST(ios_base::iostate, __ok ? ios_base::goodbit : ios_base::failbit);
- if (__in_ite == __end)
- __err |= ios_base::eofbit;
- return __in_ite;
-}
-#endif /* _STLP_NO_LONG_DOUBLE */
-
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err,
- void*& __p) const {
-#if defined (_STLP_LONG_LONG) && !defined (__MRC__) //*ty 12/07/2001 - MrCpp can not cast from long long to void*
- unsigned _STLP_LONG_LONG __val;
-#else
- unsigned long __val;
-#endif
- iter_type __tmp = _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 );
- if (!(__err & ios_base::failbit))
- __p = __REINTERPRET_CAST(void*,__val);
- return __tmp;
- }
-
-#if defined (_STLP_LONG_LONG)
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err,
- _STLP_LONG_LONG& __val) const {
- return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 );
-}
-
-template <class _CharT, class _InputIter>
-_InputIter
-num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err,
- unsigned _STLP_LONG_LONG& __val) const {
- return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 );
-}
-#endif /* _STLP_LONG_LONG */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_NUMERIC_FACETS_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_num_get.h b/stl/_num_get.h
deleted file mode 100644
index d764eea..0000000
--- a/stl/_num_get.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// WARNING: This is an internal header file, included by other C++
-// standard library headers. You should not attempt to use this header
-// file directly.
-
-
-#ifndef _STLP_INTERNAL_NUM_GET_H
-#define _STLP_INTERNAL_NUM_GET_H
-
-#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
-# include <stl/_istreambuf_iterator.h>
-#endif
-
-#ifndef _STLP_C_LOCALE_H
-# include <stl/c_locale.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NUMPUNCT_H
-# include <stl/_numpunct.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CTYPE_H
-# include <stl/_ctype.h>
-#endif
-
-#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
-# include <stl/_iostream_string.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//----------------------------------------------------------------------
-// num_get facets
-
-#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-template <class _CharT, class _InputIter>
-#else
-template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
-#endif
-class num_get: public locale::facet {
- friend class _Locale_impl;
-public:
- typedef _CharT char_type;
- typedef _InputIter iter_type;
-
- explicit num_get(size_t __refs = 0): locale::facet(__refs) {}
-
-#if !defined (_STLP_NO_BOOL)
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, bool& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-#endif
-
-#if defined (_STLP_FIX_LIBRARY_ISSUES)
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, short& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, int& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-#endif
-
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, long& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, unsigned short& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, unsigned int& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, unsigned long& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-
-#if defined (_STLP_LONG_LONG)
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, _STLP_LONG_LONG& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-#endif /* _STLP_LONG_LONG */
-
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, float& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, double& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-
-#if !defined (_STLP_NO_LONG_DOUBLE)
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, long double& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-# endif
-
- _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, void*& __val) const
- { return do_get(__ii, __end, __str, __err, __val); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- ~num_get() {}
-
- typedef string string_type;
- typedef ctype<_CharT> _Ctype;
- typedef numpunct<_CharT> _Numpunct;
-
-#if !defined (_STLP_NO_BOOL)
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, bool& __val) const;
-#endif
-
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, long& __val) const;
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, unsigned short& __val) const;
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, unsigned int& __val) const;
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, unsigned long& __val) const;
-
-#if defined (_STLP_FIX_LIBRARY_ISSUES)
- // issue 118 : those are actually not supposed to be here
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, short& __val) const;
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, int& __val) const;
-#endif
-
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, float& __val) const;
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, double& __val) const;
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, void*& __p) const;
-
-#if !defined (_STLP_NO_LONG_DOUBLE)
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, long double& __val) const;
-#endif
-
-#if defined (_STLP_LONG_LONG)
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, _STLP_LONG_LONG& __val) const;
- virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
- ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const;
-#endif
-
-};
-
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS num_get<char, istreambuf_iterator<char, char_traits<char> > >;
-// _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
-# if !defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
-// _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
-# endif
-#endif
-
-#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-_STLP_DECLSPEC bool _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
-
-template <class _InputIter, class _Integer, class _CharT>
-bool _STLP_CALL
-__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT*);
-
-# if !defined (_STLP_NO_WCHAR_T)
-bool _STLP_DECLSPEC _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*);
-bool _STLP_DECLSPEC _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
-# endif
-
-inline void _STLP_CALL
-_Initialize_get_float(const ctype<char>&,
- char& Plus, char& Minus,
- char& pow_e, char& pow_E,
- char*) {
- Plus = '+';
- Minus = '-';
- pow_e = 'e';
- pow_E = 'E';
-}
-
-# if !defined (_STLP_NO_WCHAR_T)
-void _STLP_DECLSPEC _STLP_CALL _Initialize_get_float(const ctype<wchar_t>&,
- wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
-# endif
-void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, float&);
-void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, double&);
-# if !defined (_STLP_NO_LONG_DOUBLE)
-void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, long double&);
-# endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_num_get.c>
-#endif
-
-#endif /* _STLP_INTERNAL_NUM_GET_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_num_put.c b/stl/_num_put.c
deleted file mode 100644
index 5bc7c3b..0000000
--- a/stl/_num_put.c
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_NUM_PUT_C
-#define _STLP_NUM_PUT_C
-
-#ifndef _STLP_INTERNAL_NUM_PUT_H
-# include <stl/_num_put.h>
-#endif
-
-#ifndef _STLP_INTERNAL_LIMITS
-# include <stl/_limits.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// __do_put_float and its helper functions. Strategy: write the output
-// to a buffer of char, transform the buffer to _CharT, and then copy
-// it to the output.
-
-//----------------------------------------------------------------------
-// num_put facet
-
-template <class _CharT, class _OutputIter>
-_OutputIter _STLP_CALL
-__copy_float_and_fill(const _CharT* __first, const _CharT* __last,
- _OutputIter __oi,
- ios_base::fmtflags __flags,
- streamsize __width, _CharT __fill,
- _CharT __xplus, _CharT __xminus) {
- if (__width <= __last - __first)
- return copy(__first, __last, __oi);
- else {
- streamsize __pad = __width - (__last - __first);
- ios_base::fmtflags __dir = __flags & ios_base::adjustfield;
-
- if (__dir == ios_base::left) {
- __oi = copy(__first, __last, __oi);
- return __fill_n(__oi, __pad, __fill);
- }
- else if (__dir == ios_base::internal && __first != __last &&
- (*__first == __xplus || *__first == __xminus)) {
- *__oi++ = *__first++;
- __oi = __fill_n(__oi, __pad, __fill);
- return copy(__first, __last, __oi);
- }
- else {
- __oi = __fill_n(__oi, __pad, __fill);
- return copy(__first, __last, __oi);
- }
- }
-}
-
-#if !defined (_STLP_NO_WCHAR_T)
-// Helper routine for wchar_t
-template <class _OutputIter>
-_OutputIter _STLP_CALL
-__put_float(__iostring &__str, _OutputIter __oi,
- ios_base& __f, wchar_t __fill,
- wchar_t __decimal_point, wchar_t __sep,
- size_t __group_pos, const string& __grouping) {
- const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __f._M_ctype_facet());
-
- __iowstring __wbuf;
- __convert_float_buffer(__str, __wbuf, __ct, __decimal_point);
-
- if (!__grouping.empty()) {
- __insert_grouping(__wbuf, __group_pos, __grouping,
- __sep, __ct.widen('+'), __ct.widen('-'), 0);
- }
-
- return __copy_float_and_fill(__CONST_CAST(wchar_t*, __wbuf.data()),
- __CONST_CAST(wchar_t*, __wbuf.data()) + __wbuf.size(), __oi,
- __f.flags(), __f.width(0), __fill, __ct.widen('+'), __ct.widen('-'));
-}
-#endif /* WCHAR_T */
-
-// Helper routine for char
-template <class _OutputIter>
-_OutputIter _STLP_CALL
-__put_float(__iostring &__str, _OutputIter __oi,
- ios_base& __f, char __fill,
- char __decimal_point, char __sep,
- size_t __group_pos, const string& __grouping) {
- if ((__group_pos < __str.size()) && (__str[__group_pos] == '.')) {
- __str[__group_pos] = __decimal_point;
- }
-
- if (!__grouping.empty()) {
- __insert_grouping(__str, __group_pos,
- __grouping, __sep, '+', '-', 0);
- }
-
- return __copy_float_and_fill(__CONST_CAST(char*, __str.data()),
- __CONST_CAST(char*, __str.data()) + __str.size(), __oi,
- __f.flags(), __f.width(0), __fill, '+', '-');
-}
-
-template <class _CharT, class _OutputIter, class _Float>
-_OutputIter _STLP_CALL
-__do_put_float(_OutputIter __s, ios_base& __f,
- _CharT __fill, _Float __x) {
- __iostring __buf;
-
- size_t __group_pos = __write_float(__buf, __f.flags(), (int)__f.precision(), __x);
-
- const numpunct<_CharT>& __np = *__STATIC_CAST(const numpunct<_CharT>*, __f._M_numpunct_facet());
-
- return __put_float(__buf, __s, __f, __fill,
- __np.decimal_point(), __np.thousands_sep(),
- __group_pos, __f._M_grouping());
-}
-
-inline void __get_money_digits_aux (__iostring &__buf, ios_base &, _STLP_LONGEST_FLOAT_TYPE __x)
-{ __get_floor_digits(__buf, __x); }
-
-#if !defined (_STLP_NO_WCHAR_T)
-inline void __get_money_digits_aux (__iowstring &__wbuf, ios_base &__f, _STLP_LONGEST_FLOAT_TYPE __x) {
- __iostring __buf;
- __get_floor_digits(__buf, __x);
-
- const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __f._M_ctype_facet());
- __convert_float_buffer(__buf, __wbuf, __ct, wchar_t(0), false);
-}
-#endif
-
-template <class _CharT>
-void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT) &__buf, ios_base& __f, _STLP_LONGEST_FLOAT_TYPE __x)
-{ __get_money_digits_aux(__buf, __f, __x); }
-
-// _M_do_put_integer and its helper functions.
-
-template <class _CharT, class _OutputIter>
-_OutputIter _STLP_CALL
-__copy_integer_and_fill(const _CharT* __buf, ptrdiff_t __len,
- _OutputIter __oi,
- ios_base::fmtflags __flg, streamsize __wid, _CharT __fill,
- _CharT __xplus, _CharT __xminus) {
- if (__len >= __wid)
- return copy(__buf, __buf + __len, __oi);
- else {
- //casting numeric_limits<ptrdiff_t>::max to streamsize only works is ptrdiff_t is signed or streamsize representation
- //is larger than ptrdiff_t one.
- _STLP_STATIC_ASSERT(((sizeof(streamsize) > sizeof(ptrdiff_t)) ||
- (sizeof(streamsize) == sizeof(ptrdiff_t))) && numeric_limits<ptrdiff_t>::is_signed)
- ptrdiff_t __pad = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()),
- __STATIC_CAST(streamsize, __wid - __len)));
- ios_base::fmtflags __dir = __flg & ios_base::adjustfield;
-
- if (__dir == ios_base::left) {
- __oi = copy(__buf, __buf + __len, __oi);
- return __fill_n(__oi, __pad, __fill);
- }
- else if (__dir == ios_base::internal && __len != 0 &&
- (__buf[0] == __xplus || __buf[0] == __xminus)) {
- *__oi++ = __buf[0];
- __oi = __fill_n(__oi, __pad, __fill);
- return copy(__buf + 1, __buf + __len, __oi);
- }
- else if (__dir == ios_base::internal && __len >= 2 &&
- (__flg & ios_base::showbase) &&
- (__flg & ios_base::basefield) == ios_base::hex) {
- *__oi++ = __buf[0];
- *__oi++ = __buf[1];
- __oi = __fill_n(__oi, __pad, __fill);
- return copy(__buf + 2, __buf + __len, __oi);
- }
- else {
- __oi = __fill_n(__oi, __pad, __fill);
- return copy(__buf, __buf + __len, __oi);
- }
- }
-}
-
-#if !defined (_STLP_NO_WCHAR_T)
-// Helper function for wchar_t
-template <class _OutputIter>
-_OutputIter _STLP_CALL
-__put_integer(char* __buf, char* __iend, _OutputIter __s,
- ios_base& __f,
- ios_base::fmtflags __flags, wchar_t __fill) {
- locale __loc = __f.getloc();
- // const ctype<wchar_t>& __ct = use_facet<ctype<wchar_t> >(__loc);
- const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __f._M_ctype_facet());
-
- wchar_t __xplus = __ct.widen('+');
- wchar_t __xminus = __ct.widen('-');
-
- wchar_t __wbuf[64];
- __ct.widen(__buf, __iend, __wbuf);
- ptrdiff_t __len = __iend - __buf;
- wchar_t* __eend = __wbuf + __len;
-
- // const numpunct<wchar_t>& __np = use_facet<numpunct<wchar_t> >(__loc);
- // const string& __grouping = __np.grouping();
-
- const numpunct<wchar_t>& __np = *__STATIC_CAST(const numpunct<wchar_t>*, __f._M_numpunct_facet());
- const string& __grouping = __f._M_grouping();
-
- if (!__grouping.empty()) {
- int __basechars;
- if (__flags & ios_base::showbase)
- switch (__flags & ios_base::basefield) {
- case ios_base::hex: __basechars = 2; break;
- case ios_base::oct: __basechars = 1; break;
- default: __basechars = 0;
- }
- else
- __basechars = 0;
-
- __len = __insert_grouping(__wbuf, __eend, __grouping, __np.thousands_sep(),
- __xplus, __xminus, __basechars);
- }
-
- return __copy_integer_and_fill((wchar_t*)__wbuf, __len, __s,
- __flags, __f.width(0), __fill, __xplus, __xminus);
-}
-#endif
-
-// Helper function for char
-template <class _OutputIter>
-_OutputIter _STLP_CALL
-__put_integer(char* __buf, char* __iend, _OutputIter __s,
- ios_base& __f, ios_base::fmtflags __flags, char __fill) {
- char __grpbuf[64];
- ptrdiff_t __len = __iend - __buf;
-
- // const numpunct<char>& __np = use_facet<numpunct<char> >(__f.getloc());
- // const string& __grouping = __np.grouping();
-
- const numpunct<char>& __np = *__STATIC_CAST(const numpunct<char>*, __f._M_numpunct_facet());
- const string& __grouping = __f._M_grouping();
-
- if (!__grouping.empty()) {
- int __basechars;
- if (__flags & ios_base::showbase)
- switch (__flags & ios_base::basefield) {
- case ios_base::hex: __basechars = 2; break;
- case ios_base::oct: __basechars = 1; break;
- default: __basechars = 0;
- }
- else
- __basechars = 0;
-
- // make sure there is room at the end of the buffer
- // we pass to __insert_grouping
- copy(__buf, __iend, (char *) __grpbuf);
- __buf = __grpbuf;
- __iend = __grpbuf + __len;
- __len = __insert_grouping(__buf, __iend, __grouping, __np.thousands_sep(),
- '+', '-', __basechars);
- }
-
- return __copy_integer_and_fill(__buf, __len, __s, __flags, __f.width(0), __fill, '+', '-');
-}
-
-#if defined (_STLP_LONG_LONG)
-typedef _STLP_LONG_LONG __max_int_t;
-typedef unsigned _STLP_LONG_LONG __umax_int_t;
-#else
-typedef long __max_int_t;
-typedef unsigned long __umax_int_t;
-#endif
-
-_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_lo();
-_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_hi();
-
-template <class _Integer>
-inline char* _STLP_CALL
-__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __true_type& /* is_signed */) {
- const bool __negative = __x < 0 ;
- __max_int_t __temp = __x;
- __umax_int_t __utemp = __negative?-__temp:__temp;
-
- for (; __utemp != 0; __utemp /= 10)
- *--__ptr = (char)((int)(__utemp % 10) + '0');
- // put sign if needed or requested
- if (__negative)
- *--__ptr = '-';
- else if (__flags & ios_base::showpos)
- *--__ptr = '+';
- return __ptr;
-}
-
-template <class _Integer>
-inline char* _STLP_CALL
-__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __false_type& /* is_signed */) {
- for (; __x != 0; __x /= 10)
- *--__ptr = (char)((int)(__x % 10) + '0');
- // put sign if requested
- if (__flags & ios_base::showpos)
- *--__ptr = '+';
- return __ptr;
-}
-
-template <class _Integer>
-char* _STLP_CALL
-__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x) {
- char* __ptr = __buf;
-
- if (__x == 0) {
- *--__ptr = '0';
- if ((__flags & ios_base::showpos) && ((__flags & (ios_base::oct | ios_base::hex)) == 0))
- *--__ptr = '+';
- // oct or hex base shall not be added to the 0 value (see '#' flag in C formating strings)
- }
- else {
- switch (__flags & ios_base::basefield) {
- case ios_base::oct:
- {
- __umax_int_t __temp = __x;
- // if the size of integer is less than 8, clear upper part
- if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 )
- __temp &= 0xFFFFFFFF;
-
- for (; __temp != 0; __temp >>=3)
- *--__ptr = (char)((((unsigned)__temp)& 0x7) + '0');
-
- // put leading '0' if showbase is set
- if (__flags & ios_base::showbase)
- *--__ptr = '0';
- }
- break;
- case ios_base::hex:
- {
- const char* __table_ptr = (__flags & ios_base::uppercase) ?
- __hex_char_table_hi() : __hex_char_table_lo();
- __umax_int_t __temp = __x;
- // if the size of integer is less than 8, clear upper part
- if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 )
- __temp &= 0xFFFFFFFF;
-
- for (; __temp != 0; __temp >>=4)
- *--__ptr = __table_ptr[((unsigned)__temp & 0xF)];
-
- if (__flags & ios_base::showbase) {
- *--__ptr = __table_ptr[16];
- *--__ptr = '0';
- }
- }
- break;
- //case ios_base::dec:
- default:
- {
-#if defined(__HP_aCC) && (__HP_aCC == 1)
- bool _IsSigned = !((_Integer)-1 > 0);
- if (_IsSigned)
- __ptr = __write_decimal_backward(__ptr, __x, __flags, __true_type() );
- else
- __ptr = __write_decimal_backward(__ptr, __x, __flags, __false_type() );
-#else
- typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
- __ptr = __write_decimal_backward(__ptr, __x, __flags, _IsSigned());
-#endif
- }
- break;
- }
- }
-
- // return pointer to beginning of the string
- return __ptr;
-}
-
-template <class _CharT, class _OutputIter, class _Integer>
-_OutputIter _STLP_CALL
-__do_put_integer(_OutputIter __s, ios_base& __f, _CharT __fill, _Integer __x) {
- // buffer size = number of bytes * number of digit necessary in the smallest Standard base (base 8, 3 digits/byte)
- // plus the longest base representation '0x'
- // Do not use __buf_size to define __buf static buffer, some compilers (HP aCC) do not accept const variable as
- // the specification of a static buffer size.
- char __buf[sizeof(_Integer) * 3 + 2];
- const ptrdiff_t __buf_size = sizeof(__buf) / sizeof(char);
- ios_base::fmtflags __flags = __f.flags();
- char* __ibeg = __write_integer_backward((char*)__buf+__buf_size, __flags, __x);
- return __put_integer(__ibeg, (char*)__buf+__buf_size, __s, __f, __flags, __fill);
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-//
-// num_put<>
-//
-
-#if (_STLP_STATIC_TEMPLATE_DATA > 0)
-
-# if !defined (__BORLANDC__)
-template <class _CharT, class _OutputIterator>
-locale::id num_put<_CharT, _OutputIterator>::id;
-# endif
-
-# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \
- defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)
-/*
- * Under cygwin, when STLport is used as a shared library, the id needs
- * to be specified as imported otherwise they will be duplicated in the
- * calling executable.
- */
-template <>
-_STLP_DECLSPEC locale::id num_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
-/*
-template <>
-_STLP_DECLSPEC locale::id num_put<char, char*>::id;
-*/
-
-# if !defined (_STLP_NO_WCHAR_T)
-template <>
-_STLP_DECLSPEC locale::id num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
-/*
-template <>
-_STLP_DECLSPEC locale::id num_put<wchar_t, wchar_t*>::id;
-*/
-# endif
-
-# endif /* __CYGWIN__ && _STLP_USE_DYNAMIC_LIB */
-
-#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
-
-//typedef num_put<char, char*> num_put_char;
-typedef num_put<char, ostreambuf_iterator<char, char_traits<char> > > num_put_char_2;
-
-//__DECLARE_INSTANCE(locale::id, num_put_char::id, );
-__DECLARE_INSTANCE(locale::id, num_put_char_2::id, );
-
-# if !defined (_STLP_NO_WCHAR_T)
-
-//typedef num_put<wchar_t, wchar_t*> num_put_wchar_t;
-typedef num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > num_put_wchar_t_2;
-
-//__DECLARE_INSTANCE(locale::id, num_put_wchar_t::id, );
-__DECLARE_INSTANCE(locale::id, num_put_wchar_t_2::id, );
-
-# endif
-
-#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
-
-// issue 118
-
-#if !defined (_STLP_NO_BOOL)
-template <class _CharT, class _OutputIter>
-_OutputIter
-num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f,
- char_type __fill, bool __val) const {
- if (!(__f.flags() & ios_base::boolalpha))
- return this->do_put(__s, __f, __fill, __STATIC_CAST(long,__val));
-
- locale __loc = __f.getloc();
- // typedef numpunct<_CharT> _Punct;
- // const _Punct& __np = use_facet<_Punct>(__loc);
-
- const numpunct<_CharT>& __np = *__STATIC_CAST(const numpunct<_CharT>*, __f._M_numpunct_facet());
-
- basic_string<_CharT> __str = __val ? __np.truename() : __np.falsename();
-
- // Reuse __copy_integer_and_fill. Since internal padding makes no
- // sense for bool, though, make sure we use something else instead.
- // The last two argument to __copy_integer_and_fill are dummies.
- ios_base::fmtflags __flags = __f.flags();
- if ((__flags & ios_base::adjustfield) == ios_base::internal)
- __flags = (__flags & ~ios_base::adjustfield) | ios_base::right;
-
- return _STLP_PRIV __copy_integer_and_fill(__str.c_str(), __str.size(), __s,
- __flags, __f.width(0), __fill,
- (_CharT) 0, (_CharT) 0);
-}
-
-#endif
-
-template <class _CharT, class _OutputIter>
-_OutputIter
-num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
- long __val) const
-{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
-
-template <class _CharT, class _OutputIter>
-_OutputIter
-num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
- unsigned long __val) const
-{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
-
-template <class _CharT, class _OutputIter>
-_OutputIter
-num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
- double __val) const
-{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); }
-
-#if !defined (_STLP_NO_LONG_DOUBLE)
-template <class _CharT, class _OutputIter>
-_OutputIter
-num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
- long double __val) const
-{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); }
-#endif
-
-#if defined (_STLP_LONG_LONG)
-template <class _CharT, class _OutputIter>
-_OutputIter
-num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
- _STLP_LONG_LONG __val) const
-{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
-
-template <class _CharT, class _OutputIter>
-_OutputIter
-num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
- unsigned _STLP_LONG_LONG __val) const
-{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
-#endif /* _STLP_LONG_LONG */
-
-
-// lib.facet.num.put.virtuals "12 For conversion from void* the specifier is %p."
-template <class _CharT, class _OutputIter>
-_OutputIter
-num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT /*__fill*/,
- const void* __val) const {
- const ctype<_CharT>& __c_type = *__STATIC_CAST(const ctype<_CharT>*, __f._M_ctype_facet());
- ios_base::fmtflags __save_flags = __f.flags();
-
- __f.setf(ios_base::hex, ios_base::basefield);
- __f.setf(ios_base::showbase);
- __f.setf(ios_base::internal, ios_base::adjustfield);
- __f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix
-# if defined(_STLP_LONG_LONG) && !defined(__MRC__) //*ty 11/24/2001 - MrCpp can not cast from void* to long long
- _OutputIter result = this->do_put(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned _STLP_LONG_LONG,__val));
-# else
- _OutputIter result = this->do_put(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned long,__val));
-# endif
- __f.flags(__save_flags);
- return result;
-}
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_NUM_PUT_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_num_put.h b/stl/_num_put.h
deleted file mode 100644
index 077cd93..0000000
--- a/stl/_num_put.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// WARNING: This is an internal header file, included by other C++
-// standard library headers. You should not attempt to use this header
-// file directly.
-
-
-#ifndef _STLP_INTERNAL_NUM_PUT_H
-#define _STLP_INTERNAL_NUM_PUT_H
-
-#ifndef _STLP_INTERNAL_NUMPUNCT_H
-# include <stl/_numpunct.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CTYPE_H
-# include <stl/_ctype.h>
-#endif
-
-#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
-# include <stl/_ostreambuf_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
-# include <stl/_iostream_string.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//----------------------------------------------------------------------
-// num_put facet
-
-#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-template <class _CharT, class _OutputIter>
-#else
-template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
-#endif
-class num_put: public locale::facet {
- friend class _Locale_impl;
-public:
- typedef _CharT char_type;
- typedef _OutputIter iter_type;
-
- explicit num_put(size_t __refs = 0) : locale::facet(__refs) {}
-
-#if !defined (_STLP_NO_BOOL)
- iter_type put(iter_type __s, ios_base& __f, char_type __fill,
- bool __val) const {
- return do_put(__s, __f, __fill, __val);
- }
-#endif
- iter_type put(iter_type __s, ios_base& __f, char_type __fill,
- long __val) const {
- return do_put(__s, __f, __fill, __val);
- }
-
- iter_type put(iter_type __s, ios_base& __f, char_type __fill,
- unsigned long __val) const {
- return do_put(__s, __f, __fill, __val);
- }
-
-#if defined (_STLP_LONG_LONG)
- iter_type put(iter_type __s, ios_base& __f, char_type __fill,
- _STLP_LONG_LONG __val) const {
- return do_put(__s, __f, __fill, __val);
- }
-
- iter_type put(iter_type __s, ios_base& __f, char_type __fill,
- unsigned _STLP_LONG_LONG __val) const {
- return do_put(__s, __f, __fill, __val);
- }
-#endif
-
- iter_type put(iter_type __s, ios_base& __f, char_type __fill,
- double __val) const {
- return do_put(__s, __f, __fill, (double)__val);
- }
-
-#if !defined (_STLP_NO_LONG_DOUBLE)
- iter_type put(iter_type __s, ios_base& __f, char_type __fill,
- long double __val) const {
- return do_put(__s, __f, __fill, __val);
- }
-#endif
-
- iter_type put(iter_type __s, ios_base& __f, char_type __fill,
- const void * __val) const {
- return do_put(__s, __f, __fill, __val);
- }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- ~num_put() {}
-#if !defined (_STLP_NO_BOOL)
- virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const;
-#endif
- virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long __val) const;
- virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, unsigned long __val) const;
- virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, double __val) const;
-#if !defined (_STLP_NO_LONG_DOUBLE)
- virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long double __val) const;
-#endif
-
-#if defined (_STLP_LONG_LONG)
- virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, _STLP_LONG_LONG __val) const;
- virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
- unsigned _STLP_LONG_LONG __val) const ;
-#endif
- virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, const void* __val) const;
-};
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
-// _STLP_EXPORT_TEMPLATE_CLASS num_put<char, char*>;
-# if !defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
-// _STLP_EXPORT_TEMPLATE_CLASS num_put<wchar_t, wchar_t*>;
-# endif
-#endif
-
-#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Integer>
-char* _STLP_CALL
-__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x);
-
-/*
- * Returns the position on the right of the digits that has to be considered
- * for the application of the grouping policy.
- */
-extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, double);
-# if !defined (_STLP_NO_LONG_DOUBLE)
-extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, long double);
-# endif
-
-/*
- * Gets the digits of the integer part.
- */
-void _STLP_CALL __get_floor_digits(__iostring&, _STLP_LONGEST_FLOAT_TYPE);
-
-template <class _CharT>
-void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT)&, ios_base&, _STLP_LONGEST_FLOAT_TYPE);
-
-# if !defined (_STLP_NO_WCHAR_T)
-extern void _STLP_CALL __convert_float_buffer(__iostring const&, __iowstring&, const ctype<wchar_t>&, wchar_t, bool = true);
-# endif
-extern void _STLP_CALL __adjust_float_buffer(__iostring&, char);
-
-extern char* _STLP_CALL
-__write_integer(char* buf, ios_base::fmtflags flags, long x);
-
-extern ptrdiff_t _STLP_CALL __insert_grouping(char* first, char* last, const string&, char, char, char, int);
-extern void _STLP_CALL __insert_grouping(__iostring&, size_t, const string&, char, char, char, int);
-# if !defined (_STLP_NO_WCHAR_T)
-extern ptrdiff_t _STLP_CALL __insert_grouping(wchar_t*, wchar_t*, const string&, wchar_t, wchar_t, wchar_t, int);
-extern void _STLP_CALL __insert_grouping(__iowstring&, size_t, const string&, wchar_t, wchar_t, wchar_t, int);
-# endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_num_put.c>
-#endif
-
-#endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_numpunct.h b/stl/_numpunct.h
deleted file mode 100644
index 504d979..0000000
--- a/stl/_numpunct.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// WARNING: This is an internal header file, included by other C++
-// standard library headers. You should not attempt to use this header
-// file directly.
-
-
-#ifndef _STLP_INTERNAL_NUMPUNCT_H
-#define _STLP_INTERNAL_NUMPUNCT_H
-
-#ifndef _STLP_IOS_BASE_H
-# include <stl/_ios_base.h>
-#endif
-
-# ifndef _STLP_C_LOCALE_H
-# include <stl/c_locale.h>
-# endif
-
-#ifndef _STLP_INTERNAL_STRING_H
-# include <stl/_string.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//----------------------------------------------------------------------
-// numpunct facets
-
-template <class _CharT> class numpunct {};
-template <class _CharT> class numpunct_byname {};
-template <class _Ch, class _InIt> class num_get;
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
-{
- friend class _Locale_impl;
-
-#ifndef _STLP_NO_FRIEND_TEMPLATES
- template <class _Ch, class _InIt> friend class num_get;
-#endif
-public:
- typedef char char_type;
- typedef string string_type;
-
- explicit numpunct(size_t __refs = 0)
- : locale::facet(__refs), _M_truename("true"), _M_falsename("false") {}
-
- char decimal_point() const { return do_decimal_point(); }
- char thousands_sep() const { return do_thousands_sep(); }
- string grouping() const { return do_grouping(); }
- string truename() const { return do_truename(); }
- string falsename() const { return do_falsename(); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-#ifndef _STLP_NO_FRIEND_TEMPLATES
-protected:
-#endif
- ~numpunct();
-
- string _M_truename;
- string _M_falsename;
- string _M_grouping;
-
- virtual char do_decimal_point() const;
- virtual char do_thousands_sep() const;
- virtual string do_grouping() const;
- virtual string do_truename() const;
- virtual string do_falsename() const;
-};
-
-# if ! defined (_STLP_NO_WCHAR_T)
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
-{
- friend class _Locale_impl;
-public:
- typedef wchar_t char_type;
- typedef wstring string_type;
-
- explicit numpunct(size_t __refs = 0)
- : locale::facet(__refs), _M_truename(L"true"), _M_falsename(L"false") {}
-
- wchar_t decimal_point() const { return do_decimal_point(); }
- wchar_t thousands_sep() const { return do_thousands_sep(); }
- string grouping() const { return do_grouping(); }
- wstring truename() const { return do_truename(); }
- wstring falsename() const { return do_falsename(); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- wstring _M_truename;
- wstring _M_falsename;
- string _M_grouping;
-
- ~numpunct();
-
- virtual wchar_t do_decimal_point() const;
- virtual wchar_t do_thousands_sep() const;
- virtual string do_grouping() const;
- virtual wstring do_truename() const;
- virtual wstring do_falsename() const;
-};
-
-# endif /* WCHAR_T */
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
-public:
- typedef char char_type;
- typedef string string_type;
-
- explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
-
-protected:
-
- ~numpunct_byname();
-
- virtual char do_decimal_point() const;
- virtual char do_thousands_sep() const;
- virtual string do_grouping() const;
-
-private:
- _Locale_numeric* _M_numeric;
-
- //explicitely defined as private to avoid warnings:
- typedef numpunct_byname<char> _Self;
- numpunct_byname(_Self const&);
- _Self& operator = (_Self const&);
- friend _Locale_name_hint* _Locale_extract_hint(numpunct_byname<char>*);
-};
-
-# ifndef _STLP_NO_WCHAR_T
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
-public:
- typedef wchar_t char_type;
- typedef wstring string_type;
-
- explicit numpunct_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0);
-
-protected:
-
- ~numpunct_byname();
-
- virtual wchar_t do_decimal_point() const;
- virtual wchar_t do_thousands_sep() const;
- virtual string do_grouping() const;
-
-private:
- _Locale_numeric* _M_numeric;
-
- //explicitely defined as private to avoid warnings:
- typedef numpunct_byname<wchar_t> _Self;
- numpunct_byname(_Self const&);
- _Self& operator = (_Self const&);
-};
-
-# endif /* WCHAR_T */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_NUMPUNCT_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_ostream.c b/stl/_ostream.c
deleted file mode 100644
index 6baf4ab..0000000
--- a/stl/_ostream.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_OSTREAM_C
-#define _STLP_OSTREAM_C
-
-#ifndef _STLP_INTERNAL_OSTREAM_H
-# include <stl/_ostream.h>
-#endif
-
-#if !defined (_STLP_INTERNAL_NUM_PUT_H)
-# include <stl/_num_put.h> // For basic_streambuf and iterators
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//----------------------------------------------------------------------
-// Definitions of non-inline member functions.
-
-// Constructor, destructor
-
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<_CharT, _Traits>* __buf)
- : basic_ios<_CharT, _Traits>() {
- this->init(__buf);
-}
-
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>::~basic_ostream()
-{}
-
-// Output directly from a streambuf.
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<_CharT, _Traits>* __from) {
- sentry __sentry(*this);
- if (__sentry) {
- if (__from) {
- bool __any_inserted = __from->gptr() != __from->egptr()
- ? this->_M_copy_buffered(__from, this->rdbuf())
- : this->_M_copy_unbuffered(__from, this->rdbuf());
- if (!__any_inserted)
- this->setstate(ios_base::failbit);
- }
- else
- this->setstate(ios_base::badbit);
- }
-
- return *this;
-}
-
-// Helper functions for the streambuf version of operator<<. The
-// exception-handling code is complicated because exceptions thrown
-// while extracting characters are treated differently than exceptions
-// thrown while inserting characters.
-
-template <class _CharT, class _Traits>
-bool basic_ostream<_CharT, _Traits>
- ::_M_copy_buffered(basic_streambuf<_CharT, _Traits>* __from,
- basic_streambuf<_CharT, _Traits>* __to) {
- bool __any_inserted = false;
-
- while (__from->egptr() != __from->gptr()) {
- const ptrdiff_t __avail = __from->egptr() - __from->gptr();
-
- streamsize __nwritten;
- _STLP_TRY {
- __nwritten = __to->sputn(__from->gptr(), __avail);
- __from->gbump((int)__nwritten);
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- return __any_inserted;
- }
-
- if (__nwritten == __avail) {
- _STLP_TRY {
- if (this->_S_eof(__from->sgetc()))
- return true;
- else
- __any_inserted = true;
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::failbit);
- return false;
- }
- }
- else if (__nwritten != 0)
- return true;
- else
- return __any_inserted;
- }
-
- // No characters are in the buffer, but we aren't at EOF. Switch to
- // unbuffered mode.
- return __any_inserted || this->_M_copy_unbuffered(__from, __to);
-}
-
-/*
- * Helper struct (guard) to put back a character in a streambuf
- * whenever an exception or an eof occur.
- */
-template <class _CharT, class _Traits>
-struct _SPutBackC {
- typedef basic_streambuf<_CharT, _Traits> _StreamBuf;
- typedef typename _StreamBuf::int_type int_type;
- _SPutBackC(_StreamBuf *pfrom)
- : __pfrom(pfrom), __c(0), __do_guard(false) {}
- ~_SPutBackC() {
- if (__do_guard) {
- __pfrom->sputbackc(_Traits::to_char_type(__c));
- }
- }
-
- void guard(int_type c) {
- __c = c;
- __do_guard = true;
- }
- void release() {
- __do_guard = false;
- }
-
-private:
- _StreamBuf *__pfrom;
- int_type __c;
- bool __do_guard;
-};
-
-template <class _CharT, class _Traits>
-bool basic_ostream<_CharT, _Traits>
- ::_M_copy_unbuffered(basic_streambuf<_CharT, _Traits>* __from,
- basic_streambuf<_CharT, _Traits>* __to) {
- typedef _SPutBackC<_CharT, _Traits> _SPutBackCGuard;
- bool __any_inserted = false;
- int_type __c;
-
- _STLP_TRY {
- _SPutBackCGuard __cguard(__from);
- for (;;) {
- _STLP_TRY {
- __c = __from->sbumpc();
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::failbit);
- return __any_inserted;
- }
-
- if ( this->_S_eof(__c) )
- return __any_inserted;
-
- __cguard.guard(__c);
- if ( this->_S_eof( __to->sputc(_Traits::to_char_type(__c)) ) ) {
- return __any_inserted;
- }
-
- __cguard.release();
- __any_inserted = true;
- }
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- return __any_inserted;
- }
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// Helper function for numeric output.
-template <class _CharT, class _Traits, class _Number>
-basic_ostream<_CharT, _Traits>& _STLP_CALL
-__put_num(basic_ostream<_CharT, _Traits>& __os, _Number __x) {
- typedef typename basic_ostream<_CharT, _Traits>::sentry _Sentry;
- _Sentry __sentry(__os);
- bool __failed = true;
-
- if (__sentry) {
- _STLP_TRY {
- typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > _NumPut;
- __failed = (use_facet<_NumPut>(__os.getloc())).put(ostreambuf_iterator<_CharT, _Traits>(__os.rdbuf()),
- __os, __os.fill(),
- __x).failed();
- }
- _STLP_CATCH_ALL {
- __os._M_handle_exception(ios_base::badbit);
- }
- }
- if (__failed)
- __os.setstate(ios_base::badbit);
- return __os;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-/*
- * In the following operators we try to limit code bloat by limiting the
- * number of __put_num instanciations.
- */
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __x) {
- _STLP_STATIC_ASSERT( sizeof(short) <= sizeof(long) )
- long __tmp = ((this->flags() & _Basic_ios::basefield) != ios_base::dec) ?
- __STATIC_CAST(long, __STATIC_CAST(unsigned short, __x)): __x;
- return _STLP_PRIV __put_num(*this, __tmp);
-}
-
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __x) {
- _STLP_STATIC_ASSERT( sizeof(unsigned short) <= sizeof(unsigned long) )
- return _STLP_PRIV __put_num(*this, __STATIC_CAST(unsigned long,__x));
-}
-
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __x) {
- _STLP_STATIC_ASSERT( sizeof(int) <= sizeof(long) )
- long __tmp = ((this->flags() & _Basic_ios::basefield) != ios_base::dec) ?
- __STATIC_CAST(long, __STATIC_CAST(unsigned int, __x)): __x;
- return _STLP_PRIV __put_num(*this, __tmp);
-}
-
-template <class _CharT, class _Traits>
-#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300)
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __x) {
- _STLP_STATIC_ASSERT( sizeof(unsigned int) <= sizeof(unsigned long) )
-#else
-/* We define this operator with size_t rather than unsigned int to avoid
- * 64 bits warning.
- */
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(size_t __x) {
- _STLP_STATIC_ASSERT( sizeof(size_t) <= sizeof(unsigned long) )
-#endif
- return _STLP_PRIV __put_num(*this, __STATIC_CAST(unsigned long,__x));
-}
-
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __x)
-{ return _STLP_PRIV __put_num(*this, __x); }
-
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __x)
-{ return _STLP_PRIV __put_num(*this, __x); }
-
-#ifdef _STLP_LONG_LONG
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<< (_STLP_LONG_LONG __x)
-{ return _STLP_PRIV __put_num(*this, __x); }
-
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<< (unsigned _STLP_LONG_LONG __x)
-{ return _STLP_PRIV __put_num(*this, __x); }
-#endif
-
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __x)
-{ return _STLP_PRIV __put_num(*this, __STATIC_CAST(double,__x)); }
-
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __x)
-{ return _STLP_PRIV __put_num(*this, __x); }
-
-#ifndef _STLP_NO_LONG_DOUBLE
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __x)
-{ return _STLP_PRIV __put_num(*this, __x); }
-#endif
-
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __x)
-{ return _STLP_PRIV __put_num(*this, __x); }
-
-#ifndef _STLP_NO_BOOL
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __x)
-{ return _STLP_PRIV __put_num(*this, __x); }
-#endif
-
-template <class _CharT, class _Traits>
-void basic_ostream<_CharT, _Traits>::_M_put_char(_CharT __c) {
- sentry __sentry(*this);
- if (__sentry) {
- bool __failed = true;
- _STLP_TRY {
- streamsize __npad = this->width() > 0 ? this->width() - 1 : 0;
- // if (__npad <= 1)
- if (__npad == 0)
- __failed = this->_S_eof(this->rdbuf()->sputc(__c));
- else if ((this->flags() & ios_base::adjustfield) == ios_base::left) {
- __failed = this->_S_eof(this->rdbuf()->sputc(__c));
- __failed = __failed ||
- this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
- }
- else {
- __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
- __failed = __failed || this->_S_eof(this->rdbuf()->sputc(__c));
- }
-
- this->width(0);
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- }
-
- if (__failed)
- this->setstate(ios_base::badbit);
- }
-}
-
-template <class _CharT, class _Traits>
-void basic_ostream<_CharT, _Traits>::_M_put_nowiden(const _CharT* __s) {
- sentry __sentry(*this);
- if (__sentry) {
- bool __failed = true;
- streamsize __n = _Traits::length(__s);
- streamsize __npad = this->width() > __n ? this->width() - __n : 0;
-
- _STLP_TRY {
- if (__npad == 0)
- __failed = this->rdbuf()->sputn(__s, __n) != __n;
- else if ((this->flags() & ios_base::adjustfield) == ios_base::left) {
- __failed = this->rdbuf()->sputn(__s, __n) != __n;
- __failed = __failed ||
- this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
- }
- else {
- __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
- __failed = __failed || this->rdbuf()->sputn(__s, __n) != __n;
- }
-
- this->width(0);
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- }
-
- if (__failed)
- this->setstate(ios_base::failbit);
- }
-}
-
-template <class _CharT, class _Traits>
-void basic_ostream<_CharT, _Traits>::_M_put_widen(const char* __s) {
- sentry __sentry(*this);
- if (__sentry) {
- bool __failed = true;
- streamsize __n = char_traits<char>::length(__s);
- streamsize __npad = this->width() > __n ? this->width() - __n : 0;
-
- _STLP_TRY {
- if (__npad == 0)
- __failed = !this->_M_put_widen_aux(__s, __n);
- else if ((this->flags() & ios_base::adjustfield) == ios_base::left) {
- __failed = !this->_M_put_widen_aux(__s, __n);
- __failed = __failed ||
- this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
- }
- else {
- __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
- __failed = __failed || !this->_M_put_widen_aux(__s, __n);
- }
-
- this->width(0);
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- }
-
- if (__failed)
- this->setstate(ios_base::failbit);
- }
-}
-
-template <class _CharT, class _Traits>
-bool basic_ostream<_CharT, _Traits>::_M_put_widen_aux(const char* __s,
- streamsize __n) {
- basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
-
- for ( ; __n > 0 ; --__n)
- if (this->_S_eof(__buf->sputc(this->widen(*__s++))))
- return false;
- return true;
-}
-
-// Unformatted output of a single character.
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::put(char_type __c) {
- sentry __sentry(*this);
- bool __failed = true;
-
- if (__sentry) {
- _STLP_TRY {
- __failed = this->_S_eof(this->rdbuf()->sputc(__c));
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- }
- }
-
- if (__failed)
- this->setstate(ios_base::badbit);
-
- return *this;
-}
-
-// Unformatted output of a single character.
-template <class _CharT, class _Traits>
-basic_ostream<_CharT, _Traits>&
-basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) {
- sentry __sentry(*this);
- bool __failed = true;
-
- if (__sentry) {
- _STLP_TRY {
- __failed = this->rdbuf()->sputn(__s, __n) != __n;
- }
- _STLP_CATCH_ALL {
- this->_M_handle_exception(ios_base::badbit);
- }
- }
-
- if (__failed)
- this->setstate(ios_base::badbit);
-
- return *this;
-}
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_OSTREAM_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_ostream.h b/stl/_ostream.h
deleted file mode 100644
index 0e4c364..0000000
--- a/stl/_ostream.h
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-
-#ifndef _STLP_INTERNAL_OSTREAM_H
-#define _STLP_INTERNAL_OSTREAM_H
-
-#ifndef _STLP_INTERNAL_IOS_H
-# include <stl/_ios.h> // For basic_ios<>. Includes <iosfwd>.
-#endif
-
-#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
-# include <stl/_ostreambuf_iterator.h>
-#endif
-
-#if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) && !defined (_STLP_INTERNAL_EXCEPTION)
-# include <stl/_exception.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-template <class _CharT, class _Traits>
-class _Osentry;
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _CharT, class _Traits>
-bool __init_bostr(basic_ostream<_CharT, _Traits>& __str);
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-//----------------------------------------------------------------------
-// class basic_ostream<>
-
-template <class _CharT, class _Traits>
-class basic_ostream : virtual public basic_ios<_CharT, _Traits> {
- typedef basic_ostream<_CharT, _Traits> _Self;
-
-#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
- //explicitely defined as private to avoid warnings:
- basic_ostream(_Self const&);
- _Self& operator = (_Self const&);
-#endif
-
-public: // Types
- typedef _CharT char_type;
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::pos_type pos_type;
- typedef typename _Traits::off_type off_type;
- typedef _Traits traits_type;
- typedef basic_ios<_CharT, _Traits> _Basic_ios;
-
-public: // Constructor and destructor.
- explicit basic_ostream(basic_streambuf<_CharT, _Traits>* __buf);
- ~basic_ostream();
-
-public: // Hooks for manipulators.
- typedef basic_ios<_CharT, _Traits>& (_STLP_CALL *__ios_fn)(basic_ios<_CharT, _Traits>&);
- typedef ios_base& (_STLP_CALL *__ios_base_fn)(ios_base&);
- typedef _Self& (_STLP_CALL *__ostream_fn)(_Self&);
- _Self& operator<< (__ostream_fn __f) { return __f(*this); }
- _Self & operator<< (__ios_base_fn __f) { __f(*this); return *this; }
- _Self& operator<< (__ios_fn __ff) { __ff(*this); return *this; }
-
-private:
- bool _M_copy_buffered(basic_streambuf<_CharT, _Traits>* __from,
- basic_streambuf<_CharT, _Traits>* __to);
- bool _M_copy_unbuffered(basic_streambuf<_CharT, _Traits>* __from,
- basic_streambuf<_CharT, _Traits>* __to);
-
-public:
- void _M_put_char(_CharT __c);
-
- void _M_put_nowiden(const _CharT* __s);
- void _M_put_widen(const char* __s);
- bool _M_put_widen_aux(const char* __s, streamsize __n);
-
-public: // Unformatted output.
- _Self& put(char_type __c);
- _Self& write(const char_type* __s, streamsize __n);
-
-public: // Formatted output.
- // Formatted output from a streambuf.
- _Self& operator<<(basic_streambuf<_CharT, _Traits>* __buf);
-# ifndef _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
- // this is needed for compiling with option char = unsigned
- _Self& operator<<(unsigned char __x) { _M_put_char(__x); return *this; }
-# endif
- _Self& operator<<(short __x);
- _Self& operator<<(unsigned short __x);
- _Self& operator<<(int __x);
-#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300)
- _Self& operator<<(unsigned int __x);
-#else
-/* We define this operator with size_t rather than unsigned int to avoid
- * 64 bits warning.
- */
- _Self& operator<<(size_t __x);
-#endif
- _Self& operator<<(long __x);
- _Self& operator<<(unsigned long __x);
-#ifdef _STLP_LONG_LONG
- _Self& operator<< (_STLP_LONG_LONG __x);
- _Self& operator<< (unsigned _STLP_LONG_LONG __x);
-#endif
- _Self& operator<<(float __x);
- _Self& operator<<(double __x);
-# ifndef _STLP_NO_LONG_DOUBLE
- _Self& operator<<(long double __x);
-# endif
- _Self& operator<<(const void* __x);
-# ifndef _STLP_NO_BOOL
- _Self& operator<<(bool __x);
-# endif
-
-public: // Buffer positioning and manipulation.
- _Self& flush() {
- if (this->rdbuf())
- if (this->rdbuf()->pubsync() == -1)
- this->setstate(ios_base::badbit);
- return *this;
- }
-
- pos_type tellp() {
- return this->rdbuf() && !this->fail()
- ? this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out)
- : pos_type(-1);
- }
-
- _Self& seekp(pos_type __pos) {
- if (this->rdbuf() && !this->fail()) {
- if (this->rdbuf()->pubseekpos(__pos) == pos_type(-1)) {
- this->setstate(ios_base::failbit);
- }
- }
- return *this;
- }
-
- _Self& seekp(off_type __off, ios_base::seekdir __dir) {
- if (this->rdbuf() && !this->fail())
- this->rdbuf()->pubseekoff(__off, __dir);
- return *this;
- }
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
- // If we are using DLL specs, we have not to use inner classes
- // end class declaration here
- typedef _Osentry<_CharT, _Traits> sentry;
-};
-# define sentry _Osentry
- template <class _CharT, class _Traits>
- class _Osentry {
- typedef _Osentry<_CharT, _Traits> _Self;
-#else
- class sentry {
- typedef sentry _Self;
-#endif
- private:
- basic_ostream<_CharT, _Traits>& _M_str;
- // basic_streambuf<_CharT, _Traits>* _M_buf;
- bool _M_ok;
- public:
- explicit sentry(basic_ostream<_CharT, _Traits>& __str)
- : _M_str(__str), /* _M_buf(__str.rdbuf()), */ _M_ok(_STLP_PRIV __init_bostr(__str))
- {}
-
- ~sentry() {
- if (_M_str.flags() & ios_base::unitbuf)
-#if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
- if (!uncaught_exception())
-#endif
- _M_str.flush();
- }
-
- operator bool() const { return _M_ok; }
- private: // Disable assignment and copy constructor.
- //Implementation is here only to avoid warning with some compilers.
- sentry(const _Self& __s) : _M_str(__s._M_str) {}
- _Self& operator=(const _Self&) { return *this; }
- };
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-# undef sentry
-#else
- // close basic_ostream class definition here
-};
-#endif
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS basic_ostream<char, char_traits<char> >;
-_STLP_EXPORT_TEMPLATE_CLASS _Osentry<char, char_traits<char> >;
-# if !defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS basic_ostream<wchar_t, char_traits<wchar_t> >;
-_STLP_EXPORT_TEMPLATE_CLASS _Osentry<wchar_t, char_traits<wchar_t> >;
-# endif
-#endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// Helper functions for istream<>::sentry constructor.
-template <class _CharT, class _Traits>
-bool __init_bostr(basic_ostream<_CharT, _Traits>& __str) {
- if (__str.good()) {
- // boris : check if this is needed !
- if (!__str.rdbuf())
- __str.setstate(ios_base::badbit);
- if (__str.tie())
- __str.tie()->flush();
- return __str.good();
- }
- else
- return false;
-}
-
-template <class _CharT, class _Traits>
-inline basic_streambuf<_CharT, _Traits>* _STLP_CALL
-__get_ostreambuf(basic_ostream<_CharT, _Traits>& __St)
-{ return __St.rdbuf(); }
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-// Non-member functions.
-template <class _CharT, class _Traits>
-inline basic_ostream<_CharT, _Traits>& _STLP_CALL
-operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c){
- __os._M_put_char(__c);
- return __os;
-}
-
-template <class _CharT, class _Traits>
-inline basic_ostream<_CharT, _Traits>& _STLP_CALL
-operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __s) {
- __os._M_put_nowiden(__s);
- return __os;
-}
-
-#if defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER)
-// some specializations
-
-inline basic_ostream<char, char_traits<char> >& _STLP_CALL
-operator<<(basic_ostream<char, char_traits<char> >& __os, char __c) {
- __os._M_put_char(__c);
- return __os;
-}
-
-inline basic_ostream<char, char_traits<char> >& _STLP_CALL
-operator<<(basic_ostream<char, char_traits<char> >& __os, signed char __c) {
- __os._M_put_char(__c);
- return __os;
-}
-
-inline basic_ostream<char, char_traits<char> >& _STLP_CALL
-operator<<(basic_ostream<char, char_traits<char> >& __os, unsigned char __c) {
- __os._M_put_char(__c);
- return __os;
-}
-
-inline basic_ostream<char, char_traits<char> >& _STLP_CALL
-operator<<(basic_ostream<char, char_traits<char> >& __os, const char* __s) {
- __os._M_put_nowiden(__s);
- return __os;
-}
-
-inline basic_ostream<char, char_traits<char> >& _STLP_CALL
-operator<<(basic_ostream<char, char_traits<char> >& __os, const signed char* __s) {
- __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
- return __os;
-}
-
-inline basic_ostream<char, char_traits<char> >&
-operator<<(basic_ostream<char, char_traits<char> >& __os, const unsigned char* __s) {
- __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
- return __os;
-}
-
-#else
-
-// also for compilers who might use that
-template <class _CharT, class _Traits>
-inline basic_ostream<_CharT, _Traits>& _STLP_CALL
-operator<<(basic_ostream<_CharT, _Traits>& __os, char __c) {
- __os._M_put_char(__os.widen(__c));
- return __os;
-}
-
-template <class _Traits>
-inline basic_ostream<char, _Traits>& _STLP_CALL
-operator<<(basic_ostream<char, _Traits>& __os, char __c) {
- __os._M_put_char(__c);
- return __os;
-}
-
-template <class _Traits>
-inline basic_ostream<char, _Traits>& _STLP_CALL
-operator<<(basic_ostream<char, _Traits>& __os, signed char __c) {
- __os._M_put_char(__c);
- return __os;
-}
-
-template <class _Traits>
-inline basic_ostream<char, _Traits>& _STLP_CALL
-operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c) {
- __os._M_put_char(__c);
- return __os;
-}
-
-template <class _CharT, class _Traits>
-inline basic_ostream<_CharT, _Traits>& _STLP_CALL
-operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __s) {
- __os._M_put_widen(__s);
- return __os;
-}
-
-template <class _Traits>
-inline basic_ostream<char, _Traits>& _STLP_CALL
-operator<<(basic_ostream<char, _Traits>& __os, const char* __s) {
- __os._M_put_nowiden(__s);
- return __os;
-}
-
-template <class _Traits>
-inline basic_ostream<char, _Traits>& _STLP_CALL
-operator<<(basic_ostream<char, _Traits>& __os, const signed char* __s) {
- __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
- return __os;
-}
-
-template <class _Traits>
-inline basic_ostream<char, _Traits>&
-operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __s) {
- __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
- return __os;
-}
-#endif /* _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER */
-
-//----------------------------------------------------------------------
-// basic_ostream manipulators.
-
-template <class _CharT, class _Traits>
-inline basic_ostream<_CharT, _Traits>& _STLP_CALL
-endl(basic_ostream<_CharT, _Traits>& __os) {
- __os.put(__os.widen('\n'));
- __os.flush();
- return __os;
-}
-
-template <class _CharT, class _Traits>
-inline basic_ostream<_CharT, _Traits>& _STLP_CALL
-ends(basic_ostream<_CharT, _Traits>& __os) {
- __os.put(_STLP_DEFAULT_CONSTRUCTED(_CharT));
- return __os;
-}
-
-template <class _CharT, class _Traits>
-inline basic_ostream<_CharT, _Traits>& _STLP_CALL
-flush(basic_ostream<_CharT, _Traits>& __os) {
- __os.flush();
- return __os;
-}
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_ostream.c>
-#endif
-
-#endif /* _STLP_INTERNAL_OSTREAM_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_pair.h b/stl/_pair.h
deleted file mode 100644
index d431fe0..0000000
--- a/stl/_pair.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_PAIR_H
-#define _STLP_INTERNAL_PAIR_H
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-# include <stl/type_traits.h>
-#endif
-
-#ifndef _STLP_MOVE_CONSTRUCT_FWK_H
-# include <stl/_move_construct_fwk.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _T1, class _T2>
-struct pair {
- typedef _T1 first_type;
- typedef _T2 second_type;
-
- _T1 first;
- _T2 second;
-#if defined (_STLP_CONST_CONSTRUCTOR_BUG)
- pair() {}
-#else
- pair() : first(_T1()), second(_T2()) {}
-#endif
- pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES) && !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200))
- template <class _U1, class _U2>
- pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
-
- pair(const pair<_T1,_T2>& __o) : first(__o.first), second(__o.second) {}
-#endif
-
- pair(__move_source<pair<_T1, _T2> > src) : first(_STLP_PRIV _AsMoveSource(src.get().first)),
- second(_STLP_PRIV _AsMoveSource(src.get().second))
- {}
-
- __TRIVIAL_DESTRUCTOR(pair)
-};
-
-template <class _T1, class _T2>
-inline bool _STLP_CALL operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
-{ return __x.first == __y.first && __x.second == __y.second; }
-
-template <class _T1, class _T2>
-inline bool _STLP_CALL operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
- return __x.first < __y.first ||
- (!(__y.first < __x.first) && __x.second < __y.second);
-}
-
-#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
-template <class _T1, class _T2>
-inline bool _STLP_CALL operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
-{ return !(__x == __y); }
-
-template <class _T1, class _T2>
-inline bool _STLP_CALL operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
-{ return __y < __x; }
-
-template <class _T1, class _T2>
-inline bool _STLP_CALL operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
-{ return !(__y < __x); }
-
-template <class _T1, class _T2>
-inline bool _STLP_CALL operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
-{ return !(__x < __y); }
-#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
-
-#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_EXTENSIONS)
-template <class _T1, class _T2, int _Sz>
-inline pair<_T1, _T2 const*> make_pair(_T1 const& __x,
- _T2 const (&__y)[_Sz])
-{ return pair<_T1, _T2 const*>(__x, static_cast<_T2 const*>(__y)); }
-
-template <class _T1, class _T2, int _Sz>
-inline pair<_T1 const*, _T2> make_pair(_T1 const (&__x)[_Sz],
- _T2 const& __y)
-{ return pair<_T1 const*, _T2>(static_cast<_T1 const*>(__x), __y); }
-
-template <class _T1, class _T2, int _Sz1, int _Sz2>
-inline pair<_T1 const*, _T2 const*> make_pair(_T1 const (&__x)[_Sz1],
- _T2 const (&__y)[_Sz2]) {
- return pair<_T1 const*, _T2 const*>(static_cast<_T1 const*>(__x),
- static_cast<_T2 const*>(__y));
-}
-#endif
-
-template <class _T1, class _T2>
-inline pair<_T1, _T2> _STLP_CALL make_pair(_T1 __x, _T2 __y)
-{ return pair<_T1, _T2>(__x, __y); }
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_USE_NAMESPACES) || !defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
-_STLP_BEGIN_RELOPS_NAMESPACE
-
-template <class _Tp>
-inline bool _STLP_CALL operator!=(const _Tp& __x, const _Tp& __y)
-{ return !(__x == __y); }
-
-template <class _Tp>
-inline bool _STLP_CALL operator>(const _Tp& __x, const _Tp& __y)
-{ return __y < __x; }
-
-template <class _Tp>
-inline bool _STLP_CALL operator<=(const _Tp& __x, const _Tp& __y)
-{ return !(__y < __x); }
-
-template <class _Tp>
-inline bool _STLP_CALL operator>=(const _Tp& __x, const _Tp& __y)
-{ return !(__x < __y); }
-
-_STLP_END_RELOPS_NAMESPACE
-#endif
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-_STLP_BEGIN_NAMESPACE
-
-template <class _T1, class _T2>
-struct __type_traits<pair<_T1, _T2> > {
- typedef __type_traits<_T1> _T1Traits;
- typedef __type_traits<_T2> _T2Traits;
- typedef typename _Land2<typename _T1Traits::has_trivial_default_constructor,
- typename _T2Traits::has_trivial_default_constructor>::_Ret has_trivial_default_constructor;
- typedef typename _Land2<typename _T1Traits::has_trivial_copy_constructor,
- typename _T2Traits::has_trivial_copy_constructor>::_Ret has_trivial_copy_constructor;
- typedef typename _Land2<typename _T1Traits::has_trivial_assignment_operator,
- typename _T2Traits::has_trivial_assignment_operator>::_Ret has_trivial_assignment_operator;
- typedef typename _Land2<typename _T1Traits::has_trivial_destructor,
- typename _T2Traits::has_trivial_destructor>::_Ret has_trivial_destructor;
- typedef __false_type is_POD_type;
-
-#if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
- // disable incorrect "dependent type qualifier" error
- typedef __false_type implemented;
-#endif
-};
-
-template <class _T1, class _T2>
-struct __move_traits<pair<_T1, _T2> >
- : _STLP_PRIV __move_traits_help1<_T1, _T2> {};
-
-_STLP_END_NAMESPACE
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-#endif /* _STLP_INTERNAL_PAIR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_pthread_alloc.h b/stl/_pthread_alloc.h
deleted file mode 100644
index 2826185..0000000
--- a/stl/_pthread_alloc.h
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_PTHREAD_ALLOC_H
-#define _STLP_PTHREAD_ALLOC_H
-
-/*
- * Pthread-specific node allocator.
- * This is similar to the default allocator, except that free-list
- * information is kept separately for each thread, avoiding locking.
- * This should be reasonably fast even in the presence of threads.
- * The down side is that storage may not be well-utilized.
- * It is not an error to allocate memory in thread A and deallocate
- * it in thread B. But this effectively transfers ownership of the memory,
- * so that it can only be reallocated by thread B. Thus this can effectively
- * result in a storage leak if it's done on a regular basis.
- * It can also result in frequent sharing of
- * cache lines among processors, with potentially serious performance
- * consequences.
- */
-
-#if !defined (_STLP_PTHREADS)
-# error POSIX specific allocator implementation. Your system do not seems to \
-have this interface so please comment the _STLP_USE_PERTHREAD_ALLOC macro \
-or report to the STLport forum.
-#endif
-
-#if defined (_STLP_USE_NO_IOSTREAMS)
-# error You cannot use per thread allocator implementation without building \
-STLport libraries.
-#endif
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-# include <stl/_alloc.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-struct _Pthread_alloc_per_thread_state;
-
-// Pthread-specific allocator.
-class _STLP_CLASS_DECLSPEC _Pthread_alloc {
-public: // but only for internal use:
- typedef _Pthread_alloc_per_thread_state __state_type;
- typedef char value_type;
-
-public:
- // Return a recycled or new per thread state.
- static __state_type * _STLP_CALL _S_get_per_thread_state();
-
- /* n must be > 0 */
- static void * _STLP_CALL allocate(size_t& __n);
-
- /* p may not be 0 */
- static void _STLP_CALL deallocate(void *__p, size_t __n);
-
- // boris : versions for per_thread_allocator
- /* n must be > 0 */
- static void * _STLP_CALL allocate(size_t& __n, __state_type* __a);
-
- /* p may not be 0 */
- static void _STLP_CALL deallocate(void *__p, size_t __n, __state_type* __a);
-
- static void * _STLP_CALL reallocate(void *__p, size_t __old_sz, size_t& __new_sz);
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-typedef _STLP_PRIV _Pthread_alloc __pthread_alloc;
-typedef __pthread_alloc pthread_alloc;
-
-template <class _Tp>
-class pthread_allocator : public __stlport_class<pthread_allocator<_Tp> > {
- typedef pthread_alloc _S_Alloc; // The underlying allocator.
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
- typedef _Tp value_type;
-
-#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
- template <class _NewType> struct rebind {
- typedef pthread_allocator<_NewType> other;
- };
-#endif
-
- pthread_allocator() _STLP_NOTHROW {}
- pthread_allocator(const pthread_allocator<_Tp>& a) _STLP_NOTHROW {}
-
-#if defined (_STLP_MEMBER_TEMPLATES) /* && defined (_STLP_FUNCTION_PARTIAL_ORDER) */
- template <class _OtherType> pthread_allocator(const pthread_allocator<_OtherType>&)
- _STLP_NOTHROW {}
-#endif
-
- ~pthread_allocator() _STLP_NOTHROW {}
-
- pointer address(reference __x) const { return &__x; }
- const_pointer address(const_reference __x) const { return &__x; }
-
- // __n is permitted to be 0. The C++ standard says nothing about what
- // the return value is when __n == 0.
- _Tp* allocate(size_type __n, const void* = 0) {
- if (__n > max_size()) {
- __THROW_BAD_ALLOC;
- }
- if (__n != 0) {
- size_type __buf_size = __n * sizeof(value_type);
- _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size));
-#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
- if (__ret != 0) {
- memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
- }
-#endif
- return __ret;
- }
- else
- return 0;
- }
-
- void deallocate(pointer __p, size_type __n) {
- _STLP_ASSERT( (__p == 0) == (__n == 0) )
- if (__p != 0) {
-#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
- memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
-#endif
- _S_Alloc::deallocate(__p, __n * sizeof(value_type));
- }
- }
-
- size_type max_size() const _STLP_NOTHROW
- { return size_t(-1) / sizeof(_Tp); }
-
- void construct(pointer __p, const _Tp& __val) { _STLP_PLACEMENT_NEW (__p) _Tp(__val); }
- void destroy(pointer _p) { _p->~_Tp(); }
-
-#if defined (_STLP_NO_EXTENSIONS)
- /* STLport extension giving rounded size of an allocated memory buffer
- * This method do not have to be part of a user defined allocator implementation
- * and won't even be called if such a function was granted.
- */
-protected:
-#endif
- _Tp* allocate(size_type __n, size_type& __allocated_n) {
- if (__n > max_size()) {
- __THROW_BAD_ALLOC;
- }
- if (__n != 0) {
- size_type __buf_size = __n * sizeof(value_type);
- _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size));
-#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
- if (__ret != 0) {
- memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
- }
-#endif
- __allocated_n = __buf_size / sizeof(value_type);
- return __ret;
- }
- else
- return 0;
- }
-};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC pthread_allocator<void> {
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef void* pointer;
- typedef const void* const_pointer;
- typedef void value_type;
-#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
- template <class _NewType> struct rebind {
- typedef pthread_allocator<_NewType> other;
- };
-#endif
-};
-
-template <class _T1, class _T2>
-inline bool operator==(const pthread_allocator<_T1>&,
- const pthread_allocator<_T2>& a2)
-{ return true; }
-
-#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
-template <class _T1, class _T2>
-inline bool operator!=(const pthread_allocator<_T1>&,
- const pthread_allocator<_T2>&)
-{ return false; }
-#endif
-
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-
-# if defined (_STLP_USE_RAW_SGI_ALLOCATORS)
-template <class _Tp>
-struct _Alloc_traits<_Tp, _Pthread_alloc>
-{ typedef __allocator<_Tp, _Pthread_alloc> allocator_type; };
-# endif
-
-template <class _Tp, class _Atype>
-struct _Alloc_traits<_Tp, pthread_allocator<_Atype> >
-{ typedef pthread_allocator<_Tp> allocator_type; };
-
-#endif
-
-#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
-
-template <class _Tp1, class _Tp2>
-inline pthread_allocator<_Tp2>&
-__stl_alloc_rebind(pthread_allocator<_Tp1>& __x, const _Tp2*)
-{ return (pthread_allocator<_Tp2>&)__x; }
-
-template <class _Tp1, class _Tp2>
-inline pthread_allocator<_Tp2>
-__stl_alloc_create(pthread_allocator<_Tp1>&, const _Tp2*)
-{ return pthread_allocator<_Tp2>(); }
-
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Tp>
-struct __pthread_alloc_type_traits {
- typedef typename _IsSTLportClass<pthread_allocator<_Tp> >::_Ret _STLportAlloc;
- //The default allocator implementation which is recognize thanks to the
- //__stlport_class inheritance is a stateless object so:
- typedef _STLportAlloc has_trivial_default_constructor;
- typedef _STLportAlloc has_trivial_copy_constructor;
- typedef _STLportAlloc has_trivial_assignment_operator;
- typedef _STLportAlloc has_trivial_destructor;
- typedef _STLportAlloc is_POD_type;
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp>
-struct __type_traits<pthread_allocator<_Tp> > : _STLP_PRIV __pthread_alloc_type_traits<_Tp> {};
-#else
-_STLP_TEMPLATE_NULL
-struct __type_traits<pthread_allocator<char> > : _STLP_PRIV __pthread_alloc_type_traits<char> {};
-# if defined (_STLP_HAS_WCHAR_T)
-_STLP_TEMPLATE_NULL
-struct __type_traits<pthread_allocator<wchar_t> > : _STLP_PRIV __pthread_alloc_type_traits<wchar_t> {};
-# endif
-# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-_STLP_TEMPLATE_NULL
-struct __type_traits<pthread_allocator<void*> > : _STLP_PRIV __pthread_alloc_type_traits<void*> {};
-# endif
-#endif
-
-//
-// per_thread_allocator<> : this allocator always return memory to the same thread
-// it was allocated from.
-//
-
-template <class _Tp>
-class per_thread_allocator {
- typedef pthread_alloc _S_Alloc; // The underlying allocator.
- typedef pthread_alloc::__state_type __state_type;
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
- typedef _Tp value_type;
-
-#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
- template <class _NewType> struct rebind {
- typedef per_thread_allocator<_NewType> other;
- };
-#endif
-
- per_thread_allocator() _STLP_NOTHROW {
- _M_state = _S_Alloc::_S_get_per_thread_state();
- }
- per_thread_allocator(const per_thread_allocator<_Tp>& __a) _STLP_NOTHROW : _M_state(__a._M_state){}
-
-#if defined (_STLP_MEMBER_TEMPLATES) /* && defined (_STLP_FUNCTION_PARTIAL_ORDER) */
- template <class _OtherType> per_thread_allocator(const per_thread_allocator<_OtherType>& __a)
- _STLP_NOTHROW : _M_state(__a._M_state) {}
-#endif
-
- ~per_thread_allocator() _STLP_NOTHROW {}
-
- pointer address(reference __x) const { return &__x; }
- const_pointer address(const_reference __x) const { return &__x; }
-
- // __n is permitted to be 0. The C++ standard says nothing about what
- // the return value is when __n == 0.
- _Tp* allocate(size_type __n, const void* = 0) {
- if (__n > max_size()) {
- __THROW_BAD_ALLOC;
- }
- if (__n != 0) {
- size_type __buf_size = __n * sizeof(value_type);
- _Tp* __ret = __REINTERPRET_CAST(_Tp*, _S_Alloc::allocate(__buf_size, _M_state));
-#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
- if (__ret != 0) {
- memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
- }
-#endif
- return __ret;
- }
- else
- return 0;
- }
-
- void deallocate(pointer __p, size_type __n) {
- _STLP_ASSERT( (__p == 0) == (__n == 0) )
- if (__p != 0) {
-#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
- memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
-#endif
- _S_Alloc::deallocate(__p, __n * sizeof(value_type), _M_state);
- }
- }
-
- size_type max_size() const _STLP_NOTHROW
- { return size_t(-1) / sizeof(_Tp); }
-
- void construct(pointer __p, const _Tp& __val) { _STLP_PLACEMENT_NEW (__p) _Tp(__val); }
- void destroy(pointer _p) { _p->~_Tp(); }
-
- // state is being kept here
- __state_type* _M_state;
-
-#if defined (_STLP_NO_EXTENSIONS)
- /* STLport extension giving rounded size of an allocated memory buffer
- * This method do not have to be part of a user defined allocator implementation
- * and won't even be called if such a function was granted.
- */
-protected:
-#endif
- _Tp* allocate(size_type __n, size_type& __allocated_n) {
- if (__n > max_size()) {
- __THROW_BAD_ALLOC;
- }
- if (__n != 0) {
- size_type __buf_size = __n * sizeof(value_type);
- _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size, _M_state));
-#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
- if (__ret != 0) {
- memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
- }
-#endif
- __allocated_n = __buf_size / sizeof(value_type);
- return __ret;
- }
- else
- return 0;
- }
-};
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC per_thread_allocator<void> {
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef void* pointer;
- typedef const void* const_pointer;
- typedef void value_type;
-#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
- template <class _NewType> struct rebind {
- typedef per_thread_allocator<_NewType> other;
- };
-#endif
-};
-
-template <class _T1, class _T2>
-inline bool operator==(const per_thread_allocator<_T1>& __a1,
- const per_thread_allocator<_T2>& __a2)
-{ return __a1._M_state == __a2._M_state; }
-
-#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
-template <class _T1, class _T2>
-inline bool operator!=(const per_thread_allocator<_T1>& __a1,
- const per_thread_allocator<_T2>& __a2)
-{ return __a1._M_state != __a2._M_state; }
-#endif
-
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-
-template <class _Tp, class _Atype>
-struct _Alloc_traits<_Tp, per_thread_allocator<_Atype> >
-{ typedef per_thread_allocator<_Tp> allocator_type; };
-
-#endif
-
-#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
-
-template <class _Tp1, class _Tp2>
-inline per_thread_allocator<_Tp2>&
-__stl_alloc_rebind(per_thread_allocator<_Tp1>& __x, const _Tp2*)
-{ return (per_thread_allocator<_Tp2>&)__x; }
-
-template <class _Tp1, class _Tp2>
-inline per_thread_allocator<_Tp2>
-__stl_alloc_create(per_thread_allocator<_Tp1>&, const _Tp2*)
-{ return per_thread_allocator<_Tp2>(); }
-
-#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Tp>
-struct __perthread_alloc_type_traits {
- typedef typename _IsSTLportClass<per_thread_allocator<_Tp> >::_Ret _STLportAlloc;
- //The default allocator implementation which is recognize thanks to the
- //__stlport_class inheritance is a stateless object so:
- typedef __false_type has_trivial_default_constructor;
- typedef _STLportAlloc has_trivial_copy_constructor;
- typedef _STLportAlloc has_trivial_assignment_operator;
- typedef _STLportAlloc has_trivial_destructor;
- typedef __false_type is_POD_type;
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp>
-struct __type_traits<per_thread_allocator<_Tp> > : _STLP_PRIV __perthread_alloc_type_traits<_Tp> {};
-#else
-_STLP_TEMPLATE_NULL
-struct __type_traits<per_thread_allocator<char> > : _STLP_PRIV __perthread_alloc_type_traits<char> {};
-# if defined (_STLP_HAS_WCHAR_T)
-_STLP_TEMPLATE_NULL
-struct __type_traits<per_thread_allocator<wchar_t> > : _STLP_PRIV __perthread_alloc_type_traits<wchar_t> {};
-# endif
-# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-_STLP_TEMPLATE_NULL
-struct __type_traits<per_thread_allocator<void*> > : _STLP_PRIV __perthread_alloc_type_traits<void*> {};
-# endif
-#endif
-
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_PTHREAD_ALLOC */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_ptrs_specialize.h b/stl/_ptrs_specialize.h
deleted file mode 100644
index 92340db..0000000
--- a/stl/_ptrs_specialize.h
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef _STLP_PTRS_SPECIALIZE_H
-#define _STLP_PTRS_SPECIALIZE_H
-
-#ifndef _STLP_TYPE_TRAITS_H
-# include <stl/type_traits.h>
-#endif
-
-// the following is a workaround for arrow operator problems
-#if defined ( _STLP_NO_ARROW_OPERATOR )
-// User wants to disable proxy -> operators
-# define _STLP_DEFINE_ARROW_OPERATOR
-# define _STLP_ARROW_SPECIALIZE_WITH_PTRS(_Tp)
-#else
-// Compiler can handle generic -> operator.
-# define _STLP_ARROW_SPECIALIZE_WITH_PTRS(_Tp)
-# if defined (__BORLANDC__)
-# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(*(*this)); }
-# elif defined(__WATCOMC__)
-# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { reference x = operator*(); return &x; }
-# else
-# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); }
-# endif
-#endif /* _STLP_NO_ARROW_OPERATOR */
-
-// Important pointers specializations
-
-#ifdef _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
-# define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type)
-# define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type)
-#else
-# define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type) _STLP_TEMPLATE_NULL struct __type_traits<_Type> : __type_traits_aux<1> {};
-# define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) \
-_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type*) \
-_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type*) \
-_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type**) \
-_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type* const *) \
-_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type**) \
-_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type***) \
-_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type***)
-#endif
-
-# define _STLP_POINTERS_SPECIALIZE(_Type) _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) _STLP_ARROW_SPECIALIZE_WITH_PTRS(_Type)
-
-_STLP_BEGIN_NAMESPACE
-
-# if !defined ( _STLP_NO_BOOL )
-_STLP_POINTERS_SPECIALIZE( bool )
-# endif
-_STLP_TYPE_TRAITS_POD_SPECIALIZE_V(void)
-# ifndef _STLP_NO_SIGNED_BUILTINS
- _STLP_POINTERS_SPECIALIZE( signed char )
-# endif
- _STLP_POINTERS_SPECIALIZE( char )
- _STLP_POINTERS_SPECIALIZE( unsigned char )
- _STLP_POINTERS_SPECIALIZE( short )
- _STLP_POINTERS_SPECIALIZE( unsigned short )
- _STLP_POINTERS_SPECIALIZE( int )
- _STLP_POINTERS_SPECIALIZE( unsigned int )
- _STLP_POINTERS_SPECIALIZE( long )
- _STLP_POINTERS_SPECIALIZE( unsigned long )
- _STLP_POINTERS_SPECIALIZE( float )
- _STLP_POINTERS_SPECIALIZE( double )
-# if !defined ( _STLP_NO_LONG_DOUBLE )
- _STLP_POINTERS_SPECIALIZE( long double )
-# endif
-# if defined ( _STLP_LONG_LONG)
- _STLP_POINTERS_SPECIALIZE( _STLP_LONG_LONG )
- _STLP_POINTERS_SPECIALIZE( unsigned _STLP_LONG_LONG )
-# endif
-#if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
- _STLP_POINTERS_SPECIALIZE( wchar_t )
-# endif
-
-_STLP_END_NAMESPACE
-
-# undef _STLP_ARROW_SPECIALIZE
-# undef _STLP_ARROW_SPECIALIZE_WITH_PTRS
-# undef _STLP_TYPE_TRAITS_POD_SPECIALIZE_V
-
-#endif
diff --git a/stl/_queue.h b/stl/_queue.h
deleted file mode 100644
index 4920615..0000000
--- a/stl/_queue.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_QUEUE_H
-#define _STLP_INTERNAL_QUEUE_H
-
-#ifndef _STLP_INTERNAL_DEQUE_H
-# include <stl/_deque.h>
-#endif
-
-#ifndef _STLP_INTERNAL_VECTOR_H
-# include <stl/_vector.h>
-#endif
-
-#ifndef _STLP_INTERNAL_HEAP_H
-# include <stl/_heap.h>
-#endif
-
-#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
-# include <stl/_function_base.h>
-#endif
-
-#if defined(__SC__) && !defined(__DMC__) //*ty 12/07/2001 - since "comp" is a built-in type and reserved under SCpp
-# define comp _Comp
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-# if ! defined ( _STLP_LIMITED_DEFAULT_TEMPLATES )
-template <class _Tp, class _Sequence = deque<_Tp> >
-# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
-# define _STLP_QUEUE_ARGS _Tp
-template <class _Tp>
-# else
-template <class _Tp, class _Sequence>
-# endif
-class queue
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
-# if defined (_STLP_QUEUE_ARGS)
- : public __stlport_class<queue<_Tp> >
-# else
- : public __stlport_class<queue<_Tp, _Sequence> >
-# endif
-#endif
-{
-# if defined ( _STLP_QUEUE_ARGS )
- typedef deque<_Tp> _Sequence;
- typedef queue<_Tp> _Self;
-# else
- typedef queue<_Tp, _Sequence> _Self;
-# endif
-public:
- typedef typename _Sequence::value_type value_type;
- typedef typename _Sequence::size_type size_type;
- typedef _Sequence container_type;
-
- typedef typename _Sequence::reference reference;
- typedef typename _Sequence::const_reference const_reference;
-
-protected:
- //c is a Standard name (23.2.3.1), do no make it STLport naming convention compliant.
- _Sequence c;
-public:
- queue() : c() {}
- explicit queue(const _Sequence& __c) : c(__c) {}
-
- queue(__move_source<_Self> src)
- : c(_STLP_PRIV _AsMoveSource(src.get().c)) {}
-
- bool empty() const { return c.empty(); }
- size_type size() const { return c.size(); }
- reference front() { return c.front(); }
- const_reference front() const { return c.front(); }
- reference back() { return c.back(); }
- const_reference back() const { return c.back(); }
- void push(const value_type& __x) { c.push_back(__x); }
- void pop() { c.pop_front(); }
- const _Sequence& _Get_s() const { return c; }
-};
-
-#ifndef _STLP_QUEUE_ARGS
-# define _STLP_QUEUE_ARGS _Tp, _Sequence
-# define _STLP_QUEUE_HEADER_ARGS class _Tp, class _Sequence
-#else
-# define _STLP_QUEUE_HEADER_ARGS class _Tp
-#endif
-
-template < _STLP_QUEUE_HEADER_ARGS >
-inline bool _STLP_CALL
-operator==(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) {
- return __x._Get_s() == __y._Get_s();
-}
-
-template < _STLP_QUEUE_HEADER_ARGS >
-inline bool _STLP_CALL
-operator<(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) {
- return __x._Get_s() < __y._Get_s();
-}
-
-_STLP_RELOPS_OPERATORS( template < _STLP_QUEUE_HEADER_ARGS >, queue<_STLP_QUEUE_ARGS > )
-
-# if !(defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) || defined ( _STLP_TEMPLATE_PARAM_SUBTYPE_BUG ))
-template <class _Tp, class _Sequence = vector<_Tp>,
- class _Compare = less<_STLP_HEADER_TYPENAME _Sequence::value_type> >
-# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
-template <class _Tp>
-# else
-template <class _Tp, class _Sequence, class _Compare>
-# endif
-class priority_queue
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
-# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
- : public __stlport_class<priority_queue<_Tp> >
-# else
- : public __stlport_class<priority_queue<_Tp, _Sequence> >
-# endif
-#endif
-{
-# ifdef _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS
- typedef vector<_Tp> _Sequence;
- typedef less< typename vector<_Tp>::value_type> _Compare;
- typedef priority_queue<_Tp> _Self;
-# else
- typedef priority_queue<_Tp, _Sequence, _Compare> _Self;
-# endif
-public:
- typedef typename _Sequence::value_type value_type;
- typedef typename _Sequence::size_type size_type;
- typedef _Sequence container_type;
-
- typedef typename _Sequence::reference reference;
- typedef typename _Sequence::const_reference const_reference;
-protected:
- //c is a Standard name (23.2.3.2), do no make it STLport naming convention compliant.
- _Sequence c;
- _Compare comp;
-public:
- priority_queue() : c() {}
- explicit priority_queue(const _Compare& __x) : c(), comp(__x) {}
- priority_queue(const _Compare& __x, const _Sequence& __s)
- : c(__s), comp(__x)
- { make_heap(c.begin(), c.end(), comp); }
-
- priority_queue(__move_source<_Self> src)
- : c(_STLP_PRIV _AsMoveSource(src.get().c)),
- comp(_STLP_PRIV _AsMoveSource(src.get().comp)) {}
-
-#ifdef _STLP_MEMBER_TEMPLATES
- template <class _InputIterator>
- priority_queue(_InputIterator __first, _InputIterator __last)
- : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
-
- template <class _InputIterator>
- priority_queue(_InputIterator __first,
- _InputIterator __last, const _Compare& __x)
- : c(__first, __last), comp(__x)
- { make_heap(c.begin(), c.end(), comp); }
-
- template <class _InputIterator>
- priority_queue(_InputIterator __first, _InputIterator __last,
- const _Compare& __x, const _Sequence& __s)
- : c(__s), comp(__x)
- {
- c.insert(c.end(), __first, __last);
- make_heap(c.begin(), c.end(), comp);
- }
-
-#else /* _STLP_MEMBER_TEMPLATES */
- priority_queue(const value_type* __first, const value_type* __last)
- : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
-
- priority_queue(const value_type* __first, const value_type* __last,
- const _Compare& __x)
- : c(__first, __last), comp(__x)
- { make_heap(c.begin(), c.end(), comp); }
-
- priority_queue(const value_type* __first, const value_type* __last,
- const _Compare& __x, const _Sequence& __c)
- : c(__c), comp(__x)
- {
- c.insert(c.end(), __first, __last);
- make_heap(c.begin(), c.end(), comp);
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- bool empty() const { return c.empty(); }
- size_type size() const { return c.size(); }
- const_reference top() const { return c.front(); }
- void push(const value_type& __x) {
- _STLP_TRY {
- c.push_back(__x);
- push_heap(c.begin(), c.end(), comp);
- }
- _STLP_UNWIND(c.clear())
- }
- void pop() {
- _STLP_TRY {
- pop_heap(c.begin(), c.end(), comp);
- c.pop_back();
- }
- _STLP_UNWIND(c.clear())
- }
-};
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp, class _Sequence>
-struct __move_traits<queue<_Tp, _Sequence> > :
- _STLP_PRIV __move_traits_aux<_Sequence>
-{};
-
-template <class _Tp, class _Sequence, class _Compare>
-struct __move_traits<priority_queue<_Tp, _Sequence, _Compare> > :
- _STLP_PRIV __move_traits_aux2<_Sequence, _Compare>
-{};
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-_STLP_END_NAMESPACE
-
-#undef _STLP_QUEUE_ARGS
-#undef _STLP_QUEUE_HEADER_ARGS
-#undef comp
-
-#endif /* _STLP_INTERNAL_QUEUE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_range_errors.h b/stl/_range_errors.h
deleted file mode 100644
index 583d265..0000000
--- a/stl/_range_errors.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics
- *
- * 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.
- *
- */
-
-#ifndef _STLP_RANGE_ERRORS_H
-#define _STLP_RANGE_ERRORS_H
-
-// A few places in the STL throw range errors, using standard exception
-// classes defined in <stdexcept>. This header file provides functions
-// to throw those exception objects.
-
-// _STLP_DONT_THROW_RANGE_ERRORS is a hook so that users can disable
-// this exception throwing.
-#if defined (_STLP_CAN_THROW_RANGE_ERRORS) && defined (_STLP_USE_EXCEPTIONS) && \
- !defined (_STLP_DONT_THROW_RANGE_ERRORS)
-# define _STLP_THROW_RANGE_ERRORS
-#endif
-
-// For the STLport iostreams, only declaration here, definition is in the lib
-#if !defined (_STLP_USE_NO_IOSTREAMS) && \
- !defined (_STLP_USE_NO_EXTERN_RANGE_ERRORS) && \
- !defined (_STLP_EXTERN_RANGE_ERRORS)
-# define _STLP_EXTERN_RANGE_ERRORS
-#endif
-
-_STLP_BEGIN_NAMESPACE
-void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg);
-void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg);
-void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg);
-void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg);
-void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg);
-void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg);
-_STLP_END_NAMESPACE
-
-#if !defined (_STLP_EXTERN_RANGE_ERRORS)
-
-# if defined(_STLP_THROW_RANGE_ERRORS)
-# ifndef _STLP_INTERNAL_STDEXCEPT
-# include <stl/_stdexcept.h>
-# endif
-# ifndef _STLP_STRING
-# include <string>
-# endif
-# define _STLP_THROW_MSG(ex,msg) throw ex(string(msg))
-# else
-# if defined (_STLP_RTTI_BUG)
-# define _STLP_THROW_MSG(ex,msg) TerminateProcess(GetCurrentProcess(), 0)
-# else
-# ifndef _STLP_INTERNAL_CSTDLIB
-# include <stl/_cstdlib.h>
-# endif
-# ifndef _STLP_INTERNAL_CSTDIO
-# include <stl/_cstdio.h>
-# endif
-# define _STLP_THROW_MSG(ex,msg) puts(msg),_STLP_ABORT()
-# endif
-# endif
-
-// For mode without library and throwing range errors, include the
-// stdexcept header and throw the appropriate exceptions directly.
-
-_STLP_BEGIN_NAMESPACE
-
-inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg)
-{ _STLP_THROW_MSG(runtime_error, __msg); }
-
-inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg)
-{ _STLP_THROW_MSG(range_error, __msg); }
-
-inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg)
-{ _STLP_THROW_MSG(out_of_range, __msg); }
-
-inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg)
-{ _STLP_THROW_MSG(length_error, __msg); }
-
-inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg)
-{ _STLP_THROW_MSG(invalid_argument, __msg); }
-
-inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg)
-{ _STLP_THROW_MSG(overflow_error, __msg); }
-
-_STLP_END_NAMESPACE
-
-# undef _STLP_THROW_MSG
-
-#endif /* EXTERN_RANGE_ERRORS */
-
-#endif /* _STLP_RANGE_ERRORS_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_rope.c b/stl/_rope.c
deleted file mode 100644
index 61a8fda..0000000
--- a/stl/_rope.c
+++ /dev/null
@@ -1,1433 +0,0 @@
-/*
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
-// if necessary. Assumes path_end[leaf_index] and leaf_pos are correct.
-// Results in a valid buf_ptr if the iterator can be legitimately
-// dereferenced.
-#ifndef _STLP_ROPEIMPL_H
-#define _STLP_ROPEIMPL_H
-
-#ifndef _STLP_INTERNAL_ROPE_H
-# include <stl/_rope.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CSTDIO
-# include <stl/_cstdio.h>
-#endif
-
-#if !defined (_STLP_USE_NO_IOSTREAMS)
-# ifndef _STLP_IOSTREAM
-# include <iostream>
-# endif
-#endif
-
-#include <stl/_range_errors.h>
-
-_STLP_BEGIN_NAMESPACE
-
-# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
-# define __allocator__ _Alloc
-# else
-# define __allocator__ allocator_type
-# endif
-
-template<class _CharT, class _Alloc>
-_Rope_iterator<_CharT, _Alloc>::_Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos)
- : _Rope_iterator_base<_CharT,_Alloc>(__r->_M_tree_ptr._M_data, __pos),
- _M_root_rope(__r) { _RopeRep::_S_ref(this->_M_root); }
-
-template<class _CharT, class _Alloc>
-_Rope_iterator<_CharT, _Alloc>::_Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos):
- _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr._M_data, __pos),
- _M_root_rope(&__r) {
-#if !defined (__DMC__)
- _RopeRep::_S_ref(this->_M_root); if (!(__r.empty()))_S_setcache(*this);
-#else
- _Rope_iterator_base<_CharT, _Alloc>* __x = this;
- _RopeRep::_S_ref(this->_M_root); if (!(__r.empty()))_S_setcache(*__x);
-#endif
-}
-
-template<class _CharT, class _Alloc>
-void _Rope_RopeRep<_CharT, _Alloc>::_M_free_c_string() {
- _CharT* __cstr = _M_c_string;
- if (0 != __cstr) {
- size_t _p_size = _M_size._M_data + 1;
- _STLP_STD::_Destroy_Range(__cstr, __cstr + _p_size);
- _M_size.deallocate(__cstr, _p_size);
- }
-}
-
-// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
-// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct.
-// Results in a valid buf_ptr if the iterator can be legitimately
-// dereferenced.
-template <class _CharT, class _Alloc>
-void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf(
- _Rope_iterator_base<_CharT,_Alloc>& __x) {
- const _RopeRep* __leaf = __x._M_path_end._M_data[__x._M_leaf_index];
- size_t __leaf_pos = __x._M_leaf_pos;
- size_t __pos = __x._M_current_pos;
-
- switch(__leaf->_M_tag) {
- case _RopeRep::_S_leaf:
- typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf;
- __x._M_buf_start = __STATIC_CAST(const _RopeLeaf*, __leaf)->_M_data;
- __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos);
- __x._M_buf_end = __x._M_buf_start + __leaf->_M_size._M_data;
- break;
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- {
- size_t __len = _S_iterator_buf_len;
- size_t __buf_start_pos = __leaf_pos;
- size_t __leaf_end = __leaf_pos + __leaf->_M_size._M_data;
- typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction;
- char_producer<_CharT>* __fn = __STATIC_CAST(const _RopeFunction*, __leaf)->_M_fn;
-
- if (__buf_start_pos + __len <= __pos) {
- __buf_start_pos = __pos - __len/4;
- if (__buf_start_pos + __len > __leaf_end) {
- __buf_start_pos = __leaf_end - __len;
- }
- }
- if (__buf_start_pos + __len > __leaf_end) {
- __len = __leaf_end - __buf_start_pos;
- }
- (*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf._M_data);
- __x._M_buf_ptr = __x._M_tmp_buf._M_data + (__pos - __buf_start_pos);
- __x._M_buf_start = __x._M_tmp_buf._M_data;
- __x._M_buf_end = __x._M_tmp_buf._M_data + __len;
- }
- break;
- default:
- _STLP_ASSERT(0)
- ;
- }
-}
-
-// Set path and buffer inside a rope iterator. We assume that
-// pos and root are already set.
-template <class _CharT, class _Alloc>
-void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache(
- _Rope_iterator_base<_CharT,_Alloc>& __x) {
- const _RopeRep* __path[_RopeRep::_S_max_rope_depth+1];
- const _RopeRep* __curr_rope;
- int __curr_depth = -1; /* index into path */
- size_t __curr_start_pos = 0;
- size_t __pos = __x._M_current_pos;
- unsigned char __dirns = 0; // Bit vector marking right turns in the path
-
- _STLP_ASSERT(__pos <= __x._M_root->_M_size._M_data)
- if (__pos >= __x._M_root->_M_size._M_data) {
- __x._M_buf_ptr = 0;
- return;
- }
- __curr_rope = __x._M_root;
- if (0 != __curr_rope->_M_c_string) {
- /* Treat the root as a leaf. */
- __x._M_buf_start = __curr_rope->_M_c_string;
- __x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size._M_data;
- __x._M_buf_ptr = __curr_rope->_M_c_string + __pos;
- __x._M_path_end._M_data[0] = __curr_rope;
- __x._M_leaf_index = 0;
- __x._M_leaf_pos = 0;
- return;
- }
- for(;;) {
- ++__curr_depth;
- _STLP_ASSERT(__curr_depth <= _RopeRep::_S_max_rope_depth)
- __path[__curr_depth] = __curr_rope;
- switch(__curr_rope->_M_tag) {
- case _RopeRep::_S_leaf:
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- __x._M_leaf_pos = __curr_start_pos;
- goto done;
- case _RopeRep::_S_concat:
- {
- const _RopeConcat* __c = __STATIC_CAST(const _RopeConcat*, __curr_rope);
- _RopeRep* __left = __c->_M_left;
- size_t __left_len = __left->_M_size._M_data;
-
- __dirns <<= 1;
- if (__pos >= __curr_start_pos + __left_len) {
- __dirns |= 1;
- __curr_rope = __c->_M_right;
- __curr_start_pos += __left_len;
- } else {
- __curr_rope = __left;
- }
- }
- break;
- }
- }
-done:
- // Copy last section of path into _M_path_end.
- {
- int __i = -1;
- int __j = __curr_depth + 1 - _S_path_cache_len;
-
- if (__j < 0) __j = 0;
- while (__j <= __curr_depth) {
- __x._M_path_end._M_data[++__i] = __path[__j++];
- }
- __x._M_leaf_index = __i;
- }
- __x._M_path_directions = __dirns;
- _S_setbuf(__x);
-}
-
-// Specialized version of the above. Assumes that
-// the path cache is valid for the previous position.
-template <class _CharT, class _Alloc>
-void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache_for_incr(
-_Rope_iterator_base<_CharT,_Alloc>& __x) {
- int __current_index = __x._M_leaf_index;
- const _RopeRep* __current_node = __x._M_path_end._M_data[__current_index];
- size_t __len = __current_node->_M_size._M_data;
- size_t __node_start_pos = __x._M_leaf_pos;
- unsigned char __dirns = __x._M_path_directions;
- const _RopeConcat* __c;
-
- _STLP_ASSERT(__x._M_current_pos <= __x._M_root->_M_size._M_data)
- if (__x._M_current_pos - __node_start_pos < __len) {
- /* More stuff in this leaf, we just didn't cache it. */
- _S_setbuf(__x);
- return;
- }
- _STLP_ASSERT(__node_start_pos + __len == __x._M_current_pos)
- // node_start_pos is starting position of last_node.
- while (--__current_index >= 0) {
- if (!(__dirns & 1) /* Path turned left */)
- break;
- __current_node = __x._M_path_end._M_data[__current_index];
- __c = __STATIC_CAST(const _RopeConcat*, __current_node);
- // Otherwise we were in the right child. Thus we should pop
- // the concatenation node.
- __node_start_pos -= __c->_M_left->_M_size._M_data;
- __dirns >>= 1;
- }
- if (__current_index < 0) {
- // We underflowed the cache. Punt.
- _S_setcache(__x);
- return;
- }
- __current_node = __x._M_path_end._M_data[__current_index];
- __c = __STATIC_CAST(const _RopeConcat*, __current_node);
- // current_node is a concatenation node. We are positioned on the first
- // character in its right child.
- // node_start_pos is starting position of current_node.
- __node_start_pos += __c->_M_left->_M_size._M_data;
- __current_node = __c->_M_right;
- __x._M_path_end._M_data[++__current_index] = __current_node;
- __dirns |= 1;
- while (_RopeRep::_S_concat == __current_node->_M_tag) {
- ++__current_index;
- if (_S_path_cache_len == __current_index) {
- int __i;
- for (__i = 0; __i < _S_path_cache_len-1; ++__i) {
- __x._M_path_end._M_data[__i] = __x._M_path_end._M_data[__i+1];
- }
- --__current_index;
- }
- __current_node = __STATIC_CAST(const _RopeConcat*, __current_node)->_M_left;
- __x._M_path_end._M_data[__current_index] = __current_node;
- __dirns <<= 1;
- // node_start_pos is unchanged.
- }
- __x._M_leaf_index = __current_index;
- __x._M_leaf_pos = __node_start_pos;
- __x._M_path_directions = __dirns;
- _S_setbuf(__x);
-}
-
-template <class _CharT, class _Alloc>
-void _Rope_iterator_base<_CharT,_Alloc>::_M_incr(size_t __n) {
- _M_current_pos += __n;
- if (0 != _M_buf_ptr) {
- size_t __chars_left = _M_buf_end - _M_buf_ptr;
- if (__chars_left > __n) {
- _M_buf_ptr += __n;
- } else if (__chars_left == __n) {
- _M_buf_ptr += __n;
- _S_setcache_for_incr(*this);
- } else {
- _M_buf_ptr = 0;
- }
- }
-}
-
-template <class _CharT, class _Alloc>
-void _Rope_iterator_base<_CharT,_Alloc>::_M_decr(size_t __n) {
- if (0 != _M_buf_ptr) {
- size_t __chars_left = _M_buf_ptr - _M_buf_start;
- if (__chars_left >= __n) {
- _M_buf_ptr -= __n;
- } else {
- _M_buf_ptr = 0;
- }
- }
- _M_current_pos -= __n;
-}
-
-template <class _CharT, class _Alloc>
-void _Rope_iterator<_CharT,_Alloc>::_M_check() {
- if (_M_root_rope->_M_tree_ptr._M_data != this->_M_root) {
- // _Rope was modified. Get things fixed up.
- _RopeRep::_S_unref(this->_M_root);
- this->_M_root = _M_root_rope->_M_tree_ptr._M_data;
- _RopeRep::_S_ref(this->_M_root);
- this->_M_buf_ptr = 0;
- }
-}
-
-// There are several reasons for not doing this with virtual destructors
-// and a class specific delete operator:
-// - A class specific delete operator can't easily get access to
-// allocator instances if we need them.
-// - Any virtual function would need a 4 or byte vtable pointer;
-// this only requires a one byte tag per object.
-template <class _CharT, class _Alloc>
-void _Rope_RopeRep<_CharT,_Alloc>::_M_free_tree() {
- switch (_M_tag) {
- case _S_leaf:
- {
- typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf;
- _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, this);
- _STLP_STD::_Destroy(__l); // ->_Rope_RopeLeaf<_CharT,_Alloc>::~_Rope_RopeLeaf();
- _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size,
- _RopeLeaf).deallocate(__l, 1);
- break;
- }
- case _S_concat:
- {
- typedef _Rope_RopeConcatenation<_CharT, _Alloc> _RopeConcatenation;
- _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, this);
- _STLP_STD::_Destroy(__c);
- _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size,
- _RopeConcatenation).deallocate(__c, 1);
- break;
- }
- case _S_function:
- {
- typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction;
- _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, this);
- _STLP_STD::_Destroy(__f);
- _STLP_CREATE_ALLOCATOR(allocator_type, (const allocator_type&)_M_size,
- _RopeFunction).deallocate(__f, 1);
- break;
- }
- case _S_substringfn:
- {
- typedef _Rope_RopeSubstring<_CharT, _Alloc> _RopeSubstring;
- _RopeSubstring* __rss = __STATIC_CAST(_RopeSubstring*, this);
- _STLP_STD::_Destroy(__rss);
- _STLP_CREATE_ALLOCATOR(allocator_type, (const allocator_type&)_M_size,
- _RopeSubstring).deallocate(__rss, 1);
- break;
- }
- }
-}
-
-# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
-# define __RopeLeaf__ _Rope_RopeLeaf<_CharT,_Alloc>
-# define __RopeRep__ _Rope_RopeRep<_CharT,_Alloc>
-# define _RopeLeaf _Rope_RopeLeaf<_CharT,_Alloc>
-# define _RopeRep _Rope_RopeRep<_CharT,_Alloc>
-# define size_type size_t
-# else
-# define __RopeLeaf__ _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeLeaf
-# define __RopeRep__ _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeRep
-# endif
-
-template <class _CharT, class _Alloc>
-void rope<_CharT, _Alloc>::_M_throw_out_of_range() const {
- __stl_throw_out_of_range("rope");
-}
-
-// Concatenate a C string onto a leaf rope by copying the rope data.
-// Used for short ropes.
-template <class _CharT, class _Alloc>
-__RopeLeaf__*
-rope<_CharT,_Alloc>::_S_leaf_concat_char_iter (
- _RopeLeaf* __r, const _CharT* __iter, size_t __len) {
- size_t __old_len = __r->_M_size._M_data;
- _CharT* __new_data = __r->_M_size.allocate(_S_rounded_up_size(__old_len + __len));
- _RopeLeaf* __result;
-
- _STLP_PRIV __ucopy_n(__r->_M_data, __old_len, __new_data);
- _STLP_PRIV __ucopy_n(__iter, __len, __new_data + __old_len);
- _S_construct_null(__new_data + __old_len + __len);
- _STLP_TRY {
- __result = _S_new_RopeLeaf(__new_data, __old_len + __len, __r->get_allocator());
- }
- _STLP_UNWIND(_RopeRep::_S_free_string(__new_data, __old_len + __len,
- __r->get_allocator()))
- return __result;
-}
-
-template <class _CharT, class _Alloc>
-void _Terminate_RopeLeaf(_Rope_RopeLeaf<_CharT,_Alloc> *__r,
- size_t __size, const __true_type& /*basic char type*/) {
- _S_construct_null(__r->_M_data + __size);
- _STLP_ASSERT(__r->_M_c_string == __r->_M_data)
-}
-
-template <class _CharT, class _Alloc>
-void _Terminate_RopeLeaf(_Rope_RopeLeaf<_CharT,_Alloc> *__r,
- size_t, const __false_type& /*basic char type*/) {
- if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string) {
- __r->_M_free_c_string();
- __r->_M_c_string = 0;
- }
-}
-
-// As above, but it's OK to clobber original if refcount is 1
-template <class _CharT, class _Alloc>
-__RopeLeaf__*
-rope<_CharT,_Alloc>::_S_destr_leaf_concat_char_iter (_RopeLeaf* __r, const _CharT* __iter, size_t __len) {
- //_STLP_ASSERT(__r->_M_ref_count >= 1)
- if ( /* __r->_M_ref_count > 1 */ __r->_M_incr() > 2 ) { // - ptr
- __r->_M_decr(); // - ptr
- return _S_leaf_concat_char_iter(__r, __iter, __len);
- }
- __r->_M_decr(); // - ptr, __r->_M_ref_count == 1 or 0
- size_t __old_len = __r->_M_size._M_data;
- if (_S_rounded_up_size(__old_len) == _S_rounded_up_size(__old_len + __len)) {
- // The space has been partially initialized for the standard
- // character types. But that doesn't matter for those types.
- _STLP_PRIV __ucopy_n(__iter, __len, __r->_M_data + __old_len);
- _Terminate_RopeLeaf(__r, __old_len + __len, _IsBasicCharType());
- __r->_M_size._M_data = __old_len + __len;
- // _STLP_ASSERT(__r->_M_ref_count == 1)
- // __r->_M_ref_count = 2;
- __r->_M_incr(); // i.e. __r->_M_ref_count = 2
- return __r;
- } else {
- _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len);
- //_STLP_ASSERT(__result->_M_ref_count == 1)
- return __result;
- }
-}
-
-// Assumes left and right are not 0.
-// Does not increment (nor decrement on exception) child reference counts.
-// Result has ref count 1.
-template <class _CharT, class _Alloc>
-__RopeRep__*
-rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right) {
- _RopeConcatenation* __result =
- _S_new_RopeConcatenation(__left, __right, __left->get_allocator());
- size_t __depth = __result->_M_depth;
-
- _STLP_ASSERT(__left->get_allocator() == __right->get_allocator())
- if (__depth > 20 && (__result->_M_size._M_data < 1000 ||
- __depth > _RopeRep::_S_max_rope_depth)) {
- _RopeRep* __balanced;
-
- _STLP_TRY {
- __balanced = _S_balance(__result);
- // _STLP_ASSERT(__result == __balanced ||
- // 1 == __result->_M_ref_count &&
- // 1 == __balanced->_M_ref_count)
- __result->_M_unref_nonnil();
- }
- _STLP_UNWIND((_STLP_CREATE_ALLOCATOR(allocator_type,(allocator_type&)__left->_M_size,
- _RopeConcatenation).deallocate(__result,1)))
- // In case of exception, we need to deallocate
- // otherwise dangling result node. But caller
- // still owns its children. Thus unref is
- // inappropriate.
- return __balanced;
- } else {
- return __result;
- }
-}
-
-template <class _CharT, class _Alloc>
-__RopeRep__*
-rope<_CharT,_Alloc>::_S_concat_char_iter (_RopeRep* __r,
- const _CharT*__s, size_t __slen) {
- _RopeRep* __result;
- if (0 == __slen) {
- _S_ref(__r);
- return __r;
- }
- if (0 == __r)
- return _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator());
- if (_RopeRep::_S_leaf == __r->_M_tag &&
- __r->_M_size._M_data + __slen <= _S_copy_max) {
- __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
- // _STLP_ASSERT(1 == __result->_M_ref_count)
- return __result;
- }
- if (_RopeRep::_S_concat == __r->_M_tag &&
- _RopeRep::_S_leaf == ((_RopeConcatenation*)__r)->_M_right->_M_tag) {
- _RopeLeaf* __right = (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right);
- if (__right->_M_size._M_data + __slen <= _S_copy_max) {
- _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left;
- _RopeRep* __nright = _S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen);
- __left->_M_ref_nonnil();
- _STLP_TRY {
- __result = _S_tree_concat(__left, __nright);
- }
- _STLP_UNWIND(_S_unref(__left); _S_unref(__nright))
- // _STLP_ASSERT(1 == __result->_M_ref_count)
- return __result;
- }
- }
- _RopeRep* __nright =
- _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator());
- _STLP_TRY {
- __r->_M_ref_nonnil();
- __result = _S_tree_concat(__r, __nright);
- }
- _STLP_UNWIND(_S_unref(__r); _S_unref(__nright))
- // _STLP_ASSERT(1 == __result->_M_ref_count)
- return __result;
-}
-
-template <class _CharT, class _Alloc>
-__RopeRep__*
-rope<_CharT,_Alloc>::_S_destr_concat_char_iter(
- _RopeRep* __r, const _CharT* __s, size_t __slen) {
- _RopeRep* __result;
- if (0 == __r)
- return _S_RopeLeaf_from_unowned_char_ptr(__s, __slen,
- __r->get_allocator());
- // size_t __count = __r->_M_ref_count;
- size_t __orig_size = __r->_M_size._M_data;
- // _STLP_ASSERT(__count >= 1)
- if ( /* __count > 1 */ __r->_M_incr() > 2 ) {
- __r->_M_decr();
- return _S_concat_char_iter(__r, __s, __slen);
- }
- if (0 == __slen) {
- return __r;
- }
- __r->_M_decr();
- if (__orig_size + __slen <= _S_copy_max && _RopeRep::_S_leaf == __r->_M_tag) {
- return _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
- }
- if (_RopeRep::_S_concat == __r->_M_tag) {
- _RopeLeaf* __right = __STATIC_CAST(_RopeLeaf*, __STATIC_CAST(_RopeConcatenation*, __r)->_M_right);
- if (_RopeRep::_S_leaf == __right->_M_tag &&
- __right->_M_size._M_data + __slen <= _S_copy_max) {
- _RopeRep* __new_right = _S_destr_leaf_concat_char_iter(__right, __s, __slen);
- if (__right == __new_right) {
- // _STLP_ASSERT(__new_right->_M_ref_count == 2)
- // __new_right->_M_ref_count = 1;
- __new_right->_M_decr();
- } else {
- // _STLP_ASSERT(__new_right->_M_ref_count >= 1)
- __right->_M_unref_nonnil();
- }
- // _STLP_ASSERT(__r->_M_ref_count == 1)
- // __r->_M_ref_count = 2; // One more than before.
- __r->_M_incr();
- __STATIC_CAST(_RopeConcatenation*, __r)->_M_right = __new_right;
- // E.Musser : moved below
- // __r->_M_size._M_data = __orig_size + __slen;
- if (0 != __r->_M_c_string) {
- __r->_M_free_c_string();
- __r->_M_c_string = 0;
- }
- __r->_M_size._M_data = __orig_size + __slen;
- return __r;
- }
- }
- _RopeRep* __right =
- _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator());
- __r->_M_ref_nonnil();
- _STLP_TRY {
- __result = _S_tree_concat(__r, __right);
- }
- _STLP_UNWIND(_S_unref(__r); _S_unref(__right))
- // _STLP_ASSERT(1 == __result->_M_ref_count)
- return __result;
-}
-
-template <class _CharT, class _Alloc>
-__RopeRep__*
-rope<_CharT,_Alloc>::_S_concat_rep(_RopeRep* __left, _RopeRep* __right) {
- if (0 == __left) {
- _S_ref(__right);
- return __right;
- }
- if (0 == __right) {
- __left->_M_ref_nonnil();
- return __left;
- }
- if (_RopeRep::_S_leaf == __right->_M_tag) {
- if (_RopeRep::_S_leaf == __left->_M_tag) {
- if (__right->_M_size._M_data + __left->_M_size._M_data <= _S_copy_max) {
- return _S_leaf_concat_char_iter(__STATIC_CAST(_RopeLeaf*, __left),
- __STATIC_CAST(_RopeLeaf*, __right)->_M_data,
- __right->_M_size._M_data);
- }
- } else if (_RopeRep::_S_concat == __left->_M_tag &&
- _RopeRep::_S_leaf == __STATIC_CAST(_RopeConcatenation*, __left)->_M_right->_M_tag) {
- _RopeLeaf* __leftright =
- __STATIC_CAST(_RopeLeaf*, __STATIC_CAST(_RopeConcatenation*, __left)->_M_right);
- if (__leftright->_M_size._M_data + __right->_M_size._M_data <= _S_copy_max) {
- _RopeRep* __leftleft = __STATIC_CAST(_RopeConcatenation*, __left)->_M_left;
- _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright,
- __STATIC_CAST(_RopeLeaf*, __right)->_M_data,
- __right->_M_size._M_data);
- __leftleft->_M_ref_nonnil();
- _STLP_TRY {
- return _S_tree_concat(__leftleft, __rest);
- }
- _STLP_UNWIND(_S_unref(__leftleft); _S_unref(__rest))
- }
- }
- }
- __left->_M_ref_nonnil();
- __right->_M_ref_nonnil();
- _STLP_TRY {
- return _S_tree_concat(__left, __right);
- }
- _STLP_UNWIND(_S_unref(__left); _S_unref(__right))
- _STLP_RET_AFTER_THROW(0)
-}
-
-template <class _CharT, class _Alloc>
-__RopeRep__*
-rope<_CharT,_Alloc>::_S_substring(_RopeRep* __base,
- size_t __start, size_t __endp1) {
- if (0 == __base) return 0;
- size_t __len = __base->_M_size._M_data;
- size_t __adj_endp1;
- const size_t __lazy_threshold = 128;
-
- if (__endp1 >= __len) {
- if (0 == __start) {
- __base->_M_ref_nonnil();
- return __base;
- } else {
- __adj_endp1 = __len;
- }
- } else {
- __adj_endp1 = __endp1;
- }
- switch(__base->_M_tag) {
- case _RopeRep::_S_concat:
- {
- _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __base);
- _RopeRep* __left = __c->_M_left;
- _RopeRep* __right = __c->_M_right;
- size_t __left_len = __left->_M_size._M_data;
- _RopeRep* __result;
-
- if (__adj_endp1 <= __left_len) {
- return _S_substring(__left, __start, __endp1);
- } else if (__start >= __left_len) {
- return _S_substring(__right, __start - __left_len,
- __adj_endp1 - __left_len);
- }
- _Self_destruct_ptr __left_result(_S_substring(__left, __start, __left_len));
- _Self_destruct_ptr __right_result(_S_substring(__right, 0, __endp1 - __left_len));
- _STLP_MPWFIX_TRY //*TY 06/01/2000 - mpw forgets to call dtor on __left_result and __right_result without this try block
- __result = _S_concat_rep(__left_result, __right_result);
- // _STLP_ASSERT(1 == __result->_M_ref_count)
- return __result;
- _STLP_MPWFIX_CATCH //*TY 06/01/2000 -
- }
- case _RopeRep::_S_leaf:
- {
- _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __base);
- _RopeLeaf* __result;
- size_t __result_len;
- if (__start >= __adj_endp1) return 0;
- __result_len = __adj_endp1 - __start;
- if (__result_len > __lazy_threshold) goto lazy;
- const _CharT* __section = __l->_M_data + __start;
- // We should sometimes create substring node instead.
- __result = _S_RopeLeaf_from_unowned_char_ptr(__section, __result_len,
- __base->get_allocator());
- return __result;
- }
- case _RopeRep::_S_substringfn:
- // Avoid introducing multiple layers of substring nodes.
- {
- _RopeSubstring* __old = __STATIC_CAST(_RopeSubstring*, __base);
- size_t __result_len;
- if (__start >= __adj_endp1) return 0;
- __result_len = __adj_endp1 - __start;
- if (__result_len > __lazy_threshold) {
- _RopeSubstring* __result = _S_new_RopeSubstring(__old->_M_base,
- __start + __old->_M_start,
- __adj_endp1 - __start,
- __base->get_allocator());
- return __result;
- } // *** else fall through: ***
- }
- case _RopeRep::_S_function:
- {
- _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __base);
- if (__start >= __adj_endp1) return 0;
- size_t __result_len = __adj_endp1 - __start;
-
- if (__result_len > __lazy_threshold) goto lazy;
- _CharT* __section = __base->_M_size.allocate(_S_rounded_up_size(__result_len));
- _STLP_TRY {
- (*(__f->_M_fn))(__start, __result_len, __section);
- }
- _STLP_UNWIND(_RopeRep::_S_free_string(__section,
- __result_len, __base->get_allocator()))
- _S_construct_null(__section + __result_len);
- return _S_new_RopeLeaf(__section, __result_len,
- __base->get_allocator());
- }
- }
- /*NOTREACHED*/
- _STLP_ASSERT(false)
- lazy:
- {
- // Create substring node.
- return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start,
- __base->get_allocator());
- }
-}
-
-template<class _CharT>
-class _Rope_flatten_char_consumer : public _Rope_char_consumer<_CharT> {
-private:
- _CharT* _M_buf_ptr;
-public:
- _Rope_flatten_char_consumer(_CharT* __buffer) {
- _M_buf_ptr = __buffer;
- }
- ~_Rope_flatten_char_consumer() {}
- bool operator() (const _CharT* __leaf, size_t __n) {
- _STLP_PRIV __ucopy_n(__leaf, __n, _M_buf_ptr);
- _M_buf_ptr += __n;
- return true;
- }
-};
-
-template<class _CharT>
-class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> {
-private:
- _CharT _M_pattern;
-public:
- size_t _M_count; // Number of nonmatching characters
- _Rope_find_char_char_consumer(_CharT __p)
- : _M_pattern(__p), _M_count(0) {}
- ~_Rope_find_char_char_consumer() {}
- bool operator() (const _CharT* __leaf, size_t __n) {
- size_t __i;
- for (__i = 0; __i < __n; ++__i) {
- if (__leaf[__i] == _M_pattern) {
- _M_count += __i; return false;
- }
- }
- _M_count += __n; return true;
- }
-};
-
-#if !defined (_STLP_USE_NO_IOSTREAMS)
-template<class _CharT, class _Traits>
-// Here _CharT is both the stream and rope character type.
-class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> {
-private:
- typedef basic_ostream<_CharT,_Traits> _Insert_ostream;
- typedef _Rope_insert_char_consumer<_CharT,_Traits> _Self;
- _Insert_ostream& _M_o;
-
- //explicitely defined as private to avoid warnings:
- _Self& operator = (_Self const&);
-public:
- _Rope_insert_char_consumer(_Insert_ostream& __writer)
- : _M_o(__writer) {}
-# if defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)) //*TY 05/23/2000 - added support for mpw compiler's trigger function approach to generate vtable
- ~_Rope_insert_char_consumer(); //*TY 05/23/2000 -
-# else //*TY 05/23/2000 -
- ~_Rope_insert_char_consumer() {}
-# endif //*TY 05/23/2000 -
- // Caller is presumed to own the ostream
- bool operator() (const _CharT* __leaf, size_t __n);
- // Returns true to continue traversal.
-};
-
-# if defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)) //*TY 05/23/2000 - added support for mpw compiler's trigger function approach to generate vtable
-template<class _CharT, class _Traits>
-_Rope_insert_char_consumer<_CharT, _Traits>:: ~_Rope_insert_char_consumer() {}
-# endif //*TY 05/23/2000 -
-
-template<class _CharT, class _Traits>
-bool _Rope_insert_char_consumer<_CharT, _Traits>::operator()
- (const _CharT* __leaf, size_t __n) {
- size_t __i;
- // We assume that formatting is set up correctly for each element.
- for (__i = 0; __i < __n; ++__i) _M_o.put(__leaf[__i]);
- return true;
-}
-#endif /* !_STLP_USE_NO_IOSTREAMS */
-
-template <class _CharT, class _Alloc, class _CharConsumer>
-bool _S_apply_to_pieces(_CharConsumer& __c,
- _Rope_RopeRep<_CharT, _Alloc> * __r,
- size_t __begin, size_t __end) {
- typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
- typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation;
- typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
- typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
-
- if (0 == __r) return true;
- switch(__r->_M_tag) {
- case _RopeRep::_S_concat:
- {
- _RopeConcatenation* __conc = __STATIC_CAST(_RopeConcatenation*, __r);
- _RopeRep* __left = __conc->_M_left;
- size_t __left_len = __left->_M_size._M_data;
- if (__begin < __left_len) {
- size_t __left_end = (min) (__left_len, __end);
- if (!_S_apply_to_pieces(__c, __left, __begin, __left_end))
- return false;
- }
- if (__end > __left_len) {
- _RopeRep* __right = __conc->_M_right;
- size_t __right_start = (max)(__left_len, __begin);
- if (!_S_apply_to_pieces(__c, __right,
- __right_start - __left_len,
- __end - __left_len)) {
- return false;
- }
- }
- }
- return true;
- case _RopeRep::_S_leaf:
- {
- _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r);
- return __c(__l->_M_data + __begin, __end - __begin);
- }
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- {
- _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r);
- size_t __len = __end - __begin;
- bool __result;
- _CharT* __buffer = __r->get_allocator().allocate(__len);
- _STLP_TRY {
- (*(__f->_M_fn))(__begin, __len, __buffer);
- __result = __c(__buffer, __len);
- __r->get_allocator().deallocate(__buffer, __len);
- }
- _STLP_UNWIND((__r->get_allocator().deallocate(__buffer, __len)))
- return __result;
- }
- default:
- _STLP_ASSERT(false)
- /*NOTREACHED*/
- return false;
- }
-}
-
-#if !defined (_STLP_USE_NO_IOSTREAMS)
-template<class _CharT, class _Traits>
-inline void _Rope_fill(basic_ostream<_CharT, _Traits>& __o, streamsize __n) {
- char __f = __o.fill();
- for (streamsize __i = 0; __i < __n; ++__i) __o.put(__f);
-}
-
-template<class _CharT, class _Traits, class _Alloc>
-basic_ostream<_CharT, _Traits>& _S_io_get(basic_ostream<_CharT, _Traits>& __o,
- const rope<_CharT, _Alloc>& __r, const __true_type& /*_IsBasicCharType*/) {
- streamsize __w = __o.width();
- const bool __left = (__o.flags() & ios::left) != 0;
- size_t __rope_len = __r.size();
- _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
-
- const bool __need_pad = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __rope_len) < __w)) ||
- ((sizeof(streamsize) <= sizeof(size_t)) && (__rope_len < __STATIC_CAST(size_t, __w))));
- streamsize __pad_len = __need_pad ? __w - __rope_len : 0;
-
- if (!__left && __pad_len > 0) {
- _Rope_fill(__o, __pad_len);
- }
- __r.apply_to_pieces(0, __rope_len, __c);
- if (__left && __pad_len > 0) {
- _Rope_fill(__o, __pad_len);
- }
- return __o;
-}
-
-template<class _CharT, class _Traits, class _Alloc>
-basic_ostream<_CharT, _Traits>& _S_io_get(basic_ostream<_CharT, _Traits>& __o,
- const rope<_CharT, _Alloc>& __r, const __false_type& /*_IsBasicCharType*/) {
- streamsize __w = __o.width();
- size_t __rope_len = __r.size();
- _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
-
- __o.width(__w /__rope_len);
- _STLP_TRY {
- __r.apply_to_pieces(0, __rope_len, __c);
- __o.width(__w);
- }
- _STLP_UNWIND(__o.width(__w))
- return __o;
-}
-
-template<class _CharT, class _Traits, class _Alloc>
-basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __o,
- const rope<_CharT, _Alloc>& __r) {
- typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral;
- return _S_io_get(__o, __r, _Char_Is_Integral());
-}
-#endif /* NO_IOSTREAMS */
-
-template <class _CharT, class _Alloc>
-_CharT* rope<_CharT,_Alloc>::_S_flatten(_RopeRep* __r,
- size_t __start, size_t __len,
- _CharT* __buffer) {
- _Rope_flatten_char_consumer<_CharT> __c(__buffer);
- _S_apply_to_pieces(__c, __r, __start, __start + __len);
- return(__buffer + __len);
-}
-
-template <class _CharT, class _Alloc>
-size_t rope<_CharT,_Alloc>::find(_CharT __pattern, size_t __start) const {
- _Rope_find_char_char_consumer<_CharT> __c(__pattern);
- _S_apply_to_pieces(__c, _M_tree_ptr._M_data, __start, size());
- size_type __result_pos = __start + __c._M_count;
-#ifndef _STLP_OLD_ROPE_SEMANTICS
- if (__result_pos == size()) __result_pos = npos;
-#endif
- return __result_pos;
-}
-
-template <class _CharT, class _Alloc>
-_CharT*
-rope<_CharT,_Alloc>::_S_flatten(_Rope_RopeRep<_CharT, _Alloc>* __r, _CharT* __buffer) {
- if (0 == __r) return __buffer;
- switch(__r->_M_tag) {
- case _RopeRep::_S_concat:
- {
- _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __r);
- _RopeRep* __left = __c->_M_left;
- _RopeRep* __right = __c->_M_right;
- _CharT* __rest = _S_flatten(__left, __buffer);
- return _S_flatten(__right, __rest);
- }
- case _RopeRep::_S_leaf:
- {
- _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r);
- return _STLP_PRIV __ucopy_n(__l->_M_data, __l->_M_size._M_data, __buffer).second;
- }
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- // We dont yet do anything with substring nodes.
- // This needs to be fixed before ropefiles will work well.
- {
- _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r);
- (*(__f->_M_fn))(0, __f->_M_size._M_data, __buffer);
- return __buffer + __f->_M_size._M_data;
- }
- default:
- _STLP_ASSERT(false)
- /*NOTREACHED*/
- return 0;
- }
-}
-
-#ifdef _STLP_DEBUG
-// This needs work for _CharT != char
-template <class _CharT, class _Alloc>
-void rope<_CharT,_Alloc>::_S_dump(_RopeRep* __r, int __indent) {
- for (int __i = 0; __i < __indent; ++__i) putchar(' ');
- if (0 == __r) {
- printf("NULL\n"); return;
- }
- if (_RopeRep::_S_concat == __r->_M_tag) {
- _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __r);
- _RopeRep* __left = __c->_M_left;
- _RopeRep* __right = __c->_M_right;
- printf("Concatenation %p (rc = %ld, depth = %d, len = %ld, %s balanced)\n",
- __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size._M_data,
- __r->_M_is_balanced? "" : "not");
- _S_dump(__left, __indent + 2);
- _S_dump(__right, __indent + 2);
- return;
- }
- else {
- const char* __kind;
-
- switch (__r->_M_tag) {
- case _RopeRep::_S_leaf:
- __kind = "Leaf";
- break;
- case _RopeRep::_S_function:
- __kind = "Function";
- break;
- case _RopeRep::_S_substringfn:
- __kind = "Function representing substring";
- break;
- default:
- __kind = "(corrupted kind field!)";
- }
- printf("%s %p (rc = %ld, depth = %d, len = %ld) ",
- __kind, __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size._M_data);
- if (sizeof(_CharT) == 1) {
- const int __max_len = 40;
- _Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len));
- _CharT __buffer[__max_len + 1];
- bool __too_big = __r->_M_size._M_data > __prefix->_M_size._M_data;
-
- _S_flatten(__prefix, __buffer);
- __buffer[__prefix->_M_size._M_data] = _STLP_DEFAULT_CONSTRUCTED(_CharT);
- printf("%s%s\n", (char*)__buffer, __too_big? "...\n" : "\n");
- } else {
- printf("\n");
- }
- }
-}
-#endif /* _STLP_DEBUG */
-
-# define __ROPE_TABLE_BODY = { \
-/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21, \
-/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377, \
-/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181, \
-/* 18 */6765ul, /* 19 */10946ul, /* 20 */17711ul, /* 21 */28657ul, /* 22 */46368ul, \
-/* 23 */75025ul, /* 24 */121393ul, /* 25 */196418ul, /* 26 */317811ul, \
-/* 27 */514229ul, /* 28 */832040ul, /* 29 */1346269ul, /* 30 */2178309ul, \
-/* 31 */3524578ul, /* 32 */5702887ul, /* 33 */9227465ul, /* 34 */14930352ul, \
-/* 35 */24157817ul, /* 36 */39088169ul, /* 37 */63245986ul, /* 38 */102334155ul, \
-/* 39 */165580141ul, /* 40 */267914296ul, /* 41 */433494437ul, \
-/* 42 */701408733ul, /* 43 */1134903170ul, /* 44 */1836311903ul, \
-/* 45 */2971215073ul }
-
-# if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
-template <class _CharT, class _Alloc>
-const unsigned long
-rope<_CharT,_Alloc>::_S_min_len[__ROPE_DEPTH_SIZE] __ROPE_TABLE_BODY;
-# else
-__DECLARE_INSTANCE(const unsigned long,
- crope::_S_min_len[__ROPE_DEPTH_SIZE],
- __ROPE_TABLE_BODY);
-# ifndef _STLP_NO_WCHAR_T
-__DECLARE_INSTANCE(const unsigned long,
- wrope::_S_min_len[__ROPE_DEPTH_SIZE],
- __ROPE_TABLE_BODY);
-# endif
-# endif
-# undef __ROPE_DEPTH_SIZE
-# undef __ROPE_MAX_DEPTH
-# undef __ROPE_TABLE_BODY
-
-// These are Fibonacci numbers < 2**32.
-
-template <class _CharT, class _Alloc>
-__RopeRep__* rope<_CharT,_Alloc>::_S_balance(_RopeRep* __r) {
- _RopeRep* __forest[_RopeRep::_S_max_rope_depth + 1] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0};
- _RopeRep* __result = 0;
- int __i;
- // Invariant:
- // The concatenation of forest in descending order is equal to __r.
- // __forest[__i]._M_size._M_data >= _S_min_len[__i]
- // __forest[__i]._M_depth = __i
- // References from forest are included in refcount.
-
- _STLP_TRY {
- _S_add_to_forest(__r, __forest);
- for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
- if (0 != __forest[__i]) {
- _Self_destruct_ptr __old(__result);
- __result = _S_concat_rep(__forest[__i], __result);
- __forest[__i]->_M_unref_nonnil();
-# ifdef _STLP_USE_EXCEPTIONS
- __forest[__i] = 0;
-# endif
- }
- }
- _STLP_UNWIND(for(__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
- _S_unref(__forest[__i]))
- if (__result->_M_depth > _RopeRep::_S_max_rope_depth) {
- __stl_throw_range_error("rope too long");
- }
- return(__result);
-}
-
-
-template <class _CharT, class _Alloc>
-void
-rope<_CharT,_Alloc>::_S_add_to_forest(_RopeRep* __r, _RopeRep** __forest)
-{
- if (__r -> _M_is_balanced) {
- _S_add_leaf_to_forest(__r, __forest);
- return;
- }
- _STLP_ASSERT(__r->_M_tag == _RopeRep::_S_concat)
- {
- _RopeConcatenation* __c = (_RopeConcatenation*)__r;
-
- _S_add_to_forest(__c->_M_left, __forest);
- _S_add_to_forest(__c->_M_right, __forest);
- }
-}
-
-
-template <class _CharT, class _Alloc>
-void
-rope<_CharT,_Alloc>::_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest)
-{
- _RopeRep* __insertee; // included in refcount
- _RopeRep* __too_tiny = 0; // included in refcount
- int __i; // forest[0..__i-1] is empty
- size_t __s = __r->_M_size._M_data;
-
- for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i) {
- if (0 != __forest[__i]) {
- _Self_destruct_ptr __old(__too_tiny);
- __too_tiny = _S_concat_and_set_balanced(__forest[__i], __too_tiny);
- __forest[__i]->_M_unref_nonnil();
- __forest[__i] = 0;
- }
- }
- {
- _Self_destruct_ptr __old(__too_tiny);
- __insertee = _S_concat_and_set_balanced(__too_tiny, __r);
- }
- // Too_tiny dead, and no longer included in refcount.
- // Insertee is live and included.
- _STLP_ASSERT(_S_is_almost_balanced(__insertee))
- _STLP_ASSERT(__insertee->_M_depth <= __r->_M_depth + 1)
- for (;; ++__i) {
- if (0 != __forest[__i]) {
- _Self_destruct_ptr __old(__insertee);
- __insertee = _S_concat_and_set_balanced(__forest[__i], __insertee);
- __forest[__i]->_M_unref_nonnil();
- __forest[__i] = 0;
- _STLP_ASSERT(_S_is_almost_balanced(__insertee))
- }
- _STLP_ASSERT(_S_min_len[__i] <= __insertee->_M_size._M_data)
- _STLP_ASSERT(__forest[__i] == 0)
- if (__i == _RopeRep::_S_max_rope_depth ||
- __insertee->_M_size._M_data < _S_min_len[__i+1]) {
- __forest[__i] = __insertee;
- // refcount is OK since __insertee is now dead.
- return;
- }
- }
-}
-
-template <class _CharT, class _Alloc>
-_CharT
-rope<_CharT,_Alloc>::_S_fetch(_RopeRep* __r, size_type __i)
-{
- _CharT* __cstr = __r->_M_c_string;
-
- _STLP_ASSERT(__i < __r->_M_size._M_data)
- if (0 != __cstr) return __cstr[__i];
- for(;;) {
- switch(__r->_M_tag) {
- case _RopeRep::_S_concat:
- {
- _RopeConcatenation* __c = (_RopeConcatenation*)__r;
- _RopeRep* __left = __c->_M_left;
- size_t __left_len = __left->_M_size._M_data;
-
- if (__i >= __left_len) {
- __i -= __left_len;
- __r = __c->_M_right;
- } else {
- __r = __left;
- }
- }
- break;
- case _RopeRep::_S_leaf:
- {
- _RopeLeaf* __l = (_RopeLeaf*)__r;
- return __l->_M_data[__i];
- }
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- {
- _RopeFunction* __f = (_RopeFunction*)__r;
- _CharT __result;
-
- (*(__f->_M_fn))(__i, 1, &__result);
- return __result;
- }
- }
- }
-#if defined(_STLP_NEED_UNREACHABLE_RETURN)
- return 0;
-#endif
-}
-
-// Return a uniquely referenced character slot for the given
-// position, or 0 if that's not possible.
-template <class _CharT, class _Alloc>
-_CharT*
-rope<_CharT,_Alloc>::_S_fetch_ptr(_RopeRep* __r, size_type __i)
-{
- _RopeRep* __clrstack[_RopeRep::_S_max_rope_depth];
- size_t __csptr = 0;
-
- for(;;) {
- // if (__r->_M_ref_count > 1) return 0;
- if ( __r->_M_incr() > 2 ) {
- __r->_M_decr();
- return 0;
- }
- switch(__r->_M_tag) {
- case _RopeRep::_S_concat:
- {
- _RopeConcatenation* __c = (_RopeConcatenation*)__r;
- _RopeRep* __left = __c->_M_left;
- size_t __left_len = __left->_M_size._M_data;
-
- if (__c->_M_c_string != 0) __clrstack[__csptr++] = __c;
- if (__i >= __left_len) {
- __i -= __left_len;
- __r = __c->_M_right;
- } else {
- __r = __left;
- }
- }
- break;
- case _RopeRep::_S_leaf:
- {
- _RopeLeaf* __l = (_RopeLeaf*)__r;
- if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0)
- __clrstack[__csptr++] = __l;
- while (__csptr > 0) {
- -- __csptr;
- _RopeRep* __d = __clrstack[__csptr];
- __d->_M_free_c_string();
- __d->_M_c_string = 0;
- }
- return __l->_M_data + __i;
- }
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- return 0;
- }
- }
-#if defined(_STLP_NEED_UNREACHABLE_RETURN)
- return 0;
-#endif
-
-}
-
-// The following could be implemented trivially using
-// lexicographical_compare_3way.
-// We do a little more work to avoid dealing with rope iterators for
-// flat strings.
-template <class _CharT, class _Alloc>
-int
-rope<_CharT,_Alloc>::_S_compare (const _RopeRep* __left,
- const _RopeRep* __right) {
- size_t __left_len;
- size_t __right_len;
-
- if (0 == __right) return 0 != __left;
- if (0 == __left) return -1;
- __left_len = __left->_M_size._M_data;
- __right_len = __right->_M_size._M_data;
- if (_RopeRep::_S_leaf == __left->_M_tag) {
- const _RopeLeaf* __l = __STATIC_CAST(const _RopeLeaf*, __left);
- if (_RopeRep::_S_leaf == __right->_M_tag) {
- const _RopeLeaf* __r = __STATIC_CAST(const _RopeLeaf*, __right);
- return _STLP_PRIV __lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len,
- __r->_M_data, __r->_M_data + __right_len);
- }
- else {
- const_iterator __rstart(__right, 0);
- const_iterator __rend(__right, __right_len);
- return _STLP_PRIV __lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len,
- __rstart, __rend);
- }
- }
- else {
- const_iterator __lstart(__left, 0);
- const_iterator __lend(__left, __left_len);
- if (_RopeRep::_S_leaf == __right->_M_tag) {
- const _RopeLeaf* __r = __STATIC_CAST(const _RopeLeaf*, __right);
- return _STLP_PRIV __lexicographical_compare_3way(__lstart, __lend,
- __r->_M_data, __r->_M_data + __right_len);
- }
- else {
- const_iterator __rstart(__right, 0);
- const_iterator __rend(__right, __right_len);
- return _STLP_PRIV __lexicographical_compare_3way(__lstart, __lend, __rstart, __rend);
- }
- }
-}
-
-// Assignment to reference proxies.
-template <class _CharT, class _Alloc>
-_Rope_char_ref_proxy<_CharT, _Alloc>&
-_Rope_char_ref_proxy<_CharT, _Alloc>::operator= (_CharT __c) {
- _RopeRep* __old = _M_root->_M_tree_ptr._M_data;
- // First check for the case in which everything is uniquely
- // referenced. In that case we can do this destructively.
- _CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos);
- if (0 != __ptr) {
- *__ptr = __c;
- return *this;
- }
- _Self_destruct_ptr __left(
- _My_rope::_S_substring(__old, 0, _M_pos));
- _Self_destruct_ptr __right(
- _My_rope::_S_substring(__old, _M_pos+1, __old->_M_size._M_data));
- _Self_destruct_ptr __result_left(
- _My_rope::_S_destr_concat_char_iter(__left, &__c, 1));
-
- // _STLP_ASSERT(__left == __result_left || 1 == __result_left->_M_ref_count)
- _RopeRep* __result =
- _My_rope::_S_concat_rep(__result_left, __right);
- // _STLP_ASSERT(1 <= __result->_M_ref_count)
- _RopeRep::_S_unref(__old);
- _M_root->_M_tree_ptr._M_data = __result;
- return *this;
-}
-
-template <class _CharT, class _Alloc>
-_Rope_char_ptr_proxy<_CharT, _Alloc>
-_Rope_char_ref_proxy<_CharT, _Alloc>::operator& () const {
- return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this);
-}
-
-# if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
-template<class _CharT, class _Alloc>
-_CharT rope<_CharT,_Alloc>::_S_empty_c_str[1] = { _CharT() };
-# else
-__DECLARE_INSTANCE(char, crope::_S_empty_c_str[1], ={0});
-# ifdef _STLP_HAS_WCHAR_T
-__DECLARE_INSTANCE(wchar_t, wrope::_S_empty_c_str[1], ={0});
-# endif /* _STLP_HAS_WCHAR_T */
-# endif /* _STLP_STATIC_TEMPLATE_DATA */
-// # endif
-
-#if !defined (_STLP_STATIC_CONST_INIT_BUG)
-# if !defined (__GNUC__) || (__GNUC__ != 2) || (__GNUC_MINOR__ != 96)
-template <class _CharT, class _Alloc>
-const size_t rope<_CharT, _Alloc>::npos;
-# endif
-#endif
-
-template<class _CharT, class _Alloc>
-const _CharT* rope<_CharT,_Alloc>::c_str() const {
- if (0 == _M_tree_ptr._M_data) {
- // Possibly redundant, but probably fast.
- _S_empty_c_str[0] = _STLP_DEFAULT_CONSTRUCTED(_CharT);
- return _S_empty_c_str;
- }
- _CharT* __old_c_string = _M_tree_ptr._M_data->_M_c_string;
- if (0 != __old_c_string) return __old_c_string;
- size_t __s = size();
- _CharT* __result = _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_tree_ptr, _CharT).allocate(__s + 1);
- _S_flatten(_M_tree_ptr._M_data, __result);
- _S_construct_null(__result + __s);
- __old_c_string = __STATIC_CAST(_CharT*, _Atomic_swap_ptr(__REINTERPRET_CAST(void* _STLP_VOLATILE*, &(_M_tree_ptr._M_data->_M_c_string)),
- __result));
- if (0 != __old_c_string) {
- // It must have been added in the interim. Hence it had to have been
- // separately allocated. Deallocate the old copy, since we just
- // replaced it.
- _STLP_STD::_Destroy_Range(__old_c_string, __old_c_string + __s + 1);
- _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_tree_ptr, _CharT).deallocate(__old_c_string, __s + 1);
- }
- return __result;
-}
-
-template<class _CharT, class _Alloc>
-const _CharT* rope<_CharT,_Alloc>::replace_with_c_str() {
- if (0 == _M_tree_ptr._M_data) {
- _S_empty_c_str[0] = _STLP_DEFAULT_CONSTRUCTED(_CharT);
- return _S_empty_c_str;
- }
- _CharT* __old_c_string = _M_tree_ptr._M_data->_M_c_string;
- if (_RopeRep::_S_leaf == _M_tree_ptr._M_data->_M_tag && 0 != __old_c_string) {
- return __old_c_string;
- }
- size_t __s = size();
- _CharT* __result = _M_tree_ptr.allocate(_S_rounded_up_size(__s));
- _S_flatten(_M_tree_ptr._M_data, __result);
- _S_construct_null(__result + __s);
- _M_tree_ptr._M_data->_M_unref_nonnil();
- _M_tree_ptr._M_data = _S_new_RopeLeaf(__result, __s, _M_tree_ptr);
- return __result;
-}
-
-// Algorithm specializations. More should be added.
-
-#if (!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310)) && \
- (!defined (__DMC__) || defined (__PUT_STATIC_DATA_MEMBERS_HERE))
-// I couldn't get this to work with VC++
-template<class _CharT,class _Alloc>
-void _Rope_rotate(_Rope_iterator<_CharT,_Alloc> __first,
- _Rope_iterator<_CharT,_Alloc> __middle,
- _Rope_iterator<_CharT,_Alloc> __last) {
- _STLP_ASSERT(__first.container() == __middle.container() &&
- __middle.container() == __last.container())
- rope<_CharT,_Alloc>& __r(__first.container());
- rope<_CharT,_Alloc> __prefix = __r.substr(0, __first.index());
- rope<_CharT,_Alloc> __suffix =
- __r.substr(__last.index(), __r.size() - __last.index());
- rope<_CharT,_Alloc> __part1 =
- __r.substr(__middle.index(), __last.index() - __middle.index());
- rope<_CharT,_Alloc> __part2 =
- __r.substr(__first.index(), __middle.index() - __first.index());
- __r = __prefix;
- __r += __part1;
- __r += __part2;
- __r += __suffix;
-}
-
-
-# if 0
-// Probably not useful for several reasons:
-// - for SGIs 7.1 compiler and probably some others,
-// this forces lots of rope<wchar_t, ...> instantiations, creating a
-// code bloat and compile time problem. (Fixed in 7.2.)
-// - wchar_t is 4 bytes wide on most UNIX platforms, making it unattractive
-// for unicode strings. Unsigned short may be a better character
-// type.
-inline void rotate(
- _Rope_iterator<wchar_t,_STLP_DEFAULT_ALLOCATOR(char) > __first,
- _Rope_iterator<wchar_t,_STLP_DEFAULT_ALLOCATOR(char) > __middle,
- _Rope_iterator<wchar_t,_STLP_DEFAULT_ALLOCATOR(char) > __last) {
- _Rope_rotate(__first, __middle, __last);
-}
-# endif
-#endif /* _STLP_MSVC */
-
-# undef __RopeLeaf__
-# undef __RopeRep__
-# undef __RopeLeaf
-# undef __RopeRep
-# undef size_type
-
-_STLP_END_NAMESPACE
-
-# endif /* ROPEIMPL_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_rope.h b/stl/_rope.h
deleted file mode 100644
index 82fc84e..0000000
--- a/stl/_rope.h
+++ /dev/null
@@ -1,2374 +0,0 @@
-/*
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-// rope<_CharT,_Alloc> is a sequence of _CharT.
-// Ropes appear to be mutable, but update operations
-// really copy enough of the data structure to leave the original
-// valid. Thus ropes can be logically copied by just copying
-// a pointer value.
-
-#ifndef _STLP_INTERNAL_ROPE_H
-#define _STLP_INTERNAL_ROPE_H
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-#ifndef _STLP_IOSFWD
-# include <iosfwd>
-#endif
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-# include <stl/_alloc.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ITERATOR_H
-# include <stl/_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALGO_H
-# include <stl/_algo.h>
-#endif
-
-#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
-# include <stl/_function_base.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NUMERIC_H
-# include <stl/_numeric.h>
-#endif
-
-#ifndef _STLP_INTERNAL_HASH_FUN_H
-# include <stl/_hash_fun.h>
-#endif
-
-#ifndef _STLP_CHAR_TRAITS_H
-# include <stl/char_traits.h>
-#endif
-
-#ifndef _STLP_INTERNAL_THREADS_H
-# include <stl/_threads.h>
-#endif
-
-#ifdef _STLP_SGI_THREADS
-# include <mutex.h>
-#endif
-
-#ifndef _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE
-# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) (_Alloc_traits<_Tp,__atype>::create_allocator(__a))
-#elif defined(__MRC__)||defined(__SC__)
-# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) __stl_alloc_create<_Tp,__atype>(__a,(_Tp*)0)
-#else
-# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-// First a lot of forward declarations. The standard seems to require
-// much stricter "declaration before use" than many of the implementations
-// that preceded it.
-template<class _CharT, _STLP_DEFAULT_ALLOCATOR_SELECT(_CharT) > class rope;
-template<class _CharT, class _Alloc> struct _Rope_RopeConcatenation;
-template<class _CharT, class _Alloc> struct _Rope_RopeRep;
-template<class _CharT, class _Alloc> struct _Rope_RopeLeaf;
-template<class _CharT, class _Alloc> struct _Rope_RopeFunction;
-template<class _CharT, class _Alloc> struct _Rope_RopeSubstring;
-template<class _CharT, class _Alloc> class _Rope_iterator;
-template<class _CharT, class _Alloc> class _Rope_const_iterator;
-template<class _CharT, class _Alloc> class _Rope_char_ref_proxy;
-template<class _CharT, class _Alloc> class _Rope_char_ptr_proxy;
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// Some helpers, so we can use the power algorithm on ropes.
-// See below for why this isn't local to the implementation.
-
-// This uses a nonstandard refcount convention.
-// The result has refcount 0.
-template<class _CharT, class _Alloc>
-struct _Rope_Concat_fn
- : public binary_function<rope<_CharT,_Alloc>, rope<_CharT,_Alloc>,
- rope<_CharT,_Alloc> > {
- rope<_CharT,_Alloc> operator() (const rope<_CharT,_Alloc>& __x,
- const rope<_CharT,_Alloc>& __y) {
- return __x + __y;
- }
-};
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>
-__identity_element(_Rope_Concat_fn<_CharT, _Alloc>)
-{ return rope<_CharT,_Alloc>(); }
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-// Store an eos
-template <class _CharT>
-inline void _S_construct_null_aux(_CharT *__p, const __true_type&)
-{ *__p = 0; }
-
-template <class _CharT>
-inline void _S_construct_null_aux(_CharT *__p, const __false_type&)
-{ _STLP_STD::_Construct(__p); }
-
-template <class _CharT>
-inline void _S_construct_null(_CharT *__p) {
- typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral;
- _S_construct_null_aux(__p, _Char_Is_Integral());
-}
-
-// char_producers are logically functions that generate a section of
-// a string. These can be converted to ropes. The resulting rope
-// invokes the char_producer on demand. This allows, for example,
-// files to be viewed as ropes without reading the entire file.
-template <class _CharT>
-class char_producer {
-public:
- virtual ~char_producer() {}
- virtual void operator()(size_t __start_pos, size_t __len,
- _CharT* __buffer) = 0;
- // Buffer should really be an arbitrary output iterator.
- // That way we could flatten directly into an ostream, etc.
- // This is thoroughly impossible, since iterator types don't
- // have runtime descriptions.
-};
-
-// Sequence buffers:
-//
-// Sequence must provide an append operation that appends an
-// array to the sequence. Sequence buffers are useful only if
-// appending an entire array is cheaper than appending element by element.
-// This is true for many string representations.
-// This should perhaps inherit from ostream<sequence::value_type>
-// and be implemented correspondingly, so that they can be used
-// for formatted. For the sake of portability, we don't do this yet.
-//
-// For now, sequence buffers behave as output iterators. But they also
-// behave a little like basic_ostringstream<sequence::value_type> and a
-// little like containers.
-
-template<class _Sequence
-# if !(defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) || \
- defined ( _STLP_NO_DEFAULT_NON_TYPE_PARAM ))
- , size_t _Buf_sz = 100
-# if defined(__sgi) && !defined(__GNUC__)
-# define __TYPEDEF_WORKAROUND
- ,class _V = typename _Sequence::value_type
-# endif /* __sgi */
-# endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
- >
-// The 3rd parameter works around a common compiler bug.
-class sequence_buffer : public iterator <output_iterator_tag, void, void, void, void> {
-public:
-# ifndef __TYPEDEF_WORKAROUND
- typedef typename _Sequence::value_type value_type;
- typedef sequence_buffer<_Sequence
-# if !(defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) || \
- defined ( _STLP_NO_DEFAULT_NON_TYPE_PARAM ))
- , _Buf_sz
- > _Self;
-# else /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
- > _Self;
- enum { _Buf_sz = 100};
-# endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
- // # endif
-# else /* __TYPEDEF_WORKAROUND */
- typedef _V value_type;
- typedef sequence_buffer<_Sequence, _Buf_sz, _V> _Self;
-# endif /* __TYPEDEF_WORKAROUND */
-protected:
- _Sequence* _M_prefix;
- value_type _M_buffer[_Buf_sz];
- size_t _M_buf_count;
-public:
- void flush() {
- _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count);
- _M_buf_count = 0;
- }
- ~sequence_buffer() { flush(); }
- sequence_buffer() : _M_prefix(0), _M_buf_count(0) {}
- sequence_buffer(const _Self& __x) {
- _M_prefix = __x._M_prefix;
- _M_buf_count = __x._M_buf_count;
- copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
- }
- sequence_buffer(_Self& __x) {
- __x.flush();
- _M_prefix = __x._M_prefix;
- _M_buf_count = 0;
- }
- sequence_buffer(_Sequence& __s) : _M_prefix(&__s), _M_buf_count(0) {}
- _Self& operator= (_Self& __x) {
- __x.flush();
- _M_prefix = __x._M_prefix;
- _M_buf_count = 0;
- return *this;
- }
- _Self& operator= (const _Self& __x) {
- _M_prefix = __x._M_prefix;
- _M_buf_count = __x._M_buf_count;
- copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
- return *this;
- }
- void push_back(value_type __x) {
- if (_M_buf_count < _Buf_sz) {
- _M_buffer[_M_buf_count] = __x;
- ++_M_buf_count;
- } else {
- flush();
- _M_buffer[0] = __x;
- _M_buf_count = 1;
- }
- }
- void append(const value_type *__s, size_t __len) {
- if (__len + _M_buf_count <= _Buf_sz) {
- size_t __i = _M_buf_count;
- size_t __j = 0;
- for (; __j < __len; __i++, __j++) {
- _M_buffer[__i] = __s[__j];
- }
- _M_buf_count += __len;
- } else if (0 == _M_buf_count) {
- _M_prefix->append(__s, __s + __len);
- } else {
- flush();
- append(__s, __len);
- }
- }
- _Self& write(const value_type *__s, size_t __len) {
- append(__s, __len);
- return *this;
- }
- _Self& put(value_type __x) {
- push_back(__x);
- return *this;
- }
- _Self& operator=(const value_type& __rhs) {
- push_back(__rhs);
- return *this;
- }
- _Self& operator*() { return *this; }
- _Self& operator++() { return *this; }
- _Self& operator++(int) { return *this; }
-};
-
-// The following should be treated as private, at least for now.
-template<class _CharT>
-class _Rope_char_consumer {
-#if !defined (_STLP_MEMBER_TEMPLATES)
-public:
- //Without member templates we have to use run-time parameterization.
- // The symmetry with char_producer is accidental and temporary.
- virtual ~_Rope_char_consumer() {}
- virtual bool operator()(const _CharT* __buffer, size_t __len) = 0;
-#endif
-};
-
-//
-// What follows should really be local to rope. Unfortunately,
-// that doesn't work, since it makes it impossible to define generic
-// equality on rope iterators. According to the draft standard, the
-// template parameters for such an equality operator cannot be inferred
-// from the occurence of a member class as a parameter.
-// (SGI compilers in fact allow this, but the __result wouldn't be
-// portable.)
-// Similarly, some of the static member functions are member functions
-// only to avoid polluting the global namespace, and to circumvent
-// restrictions on type inference for template functions.
-//
-
-//
-// The internal data structure for representing a rope. This is
-// private to the implementation. A rope is really just a pointer
-// to one of these.
-//
-// A few basic functions for manipulating this data structure
-// are members of _RopeRep. Most of the more complex algorithms
-// are implemented as rope members.
-//
-// Some of the static member functions of _RopeRep have identically
-// named functions in rope that simply invoke the _RopeRep versions.
-//
-
-template<class _CharT, class _Alloc>
-struct _Rope_RopeRep
- : public _Refcount_Base
-{
- typedef _Rope_RopeRep<_CharT, _Alloc> _Self;
-public:
- //
- // GAB: 11/09/05
- //
- // "__ROPE_DEPTH_SIZE" is set to one more then the "__ROPE_MAX_DEPTH".
- // This was originally just an addition of "__ROPE_MAX_DEPTH + 1"
- // but this addition causes the sunpro compiler to complain about
- // multiple declarations during the initialization of "_S_min_len".
- // Changed to be a fixed value and the sunpro compiler appears to
- // be happy???
- //
-# define __ROPE_MAX_DEPTH 45
-# define __ROPE_DEPTH_SIZE 46 // __ROPE_MAX_DEPTH + 1
- enum { _S_max_rope_depth = __ROPE_MAX_DEPTH };
- enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
- // Apparently needed by VC++
- // The data fields of leaves are allocated with some
- // extra space, to accomodate future growth and for basic
- // character types, to hold a trailing eos character.
- enum { _S_alloc_granularity = 8 };
-
- _Tag _M_tag:8;
- bool _M_is_balanced:8;
-
- _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
- typedef typename _Alloc_traits<_CharT,_Alloc>::allocator_type allocator_type;
-
- allocator_type get_allocator() const { return allocator_type(_M_size); }
-
- unsigned char _M_depth;
- _CharT* _STLP_VOLATILE _M_c_string;
- _STLP_PRIV _STLP_alloc_proxy<size_t, _CharT, allocator_type> _M_size;
-
-# ifdef _STLP_NO_ARROW_OPERATOR
- _Rope_RopeRep() : _Refcount_Base(1), _M_size(allocator_type(), 0) {}
-# endif
-
- /* Flattened version of string, if needed. */
- /* typically 0. */
- /* If it's not 0, then the memory is owned */
- /* by this node. */
- /* In the case of a leaf, this may point to */
- /* the same memory as the data field. */
- _Rope_RopeRep(_Tag __t, unsigned char __d, bool __b, size_t _p_size,
- allocator_type __a) :
- _Refcount_Base(1),
- _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0), _M_size(__a, _p_size)
- { }
-
- typedef typename _AreSameUnCVTypes<_CharT, char>::_Ret _IsChar;
-# ifdef _STLP_HAS_WCHAR_T
- typedef typename _AreSameUnCVTypes<_CharT, wchar_t>::_Ret _IsWCharT;
-# else
- typedef __false_type _IsWCharT;
-# endif
-
- typedef typename _Lor2<_IsChar, _IsWCharT>::_Ret _IsBasicCharType;
-
-#if 0
- /* Please tell why this code is necessary if you uncomment it.
- * Problem with it is that rope implementation expect that _S_rounded_up_size(n)
- * returns a size > n in order to store the terminating null charater. When
- * instanciation type is not a char or wchar_t this is not guaranty resulting in
- * memory overrun.
- */
- static size_t _S_rounded_up_size_aux(size_t __n, __true_type const& /*_IsBasicCharType*/) {
- // Allow slop for in-place expansion.
- return (__n + _S_alloc_granularity) & ~(_S_alloc_granularity - 1);
- }
-
- static size_t _S_rounded_up_size_aux(size_t __n, __false_type const& /*_IsBasicCharType*/) {
- // Allow slop for in-place expansion.
- return (__n + _S_alloc_granularity - 1) & ~(_S_alloc_granularity - 1);
- }
-#endif
- // fbp : moved from RopeLeaf
- static size_t _S_rounded_up_size(size_t __n)
- //{ return _S_rounded_up_size_aux(__n, _IsBasicCharType()); }
- { return (__n + _S_alloc_granularity) & ~(_S_alloc_granularity - 1); }
-
- static void _S_free_string( _CharT* __s, size_t __len,
- allocator_type __a) {
- _STLP_STD::_Destroy_Range(__s, __s + __len);
- // This has to be a static member, so this gets a bit messy
-# ifndef _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE
- __a.deallocate(__s, _S_rounded_up_size(__len)); //*ty 03/24/2001 - restored not to use __stl_alloc_rebind() since it is not defined under _STLP_MEMBER_TEMPLATE_CLASSES
-# else
- __stl_alloc_rebind (__a, (_CharT*)0).deallocate(__s, _S_rounded_up_size(__len));
-# endif
- }
-
- // Deallocate data section of a leaf.
- // This shouldn't be a member function.
- // But its hard to do anything else at the
- // moment, because it's templatized w.r.t.
- // an allocator.
- // Does nothing if __GC is defined.
- void _M_free_c_string();
- void _M_free_tree();
- // Deallocate t. Assumes t is not 0.
- void _M_unref_nonnil() {
- if (_M_decr() == 0) _M_free_tree();
- }
- void _M_ref_nonnil() {
- _M_incr();
- }
- static void _S_unref(_Self* __t) {
- if (0 != __t) {
- __t->_M_unref_nonnil();
- }
- }
- static void _S_ref(_Self* __t) {
- if (0 != __t) __t->_M_incr();
- }
- //static void _S_free_if_unref(_Self* __t) {
- // if (0 != __t && 0 == __t->_M_ref_count) __t->_M_free_tree();
- //}
-};
-
-template<class _CharT, class _Alloc>
-struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> {
-public:
- _CharT* _M_data; /* Not necessarily 0 terminated. */
- /* The allocated size is */
- /* _S_rounded_up_size(size), except */
- /* in the GC case, in which it */
- /* doesn't matter. */
-private:
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
- typedef typename _RopeRep::_IsBasicCharType _IsBasicCharType;
- void _M_init(__true_type const& /*_IsBasicCharType*/) {
- this->_M_c_string = _M_data;
- }
- void _M_init(__false_type const& /*_IsBasicCharType*/) {}
-
-public:
- _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
- typedef typename _RopeRep::allocator_type allocator_type;
-
- _Rope_RopeLeaf( _CharT* __d, size_t _p_size, allocator_type __a)
- : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_leaf, 0, true, _p_size, __a),
- _M_data(__d) {
- _STLP_ASSERT(_p_size > 0)
- _M_init(_IsBasicCharType());
- }
-
-# ifdef _STLP_NO_ARROW_OPERATOR
- _Rope_RopeLeaf() {}
- _Rope_RopeLeaf(const _Rope_RopeLeaf<_CharT, _Alloc>& ) {}
-# endif
-
-// The constructor assumes that d has been allocated with
- // the proper allocator and the properly padded size.
- // In contrast, the destructor deallocates the data:
- ~_Rope_RopeLeaf() {
- if (_M_data != this->_M_c_string) {
- this->_M_free_c_string();
- }
- _RopeRep::_S_free_string(_M_data, this->_M_size._M_data, this->get_allocator());
- }
-};
-
-template<class _CharT, class _Alloc>
-struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT, _Alloc> {
-private:
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
-
-public:
- _RopeRep* _M_left;
- _RopeRep* _M_right;
- _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
- typedef typename _RopeRep::allocator_type allocator_type;
- _Rope_RopeConcatenation(_RopeRep* __l, _RopeRep* __r, allocator_type __a)
- : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_concat,
- (max)(__l->_M_depth, __r->_M_depth) + 1, false,
- __l->_M_size._M_data + __r->_M_size._M_data, __a), _M_left(__l), _M_right(__r)
- {}
-# ifdef _STLP_NO_ARROW_OPERATOR
- _Rope_RopeConcatenation() {}
- _Rope_RopeConcatenation(const _Rope_RopeConcatenation<_CharT, _Alloc>&) {}
-# endif
-
- ~_Rope_RopeConcatenation() {
- this->_M_free_c_string();
- _M_left->_M_unref_nonnil();
- _M_right->_M_unref_nonnil();
- }
-};
-
-template <class _CharT, class _Alloc>
-struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT, _Alloc> {
-private:
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
-public:
- char_producer<_CharT>* _M_fn;
- /*
- * Char_producer is owned by the
- * rope and should be explicitly
- * deleted when the rope becomes
- * inaccessible.
- */
- bool _M_delete_when_done;
- _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
- typedef typename _Rope_RopeRep<_CharT,_Alloc>::allocator_type allocator_type;
-# ifdef _STLP_NO_ARROW_OPERATOR
- _Rope_RopeFunction() {}
- _Rope_RopeFunction(const _Rope_RopeFunction<_CharT, _Alloc>& ) {}
-# endif
-
- _Rope_RopeFunction(char_producer<_CharT>* __f, size_t _p_size,
- bool __d, allocator_type __a)
- : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_function, 0, true, _p_size, __a), _M_fn(__f)
- , _M_delete_when_done(__d)
- { _STLP_ASSERT(_p_size > 0) }
-
- ~_Rope_RopeFunction() {
- this->_M_free_c_string();
- if (_M_delete_when_done) {
- delete _M_fn;
- }
- }
-};
-
-/*
- * Substring results are usually represented using just
- * concatenation nodes. But in the case of very long flat ropes
- * or ropes with a functional representation that isn't practical.
- * In that case, we represent the __result as a special case of
- * RopeFunction, whose char_producer points back to the rope itself.
- * In all cases except repeated substring operations and
- * deallocation, we treat the __result as a RopeFunction.
- */
-template<class _CharT, class _Alloc>
-struct _Rope_RopeSubstring : public char_producer<_CharT>, public _Rope_RopeFunction<_CharT,_Alloc> {
-public:
- // XXX this whole class should be rewritten.
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
- _RopeRep *_M_base; // not 0
- size_t _M_start;
- /* virtual */ void operator()(size_t __start_pos, size_t __req_len,
- _CharT* __buffer) {
- typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
- typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
- switch (_M_base->_M_tag) {
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- {
- char_producer<_CharT>* __fn =
- __STATIC_CAST(_RopeFunction*, _M_base)->_M_fn;
- _STLP_ASSERT(__start_pos + __req_len <= this->_M_size._M_data)
- _STLP_ASSERT(_M_start + this->_M_size._M_data <= _M_base->_M_size._M_data)
- (*__fn)(__start_pos + _M_start, __req_len, __buffer);
- }
- break;
- case _RopeRep::_S_leaf:
- {
- _CharT* __s =
- __STATIC_CAST(_RopeLeaf*, _M_base)->_M_data;
- _STLP_PRIV __ucopy_n(__s + __start_pos + _M_start, __req_len, __buffer);
- }
- break;
- default:
- _STLP_ASSERT(false)
- ;
- }
- }
-
- _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
- typedef typename _RopeRep::allocator_type allocator_type;
-
- _Rope_RopeSubstring(_RopeRep* __b, size_t __s, size_t __l, allocator_type __a)
- : _Rope_RopeFunction<_CharT,_Alloc>(this, __l, false, __a),
- _M_base(__b), _M_start(__s) {
- _STLP_ASSERT(__l > 0)
- _STLP_ASSERT(__s + __l <= __b->_M_size._M_data)
- _M_base->_M_ref_nonnil();
- this->_M_tag = _RopeRep::_S_substringfn;
- }
- virtual ~_Rope_RopeSubstring()
- { _M_base->_M_unref_nonnil(); }
-};
-
-/*
- * Self-destructing pointers to Rope_rep.
- * These are not conventional smart pointers. Their
- * only purpose in life is to ensure that unref is called
- * on the pointer either at normal exit or if an exception
- * is raised. It is the caller's responsibility to
- * adjust reference counts when these pointers are initialized
- * or assigned to. (This convention significantly reduces
- * the number of potentially expensive reference count
- * updates.)
- */
-template<class _CharT, class _Alloc>
-struct _Rope_self_destruct_ptr {
- _Rope_RopeRep<_CharT,_Alloc>* _M_ptr;
- ~_Rope_self_destruct_ptr()
- { _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); }
-# ifdef _STLP_USE_EXCEPTIONS
- _Rope_self_destruct_ptr() : _M_ptr(0) {}
-# else
- _Rope_self_destruct_ptr() {}
-# endif
- _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT,_Alloc>* __p) : _M_ptr(__p) {}
- _Rope_RopeRep<_CharT,_Alloc>& operator*() { return *_M_ptr; }
- _Rope_RopeRep<_CharT,_Alloc>* operator->() { return _M_ptr; }
- operator _Rope_RopeRep<_CharT,_Alloc>*() { return _M_ptr; }
- _Rope_self_destruct_ptr<_CharT, _Alloc>&
- operator= (_Rope_RopeRep<_CharT,_Alloc>* __x)
- { _M_ptr = __x; return *this; }
-};
-
-/*
- * Dereferencing a nonconst iterator has to return something
- * that behaves almost like a reference. It's not possible to
- * return an actual reference since assignment requires extra
- * work. And we would get into the same problems as with the
- * CD2 version of basic_string.
- */
-template<class _CharT, class _Alloc>
-class _Rope_char_ref_proxy {
- typedef _Rope_char_ref_proxy<_CharT, _Alloc> _Self;
- friend class rope<_CharT,_Alloc>;
- friend class _Rope_iterator<_CharT,_Alloc>;
- friend class _Rope_char_ptr_proxy<_CharT,_Alloc>;
- typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr;
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
- typedef rope<_CharT,_Alloc> _My_rope;
- size_t _M_pos;
- _CharT _M_current;
- bool _M_current_valid;
- _My_rope* _M_root; // The whole rope.
-public:
- _Rope_char_ref_proxy(_My_rope* __r, size_t __p) :
- _M_pos(__p), _M_current_valid(false), _M_root(__r) {}
- _Rope_char_ref_proxy(const _Self& __x) :
- _M_pos(__x._M_pos), _M_current_valid(false), _M_root(__x._M_root) {}
- // Don't preserve cache if the reference can outlive the
- // expression. We claim that's not possible without calling
- // a copy constructor or generating reference to a proxy
- // reference. We declare the latter to have undefined semantics.
- _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c)
- : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {}
- inline operator _CharT () const;
- _Self& operator= (_CharT __c);
- _Rope_char_ptr_proxy<_CharT, _Alloc> operator& () const;
- _Self& operator= (const _Self& __c) {
- return operator=((_CharT)__c);
- }
-};
-
-#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
-template<class _CharT, class __Alloc>
-inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a,
- _Rope_char_ref_proxy <_CharT, __Alloc > __b) {
- _CharT __tmp = __a;
- __a = __b;
- __b = __tmp;
-}
-#else
-// There is no really acceptable way to handle this. The default
-// definition of swap doesn't work for proxy references.
-// It can't really be made to work, even with ugly hacks, since
-// the only unusual operation it uses is the copy constructor, which
-// is needed for other purposes. We provide a macro for
-// full specializations, and instantiate the most common case.
-# define _ROPE_SWAP_SPECIALIZATION(_CharT, __Alloc) \
- inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, \
- _Rope_char_ref_proxy <_CharT, __Alloc > __b) { \
- _CharT __tmp = __a; \
- __a = __b; \
- __b = __tmp; \
- }
-
-_ROPE_SWAP_SPECIALIZATION(char,_STLP_DEFAULT_ALLOCATOR(char) )
-
-# ifndef _STLP_NO_WCHAR_T
-_ROPE_SWAP_SPECIALIZATION(wchar_t,_STLP_DEFAULT_ALLOCATOR(wchar_t) )
-# endif
-
-#endif /* !_STLP_FUNCTION_TMPL_PARTIAL_ORDER */
-
-template<class _CharT, class _Alloc>
-class _Rope_char_ptr_proxy {
- // XXX this class should be rewritten.
-public:
- typedef _Rope_char_ptr_proxy<_CharT, _Alloc> _Self;
- friend class _Rope_char_ref_proxy<_CharT,_Alloc>;
- size_t _M_pos;
- rope<_CharT,_Alloc>* _M_root; // The whole rope.
-
- _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)
- : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
- _Rope_char_ptr_proxy(const _Self& __x)
- : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
- _Rope_char_ptr_proxy() {}
- _Rope_char_ptr_proxy(_CharT* __x) : _M_pos(0), _M_root(0) {
- _STLP_ASSERT(0 == __x)
- }
- _Self& operator= (const _Self& __x) {
- _M_pos = __x._M_pos;
- _M_root = __x._M_root;
- return *this;
- }
-
- _Rope_char_ref_proxy<_CharT,_Alloc> operator*() const {
- return _Rope_char_ref_proxy<_CharT,_Alloc>(_M_root, _M_pos);
- }
-};
-
-
-/*
- * Rope iterators:
- * Unlike in the C version, we cache only part of the stack
- * for rope iterators, since they must be efficiently copyable.
- * When we run out of cache, we have to reconstruct the iterator
- * value.
- * Pointers from iterators are not included in reference counts.
- * Iterators are assumed to be thread private. Ropes can
- * be shared.
- */
-template<class _CharT, class _Alloc>
-class _Rope_iterator_base
-/* : public random_access_iterator<_CharT, ptrdiff_t> */
-{
- friend class rope<_CharT,_Alloc>;
- typedef _Rope_iterator_base<_CharT, _Alloc> _Self;
- typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcat;
-public:
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
-
- enum { _S_path_cache_len = 4 }; // Must be <= 9 because of _M_path_direction.
- enum { _S_iterator_buf_len = 15 };
- size_t _M_current_pos;
- // The whole rope.
- _RopeRep* _M_root;
- // Starting position for current leaf
- size_t _M_leaf_pos;
- // Buffer possibly containing current char.
- _CharT* _M_buf_start;
- // Pointer to current char in buffer, != 0 ==> buffer valid.
- _CharT* _M_buf_ptr;
- // One past __last valid char in buffer.
- _CharT* _M_buf_end;
-
- // What follows is the path cache. We go out of our
- // way to make this compact.
- // Path_end contains the bottom section of the path from
- // the root to the current leaf.
- struct {
-# if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
- _RopeRep const*_M_data[4];
-# else
- _RopeRep const*_M_data[_S_path_cache_len];
-# endif
- } _M_path_end;
- // Last valid __pos in path_end;
- // _M_path_end[0] ... _M_path_end[_M_leaf_index-1]
- // point to concatenation nodes.
- int _M_leaf_index;
- // (_M_path_directions >> __i) & 1 is 1
- // if we got from _M_path_end[leaf_index - __i - 1]
- // to _M_path_end[leaf_index - __i] by going to the
- // __right. Assumes path_cache_len <= 9.
- unsigned char _M_path_directions;
- // Short buffer for surrounding chars.
- // This is useful primarily for
- // RopeFunctions. We put the buffer
- // here to avoid locking in the
- // multithreaded case.
- // The cached path is generally assumed to be valid
- // only if the buffer is valid.
- struct {
-# if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
- _CharT _M_data[15];
-# else
- _CharT _M_data[_S_iterator_buf_len];
-# endif
- } _M_tmp_buf;
-
- // Set buffer contents given path cache.
- static void _S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x);
- // Set buffer contents and path cache.
- static void _S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x);
- // As above, but assumes path cache is valid for previous posn.
- static void _S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x);
- _Rope_iterator_base() {}
- _Rope_iterator_base(_RopeRep* __root, size_t __pos)
- : _M_current_pos(__pos),_M_root(__root), _M_buf_ptr(0) {}
- void _M_incr(size_t __n);
- void _M_decr(size_t __n);
-public:
- size_t index() const { return _M_current_pos; }
-private:
- void _M_copy_buf(const _Self& __x) {
- _M_tmp_buf = __x._M_tmp_buf;
- if (__x._M_buf_start == __x._M_tmp_buf._M_data) {
- _M_buf_start = _M_tmp_buf._M_data;
- _M_buf_end = _M_buf_start + (__x._M_buf_end - __x._M_buf_start);
- _M_buf_ptr = _M_buf_start + (__x._M_buf_ptr - __x._M_buf_start);
- } else {
- _M_buf_end = __x._M_buf_end;
- }
- }
-
-public:
- _Rope_iterator_base(const _Self& __x) :
- _M_current_pos(__x._M_current_pos),
- _M_root(__x._M_root),
- _M_leaf_pos( __x._M_leaf_pos ),
- _M_buf_start(__x._M_buf_start),
- _M_buf_ptr(__x._M_buf_ptr),
- _M_path_end(__x._M_path_end),
- _M_leaf_index(__x._M_leaf_index),
- _M_path_directions(__x._M_path_directions)
- {
- if (0 != __x._M_buf_ptr) {
- _M_copy_buf(__x);
- }
- }
- _Self& operator = (const _Self& __x)
- {
- _M_current_pos = __x._M_current_pos;
- _M_root = __x._M_root;
- _M_buf_start = __x._M_buf_start;
- _M_buf_ptr = __x._M_buf_ptr;
- _M_path_end = __x._M_path_end;
- _M_leaf_index = __x._M_leaf_index;
- _M_path_directions = __x._M_path_directions;
- _M_leaf_pos = __x._M_leaf_pos;
- if (0 != __x._M_buf_ptr) {
- _M_copy_buf(__x);
- }
- return *this;
- }
-};
-
-template<class _CharT, class _Alloc> class _Rope_iterator;
-
-template<class _CharT, class _Alloc>
-class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
- friend class rope<_CharT,_Alloc>;
- typedef _Rope_const_iterator<_CharT, _Alloc> _Self;
- typedef _Rope_iterator_base<_CharT,_Alloc> _Base;
- // protected:
-public:
-# ifndef _STLP_HAS_NO_NAMESPACES
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
- // The one from the base class may not be directly visible.
-# endif
- _Rope_const_iterator(const _RopeRep* __root, size_t __pos):
- _Rope_iterator_base<_CharT,_Alloc>(__CONST_CAST(_RopeRep*,__root), __pos)
- // Only nonconst iterators modify root ref count
- {}
-public:
- typedef _CharT reference; // Really a value. Returning a reference
- // Would be a mess, since it would have
- // to be included in refcount.
- typedef const _CharT* pointer;
- typedef _CharT value_type;
- typedef ptrdiff_t difference_type;
- typedef random_access_iterator_tag iterator_category;
-
-public:
- _Rope_const_iterator() {}
- _Rope_const_iterator(const _Self& __x) :
- _Rope_iterator_base<_CharT,_Alloc>(__x) { }
- _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x):
- _Rope_iterator_base<_CharT,_Alloc>(__x) {}
- _Rope_const_iterator(const rope<_CharT,_Alloc>& __r, size_t __pos) :
- _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr._M_data, __pos) {}
- _Self& operator= (const _Self& __x) {
- _Base::operator=(__x);
- return *this;
- }
- reference operator*() {
- if (0 == this->_M_buf_ptr)
-#if !defined (__DMC__)
- _S_setcache(*this);
-#else
- { _Rope_iterator_base<_CharT, _Alloc>* __x = this; _S_setcache(*__x); }
-#endif
- return *(this->_M_buf_ptr);
- }
- _Self& operator++() {
- _CharT* __next;
- if (0 != this->_M_buf_ptr && (__next = this->_M_buf_ptr + 1) < this->_M_buf_end) {
- this->_M_buf_ptr = __next;
- ++this->_M_current_pos;
- } else {
- this->_M_incr(1);
- }
- return *this;
- }
- _Self& operator+=(ptrdiff_t __n) {
- if (__n >= 0) {
- this->_M_incr(__n);
- } else {
- this->_M_decr(-__n);
- }
- return *this;
- }
- _Self& operator--() {
- this->_M_decr(1);
- return *this;
- }
- _Self& operator-=(ptrdiff_t __n) {
- if (__n >= 0) {
- this->_M_decr(__n);
- } else {
- this->_M_incr(-__n);
- }
- return *this;
- }
- _Self operator++(int) {
- size_t __old_pos = this->_M_current_pos;
- this->_M_incr(1);
- return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
- // This makes a subsequent dereference expensive.
- // Perhaps we should instead copy the iterator
- // if it has a valid cache?
- }
- _Self operator--(int) {
- size_t __old_pos = this->_M_current_pos;
- this->_M_decr(1);
- return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
- }
- inline reference operator[](size_t __n);
-};
-
-template<class _CharT, class _Alloc>
-class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
- friend class rope<_CharT,_Alloc>;
- typedef _Rope_iterator<_CharT, _Alloc> _Self;
- typedef _Rope_iterator_base<_CharT,_Alloc> _Base;
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
-
-public:
- rope<_CharT,_Alloc>* _M_root_rope;
- // root is treated as a cached version of this,
- // and is used to detect changes to the underlying
- // rope.
- // Root is included in the reference count.
- // This is necessary so that we can detect changes reliably.
- // Unfortunately, it requires careful bookkeeping for the
- // nonGC case.
- _Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos);
-
- void _M_check();
-public:
- typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference;
- typedef _Rope_char_ref_proxy<_CharT,_Alloc>* pointer;
- typedef _CharT value_type;
- typedef ptrdiff_t difference_type;
- typedef random_access_iterator_tag iterator_category;
-public:
- ~_Rope_iterator() { //*TY 5/6/00 - added dtor to balance reference count
- _RopeRep::_S_unref(this->_M_root);
- }
-
- rope<_CharT,_Alloc>& container() { return *_M_root_rope; }
- _Rope_iterator() {
- this->_M_root = 0; // Needed for reference counting.
- }
- _Rope_iterator(const _Self& __x) :
- _Rope_iterator_base<_CharT,_Alloc>(__x) {
- _M_root_rope = __x._M_root_rope;
- _RopeRep::_S_ref(this->_M_root);
- }
- _Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos);
- _Self& operator= (const _Self& __x) {
- _RopeRep* __old = this->_M_root;
- _RopeRep::_S_ref(__x._M_root);
- _Base::operator=(__x);
- _M_root_rope = __x._M_root_rope;
- _RopeRep::_S_unref(__old);
- return *this;
- }
- reference operator*() {
- _M_check();
- if (0 == this->_M_buf_ptr) {
- return reference(_M_root_rope, this->_M_current_pos);
- } else {
- return reference(_M_root_rope, this->_M_current_pos, *(this->_M_buf_ptr));
- }
- }
- _Self& operator++() {
- this->_M_incr(1);
- return *this;
- }
- _Self& operator+=(ptrdiff_t __n) {
- if (__n >= 0) {
- this->_M_incr(__n);
- } else {
- this->_M_decr(-__n);
- }
- return *this;
- }
- _Self& operator--() {
- this->_M_decr(1);
- return *this;
- }
- _Self& operator-=(ptrdiff_t __n) {
- if (__n >= 0) {
- this->_M_decr(__n);
- } else {
- this->_M_incr(-__n);
- }
- return *this;
- }
- _Self operator++(int) {
- size_t __old_pos = this->_M_current_pos;
- this->_M_incr(1);
- return _Self(_M_root_rope, __old_pos);
- }
- _Self operator--(int) {
- size_t __old_pos = this->_M_current_pos;
- this->_M_decr(1);
- return _Self(_M_root_rope, __old_pos);
- }
- reference operator[](ptrdiff_t __n) {
- return reference(_M_root_rope, this->_M_current_pos + __n);
- }
-};
-
-# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
-template <class _CharT, class _Alloc>
-inline random_access_iterator_tag
-iterator_category(const _Rope_iterator<_CharT,_Alloc>&) { return random_access_iterator_tag();}
-template <class _CharT, class _Alloc>
-inline _CharT* value_type(const _Rope_iterator<_CharT,_Alloc>&) { return 0; }
-template <class _CharT, class _Alloc>
-inline ptrdiff_t* distance_type(const _Rope_iterator<_CharT,_Alloc>&) { return 0; }
-template <class _CharT, class _Alloc>
-inline random_access_iterator_tag
-iterator_category(const _Rope_const_iterator<_CharT,_Alloc>&) { return random_access_iterator_tag(); }
-template <class _CharT, class _Alloc>
-inline _CharT* value_type(const _Rope_const_iterator<_CharT,_Alloc>&) { return 0; }
-template <class _CharT, class _Alloc>
-inline ptrdiff_t* distance_type(const _Rope_const_iterator<_CharT,_Alloc>&) { return 0; }
-#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
-
-template <class _CharT, class _Alloc, class _CharConsumer>
-bool _S_apply_to_pieces(_CharConsumer& __c,
- _Rope_RopeRep<_CharT, _Alloc> *__r,
- size_t __begin, size_t __end);
- // begin and end are assumed to be in range.
-
-template <class _CharT, class _Alloc>
-class rope
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<rope<_CharT, _Alloc> >
-#endif
-{
- typedef rope<_CharT,_Alloc> _Self;
-public:
- typedef _CharT value_type;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef _CharT const_reference;
- typedef const _CharT* const_pointer;
- typedef _Rope_iterator<_CharT,_Alloc> iterator;
- typedef _Rope_const_iterator<_CharT,_Alloc> const_iterator;
- typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference;
- typedef _Rope_char_ptr_proxy<_CharT,_Alloc> pointer;
-
- friend class _Rope_iterator<_CharT,_Alloc>;
- friend class _Rope_const_iterator<_CharT,_Alloc>;
- friend struct _Rope_RopeRep<_CharT,_Alloc>;
- friend class _Rope_iterator_base<_CharT,_Alloc>;
- friend class _Rope_char_ptr_proxy<_CharT,_Alloc>;
- friend class _Rope_char_ref_proxy<_CharT,_Alloc>;
- friend struct _Rope_RopeSubstring<_CharT,_Alloc>;
-
- _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
-
-protected:
- typedef _CharT* _Cstrptr;
-
- static _CharT _S_empty_c_str[1];
-
- enum { _S_copy_max = 23 };
- // For strings shorter than _S_copy_max, we copy to
- // concatenate.
-
- typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
- typedef typename _RopeRep::_IsBasicCharType _IsBasicCharType;
-
-public:
- _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
- typedef typename _Alloc_traits<_CharT,_Alloc>::allocator_type allocator_type;
-
-public:
- // The only data member of a rope:
- _STLP_PRIV _STLP_alloc_proxy<_RopeRep*, _CharT, allocator_type> _M_tree_ptr;
-
-public:
- allocator_type get_allocator() const { return allocator_type(_M_tree_ptr); }
-
-public:
- typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation;
- typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
- typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
- typedef _Rope_RopeSubstring<_CharT,_Alloc> _RopeSubstring;
-
- // Retrieve a character at the indicated position.
- static _CharT _S_fetch(_RopeRep* __r, size_type __pos);
-
- // Obtain a pointer to the character at the indicated position.
- // The pointer can be used to change the character.
- // If such a pointer cannot be produced, as is frequently the
- // case, 0 is returned instead.
- // (Returns nonzero only if all nodes in the path have a refcount
- // of 1.)
- static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos);
-
- static void _S_unref(_RopeRep* __t) {
- _RopeRep::_S_unref(__t);
- }
- static void _S_ref(_RopeRep* __t) {
- _RopeRep::_S_ref(__t);
- }
-
- typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr;
-
- // _Result is counted in refcount.
- static _RopeRep* _S_substring(_RopeRep* __base,
- size_t __start, size_t __endp1);
-
- static _RopeRep* _S_concat_char_iter(_RopeRep* __r,
- const _CharT* __iter, size_t __slen);
- // Concatenate rope and char ptr, copying __s.
- // Should really take an arbitrary iterator.
- // Result is counted in refcount.
- static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r,
- const _CharT* __iter, size_t __slen);
- // As above, but one reference to __r is about to be
- // destroyed. Thus the pieces may be recycled if all
- // relevent reference counts are 1.
-
- // General concatenation on _RopeRep. _Result
- // has refcount of 1. Adjusts argument refcounts.
- static _RopeRep* _S_concat_rep(_RopeRep* __left, _RopeRep* __right);
-
-public:
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _CharConsumer>
-#else
- typedef _Rope_char_consumer<_CharT> _CharConsumer;
-#endif
- void apply_to_pieces(size_t __begin, size_t __end,
- _CharConsumer& __c) const
- { _S_apply_to_pieces(__c, _M_tree_ptr._M_data, __begin, __end); }
-
-protected:
-
- static size_t _S_rounded_up_size(size_t __n)
- { return _RopeRep::_S_rounded_up_size(__n); }
-
- // Allocate and construct a RopeLeaf using the supplied allocator
- // Takes ownership of s instead of copying.
- static _RopeLeaf* _S_new_RopeLeaf(_CharT *__s,
- size_t _p_size, allocator_type __a) {
- _RopeLeaf* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
- _RopeLeaf).allocate(1);
- _STLP_TRY {
- _STLP_PLACEMENT_NEW(__space) _RopeLeaf(__s, _p_size, __a);
- }
- _STLP_UNWIND(_STLP_CREATE_ALLOCATOR(allocator_type,__a,
- _RopeLeaf).deallocate(__space, 1))
- return __space;
- }
-
- static _RopeConcatenation* _S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right,
- allocator_type __a) {
- _RopeConcatenation* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
- _RopeConcatenation).allocate(1);
- return _STLP_PLACEMENT_NEW(__space) _RopeConcatenation(__left, __right, __a);
- }
-
- static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f,
- size_t _p_size, bool __d, allocator_type __a) {
- _RopeFunction* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
- _RopeFunction).allocate(1);
- return _STLP_PLACEMENT_NEW(__space) _RopeFunction(__f, _p_size, __d, __a);
- }
-
- static _RopeSubstring* _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
- size_t __l, allocator_type __a) {
- _RopeSubstring* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
- _RopeSubstring).allocate(1);
- return _STLP_PLACEMENT_NEW(__space) _RopeSubstring(__b, __s, __l, __a);
- }
-
- static
- _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
- size_t _p_size, allocator_type __a) {
- if (0 == _p_size) return 0;
-
- _CharT* __buf = _STLP_CREATE_ALLOCATOR(allocator_type,__a, _CharT).allocate(_S_rounded_up_size(_p_size));
-
- _STLP_PRIV __ucopy_n(__s, _p_size, __buf);
- _S_construct_null(__buf + _p_size);
-
- _STLP_TRY {
- return _S_new_RopeLeaf(__buf, _p_size, __a);
- }
- _STLP_UNWIND(_RopeRep::_S_free_string(__buf, _p_size, __a))
- _STLP_RET_AFTER_THROW(0)
- }
-
-
- // Concatenation of nonempty strings.
- // Always builds a concatenation node.
- // Rebalances if the result is too deep.
- // Result has refcount 1.
- // Does not increment left and right ref counts even though
- // they are referenced.
- static _RopeRep*
- _S_tree_concat(_RopeRep* __left, _RopeRep* __right);
-
- // Concatenation helper functions
- static _RopeLeaf*
- _S_leaf_concat_char_iter(_RopeLeaf* __r,
- const _CharT* __iter, size_t __slen);
- // Concatenate by copying leaf.
- // should take an arbitrary iterator
- // result has refcount 1.
- static _RopeLeaf* _S_destr_leaf_concat_char_iter
- (_RopeLeaf* __r, const _CharT* __iter, size_t __slen);
- // A version that potentially clobbers __r if __r->_M_ref_count == 1.
-
-
- // A helper function for exponentiating strings.
- // This uses a nonstandard refcount convention.
- // The result has refcount 0.
- typedef _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc> _Concat_fn;
-#if !defined (__GNUC__) || (__GNUC__ < 3)
- friend _Concat_fn;
-#else
- friend struct _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc>;
-#endif
-
-public:
- static size_t _S_char_ptr_len(const _CharT* __s) {
- return char_traits<_CharT>::length(__s);
- }
-
-public: /* for operators */
- rope(_RopeRep* __t, const allocator_type& __a = allocator_type())
- : _M_tree_ptr(__a, __t) { }
-private:
- // Copy __r to the _CharT buffer.
- // Returns __buffer + __r->_M_size._M_data.
- // Assumes that buffer is uninitialized.
- static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer);
-
- // Again, with explicit starting position and length.
- // Assumes that buffer is uninitialized.
- static _CharT* _S_flatten(_RopeRep* __r,
- size_t __start, size_t __len,
- _CharT* __buffer);
-
- // fbp : HP aCC prohibits access to protected min_len from within static methods ( ?? )
-public:
- static const unsigned long _S_min_len[__ROPE_DEPTH_SIZE];
-protected:
- static bool _S_is_balanced(_RopeRep* __r)
- { return (__r->_M_size._M_data >= _S_min_len[__r->_M_depth]); }
-
- static bool _S_is_almost_balanced(_RopeRep* __r) {
- return (__r->_M_depth == 0 ||
- __r->_M_size._M_data >= _S_min_len[__r->_M_depth - 1]);
- }
-
- static bool _S_is_roughly_balanced(_RopeRep* __r) {
- return (__r->_M_depth <= 1 ||
- __r->_M_size._M_data >= _S_min_len[__r->_M_depth - 2]);
- }
-
- // Assumes the result is not empty.
- static _RopeRep* _S_concat_and_set_balanced(_RopeRep* __left,
- _RopeRep* __right) {
- _RopeRep* __result = _S_concat_rep(__left, __right);
- if (_S_is_balanced(__result)) __result->_M_is_balanced = true;
- return __result;
- }
-
- // The basic rebalancing operation. Logically copies the
- // rope. The result has refcount of 1. The client will
- // usually decrement the reference count of __r.
- // The result is within height 2 of balanced by the above
- // definition.
- static _RopeRep* _S_balance(_RopeRep* __r);
-
- // Add all unbalanced subtrees to the forest of balanceed trees.
- // Used only by balance.
- static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest);
-
- // Add __r to forest, assuming __r is already balanced.
- static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest);
-
-#ifdef _STLP_DEBUG
- // Print to stdout, exposing structure
- static void _S_dump(_RopeRep* __r, int __indent = 0);
-#endif
-
- // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp.
- static int _S_compare(const _RopeRep* __x, const _RopeRep* __y);
-
- void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
-
- void _M_reset(_RopeRep* __r) {
- //if (__r != _M_tree_ptr._M_data) {
- _S_unref(_M_tree_ptr._M_data);
- _M_tree_ptr._M_data = __r;
- //}
- }
-
-public:
- bool empty() const { return 0 == _M_tree_ptr._M_data; }
-
- // Comparison member function. This is public only for those
- // clients that need a ternary comparison. Others
- // should use the comparison operators below.
- int compare(const _Self& __y) const {
- return _S_compare(_M_tree_ptr._M_data, __y._M_tree_ptr._M_data);
- }
-
- rope(const _CharT* __s, const allocator_type& __a = allocator_type())
- : _M_tree_ptr(__a, _S_RopeLeaf_from_unowned_char_ptr(__s, _S_char_ptr_len(__s),__a))
- {}
-
- rope(const _CharT* __s, size_t __len,
- const allocator_type& __a = allocator_type())
- : _M_tree_ptr(__a, (_S_RopeLeaf_from_unowned_char_ptr(__s, __len, __a)))
- {}
-
- // Should perhaps be templatized with respect to the iterator type
- // and use Sequence_buffer. (It should perhaps use sequence_buffer
- // even now.)
- rope(const _CharT *__s, const _CharT *__e,
- const allocator_type& __a = allocator_type())
- : _M_tree_ptr(__a, _S_RopeLeaf_from_unowned_char_ptr(__s, __e - __s, __a))
- {}
-
- rope(const const_iterator& __s, const const_iterator& __e,
- const allocator_type& __a = allocator_type())
- : _M_tree_ptr(__a, _S_substring(__s._M_root, __s._M_current_pos,
- __e._M_current_pos))
- {}
-
- rope(const iterator& __s, const iterator& __e,
- const allocator_type& __a = allocator_type())
- : _M_tree_ptr(__a, _S_substring(__s._M_root, __s._M_current_pos,
- __e._M_current_pos))
- {}
-
- rope(_CharT __c, const allocator_type& __a = allocator_type())
- : _M_tree_ptr(__a, (_RopeRep*)0) {
- _CharT* __buf = _M_tree_ptr.allocate(_S_rounded_up_size(1));
-
- _Copy_Construct(__buf, __c);
- _S_construct_null(__buf + 1);
-
- _STLP_TRY {
- _M_tree_ptr._M_data = _S_new_RopeLeaf(__buf, 1, __a);
- }
- _STLP_UNWIND(_RopeRep::_S_free_string(__buf, 1, __a))
- }
-
- rope(size_t __n, _CharT __c,
- const allocator_type& __a = allocator_type()):
- _M_tree_ptr(__a, (_RopeRep*)0) {
- if (0 == __n)
- return;
-
- rope<_CharT,_Alloc> __result;
-# define __exponentiate_threshold size_t(32)
- _RopeRep* __remainder;
- rope<_CharT,_Alloc> __remainder_rope;
-
- // gcc-2.7.2 bugs
- typedef _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc> _Concat_fn;
-
- size_t __exponent = __n / __exponentiate_threshold;
- size_t __rest = __n % __exponentiate_threshold;
- if (0 == __rest) {
- __remainder = 0;
- } else {
- _CharT* __rest_buffer = _M_tree_ptr.allocate(_S_rounded_up_size(__rest));
- uninitialized_fill_n(__rest_buffer, __rest, __c);
- _S_construct_null(__rest_buffer + __rest);
- _STLP_TRY {
- __remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a);
- }
- _STLP_UNWIND(_RopeRep::_S_free_string(__rest_buffer, __rest, __a))
- }
- __remainder_rope._M_tree_ptr._M_data = __remainder;
- if (__exponent != 0) {
- _CharT* __base_buffer = _M_tree_ptr.allocate(_S_rounded_up_size(__exponentiate_threshold));
- _RopeLeaf* __base_leaf;
- rope<_CharT,_Alloc> __base_rope;
- uninitialized_fill_n(__base_buffer, __exponentiate_threshold, __c);
- _S_construct_null(__base_buffer + __exponentiate_threshold);
- _STLP_TRY {
- __base_leaf = _S_new_RopeLeaf(__base_buffer,
- __exponentiate_threshold, __a);
- }
- _STLP_UNWIND(_RopeRep::_S_free_string(__base_buffer,
- __exponentiate_threshold, __a))
- __base_rope._M_tree_ptr._M_data = __base_leaf;
- if (1 == __exponent) {
- __result = __base_rope;
- // One each for base_rope and __result
- //_STLP_ASSERT(2 == __result._M_tree_ptr._M_data->_M_ref_count)
- } else {
- __result = _STLP_PRIV __power(__base_rope, __exponent, _Concat_fn());
- }
- if (0 != __remainder) {
- __result += __remainder_rope;
- }
- } else {
- __result = __remainder_rope;
- }
- _M_tree_ptr._M_data = __result._M_tree_ptr._M_data;
- _M_tree_ptr._M_data->_M_ref_nonnil();
-# undef __exponentiate_threshold
- }
-
- rope(const allocator_type& __a = allocator_type())
- : _M_tree_ptr(__a, (_RopeRep*)0) {}
-
- // Construct a rope from a function that can compute its members
- rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn,
- const allocator_type& __a = allocator_type())
- : _M_tree_ptr(__a, (_RopeRep*)0) {
- _M_tree_ptr._M_data = (0 == __len) ?
- 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
- }
-
- rope(const _Self& __x)
- : _M_tree_ptr(__x._M_tree_ptr, __x._M_tree_ptr._M_data) {
- _S_ref(_M_tree_ptr._M_data);
- }
-
- rope(__move_source<_Self> __src)
- : _M_tree_ptr(__src.get()._M_tree_ptr, __src.get()._M_tree_ptr._M_data) {
- __src.get()._M_tree_ptr._M_data = 0;
- }
-
- ~rope() {
- _S_unref(_M_tree_ptr._M_data);
- }
-
- _Self& operator=(const _Self& __x) {
- _STLP_ASSERT(get_allocator() == __x.get_allocator())
- _S_ref(__x._M_tree_ptr._M_data);
- _M_reset(__x._M_tree_ptr._M_data);
- return *this;
- }
-
- void clear() {
- _S_unref(_M_tree_ptr._M_data);
- _M_tree_ptr._M_data = 0;
- }
- void push_back(_CharT __x) {
- _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, &__x, 1));
- }
-
- void pop_back() {
- _RopeRep* __old = _M_tree_ptr._M_data;
- _M_tree_ptr._M_data =
- _S_substring(_M_tree_ptr._M_data, 0, _M_tree_ptr._M_data->_M_size._M_data - 1);
- _S_unref(__old);
- }
-
- _CharT back() const {
- return _S_fetch(_M_tree_ptr._M_data, _M_tree_ptr._M_data->_M_size._M_data - 1);
- }
-
- void push_front(_CharT __x) {
- _RopeRep* __old = _M_tree_ptr._M_data;
- _RopeRep* __left =
- _S_RopeLeaf_from_unowned_char_ptr(&__x, 1, _M_tree_ptr);
- _STLP_TRY {
- _M_tree_ptr._M_data = _S_concat_rep(__left, _M_tree_ptr._M_data);
- _S_unref(__old);
- _S_unref(__left);
- }
- _STLP_UNWIND(_S_unref(__left))
- }
-
- void pop_front() {
- _RopeRep* __old = _M_tree_ptr._M_data;
- _M_tree_ptr._M_data = _S_substring(_M_tree_ptr._M_data, 1, _M_tree_ptr._M_data->_M_size._M_data);
- _S_unref(__old);
- }
-
- _CharT front() const {
- return _S_fetch(_M_tree_ptr._M_data, 0);
- }
-
- void balance() {
- _RopeRep* __old = _M_tree_ptr._M_data;
- _M_tree_ptr._M_data = _S_balance(_M_tree_ptr._M_data);
- _S_unref(__old);
- }
-
- void copy(_CharT* __buffer) const {
- _STLP_STD::_Destroy_Range(__buffer, __buffer + size());
- _S_flatten(_M_tree_ptr._M_data, __buffer);
- }
-
- /*
- * This is the copy function from the standard, but
- * with the arguments reordered to make it consistent with the
- * rest of the interface.
- * Note that this guaranteed not to compile if the draft standard
- * order is assumed.
- */
- size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const {
- size_t _p_size = size();
- size_t __len = (__pos + __n > _p_size? _p_size - __pos : __n);
-
- _STLP_STD::_Destroy_Range(__buffer, __buffer + __len);
- _S_flatten(_M_tree_ptr._M_data, __pos, __len, __buffer);
- return __len;
- }
-
-# ifdef _STLP_DEBUG
- // Print to stdout, exposing structure. May be useful for
- // performance debugging.
- void dump() {
- _S_dump(_M_tree_ptr._M_data);
- }
-# endif
-
- // Convert to 0 terminated string in new allocated memory.
- // Embedded 0s in the input do not terminate the copy.
- const _CharT* c_str() const;
-
- // As above, but also use the flattened representation as the
- // the new rope representation.
- const _CharT* replace_with_c_str();
-
- // Reclaim memory for the c_str generated flattened string.
- // Intentionally undocumented, since it's hard to say when this
- // is safe for multiple threads.
- void delete_c_str () {
- if (0 == _M_tree_ptr._M_data) return;
- if (_RopeRep::_S_leaf == _M_tree_ptr._M_data->_M_tag &&
- ((_RopeLeaf*)_M_tree_ptr._M_data)->_M_data ==
- _M_tree_ptr._M_data->_M_c_string) {
- // Representation shared
- return;
- }
- _M_tree_ptr._M_data->_M_free_c_string();
- _M_tree_ptr._M_data->_M_c_string = 0;
- }
-
- _CharT operator[] (size_type __pos) const {
- return _S_fetch(_M_tree_ptr._M_data, __pos);
- }
-
- _CharT at(size_type __pos) const {
- if (__pos >= size()) _M_throw_out_of_range();
- return (*this)[__pos];
- }
-
- const_iterator begin() const {
- return(const_iterator(_M_tree_ptr._M_data, 0));
- }
-
- // An easy way to get a const iterator from a non-const container.
- const_iterator const_begin() const {
- return(const_iterator(_M_tree_ptr._M_data, 0));
- }
-
- const_iterator end() const {
- return(const_iterator(_M_tree_ptr._M_data, size()));
- }
-
- const_iterator const_end() const {
- return(const_iterator(_M_tree_ptr._M_data, size()));
- }
-
- size_type size() const {
- return(0 == _M_tree_ptr._M_data? 0 : _M_tree_ptr._M_data->_M_size._M_data);
- }
-
- size_type length() const {
- return size();
- }
-
- size_type max_size() const {
- return _S_min_len[__ROPE_MAX_DEPTH-1] - 1;
- // Guarantees that the result can be sufficiently
- // balanced. Longer ropes will probably still work,
- // but it's harder to make guarantees.
- }
-
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(end());
- }
-
- const_reverse_iterator const_rbegin() const {
- return const_reverse_iterator(end());
- }
-
- const_reverse_iterator rend() const {
- return const_reverse_iterator(begin());
- }
-
- const_reverse_iterator const_rend() const {
- return const_reverse_iterator(begin());
- }
- // The symmetric cases are intentionally omitted, since they're presumed
- // to be less common, and we don't handle them as well.
-
- // The following should really be templatized.
- // The first argument should be an input iterator or
- // forward iterator with value_type _CharT.
- _Self& append(const _CharT* __iter, size_t __n) {
- _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, __iter, __n));
- return *this;
- }
-
- _Self& append(const _CharT* __c_string) {
- size_t __len = _S_char_ptr_len(__c_string);
- append(__c_string, __len);
- return *this;
- }
-
- _Self& append(const _CharT* __s, const _CharT* __e) {
- _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, __s, __e - __s));
- return *this;
- }
-
- _Self& append(const_iterator __s, const_iterator __e) {
- _STLP_ASSERT(__s._M_root == __e._M_root)
- _STLP_ASSERT(get_allocator() == __s._M_root->get_allocator())
- _Self_destruct_ptr __appendee(_S_substring(__s._M_root, __s._M_current_pos, __e._M_current_pos));
- _M_reset(_S_concat_rep(_M_tree_ptr._M_data, (_RopeRep*)__appendee));
- return *this;
- }
-
- _Self& append(_CharT __c) {
- _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, &__c, 1));
- return *this;
- }
-
- _Self& append() { return append(_CharT()); } // XXX why?
-
- _Self& append(const _Self& __y) {
- _STLP_ASSERT(__y.get_allocator() == get_allocator())
- _M_reset(_S_concat_rep(_M_tree_ptr._M_data, __y._M_tree_ptr._M_data));
- return *this;
- }
-
- _Self& append(size_t __n, _CharT __c) {
- rope<_CharT,_Alloc> __last(__n, __c);
- return append(__last);
- }
-
- void swap(_Self& __b) {
- _M_tree_ptr.swap(__b._M_tree_ptr);
- }
-
-protected:
- // Result is included in refcount.
- static _RopeRep* replace(_RopeRep* __old, size_t __pos1,
- size_t __pos2, _RopeRep* __r) {
- if (0 == __old) { _S_ref(__r); return __r; }
- _Self_destruct_ptr __left(_S_substring(__old, 0, __pos1));
- _Self_destruct_ptr __right(_S_substring(__old, __pos2, __old->_M_size._M_data));
- _STLP_MPWFIX_TRY //*TY 06/01/2000 -
- _RopeRep* __result;
-
- if (0 == __r) {
- __result = _S_concat_rep(__left, __right);
- } else {
- _STLP_ASSERT(__old->get_allocator() == __r->get_allocator())
- _Self_destruct_ptr __left_result(_S_concat_rep(__left, __r));
- __result = _S_concat_rep(__left_result, __right);
- }
- return __result;
- _STLP_MPWFIX_CATCH //*TY 06/01/2000 -
- }
-
-public:
- void insert(size_t __p, const _Self& __r) {
- if (__p > size()) _M_throw_out_of_range();
- _STLP_ASSERT(get_allocator() == __r.get_allocator())
- _M_reset(replace(_M_tree_ptr._M_data, __p, __p, __r._M_tree_ptr._M_data));
- }
-
- void insert(size_t __p, size_t __n, _CharT __c) {
- rope<_CharT,_Alloc> __r(__n,__c);
- insert(__p, __r);
- }
-
- void insert(size_t __p, const _CharT* __i, size_t __n) {
- if (__p > size()) _M_throw_out_of_range();
- _Self_destruct_ptr __left(_S_substring(_M_tree_ptr._M_data, 0, __p));
- _Self_destruct_ptr __right(_S_substring(_M_tree_ptr._M_data, __p, size()));
- _Self_destruct_ptr __left_result(
- _S_concat_char_iter(__left, __i, __n));
- // _S_ destr_concat_char_iter should be safe here.
- // But as it stands it's probably not a win, since __left
- // is likely to have additional references.
- _M_reset(_S_concat_rep(__left_result, __right));
- }
-
- void insert(size_t __p, const _CharT* __c_string) {
- insert(__p, __c_string, _S_char_ptr_len(__c_string));
- }
-
- void insert(size_t __p, _CharT __c) {
- insert(__p, &__c, 1);
- }
-
- void insert(size_t __p) {
- _CharT __c = _CharT();
- insert(__p, &__c, 1);
- }
-
- void insert(size_t __p, const _CharT* __i, const _CharT* __j) {
- _Self __r(__i, __j);
- insert(__p, __r);
- }
-
- void insert(size_t __p, const const_iterator& __i,
- const const_iterator& __j) {
- _Self __r(__i, __j);
- insert(__p, __r);
- }
-
- void insert(size_t __p, const iterator& __i,
- const iterator& __j) {
- _Self __r(__i, __j);
- insert(__p, __r);
- }
-
- // (position, length) versions of replace operations:
- void replace(size_t __p, size_t __n, const _Self& __r) {
- if (__p > size()) _M_throw_out_of_range();
- _M_reset(replace(_M_tree_ptr._M_data, __p, __p + __n, __r._M_tree_ptr._M_data));
- }
-
- void replace(size_t __p, size_t __n,
- const _CharT* __i, size_t __i_len) {
- _Self __r(__i, __i_len);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n, _CharT __c) {
- _Self __r(__c);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n, const _CharT* __c_string) {
- _Self __r(__c_string);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n,
- const _CharT* __i, const _CharT* __j) {
- _Self __r(__i, __j);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n,
- const const_iterator& __i, const const_iterator& __j) {
- _Self __r(__i, __j);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n,
- const iterator& __i, const iterator& __j) {
- _Self __r(__i, __j);
- replace(__p, __n, __r);
- }
-
- // Single character variants:
- void replace(size_t __p, _CharT __c) {
- if (__p > size()) _M_throw_out_of_range();
- iterator __i(this, __p);
- *__i = __c;
- }
-
- void replace(size_t __p, const _Self& __r) {
- replace(__p, 1, __r);
- }
-
- void replace(size_t __p, const _CharT* __i, size_t __i_len) {
- replace(__p, 1, __i, __i_len);
- }
-
- void replace(size_t __p, const _CharT* __c_string) {
- replace(__p, 1, __c_string);
- }
-
- void replace(size_t __p, const _CharT* __i, const _CharT* __j) {
- replace(__p, 1, __i, __j);
- }
-
- void replace(size_t __p, const const_iterator& __i,
- const const_iterator& __j) {
- replace(__p, 1, __i, __j);
- }
-
- void replace(size_t __p, const iterator& __i,
- const iterator& __j) {
- replace(__p, 1, __i, __j);
- }
-
- // Erase, (position, size) variant.
- void erase(size_t __p, size_t __n) {
- if (__p > size()) _M_throw_out_of_range();
- _M_reset(replace(_M_tree_ptr._M_data, __p, __p + __n, 0));
- }
-
- // Erase, single character
- void erase(size_t __p) {
- erase(__p, __p + 1);
- }
-
- // Insert, iterator variants.
- iterator insert(const iterator& __p, const _Self& __r)
- { insert(__p.index(), __r); return __p; }
- iterator insert(const iterator& __p, size_t __n, _CharT __c)
- { insert(__p.index(), __n, __c); return __p; }
- iterator insert(const iterator& __p, _CharT __c)
- { insert(__p.index(), __c); return __p; }
- iterator insert(const iterator& __p )
- { insert(__p.index()); return __p; }
- iterator insert(const iterator& __p, const _CharT* c_string)
- { insert(__p.index(), c_string); return __p; }
- iterator insert(const iterator& __p, const _CharT* __i, size_t __n)
- { insert(__p.index(), __i, __n); return __p; }
- iterator insert(const iterator& __p, const _CharT* __i,
- const _CharT* __j)
- { insert(__p.index(), __i, __j); return __p; }
- iterator insert(const iterator& __p,
- const const_iterator& __i, const const_iterator& __j)
- { insert(__p.index(), __i, __j); return __p; }
- iterator insert(const iterator& __p,
- const iterator& __i, const iterator& __j)
- { insert(__p.index(), __i, __j); return __p; }
-
- // Replace, range variants.
- void replace(const iterator& __p, const iterator& __q,
- const _Self& __r)
- { replace(__p.index(), __q.index() - __p.index(), __r); }
- void replace(const iterator& __p, const iterator& __q, _CharT __c)
- { replace(__p.index(), __q.index() - __p.index(), __c); }
- void replace(const iterator& __p, const iterator& __q,
- const _CharT* __c_string)
- { replace(__p.index(), __q.index() - __p.index(), __c_string); }
- void replace(const iterator& __p, const iterator& __q,
- const _CharT* __i, size_t __n)
- { replace(__p.index(), __q.index() - __p.index(), __i, __n); }
- void replace(const iterator& __p, const iterator& __q,
- const _CharT* __i, const _CharT* __j)
- { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
- void replace(const iterator& __p, const iterator& __q,
- const const_iterator& __i, const const_iterator& __j)
- { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
- void replace(const iterator& __p, const iterator& __q,
- const iterator& __i, const iterator& __j)
- { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
-
- // Replace, iterator variants.
- void replace(const iterator& __p, const _Self& __r)
- { replace(__p.index(), __r); }
- void replace(const iterator& __p, _CharT __c)
- { replace(__p.index(), __c); }
- void replace(const iterator& __p, const _CharT* __c_string)
- { replace(__p.index(), __c_string); }
- void replace(const iterator& __p, const _CharT* __i, size_t __n)
- { replace(__p.index(), __i, __n); }
- void replace(const iterator& __p, const _CharT* __i, const _CharT* __j)
- { replace(__p.index(), __i, __j); }
- void replace(const iterator& __p, const_iterator __i,
- const_iterator __j)
- { replace(__p.index(), __i, __j); }
- void replace(const iterator& __p, iterator __i, iterator __j)
- { replace(__p.index(), __i, __j); }
-
- // Iterator and range variants of erase
- iterator erase(const iterator& __p, const iterator& __q) {
- size_t __p_index = __p.index();
- erase(__p_index, __q.index() - __p_index);
- return iterator(this, __p_index);
- }
- iterator erase(const iterator& __p) {
- size_t __p_index = __p.index();
- erase(__p_index, 1);
- return iterator(this, __p_index);
- }
-
- _Self substr(size_t __start, size_t __len = 1) const {
- if (__start > size()) _M_throw_out_of_range();
- return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start, __start + __len));
- }
-
- _Self substr(iterator __start, iterator __end) const {
- return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start.index(), __end.index()));
- }
-
- _Self substr(iterator __start) const {
- size_t __pos = __start.index();
- return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __pos, __pos + 1));
- }
-
- _Self substr(const_iterator __start, const_iterator __end) const {
- // This might eventually take advantage of the cache in the
- // iterator.
- return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start.index(), __end.index()));
- }
-
- rope<_CharT,_Alloc> substr(const_iterator __start) {
- size_t __pos = __start.index();
- return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __pos, __pos + 1));
- }
-
-#include <stl/_string_npos.h>
-
- size_type find(const _Self& __s, size_type __pos = 0) const {
- if (__pos >= size())
-# ifndef _STLP_OLD_ROPE_SEMANTICS
- return npos;
-# else
- return size();
-# endif
-
- size_type __result_pos;
- const_iterator __result = search(const_begin() + (ptrdiff_t)__pos, const_end(), __s.begin(), __s.end() );
- __result_pos = __result.index();
-# ifndef _STLP_OLD_ROPE_SEMANTICS
- if (__result_pos == size()) __result_pos = npos;
-# endif
- return __result_pos;
- }
- size_type find(_CharT __c, size_type __pos = 0) const;
- size_type find(const _CharT* __s, size_type __pos = 0) const {
- size_type __result_pos;
- const_iterator __result = search(const_begin() + (ptrdiff_t)__pos, const_end(),
- __s, __s + _S_char_ptr_len(__s));
- __result_pos = __result.index();
-# ifndef _STLP_OLD_ROPE_SEMANTICS
- if (__result_pos == size()) __result_pos = npos;
-# endif
- return __result_pos;
- }
-
- iterator mutable_begin() {
- return(iterator(this, 0));
- }
-
- iterator mutable_end() {
- return(iterator(this, size()));
- }
-
- reverse_iterator mutable_rbegin() {
- return reverse_iterator(mutable_end());
- }
-
- reverse_iterator mutable_rend() {
- return reverse_iterator(mutable_begin());
- }
-
- reference mutable_reference_at(size_type __pos) {
- return reference(this, __pos);
- }
-
-# ifdef __STD_STUFF
- reference operator[] (size_type __pos) {
- return reference(this, __pos);
- }
-
- reference at(size_type __pos) {
- if (__pos >= size()) _M_throw_out_of_range();
- return (*this)[__pos];
- }
-
- void resize(size_type, _CharT) {}
- void resize(size_type) {}
- void reserve(size_type = 0) {}
- size_type capacity() const {
- return max_size();
- }
-
- // Stuff below this line is dangerous because it's error prone.
- // I would really like to get rid of it.
- // copy function with funny arg ordering.
- size_type copy(_CharT* __buffer, size_type __n,
- size_type __pos = 0) const {
- return copy(__pos, __n, __buffer);
- }
-
- iterator end() { return mutable_end(); }
-
- iterator begin() { return mutable_begin(); }
-
- reverse_iterator rend() { return mutable_rend(); }
-
- reverse_iterator rbegin() { return mutable_rbegin(); }
-
-# else
-
- const_iterator end() { return const_end(); }
-
- const_iterator begin() { return const_begin(); }
-
- const_reverse_iterator rend() { return const_rend(); }
-
- const_reverse_iterator rbegin() { return const_rbegin(); }
-
-# endif
-}; //class rope
-
-#if !defined (_STLP_STATIC_CONST_INIT_BUG)
-# if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
-template <class _CharT, class _Alloc>
-const size_t rope<_CharT, _Alloc>::npos = ~(size_t) 0;
-# endif
-#endif
-
-template <class _CharT, class _Alloc>
-inline _CharT
-_Rope_const_iterator< _CharT, _Alloc>::operator[](size_t __n)
-{ return rope<_CharT,_Alloc>::_S_fetch(this->_M_root, this->_M_current_pos + __n); }
-
-template <class _CharT, class _Alloc>
-inline bool operator== (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y) {
- return (__x._M_current_pos == __y._M_current_pos &&
- __x._M_root == __y._M_root);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator< (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y)
-{ return (__x._M_current_pos < __y._M_current_pos); }
-
-#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-
-template <class _CharT, class _Alloc>
-inline bool operator!= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y)
-{ return !(__x == __y); }
-
-template <class _CharT, class _Alloc>
-inline bool operator> (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y)
-{ return __y < __x; }
-
-template <class _CharT, class _Alloc>
-inline bool operator<= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y)
-{ return !(__y < __x); }
-
-template <class _CharT, class _Alloc>
-inline bool operator>= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y)
-{ return !(__x < __y); }
-
-#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
-
-template <class _CharT, class _Alloc>
-inline ptrdiff_t operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y)
-{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }
-
-#if !defined( __MWERKS__ ) || __MWERKS__ >= 0x2000 // dwa 8/21/97 - "ambiguous access to overloaded function" bug.
-template <class _CharT, class _Alloc>
-inline _Rope_const_iterator<_CharT,_Alloc>
-operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n)
-{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos - __n); }
-# endif
-
-template <class _CharT, class _Alloc>
-inline _Rope_const_iterator<_CharT,_Alloc>
-operator+(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n)
-{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos + __n); }
-
-template <class _CharT, class _Alloc>
-inline _Rope_const_iterator<_CharT,_Alloc>
-operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT,_Alloc>& __x)
-{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos + __n); }
-
-template <class _CharT, class _Alloc>
-inline bool operator== (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y) {
- return (__x._M_current_pos == __y._M_current_pos &&
- __x._M_root_rope == __y._M_root_rope);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator< (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y)
-{ return (__x._M_current_pos < __y._M_current_pos); }
-
-#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
-template <class _CharT, class _Alloc>
-inline bool operator!= (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y)
-{ return !(__x == __y); }
-
-template <class _CharT, class _Alloc>
-inline bool operator> (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y)
-{ return __y < __x; }
-
-template <class _CharT, class _Alloc>
-inline bool operator<= (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y)
-{ return !(__y < __x); }
-
-template <class _CharT, class _Alloc>
-inline bool operator>= (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y)
-{ return !(__x < __y); }
-#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
-
-template <class _CharT, class _Alloc>
-inline ptrdiff_t operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y)
-{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }
-
-#if !defined( __MWERKS__ ) || __MWERKS__ >= 0x2000 // dwa 8/21/97 - "ambiguous access to overloaded function" bug.
-template <class _CharT, class _Alloc>
-inline _Rope_iterator<_CharT,_Alloc>
-operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n) {
- return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos - __n);
-}
-# endif
-
-template <class _CharT, class _Alloc>
-inline _Rope_iterator<_CharT,_Alloc>
-operator+(const _Rope_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n) {
- return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos + __n);
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_iterator<_CharT,_Alloc>
-operator+(ptrdiff_t __n, const _Rope_iterator<_CharT,_Alloc>& __x) {
- return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos + __n);
-}
-
-template <class _CharT, class _Alloc>
-inline rope<_CharT,_Alloc>
-operator+ (const rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right) {
- _STLP_ASSERT(__left.get_allocator() == __right.get_allocator())
- return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_rep(__left._M_tree_ptr._M_data, __right._M_tree_ptr._M_data));
- // Inlining this should make it possible to keep __left and __right in registers.
-}
-
-template <class _CharT, class _Alloc>
-inline rope<_CharT,_Alloc>&
-operator+= (rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right) {
- __left.append(__right);
- return __left;
-}
-
-template <class _CharT, class _Alloc>
-inline rope<_CharT,_Alloc>
-operator+ (const rope<_CharT,_Alloc>& __left,
- const _CharT* __right) {
- size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right);
- return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_char_iter(__left._M_tree_ptr._M_data, __right, __rlen));
-}
-
-template <class _CharT, class _Alloc>
-inline rope<_CharT,_Alloc>&
-operator+= (rope<_CharT,_Alloc>& __left,
- const _CharT* __right) {
- __left.append(__right);
- return __left;
-}
-
-template <class _CharT, class _Alloc>
-inline rope<_CharT,_Alloc>
-operator+ (const rope<_CharT,_Alloc>& __left, _CharT __right) {
- return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_char_iter(__left._M_tree_ptr._M_data, &__right, 1));
-}
-
-template <class _CharT, class _Alloc>
-inline rope<_CharT,_Alloc>&
-operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) {
- __left.append(__right);
- return __left;
-}
-
-template <class _CharT, class _Alloc>
-inline bool
-operator< (const rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right) {
- return __left.compare(__right) < 0;
-}
-
-template <class _CharT, class _Alloc>
-inline bool
-operator== (const rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right) {
- return __left.compare(__right) == 0;
-}
-
-#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-
-template <class _CharT, class _Alloc>
-inline bool
-operator!= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
- return !(__x == __y);
-}
-
-template <class _CharT, class _Alloc>
-inline bool
-operator> (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
- return __y < __x;
-}
-
-template <class _CharT, class _Alloc>
-inline bool
-operator<= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
- return !(__y < __x);
-}
-
-template <class _CharT, class _Alloc>
-inline bool
-operator>= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
- return !(__x < __y);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator!= (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
- const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) {
- return !(__x == __y);
-}
-
-#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
-
-template <class _CharT, class _Alloc>
-inline bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
- const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) {
- return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root);
-}
-
-#if !defined (_STLP_USE_NO_IOSTREAMS)
-template<class _CharT, class _Traits, class _Alloc>
-basic_ostream<_CharT, _Traits>& operator<< (basic_ostream<_CharT, _Traits>& __o,
- const rope<_CharT, _Alloc>& __r);
-#endif
-
-typedef rope<char, _STLP_DEFAULT_ALLOCATOR(char) > crope;
-#if defined (_STLP_HAS_WCHAR_T)
-typedef rope<wchar_t, _STLP_DEFAULT_ALLOCATOR(wchar_t) > wrope;
-#endif
-
-inline crope::reference __mutable_reference_at(crope& __c, size_t __i)
-{ return __c.mutable_reference_at(__i); }
-
-#if defined (_STLP_HAS_WCHAR_T)
-inline wrope::reference __mutable_reference_at(wrope& __c, size_t __i)
-{ return __c.mutable_reference_at(__i); }
-#endif
-
-#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
-template <class _CharT, class _Alloc>
-inline void swap(rope<_CharT,_Alloc>& __x, rope<_CharT,_Alloc>& __y)
-{ __x.swap(__y); }
-#else
-
-inline void swap(crope& __x, crope& __y) { __x.swap(__y); }
-# ifdef _STLP_HAS_WCHAR_T // dwa 8/21/97
-inline void swap(wrope& __x, wrope& __y) { __x.swap(__y); }
-# endif
-
-#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
-
-
-// Hash functions should probably be revisited later:
-_STLP_TEMPLATE_NULL struct hash<crope> {
- size_t operator()(const crope& __str) const {
- size_t _p_size = __str.size();
-
- if (0 == _p_size) return 0;
- return 13*__str[0] + 5*__str[_p_size - 1] + _p_size;
- }
-};
-
-#if defined (_STLP_HAS_WCHAR_T) // dwa 8/21/97
-_STLP_TEMPLATE_NULL struct hash<wrope> {
- size_t operator()(const wrope& __str) const {
- size_t _p_size = __str.size();
-
- if (0 == _p_size) return 0;
- return 13*__str[0] + 5*__str[_p_size - 1] + _p_size;
- }
-};
-#endif
-
-#if (!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310))
-// I couldn't get this to work with VC++
-template<class _CharT,class _Alloc>
-# if defined (__DMC__) && !defined (__PUT_STATIC_DATA_MEMBERS_HERE)
-extern
-# endif
-void _Rope_rotate(_Rope_iterator<_CharT, _Alloc> __first,
- _Rope_iterator<_CharT, _Alloc> __middle,
- _Rope_iterator<_CharT, _Alloc> __last);
-
-inline void rotate(_Rope_iterator<char, _STLP_DEFAULT_ALLOCATOR(char) > __first,
- _Rope_iterator<char, _STLP_DEFAULT_ALLOCATOR(char) > __middle,
- _Rope_iterator<char, _STLP_DEFAULT_ALLOCATOR(char) > __last)
-{ _Rope_rotate(__first, __middle, __last); }
-#endif
-
-template <class _CharT, class _Alloc>
-inline _Rope_char_ref_proxy<_CharT, _Alloc>::operator _CharT () const {
- if (_M_current_valid) {
- return _M_current;
- } else {
- return _My_rope::_S_fetch(_M_root->_M_tree_ptr._M_data, _M_pos);
- }
-}
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _CharT, class _Alloc>
-struct __move_traits<rope<_CharT, _Alloc> > {
- typedef __stlp_movable implemented;
- //Completness depends on the allocator:
- typedef typename __move_traits<_Alloc>::complete complete;
-};
-#endif
-
-_STLP_END_NAMESPACE
-
-#if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_rope.c>
-#endif
-
-#endif /* _STLP_INTERNAL_ROPE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_set.h b/stl/_set.h
deleted file mode 100644
index a253b46..0000000
--- a/stl/_set.h
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_SET_H
-#define _STLP_INTERNAL_SET_H
-
-#ifndef _STLP_INTERNAL_TREE_H
-# include <stl/_tree.h>
-#endif
-
-#if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
-
-_STLP_BEGIN_NAMESPACE
-
-//Specific iterator traits creation
-_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, Const_traits)
-
-template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
- _STLP_DEFAULT_ALLOCATOR_SELECT(_Key) >
-class set
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<set<_Key, _Compare, _Alloc> >
-#endif
-{
- typedef set<_Key, _Compare, _Alloc> _Self;
-public:
-// typedefs:
- typedef _Key key_type;
- typedef _Key value_type;
- typedef _Compare key_compare;
- typedef _Compare value_compare;
-
-private:
- //Specific iterator traits creation
- typedef _STLP_PRIV _SetTraitsT<value_type> _SetTraits;
-
-public:
- //Following typedef have to be public for __move_traits specialization.
- typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
- value_type, _STLP_PRIV _Identity<value_type>,
- _SetTraits, _Alloc> _Rep_type;
-
- typedef typename _Rep_type::pointer pointer;
- typedef typename _Rep_type::const_pointer const_pointer;
- typedef typename _Rep_type::reference reference;
- typedef typename _Rep_type::const_reference const_reference;
- typedef typename _Rep_type::iterator iterator;
- typedef typename _Rep_type::const_iterator const_iterator;
- typedef typename _Rep_type::reverse_iterator reverse_iterator;
- typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
- typedef typename _Rep_type::size_type size_type;
- typedef typename _Rep_type::difference_type difference_type;
- typedef typename _Rep_type::allocator_type allocator_type;
-
-private:
- _Rep_type _M_t; // red-black tree representing set
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-public:
-
- // allocation/deallocation
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit set(const _Compare& __comp = _Compare(),
- const allocator_type& __a = allocator_type())
-#else
- set()
- : _M_t(_Compare(), allocator_type()) {}
- explicit set(const _Compare& __comp)
- : _M_t(__comp, allocator_type()) {}
- set(const _Compare& __comp, const allocator_type& __a)
-#endif
- : _M_t(__comp, __a) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- set(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- set(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
- : _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); }
-# endif
- template <class _InputIterator>
- set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-#else
- set(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- set(const value_type* __first,
- const value_type* __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-
- set(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- set(const_iterator __first, const_iterator __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- set(const _Self& __x) : _M_t(__x._M_t) {}
-
- set(__move_source<_Self> src)
- : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
-
- _Self& operator=(const _Self& __x) {
- _M_t = __x._M_t;
- return *this;
- }
-
- // accessors:
- key_compare key_comp() const { return _M_t.key_comp(); }
- value_compare value_comp() const { return _M_t.key_comp(); }
- allocator_type get_allocator() const { return _M_t.get_allocator(); }
-
- iterator begin() { return _M_t.begin(); }
- iterator end() { return _M_t.end(); }
- const_iterator begin() const { return _M_t.begin(); }
- const_iterator end() const { return _M_t.end(); }
- reverse_iterator rbegin() { return _M_t.rbegin(); }
- reverse_iterator rend() { return _M_t.rend(); }
- const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
- const_reverse_iterator rend() const { return _M_t.rend(); }
- bool empty() const { return _M_t.empty(); }
- size_type size() const { return _M_t.size(); }
- size_type max_size() const { return _M_t.max_size(); }
- void swap(_Self& __x) { _M_t.swap(__x._M_t); }
-
- // insert/erase
- pair<iterator,bool> insert(const value_type& __x)
- { return _M_t.insert_unique(__x); }
- iterator insert(iterator __pos, const value_type& __x)
- { return _M_t.insert_unique( __pos , __x); }
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(_InputIterator __first, _InputIterator __last)
- { _M_t.insert_unique(__first, __last); }
-#else
- void insert(const_iterator __first, const_iterator __last)
- { _M_t.insert_unique(__first, __last); }
- void insert(const value_type* __first, const value_type* __last)
- { _M_t.insert_unique(__first, __last); }
-#endif /* _STLP_MEMBER_TEMPLATES */
- void erase(iterator __pos) { _M_t.erase( __pos ); }
- size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); }
- void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last ); }
- void clear() { _M_t.clear(); }
-
- // set operations:
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __x) { return _M_t.find(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __x) const
- { return _M_t.find(__x) == _M_t.end() ? 0 : 1 ; }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __x)
- { return _M_t.equal_range_unique(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __x) const
- { return _M_t.equal_range_unique(__x); }
-};
-
-//Specific iterator traits creation
-_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, Const_traits)
-
-template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
- _STLP_DEFAULT_ALLOCATOR_SELECT(_Key) >
-class multiset
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<multiset<_Key, _Compare, _Alloc> >
-#endif
-{
- typedef multiset<_Key, _Compare, _Alloc> _Self;
-public:
- // typedefs:
-
- typedef _Key key_type;
- typedef _Key value_type;
- typedef _Compare key_compare;
- typedef _Compare value_compare;
-
-private:
- //Specific iterator traits creation
- typedef _STLP_PRIV _MultisetTraitsT<value_type> _MultisetTraits;
-
-public:
- //Following typedef have to be public for __move_traits specialization.
- typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
- value_type, _STLP_PRIV _Identity<value_type>,
- _MultisetTraits, _Alloc> _Rep_type;
-
- typedef typename _Rep_type::pointer pointer;
- typedef typename _Rep_type::const_pointer const_pointer;
- typedef typename _Rep_type::reference reference;
- typedef typename _Rep_type::const_reference const_reference;
- typedef typename _Rep_type::iterator iterator;
- typedef typename _Rep_type::const_iterator const_iterator;
- typedef typename _Rep_type::reverse_iterator reverse_iterator;
- typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
- typedef typename _Rep_type::size_type size_type;
- typedef typename _Rep_type::difference_type difference_type;
- typedef typename _Rep_type::allocator_type allocator_type;
-
-private:
- _Rep_type _M_t; // red-black tree representing multiset
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-public:
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit multiset(const _Compare& __comp = _Compare(),
- const allocator_type& __a = allocator_type())
-#else
- multiset()
- : _M_t(_Compare(), allocator_type()) {}
- explicit multiset(const _Compare& __comp)
- : _M_t(__comp, allocator_type()) {}
- multiset(const _Compare& __comp, const allocator_type& __a)
-#endif
- : _M_t(__comp, __a) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- multiset(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
-
- template <class _InputIterator>
- multiset(_InputIterator __first, _InputIterator __last,
- const _Compare& __comp,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- multiset(_InputIterator __first, _InputIterator __last,
- const _Compare& __comp)
- : _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); }
-# endif
-#else
- multiset(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
-
- multiset(const value_type* __first, const value_type* __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-
- multiset(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
-
- multiset(const_iterator __first, const_iterator __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- multiset(const _Self& __x) : _M_t(__x._M_t) {}
- _Self& operator=(const _Self& __x) {
- _M_t = __x._M_t;
- return *this;
- }
-
- multiset(__move_source<_Self> src)
- : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
-
- // accessors:
- key_compare key_comp() const { return _M_t.key_comp(); }
- value_compare value_comp() const { return _M_t.key_comp(); }
- allocator_type get_allocator() const { return _M_t.get_allocator(); }
-
- iterator begin() { return _M_t.begin(); }
- iterator end() { return _M_t.end(); }
- const_iterator begin() const { return _M_t.begin(); }
- const_iterator end() const { return _M_t.end(); }
- reverse_iterator rbegin() { return _M_t.rbegin(); }
- reverse_iterator rend() { return _M_t.rend(); }
- const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
- const_reverse_iterator rend() const { return _M_t.rend(); }
- bool empty() const { return _M_t.empty(); }
- size_type size() const { return _M_t.size(); }
- size_type max_size() const { return _M_t.max_size(); }
- void swap(_Self& __x) { _M_t.swap(__x._M_t); }
-
- // insert/erase
- iterator insert(const value_type& __x)
- { return _M_t.insert_equal(__x); }
- iterator insert(iterator __pos, const value_type& __x)
- { return _M_t.insert_equal(__pos, __x); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(_InputIterator __first, _InputIterator __last)
- { _M_t.insert_equal(__first, __last); }
-#else
- void insert(const value_type* __first, const value_type* __last)
- { _M_t.insert_equal(__first, __last); }
- void insert(const_iterator __first, const_iterator __last)
- { _M_t.insert_equal(__first, __last); }
-#endif /* _STLP_MEMBER_TEMPLATES */
- void erase(iterator __pos) { _M_t.erase( __pos ); }
- size_type erase(const key_type& __x) { return _M_t.erase(__x); }
- void erase(iterator __first, iterator __last) { _M_t.erase( __first, __last ); }
- void clear() { _M_t.clear(); }
-
- // multiset operations:
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __x) { return _M_t.find(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __x) const { return _M_t.count(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __x) { return _M_t.equal_range(__x); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __x) const { return _M_t.equal_range(__x); }
-};
-
-#else
-# include <stl/pointers/_set.h>
-_STLP_BEGIN_NAMESPACE
-#endif /* _STLP_USE_PTR_SPECIALIZATIONS */
-
-#define _STLP_TEMPLATE_HEADER template <class _Key, class _Compare, class _Alloc>
-#define _STLP_TEMPLATE_CONTAINER set<_Key,_Compare,_Alloc>
-#include <stl/_relops_cont.h>
-#undef _STLP_TEMPLATE_CONTAINER
-#define _STLP_TEMPLATE_CONTAINER multiset<_Key,_Compare,_Alloc>
-#include <stl/_relops_cont.h>
-#undef _STLP_TEMPLATE_CONTAINER
-#undef _STLP_TEMPLATE_HEADER
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Key, class _Compare, class _Alloc>
-struct __move_traits<set<_Key,_Compare,_Alloc> > :
- _STLP_PRIV __move_traits_aux<typename set<_Key,_Compare,_Alloc>::_Rep_type>
-{};
-
-template <class _Key, class _Compare, class _Alloc>
-struct __move_traits<multiset<_Key,_Compare,_Alloc> > :
- _STLP_PRIV __move_traits_aux<typename multiset<_Key,_Compare,_Alloc>::_Rep_type>
-{};
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_SET_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_slist.h b/stl/_slist.h
deleted file mode 100644
index b0d941a..0000000
--- a/stl/_slist.h
+++ /dev/null
@@ -1,906 +0,0 @@
-/*
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_SLIST_H
-#define _STLP_INTERNAL_SLIST_H
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-# include <stl/_alloc.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ITERATOR_H
-# include <stl/_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CONSTRUCT_H
-# include <stl/_construct.h>
-#endif
-
-#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
-# include <stl/_function_base.h>
-#endif
-
-#ifndef _STLP_INTERNAL_SLIST_BASE_H
-# include <stl/_slist_base.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Tp>
-class _Slist_node : public _Slist_node_base {
-public:
- _Tp _M_data;
- __TRIVIAL_STUFF(_Slist_node)
-};
-
-struct _Slist_iterator_base {
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef forward_iterator_tag iterator_category;
-
- _Slist_node_base *_M_node;
-
- _Slist_iterator_base(_Slist_node_base *__x) : _M_node(__x) {}
-
- void _M_incr() {
- _M_node = _M_node->_M_next;
- }
-};
-
-template <class _Tp, class _Traits>
-class _Slist_iterator : public _Slist_iterator_base {
-public:
- typedef typename _Traits::value_type value_type;
- typedef typename _Traits::pointer pointer;
- typedef typename _Traits::reference reference;
- typedef forward_iterator_tag iterator_category;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- typedef _Slist_iterator<_Tp, _Traits> _Self;
- typedef typename _Traits::_NonConstTraits _NonConstTraits;
- typedef _Slist_iterator<_Tp, _NonConstTraits> iterator;
- typedef typename _Traits::_ConstTraits _ConstTraits;
- typedef _Slist_iterator<_Tp, _ConstTraits> const_iterator;
-
- typedef _Slist_node<value_type> _Node;
-
- explicit _Slist_iterator(_Slist_node_base *__x) : _Slist_iterator_base(__x) {}
- _Slist_iterator() : _Slist_iterator_base(0) {}
- //copy constructor for iterator and constructor from iterator for const_iterator
- _Slist_iterator(const iterator& __x) : _Slist_iterator_base(__x._M_node) {}
-
- reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; }
-
- _STLP_DEFINE_ARROW_OPERATOR
-
- _Self& operator++() {
- _M_incr();
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- _M_incr();
- return __tmp;
- }
-
- bool operator==(const_iterator __y ) const {
- return this->_M_node == __y._M_node;
- }
- bool operator!=(const_iterator __y ) const {
- return this->_M_node != __y._M_node;
- }
-};
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-_STLP_MOVE_TO_STD_NAMESPACE
-template <class _Tp, class _Traits>
-struct __type_traits<_STLP_PRIV _Slist_iterator<_Tp, _Traits> > {
- typedef __false_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __false_type is_POD_type;
-};
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
-_STLP_MOVE_TO_STD_NAMESPACE
-template <class _Tp, class _Traits>
-inline _Tp* _STLP_CALL value_type(const _STLP_PRIV _Slist_iterator<_Tp, _Traits>&) { return __STATIC_CAST(_Tp*, 0); }
-inline ptrdiff_t* _STLP_CALL distance_type(const _STLP_PRIV _Slist_iterator_base&) { return 0; }
-inline forward_iterator_tag _STLP_CALL iterator_category(const _STLP_PRIV _Slist_iterator_base&) { return forward_iterator_tag(); }
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif /* OLD_QUERIES */
-
-// Base class that encapsulates details of allocators and simplifies EH
-template <class _Tp, class _Alloc>
-class _Slist_base {
-protected:
- typedef _Slist_node<_Tp> _Node;
- typedef typename _Alloc_traits<_Node,_Alloc>::allocator_type _M_node_allocator_type;
- typedef _Slist_base<_Tp, _Alloc> _Self;
-
-public:
- typedef _STLP_alloc_proxy<_Slist_node_base, _Node, _M_node_allocator_type> _AllocProxy;
-
- _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
- typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type;
-
- _Slist_base(const allocator_type& __a) :
- _M_head(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Slist_node_base() ) {
- _M_head._M_data._M_next = 0;
- }
- _Slist_base(__move_source<_Self> src) :
- _M_head(__move_source<_AllocProxy>(src.get()._M_head)) {
- src.get()._M_head._M_data._M_next = 0;
- }
- ~_Slist_base() { _M_erase_after(&_M_head._M_data, 0); }
-
-protected:
- _Slist_node_base* _M_erase_after(_Slist_node_base* __pos) {
- _Node* __next = __STATIC_CAST(_Node*, __pos->_M_next);
- _Slist_node_base* __next_next = __next->_M_next;
- __pos->_M_next = __next_next;
- _STLP_STD::_Destroy(&__next->_M_data);
- _M_head.deallocate(__next,1);
- return __next_next;
- }
- _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);
-
-public:
- allocator_type get_allocator() const
- { return _STLP_CONVERT_ALLOCATOR((const _M_node_allocator_type&)_M_head, _Tp); }
- _AllocProxy _M_head;
-};
-
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-# define slist _STLP_PTR_IMPL_NAME(slist)
-#elif defined (_STLP_DEBUG)
-# define slist _STLP_NON_DBG_NAME(slist)
-#else
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
-class slist;
-
-#if !defined (slist)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-// helper functions to reduce code duplication
-template <class _Tp, class _Alloc, class _BinaryPredicate>
-void _Slist_unique(slist<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred);
-
-template <class _Tp, class _Alloc, class _StrictWeakOrdering>
-void _Slist_merge(slist<_Tp, _Alloc>& __that, slist<_Tp, _Alloc>& __x,
- _StrictWeakOrdering __comp);
-
-template <class _Tp, class _Alloc, class _StrictWeakOrdering>
-void _Slist_sort(slist<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp);
-
-#if !defined (slist)
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-template <class _Tp, class _Alloc>
-class slist : protected _STLP_PRIV _Slist_base<_Tp,_Alloc>
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (slist)
- , public __stlport_class<slist<_Tp, _Alloc> >
-#endif
-{
-private:
- typedef _STLP_PRIV _Slist_base<_Tp,_Alloc> _Base;
- typedef slist<_Tp,_Alloc> _Self;
-public:
- typedef _Tp value_type;
-
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef forward_iterator_tag _Iterator_category;
-
- typedef _STLP_PRIV _Slist_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
- typedef _STLP_PRIV _Slist_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
-
- _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
- typedef typename _Base::allocator_type allocator_type;
-
-private:
- typedef _STLP_PRIV _Slist_node<_Tp> _Node;
- typedef _STLP_PRIV _Slist_node_base _Node_base;
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- _Node* _M_create_node(const value_type& __x = _Tp()) {
-#else
- _Node* _M_create_node(const value_type& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- _Node* __node = this->_M_head.allocate(1);
- _STLP_TRY {
- _Copy_Construct(&__node->_M_data, __x);
- __node->_M_next = 0;
- }
- _STLP_UNWIND(this->_M_head.deallocate(__node, 1))
- return __node;
- }
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- _Node* _M_create_node() {
- _Node* __node = this->_M_head.allocate(1);
- _STLP_TRY {
- _STLP_STD::_Construct(&__node->_M_data);
- __node->_M_next = 0;
- }
- _STLP_UNWIND(this->_M_head.deallocate(__node, 1))
- return __node;
- }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
-public:
-
- allocator_type get_allocator() const { return _Base::get_allocator(); }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit slist(const allocator_type& __a = allocator_type())
-#else
- slist()
- : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type()) {}
- slist(const allocator_type& __a)
-#endif
- : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) {}
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit slist(size_type __n, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp),
- const allocator_type& __a = allocator_type())
-#else
- explicit slist(size_type __n)
- : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type())
- { _M_insert_after_fill(&this->_M_head._M_data, __n, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
- slist(size_type __n, const value_type& __x)
- : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type())
- { _M_insert_after_fill(&this->_M_head._M_data, __n, __x); }
- slist(size_type __n, const value_type& __x, const allocator_type& __a)
-#endif
- : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
- { _M_insert_after_fill(&this->_M_head._M_data, __n, __x); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- // We don't need any dispatching tricks here, because _M_insert_after_range
- // already does them.
- template <class _InputIterator>
- slist(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
- { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- // VC++ needs this crazyness
- template <class _InputIterator>
- slist(_InputIterator __first, _InputIterator __last)
- : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type())
- { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
-# endif
-#else /* _STLP_MEMBER_TEMPLATES */
- slist(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type() )
- : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
- { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
- slist(const value_type* __first, const value_type* __last,
- const allocator_type& __a = allocator_type())
- : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
- { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- slist(const _Self& __x)
- : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__x.get_allocator())
- { _M_insert_after_range(&this->_M_head._M_data, __x.begin(), __x.end()); }
-
- slist(__move_source<_Self> src)
- : _STLP_PRIV _Slist_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {}
-
- _Self& operator= (const _Self& __x);
-
- ~slist() {}
-
-public:
- // assign(), a generalized assignment member function. Two
- // versions: one that takes a count, and one that takes a range.
- // The range version is a member template, so we dispatch on whether
- // or not the type is an integer.
-
- void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); }
-
-private:
- void _M_fill_assign(size_type __n, const _Tp& __val);
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-public:
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-
-private:
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val,
- const __true_type& /*_IsIntegral*/) {
- _M_fill_assign((size_type) __n, (_Tp) __val);
- }
-
- template <class _InputIter>
- void _M_assign_dispatch(_InputIter __first, _InputIter __last,
- const __false_type& /*_IsIntegral*/) {
-#else
-public:
- void assign(const_pointer __first, const_pointer __last) {
- _Node_base* __prev = &this->_M_head._M_data;
- _Node_base* __node = this->_M_head._M_data._M_next;
- while (__node != 0 && __first != __last) {
- __STATIC_CAST(_Node*, __node)->_M_data = *__first;
- __prev = __node;
- __node = __node->_M_next;
- ++__first;
- }
- if (__first != __last)
- _M_insert_after_range(__prev, __first, __last);
- else
- this->_M_erase_after(__prev, 0);
- }
- void assign(const_iterator __first, const_iterator __last) {
-#endif /* _STLP_MEMBER_TEMPLATES */
- _Node_base* __prev = &this->_M_head._M_data;
- _Node_base* __node = this->_M_head._M_data._M_next;
- while (__node != 0 && __first != __last) {
- __STATIC_CAST(_Node*, __node)->_M_data = *__first;
- __prev = __node;
- __node = __node->_M_next;
- ++__first;
- }
- if (__first != __last)
- _M_insert_after_range(__prev, __first, __last);
- else
- this->_M_erase_after(__prev, 0);
- }
-
-public:
-
- // Experimental new feature: before_begin() returns a
- // non-dereferenceable iterator that, when incremented, yields
- // begin(). This iterator may be used as the argument to
- // insert_after, erase_after, etc. Note that even for an empty
- // slist, before_begin() is not the same iterator as end(). It
- // is always necessary to increment before_begin() at least once to
- // obtain end().
- iterator before_begin() { return iterator(&this->_M_head._M_data); }
- const_iterator before_begin() const
- { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_head._M_data)); }
-
- iterator begin() { return iterator(this->_M_head._M_data._M_next); }
- const_iterator begin() const
- { return const_iterator(this->_M_head._M_data._M_next);}
-
- iterator end() { return iterator(); }
- const_iterator end() const { return const_iterator(); }
-
- size_type size() const
- { return _STLP_PRIV _Sl_global_inst::size(this->_M_head._M_data._M_next); }
-
- size_type max_size() const { return size_type(-1); }
-
- bool empty() const { return this->_M_head._M_data._M_next == 0; }
-
- void swap(_Self& __x) {
- this->_M_head.swap(__x._M_head);
- }
-
-public:
- reference front() { return *begin(); }
- const_reference front() const { return *begin(); }
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_front(const value_type& __x = _Tp()) {
-#else
- void push_front(const value_type& __x) {
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- _STLP_PRIV __slist_make_link(&this->_M_head._M_data, _M_create_node(__x));
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_front() { _STLP_PRIV __slist_make_link(&this->_M_head._M_data, _M_create_node());}
-#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
- void pop_front() {
- _Node* __node = __STATIC_CAST(_Node*, this->_M_head._M_data._M_next);
- this->_M_head._M_data._M_next = __node->_M_next;
- _STLP_STD::_Destroy(&__node->_M_data);
- this->_M_head.deallocate(__node, 1);
- }
-
- iterator previous(const_iterator __pos) {
- return iterator(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node));
- }
- const_iterator previous(const_iterator __pos) const {
- return const_iterator(__CONST_CAST(_Node_base*,
- _STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data,
- __pos._M_node)));
- }
-
-private:
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- _Node* _M_insert_after(_Node_base* __pos, const value_type& __x = _Tp()) {
-#else
- _Node* _M_insert_after(_Node_base* __pos, const value_type& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- return __STATIC_CAST(_Node*, _STLP_PRIV __slist_make_link(__pos, _M_create_node(__x)));
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- _Node* _M_insert_after(_Node_base* __pos) {
- return __STATIC_CAST(_Node*, _STLP_PRIV __slist_make_link(__pos, _M_create_node()));
- }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- void _M_insert_after_fill(_Node_base* __pos,
- size_type __n, const value_type& __x) {
- for (size_type __i = 0; __i < __n; ++__i)
- __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(__x));
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InIter>
- void _M_insert_after_range(_Node_base* __pos,
- _InIter __first, _InIter __last) {
- typedef typename _IsIntegral<_InIter>::_Ret _Integral;
- _M_insert_after_range(__pos, __first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
- const __true_type&) {
- _M_insert_after_fill(__pos, __n, __x);
- }
-
- template <class _InIter>
- void _M_insert_after_range(_Node_base* __pos,
- _InIter __first, _InIter __last,
- const __false_type&) {
-#else /* _STLP_MEMBER_TEMPLATES */
- void _M_insert_after_range(_Node_base* __pos,
- const value_type* __first,
- const value_type* __last) {
- while (__first != __last) {
- __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
- ++__first;
- }
- }
- void _M_insert_after_range(_Node_base* __pos,
- const_iterator __first, const_iterator __last) {
-#endif /* _STLP_MEMBER_TEMPLATES */
- while (__first != __last) {
- __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
- ++__first;
- }
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InIter>
- void _M_splice_after_range(_Node_base* __pos,
- _InIter __first, _InIter __last) {
- typedef typename _IsIntegral<_InIter>::_Ret _Integral;
- _M_splice_after_range(__pos, __first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_splice_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
- const __true_type&) {
- _M_insert_after_fill(__pos, __n, __x);
- }
-
- template <class _InIter>
- void _M_splice_after_range(_Node_base* __pos,
- _InIter __first, _InIter __last,
- const __false_type&) {
-#else /* _STLP_MEMBER_TEMPLATES */
- void _M_splice_after_range(_Node_base* __pos,
- const value_type* __first,
- const value_type* __last) {
- while (__first != __last) {
- __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
- ++__first;
- }
- }
- void _M_splice_after_range(_Node_base* __pos,
- const_iterator __first, const_iterator __last) {
-#endif /* _STLP_MEMBER_TEMPLATES */
- //We use a temporary slist to avoid the auto reference troubles (infinite loop)
- _Self __tmp(__first, __last, this->get_allocator());
- splice_after(iterator(__pos), __tmp);
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InIter>
- void _M_splice_range(_Node_base* __pos,
- _InIter __first, _InIter __last) {
- typedef typename _IsIntegral<_InIter>::_Ret _Integral;
- _M_splice_range(__pos, __first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_splice_range(_Node_base* __pos, _Integer __n, _Integer __x,
- const __true_type&) {
- _M_insert_after_fill(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos),
- __n, __x);
- }
-
- template <class _InIter>
- void _M_splice_range(_Node_base* __pos,
- _InIter __first, _InIter __last,
- const __false_type&) {
-#else /* _STLP_MEMBER_TEMPLATES */
- void _M_splice_range(_Node_base* __pos,
- const value_type* __first,
- const value_type* __last) {
- while (__first != __last) {
- __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
- ++__first;
- }
- }
- void _M_splice_range(_Node_base* __pos,
- const_iterator __first, const_iterator __last) {
-#endif /* _STLP_MEMBER_TEMPLATES */
- //We use a temporary slist to avoid the auto reference troubles (infinite loop)
- _Self __tmp(__first, __last, this->get_allocator());
- splice(iterator(__pos), __tmp);
- }
-
-public:
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert_after(iterator __pos, const value_type& __x = _Tp()) {
-#else
- iterator insert_after(iterator __pos, const value_type& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- return iterator(_M_insert_after(__pos._M_node, __x));
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert_after(iterator __pos) {
- return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
- }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- void insert_after(iterator __pos, size_type __n, const value_type& __x) {
- _M_insert_after_fill(__pos._M_node, __n, __x);
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- // We don't need any dispatching tricks here, because _M_insert_after_range
- // already does them.
- template <class _InIter>
- void insert_after(iterator __pos, _InIter __first, _InIter __last) {
-#else /* _STLP_MEMBER_TEMPLATES */
- void insert_after(iterator __pos,
- const value_type* __first, const value_type* __last) {
- _M_insert_after_range(__pos._M_node, __first, __last);
- }
- void insert_after(iterator __pos,
- const_iterator __first, const_iterator __last) {
-#endif /* _STLP_MEMBER_TEMPLATES */
- _M_splice_after_range(__pos._M_node, __first, __last);
- }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert(iterator __pos, const value_type& __x = _Tp()) {
-#else
- iterator insert(iterator __pos, const value_type& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- return iterator(_M_insert_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
- __x));
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert(iterator __pos) {
- return iterator(_M_insert_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
- _STLP_DEFAULT_CONSTRUCTED(_Tp)));
- }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- void insert(iterator __pos, size_type __n, const value_type& __x) {
- _M_insert_after_fill(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), __n, __x);
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- // We don't need any dispatching tricks here, because _M_insert_after_range
- // already does them.
- template <class _InIter>
- void insert(iterator __pos, _InIter __first, _InIter __last) {
-#else /* _STLP_MEMBER_TEMPLATES */
- void insert(iterator __pos, const value_type* __first,
- const value_type* __last) {
- _M_insert_after_range(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
- __first, __last);
- }
- void insert(iterator __pos, const_iterator __first, const_iterator __last) {
-#endif /* _STLP_MEMBER_TEMPLATES */
- _M_splice_range(__pos._M_node, __first, __last);
- }
-
-public:
- iterator erase_after(iterator __pos)
- { return iterator(this->_M_erase_after(__pos._M_node)); }
- iterator erase_after(iterator __before_first, iterator __last)
- { return iterator(this->_M_erase_after(__before_first._M_node, __last._M_node)); }
-
- iterator erase(iterator __pos)
- { return iterator(this->_M_erase_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node))); }
- iterator erase(iterator __first, iterator __last)
- { return iterator(this->_M_erase_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __first._M_node), __last._M_node)); }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type new_size, const value_type& __x = _Tp());
-#else
- void resize(size_type new_size, const value_type& __x);
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type new_size) { resize(new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- void clear()
- { this->_M_erase_after(&this->_M_head._M_data, 0); }
-
-public:
- // Moves the range [__before_first + 1, __before_last + 1) to *this,
- // inserting it immediately after __pos. This is constant time.
- void splice_after(iterator __pos, _Self& __x,
- iterator __before_first, iterator __before_last) {
- if (__before_first != __before_last) {
- if (this->get_allocator() == __x.get_allocator()) {
- _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node,
- __before_first._M_node, __before_last._M_node);
- }
- else {
- this->insert_after(__pos, iterator(__before_first._M_node->_M_next), iterator(__before_last._M_node->_M_next));
- __x.erase_after(__before_first, ++__before_last);
- }
- }
- }
-
- // Moves the element that follows __prev to *this, inserting it immediately
- // after __pos. This is constant time.
- void splice_after(iterator __pos, _Self& __x, iterator __prev) {
- if (this->get_allocator() == __x.get_allocator()) {
- _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node,
- __prev._M_node, __prev._M_node->_M_next);
- }
- else {
- this->insert_after(__pos, __STATIC_CAST(_Node*, __prev._M_node->_M_next)->_M_data);
- __x.erase_after(__prev);
- }
- }
-
- // Removes all of the elements from the list __x to *this, inserting
- // them immediately after __pos. __x must not be *this. Complexity:
- // linear in __x.size().
- void splice_after(iterator __pos, _Self& __x) {
- if (this->get_allocator() == __x.get_allocator())
- _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node, &__x._M_head._M_data);
- else {
- this->insert_after(__pos, __x.begin(), __x.end());
- __x.clear();
- }
- }
-
- // Linear in distance(begin(), __pos), and linear in __x.size().
- void splice(iterator __pos, _Self& __x) {
- if (__x._M_head._M_data._M_next) {
- if (this->get_allocator() == __x.get_allocator()) {
- _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
- &__x._M_head._M_data,
- _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, 0));
- }
- else {
- insert(__pos, __x.begin(), __x.end());
- __x.clear();
- }
- }
- }
-
- // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i).
- void splice(iterator __pos, _Self& __x, iterator __i) {
- if (this->get_allocator() == __x.get_allocator()) {
- _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
- _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, __i._M_node),
- __i._M_node);
- }
- else {
- insert(__pos, *__i);
- __x.erase(__i);
- }
- }
-
- // Linear in distance(begin(), __pos), in distance(__x.begin(), __first),
- // and in distance(__first, __last).
- void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
- if (__first != __last) {
- if (this->get_allocator() == __x.get_allocator()) {
- _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
- _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, __first._M_node),
- _STLP_PRIV _Sl_global_inst::__previous(__first._M_node, __last._M_node));
- }
- else {
- insert(__pos, __first, __last);
- __x.erase(__first, __last);
- }
- }
- }
-
-public:
- void reverse() {
- if (this->_M_head._M_data._M_next)
- this->_M_head._M_data._M_next = _STLP_PRIV _Sl_global_inst::__reverse(this->_M_head._M_data._M_next);
- }
-
- void remove(const _Tp& __val);
-
- void unique() { _STLP_PRIV _Slist_unique(*this, equal_to<value_type>()); }
- void merge(_Self& __x) { _STLP_PRIV _Slist_merge(*this, __x, less<value_type>()); }
- void sort() { _STLP_PRIV _Slist_sort(*this, less<value_type>()); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _Predicate>
- void remove_if(_Predicate __pred) {
- _Node_base* __cur = &this->_M_head._M_data;
- while (__cur->_M_next) {
- if (__pred(__STATIC_CAST(_Node*, __cur->_M_next)->_M_data))
- this->_M_erase_after(__cur);
- else
- __cur = __cur->_M_next;
- }
- }
-
- template <class _BinaryPredicate>
- void unique(_BinaryPredicate __pred)
- { _STLP_PRIV _Slist_unique(*this, __pred); }
-
- template <class _StrictWeakOrdering>
- void merge(_Self& __x, _StrictWeakOrdering __comp)
- { _STLP_PRIV _Slist_merge(*this, __x, __comp); }
-
- template <class _StrictWeakOrdering>
- void sort(_StrictWeakOrdering __comp)
- { _STLP_PRIV _Slist_sort(*this, __comp); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-};
-
-#if defined (slist)
-# undef slist
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-_STLP_END_NAMESPACE
-
-#if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_slist.c>
-#endif
-
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-# include <stl/pointers/_slist.h>
-#endif
-
-#if defined (_STLP_DEBUG)
-# include <stl/debug/_slist.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _Tp, class _Alloc>
-inline bool _STLP_CALL
-operator == (const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) {
- typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator;
- const_iterator __end1 = _SL1.end();
- const_iterator __end2 = _SL2.end();
-
- const_iterator __i1 = _SL1.begin();
- const_iterator __i2 = _SL2.begin();
- while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
- ++__i1;
- ++__i2;
- }
- return __i1 == __end1 && __i2 == __end2;
-}
-
-#define _STLP_EQUAL_OPERATOR_SPECIALIZED
-#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
-#define _STLP_TEMPLATE_CONTAINER slist<_Tp, _Alloc>
-#include <stl/_relops_cont.h>
-#undef _STLP_TEMPLATE_CONTAINER
-#undef _STLP_TEMPLATE_HEADER
-#undef _STLP_EQUAL_OPERATOR_SPECIALIZED
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp, class _Alloc>
-struct __move_traits<slist<_Tp, _Alloc> > {
- typedef __stlp_movable implemented;
- typedef typename __move_traits<_Alloc>::complete complete;
-};
-
-// Specialization of insert_iterator so that insertions will be constant
-// time rather than linear time.
-template <class _Tp, class _Alloc>
-class insert_iterator<slist<_Tp, _Alloc> > {
-protected:
- typedef slist<_Tp, _Alloc> _Container;
- _Container* _M_container;
- typename _Container::iterator _M_iter;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- insert_iterator(_Container& __x, typename _Container::iterator __i)
- : _M_container(&__x) {
- if (__i == __x.begin())
- _M_iter = __x.before_begin();
- else
- _M_iter = __x.previous(__i);
- }
-
- insert_iterator<_Container>&
- operator = (const typename _Container::value_type& __val) {
- _M_iter = _M_container->insert_after(_M_iter, __val);
- return *this;
- }
-
- insert_iterator<_Container>& operator*() { return *this; }
- insert_iterator<_Container>& operator++() { return *this; }
- insert_iterator<_Container>& operator++(int) { return *this; }
-};
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_SLIST_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_sparc_atomic.h b/stl/_sparc_atomic.h
deleted file mode 100644
index 40d10f3..0000000
--- a/stl/_sparc_atomic.h
+++ /dev/null
@@ -1,62 +0,0 @@
-
-// Currently, SUN CC requires object file
-
-#if defined (__GNUC__)
-
-/*
-** int _STLP_atomic_exchange (__stl_atomic_t *pvalue, __stl_atomic_t value)
-*/
-
-# if defined(__sparc_v9__) || defined (__sparcv9)
-
-# ifdef __arch64__
-
-# define _STLP_EXCH_ASM asm volatile ("casx [%3], %4, %0 ; membar #LoadLoad | #LoadStore " : \
- "=r" (_L_value2), "=m" (*_L_pvalue1) : \
- "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) )
-
-# else /* __arch64__ */
-
-# define _STLP_EXCH_ASM asm volatile ("cas [%3], %4, %0" : \
- "=r" (_L_value2), "=m" (*_L_pvalue1) : \
- "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) )
-# endif
-
-# else /* __sparc_v9__ */
-
-# define _STLP_EXCH_ASM asm volatile ("swap [%3], %0 " : \
- "=r" (_L_value2), "=m" (*_L_pvalue1) : \
- "m" (*_L_pvalue1), "r" (_L_pvalue1), "0" (_L_value2) )
-# endif
-
-
-# define _STLP_ATOMIC_EXCHANGE(__pvalue1, __value2) \
- ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
- register __stl_atomic_t _L_value1, _L_value2 = __value2 ; \
- do { _L_value1 = *_L_pvalue1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
- _L_value1; })
-
-# define _STLP_ATOMIC_INCREMENT(__pvalue1) \
- ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
- register __stl_atomic_t _L_value1, _L_value2; \
- do { _L_value1 = *_L_pvalue1; _L_value2 = _L_value1+1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
- (_L_value2 + 1); })
-
-# define _STLP_ATOMIC_DECREMENT(__pvalue1) \
- ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
- register __stl_atomic_t _L_value1, _L_value2; \
- do { _L_value1 = *_L_pvalue1; _L_value2 = _L_value1-1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
- (_L_value2 - 1); })
-
-# elif ! defined (_STLP_NO_EXTERN_INLINE)
-
-extern "C" __stl_atomic_t _STLP_atomic_exchange(__stl_atomic_t * __x, __stl_atomic_t __v);
-extern "C" void _STLP_atomic_decrement(__stl_atomic_t* i);
-extern "C" void _STLP_atomic_increment(__stl_atomic_t* i);
-
-# define _STLP_ATOMIC_INCREMENT(__x) _STLP_atomic_increment((__stl_atomic_t*)__x)
-# define _STLP_ATOMIC_DECREMENT(__x) _STLP_atomic_decrement((__stl_atomic_t*)__x)
-# define _STLP_ATOMIC_EXCHANGE(__x, __y) _STLP_atomic_exchange((__stl_atomic_t*)__x, (__stl_atomic_t)__y)
-
-# endif
-
diff --git a/stl/_sstream.c b/stl/_sstream.c
deleted file mode 100644
index cbf439f..0000000
--- a/stl/_sstream.c
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_SSTREAM_C
-#define _STLP_SSTREAM_C
-
-#ifndef _STLP_INTERNAL_SSTREAM
-# include <stl/_sstream.h>
-#endif
-
-#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
-// no wint_t is supported for this mode
-# define __BSB_int_type__ int
-# define __BSB_pos_type__ streampos
-#else
-# define __BSB_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
-# define __BSB_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//----------------------------------------------------------------------
-// Non-inline stringbuf member functions.
-
-// Constructors. Note that the base class constructor sets all of the
-// get and area pointers to null.
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_stringbuf<_CharT, _Traits, _Alloc>
- ::basic_stringbuf(ios_base::openmode __mode)
- : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str()
-{}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_stringbuf<_CharT, _Traits, _Alloc>
- ::basic_stringbuf(const basic_string<_CharT, _Traits, _Alloc>& __s, ios_base::openmode __mode)
- : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str(__s)
-{
- _M_set_ptrs();
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_stringbuf<_CharT, _Traits, _Alloc>::~basic_stringbuf()
-{}
-
-// Set the underlying string to a new value.
-template <class _CharT, class _Traits, class _Alloc>
-void
-basic_stringbuf<_CharT, _Traits, _Alloc>::str(const basic_string<_CharT, _Traits, _Alloc>& __s)
-{
- _M_str = __s;
- _M_set_ptrs();
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-void
-basic_stringbuf<_CharT, _Traits, _Alloc>::_M_set_ptrs() {
- _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
- _CharT* __data_end = __data_ptr + _M_str.size();
- // The initial read position is the beginning of the string.
- if (_M_mode & ios_base::in) {
- if (_M_mode & ios_base::ate)
- this->setg(__data_ptr, __data_end, __data_end);
- else
- this->setg(__data_ptr, __data_ptr, __data_end);
- }
-
- // The initial write position is the beginning of the string.
- if (_M_mode & ios_base::out) {
- if (_M_mode & (ios_base::app | ios_base::ate))
- this->setp(__data_end, __data_end);
- else
- this->setp(__data_ptr, __data_end);
- }
-}
-
-// Precondition: gptr() >= egptr(). Returns a character, if one is available.
-template <class _CharT, class _Traits, class _Alloc>
-__BSB_int_type__
-basic_stringbuf<_CharT, _Traits, _Alloc>::underflow() {
- return this->gptr() != this->egptr()
- ? _Traits::to_int_type(*this->gptr())
- : _Traits::eof();
-}
-
-// Precondition: gptr() >= egptr().
-template <class _CharT, class _Traits, class _Alloc>
-__BSB_int_type__
-basic_stringbuf<_CharT, _Traits, _Alloc>::uflow() {
- if (this->gptr() != this->egptr()) {
- int_type __c = _Traits::to_int_type(*this->gptr());
- this->gbump(1);
- return __c;
- }
- else
- return _Traits::eof();
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-__BSB_int_type__
-basic_stringbuf<_CharT, _Traits, _Alloc>::pbackfail(int_type __c) {
- if (this->gptr() != this->eback()) {
- if (!_Traits::eq_int_type(__c, _Traits::eof())) {
- if (_Traits::eq(_Traits::to_char_type(__c), this->gptr()[-1])) {
- this->gbump(-1);
- return __c;
- }
- else if (_M_mode & ios_base::out) {
- this->gbump(-1);
- *this->gptr() = _Traits::to_char_type(__c);
- return __c;
- }
- else
- return _Traits::eof();
- }
- else {
- this->gbump(-1);
- return _Traits::not_eof(__c);
- }
- }
- else
- return _Traits::eof();
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-__BSB_int_type__
-basic_stringbuf<_CharT, _Traits, _Alloc>::overflow(int_type __c) {
- // fbp : reverse order of "ifs" to pass Dietmar's test.
- // Apparently, standard allows overflow with eof even for read-only streams.
- if (!_Traits::eq_int_type(__c, _Traits::eof())) {
- if (_M_mode & ios_base::out) {
- if (!(_M_mode & ios_base::in)) {
- // It's a write-only streambuf, so we can use special append buffer.
- if (this->pptr() == this->epptr())
- this->_M_append_buffer();
-
- if (this->pptr() != this->epptr()) {
- *this->pptr() = _Traits::to_char_type(__c);
- this->pbump(1);
- return __c;
- }
- else
- return _Traits::eof();
- }
- else {
- // We're not using a special append buffer, just the string itself.
- if (this->pptr() == this->epptr()) {
- ptrdiff_t __offset = this->gptr() - this->eback();
- _M_str.push_back(_Traits::to_char_type(__c));
-
- _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
- size_t __data_size = _M_str.size();
-
- this->setg(__data_ptr, __data_ptr + __offset, __data_ptr+__data_size);
- this->setp(__data_ptr, __data_ptr + __data_size);
- this->pbump((int)__data_size);
- return __c;
- }
- else {
- *this->pptr() = _Traits::to_char_type(__c);
- this->pbump(1);
- return __c;
- }
- }
- }
- else // Overflow always fails if it's read-only
- return _Traits::eof();
- }
- else // __c is EOF, so we don't have to do anything
- return _Traits::not_eof(__c);
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-streamsize
-basic_stringbuf<_CharT, _Traits, _Alloc>::xsputn(const char_type* __s,
- streamsize __n) {
- streamsize __nwritten = 0;
-
- if ((_M_mode & ios_base::out) && __n > 0) {
- // If the put pointer is somewhere in the middle of the string,
- // then overwrite instead of append.
- if (this->pbase() == _M_str.data() ) {
- ptrdiff_t __avail = _M_str.data() + _M_str.size() - this->pptr();
- if (__avail > __n) {
- _Traits::copy(this->pptr(), __s, __STATIC_CAST(size_t, __n));
- this->pbump((int)__n);
- return __n;
- }
- else {
- _Traits::copy(this->pptr(), __s, __avail);
- __nwritten += __avail;
- __n -= __avail;
- __s += __avail;
- this->setp(_M_Buf, _M_Buf + __STATIC_CAST(int,_S_BufSiz));
- }
- }
-
- // At this point we know we're appending.
- if (_M_mode & ios_base::in) {
- ptrdiff_t __get_offset = this->gptr() - this->eback();
- _M_str.append(__s, __s + __STATIC_CAST(ptrdiff_t, __n));
-
- _CharT* __data_ptr = __CONST_CAST(_CharT*, _M_str.data());
- size_t __data_size = _M_str.size();
-
- this->setg(__data_ptr, __data_ptr + __get_offset, __data_ptr + __data_size);
- this->setp(__data_ptr, __data_ptr + __data_size);
- this->pbump((int)__data_size);
- }
- else {
- _M_append_buffer();
- _M_str.append(__s, __s + __STATIC_CAST(ptrdiff_t, __n));
- }
-
- __nwritten += __n;
- }
-
- return __nwritten;
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-streamsize
-basic_stringbuf<_CharT, _Traits, _Alloc>::_M_xsputnc(char_type __c,
- streamsize __n) {
- streamsize __nwritten = 0;
-
- if ((_M_mode & ios_base::out) && __n > 0) {
- // If the put pointer is somewhere in the middle of the string,
- // then overwrite instead of append.
- if (this->pbase() == _M_str.data()) {
- ptrdiff_t __avail = _M_str.data() + _M_str.size() - this->pptr();
- if (__avail > __n) {
- _Traits::assign(this->pptr(), __STATIC_CAST(size_t, __n), __c);
- this->pbump(__STATIC_CAST(int, __n));
- return __n;
- }
- else {
- _Traits::assign(this->pptr(), __avail, __c);
- __nwritten += __avail;
- __n -= __avail;
- this->setp(_M_Buf, _M_Buf + __STATIC_CAST(int,_S_BufSiz));
- }
- }
-
- // At this point we know we're appending.
- size_t __app_size = sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))
- : __STATIC_CAST(size_t, __n);
- if (this->_M_mode & ios_base::in) {
- ptrdiff_t __get_offset = this->gptr() - this->eback();
- _M_str.append(__app_size, __c);
-
- _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
- size_t __data_size = _M_str.size();
-
- this->setg(__data_ptr, __data_ptr + __get_offset, __data_ptr + __data_size);
- this->setp(__data_ptr, __data_ptr + __data_size);
- this->pbump((int)__data_size);
- }
- else {
- _M_append_buffer();
- _M_str.append(__app_size, __c);
- }
-
- __nwritten += __app_size;
- }
-
- return __nwritten;
-}
-
-// According to the C++ standard the effects of setbuf are implementation
-// defined, except that setbuf(0, 0) has no effect. In this implementation,
-// setbuf(<anything>, n), for n > 0, calls reserve(n) on the underlying
-// string.
-template <class _CharT, class _Traits, class _Alloc>
-basic_streambuf<_CharT, _Traits>*
-basic_stringbuf<_CharT, _Traits, _Alloc>::setbuf(_CharT*, streamsize __n) {
- if (__n > 0) {
- bool __do_get_area = false;
- bool __do_put_area = false;
- ptrdiff_t __offg = 0;
- ptrdiff_t __offp = 0;
-
- if (this->pbase() == _M_str.data()) {
- __do_put_area = true;
- __offp = this->pptr() - this->pbase();
- }
-
- if (this->eback() == _M_str.data()) {
- __do_get_area = true;
- __offg = this->gptr() - this->eback();
- }
-
- if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))
- _M_append_buffer();
-
- _M_str.reserve(sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))
- : __STATIC_CAST(size_t, __n));
-
- _CharT* __data_ptr = __CONST_CAST(_CharT*, _M_str.data());
- size_t __data_size = _M_str.size();
-
- if (__do_get_area) {
- this->setg(__data_ptr, __data_ptr + __offg, __data_ptr + __data_size);
- }
-
- if (__do_put_area) {
- this->setp(__data_ptr, __data_ptr + __data_size);
- this->pbump((int)__offp);
- }
- }
-
- return this;
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-__BSB_pos_type__
-basic_stringbuf<_CharT, _Traits, _Alloc>
- ::seekoff(off_type __off,
- ios_base::seekdir __dir,
- ios_base::openmode __mode) {
- __mode &= _M_mode;
-
- bool __imode = (__mode & ios_base::in) != 0;
- bool __omode = (__mode & ios_base::out) != 0;
-
- if ( !(__imode || __omode) )
- return pos_type(off_type(-1));
-
- if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) )
- return pos_type(off_type(-1));
-
- if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))
- _M_append_buffer();
-
- streamoff __newoff;
- switch(__dir) {
- case ios_base::beg:
- __newoff = 0;
- break;
- case ios_base::end:
- __newoff = _M_str.size();
- break;
- case ios_base::cur:
- __newoff = __imode ? this->gptr() - this->eback() : this->pptr() - this->pbase();
- break;
- default:
- return pos_type(off_type(-1));
- }
-
- __off += __newoff;
-
- if (__imode) {
- ptrdiff_t __n = this->egptr() - this->eback();
-
- if (__off < 0 || __off > __n)
- return pos_type(off_type(-1));
- this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __off),
- this->eback() + __STATIC_CAST(ptrdiff_t, __n));
- }
-
- if (__omode) {
- ptrdiff_t __n = this->epptr() - this->pbase();
-
- if (__off < 0 || __off > __n)
- return pos_type(off_type(-1));
- this->setp(this->pbase(), this->pbase() + __n);
- this->pbump((int)__off);
- }
-
- return pos_type(__off);
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-__BSB_pos_type__
-basic_stringbuf<_CharT, _Traits, _Alloc>
- ::seekpos(pos_type __pos, ios_base::openmode __mode) {
- __mode &= _M_mode;
-
- bool __imode = (__mode & ios_base::in) != 0;
- bool __omode = (__mode & ios_base::out) != 0;
-
- if ( !(__imode || __omode) )
- return pos_type(off_type(-1));
-
- if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) )
- return pos_type(off_type(-1));
-
- const off_type __n = __pos - pos_type(off_type(0));
- if ((_M_mode & ios_base::out) && !(_M_mode & ios_base::in))
- _M_append_buffer();
-
- if (__imode) {
- if (__n < 0 || __n > this->egptr() - this->eback())
- return pos_type(off_type(-1));
- this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __n), this->egptr());
- }
-
- if (__omode) {
- if (__n < 0 || size_t(__n) > _M_str.size())
- return pos_type(off_type(-1));
-
- _CharT* __data_ptr = __CONST_CAST(_CharT*,_M_str.data());
- size_t __data_size = _M_str.size();
-
- this->setp(__data_ptr, __data_ptr+__data_size);
- this->pbump((int)__n);
- }
-
- return __pos;
-}
-
-// This is declared as a const member function because it is
-// called by basic_stringbuf<>::str(). Precondition: this is a
-// write-only stringbuf. We can't use an output buffer for read-
-// write stringbufs. Postcondition: pptr is reset to the beginning
-// of the buffer.
-template <class _CharT, class _Traits, class _Alloc>
-void basic_stringbuf<_CharT, _Traits, _Alloc>::_M_append_buffer() const {
- // Do we have a buffer to append?
- if (this->pbase() == this->_M_Buf && this->pptr() != this->_M_Buf) {
- basic_stringbuf<_CharT, _Traits, _Alloc>* __this = __CONST_CAST(_Self*,this);
- __this->_M_str.append((const _CharT*)this->pbase(), (const _CharT*)this->pptr());
-#ifndef __MWERKS__
- __this->setp(__CONST_CAST(_CharT*,_M_Buf),
- __CONST_CAST(_CharT*,_M_Buf + __STATIC_CAST(int,_S_BufSiz)));
-#else // CodeWarrior treat const char * and const char [8] as different types
- __this->setp((_CharT*)_M_Buf,
- (_CharT*)(_M_Buf + __STATIC_CAST(int,_S_BufSiz)));
-#endif
- }
-
- // Have we run off the end of the string?
- else if (this->pptr() == this->epptr()) {
- basic_stringbuf<_CharT, _Traits, _Alloc>* __this = __CONST_CAST(_Self*,this);
-#ifndef __MWERKS__
- __this->setp(__CONST_CAST(_CharT*,_M_Buf),
- __CONST_CAST(_CharT*,_M_Buf + __STATIC_CAST(int,_S_BufSiz)));
-#else // CodeWarrior treat const char * and const char [8] as different types
- __this->setp((_CharT*)_M_Buf,
- (_CharT*)(_M_Buf + __STATIC_CAST(int,_S_BufSiz)));
-#endif
- }
-}
-
-//----------------------------------------------------------------------
-// Non-inline istringstream member functions.
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_istringstream<_CharT, _Traits, _Alloc>
- ::basic_istringstream(ios_base::openmode __mode)
- : basic_istream<_CharT, _Traits>(0),
- _M_buf(__mode | ios_base::in) {
- this->init(&_M_buf);
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_istringstream<_CharT, _Traits, _Alloc>
- ::basic_istringstream(const _String& __str,ios_base::openmode __mode)
- : basic_istream<_CharT, _Traits>(0),
- _M_buf(__str, __mode | ios_base::in) {
- this->init(&_M_buf);
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_istringstream<_CharT, _Traits, _Alloc>::~basic_istringstream()
-{}
-
-//----------------------------------------------------------------------
-// Non-inline ostringstream member functions.
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_ostringstream<_CharT, _Traits, _Alloc>
- ::basic_ostringstream(ios_base::openmode __mode)
- : basic_ostream<_CharT, _Traits>(0),
- _M_buf(__mode | ios_base::out) {
- this->init(&_M_buf);
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_ostringstream<_CharT, _Traits, _Alloc>
- ::basic_ostringstream(const _String& __str, ios_base::openmode __mode)
- : basic_ostream<_CharT, _Traits>(0),
- _M_buf(__str, __mode | ios_base::out) {
- this->init(&_M_buf);
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_ostringstream<_CharT, _Traits, _Alloc>::~basic_ostringstream()
-{}
-
-//----------------------------------------------------------------------
-// Non-inline stringstream member functions.
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_stringstream<_CharT, _Traits, _Alloc>
- ::basic_stringstream(ios_base::openmode __mode)
- : basic_iostream<_CharT, _Traits>(0), _M_buf(__mode) {
- this->init(&_M_buf);
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_stringstream<_CharT, _Traits, _Alloc>
- ::basic_stringstream(const _String& __str, ios_base::openmode __mode)
- : basic_iostream<_CharT, _Traits>(0), _M_buf(__str, __mode) {
- this->init(&_M_buf);
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_stringstream<_CharT, _Traits, _Alloc>::~basic_stringstream()
-{}
-
-_STLP_END_NAMESPACE
-
-# undef __BSB_int_type__
-# undef __BSB_pos_type__
-
-#endif /* _STLP_SSTREAM_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_sstream.h b/stl/_sstream.h
deleted file mode 100644
index 8239648..0000000
--- a/stl/_sstream.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-
-// This header defines classes basic_stringbuf, basic_istringstream,
-// basic_ostringstream, and basic_stringstream. These classes
-// represent streamsbufs and streams whose sources or destinations are
-// C++ strings.
-
-#ifndef _STLP_INTERNAL_SSTREAM
-#define _STLP_INTERNAL_SSTREAM
-
-#ifndef _STLP_INTERNAL_STREAMBUF
-# include <stl/_streambuf.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ISTREAM
-# include <stl/_istream.h> // Includes <ostream>, <ios>, <iosfwd>
-#endif
-
-#ifndef _STLP_INTERNAL_STRING_H
-# include <stl/_string.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//----------------------------------------------------------------------
-// This version of basic_stringbuf relies on the internal details of
-// basic_string. It relies on the fact that, in this implementation,
-// basic_string's iterators are pointers. It also assumes (as allowed
-// by the standard) that _CharT is a POD type.
-
-// We have a very small buffer for the put area, just so that we don't
-// have to use append() for every sputc. Conceptually, the buffer
-// immediately follows the end of the underlying string. We use this
-// buffer when appending to write-only streambufs, but we don't use it
-// for read-write streambufs.
-
-template <class _CharT, class _Traits, class _Alloc>
-class basic_stringbuf : public basic_streambuf<_CharT, _Traits> {
-public: // Typedefs.
- typedef _CharT char_type;
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::pos_type pos_type;
- typedef typename _Traits::off_type off_type;
- typedef _Traits traits_type;
-
- typedef basic_streambuf<_CharT, _Traits> _Base;
- typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Self;
- typedef basic_string<_CharT, _Traits, _Alloc> _String;
-
-public: // Constructors, destructor.
- explicit basic_stringbuf(ios_base::openmode __mode
- = ios_base::in | ios_base::out);
- explicit basic_stringbuf(const _String& __s, ios_base::openmode __mode
- = ios_base::in | ios_base::out);
- virtual ~basic_stringbuf();
-
-public: // Get or set the string.
- _String str() const { _M_append_buffer(); return _M_str; }
- void str(const _String& __s);
-
-protected: // Overridden virtual member functions.
- virtual int_type underflow();
- virtual int_type uflow();
- virtual int_type pbackfail(int_type __c);
- virtual int_type overflow(int_type __c);
- int_type pbackfail() {return pbackfail(_Traits::eof());}
- int_type overflow() {return overflow(_Traits::eof());}
-
- virtual streamsize xsputn(const char_type* __s, streamsize __n);
- virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
-
- virtual _Base* setbuf(_CharT* __buf, streamsize __n);
- virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
- ios_base::openmode __mode
- = ios_base::in | ios_base::out);
- virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
- = ios_base::in | ios_base::out);
-
-private: // Helper functions.
- // Append the internal buffer to the string if necessary.
- void _M_append_buffer() const;
- void _M_set_ptrs();
-
-private:
- ios_base::openmode _M_mode;
- mutable basic_string<_CharT, _Traits, _Alloc> _M_str;
-
- enum _JustName { _S_BufSiz = 8 };
- _CharT _M_Buf[ 8 /* _S_BufSiz */];
-};
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf<char, char_traits<char>, allocator<char> >;
-# if !defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
-# endif
-#endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-//----------------------------------------------------------------------
-// Class basic_istringstream, an input stream that uses a stringbuf.
-
-template <class _CharT, class _Traits, class _Alloc>
-class basic_istringstream : public basic_istream<_CharT, _Traits> {
-public: // Typedefs
- typedef typename _Traits::char_type char_type;
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::pos_type pos_type;
- typedef typename _Traits::off_type off_type;
- typedef _Traits traits_type;
-
- typedef basic_ios<_CharT, _Traits> _Basic_ios;
- typedef basic_istream<_CharT, _Traits> _Base;
- typedef basic_string<_CharT, _Traits, _Alloc> _String;
- typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf;
-
-public: // Constructors, destructor.
- basic_istringstream(ios_base::openmode __mode = ios_base::in);
- basic_istringstream(const _String& __str,
- ios_base::openmode __mode = ios_base::in);
- ~basic_istringstream();
-
-public: // Member functions
-
- basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
- { return __CONST_CAST(_Buf*,&_M_buf); }
-
- _String str() const { return _M_buf.str(); }
- void str(const _String& __s) { _M_buf.str(__s); }
-
-private:
- basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
-
-#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
- typedef basic_istringstream<_CharT, _Traits> _Self;
- //explicitely defined as private to avoid warnings:
- basic_istringstream(_Self const&);
- _Self& operator = (_Self const&);
-#endif
-};
-
-
-//----------------------------------------------------------------------
-// Class basic_ostringstream, an output stream that uses a stringbuf.
-
-template <class _CharT, class _Traits, class _Alloc>
-class basic_ostringstream : public basic_ostream<_CharT, _Traits> {
-public: // Typedefs
- typedef typename _Traits::char_type char_type;
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::pos_type pos_type;
- typedef typename _Traits::off_type off_type;
- typedef _Traits traits_type;
-
- typedef basic_ios<_CharT, _Traits> _Basic_ios;
- typedef basic_ostream<_CharT, _Traits> _Base;
- typedef basic_string<_CharT, _Traits, _Alloc> _String;
- typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf;
-
-public: // Constructors, destructor.
- basic_ostringstream(ios_base::openmode __mode = ios_base::out);
- basic_ostringstream(const _String& __str,
- ios_base::openmode __mode = ios_base::out);
- ~basic_ostringstream();
-
-public: // Member functions.
-
- basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
- { return __CONST_CAST(_Buf*,&_M_buf); }
-
- _String str() const { return _M_buf.str(); }
- void str(const _String& __s) { _M_buf.str(__s); } // dwa 02/07/00 - BUG STOMPER DAVE
-
-
-private:
- basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
-
-#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
- typedef basic_ostringstream<_CharT, _Traits> _Self;
- //explicitely defined as private to avoid warnings:
- basic_ostringstream(_Self const&);
- _Self& operator = (_Self const&);
-#endif
-};
-
-
-//----------------------------------------------------------------------
-// Class basic_stringstream, a bidirectional stream that uses a stringbuf.
-
-template <class _CharT, class _Traits, class _Alloc>
-class basic_stringstream : public basic_iostream<_CharT, _Traits> {
-public: // Typedefs
- typedef typename _Traits::char_type char_type;
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::pos_type pos_type;
- typedef typename _Traits::off_type off_type;
- typedef _Traits traits_type;
-
- typedef basic_ios<_CharT, _Traits> _Basic_ios;
- typedef basic_iostream<_CharT, _Traits> _Base;
- typedef basic_string<_CharT, _Traits, _Alloc> _String;
- typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf;
-
- typedef ios_base::openmode openmode;
-
-public: // Constructors, destructor.
- basic_stringstream(openmode __mod = ios_base::in | ios_base::out);
- basic_stringstream(const _String& __str,
- openmode __mod = ios_base::in | ios_base::out);
- ~basic_stringstream();
-
-public: // Member functions.
-
- basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
- { return __CONST_CAST(_Buf*,&_M_buf); }
-
- _String str() const { return _M_buf.str(); }
- void str(const _String& __s) { _M_buf.str(__s); }
-
-private:
- basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
-
-#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
- typedef basic_stringstream<_CharT, _Traits> _Self;
- //explicitely defined as private to avoid warnings:
- basic_stringstream(_Self const&);
- _Self& operator = (_Self const&);
-#endif
-};
-
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream<char, char_traits<char>, allocator<char> >;
-_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream<char, char_traits<char>, allocator<char> >;
-_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream<char, char_traits<char>, allocator<char> >;
-# if !defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
-_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
-_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
-# endif
-#endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_sstream.c>
-#endif
-
-#endif /* _STLP_INTERNAL_SSTREAM */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_stack.h b/stl/_stack.h
deleted file mode 100644
index 7aa468d..0000000
--- a/stl/_stack.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_STACK_H
-#define _STLP_INTERNAL_STACK_H
-
-#ifndef _STLP_INTERNAL_DEQUE_H
-# include <stl/_deque.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if !defined ( _STLP_LIMITED_DEFAULT_TEMPLATES )
-template <class _Tp, class _Sequence = deque<_Tp> >
-#elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
-# define _STLP_STACK_ARGS _Tp
-template <class _Tp>
-#else
-template <class _Tp, class _Sequence>
-#endif
-class stack
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
-# if defined (_STLP_STACK_ARGS)
- : public __stlport_class<stack<_Tp> >
-# else
- : public __stlport_class<stack<_Tp, _Sequence> >
-# endif
-#endif
-{
-#ifdef _STLP_STACK_ARGS
- typedef deque<_Tp> _Sequence;
- typedef stack<_Tp> _Self;
-#else
- typedef stack<_Tp, _Sequence> _Self;
-#endif
-
-public:
- typedef typename _Sequence::value_type value_type;
- typedef typename _Sequence::size_type size_type;
- typedef _Sequence container_type;
-
- typedef typename _Sequence::reference reference;
- typedef typename _Sequence::const_reference const_reference;
-protected:
- //c is a Standard name (23.2.3.3), do no make it STLport naming convention compliant.
- _Sequence c;
-public:
- stack() : c() {}
- explicit stack(const _Sequence& __s) : c(__s) {}
-
- stack(__move_source<_Self> src)
- : c(_STLP_PRIV _AsMoveSource(src.get().c)) {}
-
- bool empty() const { return c.empty(); }
- size_type size() const { return c.size(); }
- reference top() { return c.back(); }
- const_reference top() const { return c.back(); }
- void push(const value_type& __x) { c.push_back(__x); }
- void pop() { c.pop_back(); }
- const _Sequence& _Get_s() const { return c; }
-};
-
-#ifndef _STLP_STACK_ARGS
-# define _STLP_STACK_ARGS _Tp, _Sequence
-# define _STLP_STACK_HEADER_ARGS class _Tp, class _Sequence
-#else
-# define _STLP_STACK_HEADER_ARGS class _Tp
-#endif
-
-template < _STLP_STACK_HEADER_ARGS >
-inline bool _STLP_CALL operator==(const stack< _STLP_STACK_ARGS >& __x,
- const stack< _STLP_STACK_ARGS >& __y)
-{ return __x._Get_s() == __y._Get_s(); }
-
-template < _STLP_STACK_HEADER_ARGS >
-inline bool _STLP_CALL operator<(const stack< _STLP_STACK_ARGS >& __x,
- const stack< _STLP_STACK_ARGS >& __y)
-{ return __x._Get_s() < __y._Get_s(); }
-
-_STLP_RELOPS_OPERATORS(template < _STLP_STACK_HEADER_ARGS >, stack< _STLP_STACK_ARGS >)
-
-#undef _STLP_STACK_ARGS
-#undef _STLP_STACK_HEADER_ARGS
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp, class _Sequence>
-struct __move_traits<stack<_Tp, _Sequence> > :
- _STLP_PRIV __move_traits_aux<_Sequence>
-{};
-#endif
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_STACK_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_stdexcept_base.h b/stl/_stdexcept_base.h
deleted file mode 100644
index 3bcd849..0000000
--- a/stl/_stdexcept_base.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_STDEXCEPT_BASE
-#define _STLP_INTERNAL_STDEXCEPT_BASE
-
-#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE)
-
-# ifndef _STLP_INTERNAL_EXCEPTION
-# include <stl/_exception.h>
-# endif
-
-# if defined(_STLP_USE_EXCEPTIONS) || \
- !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32))
-
-# ifndef _STLP_INTERNAL_CSTRING
-# include <stl/_cstring.h>
-# endif
-
-# ifndef _STLP_STRING_FWD_H
-# include <stl/_string_fwd.h>
-# endif
-
-# ifndef _STLP_USE_NO_IOSTREAMS
-# define _STLP_OWN_STDEXCEPT 1
-# endif
-
-_STLP_BEGIN_NAMESPACE
-
-/* We disable the 4275 warning for
- * - WinCE where there are only static version of the native C++ runtime.
- * - The MSVC compilers when the STLport user wants to make an STLport dll linked to
- * the static C++ native runtime. In this case the std::exception base class is no more
- * exported from native dll but is used as a base class for the exported __Named_exception
- * class.
- */
-# if defined (_STLP_WCE_NET) || \
- defined (_STLP_USE_DYNAMIC_LIB) && defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
-# define _STLP_DO_WARNING_POP
-# pragma warning (push)
-# pragma warning (disable: 4275) // Non dll interface class 'exception' used as base
- // for dll-interface class '__Named_exception'
-# endif
-
-# if !defined (_STLP_NO_EXCEPTION_HEADER)
-# if !defined (_STLP_EXCEPTION_BASE) && !defined (_STLP_BROKEN_EXCEPTION_CLASS) && \
- defined (_STLP_USE_NAMESPACES) && defined (_STLP_USE_OWN_NAMESPACE)
-using _STLP_VENDOR_EXCEPT_STD::exception;
-# endif
-# endif
-# define _STLP_EXCEPTION_BASE exception
-
-class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE {
-public:
- __Named_exception(const string& __str)
-# ifndef _STLP_USE_NO_IOSTREAMS
- ;
- const char* what() const _STLP_NOTHROW_INHERENTLY;
- ~__Named_exception() _STLP_NOTHROW_INHERENTLY;
-# else
- {
-# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
- strncpy(_M_name, _STLP_PRIV __get_c_string(__str), _S_bufsize);
- _M_name[_S_bufsize - 1] = '\0';
-# else
- strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), _STLP_PRIV __get_c_string(__str), _TRUNCATE);
-# endif
- }
- const char* what() const _STLP_NOTHROW_INHERENTLY { return _M_name; }
-# endif
-
-private:
- enum { _S_bufsize = 256 };
- char _M_name[_S_bufsize];
-};
-
-# if defined (_STLP_DO_WARNING_POP)
-# pragma warning (pop)
-# undef _STLP_DO_WARNING_POP
-# endif
-
-_STLP_END_NAMESPACE
-
-# endif /* Not o32, and no exceptions */
-#endif /* _STLP_STDEXCEPT_SEEN */
-
-#endif /* _STLP_INTERNAL_STDEXCEPT_BASE */
diff --git a/stl/_stlport_version.h b/stl/_stlport_version.h
deleted file mode 100644
index 8f8055b..0000000
--- a/stl/_stlport_version.h
+++ /dev/null
@@ -1,30 +0,0 @@
- /*
- *
- * Copyright (c) 2005
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_STLPORT_VERSION_H
-#define _STLP_STLPORT_VERSION_H
-
-/* The last SGI STL release we merged with */
-#define __SGI_STL 0x330
-
-/* STLport version */
-#define _STLPORT_MAJOR 5
-#define _STLPORT_MINOR 1
-#define _STLPORT_PATCHLEVEL 4
-
-#define _STLPORT_VERSION 0x514
-
-#endif /* _STLP_STLPORT_VERSION_H */
diff --git a/stl/_stream_iterator.h b/stl/_stream_iterator.h
deleted file mode 100644
index 1d1ff3f..0000000
--- a/stl/_stream_iterator.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#if !defined (_STLP_INTERNAL_STREAM_ITERATOR_H) && !defined (_STLP_USE_NO_IOSTREAMS)
-#define _STLP_INTERNAL_STREAM_ITERATOR_H
-
-#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
-# include <stl/_iterator_base.h>
-#endif
-
-// streambuf_iterators predeclarations must appear first
-#ifndef _STLP_IOSFWD
-# include <iosfwd>
-#endif
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
-# include <stl/_ostreambuf_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
-# include <stl/_istreambuf_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ISTREAM
-# include <stl/_istream.h>
-#endif
-
-// istream_iterator and ostream_iterator look very different if we're
-// using new, templatized iostreams than if we're using the old cfront
-// version.
-
-_STLP_BEGIN_NAMESPACE
-
-#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp, class _CharT, class _Traits, class _Dist
-# define __ISI_TMPL_ARGUMENTS _Tp, _CharT, _Traits, _Dist
-template <class _Tp,
- class _CharT = _STLP_DEFAULTCHAR, class _Traits = char_traits<_CharT>,
- class _Dist = ptrdiff_t>
-class istream_iterator : public iterator<input_iterator_tag, _Tp , _Dist,
- const _Tp*, const _Tp& > {
-#else
-# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM)
-# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp
-# define __ISI_TMPL_ARGUMENTS _Tp
-template <class _Tp>
-class istream_iterator : public iterator<input_iterator_tag, _Tp , ptrdiff_t,
- const _Tp*, const _Tp& > {
-# else
-# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp, class _Dist
-# define __ISI_TMPL_ARGUMENTS _Tp, _Dist
-template <class _Tp, _STLP_DFL_TYPE_PARAM(_Dist, ptrdiff_t)>
-class istream_iterator : public iterator<input_iterator_tag, _Tp, _Dist ,
- const _Tp*, const _Tp& > {
-# endif /* _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS */
-#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
-
-#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
- typedef char _CharT;
- typedef char_traits<char> _Traits;
-# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM)
- typedef ptrdiff_t _Dist;
-# endif
-#endif
-
- typedef istream_iterator< __ISI_TMPL_ARGUMENTS > _Self;
-public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef basic_istream<_CharT, _Traits> istream_type;
-
- typedef input_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Dist difference_type;
- typedef const _Tp* pointer;
- typedef const _Tp& reference;
-
- istream_iterator() : _M_stream(0), _M_ok(false), _M_read_done(true) {}
- istream_iterator(istream_type& __s) : _M_stream(&__s), _M_ok(false), _M_read_done(false) {}
-
- reference operator*() const {
- if (!_M_read_done) {
- _M_read();
- }
- return _M_value;
- }
-
- _STLP_DEFINE_ARROW_OPERATOR
-
- _Self& operator++() {
- _M_read();
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- _M_read();
- return __tmp;
- }
-
- bool _M_equal(const _Self& __x) const {
- if (!_M_read_done) {
- _M_read();
- }
- if (!__x._M_read_done) {
- __x._M_read();
- }
- return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream);
- }
-
-private:
- istream_type* _M_stream;
- mutable _Tp _M_value;
- mutable bool _M_ok;
- mutable bool _M_read_done;
-
- void _M_read() const {
- _M_ok = ((_M_stream != 0) && !_M_stream->fail());
- if (_M_ok) {
- *_M_stream >> _M_value;
- _M_ok = !_M_stream->fail();
- }
- _M_read_done = true;
- }
-};
-
-#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-template <class _TpP,
- class _CharT = _STLP_DEFAULTCHAR, class _Traits = char_traits<_CharT> >
-#else
-template <class _TpP>
-#endif
-class ostream_iterator: public iterator<output_iterator_tag, void, void, void, void> {
-#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
- typedef char _CharT;
- typedef char_traits<char> _Traits;
- typedef ostream_iterator<_TpP> _Self;
-#else
- typedef ostream_iterator<_TpP, _CharT, _Traits> _Self;
-#endif
-public:
- typedef _CharT char_type;
- typedef _Traits traits_type;
- typedef basic_ostream<_CharT, _Traits> ostream_type;
-
- typedef output_iterator_tag iterator_category;
-
- ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {}
- ostream_iterator(ostream_type& __s, const _CharT* __c)
- : _M_stream(&__s), _M_string(__c) {}
- _Self& operator=(const _TpP& __val) {
- *_M_stream << __val;
- if (_M_string) *_M_stream << _M_string;
- return *this;
- }
- _Self& operator*() { return *this; }
- _Self& operator++() { return *this; }
- _Self& operator++(int) { return *this; }
-private:
- ostream_type* _M_stream;
- const _CharT* _M_string;
-};
-
-#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
-# if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-template <class _TpP>
-inline output_iterator_tag _STLP_CALL
-iterator_category(const ostream_iterator<_TpP>&) { return output_iterator_tag(); }
-# else
-template <class _TpP, class _CharT, class _Traits>
-inline output_iterator_tag _STLP_CALL
-iterator_category(const ostream_iterator<_TpP, _CharT, _Traits>&) { return output_iterator_tag(); }
-# endif
-#endif
-
-_STLP_END_NAMESPACE
-
-// form-independent definiotion of stream iterators
-_STLP_BEGIN_NAMESPACE
-
-template < __ISI_TMPL_HEADER_ARGUMENTS >
-inline bool _STLP_CALL
-operator==(const istream_iterator< __ISI_TMPL_ARGUMENTS >& __x,
- const istream_iterator< __ISI_TMPL_ARGUMENTS >& __y)
-{ return __x._M_equal(__y); }
-
-#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
-template < __ISI_TMPL_HEADER_ARGUMENTS >
-inline bool _STLP_CALL
-operator!=(const istream_iterator< __ISI_TMPL_ARGUMENTS >& __x,
- const istream_iterator< __ISI_TMPL_ARGUMENTS >& __y)
-{ return !__x._M_equal(__y); }
-#endif
-
-#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
-template < __ISI_TMPL_HEADER_ARGUMENTS >
-inline input_iterator_tag _STLP_CALL
-iterator_category(const istream_iterator< __ISI_TMPL_ARGUMENTS >&)
-{ return input_iterator_tag(); }
-template < __ISI_TMPL_HEADER_ARGUMENTS >
-inline _Tp* _STLP_CALL
-value_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (_Tp*) 0; }
-
-# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM)
-template < __ISI_TMPL_HEADER_ARGUMENTS >
-inline ptrdiff_t* _STLP_CALL
-distance_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (ptrdiff_t*)0; }
-# else
-template < __ISI_TMPL_HEADER_ARGUMENTS >
-inline _Dist* _STLP_CALL
-distance_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (_Dist*)0; }
-# endif /* _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS */
-#endif
-
-_STLP_END_NAMESPACE
-
-#undef __ISI_TMPL_HEADER_ARGUMENTS
-#undef __ISI_TMPL_ARGUMENTS
-
-#endif /* _STLP_INTERNAL_STREAM_ITERATOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_streambuf.h b/stl/_streambuf.h
deleted file mode 100644
index d6df0a7..0000000
--- a/stl/_streambuf.h
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_INTERNAL_STREAMBUF
-#define _STLP_INTERNAL_STREAMBUF
-
-#ifndef _STLP_IOS_BASE_H
-# include <stl/_ios_base.h> // Needed for ios_base bitfield members.
-#endif // <ios_base> includes <iosfwd>.
-
-_STLP_BEGIN_NAMESPACE
-
-//----------------------------------------------------------------------
-// Class basic_streambuf<>, the base class of the streambuf hierarchy.
-
-// A basic_streambuf<> manages an input (get) area and an output (put)
-// area. Each is described by three pointers: a beginning, an end, and a
-// current position. basic_streambuf<> contains some very simple member
-// functions that manipulate those six pointers, but almost all of the real
-// functionality gets delegated to protected virtual member functions.
-// All of the public member functions are inline, and most of the protected
-// member functions are virtual.
-
-// Although basic_streambuf<> is not abstract, it is useful only as a base
-// class. Its virtual member functions have default definitions such that
-// reading from a basic_streambuf<> will always yield EOF, and writing to a
-// basic_streambuf<> will always fail.
-
-// The second template parameter, _Traits, defaults to char_traits<_CharT>.
-// The default is declared in header <iosfwd>, and it isn't declared here
-// because C++ language rules do not allow it to be declared twice.
-
-template <class _CharT, class _Traits>
-class basic_streambuf {
- friend class basic_istream<_CharT, _Traits>;
- friend class basic_ostream<_CharT, _Traits>;
-
-public: // Typedefs.
- typedef _CharT char_type;
- typedef typename _Traits::int_type int_type;
- typedef typename _Traits::pos_type pos_type;
- typedef typename _Traits::off_type off_type;
- typedef _Traits traits_type;
-
-private: // Data members.
-
- char_type* _M_gbegin; // Beginning of get area
- char_type* _M_gnext; // Current position within the get area
- char_type* _M_gend; // End of get area
-
- char_type* _M_pbegin; // Beginning of put area
- char_type* _M_pnext; // Current position within the put area
- char_type* _M_pend; // End of put area
-
- locale _M_locale; // The streambuf's locale object
-
-//public: // Extension: locking, for thread safety.
-// _STLP_mutex _M_lock;
-
-public: // Destructor.
- virtual ~basic_streambuf();
-
-protected: // The default constructor.
- basic_streambuf()
-#if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && defined (_STLP_USE_STATIC_LIB)
- //We make it inline to avoid unresolved symbol.
- : _M_gbegin(0), _M_gnext(0), _M_gend(0),
- _M_pbegin(0), _M_pnext(0), _M_pend(0),
- _M_locale()
- {}
-#else
- ;
-#endif
-
-protected: // Protected interface to the get area.
- char_type* eback() const { return _M_gbegin; } // Beginning
- char_type* gptr() const { return _M_gnext; } // Current position
- char_type* egptr() const { return _M_gend; } // End
-
- void gbump(int __n) { _M_gnext += __n; }
- void setg(char_type* __gbegin, char_type* __gnext, char_type* __gend) {
- _M_gbegin = __gbegin;
- _M_gnext = __gnext;
- _M_gend = __gend;
- }
-
-public:
- // An alternate public interface to the above functions
- // which allows us to avoid using templated friends which
- // are not supported on some compilers.
- char_type* _M_eback() const { return eback(); }
- char_type* _M_gptr() const { return gptr(); }
- char_type* _M_egptr() const { return egptr(); }
- void _M_gbump(int __n) { gbump(__n); }
- void _M_setg(char_type* __gbegin, char_type* __gnext, char_type* __gend)
- { this->setg(__gbegin, __gnext, __gend); }
-
-protected: // Protected interface to the put area
-
- char_type* pbase() const { return _M_pbegin; } // Beginning
- char_type* pptr() const { return _M_pnext; } // Current position
- char_type* epptr() const { return _M_pend; } // End
-
- void pbump(int __n) { _M_pnext += __n; }
- void setp(char_type* __pbegin, char_type* __pend) {
- _M_pbegin = __pbegin;
- _M_pnext = __pbegin;
- _M_pend = __pend;
- }
-
-protected: // Virtual buffer management functions.
-
- virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize);
-
- // Alters the stream position, using an integer offset. In this
- // class seekoff does nothing; subclasses are expected to override it.
- virtual pos_type seekoff(off_type, ios_base::seekdir,
- ios_base::openmode = ios_base::in | ios_base::out);
-
- // Alters the stream position, using a previously obtained streampos. In
- // this class seekpos does nothing; subclasses are expected to override it.
- virtual pos_type
- seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
-
- // Synchronizes (i.e. flushes) the buffer. All subclasses are expected to
- // override this virtual member function.
- virtual int sync();
-
-
-public: // Buffer management.
- basic_streambuf<_CharT, _Traits>* pubsetbuf(char_type* __s, streamsize __n)
- { return this->setbuf(__s, __n); }
-
- pos_type pubseekoff(off_type __offset, ios_base::seekdir __way,
- ios_base::openmode __mod = ios_base::in | ios_base::out)
- { return this->seekoff(__offset, __way, __mod); }
-
- pos_type pubseekpos(pos_type __sp,
- ios_base::openmode __mod = ios_base::in | ios_base::out)
- { return this->seekpos(__sp, __mod); }
-
- int pubsync() { return this->sync(); }
-
-protected: // Virtual get area functions, as defined in
- // 17.5.2.4.3 and 17.5.2.4.4 of the standard.
- // Returns a lower bound on the number of characters that we can read,
- // with underflow, before reaching end of file. (-1 is a special value:
- // it means that underflow will fail.) Most subclasses should probably
- // override this virtual member function.
- virtual streamsize showmanyc();
-
- // Reads up to __n characters. Return value is the number of
- // characters read.
- virtual streamsize xsgetn(char_type* __s, streamsize __n);
-
- // Called when there is no read position, i.e. when gptr() is null
- // or when gptr() >= egptr(). Subclasses are expected to override
- // this virtual member function.
- virtual int_type underflow();
-
- // Similar to underflow(), but used for unbuffered input. Most
- // subclasses should probably override this virtual member function.
- virtual int_type uflow();
-
- // Called when there is no putback position, i.e. when gptr() is null
- // or when gptr() == eback(). All subclasses are expected to override
- // this virtual member function.
- virtual int_type pbackfail(int_type = traits_type::eof());
-
-protected: // Virtual put area functions, as defined in
- // 27.5.2.4.5 of the standard.
-
- // Writes up to __n characters. Return value is the number of characters
- // written.
- virtual streamsize xsputn(const char_type* __s, streamsize __n);
-
- // Extension: writes up to __n copies of __c. Return value is the number
- // of characters written.
- virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
-
- // Called when there is no write position. All subclasses are expected to
- // override this virtual member function.
- virtual int_type overflow(int_type = traits_type::eof());
-
-public: // Public members for writing characters.
- // Write a single character.
- int_type sputc(char_type __c) {
- return ((_M_pnext < _M_pend) ? _Traits::to_int_type(*_M_pnext++ = __c)
- : this->overflow(_Traits::to_int_type(__c)));
- }
-
- // Write __n characters.
- streamsize sputn(const char_type* __s, streamsize __n)
- { return this->xsputn(__s, __n); }
-
- // Extension: write __n copies of __c.
- streamsize _M_sputnc(char_type __c, streamsize __n)
- { return this->_M_xsputnc(__c, __n); }
-
-private: // Helper functions.
- int_type _M_snextc_aux();
-
-public: // Public members for reading characters.
- streamsize in_avail() {
- return (_M_gnext < _M_gend) ? (_M_gend - _M_gnext) : this->showmanyc();
- }
-
- // Advance to the next character and return it.
- int_type snextc() {
- return ( _M_gend - _M_gnext > 1 ?
- _Traits::to_int_type(*++_M_gnext) :
- this->_M_snextc_aux());
- }
-
- // Return the current character and advance to the next.
- int_type sbumpc() {
- return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext++)
- : this->uflow();
- }
-
- // Return the current character without advancing to the next.
- int_type sgetc() {
- return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext)
- : this->underflow();
- }
-
- streamsize sgetn(char_type* __s, streamsize __n)
- { return this->xsgetn(__s, __n); }
-
- int_type sputbackc(char_type __c) {
- return ((_M_gbegin < _M_gnext) && _Traits::eq(__c, *(_M_gnext - 1)))
- ? _Traits::to_int_type(*--_M_gnext)
- : this->pbackfail(_Traits::to_int_type(__c));
- }
-
- int_type sungetc() {
- return (_M_gbegin < _M_gnext)
- ? _Traits::to_int_type(*--_M_gnext)
- : this->pbackfail();
- }
-
-protected: // Virtual locale functions.
-
- // This is a hook, called by pubimbue() just before pubimbue()
- // sets the streambuf's locale to __loc. Note that imbue should
- // not (and cannot, since it has no access to streambuf's private
- // members) set the streambuf's locale itself.
- virtual void imbue(const locale&);
-
-public: // Locale-related functions.
- locale pubimbue(const locale&);
- locale getloc() const { return _M_locale; }
-
-#if !defined (_STLP_NO_ANACHRONISMS)
- void stossc() { this->sbumpc(); }
-#endif
-#if defined (__MVS__) || defined (__OS400__)
-private: // Data members.
-
- char_type* _M_gbegin; // Beginning of get area
- char_type* _M_gnext; // Current position within the get area
- char_type* _M_gend; // End of get area
-
- char_type* _M_pbegin; // Beginning of put area
- char_type* _M_pnext; // Current position within the put area
- char_type* _M_pend; // End of put area
-#endif
-};
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS basic_streambuf<char, char_traits<char> >;
-# if !defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS basic_streambuf<wchar_t, char_traits<wchar_t> >;
-# endif // _STLP_NO_WCHAR_T
-#endif // _STLP_USE_TEMPLATE_EXPORT
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_streambuf.c>
-#endif
-
-#endif
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_string.c b/stl/_string.c
deleted file mode 100644
index 5dbc628..0000000
--- a/stl/_string.c
+++ /dev/null
@@ -1,691 +0,0 @@
-/*
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_STRING_C
-#define _STLP_STRING_C
-
-#ifndef _STLP_INTERNAL_STRING_H
-# include <stl/_string.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
-# include <stl/_ctraits_fns.h>
-#endif
-
-#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-# define basic_string _STLP_NO_MEM_T_NAME(str)
-#elif defined (_STLP_DEBUG)
-# define basic_string _STLP_NON_DBG_NAME(str)
-#endif
-
-#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
-# define __size_type__ size_t
-# define size_type size_t
-# define iterator _CharT*
-#else
-# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_string<_CharT,_Traits,_Alloc>::size_type
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// A helper class to use a char_traits as a function object.
-template <class _Traits>
-struct _Not_within_traits : public unary_function<typename _Traits::char_type, bool> {
- typedef typename _Traits::char_type _CharT;
- const _CharT* _M_first;
- const _CharT* _M_last;
-
- _Not_within_traits(const _CharT* __f, const _CharT* __l)
- : _M_first(__f), _M_last(__l) {}
-
- bool operator()(const _CharT& __x) const {
- return find_if(_M_first, _M_last,
- _STLP_PRIV _Eq_char_bound<_Traits>(__x)) == _M_last;
- }
-};
-
-// ------------------------------------------------------------
-// Non-inline declarations.
-
-#if !defined (basic_string)
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-// Change the string's capacity so that it is large enough to hold
-// at least __res_arg elements, plus the terminating _CharT(). Note that,
-// if __res_arg < capacity(), this member function may actually decrease
-// the string's capacity.
-template <class _CharT, class _Traits, class _Alloc>
-void basic_string<_CharT,_Traits,_Alloc>::reserve(size_type __res_arg) {
- if (__res_arg > max_size())
- this->_M_throw_length_error();
-
- size_type __n = (max)(__res_arg, size()) + 1;
- if (__n <= capacity() + 1)
- return;
-
- pointer __new_start = this->_M_end_of_storage.allocate(__n, __n);
- pointer __new_finish = __new_start;
-
- _STLP_TRY {
- __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start);
- _M_construct_null(__new_finish);
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start, __new_finish),
- this->_M_end_of_storage.deallocate(__new_start, __n)))
-
- this->_M_destroy_range();
- this->_M_deallocate_block();
- this->_M_reset(__new_start, __new_finish, __new_start + __n);
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_string<_CharT,_Traits,_Alloc>&
-basic_string<_CharT,_Traits,_Alloc>::append(size_type __n, _CharT __c) {
- if (__n > max_size() || size() > max_size() - __n)
- this->_M_throw_length_error();
- if (size() + __n > capacity())
- reserve(size() + (max)(size(), __n));
- if (__n > 0) {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _Traits::assign(this->_M_finish + 1, __n - 1, __c);
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - 1, __c);
- _STLP_TRY {
- _M_construct_null(this->_M_finish + __n);
- }
- _STLP_UNWIND(this->_M_destroy_ptr_range(this->_M_finish + 1, this->_M_finish + __n))
- _Traits::assign(*end(), __c);
- this->_M_finish += __n;
- }
- return *this;
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_string<_CharT, _Traits, _Alloc>&
-basic_string<_CharT, _Traits, _Alloc>::_M_append(const _CharT* __first, const _CharT* __last) {
- if (__first != __last) {
- const size_type __old_size = size();
- ptrdiff_t __n = __last - __first;
- if ((size_type)__n > max_size() || __old_size > max_size() - __n)
- this->_M_throw_length_error();
- if (__old_size + __n > capacity()) {
- size_type __len = __old_size + (max)(__old_size, (size_t) __n) + 1;
- pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
- pointer __new_finish = __new_start;
- _STLP_TRY {
- __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start);
- __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish);
- _M_construct_null(__new_finish);
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
- this->_M_end_of_storage.deallocate(__new_start,__len)))
- this->_M_destroy_range();
- this->_M_deallocate_block();
- this->_M_reset(__new_start, __new_finish, __new_start + __len);
- }
- else {
- const _CharT* __f1 = __first;
- ++__f1;
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _M_copy(__f1, __last, this->_M_Finish() + 1);
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- _STLP_PRIV __ucopy(__f1, __last, this->_M_finish + 1);
- _STLP_TRY {
- _M_construct_null(this->_M_finish + __n);
- }
- _STLP_UNWIND(this->_M_destroy_ptr_range(this->_M_finish + 1, this->_M_finish + __n))
- _Traits::assign(*end(), *__first);
- this->_M_finish += __n;
- }
- }
- return *this;
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_string<_CharT,_Traits,_Alloc>&
-basic_string<_CharT,_Traits,_Alloc>::assign(size_type __n, _CharT __c) {
- if (__n <= size()) {
- _Traits::assign(this->_M_Start(), __n, __c);
- erase(begin() + __n, end());
- }
- else {
- if (__n < capacity()) {
- _Traits::assign(this->_M_Start(), size(), __c);
- append(__n - size(), __c);
- }
- else {
- _Self __str(__n, __c);
- this->swap(__str);
- }
- }
- return *this;
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_string<_CharT,_Traits,_Alloc>&
-basic_string<_CharT,_Traits,_Alloc>::_M_assign(const _CharT* __f, const _CharT* __l) {
- ptrdiff_t __n = __l - __f;
- if (__STATIC_CAST(size_type, __n) <= size()) {
- _Traits::copy(this->_M_Start(), __f, __n);
- erase(begin() + __n, end());
- }
- else {
- _Traits::copy(this->_M_Start(), __f, size());
- _M_append(__f + size(), __l);
- }
- return *this;
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-_CharT* basic_string<_CharT,_Traits,_Alloc> ::_M_insert_aux(_CharT* __p,
- _CharT __c) {
- pointer __new_pos = __p;
- if (this->_M_finish + 1 < this->_M_end_of_storage._M_data) {
- _M_construct_null(this->_M_finish + 1);
- _Traits::move(__p + 1, __p, this->_M_finish - __p);
- _Traits::assign(*__p, __c);
- ++this->_M_finish;
- }
- else {
- const size_type __old_len = size();
- size_type __len = __old_len + (max)(__old_len, __STATIC_CAST(size_type,1)) + 1;
- pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
- pointer __new_finish = __new_start;
- _STLP_TRY {
- __new_pos = _STLP_PRIV __ucopy(this->_M_Start(), __p, __new_start);
- _Copy_Construct(__new_pos, __c);
- __new_finish = __new_pos + 1;
- __new_finish = _STLP_PRIV __ucopy(__p, this->_M_finish, __new_finish);
- _M_construct_null(__new_finish);
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
- this->_M_end_of_storage.deallocate(__new_start,__len)))
- this->_M_destroy_range();
- this->_M_deallocate_block();
- this->_M_reset(__new_start, __new_finish, __new_start + __len);
- }
- return __new_pos;
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-void basic_string<_CharT,_Traits,_Alloc>::insert(iterator __pos,
- size_t __n, _CharT __c) {
- if (__n != 0) {
- if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n + 1) {
- const size_type __elems_after = this->_M_finish - __pos;
- pointer __old_finish = this->_M_finish;
- if (__elems_after >= __n) {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _M_copy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1,
- this->_M_finish + 1);
- this->_M_finish += __n;
- _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
- _Traits::assign(__pos, __n, __c);
- }
- else {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _Traits::assign(this->_M_finish + 1, __n - __elems_after - 1, __c);
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - __elems_after - 1, __c);
- this->_M_finish += __n - __elems_after;
- _STLP_TRY {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _M_copy(__pos, __old_finish + 1, this->_M_finish);
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish);
- this->_M_finish += __elems_after;
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__old_finish + 1, this->_M_finish),
- this->_M_finish = __old_finish))
- _Traits::assign(__pos, __elems_after + 1, __c);
- }
- }
- else {
- const size_type __old_size = size();
- size_type __len = __old_size + (max)(__old_size, __n) + 1;
- pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
- pointer __new_finish = __new_start;
- _STLP_TRY {
- __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start);
- __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __n, __c);
- __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish);
- _M_construct_null(__new_finish);
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
- this->_M_end_of_storage.deallocate(__new_start,__len)))
- this->_M_destroy_range();
- this->_M_deallocate_block();
- this->_M_reset(__new_start, __new_finish, __new_start + __len);
- }
- }
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-void basic_string<_CharT,_Traits,_Alloc>::_M_insert(iterator __pos,
- const _CharT* __first, const _CharT* __last,
- bool __self_ref) {
- //this version has to take care about the auto referencing
- if (__first != __last) {
- const ptrdiff_t __n = __last - __first;
- if (this->_M_end_of_storage._M_data - this->_M_finish >= __n + 1) {
- const ptrdiff_t __elems_after = this->_M_finish - __pos;
- pointer __old_finish = this->_M_finish;
- if (__elems_after >= __n) {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _M_copy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
- this->_M_finish += __n;
- _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
- if (!__self_ref || __last < __pos) {
- _M_copy(__first, __last, __pos);
- }
- else {
- //We have to check that the source buffer hasn't move
- if (__first >= __pos) {
- //The source buffer has move
- __first += __n;
- __last += __n;
- _M_copy(__first, __last, __pos);
- }
- else {
- //The source buffer hasn't move, it has been duplicated
- _M_move(__first, __last, __pos);
- }
- }
- }
- else {
- const_iterator __mid = __first;
- __mid += __elems_after + 1;
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _M_copy(__mid, __last, this->_M_finish + 1);
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- _STLP_PRIV __ucopy(__mid, __last, this->_M_finish + 1);
- this->_M_finish += __n - __elems_after;
- _STLP_TRY {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _M_copy(__pos, __old_finish + 1, this->_M_finish);
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish);
- this->_M_finish += __elems_after;
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__old_finish + 1, this->_M_finish),
- this->_M_finish = __old_finish))
- if (!__self_ref)
- _M_copy(__first, __mid, __pos);
- else
- _M_move(__first, __mid, __pos);
- }
- }
- else {
- const size_type __old_size = size();
- size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(const size_type,__n)) + 1;
- pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
- pointer __new_finish = __new_start;
- _STLP_TRY {
- __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start);
- __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish);
- __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish);
- _M_construct_null(__new_finish);
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
- this->_M_end_of_storage.deallocate(__new_start,__len)))
- this->_M_destroy_range();
- this->_M_deallocate_block();
- this->_M_reset(__new_start, __new_finish, __new_start + __len);
- }
- }
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_string<_CharT,_Traits,_Alloc>&
-basic_string<_CharT,_Traits,_Alloc> ::replace(iterator __first, iterator __last,
- size_type __n, _CharT __c) {
- size_type __len = (size_type)(__last - __first);
-
- if (__len >= __n) {
- _Traits::assign(__first, __n, __c);
- erase(__first + __n, __last);
- }
- else {
- _Traits::assign(__first, __len, __c);
- insert(__last, __n - __len, __c);
- }
- return *this;
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_string<_CharT,_Traits,_Alloc>&
-basic_string<_CharT,_Traits,_Alloc> ::_M_replace(iterator __first, iterator __last,
- const _CharT* __f, const _CharT* __l,
- bool __self_ref) {
- const ptrdiff_t __n = __l - __f;
- const difference_type __len = __last - __first;
- if (__len >= __n) {
- if (!__self_ref || __l < __first || __f >= __last)
- _M_copy(__f, __l, __first);
- else
- _M_move(__f, __l, __first);
- erase(__first + __n, __last);
- }
- else {
- if (!__self_ref || (__f >= __last) || (__l <= __first)) {
- //no overlap:
- const_iterator __m = __f + __len;
- _M_copy(__f, __m, __first);
- _M_insert(__last, __m, __l, false );
- }
- else {
- //we have to take care of overlaping
- if (__f < __first) {
- const_iterator __m = __f + __len;
- //We have to deal with possible reallocation because we do insert first.
- const difference_type __off_dest = __first - this->begin();
- const difference_type __off_src = __f - this->begin();
- _M_insert(__last, __m, __l, true);
- _Traits::move(begin() + __off_dest, begin() + __off_src, __len);
- }
- else {
- const_iterator __m = __f + __len;
- _Traits::move(__first, __f, __len);
- _M_insert(__last, __m, __l, true);
- }
- }
- }
- return *this;
-}
-
-template <class _CharT, class _Traits, class _Alloc> __size_type__
-basic_string<_CharT,_Traits,_Alloc> ::find(const _CharT* __s, size_type __pos,
- size_type __n) const {
- const size_t __len = size();
- if (__pos >= __len || __pos + __n > __len)
- return npos;
- else {
- const_pointer __result =
- _STLP_STD::search(this->_M_Start() + __pos, this->_M_Finish(),
- __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>());
- return __result != this->_M_Finish() ? __result - this->_M_Start() : npos;
- }
-}
-
-template <class _CharT, class _Traits, class _Alloc> __size_type__
-basic_string<_CharT,_Traits,_Alloc> ::find(_CharT __c, size_type __pos) const {
- if (__pos >= size()) /*__pos + 1 > size()*/
- return npos;
- else {
- const_pointer __result =
- _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(),
- _STLP_PRIV _Eq_char_bound<_Traits>(__c));
- return __result != this->_M_Finish() ? __result - this->_M_Start() : npos;
- }
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-__size_type__
-basic_string<_CharT,_Traits,_Alloc>::rfind(const _CharT* __s, size_type __pos, size_type __n) const
-{
- const size_type __len = size();
- if ( __len < __n ) {
- return npos;
- }
- const_pointer __last = this->_M_Start() + (min)( __len - __n, __pos) + __n;
- const_pointer __result = find_end(this->_M_Start(), __last,
- __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>());
- return __result != __last ? __result - this->_M_Start() : npos;
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-__size_type__
-basic_string<_CharT,_Traits,_Alloc>::rfind(_CharT __c, size_type __pos) const
-{
- const size_type __len = size();
- if ( __len < 1 ) {
- return npos;
- }
- const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
- const_reverse_iterator __rresult =
- _STLP_STD::find_if(const_reverse_iterator(__last), rend(),
- _STLP_PRIV _Eq_char_bound<_Traits>(__c));
- return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
-}
-
-template <class _CharT, class _Traits, class _Alloc> __size_type__
-basic_string<_CharT,_Traits,_Alloc> ::find_first_of(const _CharT* __s, size_type __pos,
- size_type __n) const {
- if (__pos >= size()) /*__pos + 1 > size()*/
- return npos;
- else {
- const_iterator __result = _STLP_PRIV __find_first_of(begin() + __pos, end(),
- __s, __s + __n,
- _STLP_PRIV _Eq_traits<_Traits>());
- return __result != end() ? __result - begin() : npos;
- }
-}
-
-template <class _CharT, class _Traits, class _Alloc>
- __size_type__
-basic_string<_CharT,_Traits,_Alloc> ::find_last_of(const _CharT* __s, size_type __pos,
- size_type __n) const
-{
- const size_type __len = size();
- if ( __len < 1 ) {
- return npos;
- }
- const const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
- const const_reverse_iterator __rresult =
- _STLP_PRIV __find_first_of(const_reverse_iterator(__last), rend(),
- __s, __s + __n,
- _STLP_PRIV _Eq_traits<_Traits>());
- return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
-}
-
-
-template <class _CharT, class _Traits, class _Alloc> __size_type__
-basic_string<_CharT,_Traits,_Alloc> ::find_first_not_of(const _CharT* __s, size_type __pos,
- size_type __n) const {
- typedef typename _Traits::char_type _CharType;
- if (__pos >= size()) /*__pos + 1 >= size()*/
- return npos;
- else {
- const_pointer __result = _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(),
- _STLP_PRIV _Not_within_traits<_Traits>(__CONST_CAST(const _CharType*, __s),
- __CONST_CAST(const _CharType*, __s) + __n));
- return __result != this->_M_finish ? __result - this->_M_Start() : npos;
- }
-}
-
-template <class _CharT, class _Traits, class _Alloc> __size_type__
-basic_string<_CharT,_Traits,_Alloc> ::find_first_not_of(_CharT __c, size_type __pos) const {
- if (1 > size())
- return npos;
- else {
- const_pointer __result = _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(),
- _STLP_PRIV _Neq_char_bound<_Traits>(__c));
- return __result != this->_M_finish ? __result - this->_M_Start() : npos;
- }
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-__size_type__
-basic_string<_CharT,_Traits,_Alloc>::find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
-{
- typedef typename _Traits::char_type _CharType;
- const size_type __len = size();
- if ( __len < 1 ) {
- return npos;
- }
- const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
- const_reverse_iterator __rlast = const_reverse_iterator(__last);
- const_reverse_iterator __rresult =
- _STLP_STD::find_if(__rlast, rend(),
- _STLP_PRIV _Not_within_traits<_Traits>((const _CharType*)__s,
- (const _CharType*)__s + __n));
- return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-__size_type__
-basic_string<_CharT, _Traits, _Alloc>::find_last_not_of(_CharT __c, size_type __pos) const
-{
- const size_type __len = size();
- if ( __len < 1 ) {
- return npos;
- }
- const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
- const_reverse_iterator __rlast = const_reverse_iterator(__last);
- const_reverse_iterator __rresult =
- _STLP_STD::find_if(__rlast, rend(),
- _STLP_PRIV _Neq_char_bound<_Traits>(__c));
- return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
-}
-
-#if !defined (basic_string)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-template <class _CharT, class _Traits, class _Alloc>
-void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s,
- _CharT* __buf, size_t __n) {
- if (__n > 0) {
- __n = (min) (__n - 1, __s.size());
- _STLP_STD::copy(__s.begin(), __s.begin() + __n, __buf);
- __buf[__n] = _CharT();
- }
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#include <stl/_range_errors.h>
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// _String_base methods
-template <class _Tp, class _Alloc>
-void _String_base<_Tp,_Alloc>::_M_throw_length_error() const
-{ __stl_throw_length_error("basic_string"); }
-
-template <class _Tp, class _Alloc>
-void _String_base<_Tp, _Alloc>::_M_throw_out_of_range() const
-{ __stl_throw_out_of_range("basic_string"); }
-
-template <class _Tp, class _Alloc>
-void _String_base<_Tp, _Alloc>::_M_allocate_block(size_t __n) {
- if ((__n <= (max_size() + 1)) && (__n > 0)) {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (__n > _DEFAULT_SIZE) {
- this->_M_buffers._M_dynamic_buf = _M_end_of_storage.allocate(__n, __n);
- this->_M_finish = this->_M_buffers._M_dynamic_buf;
- this->_M_end_of_storage._M_data = this->_M_finish + __n;
- }
-#else
- this->_M_start = _M_end_of_storage.allocate(__n, __n);
- this->_M_finish = this->_M_start;
- this->_M_end_of_storage._M_data = this->_M_finish + __n;
-#endif /*_STLP_USE_SHORT_STRING_OPTIM */
- } else {
- this->_M_throw_length_error();
- }
-}
-
-#if !defined (basic_string)
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
-template <class _CharT, class _Traits, class _Alloc>
-basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT* __s)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
- _STLP_FIX_LITERAL_BUG(__s)
- _M_range_initialize(__s, __s + traits_type::length(__s));
-}
-#endif
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT* __s,
- const allocator_type& __a)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
- _STLP_FIX_LITERAL_BUG(__s)
- _M_range_initialize(__s, __s + traits_type::length(__s));
-}
-
-template <class _CharT, class _Traits, class _Alloc>
-basic_string<_CharT, _Traits, _Alloc>::basic_string(const basic_string<_CharT, _Traits, _Alloc> & __s)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(__s.get_allocator())
-{ _M_range_initialize(__s._M_Start(), __s._M_Finish()); }
-
-#if defined (basic_string)
-_STLP_MOVE_TO_STD_NAMESPACE
-# undef basic_string
-#else
-/* If basic_string is defined it means that it won't be the basic_string class
- * exposed to STLport users so npos do not need external linkage.
- */
-# if !defined (_STLP_STATIC_CONST_INIT_BUG)
-# if !defined (__GNUC__) || (__GNUC__ != 2) || (__GNUC_MINOR__ != 96)
-template <class _CharT, class _Traits, class _Alloc>
-const size_t basic_string<_CharT, _Traits, _Alloc>::npos;
-# endif
-# endif
-#endif
-
-_STLP_END_NAMESPACE
-
-#undef __size_type__
-#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
-# undef size_type
-# undef iterator
-#endif
-
-#endif /* _STLP_STRING_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_string.h b/stl/_string.h
deleted file mode 100644
index 928dedd..0000000
--- a/stl/_string.h
+++ /dev/null
@@ -1,1416 +0,0 @@
-/*
- * Copyright (c) 1997-1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_STRING_H
-#define _STLP_INTERNAL_STRING_H
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-# include <stl/_alloc.h>
-#endif
-
-#ifndef _STLP_STRING_FWD_H
-# include <stl/_string_fwd.h>
-#endif
-
-#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
-# include <stl/_function_base.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ITERATOR_H
-# include <stl/_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_UNINITIALIZED_H
-# include <stl/_uninitialized.h>
-#endif
-
-#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
-# include <stl/_string_sum.h>
-#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
-
-#if defined (__MWERKS__) && ! defined (_STLP_USE_OWN_NAMESPACE)
-
-// MSL implementation classes expect to see the definition of streampos
-// when this header is included. We expect this to be fixed in later MSL
-// implementations
-# if !defined( __MSL_CPP__ ) || __MSL_CPP__ < 0x4105
-# include <stl/msl_string.h>
-# endif
-#endif // __MWERKS__
-
-/*
- * Standard C++ string class. This class has performance
- * characteristics very much like vector<>, meaning, for example, that
- * it does not perform reference-count or copy-on-write, and that
- * concatenation of two strings is an O(N) operation.
-
- * There are three reasons why basic_string is not identical to
- * vector.
- * First, basic_string can always stores a null character
- * at the end (macro dependent); this makes it possible for c_str to
- * be a fast operation.
- * Second, the C++ standard requires basic_string to copy elements
- * using char_traits<>::assign, char_traits<>::copy, and
- * char_traits<>::move. This means that all of vector<>'s low-level
- * operations must be rewritten. Third, basic_string<> has a lot of
- * extra functions in its interface that are convenient but, strictly
- * speaking, redundant.
-
- * Additionally, the C++ standard imposes a major restriction: according
- * to the standard, the character type _CharT must be a POD type. This
- * implementation weakens that restriction, and allows _CharT to be a
- * a user-defined non-POD type. However, _CharT must still have a
- * default constructor.
- */
-
-#include <stl/_string_base.h>
-
-_STLP_BEGIN_NAMESPACE
-
-// ------------------------------------------------------------
-// Class basic_string.
-
-// Class invariants:
-// (1) [start, finish) is a valid range.
-// (2) Each iterator in [start, finish) points to a valid object
-// of type value_type.
-// (3) *finish is a valid object of type value_type; when
-// value_type is not a POD it is value_type().
-// (4) [finish + 1, end_of_storage) is a valid range.
-// (5) Each iterator in [finish + 1, end_of_storage) points to
-// unininitialized memory.
-
-// Note one important consequence: a string of length n must manage
-// a block of memory whose size is at least n + 1.
-
-struct _String_reserve_t {};
-
-#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-# define basic_string _STLP_NO_MEM_T_NAME(str)
-#elif defined (_STLP_DEBUG)
-# define basic_string _STLP_NON_DBG_NAME(str)
-#endif
-
-#if defined (basic_string)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-template <class _CharT, class _Traits, class _Alloc>
-class basic_string : protected _STLP_PRIV _String_base<_CharT,_Alloc>
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string)
- , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
-#endif
-{
-protected: // Protected members inherited from base.
- typedef _STLP_PRIV _String_base<_CharT,_Alloc> _Base;
- typedef basic_string<_CharT, _Traits, _Alloc> _Self;
- // fbp : used to optimize char/wchar_t cases, and to simplify
- // _STLP_DEF_CONST_PLCT_NEW_BUG problem workaround
- typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral;
- typedef typename _IsPOD<_CharT>::_Type _Char_Is_POD;
- typedef random_access_iterator_tag r_a_i_t;
-
-public:
- typedef _CharT value_type;
- typedef _Traits traits_type;
-
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef typename _Base::size_type size_type;
- typedef ptrdiff_t difference_type;
- typedef random_access_iterator_tag _Iterator_category;
-
- typedef const value_type* const_iterator;
- typedef value_type* iterator;
-
- _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
-
-#include <stl/_string_npos.h>
-
- typedef _String_reserve_t _Reserve_t;
-
-public: // Constructor, destructor, assignment.
- typedef typename _Base::allocator_type allocator_type;
-
- allocator_type get_allocator() const
- { return _STLP_CONVERT_ALLOCATOR((const allocator_type&)this->_M_end_of_storage, _CharT); }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit basic_string(const allocator_type& __a = allocator_type())
-#else
- basic_string()
- : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), _Base::_DEFAULT_SIZE)
- { _M_terminate_string(); }
- explicit basic_string(const allocator_type& __a)
-#endif
- : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, _Base::_DEFAULT_SIZE)
- { _M_terminate_string(); }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- basic_string(_Reserve_t, size_t __n,
- const allocator_type& __a = allocator_type())
-#else
- basic_string(_Reserve_t, size_t __n)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), __n + 1)
- { _M_terminate_string(); }
- basic_string(_Reserve_t, size_t __n, const allocator_type& __a)
-#endif
- : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, __n + 1)
- { _M_terminate_string(); }
-
- basic_string(const _Self&);
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
- const allocator_type& __a = allocator_type())
-#else
- basic_string(const _Self& __s, size_type __pos)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
- if (__pos > __s.size())
- this->_M_throw_out_of_range();
- else
- _M_range_initialize(__s._M_Start() + __pos, __s._M_Finish());
- }
- basic_string(const _Self& __s, size_type __pos, size_type __n)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
- if (__pos > __s.size())
- this->_M_throw_out_of_range();
- else
- _M_range_initialize(__s._M_Start() + __pos,
- __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
- }
- basic_string(const _Self& __s, size_type __pos, size_type __n,
- const allocator_type& __a)
-#endif
- : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
- if (__pos > __s.size())
- this->_M_throw_out_of_range();
- else
- _M_range_initialize(__s._M_Start() + __pos,
- __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
- }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- basic_string(const _CharT* __s, size_type __n,
- const allocator_type& __a = allocator_type())
-#else
- basic_string(const _CharT* __s, size_type __n)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
- _STLP_FIX_LITERAL_BUG(__s)
- _M_range_initialize(__s, __s + __n);
- }
- basic_string(const _CharT* __s, size_type __n, const allocator_type& __a)
-#endif
- : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
- _STLP_FIX_LITERAL_BUG(__s)
- _M_range_initialize(__s, __s + __n);
- }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- basic_string(const _CharT* __s,
- const allocator_type& __a = allocator_type());
-#else
- basic_string(const _CharT* __s);
- basic_string(const _CharT* __s, const allocator_type& __a);
-#endif
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- basic_string(size_type __n, _CharT __c,
- const allocator_type& __a = allocator_type())
-#else
- basic_string(size_type __n, _CharT __c)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), __n + 1) {
-# if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf()) {
- _Traits::assign(this->_M_Start(), __n, __c);
- this->_M_finish = this->_M_Start() + __n;
- }
- else
-# endif
- this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c);
- _M_terminate_string();
- }
- basic_string(size_type __n, _CharT __c, const allocator_type& __a)
-#endif
- : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, __n + 1) {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf()) {
- _Traits::assign(this->_M_Start(), __n, __c);
- this->_M_finish = this->_M_Start() + __n;
- }
- else
-#endif
- this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c);
- _M_terminate_string();
- }
-
- basic_string(__move_source<_Self> src)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(__move_source<_Base>(src.get())) {}
-
- // Check to see if _InputIterator is an integer type. If so, then
- // it can't be an iterator.
-#if defined (_STLP_MEMBER_TEMPLATES) && !(defined (__MRC__) || (defined(__SC__) && !defined(__DMC__))) //*ty 04/30/2001 - mpw compilers choke on this ctor
-# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
- template <class _InputIterator>
- basic_string(_InputIterator __f, _InputIterator __l,
- const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_initialize_dispatch(__f, __l, _Integral());
- }
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- basic_string(_InputIterator __f, _InputIterator __l)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_initialize_dispatch(__f, __l, _Integral());
- }
-# endif
-# else
- /* We need an additionnal constructor to build an empty string without
- * any allocation or termination char*/
-protected:
- struct _CalledFromWorkaround_t {};
- basic_string(_CalledFromWorkaround_t, const allocator_type &__a)
- : _String_base<_CharT,_Alloc>(__a) {}
-public:
-# endif /* _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND */
-#endif /* !__MRC__ || (__SC__ && !__DMC__) */
-
-#if !(defined (_STLP_MEMBER_TEMPLATES) && !(defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)))) || \
- !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) || \
- defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
- basic_string(const _CharT* __f, const _CharT* __l,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- _M_range_initialize(__f, __l);
- }
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- basic_string(const _CharT* __f, const _CharT* __l)
- : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- _M_range_initialize(__f, __l);
- }
-# endif
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-private:
- template <class _InputIter>
- void _M_range_initialize(_InputIter __f, _InputIter __l,
- const input_iterator_tag &__tag) {
- this->_M_allocate_block();
- _M_construct_null(this->_M_Finish());
- _STLP_TRY {
- _M_appendT(__f, __l, __tag);
- }
- _STLP_UNWIND(this->_M_destroy_range())
- }
-
- template <class _ForwardIter>
- void _M_range_initialize(_ForwardIter __f, _ForwardIter __l,
- const forward_iterator_tag &) {
- difference_type __n = distance(__f, __l);
- this->_M_allocate_block(__n + 1);
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf()) {
- _M_copyT(__f, __l, this->_M_Start());
- this->_M_finish = this->_M_Start() + __n;
- }
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start());
- this->_M_terminate_string();
- }
-
- template <class _InputIter>
- void _M_range_initializeT(_InputIter __f, _InputIter __l) {
- _M_range_initialize(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
- }
-
- template <class _Integer>
- void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) {
- this->_M_allocate_block(__n + 1);
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf()) {
- _Traits::assign(this->_M_Start(), __n, __x);
- this->_M_finish = this->_M_Start() + __n;
- }
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __x);
- this->_M_terminate_string();
- }
-
- template <class _InputIter>
- void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
- _M_range_initializeT(__f, __l);
- }
-
-public:
- ~basic_string()
- { this->_M_destroy_range(); }
-
- _Self& operator=(const _Self& __s) {
- if (&__s != this)
- _M_assign(__s._M_Start(), __s._M_Finish());
- return *this;
- }
-
- _Self& operator=(const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- return _M_assign(__s, __s + traits_type::length(__s));
- }
-
- _Self& operator=(_CharT __c)
- { return assign(__STATIC_CAST(size_type,1), __c); }
-
-protected:
-
- static _CharT _STLP_CALL _M_null()
- { return _STLP_DEFAULT_CONSTRUCTED(_CharT); }
-
-protected: // Helper functions used by constructors
- // and elsewhere.
- // fbp : simplify integer types (char, wchar)
- void _M_construct_null_aux(_CharT* __p, const __false_type& /*_Is_Integral*/) const {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _Traits::assign(*__p, _M_null());
- else
-#endif /*_STLP_USE_SHORT_STRING_OPTIM*/
- _STLP_STD::_Construct(__p);
- }
- void _M_construct_null_aux(_CharT* __p, const __true_type& /*_Is_Integral*/) const
- { *__p = 0; }
-
- void _M_force_construct_null(_CharT*, const __true_type& /* _Is_POD */) const
- { /*Nothing to do*/ }
- void _M_force_construct_null(_CharT* __p, const __false_type& /* _Is_POD */) const
- { _M_construct_null_aux(__p, _Char_Is_Integral()); }
-
- void _M_construct_null(_CharT* __p) const {
- typedef __false_type _Answer;
-
- _M_force_construct_null(__p, _Answer());
- }
-
-protected:
- // Helper functions used by constructors. It is a severe error for
- // any of them to be called anywhere except from within constructors.
- void _M_terminate_string_aux(const __false_type& __is_integral) {
- _STLP_TRY {
- _M_construct_null_aux(this->_M_Finish(), __is_integral);
- }
- _STLP_UNWIND(this->_M_destroy_range(0,0))
- }
-
- void _M_terminate_string_aux(const __true_type& __is_integral)
- { _M_construct_null_aux(this->_M_Finish(), __is_integral); }
-
- void _M_force_terminate_string(const __true_type& /* _Is_POD */)
- { /*Nothing to do*/ }
- void _M_force_terminate_string(const __false_type& /* _Is_POD */)
- { _M_terminate_string_aux(_Char_Is_Integral()); }
-
- void _M_terminate_string() {
- typedef __false_type _Answer;
-
- _M_force_terminate_string(_Answer());
- }
-
- bool _M_inside(const _CharT* __s) const {
- _STLP_FIX_LITERAL_BUG(__s)
- return (__s >= this->_M_Start()) && (__s < this->_M_Finish());
- }
-
- void _M_range_initialize(const _CharT* __f, const _CharT* __l) {
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- ptrdiff_t __n = __l - __f;
- this->_M_allocate_block(__n + 1);
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf()) {
- _M_copy(__f, __l, this->_M_Start());
- this->_M_finish = this->_M_Start() + __n;
- }
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start());
- _M_terminate_string();
- }
-
-public: // Iterators.
- iterator begin() { return this->_M_Start(); }
- iterator end() { return this->_M_Finish(); }
- const_iterator begin() const { return this->_M_Start(); }
- const_iterator end() const { return this->_M_Finish(); }
-
- reverse_iterator rbegin()
- { return reverse_iterator(this->_M_Finish()); }
- reverse_iterator rend()
- { return reverse_iterator(this->_M_Start()); }
- const_reverse_iterator rbegin() const
- { return const_reverse_iterator(this->_M_Finish()); }
- const_reverse_iterator rend() const
- { return const_reverse_iterator(this->_M_Start()); }
-
-public: // Size, capacity, etc.
- size_type size() const { return this->_M_Finish() - this->_M_Start(); }
- size_type length() const { return size(); }
- size_t max_size() const { return _Base::max_size(); }
-
- void resize(size_type __n, _CharT __c) {
- if (__n <= size())
- erase(begin() + __n, end());
- else
- append(__n - size(), __c);
- }
-
- void resize(size_type __n) { resize(__n, _M_null()); }
-
- void reserve(size_type = 0);
-
- size_type capacity() const
- { return (this->_M_end_of_storage._M_data - this->_M_Start()) - 1; }
-
- void clear() {
- if (!empty()) {
- _Traits::assign(*(this->_M_Start()), _M_null());
- this->_M_destroy_range(1);
- this->_M_finish = this->_M_Start();
- }
- }
-
- bool empty() const { return this->_M_Start() == this->_M_Finish(); }
-
-public: // Element access.
-
- const_reference operator[](size_type __n) const
- { return *(this->_M_Start() + __n); }
- reference operator[](size_type __n)
- { return *(this->_M_Start() + __n); }
-
- const_reference at(size_type __n) const {
- if (__n >= size())
- this->_M_throw_out_of_range();
- return *(this->_M_Start() + __n);
- }
-
- reference at(size_type __n) {
- if (__n >= size())
- this->_M_throw_out_of_range();
- return *(this->_M_Start() + __n);
- }
-
-public: // Append, operator+=, push_back.
-
- _Self& operator+=(const _Self& __s) { return append(__s); }
- _Self& operator+=(const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return append(__s); }
- _Self& operator+=(_CharT __c) { push_back(__c); return *this; }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-private: // Helper functions for append.
- template <class _InputIter>
- _Self& _M_appendT(_InputIter __first, _InputIter __last,
- const input_iterator_tag &) {
- for ( ; __first != __last ; ++__first)
- push_back(*__first);
- return *this;
- }
-
- template <class _ForwardIter>
- _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last,
- const forward_iterator_tag &) {
- if (__first != __last) {
- const size_type __old_size = this->size();
- difference_type __n = distance(__first, __last);
- if (__STATIC_CAST(size_type,__n) > this->max_size() || __old_size > this->max_size() - __STATIC_CAST(size_type,__n))
- this->_M_throw_length_error();
- if (__old_size + __n > this->capacity()) {
- size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
- pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
- pointer __new_finish = __new_start;
- _STLP_TRY {
- __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
- __new_finish = uninitialized_copy(__first, __last, __new_finish);
- _M_construct_null(__new_finish);
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
- this->_M_end_of_storage.deallocate(__new_start, __len)))
- this->_M_destroy_range();
- this->_M_deallocate_block();
- this->_M_reset(__new_start, __new_finish, __new_start + __len);
- }
- else {
- _ForwardIter __f1 = __first;
- ++__f1;
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _M_copyT(__f1, __last, this->_M_Finish() + 1);
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- uninitialized_copy(__f1, __last, this->_M_Finish() + 1);
- _STLP_TRY {
- _M_construct_null(this->_M_Finish() + __n);
- }
- _STLP_UNWIND(this->_M_destroy_ptr_range(this->_M_Finish() + 1, this->_M_Finish() + __n))
- _Traits::assign(*this->_M_finish, *__first);
- this->_M_finish += __n;
- }
- }
- return *this;
- }
-
- template <class _Integer>
- _Self& _M_append_dispatch(_Integer __n, _Integer __x, const __true_type& /*Integral*/)
- { return append((size_type) __n, (_CharT) __x); }
-
- template <class _InputIter>
- _Self& _M_append_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*Integral*/)
- { return _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); }
-
-public:
- // Check to see if _InputIterator is an integer type. If so, then
- // it can't be an iterator.
- template <class _InputIter>
- _Self& append(_InputIter __first, _InputIter __last) {
- typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
- return _M_append_dispatch(__first, __last, _Integral());
- }
-# endif
-#endif
-
-protected:
- _Self& _M_append(const _CharT* __first, const _CharT* __last);
-
-public:
-#if !defined (_STLP_MEMBER_TEMPLATES) || \
- !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
-# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
- _Self& append(const _CharT* __first, const _CharT* __last) {
- _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
- return _M_append(__first, __last);
- }
-# endif
-#endif
-
- _Self& append(const _Self& __s)
- { return _M_append(__s._M_Start(), __s._M_Finish()); }
-
- _Self& append(const _Self& __s,
- size_type __pos, size_type __n) {
- if (__pos > __s.size())
- this->_M_throw_out_of_range();
- return _M_append(__s._M_Start() + __pos,
- __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
- }
-
- _Self& append(const _CharT* __s, size_type __n)
- { _STLP_FIX_LITERAL_BUG(__s) return _M_append(__s, __s+__n); }
- _Self& append(const _CharT* __s)
- { _STLP_FIX_LITERAL_BUG(__s) return _M_append(__s, __s + traits_type::length(__s)); }
- _Self& append(size_type __n, _CharT __c);
-
-public:
- void push_back(_CharT __c) {
- if (this->_M_Finish() + 1 == this->_M_end_of_storage._M_data)
- reserve(size() + (max)(size(), __STATIC_CAST(size_type,1)));
- _M_construct_null(this->_M_Finish() + 1);
- _Traits::assign(*(this->_M_Finish()), __c);
- ++this->_M_finish;
- }
-
- void pop_back() {
- _Traits::assign(*(this->_M_Finish() - 1), _M_null());
- this->_M_destroy_back();
- --this->_M_finish;
- }
-
-public: // Assign
- _Self& assign(const _Self& __s)
- { return _M_assign(__s._M_Start(), __s._M_Finish()); }
-
- _Self& assign(const _Self& __s,
- size_type __pos, size_type __n) {
- if (__pos > __s.size())
- this->_M_throw_out_of_range();
- return _M_assign(__s._M_Start() + __pos,
- __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
- }
-
- _Self& assign(const _CharT* __s, size_type __n)
- { _STLP_FIX_LITERAL_BUG(__s) return _M_assign(__s, __s + __n); }
-
- _Self& assign(const _CharT* __s)
- { _STLP_FIX_LITERAL_BUG(__s) return _M_assign(__s, __s + _Traits::length(__s)); }
-
- _Self& assign(size_type __n, _CharT __c);
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-private: // Helper functions for assign.
- template <class _Integer>
- _Self& _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/)
- { return assign((size_type) __n, (_CharT) __x); }
-
- template <class _InputIter>
- _Self& _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
- pointer __cur = this->_M_Start();
- while (__f != __l && __cur != this->_M_Finish()) {
- _Traits::assign(*__cur, *__f);
- ++__f;
- ++__cur;
- }
- if (__f == __l)
- erase(__cur, this->end());
- else
- _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
- return *this;
- }
-
-public:
- // Check to see if _InputIterator is an integer type. If so, then
- // it can't be an iterator.
- template <class _InputIter>
- _Self& assign(_InputIter __first, _InputIter __last) {
- typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
- return _M_assign_dispatch(__first, __last, _Integral());
- }
-# endif
-#endif
-
-protected:
- _Self& _M_assign(const _CharT* __f, const _CharT* __l);
-
-public:
-
-#if !defined (_STLP_MEMBER_TEMPLATES) || \
- !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
-# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
- _Self& assign(const _CharT* __f, const _CharT* __l) {
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- return _M_assign(__f, __l);
- }
-# endif
-#endif
-
-public: // Insert
-
- _Self& insert(size_type __pos, const _Self& __s) {
- if (__pos > size())
- this->_M_throw_out_of_range();
- if (size() > max_size() - __s.size())
- this->_M_throw_length_error();
- _M_insert(begin() + __pos, __s._M_Start(), __s._M_Finish(), &__s == this);
- return *this;
- }
-
- _Self& insert(size_type __pos, const _Self& __s,
- size_type __beg, size_type __n) {
- if (__pos > size() || __beg > __s.size())
- this->_M_throw_out_of_range();
- size_type __len = (min) (__n, __s.size() - __beg);
- if (size() > max_size() - __len)
- this->_M_throw_length_error();
- _M_insert(begin() + __pos,
- __s._M_Start() + __beg, __s._M_Start() + __beg + __len, &__s == this);
- return *this;
- }
- _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
- _STLP_FIX_LITERAL_BUG(__s)
- if (__pos > size())
- this->_M_throw_out_of_range();
- if (size() > max_size() - __n)
- this->_M_throw_length_error();
- _M_insert(begin() + __pos, __s, __s + __n, _M_inside(__s));
- return *this;
- }
-
- _Self& insert(size_type __pos, const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- if (__pos > size())
- this->_M_throw_out_of_range();
- size_type __len = _Traits::length(__s);
- if (size() > max_size() - __len)
- this->_M_throw_length_error();
- _M_insert(this->_M_Start() + __pos, __s, __s + __len, _M_inside(__s));
- return *this;
- }
-
- _Self& insert(size_type __pos, size_type __n, _CharT __c) {
- if (__pos > size())
- this->_M_throw_out_of_range();
- if (size() > max_size() - __n)
- this->_M_throw_length_error();
- insert(begin() + __pos, __n, __c);
- return *this;
- }
-
- iterator insert(iterator __p, _CharT __c) {
- _STLP_FIX_LITERAL_BUG(__p)
- if (__p == end()) {
- push_back(__c);
- return this->_M_Finish() - 1;
- }
- else
- return _M_insert_aux(__p, __c);
- }
-
- void insert(iterator __p, size_t __n, _CharT __c);
-
-protected: // Helper functions for insert.
-
- void _M_insert(iterator __p, const _CharT* __first, const _CharT* __last, bool __self_ref);
-
- pointer _M_insert_aux(pointer, _CharT);
-
- void _M_copy(const _CharT* __f, const _CharT* __l, _CharT* __res) {
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- _STLP_FIX_LITERAL_BUG(__res)
- _Traits::copy(__res, __f, __l - __f);
- }
-
- void _M_move(const _CharT* __f, const _CharT* __l, _CharT* __res) {
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- _Traits::move(__res, __f, __l - __f);
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
- template <class _ForwardIter>
- void _M_insert_overflow(iterator __pos, _ForwardIter __first, _ForwardIter __last,
- difference_type __n) {
- const size_type __old_size = this->size();
- size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
- pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
- pointer __new_finish = __new_start;
- _STLP_TRY {
- __new_finish = uninitialized_copy(this->_M_Start(), __pos, __new_start);
- __new_finish = uninitialized_copy(__first, __last, __new_finish);
- __new_finish = uninitialized_copy(__pos, this->_M_Finish(), __new_finish);
- _M_construct_null(__new_finish);
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
- this->_M_end_of_storage.deallocate(__new_start, __len)))
- this->_M_destroy_range();
- this->_M_deallocate_block();
- this->_M_reset(__new_start, __new_finish, __new_start + __len);
- }
-
- template <class _InputIter>
- void _M_insertT(iterator __p, _InputIter __first, _InputIter __last,
- const input_iterator_tag &) {
- for ( ; __first != __last; ++__first) {
- __p = insert(__p, *__first);
- ++__p;
- }
- }
-
- template <class _ForwardIter>
- void _M_insertT(iterator __pos, _ForwardIter __first, _ForwardIter __last,
- const forward_iterator_tag &) {
- if (__first != __last) {
- difference_type __n = distance(__first, __last);
- if (this->_M_end_of_storage._M_data - this->_M_finish >= __n + 1) {
- const difference_type __elems_after = this->_M_finish - __pos;
- if (__elems_after >= __n) {
-# if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _M_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
- else
-# endif /* _STLP_USE_SHORT_STRING_OPTIM */
- uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
- this->_M_finish += __n;
- _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
- _M_copyT(__first, __last, __pos);
- }
- else {
- pointer __old_finish = this->_M_Finish();
- _ForwardIter __mid = __first;
- advance(__mid, __elems_after + 1);
-# if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _M_copyT(__mid, __last, this->_M_Finish() + 1);
- else
-# endif /* _STLP_USE_SHORT_STRING_OPTIM */
- uninitialized_copy(__mid, __last, this->_M_Finish() + 1);
- this->_M_finish += __n - __elems_after;
- _STLP_TRY {
-# if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _M_copy(__pos, __old_finish + 1, this->_M_Finish());
- else
-# endif /* _STLP_USE_SHORT_STRING_OPTIM */
- uninitialized_copy(__pos, __old_finish + 1, this->_M_Finish());
- this->_M_finish += __elems_after;
- }
- _STLP_UNWIND((this->_M_destroy_ptr_range(__old_finish + 1, this->_M_Finish()),
- this->_M_finish = __old_finish))
- _M_copyT(__first, __mid, __pos);
- }
- }
- else {
- _M_insert_overflow(__pos, __first, __last, __n);
- }
- }
- }
-
- template <class _Integer>
- void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x,
- const __true_type& /*Integral*/) {
- insert(__p, (size_type) __n, (_CharT) __x);
- }
-
- template <class _InputIter>
- void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last,
- const __false_type& /*Integral*/) {
- _STLP_FIX_LITERAL_BUG(__p)
- /*
- * Within the basic_string implementation we are only going to check for
- * self referencing if iterators are string iterators or _CharT pointers.
- * A user could encapsulate those iterator within their own iterator interface
- * and in this case lead to a bad behavior, this is a known limitation.
- */
- typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsIterator;
- typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
- typedef typename _Lor2<_IsIterator, _IsConstIterator>::_Ret _CheckInside;
- _M_insert_aux(__p, __first, __last, _CheckInside());
- }
-
- template <class _RandomIter>
- void _M_insert_aux (iterator __p, _RandomIter __first, _RandomIter __last,
- const __true_type& /*_CheckInside*/) {
- _STLP_FIX_LITERAL_BUG(__p)
- _M_insert(__p, &(*__first), &(*__last), _M_inside(&(*__first)));
- }
-
- template<class _InputIter>
- void _M_insert_aux (iterator __p, _InputIter __first, _InputIter __last,
- const __false_type& /*_CheckInside*/) {
- _STLP_FIX_LITERAL_BUG(__p)
- _M_insertT(__p, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
- }
-
- template <class _InputIterator>
- void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) {
- _STLP_FIX_LITERAL_BUG(__result)
- for ( ; __first != __last; ++__first, ++__result)
- _Traits::assign(*__result, *__first);
- }
-
-# if !defined (_STLP_NO_METHOD_SPECIALIZATION)
- void _M_copyT(const _CharT* __f, const _CharT* __l, _CharT* __res) {
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- _STLP_FIX_LITERAL_BUG(__res)
- _Traits::copy(__res, __f, __l - __f);
- }
-# endif
-
-public:
- // Check to see if _InputIterator is an integer type. If so, then
- // it can't be an iterator.
- template <class _InputIter>
- void insert(iterator __p, _InputIter __first, _InputIter __last) {
- typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
- _M_insert_dispatch(__p, __first, __last, _Integral());
- }
-# endif
-#endif
-
-public:
-
-#if !defined (_STLP_MEMBER_TEMPLATES) || \
- !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
- void insert(iterator __p, const _CharT* __f, const _CharT* __l) {
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- _M_insert(__p, __f, __l, _M_inside(__f));
- }
-#endif
-
-public: // Erase.
-
- _Self& erase(size_type __pos = 0, size_type __n = npos) {
- if (__pos > size())
- this->_M_throw_out_of_range();
- erase(begin() + __pos, begin() + __pos + (min) (__n, size() - __pos));
- return *this;
- }
-
- iterator erase(iterator __pos) {
- // The move includes the terminating _CharT().
- _Traits::move(__pos, __pos + 1, this->_M_Finish() - __pos);
- this->_M_destroy_back();
- --this->_M_finish;
- return __pos;
- }
-
- iterator erase(iterator __first, iterator __last) {
- if (__first != __last) {
- // The move includes the terminating _CharT().
- traits_type::move(__first, __last, (this->_M_Finish() - __last) + 1);
- pointer __new_finish = this->_M_Finish() - (__last - __first);
- this->_M_destroy_ptr_range(__new_finish + 1, this->_M_Finish() + 1);
- this->_M_finish = __new_finish;
- }
- return __first;
- }
-
-public: // Replace. (Conceptually equivalent
- // to erase followed by insert.)
- _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
- if (__pos > size())
- this->_M_throw_out_of_range();
- const size_type __len = (min) (__n, size() - __pos);
- if (size() - __len >= max_size() - __s.size())
- this->_M_throw_length_error();
- return _M_replace(begin() + __pos, begin() + __pos + __len,
- __s._M_Start(), __s._M_Finish(), &__s == this);
- }
-
- _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
- size_type __pos2, size_type __n2) {
- if (__pos1 > size() || __pos2 > __s.size())
- this->_M_throw_out_of_range();
- const size_type __len1 = (min) (__n1, size() - __pos1);
- const size_type __len2 = (min) (__n2, __s.size() - __pos2);
- if (size() - __len1 >= max_size() - __len2)
- this->_M_throw_length_error();
- return _M_replace(begin() + __pos1, begin() + __pos1 + __len1,
- __s._M_Start() + __pos2, __s._M_Start() + __pos2 + __len2, &__s == this);
- }
-
- _Self& replace(size_type __pos, size_type __n1,
- const _CharT* __s, size_type __n2) {
- _STLP_FIX_LITERAL_BUG(__s)
- if (__pos > size())
- this->_M_throw_out_of_range();
- const size_type __len = (min) (__n1, size() - __pos);
- if (__n2 > max_size() || size() - __len >= max_size() - __n2)
- this->_M_throw_length_error();
- return _M_replace(begin() + __pos, begin() + __pos + __len,
- __s, __s + __n2, _M_inside(__s));
- }
-
- _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- if (__pos > size())
- this->_M_throw_out_of_range();
- const size_type __len = (min) (__n1, size() - __pos);
- const size_type __n2 = _Traits::length(__s);
- if (__n2 > max_size() || size() - __len >= max_size() - __n2)
- this->_M_throw_length_error();
- return _M_replace(begin() + __pos, begin() + __pos + __len,
- __s, __s + _Traits::length(__s), _M_inside(__s));
- }
-
- _Self& replace(size_type __pos, size_type __n1,
- size_type __n2, _CharT __c) {
- if (__pos > size())
- this->_M_throw_out_of_range();
- const size_type __len = (min) (__n1, size() - __pos);
- if (__n2 > max_size() || size() - __len >= max_size() - __n2)
- this->_M_throw_length_error();
- return replace(begin() + __pos, begin() + __pos + __len, __n2, __c);
- }
-
- _Self& replace(iterator __first, iterator __last, const _Self& __s) {
- _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
- return _M_replace(__first, __last, __s._M_Start(), __s._M_Finish(), &__s == this);
- }
-
- _Self& replace(iterator __first, iterator __last,
- const _CharT* __s, size_type __n) {
- _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
- _STLP_FIX_LITERAL_BUG(__s)
- return _M_replace(__first, __last, __s, __s + __n, _M_inside(__s));
- }
-
- _Self& replace(iterator __first, iterator __last,
- const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
- _STLP_FIX_LITERAL_BUG(__s)
- return _M_replace(__first, __last, __s, __s + _Traits::length(__s), _M_inside(__s));
- }
-
- _Self& replace(iterator __first, iterator __last, size_type __n, _CharT __c);
-
-protected: // Helper functions for replace.
- _Self& _M_replace(iterator __first, iterator __last,
- const _CharT* __f, const _CharT* __l, bool __self_ref);
-
-public:
-#if defined (_STLP_MEMBER_TEMPLATES)
-# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
- template <class _Integer>
- _Self& _M_replace_dispatch(iterator __first, iterator __last,
- _Integer __n, _Integer __x, const __true_type& /*IsIntegral*/) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- return replace(__first, __last, (size_type) __n, (_CharT) __x);
- }
-
- template <class _InputIter>
- _Self& _M_replace_dispatch(iterator __first, iterator __last,
- _InputIter __f, _InputIter __l, const __false_type& /*IsIntegral*/) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsIterator;
- typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
- typedef typename _Lor2<_IsIterator, _IsConstIterator>::_Ret _CheckInside;
- return _M_replace_aux(__first, __last, __f, __l, _CheckInside());
- }
-
- template <class _RandomIter>
- _Self& _M_replace_aux(iterator __first, iterator __last,
- _RandomIter __f, _RandomIter __l, __true_type const& /*_CheckInside*/) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- return _M_replace(__first, __last, &(*__f), &(*__l), _M_inside(&(*__f)));
- }
-
- template <class _InputIter>
- _Self& _M_replace_aux(iterator __first, iterator __last,
- _InputIter __f, _InputIter __l, __false_type const& /*_CheckInside*/) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- return _M_replaceT(__first, __last, __f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
- }
-
- template <class _InputIter>
- _Self& _M_replaceT(iterator __first, iterator __last,
- _InputIter __f, _InputIter __l, const input_iterator_tag&__ite_tag) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- for ( ; __first != __last && __f != __l; ++__first, ++__f)
- _Traits::assign(*__first, *__f);
- if (__f == __l)
- erase(__first, __last);
- else
- _M_insertT(__last, __f, __l, __ite_tag);
- return *this;
- }
-
- template <class _ForwardIter>
- _Self& _M_replaceT(iterator __first, iterator __last,
- _ForwardIter __f, _ForwardIter __l, const forward_iterator_tag &__ite_tag) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- difference_type __n = distance(__f, __l);
- const difference_type __len = __last - __first;
- if (__len >= __n) {
- _M_copyT(__f, __l, __first);
- erase(__first + __n, __last);
- }
- else {
- _ForwardIter __m = __f;
- advance(__m, __len);
- _M_copyT(__f, __m, __first);
- _M_insertT(__last, __m, __l, __ite_tag);
- }
- return *this;
- }
-
-public:
- // Check to see if _InputIter is an integer type. If so, then
- // it can't be an iterator.
- template <class _InputIter>
- _Self& replace(iterator __first, iterator __last,
- _InputIter __f, _InputIter __l) {
- _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
- typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
- return _M_replace_dispatch(__first, __last, __f, __l, _Integral());
- }
-
-# endif
-#endif
-
-#if !defined (_STLP_MEMBER_TEMPLATES) || \
- !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
-# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
- _Self& replace(iterator __first, iterator __last,
- const _CharT* __f, const _CharT* __l) {
- _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- return _M_replace(__first, __last, __f, __l, _M_inside(__f));
- }
-# endif
-#endif
-
-public: // Other modifier member functions.
-
- size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const {
- _STLP_FIX_LITERAL_BUG(__s)
- if (__pos > size())
- this->_M_throw_out_of_range();
- const size_type __len = (min) (__n, size() - __pos);
- _Traits::copy(__s, this->_M_Start() + __pos, __len);
- return __len;
- }
-
- void swap(_Self& __s) {
- this->_M_Swap(__s);
- }
-
-public: // Conversion to C string.
-
- const _CharT* c_str() const { return this->_M_Start(); }
- const _CharT* data() const { return this->_M_Start(); }
-
-public: // find.
-
- size_type find(const _Self& __s, size_type __pos = 0) const
- { return find(__s._M_Start(), __pos, __s.size()); }
-
- size_type find(const _CharT* __s, size_type __pos = 0) const
- { _STLP_FIX_LITERAL_BUG(__s) return find(__s, __pos, _Traits::length(__s)); }
-
- size_type find(const _CharT* __s, size_type __pos, size_type __n) const;
-
- // WIE: Versant schema compiler 5.2.2 ICE workaround
- size_type find(_CharT __c) const { return find(__c, 0); }
- size_type find(_CharT __c, size_type __pos /* = 0 */) const;
-
-public: // rfind.
-
- size_type rfind(const _Self& __s, size_type __pos = npos) const
- { return rfind(__s._M_Start(), __pos, __s.size()); }
-
- size_type rfind(const _CharT* __s, size_type __pos = npos) const
- { _STLP_FIX_LITERAL_BUG(__s) return rfind(__s, __pos, _Traits::length(__s)); }
-
- size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const;
- size_type rfind(_CharT __c, size_type __pos = npos) const;
-
-public: // find_first_of
-
- size_type find_first_of(const _Self& __s, size_type __pos = 0) const
- { return find_first_of(__s._M_Start(), __pos, __s.size()); }
-
- size_type find_first_of(const _CharT* __s, size_type __pos = 0) const
- { _STLP_FIX_LITERAL_BUG(__s) return find_first_of(__s, __pos, _Traits::length(__s)); }
-
- size_type find_first_of(const _CharT* __s, size_type __pos,
- size_type __n) const;
-
- size_type find_first_of(_CharT __c, size_type __pos = 0) const
- { return find(__c, __pos); }
-
-public: // find_last_of
-
- size_type find_last_of(const _Self& __s,
- size_type __pos = npos) const
- { return find_last_of(__s._M_Start(), __pos, __s.size()); }
-
- size_type find_last_of(const _CharT* __s, size_type __pos = npos) const
- { _STLP_FIX_LITERAL_BUG(__s) return find_last_of(__s, __pos, _Traits::length(__s)); }
-
- size_type find_last_of(const _CharT* __s, size_type __pos,
- size_type __n) const;
-
- size_type find_last_of(_CharT __c, size_type __pos = npos) const {
- return rfind(__c, __pos);
- }
-
-public: // find_first_not_of
-
- size_type find_first_not_of(const _Self& __s,
- size_type __pos = 0) const
- { return find_first_not_of(__s._M_Start(), __pos, __s.size()); }
-
- size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const
- { _STLP_FIX_LITERAL_BUG(__s) return find_first_not_of(__s, __pos, _Traits::length(__s)); }
-
- size_type find_first_not_of(const _CharT* __s, size_type __pos,
- size_type __n) const;
-
- size_type find_first_not_of(_CharT __c, size_type __pos = 0) const;
-
-public: // find_last_not_of
-
- size_type find_last_not_of(const _Self& __s,
- size_type __pos = npos) const
- { return find_last_not_of(__s._M_Start(), __pos, __s.size()); }
-
- size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const
- { _STLP_FIX_LITERAL_BUG(__s) return find_last_not_of(__s, __pos, _Traits::length(__s)); }
-
- size_type find_last_not_of(const _CharT* __s, size_type __pos,
- size_type __n) const;
-
- size_type find_last_not_of(_CharT __c, size_type __pos = npos) const;
-
-public: // Substring.
- _Self substr(size_type __pos = 0, size_type __n = npos) const
- { return _Self(*this, __pos, __n, get_allocator()); }
-
-public: // Compare
- int compare(const _Self& __s) const
- { return _M_compare(this->_M_Start(), this->_M_Finish(), __s._M_Start(), __s._M_Finish()); }
-
- int compare(size_type __pos1, size_type __n1,
- const _Self& __s) const {
- if (__pos1 > size())
- this->_M_throw_out_of_range();
- return _M_compare(this->_M_Start() + __pos1,
- this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
- __s._M_Start(), __s._M_Finish());
- }
-
- int compare(size_type __pos1, size_type __n1,
- const _Self& __s,
- size_type __pos2, size_type __n2) const {
- if (__pos1 > size() || __pos2 > __s.size())
- this->_M_throw_out_of_range();
- return _M_compare(this->_M_Start() + __pos1,
- this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
- __s._M_Start() + __pos2,
- __s._M_Start() + __pos2 + (min) (__n2, __s.size() - __pos2));
- }
-
- int compare(const _CharT* __s) const {
- _STLP_FIX_LITERAL_BUG(__s)
- return _M_compare(this->_M_Start(), this->_M_Finish(), __s, __s + _Traits::length(__s));
- }
-
- int compare(size_type __pos1, size_type __n1, const _CharT* __s) const {
- _STLP_FIX_LITERAL_BUG(__s)
- if (__pos1 > size())
- this->_M_throw_out_of_range();
- return _M_compare(this->_M_Start() + __pos1,
- this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
- __s, __s + _Traits::length(__s));
- }
-
- int compare(size_type __pos1, size_type __n1, const _CharT* __s,
- size_type __n2) const {
- _STLP_FIX_LITERAL_BUG(__s)
- if (__pos1 > size())
- this->_M_throw_out_of_range();
- return _M_compare(this->_M_Start() + __pos1,
- this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
- __s, __s + __n2);
- }
-
-public: // Helper functions for compare.
-
- static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
- const _CharT* __f2, const _CharT* __l2) {
- const ptrdiff_t __n1 = __l1 - __f1;
- const ptrdiff_t __n2 = __l2 - __f2;
- const int cmp = _Traits::compare(__f1, __f2, (min) (__n1, __n2));
- return cmp != 0 ? cmp : (__n1 < __n2 ? -1 : (__n1 > __n2 ? 1 : 0));
- }
-#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-# define _STLP_STRING_SUM_BASE(__reserve, __size, __alloc) _STLP_PRIV _String_base<_CharT,_Alloc>(__alloc, __size + 1)
-# include <stl/_string_sum_methods.h>
-# undef _STLP_STRING_SUM_BASE
-#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
-};
-
-#if !defined (_STLP_STATIC_CONST_INIT_BUG)
-# if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
-template <class _CharT, class _Traits, class _Alloc>
-const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0;
-# endif
-#endif
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS basic_string<char, char_traits<char>, allocator<char> >;
-# if defined (_STLP_HAS_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
-# endif
-#endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-#if defined (basic_string)
-_STLP_MOVE_TO_STD_NAMESPACE
-# undef basic_string
-#endif
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-# include <stl/_string_workaround.h>
-#endif
-
-#if defined (_STLP_DEBUG)
-# include <stl/debug/_string.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-// ------------------------------------------------------------
-// Non-member functions.
-// Swap.
-#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
-template <class _CharT, class _Traits, class _Alloc>
-inline void _STLP_CALL
-swap(basic_string<_CharT,_Traits,_Alloc>& __x,
- basic_string<_CharT,_Traits,_Alloc>& __y)
-{ __x.swap(__y); }
-#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _CharT, class _Traits, class _Alloc>
-struct __move_traits<basic_string<_CharT, _Traits, _Alloc> > {
- typedef __stlp_movable implemented;
- //Completness depends on the allocator:
- typedef typename __move_traits<_Alloc>::complete complete;
-};
-/*#else
- * There is no need to specialize for string and wstring in this case
- * as the default __move_traits will already tell that string is movable
- * but not complete. We cannot define it as complete as nothing guaranty
- * that the STLport user hasn't specialized std::allocator for char or
- * wchar_t.
- */
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _CharT, class _Traits, class _Alloc>
-void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s,
- _CharT* __buf, size_t __n);
-
-#if defined(_STLP_USE_WIDE_INTERFACE)
-// A couple of functions to transfer between ASCII/Unicode
-wstring __ASCIIToWide(const char *ascii);
-string __WideToASCII(const wchar_t *wide);
-#endif
-
-inline const char* _STLP_CALL
-__get_c_string(const string& __str) { return __str.c_str(); }
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#include <stl/_string_operators.h>
-
-#if defined(_STLP_USE_NO_IOSTREAMS) || \
- (defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION))
-# include <stl/_string.c>
-#endif
-
-#endif /* _STLP_INTERNAL_STRING_H */
-
-/*
- * Local Variables:
- * mode:C++
- * End:
- */
diff --git a/stl/_string_base.h b/stl/_string_base.h
deleted file mode 100644
index 923049d..0000000
--- a/stl/_string_base.h
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright (c) 1997-1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * Copyright (c) 2003
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_STRING_BASE_H
-#define _STLP_STRING_BASE_H
-
-// ------------------------------------------------------------
-// Class _String_base.
-
-// _String_base is a helper class that makes it it easier to write an
-// exception-safe version of basic_string. The constructor allocates,
-// but does not initialize, a block of memory. The destructor
-// deallocates, but does not destroy elements within, a block of
-// memory. The destructor assumes that _M_start either is null, or else
-// points to a block of memory that was allocated using _String_base's
-// allocator and whose size is _M_end_of_storage._M_data - _M_start.
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-#ifndef _STLP_SHORT_STRING_SZ
-# define _STLP_SHORT_STRING_SZ 16
-#endif
-
-template <class _Tp, class _Alloc>
-class _String_base {
- typedef _String_base<_Tp, _Alloc> _Self;
-protected:
- _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
-public:
- //dums: Some compiler(MSVC6) require it to be public not simply protected!
- enum {_DEFAULT_SIZE = _STLP_SHORT_STRING_SZ};
- //This is needed by the full move framework
- typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type;
- typedef _STLP_alloc_proxy<_Tp*, _Tp, allocator_type> _AllocProxy;
- typedef size_t size_type;
-private:
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- union _Buffers {
- _Tp* _M_dynamic_buf;
- _Tp _M_static_buf[_DEFAULT_SIZE];
- } _M_buffers;
-#else
- _Tp* _M_start;
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
-protected:
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- bool _M_using_static_buf() const {
- return (_M_end_of_storage._M_data == _M_buffers._M_static_buf + _DEFAULT_SIZE);
- }
- _Tp const* _M_Start() const {
- return _M_using_static_buf()?_M_buffers._M_static_buf:_M_buffers._M_dynamic_buf;
- }
- _Tp* _M_Start() {
- return _M_using_static_buf()?_M_buffers._M_static_buf:_M_buffers._M_dynamic_buf;
- }
-#else
- _Tp const* _M_Start() const {return _M_start;}
- _Tp* _M_Start() {return _M_start;}
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
-
- _Tp* _M_finish;
- _AllocProxy _M_end_of_storage;
-
- _Tp const* _M_Finish() const {return _M_finish;}
- _Tp* _M_Finish() {return _M_finish;}
-
- // Precondition: 0 < __n <= max_size().
- void _M_allocate_block(size_t __n = _DEFAULT_SIZE);
- void _M_deallocate_block() {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (!_M_using_static_buf() && (_M_buffers._M_dynamic_buf != 0))
- _M_end_of_storage.deallocate(_M_buffers._M_dynamic_buf, _M_end_of_storage._M_data - _M_buffers._M_dynamic_buf);
-#else
- if (_M_start != 0)
- _M_end_of_storage.deallocate(_M_start, _M_end_of_storage._M_data - _M_start);
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- }
-
- size_t max_size() const {
- const size_type __string_max_size = size_type(-1) / sizeof(_Tp);
- typename allocator_type::size_type __alloc_max_size = _M_end_of_storage.max_size();
- return (min)(__alloc_max_size, __string_max_size) - 1;
- }
-
- _String_base(const allocator_type& __a)
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- : _M_finish(_M_buffers._M_static_buf), _M_end_of_storage(__a, _M_buffers._M_static_buf + _DEFAULT_SIZE)
-#else
- : _M_start(0), _M_finish(0), _M_end_of_storage(__a, (_Tp*)0)
-#endif
- {}
-
- _String_base(const allocator_type& __a, size_t __n)
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- : _M_finish(_M_buffers._M_static_buf), _M_end_of_storage(__a, _M_buffers._M_static_buf + _DEFAULT_SIZE) {
-#else
- : _M_start(0), _M_finish(0), _M_end_of_storage(__a, (_Tp*)0) {
-#endif
- _M_allocate_block(__n);
- }
-
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- void _M_move_src (_Self &src) {
- if (src._M_using_static_buf()) {
- _M_buffers = src._M_buffers;
- _M_finish = _M_buffers._M_static_buf + (src._M_finish - src._M_buffers._M_static_buf);
- _M_end_of_storage._M_data = _M_buffers._M_static_buf + _DEFAULT_SIZE;
- }
- else {
- _M_buffers._M_dynamic_buf = src._M_buffers._M_dynamic_buf;
- _M_finish = src._M_finish;
- _M_end_of_storage._M_data = src._M_end_of_storage._M_data;
- src._M_buffers._M_dynamic_buf = 0;
- }
- }
-#endif
-
- _String_base(__move_source<_Self> src)
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- : _M_end_of_storage(__move_source<_AllocProxy>(src.get()._M_end_of_storage)) {
- _M_move_src(src.get());
-#else
- : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
- _M_end_of_storage(__move_source<_AllocProxy>(src.get()._M_end_of_storage)) {
- src.get()._M_start = 0;
-#endif
- }
-
- ~_String_base() { _M_deallocate_block(); }
-
- void _M_reset(_Tp *__start, _Tp *__finish, _Tp *__end_of_storage) {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- _M_buffers._M_dynamic_buf = __start;
-#else
- _M_start = __start;
-#endif
- _M_finish = __finish;
- _M_end_of_storage._M_data = __end_of_storage;
- }
-
- void _M_destroy_back () {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (!_M_using_static_buf())
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- _STLP_STD::_Destroy(_M_finish);
- }
-
- void _M_destroy_range(size_t __from_off = 0, size_t __to_off = 1) {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (!_M_using_static_buf())
- _STLP_STD::_Destroy_Range(_M_buffers._M_dynamic_buf + __from_off, _M_finish + __to_off);
-#else
- _STLP_STD::_Destroy_Range(_M_start + __from_off, _M_finish + __to_off);
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- }
-
- void _M_destroy_ptr_range(_Tp *__f, _Tp *__l) {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (!_M_using_static_buf())
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- _STLP_STD::_Destroy_Range(__f, __l);
- }
-
- void _M_Swap(_Self &__s) {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (_M_using_static_buf()) {
- if (__s._M_using_static_buf()) {
- _STLP_STD::swap(_M_buffers, __s._M_buffers);
- _Tp *__tmp = _M_finish;
- _M_finish = _M_buffers._M_static_buf + (__s._M_finish - __s._M_buffers._M_static_buf);
- __s._M_finish = __s._M_buffers._M_static_buf + (__tmp - _M_buffers._M_static_buf);
- //We need to swap _M_end_of_storage for allocators with state:
- _M_end_of_storage.swap(__s._M_end_of_storage);
- _M_end_of_storage._M_data = _M_buffers._M_static_buf + _DEFAULT_SIZE;
- __s._M_end_of_storage._M_data = __s._M_buffers._M_static_buf + _DEFAULT_SIZE;
- } else {
- __s._M_Swap(*this);
- return;
- }
- }
- else if (__s._M_using_static_buf()) {
- _Tp *__tmp = _M_buffers._M_dynamic_buf;
- _Tp *__tmp_finish = _M_finish;
- _Tp *__tmp_end_data = _M_end_of_storage._M_data;
- _M_buffers = __s._M_buffers;
- //We need to swap _M_end_of_storage for allocators with state:
- _M_end_of_storage.swap(__s._M_end_of_storage);
- _M_end_of_storage._M_data = _M_buffers._M_static_buf + _DEFAULT_SIZE;
- _M_finish = _M_buffers._M_static_buf + (__s._M_finish - __s._M_buffers._M_static_buf);
- __s._M_buffers._M_dynamic_buf = __tmp;
- __s._M_end_of_storage._M_data = __tmp_end_data;
- __s._M_finish = __tmp_finish;
- }
- else {
- _STLP_STD::swap(_M_buffers._M_dynamic_buf, __s._M_buffers._M_dynamic_buf);
- _M_end_of_storage.swap(__s._M_end_of_storage);
- _STLP_STD::swap(_M_finish, __s._M_finish);
- }
-#else
- _STLP_STD::swap(_M_start, __s._M_start);
- _M_end_of_storage.swap(__s._M_end_of_storage);
- _STLP_STD::swap(_M_finish, __s._M_finish);
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- }
-
- void _STLP_FUNCTION_THROWS _M_throw_length_error() const;
- void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
-};
-
-#undef _STLP_SHORT_STRING_SZ
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS _String_base<char, allocator<char> >;
-# if defined (_STLP_HAS_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS _String_base<wchar_t, allocator<wchar_t> >;
-# endif
-#endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_STRING_BASE_H */
-
-/*
- * Local Variables:
- * mode:C++
- * End:
- */
diff --git a/stl/_string_fwd.h b/stl/_string_fwd.h
deleted file mode 100644
index 1520322..0000000
--- a/stl/_string_fwd.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_STRING_FWD_H
-#define _STLP_STRING_FWD_H
-
-#ifndef _STLP_IOSFWD
-# include <iosfwd>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-template <class _CharT,
- class _Traits = char_traits<_CharT>,
- class _Alloc = allocator<_CharT> >
-class basic_string;
-#else
-template <class _CharT,
- class _Traits,
- class _Alloc>
-class basic_string;
-#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
-
-typedef basic_string<char, char_traits<char>, allocator<char> > string;
-
-#if defined (_STLP_HAS_WCHAR_T)
-typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-//This function limits header dependency between exception and string
-//implementation. It is implemented in _string.h
-const char* _STLP_CALL __get_c_string(const string& __str);
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_STRING_FWD_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_string_hash.h b/stl/_string_hash.h
deleted file mode 100644
index c5f1339..0000000
--- a/stl/_string_hash.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 1997-1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_STRING_HASH_H
-#define _STLP_STRING_HASH_H
-
-#ifndef _STLP_HASH_FUN_H
-# include <stl/_hash_fun.h>
-#endif
-
-#ifndef _STLP_INTERNAL_STRING_H
-# include <stl/_string.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _CharT, class _Traits, class _Alloc>
-_STLP_INLINE_LOOP size_t
-__stl_string_hash(const basic_string<_CharT,_Traits,_Alloc>& __s) {
- unsigned long __h = 0;
- size_t __len = __s.size();
- const _CharT* __data = __s.data();
- for ( size_t __i = 0; __i < __len; ++__i)
- __h = /* 5 *__h */(__h << 2) + __h + __data[__i];
- return size_t(__h);
-}
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-
-template <class _CharT, class _Traits, class _Alloc>
-struct hash<basic_string<_CharT,_Traits,_Alloc> > {
- size_t operator()(const basic_string<_CharT,_Traits,_Alloc>& __s) const
- { return __stl_string_hash(__s); }
-};
-
-#else
-
-_STLP_TEMPLATE_NULL
-struct _STLP_CLASS_DECLSPEC hash<string> {
- size_t operator()(const string& __s) const
- { return __stl_string_hash(__s); }
-};
-
-# if defined (_STLP_HAS_WCHAR_T)
-_STLP_TEMPLATE_NULL
-struct _STLP_CLASS_DECLSPEC hash<wstring> {
- size_t operator()(const wstring& __s) const
- { return __stl_string_hash(__s); }
-};
-# endif
-
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-_STLP_END_NAMESPACE
-
-#endif
diff --git a/stl/_string_sum.h b/stl/_string_sum.h
deleted file mode 100644
index 98e1e31..0000000
--- a/stl/_string_sum.h
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Copyright (c) 2003
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_STRING_SUM_H
-#define _STLP_STRING_SUM_H
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-/*char wrapper to simulate basic_string*/
-template <class _CharT>
-struct __char_wrapper {
- typedef const _CharT& const_reference;
-
- __char_wrapper(_CharT __val) : _Val(__val) {}
-
- _CharT getValue() const { return _Val; }
- size_t size() const { return 1; }
-
- const_reference operator[] (size_t __n) const {
- //To avoid a check on __n we use this strange implementation
- return (&_Val)[__n];
- }
-
-private:
- _CharT _Val;
-};
-
-/*C string wrapper to simulate basic_string*/
-template <class _CharT>
-struct __cstr_wrapper {
- typedef const _CharT& const_reference;
-
- __cstr_wrapper(const _CharT *__cstr, size_t __size) :
- _CStr(__cstr), _Size(__size) {}
-
- const _CharT* c_str() const { return _CStr; }
-
- size_t size() const { return _Size; }
-
- const_reference operator[] (size_t __n) const { return _CStr[__n]; }
-
-private:
- const _CharT *_CStr;
- size_t _Size;
-};
-
-/*basic_string wrapper to ensure that we only store a reference to the original string and not copy it*/
-template <class _CharT, class _Traits, class _Alloc>
-struct __bstr_wrapper {
- typedef const _CharT& const_reference;
- typedef basic_string<_CharT, _Traits, _Alloc> _BString;
-
- __bstr_wrapper (_BString const& __s) :
- _BStr(__s) {}
-
- size_t size() const { return _BStr.size(); }
-
- const_reference operator[] (size_t __n) const { return _BStr[__n]; }
-
- _BString const& b_str() const { return _BStr; }
-
-private:
- _BString const& _BStr;
-};
-
-struct __on_left {};
-struct __on_right {};
-
-template <class _CharT, class _Traits, class _Alloc,
- class _Left, class _Right,
- class _StorageDirection>
-class __bstr_sum {
-public:
- typedef basic_string<_CharT, _Traits, _Alloc> _BString;
- typedef typename _BString::const_reference const_reference;
- typedef typename _BString::const_iterator const_iterator;
- typedef typename _BString::const_reverse_iterator const_reverse_iterator;
- typedef typename _BString::size_type size_type;
- typedef typename _BString::allocator_type allocator_type;
- typedef __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDirection> _Self;
-
- __bstr_sum (_Left const& lhs, _Right const& rhs) :
- _lhs(lhs), _rhs(rhs) {}
-
- _Left const& getLhs() const { return _lhs; }
- _Right const& getRhs() const { return _rhs; }
-
- allocator_type get_allocator() const { return _M_get_storage(false).get_allocator(); }
-
- const_iterator begin() const { return _M_get_storage().begin(); }
- const_iterator end() const { return _M_get_storage().end(); }
- const_reverse_iterator rbegin() const { return _M_get_storage().rbegin(); }
- const_reverse_iterator rend() const { return _M_get_storage().rend(); }
-
- size_type size() const { return _lhs.size() + _rhs.size(); }
- size_type length() const { return size(); }
-
- size_t max_size() const { return _M_get_storage().max_size(); }
- size_type capacity() const { return size(); }
- bool empty() const { return size() == 0; }
-
- const_reference operator[](size_t __n) const
- { return (__n < _lhs.size())?_lhs[__n]:_rhs[__n - _lhs.size()]; }
-
- const_reference at(size_type __n) const
- { return _M_get_storage().at(__n); }
-
- //operator +=
- typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __bstr_wrapper<_CharT, _Traits, _Alloc>, __on_left> _BStrOnLeft;
- _BStrOnLeft operator += (const _BString& __s) { return append(__s); }
-
- typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __cstr_wrapper<_CharT>, __on_left> _CStrOnLeft;
- _CStrOnLeft operator += (const _CharT* __s) { return append(__s); }
-
- typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __char_wrapper<_CharT>, __on_left> _CharOnLeft;
- _CharOnLeft operator += (_CharT __c) { return _CharOnLeft(*this, __c); }
-
- //append
- _BStrOnLeft append (const _BString& __s)
- { return _BStrOnLeft(*this, __s); }
- _BString& append(const _BString& __s, size_type __pos, size_type __n)
- { return _M_get_storage().append(__s, __pos, __n); }
- _CStrOnLeft append(const _CharT* __s) {
- const size_type __n = _Traits::length(__s);
- return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n));
- }
- _CStrOnLeft append(const _CharT* __s, size_type __n)
- { return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n)); }
- _BString& append(size_type __n, _CharT __c)
- {return _M_get_storage().append(__n, __c);}
- template <class _InputIter>
- _BString& append(_InputIter __first, _InputIter __last)
- {return _M_get_storage().append(__first, __last);}
-
- //assign
- _BString& assign(const _BString& __s) {return _M_get_storage().assign(__s);}
- _BString& assign(const _BString& __s, size_type __pos, size_type __n) {return _M_get_storage().assign(__s, __pos, __n);}
- _BString& assign(const _CharT* __s, size_type __n) {return _M_get_storage().assign(__s, __n);}
- _BString& assign(const _CharT* __s) {return _M_get_storage().assign(__s); }
- _BString& assign(size_type __n, _CharT __c) {return _M_get_storage().assign(__n, __c);}
-
- //insert
- _BString& insert(size_type __pos, const _BString& __s) {return _M_get_storage().insert(__pos, __s);}
- _BString& insert(size_type __pos, const _BString& __s, size_type __beg, size_type __n)
- {return _M_get_storage().insert(__pos, __s, __beg, __n);}
- _BString& insert(size_type __pos, const _CharT* __s, size_type __n) {return _M_get_storage().insert(__pos, __s, __n);}
- _BString& insert(size_type __pos, const _CharT* __s) {return _M_get_storage().insert(__pos, __s);}
- _BString& insert(size_type __pos, size_type __n, _CharT __c) {return _M_get_storage().insert(__pos, __n, __c);}
-
- //erase
- _BString& erase(size_type __pos = 0, size_type __n =_BString::npos) {return _M_get_storage().erase(__pos, __n);}
-
- //replace
- _BString& replace(size_type __pos, size_type __n, const _BString& __s)
- {return _M_get_storage().replace(__pos, __n, __s);}
- _BString& replace(size_type __pos1, size_type __n1, const _BString& __s, size_type __pos2, size_type __n2)
- {return _M_get_storage().replace(__pos1, __n1, __s, __pos2, __n2);}
- _BString& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2)
- {return _M_get_storage().replace(__pos, __n1, __s, __n2);}
- _BString& replace(size_type __pos, size_type __n1, const _CharT* __s)
- {return _M_get_storage().replace(__pos, __n1, __s);}
- _BString& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
- {return _M_get_storage().replace(__pos, __n1, __n2, __c);}
-
- size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
- {return _M_get_storage().copy(__s, __n, __pos);}
-
- void swap(_BString& __s)
- {_M_get_storage().swap(__s);}
-
- const _CharT* c_str() const { return _M_get_storage().c_str(); }
- const _CharT* data() const { return _M_get_storage().data(); }
-
- //find family
- size_type find(const _BString& __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); }
- size_type find(const _CharT* __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); }
- size_type find(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().find(__s, __pos, __n); }
- size_type find(_CharT __c, size_type __pos = 0) const { return _M_get_storage().find(__c, __pos); }
-
- size_type rfind(const _BString& __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); }
- size_type rfind(const _CharT* __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); }
- size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().rfind(__s, __pos, __n); }
- size_type rfind(_CharT __c, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__c, __pos); }
-
- size_type find_first_of(const _BString& __s, size_type __pos = 0) const
- { return _M_get_storage().find_first_of(__s, __pos); }
- size_type find_first_of(const _CharT* __s, size_type __pos = 0) const
- { return _M_get_storage().find_first_of(__s, __pos); }
- size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
- { return _M_get_storage().find_first_of(__s, __pos, __n); }
- size_type find_first_of(_CharT __c, size_type __pos = 0) const
- { return _M_get_storage().find(__c, __pos); }
-
- size_type find_last_of(const _BString& __s, size_type __pos = _BString::npos) const
- { return _M_get_storage().find_last_of(__s, __pos); }
- size_type find_last_of(const _CharT* __s, size_type __pos = _BString::npos) const
- { return _M_get_storage().find_last_of(__s, __pos); }
- size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
- { return _M_get_storage().find_last_of(__s, __pos, __n); }
- size_type find_last_of(_CharT __c, size_type __pos = _BString::npos) const
- { return _M_get_storage().rfind(__c, __pos); }
-
- size_type find_first_not_of(const _BString& __s, size_type __pos = 0) const
- { return _M_get_storage().find_first_not_of(__s, __pos); }
- size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const
- { return _M_get_storage().find_first_not_of(__s, __pos); }
- size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
- { return _M_get_storage().find_first_not_of(__s, __pos, __n); }
- size_type find_first_not_of(_CharT __c, size_type __pos = 0) const
- { return _M_get_storage().find_first_not_of(__c, __pos); }
-
- size_type find_last_not_of(const _BString& __s, size_type __pos = _BString::npos) const
- { return _M_get_storage().find_last_not_of(__s, __pos); }
- size_type find_last_not_of(const _CharT* __s, size_type __pos =_BString:: npos) const
- { return _M_get_storage().find_last_not_of(__s, __pos); }
- size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
- { return _M_get_storage().find_last_not_of(__s, __pos, __n); }
- size_type find_last_not_of(_CharT __c, size_type __pos = _BString::npos) const
- { return _M_get_storage().find_last_not_of(__c, __pos); }
-
- _BString substr(size_type __pos = 0, size_type __n = _BString::npos) const
- { return _M_get_storage().substr(__pos, __n); }
-
- //compare
- int compare(const _BString& __s) const
- { return _M_get_storage().compare(__s); }
- int compare(size_type __pos1, size_type __n1, const _Self& __s) const
- { return _M_get_storage().compare(__pos1, __n1, __s); }
- int compare(size_type __pos1, size_type __n1, const _Self& __s, size_type __pos2, size_type __n2) const
- { return _M_get_storage().compare(__pos1, __n1, __s, __pos2, __n2); }
- int compare(const _CharT* __s) const
- { return _M_get_storage().compare(__s); }
- int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
- { return _M_get_storage().compare(__pos1, __n1, __s); }
- int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
- { return _M_get_storage().compare(__pos1, __n1, __s, __n2); }
-
- //Returns the underlying basic_string representation of the template expression
- //The non const method will always initialise it.
- _BString& _M_get_storage()
- { return _rhs._M_get_storage(*this, _StorageDirection()); }
-
- template <class _Lhs, class _Rhs, class _StorageDir>
- _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
- __on_left const& /*StorageDir*/)
- { return _lhs._M_get_storage(__ref); }
-
- template <class _Lhs, class _Rhs, class _StorageDir>
- _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
- __on_right const& /*StorageDir*/)
- { return _rhs._M_get_storage(__ref); }
-
- template <class _Lhs, class _Rhs, class _StorageDir>
- _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref)
- { return _M_get_storage(__ref, _StorageDirection()); }
-
- //The const method can be invoked without initialising the basic_string so avoiding dynamic allocation.
- _BString const& _M_get_storage(bool __do_init = true) const
- { return _M_get_storage(*this, __do_init, _StorageDirection()); }
-
- template <class _Lhs, class _Rhs, class _StorageDir>
- _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
- bool __do_init, __on_left const& /*StorageDir*/) const
- { return _lhs._M_get_storage(__ref, __do_init); }
-
- template <class _Lhs, class _Rhs, class _StorageDir>
- _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
- bool __do_init, __on_right const& /*StorageDir*/) const
- { return _rhs._M_get_storage(__ref, __do_init); }
-
- template <class _Lhs, class _Rhs, class _StorageDir>
- _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
- bool __do_init) const
- { return _M_get_storage(__ref, __do_init, _StorageDirection()); }
-
-private:
- _Left _lhs;
- _Right _rhs;
-};
-
-/*
- * For this operator we choose to use the right part as the storage part
- */
-template <class _CharT, class _Traits, class _Alloc,
- class _Lh1, class _Rh1, class _StoreDir1,
- class _Lh2, class _Rh2, class _StoreDir2>
-inline __bstr_sum<_CharT, _Traits, _Alloc,
- __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>,
- __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>,
- __on_right> _STLP_CALL
-operator + (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
- const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) {
- return __bstr_sum<_CharT, _Traits, _Alloc,
- __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>,
- __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>,
- __on_right>(__lhs, __rhs);
-}
-
-template <class _CharT, class _Traits, class _Alloc,
- class _Lh1, class _Rh1, class _StoreDir1,
- class _Lh2, class _Rh2, class _StoreDir2>
-inline bool _STLP_CALL
-operator == (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
- const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
-{ return (__lhs.size() == __rhs.size()) && (__lhs._M_get_storage() == __rhs._M_get_storage()); }
-
-template <class _CharT, class _Traits, class _Alloc,
- class _Lh1, class _Rh1, class _StoreDir1,
- class _Lh2, class _Rh2, class _StoreDir2>
-inline bool _STLP_CALL
-operator < (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
- const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
-{ return __lhs._M_get_storage() < __rhs._M_get_storage(); }
-
-#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-
-template <class _CharT, class _Traits, class _Alloc,
- class _Lh1, class _Rh1, class _StoreDir1,
- class _Lh2, class _Rh2, class _StoreDir2>
-inline bool _STLP_CALL
-operator != (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
- const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
-{ return !(__lhs == __rhs); }
-
-template <class _CharT, class _Traits, class _Alloc,
- class _Lh1, class _Rh1, class _StoreDir1,
- class _Lh2, class _Rh2, class _StoreDir2>
-inline bool _STLP_CALL
-operator > (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
- const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
-{ return __rhs < __lhs; }
-
-template <class _CharT, class _Traits, class _Alloc,
- class _Lh1, class _Rh1, class _StoreDir1,
- class _Lh2, class _Rh2, class _StoreDir2>
-inline bool _STLP_CALL
-operator <= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
- const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
-{ return !(__rhs < __lhs); }
-
-template <class _CharT, class _Traits, class _Alloc,
- class _Lh1, class _Rh1, class _StoreDir1,
- class _Lh2, class _Rh2, class _StoreDir2>
-inline bool _STLP_CALL
-operator >= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
- const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
-{ return !(__lhs < __rhs); }
-
-#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
-
-
-/*
- * This class will be used to simulate a temporary string that is required for
- * a call to the c_str method on the __bstr_sum class.
- */
-
-template <class _CharT, class _Traits, class _Alloc>
-struct __sum_storage_elem {
- typedef basic_string<_CharT, _Traits, _Alloc> _BString;
-
- __sum_storage_elem(_Alloc __alloc) : _M_init(false), _M_storage(__alloc)
- {}
-
- template <class _Left, class _Right, class _StorageDir>
- void _M_Init(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref) const {
- if (!_M_init) {
- _M_storage = __ref;
- _M_init = true;
- }
- }
-
- template <class _Left, class _Right, class _StorageDir>
- _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref,
- bool __do_init) const {
- if (__do_init) {
- _M_Init(__ref);
- }
- return _M_storage;
- }
- template <class _Left, class _Right, class _StorageDir>
- _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref) {
- _M_Init(__ref);
- return _M_storage;
- }
-
- size_t size() const { return 0; }
- _CharT const& operator[](size_t __n) const
- { return __STATIC_CAST(_CharT*, 0)[__n]; }
-
-private:
- mutable bool _M_init;
- mutable basic_string<_CharT, _Traits, _Alloc> _M_storage;
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#endif /*_STLP_STRING_SUM_H*/
diff --git a/stl/_string_sum_methods.h b/stl/_string_sum_methods.h
deleted file mode 100644
index 952ce18..0000000
--- a/stl/_string_sum_methods.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (c) 2003
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/*
- * All the necessary methods used for template expressions with basic_string
- * This file do not have to be macro guarded as it is only used in the _string.h
- * file and it is a part of the basic_string definition.
- */
-
-public:
- template <class _Left, class _Right, class _StorageDir>
- basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s)
- : _STLP_STRING_SUM_BASE(_Reserve_t(), __s.size(), __s.get_allocator())
- { _M_append_sum(__s); }
-
- template <class _Left, class _Right, class _StorageDir>
- basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
- size_type __pos, size_type __n = npos,
- const allocator_type& __a = allocator_type())
- : _STLP_STRING_SUM_BASE(_Reserve_t(), (__pos <= __s.size()) ? ((min) (__n, __s.size() - __pos)) : 0, __a) {
- size_type __size = __s.size();
- if (__pos > __size)
- this->_M_throw_out_of_range();
- else
- _M_append_sum_pos(__s, __pos, (min) (__n, __size - __pos));
- }
-
-private:
- _CharT* _M_append_fast(_STLP_PRIV __char_wrapper<_CharT> __c, _CharT *__buf) {
- _STLP_STD::_Copy_Construct(__buf, __c.getValue());
- return __buf + 1;
- }
- _CharT* _M_append_fast(_CharT const* __s, size_type __s_size, _CharT *__buf)
- { return uninitialized_copy(__s, __s + __s_size, __buf); }
- _CharT* _M_append_fast(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf)
- { return _M_append_fast(__s.c_str(), __s.size(), __buf); }
- _CharT* _M_append_fast(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _CharT *__buf)
- { return _M_append_fast(__s.b_str(), __buf); }
- _CharT* _M_append_fast(_Self const& __s, _CharT *__buf)
- { return _M_append_fast(__s.data(), __s.size(), __buf); }
- _CharT* _M_append_fast(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _CharT *__buf)
- { return __buf; }
- template <class _Left, class _Right, class _StorageDir>
- _CharT* _M_append_fast(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, _CharT *__buf)
- { return _M_append_fast(__s.getRhs(), _M_append_fast(__s.getLhs(), __buf)); }
-
- _CharT* _M_append_fast_pos(_STLP_PRIV __char_wrapper<_CharT> __c, _CharT *__buf, size_type /*__pos*/, size_type __n) {
- if (__n == 0)
- return __buf;
- _STLP_STD::_Copy_Construct(__buf, __c.getValue());
- return __buf + 1;
- }
- _CharT* _M_append_fast_pos(_CharT const* __s, size_type __s_size, _CharT *__buf,
- size_type __pos, size_type __n)
- { return uninitialized_copy(__s + __pos, __s + __pos + (min)(__n, __s_size - __pos), __buf); }
- _CharT* _M_append_fast_pos(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf,
- size_type __pos, size_type __n)
- { return _M_append_fast_pos(__s.c_str(), __s.size(), __buf, __pos, __n); }
- _CharT* _M_append_fast_pos(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _CharT *__buf,
- size_type __pos, size_type __n)
- { return _M_append_fast_pos(__s.b_str(), __buf, __pos, __n); }
- _CharT* _M_append_fast_pos(_Self const& __s, _CharT *__buf,
- size_type __pos, size_type __n)
- { return _M_append_fast_pos(__s.data(), __s.size(), __buf, __pos, __n); }
- _CharT* _M_append_fast_pos(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _CharT *__buf,
- size_type, size_type)
- { return __buf; }
-
- template <class _Left, class _Right, class _StorageDir>
- _CharT* _M_append_fast_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
- _CharT *__buf, size_type __pos, size_type __n) {
- if (__n == 0) {
- return __buf;
- }
- size_type __lhs_size = __s.getLhs().size();
- if (__pos < __lhs_size) {
- if (__n < (__lhs_size - __pos)) {
- return _M_append_fast_pos(__s.getLhs(), __buf, __pos, __n);
- } else {
- return _M_append_fast_pos(__s.getRhs(), _M_append_fast_pos(__s.getLhs(), __buf, __pos, __n),
- 0, __n - (__lhs_size - __pos));
- }
- } else {
- return _M_append_fast_pos(__s.getRhs(), __buf, __pos - __lhs_size, __n);
- }
- }
-
- /* Note: We always force use of dynamic buffer if the short string optim option is activated
- * to avoid complicated code if the basic_string was instanciated with a non POD type.
- * In such a case we should use assignment for objects in the static array something that we
- * do not do.
- */
- size_type _M_get_additional_size(size_type __new_size, const __false_type& /*_Char_Is_POD*/) const {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- //To avoid problem with the string assumptions, never allocate a dynamic buffer smaller or equal
- //than the static one:
- if (__new_size < _Base::_DEFAULT_SIZE + 1)
- return (_Base::_DEFAULT_SIZE + 1) - __new_size;
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- return 0;
- }
- size_type _M_get_additional_size(size_type, const __true_type& /*_Char_Is_POD*/) const
- { return 0; }
-
- template <class _Left, class _Right, class _StorageDir>
- _Self& _M_append_sum (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s) {
- size_type __s_size = __s.size();
- if (__s_size == 0)
- return *this;
- const size_type __old_size = this->size();
- if (__s_size > this->max_size() || __old_size > (this->max_size() - __s_size))
- this->_M_throw_length_error();
- size_type __offset_size = _M_get_additional_size(__old_size + __s_size, _Char_Is_POD());
- if (__old_size + __s_size + __offset_size > this->capacity()) {
- const size_type __len = __old_size + __offset_size + (max)(__old_size, __s_size) + 1;
- pointer __new_start = this->_M_end_of_storage.allocate(__len);
- pointer __new_finish = __new_start;
- _STLP_TRY {
- __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
- __new_finish = this->_M_append_fast(__s, __new_finish);
- this->_M_construct_null(__new_finish);
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
- this->_M_end_of_storage.deallocate(__new_start,__len)))
- this->_M_destroy_range();
- this->_M_deallocate_block();
- this->_M_reset(__new_start, __new_finish, __new_start + __len);
- }
- else {
- _M_append_sum_no_overflow(__s, 0, __s_size);
- }
- return *this;
- }
-
- template <class _Left, class _Right, class _StorageDir>
- _Self& _M_append_sum_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
- size_type __pos, size_type __n) {
- size_type __s_size = (min)(__s.size() - __pos, __n);
- if (__s_size == 0)
- return *this;
- const size_type __old_size = this->size();
- if (__s_size > this->max_size() || __old_size > (this->max_size() - __s_size))
- this->_M_throw_length_error();
- size_type __offset_size = _M_get_additional_size(__old_size + __s_size, _Char_Is_POD());
- if (__old_size + __s_size + __offset_size > this->capacity()) {
- const size_type __len = __old_size + __offset_size + (max)(__old_size, __s_size) + 1;
- pointer __new_start = this->_M_end_of_storage.allocate(__len);
- pointer __new_finish = __new_start;
- _STLP_TRY {
- __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
- __new_finish = _M_append_fast_pos(__s, __new_finish, __pos, __s_size);
- this->_M_construct_null(__new_finish);
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
- this->_M_end_of_storage.deallocate(__new_start,__len)))
- this->_M_destroy_range();
- this->_M_deallocate_block();
- this->_M_reset(__new_start, __new_finish, __new_start + __len);
- }
- else {
- _M_append_sum_no_overflow(__s, __pos, __s_size);
- }
- return *this;
- }
-
- template <class _Left, class _Right, class _StorageDir>
- void _M_append_sum_no_overflow(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
- size_type __pos, size_type __n) {
- pointer __finish = this->_M_Finish();
- _M_append_fast_pos(__s, __finish + 1, __pos + 1, __n - 1);
- _STLP_TRY {
- this->_M_construct_null(__finish + __n);
- }
- _STLP_UNWIND(this->_M_destroy_ptr_range(__finish + 1, __finish + __n))
- /* The call to the traits::assign method is only important for non POD types because the instance
- * pointed to by _M_finish has been constructed (default constructor) and should not be constructed
- * (copy constructor) once again. For POD it is irrelevant, uninitialized_copy could be fine,
- * but we are not going to make two implementations just for that.
- */
- _Traits::assign(*this->_M_finish, __s[__pos]);
- this->_M_finish += __n;
- }
diff --git a/stl/_string_workaround.h b/stl/_string_workaround.h
deleted file mode 100644
index acd5d3d..0000000
--- a/stl/_string_workaround.h
+++ /dev/null
@@ -1,733 +0,0 @@
-/*
- * Copyright (c) 2004
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-//Included from _string.h, no need for macro guarding.
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_DEBUG)
-# define basic_string _STLP_NON_DBG_NAME(str)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-#define _STLP_NO_MEM_T_STRING_BASE _STLP_PRIV _STLP_NO_MEM_T_NAME(str)<_CharT, _Traits, _Alloc>
-
-template <class _CharT, class _Traits, class _Alloc>
-class basic_string : public _STLP_NO_MEM_T_STRING_BASE
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && \
- !defined (basic_string)
- , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
-#endif
-{
-protected: // Protected members inherited from base.
- typedef basic_string<_CharT, _Traits, _Alloc> _Self;
- typedef _STLP_NO_MEM_T_STRING_BASE _Base;
- typedef typename _Base::_Char_Is_POD _Char_Is_POD;
-
-public:
-
- __IMPORT_WITH_REVERSE_ITERATORS(_Base)
-
- typedef typename _Base::_Iterator_category _Iterator_category;
- typedef typename _Base::traits_type traits_type;
- typedef typename _Base::_Reserve_t _Reserve_t;
-
-public: // Constructor, destructor, assignment.
- explicit basic_string(const allocator_type& __a = allocator_type())
- : _STLP_NO_MEM_T_STRING_BASE(__a) {}
-
- basic_string(_Reserve_t __r, size_t __n,
- const allocator_type& __a = allocator_type())
- : _STLP_NO_MEM_T_STRING_BASE(__r, __n, __a) {}
-
- basic_string(const _Self& __s)
- : _STLP_NO_MEM_T_STRING_BASE(__s) {}
-
- basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
- const allocator_type& __a = allocator_type())
- : _STLP_NO_MEM_T_STRING_BASE(__s, __pos, __n, __a) {}
-
- basic_string(const _CharT* __s, size_type __n,
- const allocator_type& __a = allocator_type())
- : _STLP_NO_MEM_T_STRING_BASE(__s, __n, __a) {}
-
- basic_string(const _CharT* __s,
- const allocator_type& __a = allocator_type())
- : _STLP_NO_MEM_T_STRING_BASE(__s, __a) {}
-
- basic_string(size_type __n, _CharT __c,
- const allocator_type& __a = allocator_type())
- : _STLP_NO_MEM_T_STRING_BASE(__n, __c, __a) {}
-
- basic_string(__move_source<_Self> src)
- : _STLP_NO_MEM_T_STRING_BASE(__move_source<_Base>(src.get())) {}
-
- // Check to see if _InputIterator is an integer type. If so, then
- // it can't be an iterator.
-#if !(defined(__MRC__) || (defined(__SC__) && !defined(__DMC__))) //*ty 04/30/2001 - mpw compilers choke on this ctor
- template <class _InputIterator>
- basic_string(_InputIterator __f, _InputIterator __l,
- const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
- : _STLP_NO_MEM_T_STRING_BASE(_Base::_CalledFromWorkaround_t(), __a) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_initialize_dispatch(__f, __l, _Integral());
- }
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- basic_string(_InputIterator __f, _InputIterator __l)
- : _STLP_NO_MEM_T_STRING_BASE(_Base::_CalledFromWorkaround_t(), allocator_type()) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_initialize_dispatch(__f, __l, _Integral());
- }
-# endif
-#endif /* !__MRC__ || (__SC__ && !__DMC__) */
-
- _Self& operator=(const _Self& __s) {
- _Base::operator=(__s);
- return *this;
- }
-
- _Self& operator=(const _CharT* __s) {
- _Base::operator=(__s);
- return *this;
- }
-
- _Self& operator=(_CharT __c) {
- _Base::operator=(__c);
- return *this;
- }
-
-private:
- template <class _InputIter>
- void _M_range_initialize(_InputIter __f, _InputIter __l,
- const input_iterator_tag &__tag) {
- this->_M_allocate_block();
- this->_M_construct_null(this->_M_Finish());
- _STLP_TRY {
- _M_appendT(__f, __l, __tag);
- }
- _STLP_UNWIND(this->_M_destroy_range())
- }
-
- template <class _ForwardIter>
- void _M_range_initialize(_ForwardIter __f, _ForwardIter __l,
- const forward_iterator_tag &) {
- difference_type __n = distance(__f, __l);
- this->_M_allocate_block(__n + 1);
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf()) {
- _M_copyT(__f, __l, this->_M_Start());
- this->_M_finish = this->_M_Start() + __n;
- }
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start());
- this->_M_terminate_string();
- }
-
- template <class _InputIter>
- void _M_range_initializeT(_InputIter __f, _InputIter __l) {
- _M_range_initialize(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
- }
-
- template <class _Integer>
- void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) {
- this->_M_allocate_block(__n + 1);
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf()) {
- _Traits::assign(this->_M_Start(), __n, __x);
- this->_M_finish = this->_M_Start() + __n;
- }
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- this->_M_finish = uninitialized_fill_n(this->_M_Start(), __n, __x);
- this->_M_terminate_string();
- }
-
- template <class _InputIter>
- void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
- _M_range_initializeT(__f, __l);
- }
-
-public: // Append, operator+=, push_back.
- _Self& operator+=(const _Self& __s) {
- _Base::operator+=(__s);
- return *this;
- }
- _Self& operator+=(const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- _Base::operator+=(__s);
- return *this;
- }
- _Self& operator+=(_CharT __c) {
- _Base::operator+=(__c);
- return *this;
- }
-
- _Self& append(const _Self& __s) {
- _Base::append(__s);
- return *this;
- }
-
- _Self& append(const _Self& __s,
- size_type __pos, size_type __n) {
- _Base::append(__s, __pos, __n);
- return *this;
- }
-
- _Self& append(const _CharT* __s, size_type __n) {
- _STLP_FIX_LITERAL_BUG(__s)
- _Base::append(__s, __n);
- return *this;
- }
- _Self& append(const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- _Base::append(__s);
- return *this;
- }
- _Self& append(size_type __n, _CharT __c) {
- _Base::append(__n, __c);
- return *this;
- }
-
- // Check to see if _InputIterator is an integer type. If so, then
- // it can't be an iterator.
- template <class _InputIter>
- _Self& append(_InputIter __first, _InputIter __last) {
- typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
- return _M_append_dispatch(__first, __last, _Integral());
- }
-
-#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
- //See equivalent assign method remark.
- _Self& append(const _CharT* __f, const _CharT* __l) {
- _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
- _Base::append(__f, __l);
- return *this;
- }
-#endif
-
-private: // Helper functions for append.
-
- template <class _InputIter>
- _Self& _M_appendT(_InputIter __first, _InputIter __last,
- const input_iterator_tag &) {
- for ( ; __first != __last ; ++__first)
- _Base::push_back(*__first);
- return *this;
- }
-
- template <class _ForwardIter>
- _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last,
- const forward_iterator_tag &) {
- if (__first != __last) {
- const size_type __old_size = this->size();
- difference_type __n = distance(__first, __last);
- if (__STATIC_CAST(size_type,__n) > max_size() || __old_size > max_size() - __STATIC_CAST(size_type,__n))
- this->_M_throw_length_error();
- if (__old_size + __n > capacity()) {
- const size_type __len = __old_size +
- (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
- pointer __new_start = this->_M_end_of_storage.allocate(__len);
- pointer __new_finish = __new_start;
- _STLP_TRY {
- __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
- __new_finish = uninitialized_copy(__first, __last, __new_finish);
- _M_construct_null(__new_finish);
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
- this->_M_end_of_storage.deallocate(__new_start,__len)))
- this->_M_destroy_range();
- this->_M_deallocate_block();
- this->_M_reset(__new_start, __new_finish, __new_start + __len);
- }
- else {
- _ForwardIter __f1 = __first;
- ++__f1;
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _M_copyT(__f1, __last, this->_M_Finish() + 1);
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- uninitialized_copy(__f1, __last, this->_M_Finish() + 1);
- _STLP_TRY {
- this->_M_construct_null(this->_M_Finish() + __n);
- }
- _STLP_UNWIND(this->_M_destroy_ptr_range(this->_M_Finish() + 1, this->_M_Finish() + __n))
- _Traits::assign(*this->_M_finish, *__first);
- this->_M_finish += __n;
- }
- }
- return *this;
- }
-
- template <class _Integer>
- _Self& _M_append_dispatch(_Integer __n, _Integer __x, const __true_type& /*Integral*/) {
- return append((size_type) __n, (_CharT) __x);
- }
-
- template <class _InputIter>
- _Self& _M_append_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*Integral*/) {
- return _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
- }
-
-public: // Assign
-
- _Self& assign(const _Self& __s) {
- _Base::assign(__s);
- return *this;
- }
-
- _Self& assign(const _Self& __s,
- size_type __pos, size_type __n) {
- _Base::assign(__s, __pos, __n);
- return *this;
- }
-
- _Self& assign(const _CharT* __s, size_type __n) {
- _STLP_FIX_LITERAL_BUG(__s)
- _Base::assign(__s, __n);
- return *this;
- }
-
- _Self& assign(const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- _Base::assign(__s);
- return *this;
- }
-
- _Self& assign(size_type __n, _CharT __c) {
- _Base::assign(__n, __c);
- return *this;
- }
-
-private: // Helper functions for assign.
-
- template <class _Integer>
- _Self& _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) {
- return assign((size_type) __n, (_CharT) __x);
- }
-
- template <class _InputIter>
- _Self& _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
- pointer __cur = this->_M_Start();
- while (__f != __l && __cur != this->_M_Finish()) {
- _Traits::assign(*__cur, *__f);
- ++__f;
- ++__cur;
- }
- if (__f == __l)
- _Base::erase(__cur, this->_M_Finish());
- else
- _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
- return *this;
- }
-
-public:
- // Check to see if _InputIterator is an integer type. If so, then
- // it can't be an iterator.
- template <class _InputIter>
- _Self& assign(_InputIter __first, _InputIter __last) {
- typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
- return _M_assign_dispatch(__first, __last, _Integral());
- }
-
-#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
- /* This method is not part of the standard and is a specialization of the
- * template method assign. It is only granted for convenience to call assign
- * with mixed parameters iterator and const_iterator.
- */
- _Self& assign(const _CharT* __f, const _CharT* __l) {
- _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
- _Base::assign(__f, __l);
- return *this;
- }
-#endif
-
-public: // Insert
-
- _Self& insert(size_type __pos, const _Self& __s) {
- _Base::insert(__pos, __s);
- return *this;
- }
-
- _Self& insert(size_type __pos, const _Self& __s,
- size_type __beg, size_type __n) {
- _Base::insert(__pos, __s, __beg, __n);
- return *this;
- }
- _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
- _STLP_FIX_LITERAL_BUG(__s)
- _Base::insert(__pos, __s, __n);
- return *this;
- }
-
- _Self& insert(size_type __pos, const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- _Base::insert(__pos, __s);
- return *this;
- }
-
- _Self& insert(size_type __pos, size_type __n, _CharT __c) {
- _Base::insert(__pos, __n, __c);
- return *this;
- }
-
- iterator insert(iterator __p, _CharT __c) {
- return _Base::insert(__p, __c);
- }
-
- void insert(iterator __p, size_t __n, _CharT __c) {
- _Base::insert(__p, __n, __c);
- }
-
- // Check to see if _InputIterator is an integer type. If so, then
- // it can't be an iterator.
- template <class _InputIter>
- void insert(iterator __p, _InputIter __first, _InputIter __last) {
- typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
- _M_insert_dispatch(__p, __first, __last, _Integral());
- }
-
-private: // Helper functions for insert.
-
- void _M_insert(iterator __p, const _CharT* __f, const _CharT* __l, bool __self_ref) {
- _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
- _Base::_M_insert(__p, __f, __l, __self_ref);
- }
-
- template <class _ForwardIter>
- void _M_insert_overflow(iterator __position, _ForwardIter __first, _ForwardIter __last,
- difference_type __n) {
- const size_type __old_size = this->size();
- const size_type __len = __old_size + (max)(__old_size, __STATIC_CAST(size_type,__n)) + 1;
- pointer __new_start = this->_M_end_of_storage.allocate(__len);
- pointer __new_finish = __new_start;
- _STLP_TRY {
- __new_finish = uninitialized_copy(this->_M_Start(), __position, __new_start);
- __new_finish = uninitialized_copy(__first, __last, __new_finish);
- __new_finish = uninitialized_copy(__position, this->_M_Finish(), __new_finish);
- this->_M_construct_null(__new_finish);
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
- this->_M_end_of_storage.deallocate(__new_start,__len)))
- this->_M_destroy_range();
- this->_M_deallocate_block();
- this->_M_reset(__new_start, __new_finish, __new_start + __len);
- }
-
- template <class _InputIter>
- void _M_insertT(iterator __p, _InputIter __first, _InputIter __last,
- const input_iterator_tag &) {
- for ( ; __first != __last; ++__first) {
- __p = insert(__p, *__first);
- ++__p;
- }
- }
-
- template <class _ForwardIter>
- void _M_insertT(iterator __position, _ForwardIter __first, _ForwardIter __last,
- const forward_iterator_tag &) {
- if (__first != __last) {
- difference_type __n = distance(__first, __last);
- if (this->_M_end_of_storage._M_data - this->_M_finish >= __n + 1) {
- const difference_type __elems_after = this->_M_finish - __position;
- if (__elems_after >= __n) {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _Base::_M_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
- this->_M_finish += __n;
- _Traits::move(__position + __n, __position, (__elems_after - __n) + 1);
- _M_copyT(__first, __last, __position);
- }
- else {
- pointer __old_finish = this->_M_Finish();
- _ForwardIter __mid = __first;
- advance(__mid, __elems_after + 1);
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _M_copyT(__mid, __last, this->_M_Finish() + 1);
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- uninitialized_copy(__mid, __last, this->_M_Finish() + 1);
- this->_M_finish += __n - __elems_after;
- _STLP_TRY {
-#if defined (_STLP_USE_SHORT_STRING_OPTIM)
- if (this->_M_using_static_buf())
- _Base::_M_copy(__position, __old_finish + 1, this->_M_Finish());
- else
-#endif /* _STLP_USE_SHORT_STRING_OPTIM */
- uninitialized_copy(__position, __old_finish + 1, this->_M_Finish());
- this->_M_finish += __elems_after;
- }
- _STLP_UNWIND((this->_M_destroy_ptr_range(__old_finish + 1, this->_M_Finish()),
- this->_M_finish = __old_finish))
- _M_copyT(__first, __mid, __position);
- }
- }
- else {
- _M_insert_overflow(__position, __first, __last, __n);
- }
- }
- }
-
- template <class _Integer>
- void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x,
- const __true_type& /*Integral*/) {
- insert(__p, (size_type) __n, (_CharT) __x);
- }
-
- template <class _InputIter>
- void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last,
- const __false_type& /*Integral*/) {
- _STLP_FIX_LITERAL_BUG(__p)
- /*
- * Within the basic_string implementation we are only going to check for
- * self referencing if iterators are string iterators or _CharT pointers.
- * A user could encapsulate those iterator within their own iterator interface
- * and in this case lead to a bad behavior, this is a known limitation.
- */
- typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsIterator;
- typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
- typedef typename _Lor2<_IsIterator, _IsConstIterator>::_Ret _CheckInside;
- _M_insert_aux(__p, __first, __last, _CheckInside());
- }
-
- template <class _RandomIter>
- void _M_insert_aux (iterator __p, _RandomIter __first, _RandomIter __last,
- const __true_type& /*_CheckInside*/) {
- _STLP_FIX_LITERAL_BUG(__p)
- _M_insert(__p, &(*__first), &(*__last), _Base::_M_inside(&(*__first)));
- }
-
- template<class _InputIter>
- void _M_insert_aux (iterator __p, _InputIter __first, _InputIter __last,
- const __false_type& /*_CheckInside*/) {
- _STLP_FIX_LITERAL_BUG(__p)
- _M_insertT(__p, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
- }
-
- template <class _InputIterator>
- void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) {
- _STLP_FIX_LITERAL_BUG(__p)
- for ( ; __first != __last; ++__first, ++__result)
- _Traits::assign(*__result, *__first);
- }
-
-#if !defined (_STLP_NO_METHOD_SPECIALIZATION)
- void _M_copyT(const _CharT* __f, const _CharT* __l, _CharT* __res) {
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) _STLP_FIX_LITERAL_BUG(__res)
- _Base::_M_copy(__f, __l, __res);
- }
-#endif
-
-public: // Erase.
-
- _Self& erase(size_type __pos = 0, size_type __n = npos) {
- _Base::erase(__pos, __n);
- return *this;
- }
-
- iterator erase(iterator __pos) {
- _STLP_FIX_LITERAL_BUG(__pos)
- return _Base::erase(__pos);
- }
-
- iterator erase(iterator __first, iterator __last) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- return _Base::erase(__first, __last);
- }
-
-public: // Replace. (Conceptually equivalent
- // to erase followed by insert.)
- _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
- _Base::replace(__pos, __n, __s);
- return *this;
- }
-
- _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
- size_type __pos2, size_type __n2) {
- _Base::replace(__pos1, __n1, __s, __pos2, __n2);
- return *this;
- }
-
- _Self& replace(size_type __pos, size_type __n1,
- const _CharT* __s, size_type __n2) {
- _STLP_FIX_LITERAL_BUG(__s)
- _Base::replace(__pos, __n1, __s, __n2);
- return *this;
- }
-
- _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- _Base::replace(__pos, __n1, __s);
- return *this;
- }
-
- _Self& replace(size_type __pos, size_type __n1,
- size_type __n2, _CharT __c) {
- _Base::replace(__pos, __n1, __n2, __c);
- return *this;
- }
-
- _Self& replace(iterator __first, iterator __last, const _Self& __s) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- _Base::replace(__first, __last, __s);
- return *this;
- }
-
- _Self& replace(iterator __first, iterator __last,
- const _CharT* __s, size_type __n) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- _STLP_FIX_LITERAL_BUG(__s)
- _Base::replace(__first, __last, __s, __n);
- return *this;
- }
-
- _Self& replace(iterator __first, iterator __last,
- const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- _STLP_FIX_LITERAL_BUG(__s)
- _Base::replace(__first, __last, __s);
- return *this;
- }
-
- _Self& replace(iterator __first, iterator __last,
- size_type __n, _CharT __c) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- _Base::replace(__first, __last, __n, __c);
- return *this;
- }
-
- // Check to see if _InputIter is an integer type. If so, then
- // it can't be an iterator.
- template <class _InputIter>
- _Self& replace(iterator __first, iterator __last,
- _InputIter __f, _InputIter __l) {
- _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
- typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
- return _M_replace_dispatch(__first, __last, __f, __l, _Integral());
- }
-
-#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
- _Self& replace(iterator __first, iterator __last,
- const _CharT* __f, const _CharT* __l) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- _Base::replace(__first, __last, __f, __l);
- return *this;
- }
-#endif
-
-protected: // Helper functions for replace.
- _Self& _M_replace(iterator __first, iterator __last,
- const _CharT* __f, const _CharT* __l, bool __self_ref) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- _Base::_M_replace(__first, __last, __f, __l, __self_ref);
- return *this;
- }
-
- template <class _Integer>
- _Self& _M_replace_dispatch(iterator __first, iterator __last,
- _Integer __n, _Integer __x, const __true_type& /*IsIntegral*/) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- return replace(__first, __last, (size_type) __n, (_CharT) __x);
- }
-
- template <class _InputIter>
- _Self& _M_replace_dispatch(iterator __first, iterator __last,
- _InputIter __f, _InputIter __l, const __false_type& /*IsIntegral*/) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsIterator;
- typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
- typedef typename _Lor2<_IsIterator, _IsConstIterator>::_Ret _CheckInside;
- return _M_replace_aux(__first, __last, __f, __l, _CheckInside());
- }
-
- template <class _RandomIter>
- _Self& _M_replace_aux(iterator __first, iterator __last,
- _RandomIter __f, _RandomIter __l, __true_type const& /*_CheckInside*/) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- return _M_replace(__first, __last, &(*__f), &(*__l), _Base::_M_inside(&(*__f)));
- }
-
- template <class _InputIter>
- _Self& _M_replace_aux(iterator __first, iterator __last,
- _InputIter __f, _InputIter __l, __false_type const& /*_CheckInside*/) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- return _M_replaceT(__first, __last, __f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
- }
-
- template <class _InputIter>
- _Self& _M_replaceT(iterator __first, iterator __last,
- _InputIter __f, _InputIter __l, const input_iterator_tag&__ite_tag) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- for ( ; __first != __last && __f != __l; ++__first, ++__f)
- _Traits::assign(*__first, *__f);
- if (__f == __l)
- _Base::erase(__first, __last);
- else
- _M_insertT(__last, __f, __l, __ite_tag);
- return *this;
- }
-
- template <class _ForwardIter>
- _Self& _M_replaceT(iterator __first, iterator __last,
- _ForwardIter __f, _ForwardIter __l, const forward_iterator_tag &__ite_tag) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- difference_type __n = distance(__f, __l);
- const difference_type __len = __last - __first;
- if (__len >= __n) {
- _M_copyT(__f, __l, __first);
- _Base::erase(__first + __n, __last);
- }
- else {
- _ForwardIter __m = __f;
- advance(__m, __len);
- _M_copyT(__f, __m, __first);
- _M_insertT(__last, __m, __l, __ite_tag);
- }
- return *this;
- }
-
-public: // Other modifier member functions.
-
- void swap(_Self& __s)
- { _Base::swap(__s); }
-
-public: // Substring.
-
- _Self substr(size_type __pos = 0, size_type __n = npos) const
- { return _Self(*this, __pos, __n, get_allocator()); }
-
-#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG)
-# define _STLP_STRING_SUM_BASE _STLP_NO_MEM_T_STRING_BASE
-# include <stl/_string_sum_methods.h>
-# undef _STLP_STRING_SUM_BASE
-#endif
-};
-
-#undef _STLP_NO_MEM_T_STRING_BASE
-
-#if defined (basic_string)
-_STLP_MOVE_TO_STD_NAMESPACE
-# undef basic_string
-#endif
-
-_STLP_END_NAMESPACE
diff --git a/stl/_tempbuf.h b/stl/_tempbuf.h
deleted file mode 100644
index b50e6d4..0000000
--- a/stl/_tempbuf.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_TEMPBUF_H
-#define _STLP_INTERNAL_TEMPBUF_H
-
-#ifndef _STLP_CLIMITS
-# include <climits>
-#endif
-
-#ifndef _STLP_INTERNAL_CSTDLIB
-# include <stl/_cstdlib.h>
-#endif
-
-#ifndef _STLP_INTERNAL_UNINITIALIZED_H
-# include <stl/_uninitialized.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _Tp>
-pair<_Tp*, ptrdiff_t> _STLP_CALL
-__get_temporary_buffer(ptrdiff_t __len, _Tp*);
-
-#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
-
-template <class _Tp>
-inline pair<_Tp*, ptrdiff_t> _STLP_CALL get_temporary_buffer(ptrdiff_t __len) {
- return __get_temporary_buffer(__len, (_Tp*) 0);
-}
-
-# if ! defined(_STLP_NO_EXTENSIONS)
-// This overload is not required by the standard; it is an extension.
-// It is supported for backward compatibility with the HP STL, and
-// because not all compilers support the language feature (explicit
-// function template arguments) that is required for the standard
-// version of get_temporary_buffer.
-template <class _Tp>
-inline pair<_Tp*, ptrdiff_t> _STLP_CALL
-get_temporary_buffer(ptrdiff_t __len, _Tp*) {
- return __get_temporary_buffer(__len, (_Tp*) 0);
-}
-# endif
-#endif
-
-template <class _Tp>
-inline void _STLP_CALL return_temporary_buffer(_Tp* __p) {
-// SunPro brain damage
- free((char*)__p);
-}
-
-template <class _ForwardIterator, class _Tp>
-class _Temporary_buffer {
-private:
- ptrdiff_t _M_original_len;
- ptrdiff_t _M_len;
- _Tp* _M_buffer;
-
- void _M_allocate_buffer() {
- _M_original_len = _M_len;
- _M_buffer = 0;
-
- if (_M_len > (ptrdiff_t)(INT_MAX / sizeof(_Tp)))
- _M_len = INT_MAX / sizeof(_Tp);
-
- while (_M_len > 0) {
- _M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp));
- if (_M_buffer)
- break;
- _M_len /= 2;
- }
- }
-
- void _M_initialize_buffer(const _Tp&, const __true_type&) {}
- void _M_initialize_buffer(const _Tp& val, const __false_type&) {
- uninitialized_fill_n(_M_buffer, _M_len, val);
- }
-
-public:
- ptrdiff_t size() const { return _M_len; }
- ptrdiff_t requested_size() const { return _M_original_len; }
- _Tp* begin() { return _M_buffer; }
- _Tp* end() { return _M_buffer + _M_len; }
-
- _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) {
- // Workaround for a __type_traits bug in the pre-7.3 compiler.
-# if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION < 730
- typedef typename __type_traits<_Tp>::is_POD_type _Trivial;
-# else
- typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Trivial;
-# endif
- _STLP_TRY {
- _M_len = distance(__first, __last);
- _M_allocate_buffer();
- if (_M_len > 0)
- _M_initialize_buffer(*__first, _Trivial());
- }
- _STLP_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0)
- }
-
- ~_Temporary_buffer() {
- _STLP_STD::_Destroy_Range(_M_buffer, _M_buffer + _M_len);
- free(_M_buffer);
- }
-
-private:
- // Disable copy constructor and assignment operator.
- _Temporary_buffer(const _Temporary_buffer<_ForwardIterator, _Tp>&) {}
- void operator=(const _Temporary_buffer<_ForwardIterator, _Tp>&) {}
-};
-
-# ifndef _STLP_NO_EXTENSIONS
-
-// Class temporary_buffer is not part of the standard. It is an extension.
-
-template <class _ForwardIterator,
- class _Tp
-#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
- = typename iterator_traits<_ForwardIterator>::value_type
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
- >
-struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp>
-{
- temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
- : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) {}
- ~temporary_buffer() {}
-};
-
-# endif /* _STLP_NO_EXTENSIONS */
-
-_STLP_END_NAMESPACE
-
-# ifndef _STLP_LINK_TIME_INSTANTIATION
-# include <stl/_tempbuf.c>
-# endif
-
-#endif /* _STLP_INTERNAL_TEMPBUF_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_threads.c b/stl/_threads.c
deleted file mode 100644
index 40641e8..0000000
--- a/stl/_threads.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_THREADS_C
-#define _STLP_THREADS_C
-
-#ifndef _STLP_INTERNAL_THREADS_H
-# include <stl/_threads.h>
-#endif
-
-#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
-
-#if defined (_STLP_SGI_THREADS)
-# include <time.h>
-#elif defined (_STLP_UNIX)
-# ifndef _STLP_INTERNAL_CTIME
-# include <stl/_ctime.h>
-# endif
-# if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_VENDOR_GLOBAL_CSTD)
-using _STLP_VENDOR_CSTD::time_t;
-# endif
-# include <sys/time.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if (_STLP_STATIC_TEMPLATE_DATA > 0)
-
-# if defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
-template<int __32bits>
-_STLP_STATIC_MUTEX
-_Atomic_swap_struct<__32bits>::_S_swap_lock _STLP_MUTEX_INITIALIZER;
-# undef _STLP_USE_ATOMIC_SWAP_MUTEX
-# endif
-
-# if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
-template <int __inst>
-unsigned _STLP_mutex_spin<__inst>::__max = _STLP_mutex_spin<__inst>::__low_max;
-
-template <int __inst>
-unsigned _STLP_mutex_spin<__inst>::__last = 0;
-# endif // _STLP_USE_PTHREAD_SPINLOCK
-
-#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
-
-# if defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
-__DECLARE_INSTANCE(_STLP_STATIC_MUTEX, _Atomic_swap_struct<sizeof(__stl_atomic_t) == sizeof(void*)>::_S_swap_lock,
- _STLP_MUTEX_INITIALIZER );
-# undef _STLP_USE_ATOMIC_SWAP_MUTEX
-# endif /* _STLP_PTHREADS */
-
-# if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
-__DECLARE_INSTANCE(unsigned, _STLP_mutex_spin<0>::__max, =30);
-__DECLARE_INSTANCE(unsigned, _STLP_mutex_spin<0>::__last, =0);
-# endif // _STLP_USE_PTHREAD_SPINLOCK
-
-#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
-
-#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
-
-# if defined (_STLP_SPARC_SOLARIS_THREADS)
-// underground function in libc.so; we do not want dependance on librt
-extern "C" int __nanosleep(const struct timespec*, struct timespec*);
-# define _STLP_NANOSLEEP __nanosleep
-# else
-# define _STLP_NANOSLEEP nanosleep
-# endif
-
-template <int __inst>
-void _STLP_CALL
-_STLP_mutex_spin<__inst>::_S_nsec_sleep(int __log_nsec) {
-# if defined (_STLP_WIN32THREADS)
- if (__log_nsec <= 20) {
- // Note from boost (www.boost.org):
- // Changed to Sleep(1) from Sleep(0).
- // According to MSDN, Sleep(0) will never yield
- // to a lower-priority thread, whereas Sleep(1)
- // will. Performance seems not to be affected.
- Sleep(1);
- } else {
- Sleep(1 << (__log_nsec - 20));
- }
-# elif defined(_STLP_OS2THREADS)
- if (__log_nsec <= 20) {
- DosSleep(0);
- } else {
- DosSleep(1 << (__log_nsec - 20));
- }
-# elif defined (_STLP_UNIX)
- timespec __ts;
- /* Max sleep is 2**27nsec ~ 60msec */
- __ts.tv_sec = 0;
- __ts.tv_nsec = 1 << __log_nsec;
- _STLP_NANOSLEEP(&__ts, 0);
-# endif
-}
-
-template <int __inst>
-void _STLP_CALL
-_STLP_mutex_spin<__inst>::_M_do_lock(volatile __stl_atomic_t* __lock) {
-# if defined(_STLP_ATOMIC_EXCHANGE)
- if (_Atomic_swap(__lock, 1)) {
- unsigned __my_spin_max = _STLP_mutex_spin<0>::__max;
- unsigned __my_last_spins = _STLP_mutex_spin<0>::__last;
- volatile unsigned __junk = 17; // Value doesn't matter.
- unsigned __i;
-
- for (__i = 0; __i < __my_spin_max; ++__i) {
- if (__i < __my_last_spins/2 || *__lock) {
- __junk *= __junk; __junk *= __junk;
- __junk *= __junk; __junk *= __junk;
- } else {
- if (!_Atomic_swap(__lock, 1)) {
- // got it!
- // Spinning worked. Thus we're probably not being scheduled
- // against the other process with which we were contending.
- // Thus it makes sense to spin longer the next time.
- _STLP_mutex_spin<0>::__last = __i;
- _STLP_mutex_spin<0>::__max = _STLP_mutex_spin<0>::__high_max;
- return;
- }
- }
- }
-
- // We are probably being scheduled against the other process. Sleep.
- _STLP_mutex_spin<0>::__max = _STLP_mutex_spin<0>::__low_max;
-
- for (__i = 0 ;; ++__i) {
- int __log_nsec = __i + 6;
-
- if (__log_nsec > 27) __log_nsec = 27;
- if (!_Atomic_swap(__lock, 1)) {
- break;
- }
- _S_nsec_sleep(__log_nsec);
- }
- } /* first _Atomic_swap */
-# endif
-}
-#endif // _STLP_USE_PTHREAD_SPINLOCK
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
-#endif /* _STLP_THREADS_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_threads.h b/stl/_threads.h
deleted file mode 100644
index ca96ca2..0000000
--- a/stl/_threads.h
+++ /dev/null
@@ -1,700 +0,0 @@
-/*
- * Copyright (c) 1997-1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-// WARNING: This is an internal header file, included by other C++
-// standard library headers. You should not attempt to use this header
-// file directly.
-
-
-#ifndef _STLP_INTERNAL_THREADS_H
-#define _STLP_INTERNAL_THREADS_H
-
-// Supported threading models are native SGI, pthreads, uithreads
-// (similar to pthreads, but based on an earlier draft of the Posix
-// threads standard), and Win32 threads. Uithread support by Jochen
-// Schlick, 1999, and Solaris threads generalized to them.
-
-#ifndef _STLP_INTERNAL_CSTDDEF
-# include <stl/_cstddef.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CSTDLIB
-# include <stl/_cstdlib.h>
-#endif
-
-// On SUN and Mac OS X gcc, zero-initialization works just fine...
-#if defined (__sun) || (defined (__GNUC__) && defined(__APPLE__))
-# define _STLP_MUTEX_INITIALIZER
-#endif
-
-/* This header defines the following atomic operation that platform should
- * try to support as much as possible. Atomic operation are exposed as macro
- * in order to easily test for their existance. They are:
- * __stl_atomic_t _STLP_ATOMIC_INCREMENT(volatile __stl_atomic_t* __ptr) :
- * increment *__ptr by 1 and returns the new value
- * __stl_atomic_t _STLP_ATOMIC_DECREMENT(volatile __stl_atomic_t* __ptr) :
- * decrement *__ptr by 1 and returns the new value
- * __stl_atomic_t _STLP_ATOMIC_EXCHANGE(volatile __stl_atomic_t* __target, __stl_atomic_t __val) :
- * assign __val to *__target and returns former *__target value
- * void* _STLP_ATOMIC_EXCHANGE_PTR(void* volatile* __target, void* __ptr) :
- * assign __ptr to *__target and returns former *__target value
- * __stl_atomic_t _STLP_ATOMIC_ADD(volatile __stl_atomic_t* __target, __stl_atomic_t __val) :
- * does *__target = *__target + __val and returns the old *__target value
- */
-
-#if defined (_STLP_WIN32) || defined (__sgi) || defined (_STLP_SPARC_SOLARIS_THREADS)
-typedef long __stl_atomic_t;
-#else
-/* Don't import whole namespace!!!! - ptr */
-// # if defined (_STLP_USE_NAMESPACES) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
-// // using _STLP_VENDOR_CSTD::size_t;
-// using namespace _STLP_VENDOR_CSTD;
-// # endif
-typedef size_t __stl_atomic_t;
-#endif
-
-#if defined (_STLP_THREADS)
-
-# if defined (_STLP_SGI_THREADS)
-
-# include <mutex.h>
-// Hack for SGI o32 compilers.
-# if !defined(__add_and_fetch) && \
- (__mips < 3 || !(defined (_ABIN32) || defined(_ABI64)))
-# define __add_and_fetch(__l,__v) add_then_test((unsigned long*)__l,__v)
-# define __test_and_set(__l,__v) test_and_set(__l,__v)
-# endif /* o32 */
-
-# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64))
-# define _STLP_ATOMIC_EXCHANGE(__p, __q) test_and_set(__p, __q)
-# else
-# define _STLP_ATOMIC_EXCHANGE(__p, __q) __test_and_set((unsigned long*)__p, (unsigned long)__q)
-# endif
-
-# define _STLP_ATOMIC_INCREMENT(__x) __add_and_fetch(__x, 1)
-# define _STLP_ATOMIC_DECREMENT(__x) __add_and_fetch(__x, (size_t) -1)
-
-# elif defined (_STLP_PTHREADS)
-
-# include <pthread.h>
-# if !defined (_STLP_USE_PTHREAD_SPINLOCK)
-# if defined (PTHREAD_MUTEX_INITIALIZER) && !defined (_STLP_MUTEX_INITIALIZER) && defined (_REENTRANT)
-# define _STLP_MUTEX_INITIALIZER = { PTHREAD_MUTEX_INITIALIZER }
-# endif
-//HPUX variants have (on some platforms optional) non-standard "DCE" pthreads impl
-# if defined (_DECTHREADS_) && (defined (_PTHREAD_USE_D4) || defined (__hpux)) && !defined (_CMA_SUPPRESS_EXTERNALS_)
-# define _STLP_PTHREAD_ATTR_DEFAULT pthread_mutexattr_default
-# else
-# define _STLP_PTHREAD_ATTR_DEFAULT 0
-# endif
-# else // _STLP_USE_PTHREAD_SPINLOCK
-# if defined (__OpenBSD__)
-# include <spinlock.h>
-# endif
-# endif // _STLP_USE_PTHREAD_SPINLOCK
-
-# if defined (__GNUC__) && defined (__i386__)
-
-# if !defined (_STLP_ATOMIC_INCREMENT)
-inline long _STLP_atomic_increment_gcc_x86(long volatile* p) {
- long result;
- __asm__ __volatile__
- ("lock; xaddl %1, %0;"
- :"=m" (*p), "=r" (result)
- :"m" (*p), "1" (1)
- :"cc");
- return result + 1;
-}
-# define _STLP_ATOMIC_INCREMENT(__x) (_STLP_atomic_increment_gcc_x86((long volatile*)__x))
-# endif
-
-# if !defined (_STLP_ATOMIC_DECREMENT)
-inline long _STLP_atomic_decrement_gcc_x86(long volatile* p) {
- long result;
- __asm__ __volatile__
- ("lock; xaddl %1, %0;"
- :"=m" (*p), "=r" (result)
- :"m" (*p), "1" (-1)
- :"cc");
- return result - 1;
-}
-# define _STLP_ATOMIC_DECREMENT(__x) (_STLP_atomic_decrement_gcc_x86((long volatile*)__x))
-# endif
-
-# if !defined (_STLP_ATOMIC_ADD)
-inline long _STLP_atomic_add_gcc_x86(long volatile* p, long addend) {
- long result;
- __asm__ __volatile__
- ("lock; xaddl %1, %0;"
- :"=m" (*p), "=r" (result)
- :"m" (*p), "1" (addend)
- :"cc");
- return result + addend;
-}
-# define _STLP_ATOMIC_ADD(__dst, __val) (_STLP_atomic_add_gcc_x86((long volatile*)__dst, (long)__val))
-# endif
-
-# endif /* if defined(__GNUC__) && defined(__i386__) */
-
-# elif defined (_STLP_WIN32THREADS)
-
-# if !defined (_STLP_ATOMIC_INCREMENT)
-# if !defined (_STLP_NEW_PLATFORM_SDK)
-# define _STLP_ATOMIC_INCREMENT(__x) InterlockedIncrement(__CONST_CAST(long*, __x))
-# define _STLP_ATOMIC_DECREMENT(__x) InterlockedDecrement(__CONST_CAST(long*, __x))
-# define _STLP_ATOMIC_EXCHANGE(__x, __y) InterlockedExchange(__CONST_CAST(long*, __x), __y)
-# else
-# define _STLP_ATOMIC_INCREMENT(__x) InterlockedIncrement(__x)
-# define _STLP_ATOMIC_DECREMENT(__x) InterlockedDecrement(__x)
-# define _STLP_ATOMIC_EXCHANGE(__x, __y) InterlockedExchange(__x, __y)
-# endif
-# define _STLP_ATOMIC_EXCHANGE_PTR(__x, __y) STLPInterlockedExchangePointer(__x, __y)
-/*
- * The following functionnality is only available since Windows 98, those that are targeting previous OSes
- * should define _WIN32_WINDOWS to a value lower that the one of Win 98, see Platform SDK documentation for
- * more informations:
- */
-# if defined (_STLP_NEW_PLATFORM_SDK) && (!defined (_STLP_WIN32_VERSION) || (_STLP_WIN32_VERSION >= 0x0410))
-# define _STLP_ATOMIC_ADD(__dst, __val) InterlockedExchangeAdd(__dst, __val)
-# endif
-# endif
-
-# elif defined (__DECC) || defined (__DECCXX)
-
-# include <machine/builtins.h>
-# define _STLP_ATOMIC_EXCHANGE __ATOMIC_EXCH_LONG
-# define _STLP_ATOMIC_INCREMENT(__x) __ATOMIC_ADD_LONG(__x, 1)
-# define _STLP_ATOMIC_DECREMENT(__x) __ATOMIC_ADD_LONG(__x, -1)
-
-# elif defined(_STLP_SPARC_SOLARIS_THREADS)
-
-# include <stl/_sparc_atomic.h>
-
-# elif defined (_STLP_UITHREADS)
-
-// this inclusion is potential hazard to bring up all sorts
-// of old-style headers. Let's assume vendor already know how
-// to deal with that.
-# ifndef _STLP_INTERNAL_CTIME
-# include <stl/_ctime.h>
-# endif
-# if defined (_STLP_USE_NAMESPACES) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
-using _STLP_VENDOR_CSTD::time_t;
-# endif
-# include <synch.h>
-# include <cstdio>
-# include <cwchar>
-
-# elif defined (_STLP_BETHREADS)
-
-# include <OS.h>
-# include <cassert>
-# include <stdio.h>
-# define _STLP_MUTEX_INITIALIZER = { 0 }
-
-# elif defined (_STLP_NWTHREADS)
-
-# include <nwthread.h>
-# include <nwsemaph.h>
-
-# elif defined(_STLP_OS2THREADS)
-
-# if defined (__GNUC__)
-# define INCL_DOSSEMAPHORES
-# include <os2.h>
-# else
-// This section serves to replace os2.h for VisualAge C++
- typedef unsigned long ULONG;
-# if !defined (__HEV__) /* INCL_SEMAPHORE may also define HEV */
-# define __HEV__
- typedef ULONG HEV;
- typedef HEV* PHEV;
-# endif
- typedef ULONG APIRET;
- typedef ULONG HMTX;
- typedef HMTX* PHMTX;
- typedef const char* PCSZ;
- typedef ULONG BOOL32;
- APIRET _System DosCreateMutexSem(PCSZ pszName, PHEV phev, ULONG flAttr, BOOL32 fState);
- APIRET _System DosRequestMutexSem(HMTX hmtx, ULONG ulTimeout);
- APIRET _System DosReleaseMutexSem(HMTX hmtx);
- APIRET _System DosCloseMutexSem(HMTX hmtx);
-# define _STLP_MUTEX_INITIALIZER = { 0 }
-# endif /* GNUC */
-
-# endif
-
-#else
-/* no threads */
-# define _STLP_ATOMIC_INCREMENT(__x) ++(*__x)
-# define _STLP_ATOMIC_DECREMENT(__x) --(*__x)
-/* We do not grant other atomic operations as they are useless if STLport do not have
- * to be thread safe
- */
-#endif
-
-#if !defined (_STLP_MUTEX_INITIALIZER)
-# if defined(_STLP_ATOMIC_EXCHANGE)
-# define _STLP_MUTEX_INITIALIZER = { 0 }
-# elif defined(_STLP_UITHREADS)
-# define _STLP_MUTEX_INITIALIZER = { DEFAULTMUTEX }
-# else
-# define _STLP_MUTEX_INITIALIZER
-# endif
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
-// Helper struct. This is a workaround for various compilers that don't
-// handle static variables in inline functions properly.
-template <int __inst>
-struct _STLP_mutex_spin {
- enum { __low_max = 30, __high_max = 1000 };
- // Low if we suspect uniprocessor, high for multiprocessor.
- static unsigned __max;
- static unsigned __last;
- static void _STLP_CALL _M_do_lock(volatile __stl_atomic_t* __lock);
- static void _STLP_CALL _S_nsec_sleep(int __log_nsec);
-};
-#endif // !_STLP_USE_PTHREAD_SPINLOCK
-
-// Locking class. Note that this class *does not have a constructor*.
-// It must be initialized either statically, with _STLP_MUTEX_INITIALIZER,
-// or dynamically, by explicitly calling the _M_initialize member function.
-// (This is similar to the ways that a pthreads mutex can be initialized.)
-// There are explicit member functions for acquiring and releasing the lock.
-
-// There is no constructor because static initialization is essential for
-// some uses, and only a class aggregate (see section 8.5.1 of the C++
-// standard) can be initialized that way. That means we must have no
-// constructors, no base classes, no virtual functions, and no private or
-// protected members.
-
-// For non-static cases, clients should use _STLP_mutex.
-
-struct _STLP_CLASS_DECLSPEC _STLP_mutex_base {
-#if defined (_STLP_ATOMIC_EXCHANGE) || defined (_STLP_SGI_THREADS)
- // It should be relatively easy to get this to work on any modern Unix.
- volatile __stl_atomic_t _M_lock;
-#endif
-
-#if defined (_STLP_THREADS)
-# if defined (_STLP_ATOMIC_EXCHANGE)
- inline void _M_initialize() { _M_lock = 0; }
- inline void _M_destroy() {}
-
- void _M_acquire_lock() {
- _STLP_mutex_spin<0>::_M_do_lock(&_M_lock);
- }
-
- inline void _M_release_lock() {
- volatile __stl_atomic_t* __lock = &_M_lock;
-# if defined(_STLP_SGI_THREADS) && defined(__GNUC__) && __mips >= 3
- asm("sync");
- *__lock = 0;
-# elif defined(_STLP_SGI_THREADS) && __mips >= 3 && \
- (defined (_ABIN32) || defined(_ABI64))
- __lock_release(__lock);
-# elif defined (_STLP_SPARC_SOLARIS_THREADS)
-# if defined (__WORD64) || defined (__arch64__) || defined (__sparcv9) || defined (__sparcv8plus)
- asm("membar #StoreStore ; membar #LoadStore");
-# else
- asm(" stbar ");
-# endif
- *__lock = 0;
-# else
- *__lock = 0;
- // This is not sufficient on many multiprocessors, since
- // writes to protected variables and the lock may be reordered.
-# endif
- }
-# elif defined (_STLP_PTHREADS)
-# if defined (_STLP_USE_PTHREAD_SPINLOCK)
-# if !defined (__OpenBSD__)
- pthread_spinlock_t _M_lock;
- inline void _M_initialize() { pthread_spin_init( &_M_lock, 0 ); }
- inline void _M_destroy() { pthread_spin_destroy( &_M_lock ); }
-
- // sorry, but no static initializer for pthread_spinlock_t;
- // this will not work for compilers that has problems with call
- // constructor of static object...
-
- // _STLP_mutex_base()
- // { pthread_spin_init( &_M_lock, 0 ); }
-
- // ~_STLP_mutex_base()
- // { pthread_spin_destroy( &_M_lock ); }
-
- inline void _M_acquire_lock() { pthread_spin_lock( &_M_lock ); }
- inline void _M_release_lock() { pthread_spin_unlock( &_M_lock ); }
-# else // __OpenBSD__
- spinlock_t _M_lock;
- inline void _M_initialize() { _SPINLOCK_INIT( &_M_lock ); }
- inline void _M_destroy() { }
- inline void _M_acquire_lock() { _SPINLOCK( &_M_lock ); }
- inline void _M_release_lock() { _SPINUNLOCK( &_M_lock ); }
-# endif // __OpenBSD__
-# else // !_STLP_USE_PTHREAD_SPINLOCK
- pthread_mutex_t _M_lock;
- inline void _M_initialize()
- { pthread_mutex_init(&_M_lock,_STLP_PTHREAD_ATTR_DEFAULT); }
- inline void _M_destroy()
- { pthread_mutex_destroy(&_M_lock); }
- inline void _M_acquire_lock() {
-# if defined ( __hpux ) && ! defined (PTHREAD_MUTEX_INITIALIZER)
- if (!_M_lock.field1) _M_initialize();
-# endif
- pthread_mutex_lock(&_M_lock);
- }
- inline void _M_release_lock() { pthread_mutex_unlock(&_M_lock); }
-# endif // !_STLP_USE_PTHREAD_SPINLOCK
-
-# elif defined (_STLP_UITHREADS)
- mutex_t _M_lock;
- inline void _M_initialize()
- { mutex_init(&_M_lock, 0, NULL); }
- inline void _M_destroy()
- { mutex_destroy(&_M_lock); }
- inline void _M_acquire_lock() { mutex_lock(&_M_lock); }
- inline void _M_release_lock() { mutex_unlock(&_M_lock); }
-
-# elif defined (_STLP_OS2THREADS)
- HMTX _M_lock;
- inline void _M_initialize() { DosCreateMutexSem(NULL, &_M_lock, 0, false); }
- inline void _M_destroy() { DosCloseMutexSem(_M_lock); }
- inline void _M_acquire_lock() {
- if (!_M_lock) _M_initialize();
- DosRequestMutexSem(_M_lock, SEM_INDEFINITE_WAIT);
- }
- inline void _M_release_lock() { DosReleaseMutexSem(_M_lock); }
-# elif defined (_STLP_BETHREADS)
- sem_id sem;
- inline void _M_initialize() {
- sem = create_sem(1, "STLPort");
- assert(sem > 0);
- }
- inline void _M_destroy() {
- int t = delete_sem(sem);
- assert(t == B_NO_ERROR);
- }
- inline void _M_acquire_lock();
- inline void _M_release_lock() {
- status_t t = release_sem(sem);
- assert(t == B_NO_ERROR);
- }
-# elif defined (_STLP_NWTHREADS)
- LONG _M_lock;
- inline void _M_initialize()
- { _M_lock = OpenLocalSemaphore(1); }
- inline void _M_destroy()
- { CloseLocalSemaphore(_M_lock); }
- inline void _M_acquire_lock()
- { WaitOnLocalSemaphore(_M_lock); }
- inline void _M_release_lock() { SignalLocalSemaphore(_M_lock); }
-# else //*ty 11/24/2001 - added configuration check
-# error "Unknown thread facility configuration"
-# endif
-#else /* No threads */
- inline void _M_initialize() {}
- inline void _M_destroy() {}
- inline void _M_acquire_lock() {}
- inline void _M_release_lock() {}
-#endif // _STLP_PTHREADS
-};
-
-// Locking class. The constructor initializes the lock, the destructor destroys it.
-// Well - behaving class, does not need static initializer
-
-class _STLP_CLASS_DECLSPEC _STLP_mutex : public _STLP_mutex_base {
- public:
- inline _STLP_mutex () { _M_initialize(); }
- inline ~_STLP_mutex () { _M_destroy(); }
- private:
- _STLP_mutex(const _STLP_mutex&);
- void operator=(const _STLP_mutex&);
-};
-
-// A locking class that uses _STLP_STATIC_MUTEX. The constructor takes
-// a reference to an _STLP_STATIC_MUTEX, and acquires a lock. The destructor
-// releases the lock.
-// It's not clear that this is exactly the right functionality.
-// It will probably change in the future.
-
-struct _STLP_CLASS_DECLSPEC _STLP_auto_lock {
- _STLP_auto_lock(_STLP_STATIC_MUTEX& __lock) : _M_lock(__lock)
- { _M_lock._M_acquire_lock(); }
- ~_STLP_auto_lock()
- { _M_lock._M_release_lock(); }
-
-private:
- _STLP_STATIC_MUTEX& _M_lock;
- void operator=(const _STLP_auto_lock&);
- _STLP_auto_lock(const _STLP_auto_lock&);
-};
-
-/*
- * Class _Refcount_Base provides a type, __stl_atomic_t, a data member,
- * _M_ref_count, and member functions _M_incr and _M_decr, which perform
- * atomic preincrement/predecrement. The constructor initializes
- * _M_ref_count.
- */
-class _STLP_CLASS_DECLSPEC _Refcount_Base {
- // The data member _M_ref_count
-#if defined (__DMC__)
-public:
-#endif
- _STLP_VOLATILE __stl_atomic_t _M_ref_count;
-
-#if defined (_STLP_THREADS) && \
- (!defined (_STLP_ATOMIC_INCREMENT) || !defined (_STLP_ATOMIC_DECREMENT) || \
- (defined (_STLP_WIN32_VERSION) && (_STLP_WIN32_VERSION <= 0x0400)))
-# define _STLP_USE_MUTEX
- _STLP_mutex _M_mutex;
-#endif
-
- public:
- // Constructor
- _Refcount_Base(__stl_atomic_t __n) : _M_ref_count(__n) {}
-
- // _M_incr and _M_decr
-#if defined (_STLP_THREADS)
-# if !defined (_STLP_USE_MUTEX)
- __stl_atomic_t _M_incr() { return _STLP_ATOMIC_INCREMENT(&_M_ref_count); }
- __stl_atomic_t _M_decr() { return _STLP_ATOMIC_DECREMENT(&_M_ref_count); }
-# else
-# undef _STLP_USE_MUTEX
- __stl_atomic_t _M_incr() {
- _STLP_auto_lock l(_M_mutex);
- return ++_M_ref_count;
- }
- __stl_atomic_t _M_decr() {
- _STLP_auto_lock l(_M_mutex);
- return --_M_ref_count;
- }
-# endif
-#else /* No threads */
- __stl_atomic_t _M_incr() { return ++_M_ref_count; }
- __stl_atomic_t _M_decr() { return --_M_ref_count; }
-#endif
-};
-
-/* Atomic swap on __stl_atomic_t
- * This is guaranteed to behave as though it were atomic only if all
- * possibly concurrent updates use _Atomic_swap.
- * In some cases the operation is emulated with a lock.
- * Idem for _Atomic_swap_ptr
- */
-/* Helper struct to handle following cases:
- * - on platforms where sizeof(__stl_atomic_t) == sizeof(void*) atomic
- * exchange can be done on pointers
- * - on platform without atomic operation swap is done in a critical section,
- * portable but inefficient.
- */
-template <int __use_ptr_atomic_swap>
-class _Atomic_swap_struct {
-public:
-#if defined (_STLP_THREADS) && \
- !defined (_STLP_ATOMIC_EXCHANGE) && \
- (defined (_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS) || \
- defined (_STLP_USE_PTHREAD_SPINLOCK) || defined (_STLP_NWTHREADS))
-# define _STLP_USE_ATOMIC_SWAP_MUTEX
- static _STLP_STATIC_MUTEX _S_swap_lock;
-#endif
-
- static __stl_atomic_t _S_swap(_STLP_VOLATILE __stl_atomic_t* __p, __stl_atomic_t __q) {
-#if defined (_STLP_THREADS)
-# if defined (_STLP_ATOMIC_EXCHANGE)
- return _STLP_ATOMIC_EXCHANGE(__p, __q);
-# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
- _S_swap_lock._M_acquire_lock();
- __stl_atomic_t __result = *__p;
- *__p = __q;
- _S_swap_lock._M_release_lock();
- return __result;
-# else
-# error Missing atomic swap implementation
-# endif
-#else
- /* no threads */
- __stl_atomic_t __result = *__p;
- *__p = __q;
- return __result;
-#endif // _STLP_THREADS
- }
-
- static void* _S_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) {
-#if defined (_STLP_THREADS)
-# if defined (_STLP_ATOMIC_EXCHANGE_PTR)
- return _STLP_ATOMIC_EXCHANGE_PTR(__p, __q);
-# elif defined (_STLP_ATOMIC_EXCHANGE)
- _STLP_STATIC_ASSERT(sizeof(__stl_atomic_t) == sizeof(void*))
- return __REINTERPRET_CAST(void*, _STLP_ATOMIC_EXCHANGE(__REINTERPRET_CAST(volatile __stl_atomic_t*, __p),
- __REINTERPRET_CAST(__stl_atomic_t, __q))
- );
-# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
- _S_swap_lock._M_acquire_lock();
- void *__result = *__p;
- *__p = __q;
- _S_swap_lock._M_release_lock();
- return __result;
-# else
-# error Missing pointer atomic swap implementation
-# endif
-#else
- /* no thread */
- void *__result = *__p;
- *__p = __q;
- return __result;
-#endif
- }
-};
-
-_STLP_TEMPLATE_NULL
-class _Atomic_swap_struct<0> {
-public:
-#if defined (_STLP_THREADS) && \
- (!defined (_STLP_ATOMIC_EXCHANGE) || !defined (_STLP_ATOMIC_EXCHANGE_PTR)) && \
- (defined (_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS) || \
- defined (_STLP_USE_PTHREAD_SPINLOCK) || defined (_STLP_NWTHREADS))
-# define _STLP_USE_ATOMIC_SWAP_MUTEX
- static _STLP_STATIC_MUTEX _S_swap_lock;
-#endif
-
- static __stl_atomic_t _S_swap(_STLP_VOLATILE __stl_atomic_t* __p, __stl_atomic_t __q) {
-#if defined (_STLP_THREADS)
-# if defined (_STLP_ATOMIC_EXCHANGE)
- return _STLP_ATOMIC_EXCHANGE(__p, __q);
-# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
- /* This should be portable, but performance is expected
- * to be quite awful. This really needs platform specific
- * code.
- */
- _S_swap_lock._M_acquire_lock();
- __stl_atomic_t __result = *__p;
- *__p = __q;
- _S_swap_lock._M_release_lock();
- return __result;
-# else
-# error Missing atomic swap implementation
-# endif
-#else
- /* no threads */
- __stl_atomic_t __result = *__p;
- *__p = __q;
- return __result;
-#endif // _STLP_THREADS
- }
-
- static void* _S_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) {
-#if defined (_STLP_THREADS)
-# if defined (_STLP_ATOMIC_EXCHANGE_PTR)
- return _STLP_ATOMIC_EXCHANGE_PTR(__p, __q);
-# elif defined (_STLP_ATOMIC_EXCHANGE)
- _STLP_STATIC_ASSERT(sizeof(__stl_atomic_t) == sizeof(void*))
- return __REINTERPRET_CAST(void*, _STLP_ATOMIC_EXCHANGE(__REINTERPRET_CAST(volatile __stl_atomic_t*, __p),
- __REINTERPRET_CAST(__stl_atomic_t, __q))
- );
-# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
- _S_swap_lock._M_acquire_lock();
- void *__result = *__p;
- *__p = __q;
- _S_swap_lock._M_release_lock();
- return __result;
-# else
-# error Missing pointer atomic swap implementation
-# endif
-#else
- /* no thread */
- void *__result = *__p;
- *__p = __q;
- return __result;
-#endif
- }
-};
-
-#if defined (_STLP_MSVC) && (_STLP_MSVC == 1300)
-# pragma warning (push)
-# pragma warning (disable : 4189) //__use_ptr_atomic_swap initialized but not used
-#endif
-
-inline __stl_atomic_t _STLP_CALL _Atomic_swap(_STLP_VOLATILE __stl_atomic_t * __p, __stl_atomic_t __q) {
- const int __use_ptr_atomic_swap = sizeof(__stl_atomic_t) == sizeof(void*);
- return _Atomic_swap_struct<__use_ptr_atomic_swap>::_S_swap(__p, __q);
-}
-
-inline void* _STLP_CALL _Atomic_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) {
- const int __use_ptr_atomic_swap = sizeof(__stl_atomic_t) == sizeof(void*);
- return _Atomic_swap_struct<__use_ptr_atomic_swap>::_S_swap_ptr(__p, __q);
-}
-
-#if defined (_STLP_MSVC) && (_STLP_MSVC == 1300)
-# pragma warning (pop)
-#endif
-
-#if defined (_STLP_BETHREADS)
-template <int __inst>
-struct _STLP_beos_static_lock_data {
- static bool is_init;
- struct mutex_t : public _STLP_mutex {
- mutex_t()
- { _STLP_beos_static_lock_data<0>::is_init = true; }
- ~mutex_t()
- { _STLP_beos_static_lock_data<0>::is_init = false; }
- };
- static mutex_t mut;
-};
-
-template <int __inst>
-bool _STLP_beos_static_lock_data<__inst>::is_init = false;
-template <int __inst>
-typename _STLP_beos_static_lock_data<__inst>::mutex_t _STLP_beos_static_lock_data<__inst>::mut;
-
-inline void _STLP_mutex_base::_M_acquire_lock() {
- if (sem == 0) {
- // we need to initialise on demand here
- // to prevent race conditions use our global
- // mutex if it's available:
- if (_STLP_beos_static_lock_data<0>::is_init) {
- _STLP_auto_lock al(_STLP_beos_static_lock_data<0>::mut);
- if (sem == 0) _M_initialize();
- }
- else {
- // no lock available, we must still be
- // in startup code, THERE MUST BE ONE THREAD
- // ONLY active at this point.
- _M_initialize();
- }
- }
- status_t t;
- t = acquire_sem(sem);
- assert(t == B_NO_ERROR);
-}
-#endif
-
-_STLP_END_NAMESPACE
-
-#if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_threads.c>
-#endif
-
-#endif /* _STLP_INTERNAL_THREADS_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_time_facets.c b/stl/_time_facets.c
deleted file mode 100644
index 53f87f9..0000000
--- a/stl/_time_facets.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_TIME_FACETS_C
-#define _STLP_TIME_FACETS_C
-
-#ifndef _STLP_INTERNAL_TIME_FACETS_H
-# include <stl/_time_facets.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NUM_PUT_H
-# include <stl/_num_put.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NUM_GET_H
-# include <stl/_num_get.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//----------------------------------------------------------------------
-// Declarations of static template members.
-#if (_STLP_STATIC_TEMPLATE_DATA > 0)
-
-# if !defined (__BORLANDC__)
-template <class _CharT, class _InputIterator>
-locale::id time_get<_CharT, _InputIterator>::id;
-
-template <class _CharT, class _OutputIterator>
-locale::id time_put<_CharT, _OutputIterator>::id;
-# endif
-
-# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \
- defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)
-/*
- * Under cygwin, when STLport is used as a shared library, the id needs
- * to be specified as imported otherwise they will be duplicated in the
- * calling executable.
- */
-template <>
-_STLP_DECLSPEC locale::id time_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
-/*
-template <>
-_STLP_DECLSPEC locale::id time_get<char, const char*>::id;
-*/
-
-template <>
-_STLP_DECLSPEC locale::id time_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
-/*
-template <>
-_STLP_DECLSPEC locale::id time_put<char, char*>::id;
-*/
-
-# ifndef _STLP_NO_WCHAR_T
-template <>
-_STLP_DECLSPEC locale::id time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
-/*
-template <>
-_STLP_DECLSPEC locale::id time_get<wchar_t, const wchar_t*>::id;
-*/
-
-template <>
-_STLP_DECLSPEC locale::id time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
-/*
-template <>
-_STLP_DECLSPEC locale::id time_put<wchar_t, wchar_t*>::id;
-*/
-# endif /* _STLP_NO_WCHAR_T */
-# endif /* __CUGWIN__ && _STLP_USE_DYNAMIC_LIB */
-
-#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
-
-//typedef time_get<char, const char*> time_get_char;
-typedef time_get<char, istreambuf_iterator<char, char_traits<char> > > time_get_char_2;
-//typedef time_put<char, char*> time_put_char;
-typedef time_put<char, ostreambuf_iterator<char, char_traits<char> > > time_put_char_2;
-
-//__DECLARE_INSTANCE(locale::id, time_get_char::id, );
-__DECLARE_INSTANCE(locale::id, time_get_char_2::id, );
-//__DECLARE_INSTANCE(locale::id, time_put_char::id, );
-__DECLARE_INSTANCE(locale::id, time_put_char_2::id, );
-
-# if !defined (_STLP_NO_WCHAR_T)
-
-//typedef time_get<wchar_t, const wchar_t*> time_get_wchar_t;
-typedef time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > time_get_wchar_t_2;
-//typedef time_put<wchar_t, wchar_t*> time_put_wchar_t;
-typedef time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > time_put_wchar_t_2;
-
-//__DECLARE_INSTANCE(locale::id, time_get_wchar_t::id, );
-__DECLARE_INSTANCE(locale::id, time_get_wchar_t_2::id, );
-//__DECLARE_INSTANCE(locale::id, time_put_wchar_t::id, );
-__DECLARE_INSTANCE(locale::id, time_put_wchar_t_2::id, );
-
-# endif
-
-#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InIt, class _CharT>
-const string* _STLP_CALL
-__match(_InIt& __first, _InIt& __last, const string *__name, const string *__name_end,
- const ctype<_CharT>& __ct) {
- typedef ptrdiff_t difference_type;
- difference_type __n = __name_end - __name;
- difference_type __i;
- size_t __pos = 0;
- difference_type __check_count = __n;
- bool __do_check[_MAXNAMES];
- const string* __matching_name[_MAX_NAME_LENGTH];
-
- for (__i = 0; __i < _MAXNAMES; ++__i)
- __do_check[__i] = true;
-
- for (__i = 0; __i < _MAX_NAME_LENGTH; ++__i)
- __matching_name[__i] = __name_end;
-
- while (__first != __last) {
- for (__i = 0; __i < __n; ++__i) {
- if (__do_check[__i]) {
- if (*__first == __ct.widen(__name[__i][__pos])) {
- if (__pos == (__name[__i].size() - 1)) {
- __do_check[__i] = 0;
- __matching_name[__pos + 1] = __name + __i;
- --__check_count;
- if (__check_count == 0) {
- ++__first;
- return __name + __i;
- }
- }
- }
- else {
- __do_check[__i] = 0;
- --__check_count;
- if (__check_count == 0)
- return __matching_name[__pos];
- }
- }
- }
-
- ++__first; ++__pos;
- }
-
- return __matching_name[__pos];
-}
-
-// __get_formatted_time reads input that is assumed to be formatted
-// according to the rules for the C strftime function (C standard,
-// 7.12.3.5). This function is used to implement the do_get_time
-// and do_get_date virtual functions, which depend on the locale
-// specifications for the time and day formats respectively.
-// Note the catchall default case, intended mainly for the '%Z'
-// format designator, which does not make sense here since the
-// representation of timezones is not part of the locale.
-//
-// The case branches are implemented either by doing a match using
-// the appopriate name table or by doing a __get_integer_nogroup.
-//
-// 'y' format is assumed to mean that the input represents years
-// since 1900. That is, 2002 should be represented as 102. There
-// is no century-guessing.
-//
-// The match is successful if and only if the second component of the
-// return value is format_end.
-
-// Note that the antepenultimate parameter is being used only to determine
-// the correct overloading for the calls to __get_integer_nogroup.
-template <class _InIt1, class _Ch>
-string::const_iterator _STLP_CALL
-__get_formatted_time _STLP_WEAK (_InIt1 __first, _InIt1 __last,
- string::const_iterator __format, string::const_iterator __format_end,
- _Ch*, const _Time_Info& __table,
- const ios_base& __s, ios_base::iostate& __err, tm* __t) {
- const ctype<_Ch>& __ct = *__STATIC_CAST(const ctype<_Ch>*, __s._M_ctype_facet());
- while (__first != __last && __format != __format_end) {
- if (*__format == '%') {
- ++__format;
- char __c = *__format;
- if (__c == '#') { //MS extension
- ++__format;
- __c = *__format;
- }
-
- switch (__c) {
- case 'a': {
- const string* __pr = __match(__first, __last,
- __table._M_dayname + 0, __table._M_dayname + 7,
- __ct);
- if (__pr == __table._M_dayname + 7)
- return __format;
- __t->tm_wday = __STATIC_CAST(int, __pr - __table._M_dayname);
- break;
- }
-
- case 'A': {
- const string* __pr = __match(__first, __last,
- __table._M_dayname + 7, __table._M_dayname + 14,
- __ct);
- if (__pr == __table._M_dayname + 14)
- return __format;
- __t->tm_wday = __STATIC_CAST(int, __pr - __table._M_dayname - 7);
- break;
- }
-
- case 'b': {
- const string* __pr = __match(__first, __last,
- __table._M_monthname + 0, __table._M_monthname + 12,
- __ct);
- if (__pr == __table._M_monthname + 12)
- return __format;
- __t->tm_mon = __STATIC_CAST(int, __pr - __table._M_monthname);
- break;
- }
-
- case 'B': {
- const string* __pr = __match(__first, __last,
- __table._M_monthname + 12, __table._M_monthname + 24,
- __ct);
- if (__pr == __table._M_monthname + 24)
- return __format;
- __t->tm_mon = __STATIC_CAST(int, __pr - __table._M_monthname - 12);
- break;
- }
-
- case 'd': {
- bool __pr = __get_decimal_integer(__first, __last, __t->tm_mday, __STATIC_CAST(_Ch*, 0));
- if (!__pr || __t->tm_mday < 1 || __t->tm_mday > 31) {
- __err |= ios_base::failbit;
- return __format;
- }
- break;
- }
-
- case 'H': case 'I': {
- bool __pr = __get_decimal_integer(__first, __last, __t->tm_hour, __STATIC_CAST(_Ch*, 0));
- if (!__pr)
- return __format;
- break;
- }
-
- case 'j': {
- bool __pr = __get_decimal_integer(__first, __last, __t->tm_yday, __STATIC_CAST(_Ch*, 0));
- if (!__pr)
- return __format;
- break;
- }
-
- case 'm': {
- bool __pr = __get_decimal_integer(__first, __last, __t->tm_mon, __STATIC_CAST(_Ch*, 0));
- --__t->tm_mon;
- if (!__pr || __t->tm_mon < 0 || __t->tm_mon > 11) {
- __err |= ios_base::failbit;
- return __format;
- }
- break;
- }
-
- case 'M': {
- bool __pr = __get_decimal_integer(__first, __last, __t->tm_min, __STATIC_CAST(_Ch*, 0));
- if (!__pr)
- return __format;
- break;
- }
-
- case 'p': {
- const string* __pr = __match(__first, __last,
- __table._M_am_pm + 0, __table._M_am_pm + 2, __ct);
- if (__pr == __table._M_am_pm + 2)
- return __format;
- // 12:00 PM <=> 12:00, 12:00 AM <=> 00:00
- if (__pr == __table._M_am_pm + 1 && __t->tm_hour != 12 )
- __t->tm_hour += 12;
- if (__pr == __table._M_am_pm && __t->tm_hour == 12 )
- __t->tm_hour = 0;
- break;
- }
-
- case 'S': {
- bool __pr = __get_decimal_integer(__first, __last, __t->tm_sec, __STATIC_CAST(_Ch*, 0));
- if (!__pr)
- return __format;
- break;
- }
-
- case 'y': {
- bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0));
- if (!__pr)
- return __format;
- break;
- }
-
- case 'Y': {
- bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0));
- __t->tm_year -= 1900;
- if (!__pr)
- return __format;
- break;
- }
-
- default:
- break;
- }
- }
- else {
- if (*__first++ != __ct.widen(*__format)) break;
- }
-
- ++__format;
- }
-
- return __format;
-}
-
-template <class _InIt, class _CharT>
-bool _STLP_CALL
-__get_short_or_long_dayname(_InIt& __first, _InIt& __last, const ctype<_CharT>& __ct,
- const _Time_Info& __table, tm* __t) {
- const string* __pr =
- __match(__first, __last, __table._M_dayname + 0, __table._M_dayname + 14, __ct);
- __t->tm_wday = __STATIC_CAST(int, (__pr - __table._M_dayname) % 7);
- return __pr != __table._M_dayname + 14;
-}
-
-template <class _InIt, class _CharT>
-bool _STLP_CALL
-__get_short_or_long_monthname(_InIt& __first, _InIt& __last, const ctype<_CharT>& __ct,
- const _Time_Info& __table, tm* __t) {
- const string* __pr =
- __match(__first, __last, __table._M_monthname + 0, __table._M_monthname + 24, __ct);
- __t->tm_mon = __STATIC_CAST(int, (__pr - __table._M_monthname) % 12);
- return __pr != __table._M_monthname + 24;
-}
-
-#if !defined (_STLP_NO_WCHAR_T)
-template <class _OuIt>
-_OuIt _STLP_CALL
-__put_time(char * __first, char * __last, _OuIt __out_ite,
- const ios_base& __s, wchar_t) {
- const ctype<wchar_t>& __ct = *__STATIC_CAST(const ctype<wchar_t>*, __s._M_ctype_facet());
- wchar_t __wbuf[64];
- __ct.widen(__first, __last, __wbuf);
- ptrdiff_t __len = __last - __first;
- wchar_t * __eend = __wbuf + __len;
- return copy((wchar_t*)__wbuf, __eend, __out_ite);
-}
-#endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _Ch, class _InIt>
-_InIt
-time_get<_Ch, _InIt>::do_get_date(_InIt __s, _InIt __end,
- ios_base& __str, ios_base::iostate& __err,
- tm* __t) const {
- typedef string::const_iterator string_iterator;
-
- string_iterator __format = _M_timeinfo._M_date_format.begin();
- string_iterator __format_end = _M_timeinfo._M_date_format.end();
-
- string_iterator __result
- = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end,
- __STATIC_CAST(_Ch*, 0), _M_timeinfo,
- __str, __err, __t);
- if (__result == __format_end)
- __err = ios_base::goodbit;
- else {
- __err = ios_base::failbit;
- if (__s == __end)
- __err |= ios_base::eofbit;
- }
- return __s;
-}
-
-template <class _Ch, class _InIt>
-_InIt
-time_get<_Ch, _InIt>::do_get_time(_InIt __s, _InIt __end,
- ios_base& __str, ios_base::iostate& __err,
- tm* __t) const {
- typedef string::const_iterator string_iterator;
- string_iterator __format = _M_timeinfo._M_time_format.begin();
- string_iterator __format_end = _M_timeinfo._M_time_format.end();
-
- string_iterator __result
- = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end,
- __STATIC_CAST(_Ch*, 0), _M_timeinfo,
- __str, __err, __t);
- __err = __result == __format_end ? ios_base::goodbit
- : ios_base::failbit;
- if (__s == __end)
- __err |= ios_base::eofbit;
- return __s;
-}
-
-template <class _Ch, class _InIt>
-_InIt
-time_get<_Ch, _InIt>::do_get_year(_InIt __s, _InIt __end,
- ios_base&, ios_base::iostate& __err,
- tm* __t) const {
- if (__s == __end) {
- __err = ios_base::failbit | ios_base::eofbit;
- return __s;
- }
-
- bool __pr = _STLP_PRIV __get_decimal_integer(__s, __end, __t->tm_year, __STATIC_CAST(_Ch*, 0));
- __t->tm_year -= 1900;
- __err = __pr ? ios_base::goodbit : ios_base::failbit;
- if (__s == __end)
- __err |= ios_base::eofbit;
-
- return __s;
-}
-
-template <class _Ch, class _InIt>
-_InIt
-time_get<_Ch, _InIt>::do_get_weekday(_InIt __s, _InIt __end,
- ios_base &__str, ios_base::iostate &__err,
- tm *__t) const {
- const ctype<_Ch>& __ct = *__STATIC_CAST(const ctype<_Ch>*, __str._M_ctype_facet());
- bool __result =
- _STLP_PRIV __get_short_or_long_dayname(__s, __end, __ct, _M_timeinfo, __t);
- if (__result)
- __err = ios_base::goodbit;
- else {
- __err = ios_base::failbit;
- if (__s == __end)
- __err |= ios_base::eofbit;
- }
- return __s;
-}
-
-template <class _Ch, class _InIt>
-_InIt
-time_get<_Ch, _InIt>::do_get_monthname(_InIt __s, _InIt __end,
- ios_base &__str, ios_base::iostate &__err,
- tm *__t) const {
- const ctype<_Ch>& __ct = *__STATIC_CAST(const ctype<_Ch>*, __str._M_ctype_facet());
- bool __result =
- _STLP_PRIV __get_short_or_long_monthname(__s, __end, __ct, _M_timeinfo, __t);
- if (__result)
- __err = ios_base::goodbit;
- else {
- __err = ios_base::failbit;
- if (__s == __end)
- __err |= ios_base::eofbit;
- }
- return __s;
-}
-
-template<class _Ch, class _OutputIter>
-_OutputIter
-time_put<_Ch,_OutputIter>::put(_OutputIter __s, ios_base& __f, _Ch __fill,
- const tm* __tmb, const _Ch* __pat,
- const _Ch* __pat_end) const {
- // locale __loc = __f.getloc();
- // const ctype<_Ch>& _Ct = use_facet<ctype<_Ch> >(__loc);
- const ctype<_Ch>& _Ct = *__STATIC_CAST(const ctype<_Ch>*, __f._M_ctype_facet());
- while (__pat != __pat_end) {
- char __c = _Ct.narrow(*__pat, 0);
- if (__c == '%') {
- char __mod = 0;
- ++__pat;
- __c = _Ct.narrow(*__pat++, 0);
- if (__c == '#') { // MS extension
- __mod = __c;
- __c = _Ct.narrow(*__pat++, 0);
- }
- __s = do_put(__s, __f, __fill, __tmb, __c, __mod);
- }
- else
- *__s++ = *__pat++;
- }
- return __s;
-}
-
-template<class _Ch, class _OutputIter>
-_OutputIter
-time_put<_Ch,_OutputIter>::do_put(_OutputIter __s, ios_base& __f, _Ch /* __fill */,
- const tm* __tmb, char __format,
- char __modifier ) const {
- char __buf[64];
- char * __iend = _STLP_PRIV __write_formatted_time(_STLP_ARRAY_AND_SIZE(__buf),
- __format, __modifier, _M_timeinfo, __tmb);
- // locale __loc = __f.getloc();
- return _STLP_PRIV __put_time(__buf, __iend, __s, __f, _Ch());
-}
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_TIME_FACETS_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_time_facets.h b/stl/_time_facets.h
deleted file mode 100644
index 3423818..0000000
--- a/stl/_time_facets.h
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// WARNING: This is an internal header file, included by other C++
-// standard library headers. You should not attempt to use this header
-// file directly.
-
-
-#ifndef _STLP_INTERNAL_TIME_FACETS_H
-#define _STLP_INTERNAL_TIME_FACETS_H
-
-#ifndef _STLP_INTERNAL_CTIME
-# include <stl/_ctime.h> // Needed (for struct tm) by time facets
-#endif
-
-#ifndef _STLP_C_LOCALE_H
-# include <stl/c_locale.h>
-#endif
-
-#ifndef _STLP_IOS_BASE_H
-# include <stl/_ios_base.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// Template functions used by time_get
-
-// Matching input against a list of names
-
-// Alphabetic input of the names of months and the names
-// of weekdays requires matching input against a list of names.
-// We use a simple generic algorithm to accomplish this. This
-// algorithm is not very efficient, especially for longer lists
-// of names, but it probably does not matter for the initial
-// implementation and it may never matter, since we do not expect
-// this kind of input to be used very often. The algorithm
-// could be improved fairly simply by creating a new list of
-// names still in the running at each iteration. A more sophisticated
-// approach would be to build a trie to do the matching.
-//
-// We compare each character of the input to the corresponding
-// character of each name on the list that has not been eliminated,
-// either because every character in the name has already been
-// matched, or because some character has not been matched. We
-// continue only as long as there are some names that have not been
-// eliminated.
-
-// We do not really need a random access iterator (a forward iterator
-// would do), but the extra generality makes the notation clumsier,
-// and we don't really need it.
-
-// We can recognize a failed match by the fact that the second
-// component of the return value will be __name_end.
-
-#define _MAXNAMES 64
-#define _MAX_NAME_LENGTH 64
-
-// Both time_get and time_put need a structure of type _Time_Info
-// to provide names and abbreviated names for months and days,
-// as well as the am/pm designator. The month and weekday tables
-// have the all the abbreviated names before all the full names.
-// The _Time_Info tables are initialized using the non-template
-// function _Init_timeinfo, which has two overloadings: one
-// with a single reference parameter for the table to be initialized,
-// and one with a second _Locale_time * parameter. The first form
-// is called by the default constructor and the second by a special
-// constructor invoked from the _byname subclass constructor to
-// construct the base class.
-
-class _STLP_CLASS_DECLSPEC _Time_Info {
-public:
- string _M_dayname[14];
- string _M_monthname[24];
- string _M_am_pm[2];
- string _M_time_format;
- string _M_date_format;
- string _M_date_time_format;
- string _M_long_date_format;
- string _M_long_date_time_format;
-};
-
-void _STLP_CALL _Init_timeinfo(_Time_Info&);
-void _STLP_CALL _Init_timeinfo(_Time_Info&, _Locale_time*);
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-class _STLP_CLASS_DECLSPEC time_base {
-public:
- enum dateorder {no_order, dmy, mdy, ymd, ydm};
-};
-
-#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-template <class _Ch, class _InIt>
-#else
-template <class _Ch, class _InIt = istreambuf_iterator<_Ch, char_traits<_Ch> > >
-#endif
-class time_get : public locale::facet, public time_base {
- friend class _Locale_impl;
-
-public:
- typedef _Ch char_type;
- typedef _InIt iter_type;
-
- explicit time_get(size_t __refs = 0) : locale::facet(__refs)
- { _STLP_PRIV _Init_timeinfo(_M_timeinfo); }
- dateorder date_order() const { return do_date_order(); }
- iter_type get_time(iter_type __s, iter_type __end, ios_base& __str,
- ios_base::iostate& __err, tm* __t) const
- { return do_get_time(__s, __end, __str, __err, __t); }
- iter_type get_date(iter_type __s, iter_type __end, ios_base& __str,
- ios_base::iostate& __err, tm* __t) const
- { return do_get_date(__s, __end, __str, __err, __t); }
- iter_type get_weekday(iter_type __s, iter_type __end, ios_base& __str,
- ios_base::iostate& __err, tm* __t) const
- { return do_get_weekday(__s, __end, __str, __err, __t); }
- iter_type get_monthname(iter_type __s, iter_type __end, ios_base& __str,
- ios_base::iostate& __err, tm* __t) const
- { return do_get_monthname(__s, __end, __str, __err, __t); }
- iter_type get_year(iter_type __s, iter_type __end, ios_base& __str,
- ios_base::iostate& __err, tm* __t) const
- { return do_get_year(__s, __end, __str, __err, __t); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- time_get(_Locale_time *, size_t __refs) : locale::facet(__refs) {}
-
- ~time_get() {}
-
- virtual dateorder do_date_order() const {return no_order;}
-
- virtual iter_type do_get_time(iter_type __s, iter_type __end,
- ios_base&, ios_base::iostate& __err,
- tm* __t) const;
-
- virtual iter_type do_get_date(iter_type __s, iter_type __end,
- ios_base&, ios_base::iostate& __err,
- tm* __t) const;
-
- virtual iter_type do_get_weekday(iter_type __s, iter_type __end,
- ios_base&,
- ios_base::iostate& __err,
- tm* __t) const;
- virtual iter_type do_get_monthname(iter_type __s, iter_type __end,
- ios_base&,
- ios_base::iostate& __err,
- tm* __t) const;
-
- virtual iter_type do_get_year(iter_type __s, iter_type __end,
- ios_base&, ios_base::iostate& __err,
- tm* __t) const;
-
- _STLP_PRIV _Time_Info _M_timeinfo;
-};
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-time_base::dateorder _STLP_CALL __get_date_order(_Locale_time*);
-_Locale_time* _STLP_CALL __acquire_time(const char* __name, _Locale_name_hint*);
-void _STLP_CALL __release_time(_Locale_time* __time);
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _Ch, class _InIt>
-class time_get_byname;
-
-#if defined (__GNUC__) && (__GNUC__ < 3)
-template <class _Ch, class _InIt>
-_Locale_name_hint* _Locale_time_extract_hint(time_get_byname<_Ch, _InIt>*);
-#else
-_Locale_name_hint* _Locale_time_extract_hint(time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >*);
-#endif
-
-#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-template <class _Ch, class _InIt>
-#else
-template <class _Ch, class _InIt = istreambuf_iterator<_Ch, char_traits<_Ch> > >
-#endif
-class time_get_byname : public time_get<_Ch, _InIt> {
-public:
- typedef time_base::dateorder dateorder;
- typedef _InIt iter_type;
-
- explicit time_get_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0)
- : time_get<_Ch, _InIt>((_Locale_time*) 0, __refs),
- _M_time(_STLP_PRIV __acquire_time(__name, __hint))
- { _STLP_PRIV _Init_timeinfo(this->_M_timeinfo, this->_M_time); }
-
-protected:
- ~time_get_byname() { _STLP_PRIV __release_time(_M_time); }
- dateorder do_date_order() const { return _STLP_PRIV __get_date_order(_M_time); }
-
-private:
- _Locale_time* _M_time;
-
- typedef time_get_byname<_Ch, _InIt> _Self;
- //explicitely defined as private to avoid warnings:
- time_get_byname(_Self const&);
- _Self& operator = (_Self const&);
-#if defined (__GNUC__) && (__GNUC__ < 3)
- friend _Locale_name_hint* _Locale_time_extract_hint<>(_Self*);
-#else
- friend _Locale_name_hint* _Locale_time_extract_hint(time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >*);
-#endif
-};
-
-// time_put facet
-
-// For the formats 'x, 'X', and 'c', do_put calls the first form of
-// put with the pattern obtained from _M_timeinfo._M_date_format or
-// _M_timeinfo._M_time_format.
-
-// Helper function: __ takes a single-character
-// format. As indicated by the foregoing remark, this will never be
-// 'x', 'X', or 'c'.
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-char * _STLP_CALL
-__write_formatted_time(char *__buf, size_t __buf_size, char __format, char __modifier,
- const _Time_Info& __table, const tm* __t);
-
-template <class _OuIt>
-inline _OuIt _STLP_CALL __put_time(char * __first, char * __last, _OuIt __out_ite,
- const ios_base& /* __loc */, char)
-{ return copy(__first, __last, __out_ite); }
-
-#if !defined (_STLP_NO_WCHAR_T)
-template <class _OuIt>
-_OuIt _STLP_CALL __put_time(char * __first, char * __last, _OuIt __out_ite,
- const ios_base& __s, wchar_t);
-#endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-template <class _Ch, class _OutIt>
-#else
-template <class _Ch, class _OutIt = ostreambuf_iterator<_Ch, char_traits<_Ch> > >
-#endif
-class time_put : public locale::facet, public time_base {
- friend class _Locale_impl;
-public:
- typedef _Ch char_type;
- typedef _OutIt iter_type;
-
- explicit time_put(size_t __refs = 0) : locale::facet(__refs)
- { _STLP_PRIV _Init_timeinfo(_M_timeinfo); }
-
- _OutIt put(iter_type __s, ios_base& __f, _Ch __fill,
- const tm* __tmb,
- const _Ch* __pat, const _Ch* __pat_end) const;
-
- _OutIt put(iter_type __s, ios_base& __f, _Ch __fill,
- const tm* __tmb, char __format, char __modifier = 0) const
- { return do_put(__s, __f, __fill, __tmb, __format, __modifier); }
-
- static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
-
-protected:
- time_put(_Locale_time* /*__time*/, size_t __refs) : locale::facet(__refs)
- {} //_STLP_PRIV _Init_timeinfo(_M_timeinfo, __time); }
-
- ~time_put() {}
- virtual iter_type do_put(iter_type __s, ios_base& __f,
- char_type /* __fill */, const tm* __tmb,
- char __format, char /* __modifier */) const;
-
- _STLP_PRIV _Time_Info _M_timeinfo;
-};
-
-#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-template <class _Ch, class _OutIt>
-#else
-template <class _Ch, class _OutIt = ostreambuf_iterator<_Ch, char_traits<_Ch> > >
-#endif
-class time_put_byname : public time_put<_Ch, _OutIt> {
- friend class _Locale_impl;
-public:
- typedef time_base::dateorder dateorder;
- typedef _OutIt iter_type;
- typedef _Ch char_type;
-
- explicit time_put_byname(const char * __name, size_t __refs = 0, _Locale_name_hint* __hint = 0)
- : time_put<_Ch, _OutIt>((_Locale_time*) 0, __refs),
- _M_time(_STLP_PRIV __acquire_time(__name, __hint))
- { _STLP_PRIV _Init_timeinfo(this->_M_timeinfo, this->_M_time); }
-
-protected:
- ~time_put_byname() { _STLP_PRIV __release_time(_M_time); }
-
-private:
- _Locale_time* _M_time;
-
- typedef time_put_byname<_Ch, _OutIt> _Self;
- //explicitely defined as private to avoid warnings:
- time_put_byname(_Self const&);
- _Self& operator = (_Self const&);
-};
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS time_get<char, istreambuf_iterator<char, char_traits<char> > >;
-_STLP_EXPORT_TEMPLATE_CLASS time_put<char, ostreambuf_iterator<char, char_traits<char> > >;
-// _STLP_EXPORT_TEMPLATE_CLASS time_get<char, const char*>;
-// _STLP_EXPORT_TEMPLATE_CLASS time_put<char, char*>;
-# if !defined (_STLP_NO_WCHAR_T)
-_STLP_EXPORT_TEMPLATE_CLASS time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
-_STLP_EXPORT_TEMPLATE_CLASS time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
-// _STLP_EXPORT_TEMPLATE_CLASS time_get<wchar_t, const wchar_t*>;
-// _STLP_EXPORT_TEMPLATE_CLASS time_put<wchar_t, wchar_t*>;
-# endif
-
-#endif
-
-_STLP_END_NAMESPACE
-
-#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_time_facets.c>
-#endif
-
-#endif /* _STLP_INTERNAL_TIME_FACETS_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_tree.h b/stl/_tree.h
deleted file mode 100644
index c4c799d..0000000
--- a/stl/_tree.h
+++ /dev/null
@@ -1,679 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_TREE_H
-#define _STLP_INTERNAL_TREE_H
-
-/*
-
-Red-black tree class, designed for use in implementing STL
-associative containers (set, multiset, map, and multimap). The
-insertion and deletion algorithms are based on those in Cormen,
-Leiserson, and Rivest, Introduction to Algorithms (MIT Press, 1990),
-except that
-
-(1) the header cell is maintained with links not only to the root
-but also to the leftmost node of the tree, to enable constant time
-begin(), and to the rightmost node of the tree, to enable linear time
-performance when used with the generic set algorithms (set_union,
-etc.);
-
-(2) when a node being deleted has two children its successor node is
-relinked into its place, rather than copied, so that the only
-iterators invalidated are those referring to the deleted node.
-
-*/
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-# include <stl/_alloc.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ITERATOR_H
-# include <stl/_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CONSTRUCT_H
-# include <stl/_construct.h>
-#endif
-
-#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
-# include <stl/_function_base.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-typedef bool _Rb_tree_Color_type;
-//const _Rb_tree_Color_type _S_rb_tree_red = false;
-//const _Rb_tree_Color_type _S_rb_tree_black = true;
-
-#define _S_rb_tree_red false
-#define _S_rb_tree_black true
-
-struct _Rb_tree_node_base {
- typedef _Rb_tree_Color_type _Color_type;
- typedef _Rb_tree_node_base* _Base_ptr;
-
- _Color_type _M_color;
- _Base_ptr _M_parent;
- _Base_ptr _M_left;
- _Base_ptr _M_right;
-
- static _Base_ptr _STLP_CALL _S_minimum(_Base_ptr __x) {
- while (__x->_M_left != 0) __x = __x->_M_left;
- return __x;
- }
-
- static _Base_ptr _STLP_CALL _S_maximum(_Base_ptr __x) {
- while (__x->_M_right != 0) __x = __x->_M_right;
- return __x;
- }
-};
-
-template <class _Value>
-struct _Rb_tree_node : public _Rb_tree_node_base {
- _Value _M_value_field;
- __TRIVIAL_STUFF(_Rb_tree_node)
-};
-
-struct _Rb_tree_base_iterator;
-
-template <class _Dummy>
-class _Rb_global {
-public:
- typedef _Rb_tree_node_base* _Base_ptr;
- // those used to be global functions
- static void _STLP_CALL _Rebalance(_Base_ptr __x, _Base_ptr& __root);
- static _Base_ptr _STLP_CALL _Rebalance_for_erase(_Base_ptr __z,
- _Base_ptr& __root,
- _Base_ptr& __leftmost,
- _Base_ptr& __rightmost);
- // those are from _Rb_tree_base_iterator - moved here to reduce code bloat
- // moved here to reduce code bloat without templatizing _Rb_tree_base_iterator
- static _Base_ptr _STLP_CALL _M_increment (_Base_ptr);
- static _Base_ptr _STLP_CALL _M_decrement (_Base_ptr);
- static void _STLP_CALL _Rotate_left (_Base_ptr __x, _Base_ptr& __root);
- static void _STLP_CALL _Rotate_right(_Base_ptr __x, _Base_ptr& __root);
-};
-
-# if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE_CLASS _Rb_global<bool>;
-# endif
-
-typedef _Rb_global<bool> _Rb_global_inst;
-
-struct _Rb_tree_base_iterator {
- typedef _Rb_tree_node_base* _Base_ptr;
- typedef bidirectional_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
- _Base_ptr _M_node;
- _Rb_tree_base_iterator() : _M_node(0) {}
- _Rb_tree_base_iterator(_Base_ptr __x) : _M_node(__x) {}
-};
-
-template <class _Value, class _Traits>
-struct _Rb_tree_iterator : public _Rb_tree_base_iterator {
- typedef _Value value_type;
- typedef typename _Traits::reference reference;
- typedef typename _Traits::pointer pointer;
- typedef _Rb_tree_iterator<_Value, _Traits> _Self;
- typedef _Rb_tree_node_base* _Base_ptr;
- typedef _Rb_tree_node<_Value>* _Link_type;
-
- typedef typename _Traits::_NonConstTraits _NonConstTraits;
- typedef _Rb_tree_iterator<_Value, _NonConstTraits> iterator;
- typedef typename _Traits::_ConstTraits _ConstTraits;
- typedef _Rb_tree_iterator<_Value, _ConstTraits> const_iterator;
-
- _Rb_tree_iterator() {}
-#if !defined (_STLP_DEBUG)
- /* In STL debug mode we need this constructor implicit for the pointer
- * specialization implementation.
- */
- explicit
-#endif
- _Rb_tree_iterator(_Base_ptr __x) : _Rb_tree_base_iterator(__x) {}
- //copy constructor for iterator and constructor from iterator for const_iterator
- _Rb_tree_iterator(const iterator& __it) : _Rb_tree_base_iterator(__it._M_node) {}
-
- reference operator*() const {
- return __STATIC_CAST(_Link_type, _M_node)->_M_value_field;
- }
-
- _STLP_DEFINE_ARROW_OPERATOR
-
- _Self& operator++() {
- _M_node = _Rb_global_inst::_M_increment(_M_node);
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- ++(*this);
- return __tmp;
- }
-
- _Self& operator--() {
- _M_node = _Rb_global_inst::_M_decrement(_M_node);
- return *this;
- }
- _Self operator--(int) {
- _Self __tmp = *this;
- --(*this);
- return __tmp;
- }
-
- bool operator == (const_iterator __rhs) const {
- return _M_node == __rhs._M_node;
- }
- bool operator != (const_iterator __rhs) const {
- return _M_node != __rhs._M_node;
- }
-};
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-_STLP_MOVE_TO_STD_NAMESPACE
-template <class _Value, class _Traits>
-struct __type_traits<_STLP_PRIV _Rb_tree_iterator<_Value, _Traits> > {
- typedef __false_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __false_type is_POD_type;
-};
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
-_STLP_MOVE_TO_STD_NAMESPACE
-template <class _Value, class _Traits>
-inline _Value* value_type(const _STLP_PRIV _Rb_tree_iterator<_Value, _Traits>&)
-{ return (_Value*)0; }
-inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _Rb_tree_base_iterator&)
-{ return bidirectional_iterator_tag(); }
-inline ptrdiff_t* distance_type(const _STLP_PRIV _Rb_tree_base_iterator&)
-{ return (ptrdiff_t*) 0; }
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-// Base class to help EH
-
-template <class _Tp, class _Alloc>
-class _Rb_tree_base {
-public:
- typedef _Rb_tree_node_base _Node_base;
- typedef _Rb_tree_node<_Tp> _Node;
- _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
- typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type;
-private:
- typedef _Rb_tree_base<_Tp, _Alloc> _Self;
- typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator_type;
- typedef _STLP_alloc_proxy<_Node_base, _Node, _M_node_allocator_type> _AllocProxy;
-
-public:
- allocator_type get_allocator() const {
- return _STLP_CONVERT_ALLOCATOR(_M_header, _Tp);
- }
-
-protected:
- _Rb_tree_base(const allocator_type& __a) :
- _M_header(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base() ) {
- _M_empty_initialize();
- }
- _Rb_tree_base(__move_source<_Self> src) :
- _M_header(__move_source<_AllocProxy>(src.get()._M_header)) {
- _M_rebind(&src.get()._M_header._M_data);
- src.get()._M_empty_initialize();
- }
- void _M_empty_initialize() {
- _M_header._M_data._M_color = _S_rb_tree_red; // used to distinguish header from
- // __root, in iterator.operator++
- _M_header._M_data._M_parent = 0;
- _M_header._M_data._M_left = &_M_header._M_data;
- _M_header._M_data._M_right = &_M_header._M_data;
- }
-
- void _M_rebind(_Node_base *__static_node) {
- if (_M_header._M_data._M_parent != 0) {
- _M_header._M_data._M_parent->_M_parent = &_M_header._M_data;
- }
- if (_M_header._M_data._M_right == __static_node) {
- _M_header._M_data._M_right = &_M_header._M_data;
- }
- if (_M_header._M_data._M_left == __static_node) {
- _M_header._M_data._M_left = &_M_header._M_data;
- }
- }
-
- _AllocProxy _M_header;
-};
-
-#if defined (_STLP_DEBUG)
-# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree)
-#endif
-
-template <class _Key, class _Compare,
- class _Value, class _KeyOfValue, class _Traits,
- _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) >
-class _Rb_tree : public _Rb_tree_base<_Value, _Alloc> {
- typedef _Rb_tree_base<_Value, _Alloc> _Base;
- typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self;
-protected:
- typedef _Rb_tree_node_base * _Base_ptr;
- typedef _Rb_tree_node<_Value> _Node;
- typedef _Node* _Link_type;
- typedef _Rb_tree_Color_type _Color_type;
-public:
- typedef _Key key_type;
- typedef _Value value_type;
- typedef typename _Traits::pointer pointer;
- typedef const value_type* const_pointer;
- typedef typename _Traits::reference reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef bidirectional_iterator_tag _Iterator_category;
- typedef typename _Base::allocator_type allocator_type;
-
-protected:
-
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
- _Base_ptr _M_create_node(const value_type& __x) {
- _Link_type __tmp = this->_M_header.allocate(1);
- _STLP_TRY {
- _Copy_Construct(&__tmp->_M_value_field, __x);
- }
- _STLP_UNWIND(this->_M_header.deallocate(__tmp,1))
- _S_left(__tmp) = 0;
- _S_right(__tmp) = 0;
- return __tmp;
- }
-
- _Base_ptr _M_clone_node(_Base_ptr __x) {
- _Base_ptr __tmp = _M_create_node(_S_value(__x));
- _S_color(__tmp) = _S_color(__x);
- return __tmp;
- }
-
- size_type _M_node_count; // keeps track of size of tree
- _Compare _M_key_compare;
-
- _Base_ptr _M_root() const
- { return this->_M_header._M_data._M_parent; }
- _Base_ptr _M_leftmost() const
- { return this->_M_header._M_data._M_left; }
- _Base_ptr _M_rightmost() const
- { return this->_M_header._M_data._M_right; }
-
- _Base_ptr& _M_root()
- { return this->_M_header._M_data._M_parent; }
- _Base_ptr& _M_leftmost()
- { return this->_M_header._M_data._M_left; }
- _Base_ptr& _M_rightmost()
- { return this->_M_header._M_data._M_right; }
-
- static _Base_ptr& _STLP_CALL _S_left(_Base_ptr __x)
- { return __x->_M_left; }
- static _Base_ptr& _STLP_CALL _S_right(_Base_ptr __x)
- { return __x->_M_right; }
- static _Base_ptr& _STLP_CALL _S_parent(_Base_ptr __x)
- { return __x->_M_parent; }
- static value_type& _STLP_CALL _S_value(_Base_ptr __x)
- { return __STATIC_CAST(_Link_type, __x)->_M_value_field; }
- static const _Key& _STLP_CALL _S_key(_Base_ptr __x)
- { return _KeyOfValue()(_S_value(__x));}
- static _Color_type& _STLP_CALL _S_color(_Base_ptr __x)
- { return (_Color_type&)(__x->_M_color); }
-
- static _Base_ptr _STLP_CALL _S_minimum(_Base_ptr __x)
- { return _Rb_tree_node_base::_S_minimum(__x); }
-
- static _Base_ptr _STLP_CALL _S_maximum(_Base_ptr __x)
- { return _Rb_tree_node_base::_S_maximum(__x); }
-
-public:
- typedef typename _Traits::_NonConstTraits _NonConstTraits;
- typedef typename _Traits::_ConstTraits _ConstTraits;
- typedef _Rb_tree_iterator<value_type, _NonConstTraits> iterator;
- typedef _Rb_tree_iterator<value_type, _ConstTraits> const_iterator;
- _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
-
-private:
- iterator _M_insert(_Base_ptr __parent, const value_type& __val, _Base_ptr __on_left = 0, _Base_ptr __on_right = 0);
- _Base_ptr _M_copy(_Base_ptr __x, _Base_ptr __p);
- void _M_erase(_Base_ptr __x);
-
-public:
- // allocation/deallocation
- _Rb_tree()
- : _Rb_tree_base<_Value, _Alloc>(allocator_type()), _M_node_count(0), _M_key_compare(_Compare())
- {}
-
- _Rb_tree(const _Compare& __comp)
- : _Rb_tree_base<_Value, _Alloc>(allocator_type()), _M_node_count(0), _M_key_compare(__comp)
- {}
-
- _Rb_tree(const _Compare& __comp, const allocator_type& __a)
- : _Rb_tree_base<_Value, _Alloc>(__a), _M_node_count(0), _M_key_compare(__comp)
- {}
-
- _Rb_tree(const _Self& __x)
- : _Rb_tree_base<_Value, _Alloc>(__x.get_allocator()),
- _M_node_count(0), _M_key_compare(__x._M_key_compare) {
- if (__x._M_root() != 0) {
- _S_color(&this->_M_header._M_data) = _S_rb_tree_red;
- _M_root() = _M_copy(__x._M_root(), &this->_M_header._M_data);
- _M_leftmost() = _S_minimum(_M_root());
- _M_rightmost() = _S_maximum(_M_root());
- }
- _M_node_count = __x._M_node_count;
- }
-
- _Rb_tree(__move_source<_Self> src)
- : _Rb_tree_base<_Value, _Alloc>(__move_source<_Base>(src.get())),
- _M_node_count(src.get()._M_node_count),
- _M_key_compare(_AsMoveSource(src.get()._M_key_compare)) {
- src.get()._M_node_count = 0;
- }
-
- ~_Rb_tree() { clear(); }
- _Self& operator=(const _Self& __x);
-
-public:
- // accessors:
- _Compare key_comp() const { return _M_key_compare; }
-
- iterator begin() { return iterator(_M_leftmost()); }
- const_iterator begin() const { return const_iterator(_M_leftmost()); }
- iterator end() { return iterator(&this->_M_header._M_data); }
- const_iterator end() const { return const_iterator(__CONST_CAST(_Base_ptr, &this->_M_header._M_data)); }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const
- { return const_reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const
- { return const_reverse_iterator(begin()); }
- bool empty() const { return _M_node_count == 0; }
- size_type size() const { return _M_node_count; }
- size_type max_size() const { return size_type(-1); }
-
- void swap(_Self& __t) {
- if (__t.empty()) {
- if (this->empty()) return;
- __t._M_header.swap(this->_M_header);
- __t._M_rebind(&this->_M_header._M_data);
- this->_M_empty_initialize();
- }
- else if (this->empty()) {
- __t.swap(*this);
- return;
- }
- else {
- this->_M_header.swap(__t._M_header);
- this->_M_rebind(&__t._M_header._M_data);
- __t._M_rebind(&this->_M_header._M_data);
- }
- _STLP_STD::swap(_M_node_count, __t._M_node_count);
- _STLP_STD::swap(_M_key_compare, __t._M_key_compare);
- }
-
-public:
- // insert/erase
- pair<iterator,bool> insert_unique(const value_type& __x);
- iterator insert_equal(const value_type& __x);
-
- iterator insert_unique(iterator __pos, const value_type& __x);
- iterator insert_equal(iterator __pos, const value_type& __x);
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template<class _II> void insert_equal(_II __first, _II __last) {
- for ( ; __first != __last; ++__first)
- insert_equal(*__first);
- }
- template<class _II> void insert_unique(_II __first, _II __last) {
- for ( ; __first != __last; ++__first)
- insert_unique(*__first);
- }
-#else
- void insert_unique(const_iterator __first, const_iterator __last) {
- for ( ; __first != __last; ++__first)
- insert_unique(*__first);
- }
- void insert_unique(const value_type* __first, const value_type* __last) {
- for ( ; __first != __last; ++__first)
- insert_unique(*__first);
- }
- void insert_equal(const_iterator __first, const_iterator __last) {
- for ( ; __first != __last; ++__first)
- insert_equal(*__first);
- }
- void insert_equal(const value_type* __first, const value_type* __last) {
- for ( ; __first != __last; ++__first)
- insert_equal(*__first);
- }
-#endif
-
- void erase(iterator __pos) {
- _Base_ptr __x = _Rb_global_inst::_Rebalance_for_erase(__pos._M_node,
- this->_M_header._M_data._M_parent,
- this->_M_header._M_data._M_left,
- this->_M_header._M_data._M_right);
- _STLP_STD::_Destroy(&_S_value(__x));
- this->_M_header.deallocate(__STATIC_CAST(_Link_type, __x), 1);
- --_M_node_count;
- }
-
- size_type erase(const key_type& __x) {
- pair<iterator,iterator> __p = equal_range(__x);
- size_type __n = distance(__p.first, __p.second);
- erase(__p.first, __p.second);
- return __n;
- }
-
- size_type erase_unique(const key_type& __x) {
- iterator __i = find(__x);
- if (__i._M_node != &this->_M_header._M_data) {
- erase(__i);
- return 1;
- }
- return 0;
- }
-
- void erase(iterator __first, iterator __last) {
- if (__first._M_node == this->_M_header._M_data._M_left && // begin()
- __last._M_node == &this->_M_header._M_data) // end()
- clear();
- else
- while (__first != __last) erase(__first++);
- }
-
- void erase(const key_type* __first, const key_type* __last) {
- while (__first != __last) erase(*__first++);
- }
-
- void clear() {
- if (_M_node_count != 0) {
- _M_erase(_M_root());
- _M_leftmost() = &this->_M_header._M_data;
- _M_root() = 0;
- _M_rightmost() = &this->_M_header._M_data;
- _M_node_count = 0;
- }
- }
-
-public:
- // set operations:
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __k) { return iterator(_M_find(__k)); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __k) const { return const_iterator(_M_find(__k)); }
-private:
- _STLP_TEMPLATE_FOR_CONT_EXT
- _Base_ptr _M_find(const _KT& __k) const {
- _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); // Last node which is not less than __k.
- _Base_ptr __x = _M_root(); // Current node.
-
- while (__x != 0)
- if (!_M_key_compare(_S_key(__x), __k))
- __y = __x, __x = _S_left(__x);
- else
- __x = _S_right(__x);
-
- if (__y != &this->_M_header._M_data) {
- if (_M_key_compare(__k, _S_key(__y))) {
- __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data);
- }
- }
- return __y;
- }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- _Base_ptr _M_lower_bound(const _KT& __k) const {
- _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); /* Last node which is not less than __k. */
- _Base_ptr __x = _M_root(); /* Current node. */
-
- while (__x != 0)
- if (!_M_key_compare(_S_key(__x), __k))
- __y = __x, __x = _S_left(__x);
- else
- __x = _S_right(__x);
-
- return __y;
- }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- _Base_ptr _M_upper_bound(const _KT& __k) const {
- _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); /* Last node which is greater than __k. */
- _Base_ptr __x = _M_root(); /* Current node. */
-
- while (__x != 0)
- if (_M_key_compare(__k, _S_key(__x)))
- __y = __x, __x = _S_left(__x);
- else
- __x = _S_right(__x);
-
- return __y;
- }
-
-public:
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __x) const {
- pair<const_iterator, const_iterator> __p = equal_range(__x);
- return distance(__p.first, __p.second);
- }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator lower_bound(const _KT& __x) { return iterator(_M_lower_bound(__x)); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator lower_bound(const _KT& __x) const { return const_iterator(_M_lower_bound(__x)); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator upper_bound(const _KT& __x) { return iterator(_M_upper_bound(__x)); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator upper_bound(const _KT& __x) const { return const_iterator(_M_upper_bound(__x)); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator,iterator> equal_range(const _KT& __x)
- { return pair<iterator, iterator>(lower_bound(__x), upper_bound(__x)); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __x) const
- { return pair<const_iterator, const_iterator>(lower_bound(__x), upper_bound(__x)); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator,iterator> equal_range_unique(const _KT& __x) {
- pair<iterator, iterator> __p;
- __p.second = lower_bound(__x);
- if (__p.second._M_node != &this->_M_header._M_data &&
- !_M_key_compare(__x, _S_key(__p.second._M_node))) {
- __p.first = __p.second++;
- }
- else {
- __p.first = __p.second;
- }
- return __p;
- }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range_unique(const _KT& __x) const {
- pair<const_iterator, const_iterator> __p;
- __p.second = lower_bound(__x);
- if (__p.second._M_node != &this->_M_header._M_data &&
- !_M_key_compare(__x, _S_key(__p.second._M_node))) {
- __p.first = __p.second++;
- }
- else {
- __p.first = __p.second;
- }
- return __p;
- }
-
-#if defined (_STLP_DEBUG)
-public:
- // Debugging.
- bool __rb_verify() const;
-#endif //_STLP_DEBUG
-};
-
-#if defined (_STLP_DEBUG)
-# undef _Rb_tree
-#endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_tree.c>
-#endif
-
-#if defined (_STLP_DEBUG)
-# include <stl/debug/_tree.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#define _STLP_TEMPLATE_HEADER template <class _Key, class _Compare, class _Value, class _KeyOfValue, class _Traits, class _Alloc>
-#define _STLP_TEMPLATE_CONTAINER _STLP_PRIV _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>
-#include <stl/_relops_cont.h>
-#undef _STLP_TEMPLATE_CONTAINER
-#undef _STLP_TEMPLATE_HEADER
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Key, class _Compare, class _Value, class _KeyOfValue, class _Traits, class _Alloc>
-struct __move_traits<_STLP_PRIV _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> >
- : _STLP_PRIV __move_traits_help2<_Compare, _Alloc> {};
-#endif
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_TREE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_typeinfo.h b/stl/_typeinfo.h
deleted file mode 100644
index 4e602fb..0000000
--- a/stl/_typeinfo.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_INTERNAL_TYPEINFO
-#define _STLP_INTERNAL_TYPEINFO
-
-#if !defined (_STLP_NO_TYPEINFO)
-
-# if defined (_STLP_NO_NEW_NEW_HEADER)
-# include <typeinfo.h>
-# else
-# ifdef _STLP_BROKEN_BAD_CAST_CLASS
-# define bad_cast _STLP_NULLIFIED_BROKEN_BAD_CAST_CLASS
-# endif
-# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo)
-# ifdef _STLP_BROKEN_BAD_CAST_CLASS
-# undef bad_cast
-# undef _STLP_NULLIFIED_BROKEN_BAD_CAST_CLASS
-# endif
-# endif
-
-# if (defined(_STLP_MSVC) && (_STLP_MSVC >= 1300)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800))
-// In .NET, <typeinfo> actually includes <typeinfo.h>
-# undef _STLP_OLDSTD_typeinfo
-# endif
-
-// if <typeinfo.h> already included, do not import anything
-# if defined(_STLP_USE_NAMESPACES) && !defined(_STLP_OLDSTD_typeinfo) && \
- (defined(_STLP_VENDOR_GLOBAL_EXCEPT_STD) || \
- defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_DEBUG))
-# if defined(_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined(_STLP_WCE_NET)
-class bad_cast : public exception {};
-# endif
-
-_STLP_BEGIN_NAMESPACE
-// VC 6 and eVC 4 have type_info in the global namespace
-# if (defined(_STLP_MSVC) && (_STLP_MSVC < 1300)) || defined(_STLP_WCE_NET)
-using ::type_info;
-# else
-using _STLP_VENDOR_EXCEPT_STD::type_info;
-# endif
-
-# if !(defined (__MRC__) || defined (__SC__) || defined (__DMC__))
-using _STLP_VENDOR_EXCEPT_STD::bad_typeid;
-# endif
-
-//#if defined( __xlC__ ) && (__xlC__ < 0x500)
-//# include <exception>
-//struct bad_cast : exception {};
-//#endif
-# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined (_STLP_WCE_NET)
-using ::bad_cast;
-# else
-using _STLP_VENDOR_EXCEPT_STD::bad_cast;
-# endif
-
-_STLP_END_NAMESPACE
-
-# endif
-
-#else
-
-# ifndef _STLP_INTERNAL_EXCEPTION
-# include <stl/_exception.h>
-# endif
-
-_STLP_BEGIN_NAMESPACE
-# if !defined (__DMC__)
-struct bad_cast : exception {};
-# endif
-_STLP_END_NAMESPACE
-#endif
-
-#endif
diff --git a/stl/_uninitialized.h b/stl/_uninitialized.h
deleted file mode 100644
index 5bf3578..0000000
--- a/stl/_uninitialized.h
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_UNINITIALIZED_H
-#define _STLP_INTERNAL_UNINITIALIZED_H
-
-#ifndef _STLP_INTERNAL_CSTRING
-# include <stl/_cstring.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CONSTRUCT_H
-# include <stl/_construct.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-// uninitialized_copy
-
-template <class _InputIter, class _OutputIter, class _Distance>
-inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
- _OutputIter __result, _Distance*) {
- _OutputIter __cur = __result;
- _STLP_TRY {
- for ( ; __first != __last; ++__first, ++__cur)
- _Param_Construct(&*__cur, *__first);
- return __cur;
- }
- _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur))
- _STLP_RET_AFTER_THROW(__cur)
-}
-
-template <class _InputIter, class _OutputIter, class _Distance>
-inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
- _OutputIter __result, const input_iterator_tag &, _Distance* __d)
-{ return __ucopy(__first, __last, __result, __d); }
-
-#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
-template <class _InputIter, class _OutputIter, class _Distance>
-inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
- _OutputIter __result, const forward_iterator_tag &, _Distance* __d)
-{ return __ucopy(__first, __last, __result, __d); }
-
-template <class _InputIter, class _OutputIter, class _Distance>
-inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
- _OutputIter __result, const bidirectional_iterator_tag &, _Distance* __d)
-{ return __ucopy(__first, __last, __result, __d); }
-#endif
-
-template <class _RandomAccessIter, class _OutputIter, class _Distance>
-inline _OutputIter __ucopy(_RandomAccessIter __first, _RandomAccessIter __last,
- _OutputIter __result, const random_access_iterator_tag &, _Distance*) {
- _OutputIter __cur = __result;
- _STLP_TRY {
- for (_Distance __n = __last - __first; __n > 0; --__n) {
- _Param_Construct(&*__cur, *__first);
- ++__first;
- ++__cur;
- }
- return __cur;
- }
- _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur))
- _STLP_RET_AFTER_THROW(__cur)
-}
-
-//Used internaly
-template <class _RandomAccessIter, class _OutputIter>
-inline _OutputIter __ucopy(_RandomAccessIter __first, _RandomAccessIter __last, _OutputIter __result)
-{ return __ucopy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); }
-
-inline void*
-__ucopy_trivial(const void* __first, const void* __last, void* __result) {
- //dums: this version can use memcpy (__copy_trivial can't)
- return (__last == __first) ? __result :
- ((char*)memcpy(__result, __first, ((const char*)__last - (const char*)__first))) +
- ((const char*)__last - (const char*)__first);
-}
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __ucopy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
- const __false_type& /*TrivialUCopy*/)
-{ return __ucopy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); }
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __ucopy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
- const __true_type& /*TrivialUCopy*/) {
- // we know they all pointers, so this cast is OK
- // return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result));
- return (_OutputIter)__ucopy_trivial(__first, __last, __result);
-}
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __ucopy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
- const __true_type& /*BothPtrType*/) {
- return __ucopy_ptrs(__first, __last, __result,
- _UseTrivialUCopy(_STLP_VALUE_TYPE(__first, _InputIter),
- _STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
-}
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __ucopy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
- const __false_type& /*BothPtrType*/) {
- return __ucopy(__first, __last, __result,
- _STLP_ITERATOR_CATEGORY(__first, _InputIter),
- _STLP_DISTANCE_TYPE(__first, _InputIter));
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter, class _ForwardIter>
-inline _ForwardIter
-uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result)
-{ return _STLP_PRIV __ucopy_aux(__first, __last, __result, _BothPtrType< _InputIter, _ForwardIter>::_Answer()); }
-
-inline char*
-uninitialized_copy(const char* __first, const char* __last, char* __result)
-{ return (char*)_STLP_PRIV __ucopy_trivial(__first, __last, __result); }
-
-# if defined (_STLP_HAS_WCHAR_T) // dwa 8/15/97
-inline wchar_t*
-uninitialized_copy(const wchar_t* __first, const wchar_t* __last, wchar_t* __result)
-{ return (wchar_t*)_STLP_PRIV __ucopy_trivial (__first, __last, __result); }
-# endif
-
-// uninitialized_copy_n (not part of the C++ standard)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter, class _Size, class _ForwardIter>
-_STLP_INLINE_LOOP
-pair<_InputIter, _ForwardIter>
-__ucopy_n(_InputIter __first, _Size __count, _ForwardIter __result,
- const input_iterator_tag &) {
- _ForwardIter __cur = __result;
- _STLP_TRY {
- for ( ; __count > 0 ; --__count, ++__first, ++__cur)
- _Param_Construct(&*__cur, *__first);
- return pair<_InputIter, _ForwardIter>(__first, __cur);
- }
- _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur))
- _STLP_RET_AFTER_THROW((pair<_InputIter, _ForwardIter>(__first, __cur)))
-}
-
-# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
-template <class _InputIter, class _Size, class _ForwardIterator>
-inline pair<_InputIter, _ForwardIterator>
-__ucopy_n(_InputIter __first, _Size __count,
- _ForwardIterator __result,
- const forward_iterator_tag &)
-{ return __ucopy_n(__first, __count, __result, input_iterator_tag()); }
-
-template <class _InputIter, class _Size, class _ForwardIterator>
-inline pair<_InputIter, _ForwardIterator>
-__ucopy_n(_InputIter __first, _Size __count,
- _ForwardIterator __result,
- const bidirectional_iterator_tag &)
-{ return __ucopy_n(__first, __count, __result, input_iterator_tag()); }
-# endif
-
-template <class _RandomAccessIter, class _Size, class _ForwardIter>
-inline pair<_RandomAccessIter, _ForwardIter>
-__ucopy_n(_RandomAccessIter __first, _Size __count, _ForwardIter __result,
- const random_access_iterator_tag &) {
- _RandomAccessIter __last = __first + __count;
- return pair<_RandomAccessIter, _ForwardIter>(__last, uninitialized_copy(__first, __last, __result));
-}
-
-// This is used internally in <rope> , which is extension itself.
-template <class _InputIter, class _Size, class _ForwardIter>
-inline pair<_InputIter, _ForwardIter>
-__ucopy_n(_InputIter __first, _Size __count, _ForwardIter __result)
-{ return _STLP_PRIV __ucopy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
-
-#if !defined (_STLP_NO_EXTENSIONS)
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _InputIter, class _Size, class _ForwardIter>
-inline pair<_InputIter, _ForwardIter>
-uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result)
-{ return _STLP_PRIV __ucopy_n(__first, __count, __result); }
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-#endif
-
-template <class _ForwardIter, class _Tp, class _Distance>
-inline void __ufill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x, _Distance*) {
- _ForwardIter __cur = __first;
- _STLP_TRY {
- for ( ; __cur != __last; ++__cur)
- _Param_Construct(&*__cur, __x);
- }
- _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur))
-}
-
-template <class _ForwardIter, class _Tp, class _Distance>
-inline void __ufill(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __x, const input_iterator_tag &, _Distance* __d)
-{ __ufill(__first, __last, __x, __d); }
-
-#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
-template <class _ForwardIter, class _Tp, class _Distance>
-inline void __ufill(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __x, const forward_iterator_tag &, _Distance* __d)
-{ __ufill(__first, __last, __x, __d); }
-
-template <class _ForwardIter, class _Tp, class _Distance>
-inline void __ufill(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __x, const bidirectional_iterator_tag &, _Distance* __d)
-{ __ufill(__first, __last, __x, __d); }
-#endif
-
-template <class _ForwardIter, class _Tp, class _Distance>
-inline void __ufill(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __x, const random_access_iterator_tag &, _Distance*) {
- _ForwardIter __cur = __first;
- _STLP_TRY {
- for (_Distance __n = __last - __first; __n > 0; --__n, ++__cur)
- _Param_Construct(&*__cur, __x);
- }
- _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur))
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _ForwardIter, class _Tp>
-inline void uninitialized_fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x) {
- _STLP_PRIV __ufill(__first, __last, __x,
- _STLP_ITERATOR_CATEGORY(__first, _ForwardIter),
- _STLP_DISTANCE_TYPE(__first, _ForwardIter));
-}
-
-// Specialization: for one-byte types we can use memset.
-inline void uninitialized_fill(unsigned char* __first, unsigned char* __last,
- const unsigned char& __val) {
- unsigned char __tmp = __val;
- memset(__first, __tmp, __last - __first);
-}
-#if !defined (_STLP_NO_SIGNED_BUILTINS)
-inline void uninitialized_fill(signed char* __first, signed char* __last,
- const signed char& __val) {
- signed char __tmp = __val;
- memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
-}
-#endif
-inline void uninitialized_fill(char* __first, char* __last, const char& __val) {
- char __tmp = __val;
- memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
-}
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x) {
- _ForwardIter __cur = __first;
- _STLP_TRY {
- for ( ; __n > 0; --__n, ++__cur)
- _Param_Construct(&*__cur, __x);
- }
- _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur))
- return __cur;
-}
-
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
- const input_iterator_tag &)
-{ return __ufill_n(__first, __n, __x); }
-
-#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
- const forward_iterator_tag &)
-{ return __ufill_n(__first, __n, __x); }
-
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
- const bidirectional_iterator_tag &)
-{ return __ufill_n(__first, __n, __x); }
-#endif
-
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter __uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x) {
- _ForwardIter __last = __first + __n;
- __ufill(__first, __last, __x, random_access_iterator_tag(), (ptrdiff_t*)0);
- return __last;
-}
-
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
- const random_access_iterator_tag &)
-{ return __uninitialized_fill_n(__first, __n, __x); }
-
-/* __uninitialized_init is an internal algo to init a range with a value
- * built using default constructor. It is only called with pointer as
- * iterator.
- */
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter __uinit_aux_aux(_ForwardIter __first, _Size __n, const _Tp& __val,
- const __false_type& /*_HasDefaultZero*/)
-{ return __uninitialized_fill_n(__first, __n, __val); }
-
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter __uinit_aux_aux(_ForwardIter __first, _Size __n, const _Tp& __val,
- const __true_type& /*_HasDefaultZero*/) {
- memset((unsigned char*)__first, 0, __n * sizeof(_Tp));
- return __first + __n;
-}
-
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter __uinit_aux(_ForwardIter __first, _Size __n, const _Tp&,
- const __true_type& /*_TrivialInit*/)
-{ return __first + __n; }
-
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter __uinit_aux(_ForwardIter __first, _Size __n, const _Tp& __val,
- const __false_type& /*_TrivialInit*/)
-{ return __uinit_aux_aux(__first, __n, __val, _HasDefaultZeroValue(__first)._Answer()); }
-
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter __uninitialized_init(_ForwardIter __first, _Size __n, const _Tp& __val)
-{ return __uinit_aux(__first, __n, __val, _UseTrivialInit(__first)._Answer()); }
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _ForwardIter, class _Size, class _Tp>
-inline void
-uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x)
-{ _STLP_PRIV __ufill_n(__first, __n, __x, _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); }
-
-// Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill,
-// __uninitialized_fill_copy.
-
-// __uninitialized_copy_copy
-// Copies [first1, last1) into [result, result + (last1 - first1)), and
-// copies [first2, last2) into
-// [result + (last1 - first1), result + (last1 - first1) + (last2 - first2)).
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _InputIter1, class _InputIter2, class _ForwardIter>
-inline _ForwardIter
-__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _ForwardIter __result)
-{ return uninitialized_copy(__first2, __last2, uninitialized_copy(__first1, __last1, __result)); }
-
-// __uninitialized_fill_copy
-// Fills [result, mid) with x, and copies [first, last) into
-// [mid, mid + (last - first)).
-template <class _ForwardIter, class _Tp, class _InputIter>
-inline _ForwardIter
-__uninitialized_fill_copy(_ForwardIter __result, _ForwardIter __mid, const _Tp& __x,
- _InputIter __first, _InputIter __last) {
- uninitialized_fill(__result, __mid, __x);
- _STLP_TRY {
- return uninitialized_copy(__first, __last, __mid);
- }
- _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __mid))
- _STLP_RET_AFTER_THROW(__result)
-}
-
-// __uninitialized_copy_fill
-// Copies [first1, last1) into [first2, first2 + (last1 - first1)), and
-// fills [first2 + (last1 - first1), last2) with x.
-template <class _Iter, class _Tp>
-inline void
-__uninitialized_copy_fill(_Iter __first1, _Iter __last1, _Iter __first2, _Iter __last2,
- const _Tp& __x) {
- _Iter __mid2 = uninitialized_copy(__first1, __last1, __first2);
- _STLP_TRY {
- uninitialized_fill(__mid2, __last2, __x);
- }
- _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first2, __mid2))
-}
-
-/* __uninitialized_move:
- * This function is used internaly and only with pointers as iterators.
- */
-template <class _InputIter, class _ForwardIter, class _TrivialUCpy>
-inline _ForwardIter
-__uninitialized_move(_InputIter __first, _InputIter __last, _ForwardIter __result,
- _TrivialUCpy __trivial_ucpy, const __false_type& /*_Movable*/)
-{ return __ucopy_ptrs(__first, __last, __result, __trivial_ucpy); }
-
-template <class _InputIter, class _ForwardIter, class _TrivialUCpy>
-_STLP_INLINE_LOOP
-_ForwardIter
-__uninitialized_move(_InputIter __first, _InputIter __last, _ForwardIter __result,
- _TrivialUCpy , const __true_type& /*_Movable*/) {
- //Move constructor should not throw so we do not need to take care of exceptions here.
- for (ptrdiff_t __n = __last - __first ; __n > 0; --__n) {
- _Move_Construct(&*__result, *__first);
- ++__first; ++__result;
- }
- return __result;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_UNINITIALIZED_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_unordered_map.h b/stl/_unordered_map.h
deleted file mode 100644
index 3ad328d..0000000
--- a/stl/_unordered_map.h
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * Copyright (c) 2004
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_UNORDERED_MAP_H
-#define _STLP_INTERNAL_UNORDERED_MAP_H
-
-#ifndef _STLP_INTERNAL_HASHTABLE_H
-# include <stl/_hashtable.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//Specific iterator traits creation
-_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMapTraitsT, traits)
-
-template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
- _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
- _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) >
-class unordered_map
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
-#endif
-{
-private:
- typedef unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
-public:
- typedef _Key key_type;
- typedef _Tp data_type;
- typedef _Tp mapped_type;
-#if !defined (__DMC__)
- typedef pair<const key_type, data_type> value_type;
-#else
- typedef pair<key_type, data_type> value_type;
-#endif
-private:
- //Specific iterator traits creation
- typedef _STLP_PRIV _UnorderedMapTraitsT<value_type> _UnorderedMapTraits;
-
-public:
- typedef hashtable<value_type, key_type, _HashFcn, _UnorderedMapTraits,
- _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
-
- typedef typename _Ht::hasher hasher;
- typedef typename _Ht::key_equal key_equal;
-
- typedef typename _Ht::size_type size_type;
- typedef typename _Ht::difference_type difference_type;
- typedef typename _Ht::pointer pointer;
- typedef typename _Ht::const_pointer const_pointer;
- typedef typename _Ht::reference reference;
- typedef typename _Ht::const_reference const_reference;
-
- typedef typename _Ht::iterator iterator;
- typedef typename _Ht::const_iterator const_iterator;
- typedef typename _Ht::local_iterator local_iterator;
- typedef typename _Ht::const_local_iterator const_local_iterator;
-
- typedef typename _Ht::allocator_type allocator_type;
-
- hasher hash_function() const { return _M_ht.hash_funct(); }
- key_equal key_eq() const { return _M_ht.key_eq(); }
- allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-private:
- _Ht _M_ht;
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-public:
- explicit unordered_map(size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a) {}
-
- unordered_map(__move_source<_Self> src)
- : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- unordered_map(_InputIterator __f, _InputIterator __l,
- size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#else
- unordered_map(const value_type* __f, const value_type* __l,
- size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-
- unordered_map(const_iterator __f, const_iterator __l,
- size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#endif /*_STLP_MEMBER_TEMPLATES */
-
- _Self& operator = (const _Self& __other)
- { _M_ht = __other._M_ht; return *this; }
-
- size_type size() const { return _M_ht.size(); }
- size_type max_size() const { return _M_ht.max_size(); }
- bool empty() const { return _M_ht.empty(); }
- void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
-
- iterator begin() { return _M_ht.begin(); }
- iterator end() { return _M_ht.end(); }
- const_iterator begin() const { return _M_ht.begin(); }
- const_iterator end() const { return _M_ht.end(); }
-
- pair<iterator,bool> insert(const value_type& __obj)
- { return _M_ht.insert_unique(__obj); }
- iterator insert(const_iterator /*__hint*/, const value_type& __obj)
- { return _M_ht.insert_unique(__obj); }
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(_InputIterator __f, _InputIterator __l)
-#else
- void insert(const value_type* __f, const value_type* __l)
- { _M_ht.insert_unique(__f,__l); }
- void insert(const_iterator __f, const_iterator __l)
-#endif /*_STLP_MEMBER_TEMPLATES */
- { _M_ht.insert_unique(__f, __l); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __key) { return _M_ht.find(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- _Tp& operator[](const _KT& __key) {
- iterator __it = _M_ht.find(__key);
- return (__it == _M_ht.end() ?
- _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second :
- (*__it).second );
- }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __key) const { return _M_ht.count(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __key)
- { return _M_ht.equal_range(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
- { return _M_ht.equal_range(__key); }
-
- size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
- void erase(const_iterator __it) { _M_ht.erase(__it); }
- void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
- void clear() { _M_ht.clear(); }
-
- size_type bucket_count() const { return _M_ht.bucket_count(); }
- size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
- size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
- local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
- local_iterator end(size_type __n) { return _M_ht.end(__n); }
- const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
- const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
-
- float load_factor() const { return _M_ht.load_factor(); }
- float max_load_factor() const { return _M_ht.max_load_factor(); }
- void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
- void rehash(size_type __hint) { _M_ht.rehash(__hint); }
-};
-
-//Specific iterator traits creation
-_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultimapTraitsT, traits)
-
-template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
- _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
- _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) >
-class unordered_multimap
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<unordered_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
-#endif
-{
-private:
- typedef unordered_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
-public:
- typedef _Key key_type;
- typedef _Tp data_type;
- typedef _Tp mapped_type;
-#if !defined (__DMC__)
- typedef pair<const key_type, data_type> value_type;
-#else
- typedef pair<key_type, data_type> value_type;
-#endif
-private:
- //Specific iterator traits creation
- typedef _STLP_PRIV _UnorderedMultimapTraitsT<value_type> _UnorderedMultimapTraits;
-
-public:
- typedef hashtable<value_type, key_type, _HashFcn, _UnorderedMultimapTraits,
- _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
-
- typedef typename _Ht::hasher hasher;
- typedef typename _Ht::key_equal key_equal;
-
- typedef typename _Ht::size_type size_type;
- typedef typename _Ht::difference_type difference_type;
- typedef typename _Ht::pointer pointer;
- typedef typename _Ht::const_pointer const_pointer;
- typedef typename _Ht::reference reference;
- typedef typename _Ht::const_reference const_reference;
-
- typedef typename _Ht::iterator iterator;
- typedef typename _Ht::const_iterator const_iterator;
- typedef typename _Ht::local_iterator local_iterator;
- typedef typename _Ht::const_local_iterator const_local_iterator;
-
- typedef typename _Ht::allocator_type allocator_type;
-
- hasher hash_function() const { return _M_ht.hash_funct(); }
- key_equal key_eq() const { return _M_ht.key_eq(); }
- allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-private:
- _Ht _M_ht;
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-public:
- explicit unordered_multimap(size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a) {}
-
- unordered_multimap(__move_source<_Self> src)
- : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- unordered_multimap(_InputIterator __f, _InputIterator __l,
- size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#else
- unordered_multimap(const value_type* __f, const value_type* __l,
- size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-
- unordered_multimap(const_iterator __f, const_iterator __l,
- size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*_STLP_MEMBER_TEMPLATES */
-
- _Self& operator = (const _Self& __other)
- { _M_ht = __other._M_ht; return *this; }
-
- size_type size() const { return _M_ht.size(); }
- size_type max_size() const { return _M_ht.max_size(); }
- bool empty() const { return _M_ht.empty(); }
- void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
-
- iterator begin() { return _M_ht.begin(); }
- iterator end() { return _M_ht.end(); }
- const_iterator begin() const { return _M_ht.begin(); }
- const_iterator end() const { return _M_ht.end(); }
-
- iterator insert(const value_type& __obj)
- { return _M_ht.insert_equal(__obj); }
- iterator insert(const_iterator /*__hint*/, const value_type& __obj)
- { return _M_ht.insert_equal(__obj); }
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(_InputIterator __f, _InputIterator __l)
-#else
- void insert(const value_type* __f, const value_type* __l)
- { _M_ht.insert_equal(__f,__l); }
- void insert(const_iterator __f, const_iterator __l)
-#endif /*_STLP_MEMBER_TEMPLATES */
- { _M_ht.insert_equal(__f, __l); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __key) { return _M_ht.find(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __key) const { return _M_ht.count(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __key)
- { return _M_ht.equal_range(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
- { return _M_ht.equal_range(__key); }
-
- size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
- void erase(const_iterator __it) { _M_ht.erase(__it); }
- void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
- void clear() { _M_ht.clear(); }
-
- size_type bucket_count() const { return _M_ht.bucket_count(); }
- size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
- size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
- local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
- local_iterator end(size_type __n) { return _M_ht.end(__n); }
- const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
- const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
-
- float load_factor() const { return _M_ht.load_factor(); }
- float max_load_factor() const { return _M_ht.max_load_factor(); }
- void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
- void rehash(size_type __hint) { _M_ht.rehash(__hint); }
-};
-
-#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
-#define _STLP_TEMPLATE_CONTAINER unordered_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
-
-#include <stl/_relops_hash_cont.h>
-
-#undef _STLP_TEMPLATE_CONTAINER
-#define _STLP_TEMPLATE_CONTAINER unordered_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
-
-#include <stl/_relops_hash_cont.h>
-
-#undef _STLP_TEMPLATE_CONTAINER
-#undef _STLP_TEMPLATE_HEADER
-
-// Specialization of insert_iterator so that it will work for unordered_map
-// and unordered_multimap.
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
-struct __move_traits<unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
- _STLP_PRIV __move_traits_help<typename unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
-{};
-
-template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
-struct __move_traits<unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
- _STLP_PRIV __move_traits_help<typename unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
-{};
-
-template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
-class insert_iterator<unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
-protected:
- typedef unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
- _Container* container;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- insert_iterator(_Container& __x) : container(&__x) {}
- insert_iterator(_Container& __x, typename _Container::iterator)
- : container(&__x) {}
- insert_iterator<_Container>&
- operator=(const typename _Container::value_type& __val) {
- container->insert(__val);
- return *this;
- }
- insert_iterator<_Container>& operator*() { return *this; }
- insert_iterator<_Container>& operator++() { return *this; }
- insert_iterator<_Container>& operator++(int) { return *this; }
-};
-
-template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
-class insert_iterator<unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
-protected:
- typedef unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
- _Container* container;
- typename _Container::iterator iter;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- insert_iterator(_Container& __x) : container(&__x) {}
- insert_iterator(_Container& __x, typename _Container::iterator)
- : container(&__x) {}
- insert_iterator<_Container>&
- operator=(const typename _Container::value_type& __val) {
- container->insert(__val);
- return *this;
- }
- insert_iterator<_Container>& operator*() { return *this; }
- insert_iterator<_Container>& operator++() { return *this; }
- insert_iterator<_Container>& operator++(int) { return *this; }
-};
-
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_UNORDERED_MAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_unordered_set.h b/stl/_unordered_set.h
deleted file mode 100644
index bcd662d..0000000
--- a/stl/_unordered_set.h
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * Copyright (c) 2004
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_UNORDERED_SET_H
-#define _STLP_INTERNAL_UNORDERED_SET_H
-
-#ifndef _STLP_INTERNAL_HASHTABLE_H
-# include <stl/_hashtable.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//Specific iterator traits creation
-_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedSetTraitsT, Const_traits)
-
-template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
- _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>),
- _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) >
-class unordered_set
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> >
-#endif
-{
- typedef unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
- //Specific iterator traits creation
- typedef _STLP_PRIV _UnorderedSetTraitsT<_Value> _UnorderedSetTraits;
-public:
- typedef hashtable<_Value, _Value, _HashFcn,
- _UnorderedSetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
-public:
- typedef typename _Ht::key_type key_type;
- typedef typename _Ht::value_type value_type;
- typedef typename _Ht::hasher hasher;
- typedef typename _Ht::key_equal key_equal;
-
- typedef typename _Ht::size_type size_type;
- typedef typename _Ht::difference_type difference_type;
- typedef typename _Ht::pointer pointer;
- typedef typename _Ht::const_pointer const_pointer;
- typedef typename _Ht::reference reference;
- typedef typename _Ht::const_reference const_reference;
-
- typedef typename _Ht::iterator iterator;
- typedef typename _Ht::const_iterator const_iterator;
- typedef typename _Ht::local_iterator local_iterator;
- typedef typename _Ht::const_local_iterator const_local_iterator;
-
- typedef typename _Ht::allocator_type allocator_type;
-
- hasher hash_function() const { return _M_ht.hash_funct(); }
- key_equal key_eq() const { return _M_ht.key_eq(); }
- allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-private:
- _Ht _M_ht;
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-public:
- explicit unordered_set(size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a) {}
-
- unordered_set(__move_source<_Self> src)
- : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- unordered_set(_InputIterator __f, _InputIterator __l,
- size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#else
- unordered_set(const value_type* __f, const value_type* __l,
- size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-
- unordered_set(const_iterator __f, const_iterator __l,
- size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#endif /*_STLP_MEMBER_TEMPLATES */
-
- _Self& operator = (const _Self& __other)
- { _M_ht = __other._M_ht; return *this; }
-
- size_type size() const { return _M_ht.size(); }
- size_type max_size() const { return _M_ht.max_size(); }
- bool empty() const { return _M_ht.empty(); }
- void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
-
- iterator begin() { return _M_ht.begin(); }
- iterator end() { return _M_ht.end(); }
- const_iterator begin() const { return _M_ht.begin(); }
- const_iterator end() const { return _M_ht.end(); }
-
- pair<iterator, bool> insert(const value_type& __obj)
- { return _M_ht.insert_unique(__obj); }
- iterator insert(const_iterator /*__hint*/, const value_type& __obj)
- { return _M_ht.insert_unique(__obj); }
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(_InputIterator __f, _InputIterator __l)
-#else
- void insert(const_iterator __f, const_iterator __l)
- {_M_ht.insert_unique(__f, __l); }
- void insert(const value_type* __f, const value_type* __l)
-#endif
- { _M_ht.insert_unique(__f,__l); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __key) { return _M_ht.find(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __key) const { return _M_ht.count(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __key)
- { return _M_ht.equal_range(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
- { return _M_ht.equal_range(__key); }
-
- size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
- void erase(const_iterator __it) { _M_ht.erase(__it); }
- void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
- void clear() { _M_ht.clear(); }
-
- size_type bucket_count() const { return _M_ht.bucket_count(); }
- size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
- size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
- local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
- local_iterator end(size_type __n) { return _M_ht.end(__n); }
- const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
- const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
-
- float load_factor() const { return _M_ht.load_factor(); }
- float max_load_factor() const { return _M_ht.max_load_factor(); }
- void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
- void rehash(size_type __hint) { _M_ht.rehash(__hint); }
-};
-
-//Specific iterator traits creation
-_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultisetTraitsT, Const_traits)
-
-template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
- _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>),
- _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) >
-class unordered_multiset
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> >
-#endif
-{
- typedef unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
- //Specific iterator traits creation
- typedef _STLP_PRIV _UnorderedMultisetTraitsT<_Value> _UnorderedMultisetTraits;
-public:
- typedef hashtable<_Value, _Value, _HashFcn,
- _UnorderedMultisetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
-
- typedef typename _Ht::key_type key_type;
- typedef typename _Ht::value_type value_type;
- typedef typename _Ht::hasher hasher;
- typedef typename _Ht::key_equal key_equal;
-
- typedef typename _Ht::size_type size_type;
- typedef typename _Ht::difference_type difference_type;
- typedef typename _Ht::pointer pointer;
- typedef typename _Ht::const_pointer const_pointer;
- typedef typename _Ht::reference reference;
- typedef typename _Ht::const_reference const_reference;
-
- typedef typename _Ht::iterator iterator;
- typedef typename _Ht::const_iterator const_iterator;
- typedef typename _Ht::local_iterator local_iterator;
- typedef typename _Ht::const_local_iterator const_local_iterator;
-
- typedef typename _Ht::allocator_type allocator_type;
-
- hasher hash_function() const { return _M_ht.hash_funct(); }
- key_equal key_eq() const { return _M_ht.key_eq(); }
- allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-private:
- _Ht _M_ht;
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-public:
- explicit unordered_multiset(size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a) {}
-
- unordered_multiset(__move_source<_Self> src)
- : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- unordered_multiset(_InputIterator __f, _InputIterator __l,
- size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#else
- unordered_multiset(const value_type* __f, const value_type* __l,
- size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-
- unordered_multiset(const_iterator __f, const_iterator __l,
- size_type __n = 100, const hasher& __hf = hasher(),
- const key_equal& __eql = key_equal(),
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*_STLP_MEMBER_TEMPLATES */
-
- _Self& operator = (const _Self& __other)
- { _M_ht = __other._M_ht; return *this; }
-
- size_type size() const { return _M_ht.size(); }
- size_type max_size() const { return _M_ht.max_size(); }
- bool empty() const { return _M_ht.empty(); }
- void swap(_Self& hs) { _M_ht.swap(hs._M_ht); }
-
- iterator begin() { return _M_ht.begin(); }
- iterator end() { return _M_ht.end(); }
- const_iterator begin() const { return _M_ht.begin(); }
- const_iterator end() const { return _M_ht.end(); }
-
- iterator insert(const value_type& __obj)
- { return _M_ht.insert_equal(__obj); }
- iterator insert(const_iterator /*__hint*/, const value_type& __obj)
- { return _M_ht.insert_equal(__obj); }
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(_InputIterator __f, _InputIterator __l)
-#else
- void insert(const value_type* __f, const value_type* __l)
- { _M_ht.insert_equal(__f,__l); }
- void insert(const_iterator __f, const_iterator __l)
-#endif /*_STLP_MEMBER_TEMPLATES */
- { _M_ht.insert_equal(__f, __l); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __key) { return _M_ht.find(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __key) const { return _M_ht.count(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __key)
- { return _M_ht.equal_range(__key); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
- { return _M_ht.equal_range(__key); }
-
- size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
- void erase(const_iterator __it) { _M_ht.erase(__it); }
- void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
- void clear() { _M_ht.clear(); }
-
- size_type bucket_count() const { return _M_ht.bucket_count(); }
- size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
- size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
- local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
- local_iterator end(size_type __n) { return _M_ht.end(__n); }
- const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
- const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
-
- float load_factor() const { return _M_ht.load_factor(); }
- float max_load_factor() const { return _M_ht.max_load_factor(); }
- void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
- void rehash(size_type __hint) { _M_ht.rehash(__hint); }
-};
-
-#define _STLP_TEMPLATE_HEADER template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-#define _STLP_TEMPLATE_CONTAINER unordered_set<_Value,_HashFcn,_EqualKey,_Alloc>
-
-#include <stl/_relops_hash_cont.h>
-
-#undef _STLP_TEMPLATE_CONTAINER
-#define _STLP_TEMPLATE_CONTAINER unordered_multiset<_Value,_HashFcn,_EqualKey,_Alloc>
-#include <stl/_relops_hash_cont.h>
-
-#undef _STLP_TEMPLATE_CONTAINER
-#undef _STLP_TEMPLATE_HEADER
-
-// Specialization of insert_iterator so that it will work for unordered_set
-// and unordered_multiset.
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-struct __move_traits<unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> > :
- _STLP_PRIV __move_traits_aux<typename unordered_set<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
-{};
-
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-struct __move_traits<unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > :
- _STLP_PRIV __move_traits_aux<typename unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
-{};
-
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-class insert_iterator<unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
-protected:
- typedef unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
- _Container* container;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- insert_iterator(_Container& __x) : container(&__x) {}
- insert_iterator(_Container& __x, typename _Container::iterator)
- : container(&__x) {}
- insert_iterator<_Container>&
- operator=(const typename _Container::value_type& __val) {
- container->insert(__val);
- return *this;
- }
- insert_iterator<_Container>& operator*() { return *this; }
- insert_iterator<_Container>& operator++() { return *this; }
- insert_iterator<_Container>& operator++(int) { return *this; }
-};
-
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-class insert_iterator<unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > {
-protected:
- typedef unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
- _Container* container;
- typename _Container::iterator iter;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- insert_iterator(_Container& __x) : container(&__x) {}
- insert_iterator(_Container& __x, typename _Container::iterator)
- : container(&__x) {}
- insert_iterator<_Container>&
- operator=(const typename _Container::value_type& __val) {
- container->insert(__val);
- return *this;
- }
- insert_iterator<_Container>& operator*() { return *this; }
- insert_iterator<_Container>& operator++() { return *this; }
- insert_iterator<_Container>& operator++(int) { return *this; }
-};
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_INTERNAL_UNORDERED_SET_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/stl/_valarray.c b/stl/_valarray.c
deleted file mode 100644
index c841a43..0000000
--- a/stl/_valarray.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_VALARRAY_C
-#define _STLP_VALARRAY_C
-
-#ifndef _STLP_VALARRAY_H
-# include <stl/_valarray.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _Tp>
-_Valarray_bool valarray<_Tp>:: operator!() const {
- _Valarray_bool __tmp(this->size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < this->size(); ++__i)
- __tmp[__i] = !(*this)[__i];
- return __tmp;
-}
-
-// Behavior is undefined if __x and *this have different sizes
-template <class _Tp>
-valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<_Tp>& __x)
-{
- size_t __index = __x._M_slice.start();
- for (size_t __i = 0;
- __i < __x._M_slice.size();
- ++__i, __index += __x._M_slice.stride())
- (*this)[__i] = __x._M_array[__index];
- return *this;
-}
-
-template <class _Tp>
-valarray<_Tp> valarray<_Tp>::operator[](slice __slice) const {
- valarray<_Tp> __tmp(__slice.size(), _NoInit());
- size_t __index = __slice.start();
- for (size_t __i = 0;
- __i < __slice.size();
- ++__i, __index += __slice.stride())
- __tmp[__i] = (*this)[__index];
- return __tmp;
-}
-
-template <class _Size>
-bool _Gslice_Iter_tmpl<_Size>::_M_incr() {
- size_t __dim = _M_indices.size() - 1;
- ++_M_step;
- for (;;) {
- _M_1d_idx += _M_gslice._M_strides[__dim];
- if (++_M_indices[__dim] != _M_gslice._M_lengths[__dim])
- return true;
- else if (__dim != 0) {
- _M_1d_idx -= _M_gslice._M_strides[__dim] * _M_gslice._M_lengths[__dim];
- _M_indices[__dim] = 0;
- --__dim;
- }
- else
- return false;
- }
-}
-
-// Behavior is undefined if __x and *this have different sizes, or if
-// __x was constructed from a degenerate gslice.
-template <class _Tp>
-valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<_Tp>& __x)
-{
- if (this->size() != 0) {
- _Gslice_Iter __i(__x._M_gslice);
- do
- (*this)[__i._M_step] = __x._M_array[__i._M_1d_idx];
- while(__i._M_incr());
- }
- return *this;
-}
-
-template <class _Tp>
-valarray<_Tp> valarray<_Tp>::operator[](const gslice& __slice) const
-{
- valarray<_Tp> __tmp(__slice._M_size(), _NoInit());
- if (__tmp.size() != 0) {
- _Gslice_Iter __i(__slice);
- do __tmp[__i._M_step] = (*this)[__i._M_1d_idx]; while(__i._M_incr());
- }
- return __tmp;
-}
-
-template <class _Tp>
-valarray<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask) const
-{
- size_t _p_size = 0;
- {
- for (size_t __i = 0; __i < __mask.size(); ++__i)
- if (__mask[__i]) ++_p_size;
- }
-
- valarray<_Tp> __tmp(_p_size, _NoInit());
- size_t __idx = 0;
- {
- for (size_t __i = 0; __i < __mask.size(); ++__i)
- if (__mask[__i]) __tmp[__idx++] = (*this)[__i];
- }
-
- return __tmp;
-}
-
-template <class _Tp>
-valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<_Tp>& __x) {
- for (size_t __i = 0; __i < __x._M_addr.size(); ++__i)
- (*this)[__i] = __x._M_array[__x._M_addr[__i]];
- return *this;
-}
-
-template <class _Tp>
-valarray<_Tp>
-valarray<_Tp>::operator[](const _Valarray_size_t& __addr) const
-{
- valarray<_Tp> __tmp(__addr.size(), _NoInit());
- for (size_t __i = 0; __i < __addr.size(); ++__i)
- __tmp[__i] = (*this)[__addr[__i]];
- return __tmp;
-}
-
-//----------------------------------------------------------------------
-// Other valarray noninline member functions
-
-// Shift and cshift
-
-template <class _Tp>
-valarray<_Tp> valarray<_Tp>::shift(int __n) const
-{
- valarray<_Tp> __tmp(this->size());
-
- if (__n >= 0) {
- if (__n < this->size())
- copy(this->_M_first + __n, this->_M_first + this->size(),
- __tmp._M_first);
- }
- else {
- if (-__n < this->size())
- copy(this->_M_first, this->_M_first + this->size() + __n,
- __tmp._M_first - __n);
- }
- return __tmp;
-}
-
-template <class _Tp>
-valarray<_Tp> valarray<_Tp>::cshift(int __m) const
-{
- valarray<_Tp> __tmp(this->size());
-
- // Reduce __m to an equivalent number in the range [0, size()). We
- // have to be careful with negative numbers, since the sign of a % b
- // is unspecified when a < 0.
- long __n = __m;
- if (this->size() < (numeric_limits<long>::max)())
- __n %= long(this->size());
- if (__n < 0)
- __n += this->size();
-
- copy(this->_M_first, this->_M_first + __n,
- __tmp._M_first + (this->size() - __n));
- copy(this->_M_first + __n, this->_M_first + this->size(),
- __tmp._M_first);
-
- return __tmp;
-}
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_VALARRAY_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_valarray.h b/stl/_valarray.h
deleted file mode 100644
index 037c5b9..0000000
--- a/stl/_valarray.h
+++ /dev/null
@@ -1,1665 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_VALARRAY_H
-#define _STLP_VALARRAY_H
-
-#ifndef _STLP_INTERNAL_CMATH
-# include <stl/_cmath.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NEW
-# include <stl/_new.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALGO_H
-# include <stl/_algo.h>
-#endif
-
-#ifndef _STLP_INTERNAL_NUMERIC_H
-# include <stl/_numeric.h>
-#endif
-
-#ifndef _STLP_INTERNAL_LIMITS
-# include <stl/_limits.h>
-#endif
-
-/* As we only need the _STLP_ASSERT macro from _debug.h we test it to include _debug.h */
-#ifndef _STLP_ASSERT
-# include <stl/debug/_debug.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-class slice;
-class gslice;
-
-template <class _Tp> class valarray;
-typedef valarray<bool> _Valarray_bool;
-typedef valarray<size_t> _Valarray_size_t;
-
-template <class _Tp> class slice_array;
-template <class _Tp> class gslice_array;
-template <class _Tp> class mask_array;
-template <class _Tp> class indirect_array;
-
-//----------------------------------------------------------------------
-// class valarray
-
-// Base class to handle memory allocation and deallocation. We can't just
-// use vector<>, because vector<bool> would be unsuitable as an internal
-// representation for valarray<bool>.
-
-template <class _Tp>
-struct _Valarray_base
-{
- _Tp* _M_first;
- size_t _M_size;
-
- _Valarray_base() : _M_first(0), _M_size(0) {}
- _Valarray_base(size_t __n) : _M_first(0), _M_size(0) { _M_allocate(__n); }
- ~_Valarray_base() { _M_deallocate(); }
-
- void _M_allocate(size_t __n) {
- if (__n != 0) {
- _M_first = __STATIC_CAST(_Tp*, (malloc(__n * sizeof(_Tp))));
- _M_size = __n;
-#if !defined(_STLP_NO_BAD_ALLOC) && defined(_STLP_USE_EXCEPTIONS)
- if (_M_first == 0) {
- _M_size = 0;
- throw _STLP_STD::bad_alloc();
- }
-#endif
- }
- else {
- _M_first = 0;
- _M_size = 0;
- }
- }
-
- void _M_deallocate() {
- free(_M_first);
- _M_first = 0;
- _M_size = 0;
- }
-};
-
-template <class _Tp>
-class valarray : private _Valarray_base<_Tp>
-{
- friend class gslice;
-
-public:
- typedef _Tp value_type;
-
- // Basic constructors
- valarray() : _Valarray_base<_Tp>() {}
- explicit valarray(size_t __n) : _Valarray_base<_Tp>(__n)
- { uninitialized_fill_n(this->_M_first, this->_M_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
- valarray(const value_type& __x, size_t __n) : _Valarray_base<_Tp>(__n)
- { uninitialized_fill_n(this->_M_first, this->_M_size, __x); }
- valarray(const value_type* __p, size_t __n) : _Valarray_base<_Tp>(__n)
- { uninitialized_copy(__p, __p + __n, this->_M_first); }
- valarray(const valarray<_Tp>& __x) : _Valarray_base<_Tp>(__x._M_size) {
- uninitialized_copy(__x._M_first, __x._M_first + __x._M_size,
- this->_M_first);
- }
-
- // Constructors from auxiliary array types
- valarray(const slice_array<_Tp>&);
- valarray(const gslice_array<_Tp>&);
- valarray(const mask_array<_Tp>&);
- valarray(const indirect_array<_Tp>&);
-
- // Destructor
- ~valarray() { _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size); }
-
- // Extension: constructor that doesn't initialize valarray elements to a
- // specific value. This is faster for types such as int and double.
-private:
- void _M_initialize(const __true_type&) {}
- void _M_initialize(const __false_type&)
- { uninitialized_fill_n(this->_M_first, this->_M_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
-
-public:
- struct _NoInit {};
- valarray(size_t __n, _NoInit) : _Valarray_base<_Tp>(__n) {
- typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Is_Trivial;
- _M_initialize(_Is_Trivial());
- }
-
-public: // Assignment
- // Basic assignment. Note that 'x = y' is undefined if x.size() != y.size()
- valarray<_Tp>& operator=(const valarray<_Tp>& __x) {
- _STLP_ASSERT(__x.size() == this->size())
- if (this != &__x)
- copy(__x._M_first, __x._M_first + __x._M_size, this->_M_first);
- return *this;
- }
-
- // Scalar assignment
- valarray<_Tp>& operator=(const value_type& __x) {
- fill_n(this->_M_first, this->_M_size, __x);
- return *this;
- }
-
- // Assignment of auxiliary array types
- valarray<_Tp>& operator=(const slice_array<_Tp>&);
- valarray<_Tp>& operator=(const gslice_array<_Tp>&);
- valarray<_Tp>& operator=(const mask_array<_Tp>&);
- valarray<_Tp>& operator=(const indirect_array<_Tp>&);
-
-public: // Element access
- value_type operator[](size_t __n) const { return this->_M_first[__n]; }
- value_type& operator[](size_t __n) { return this->_M_first[__n]; }
- size_t size() const { return this->_M_size; }
-
-public: // Subsetting operations with auxiliary type
- valarray<_Tp> operator[](slice) const;
- slice_array<_Tp> operator[](slice);
- valarray<_Tp> operator[](const gslice&) const;
- gslice_array<_Tp> operator[](const gslice&);
- valarray<_Tp> operator[](const _Valarray_bool&) const;
- mask_array<_Tp> operator[](const _Valarray_bool&);
- valarray<_Tp> operator[](const _Valarray_size_t&) const;
- indirect_array<_Tp> operator[](const _Valarray_size_t&);
-
-public: // Unary operators.
- valarray<_Tp> operator+() const { return *this; }
-
- valarray<_Tp> operator-() const {
- valarray<_Tp> __tmp(this->size(), _NoInit());
- for (size_t __i = 0; __i < this->size(); ++__i)
- __tmp[__i] = -(*this)[__i];
- return __tmp;
- }
-
- valarray<_Tp> operator~() const {
- valarray<_Tp> __tmp(this->size(), _NoInit());
- for (size_t __i = 0; __i < this->size(); ++__i)
- __tmp[__i] = ~(*this)[__i];
- return __tmp;
- }
-
- _Valarray_bool operator!() const;
-
-public: // Scalar computed assignment.
- valarray<_Tp>& operator*= (const value_type& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] *= __x;
- return *this;
- }
-
- valarray<_Tp>& operator/= (const value_type& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] /= __x;
- return *this;
- }
-
- valarray<_Tp>& operator%= (const value_type& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] %= __x;
- return *this;
- }
-
- valarray<_Tp>& operator+= (const value_type& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] += __x;
- return *this;
- }
-
- valarray<_Tp>& operator-= (const value_type& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] -= __x;
- return *this;
- }
-
- valarray<_Tp>& operator^= (const value_type& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] ^= __x;
- return *this;
- }
-
- valarray<_Tp>& operator&= (const value_type& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] &= __x;
- return *this;
- }
-
- valarray<_Tp>& operator|= (const value_type& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] |= __x;
- return *this;
- }
-
- valarray<_Tp>& operator<<= (const value_type& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] <<= __x;
- return *this;
- }
-
- valarray<_Tp>& operator>>= (const value_type& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] >>= __x;
- return *this;
- }
-
-public: // Array computed assignment.
- valarray<_Tp>& operator*= (const valarray<_Tp>& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] *= __x[__i];
- return *this;
- }
-
- valarray<_Tp>& operator/= (const valarray<_Tp>& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] /= __x[__i];
- return *this;
- }
-
- valarray<_Tp>& operator%= (const valarray<_Tp>& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] %= __x[__i];
- return *this;
- }
-
- valarray<_Tp>& operator+= (const valarray<_Tp>& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] += __x[__i];
- return *this;
- }
-
- valarray<_Tp>& operator-= (const valarray<_Tp>& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] -= __x[__i];
- return *this;
- }
-
- valarray<_Tp>& operator^= (const valarray<_Tp>& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] ^= __x[__i];
- return *this;
- }
-
- valarray<_Tp>& operator&= (const valarray<_Tp>& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] &= __x[__i];
- return *this;
- }
-
- valarray<_Tp>& operator|= (const valarray<_Tp>& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] |= __x[__i];
- return *this;
- }
-
- valarray<_Tp>& operator<<= (const valarray<_Tp>& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] <<= __x[__i];
- return *this;
- }
-
- valarray<_Tp>& operator>>= (const valarray<_Tp>& __x) {
- for (size_t __i = 0; __i < this->size(); ++__i)
- (*this)[__i] >>= __x[__i];
- return *this;
- }
-
-public: // Other member functions.
-
- // The result is undefined for zero-length arrays
- value_type sum() const {
- return accumulate(this->_M_first + 1, this->_M_first + this->_M_size,
- (*this)[0]);
- }
-
- // The result is undefined for zero-length arrays
- value_type (min) () const {
- return *min_element(this->_M_first + 0, this->_M_first + this->_M_size);
- }
-
- value_type (max) () const {
- return *max_element(this->_M_first + 0, this->_M_first + this->_M_size);
- }
-
- valarray<_Tp> shift(int __n) const;
- valarray<_Tp> cshift(int __n) const;
-
- valarray<_Tp> apply(value_type __f(value_type)) const {
- valarray<_Tp> __tmp(this->size());
- transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first,
- __f);
- return __tmp;
- }
- valarray<_Tp> apply(value_type __f(const value_type&)) const {
- valarray<_Tp> __tmp(this->size());
- transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first,
- __f);
- return __tmp;
- }
-
- void resize(size_t __n, value_type __x = value_type()) {
- _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size);
- _Valarray_base<_Tp>::_M_deallocate();
- _Valarray_base<_Tp>::_M_allocate(__n);
- uninitialized_fill_n(this->_M_first, this->_M_size, __x);
- }
-};
-
-//----------------------------------------------------------------------
-// valarray non-member functions.
-
-// Binary arithmetic operations between two arrays. Behavior is
-// undefined if the two arrays do not have the same length.
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator*(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] * __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator/(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] / __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator%(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] % __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator+(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] + __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator-(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] - __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator^(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] ^ __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator&(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] & __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator|(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] | __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator<<(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] << __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator>>(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] >> __y[__i];
- return __tmp;
-}
-
-// Binary arithmetic operations between an array and a scalar.
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator*(const valarray<_Tp>& __x, const _Tp& __c) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] * __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator*(const _Tp& __c, const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c * __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator/(const valarray<_Tp>& __x, const _Tp& __c) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] / __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator/(const _Tp& __c, const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c / __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator%(const valarray<_Tp>& __x, const _Tp& __c) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] % __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator%(const _Tp& __c, const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c % __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator+(const valarray<_Tp>& __x, const _Tp& __c) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] + __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator+(const _Tp& __c, const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c + __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator-(const valarray<_Tp>& __x, const _Tp& __c) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] - __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator-(const _Tp& __c, const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c - __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator^(const valarray<_Tp>& __x, const _Tp& __c) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] ^ __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator^(const _Tp& __c, const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c ^ __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator&(const valarray<_Tp>& __x, const _Tp& __c) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] & __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator&(const _Tp& __c, const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c & __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator|(const valarray<_Tp>& __x, const _Tp& __c) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] | __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator|(const _Tp& __c, const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c | __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator<<(const valarray<_Tp>& __x, const _Tp& __c) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] << __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator<<(const _Tp& __c, const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c << __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator>>(const valarray<_Tp>& __x, const _Tp& __c) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] >> __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> _STLP_CALL operator>>(const _Tp& __c, const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c >> __x[__i];
- return __tmp;
-}
-
-// Binary logical operations between two arrays. Behavior is undefined
-// if the two arrays have different lengths. Note that operator== does
-// not do what you might at first expect.
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator==(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] == __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator<(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] < __y[__i];
- return __tmp;
-}
-
-#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator!=(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] != __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator>(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] > __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator<=(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] <= __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator>=(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] >= __y[__i];
- return __tmp;
-}
-
-#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
-// fbp : swap ?
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator&&(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] && __y[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator||(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] || __y[__i];
- return __tmp;
-}
-
-// Logical operations between an array and a scalar.
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator==(const valarray<_Tp>& __x, const _Tp& __c)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] == __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator==(const _Tp& __c, const valarray<_Tp>& __x)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c == __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator!=(const valarray<_Tp>& __x, const _Tp& __c)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] != __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator!=(const _Tp& __c, const valarray<_Tp>& __x)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c != __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator<(const valarray<_Tp>& __x, const _Tp& __c)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] < __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator<(const _Tp& __c, const valarray<_Tp>& __x)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c < __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator>(const valarray<_Tp>& __x, const _Tp& __c)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] > __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator>(const _Tp& __c, const valarray<_Tp>& __x)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c > __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator<=(const valarray<_Tp>& __x, const _Tp& __c)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] <= __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator<=(const _Tp& __c, const valarray<_Tp>& __x)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c <= __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator>=(const valarray<_Tp>& __x, const _Tp& __c)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] >= __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator>=(const _Tp& __c, const valarray<_Tp>& __x)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c >= __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator&&(const valarray<_Tp>& __x, const _Tp& __c)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] && __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator&&(const _Tp& __c, const valarray<_Tp>& __x)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c && __x[__i];
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator||(const valarray<_Tp>& __x, const _Tp& __c)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __x[__i] || __c;
- return __tmp;
-}
-
-template <class _Tp>
-inline _Valarray_bool _STLP_CALL operator||(const _Tp& __c, const valarray<_Tp>& __x)
-{
- _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = __c || __x[__i];
- return __tmp;
-}
-
-// valarray "transcendentals" (the list includes abs and sqrt, which,
-// of course, are not transcendental).
-
-template <class _Tp>
-inline valarray<_Tp> abs(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::abs(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> acos(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::acos(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> asin(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::asin(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> atan(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::atan(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> atan2(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::atan2(__x[__i], __y[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> atan2(const valarray<_Tp>& __x, const _Tp& __c) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::atan2(__x[__i], __c);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> atan2(const _Tp& __c, const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::atan2(__c, __x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> cos(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::cos(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> cosh(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::cosh(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> exp(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::exp(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> log(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::log(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> log10(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::log10(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> pow(const valarray<_Tp>& __x,
- const valarray<_Tp>& __y) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::pow(__x[__i], __y[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> pow(const valarray<_Tp>& __x, const _Tp& __c) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::pow(__x[__i], __c);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> pow(const _Tp& __c, const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::pow(__c, __x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> sin(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::sin(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> sinh(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::sinh(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> sqrt(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::sqrt(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> tan(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::tan(__x[__i]);
- return __tmp;
-}
-
-template <class _Tp>
-inline valarray<_Tp> tanh(const valarray<_Tp>& __x) {
- typedef typename valarray<_Tp>::_NoInit _NoInit;
- valarray<_Tp> __tmp(__x.size(), _NoInit());
- for (size_t __i = 0; __i < __x.size(); ++__i)
- __tmp[__i] = ::tanh(__x[__i]);
- return __tmp;
-}
-
-//----------------------------------------------------------------------
-// slice and slice_array
-
-class slice {
-public:
- slice() : _M_start(0), _M_length(0), _M_stride(0) {}
- slice(size_t __start, size_t __length, size_t __stride)
- : _M_start(__start), _M_length(__length), _M_stride(__stride)
- {}
- __TRIVIAL_DESTRUCTOR(slice)
-
- size_t start() const { return _M_start; }
- size_t size() const { return _M_length; }
- size_t stride() const { return _M_stride; }
-
-private:
- size_t _M_start;
- size_t _M_length;
- size_t _M_stride;
-};
-
-template <class _Tp>
-class slice_array {
- friend class valarray<_Tp>;
-public:
- typedef _Tp value_type;
-
- void operator=(const valarray<value_type>& __x) const {
- size_t __index = _M_slice.start();
- for (size_t __i = 0;
- __i < _M_slice.size();
- ++__i, __index += _M_slice.stride())
- _M_array[__index] = __x[__i];
- }
-
- void operator*=(const valarray<value_type>& __x) const {
- size_t __index = _M_slice.start();
- for (size_t __i = 0;
- __i < _M_slice.size();
- ++__i, __index += _M_slice.stride())
- _M_array[__index] *= __x[__i];
- }
-
- void operator/=(const valarray<value_type>& __x) const {
- size_t __index = _M_slice.start();
- for (size_t __i = 0;
- __i < _M_slice.size();
- ++__i, __index += _M_slice.stride())
- _M_array[__index] /= __x[__i];
- }
-
- void operator%=(const valarray<value_type>& __x) const {
- size_t __index = _M_slice.start();
- for (size_t __i = 0;
- __i < _M_slice.size();
- ++__i, __index += _M_slice.stride())
- _M_array[__index] %= __x[__i];
- }
-
- void operator+=(const valarray<value_type>& __x) const {
- size_t __index = _M_slice.start();
- for (size_t __i = 0;
- __i < _M_slice.size();
- ++__i, __index += _M_slice.stride())
- _M_array[__index] += __x[__i];
- }
-
- void operator-=(const valarray<value_type>& __x) const {
- size_t __index = _M_slice.start();
- for (size_t __i = 0;
- __i < _M_slice.size();
- ++__i, __index += _M_slice.stride())
- _M_array[__index] -= __x[__i];
- }
-
- void operator^=(const valarray<value_type>& __x) const {
- size_t __index = _M_slice.start();
- for (size_t __i = 0;
- __i < _M_slice.size();
- ++__i, __index += _M_slice.stride())
- _M_array[__index] ^= __x[__i];
- }
-
- void operator&=(const valarray<value_type>& __x) const {
- size_t __index = _M_slice.start();
- for (size_t __i = 0;
- __i < _M_slice.size();
- ++__i, __index += _M_slice.stride())
- _M_array[__index] &= __x[__i];
- }
-
- void operator|=(const valarray<value_type>& __x) const {
- size_t __index = _M_slice.start();
- for (size_t __i = 0;
- __i < _M_slice.size();
- ++__i, __index += _M_slice.stride())
- _M_array[__index] |= __x[__i];
- }
-
- void operator<<=(const valarray<value_type>& __x) const {
- size_t __index = _M_slice.start();
- for (size_t __i = 0;
- __i < _M_slice.size();
- ++__i, __index += _M_slice.stride())
- _M_array[__index] <<= __x[__i];
- }
-
- void operator>>=(const valarray<value_type>& __x) const {
- size_t __index = _M_slice.start();
- for (size_t __i = 0;
- __i < _M_slice.size();
- ++__i, __index += _M_slice.stride())
- _M_array[__index] >>= __x[__i];
- }
-
- void operator=(const value_type& __c) /*const could be const but standard says NO (26.3.5.4-1)*/ {
- size_t __index = _M_slice.start();
- for (size_t __i = 0;
- __i < _M_slice.size();
- ++__i, __index += _M_slice.stride())
- _M_array[__index] = __c;
- }
-
- ~slice_array() {}
-
-private:
- slice_array(const slice& __slice, valarray<_Tp>& __array)
- : _M_slice(__slice), _M_array(__array)
- {}
-
- slice _M_slice;
- valarray<_Tp>& _M_array;
-
-private: // Disable assignment and default constructor
- slice_array();
- slice_array(const slice_array&);
- slice_array& operator=(const slice_array&);
-};
-
-// valarray member functions dealing with slice and slice_array
-
-template <class _Tp>
-inline valarray<_Tp>::valarray(const slice_array<_Tp>& __x)
- : _Valarray_base<_Tp>(__x._M_slice.size()) {
- typedef typename __type_traits<_Tp>::has_trivial_default_constructor
- _Is_Trivial;
- _M_initialize(_Is_Trivial());
- *this = __x;
-}
-
-
-template <class _Tp>
-inline slice_array<_Tp> valarray<_Tp>::operator[](slice __slice) {
- return slice_array<_Tp>(__slice, *this);
-}
-
-//----------------------------------------------------------------------
-// gslice and gslice_array
-
-template <class _Size>
-struct _Gslice_Iter_tmpl;
-
-class gslice {
- friend struct _Gslice_Iter_tmpl<size_t>;
-public:
- gslice() : _M_start(0), _M_lengths(0), _M_strides(0) {}
- gslice(size_t __start,
- const _Valarray_size_t& __lengths, const _Valarray_size_t& __strides)
- : _M_start(__start), _M_lengths(__lengths), _M_strides(__strides)
- {}
- __TRIVIAL_DESTRUCTOR(gslice)
-
- size_t start() const { return _M_start; }
- _Valarray_size_t size() const { return _M_lengths; }
- _Valarray_size_t stride() const { return _M_strides; }
-
- // Extension: check for an empty gslice.
- bool _M_empty() const { return _M_lengths.size() == 0; }
-
- // Extension: number of indices this gslice represents. (For a degenerate
- // gslice, they're not necessarily all distinct.)
- size_t _M_size() const {
- return !this->_M_empty()
- ? accumulate(_M_lengths._M_first + 1,
- _M_lengths._M_first + _M_lengths._M_size,
- _M_lengths[0],
- multiplies<size_t>())
- : 0;
- }
-
-# ifndef __HP_aCC
-private:
-# endif
-
- size_t _M_start;
- _Valarray_size_t _M_lengths;
- _Valarray_size_t _M_strides;
-};
-
-// This is not an STL iterator. It is constructed from a gslice, and it
-// steps through the gslice indices in sequence. See 23.3.6 of the C++
-// standard, paragraphs 2-3, for an explanation of the sequence. At
-// each step we get two things: the ordinal (i.e. number of steps taken),
-// and the one-dimensional index.
-
-template <class _Size>
-struct _Gslice_Iter_tmpl {
- _Gslice_Iter_tmpl(const gslice& __gslice)
- : _M_step(0), _M_1d_idx(__gslice.start()),
- _M_indices(size_t(0), __gslice._M_lengths.size()),
- _M_gslice(__gslice)
- {}
-
- bool _M_done() const { return _M_indices[0] == _M_gslice._M_lengths[0]; }
-
- bool _M_incr();
-
- _Size _M_step;
- _Size _M_1d_idx;
-
- valarray<_Size> _M_indices;
- const gslice& _M_gslice;
-};
-
-typedef _Gslice_Iter_tmpl<size_t> _Gslice_Iter;
-
-template <class _Tp>
-class gslice_array {
- friend class valarray<_Tp>;
-public:
- typedef _Tp value_type;
-
- void operator= (const valarray<value_type>& __x) const {
- if (!_M_gslice._M_empty()) {
- _Gslice_Iter __i(_M_gslice);
- do _M_array[__i._M_1d_idx] = __x[__i._M_step]; while(__i._M_incr());
- }
- }
-
- void operator*= (const valarray<value_type>& __x) const {
- if (!_M_gslice._M_empty()) {
- _Gslice_Iter __i(_M_gslice);
- do _M_array[__i._M_1d_idx] *= __x[__i._M_step]; while(__i._M_incr());
- }
- }
-
- void operator/= (const valarray<value_type>& __x) const {
- if (!_M_gslice._M_empty()) {
- _Gslice_Iter __i(_M_gslice);
- do _M_array[__i._M_1d_idx] /= __x[__i._M_step]; while(__i._M_incr());
- }
- }
-
- void operator%= (const valarray<value_type>& __x) const {
- if (!_M_gslice._M_empty()) {
- _Gslice_Iter __i(_M_gslice);
- do _M_array[__i._M_1d_idx] %= __x[__i._M_step]; while(__i._M_incr());
- }
- }
-
- void operator+= (const valarray<value_type>& __x) const {
- if (!_M_gslice._M_empty()) {
- _Gslice_Iter __i(_M_gslice);
- do _M_array[__i._M_1d_idx] += __x[__i._M_step]; while(__i._M_incr());
- }
- }
-
- void operator-= (const valarray<value_type>& __x) const {
- if (!_M_gslice._M_empty()) {
- _Gslice_Iter __i(_M_gslice);
- do _M_array[__i._M_1d_idx] -= __x[__i._M_step]; while(__i._M_incr());
- }
- }
-
- void operator^= (const valarray<value_type>& __x) const {
- if (!_M_gslice._M_empty()) {
- _Gslice_Iter __i(_M_gslice);
- do _M_array[__i._M_1d_idx] ^= __x[__i._M_step]; while(__i._M_incr());
- }
- }
-
- void operator&= (const valarray<value_type>& __x) const {
- if (!_M_gslice._M_empty()) {
- _Gslice_Iter __i(_M_gslice);
- do _M_array[__i._M_1d_idx] &= __x[__i._M_step]; while(__i._M_incr());
- }
- }
-
- void operator|= (const valarray<value_type>& __x) const {
- if (!_M_gslice._M_empty()) {
- _Gslice_Iter __i(_M_gslice);
- do _M_array[__i._M_1d_idx] |= __x[__i._M_step]; while(__i._M_incr());
- }
- }
-
- void operator<<= (const valarray<value_type>& __x) const {
- if (!_M_gslice._M_empty()) {
- _Gslice_Iter __i(_M_gslice);
- do _M_array[__i._M_1d_idx] <<= __x[__i._M_step]; while(__i._M_incr());
- }
- }
-
- void operator>>= (const valarray<value_type>& __x) const {
- if (!_M_gslice._M_empty()) {
- _Gslice_Iter __i(_M_gslice);
- do _M_array[__i._M_1d_idx] >>= __x[__i._M_step]; while(__i._M_incr());
- }
- }
-
- void operator= (const value_type& __c) /*const could be const but standard says NO (26.3.7.4-1)*/ {
- if (!_M_gslice._M_empty()) {
- _Gslice_Iter __i(_M_gslice);
- do _M_array[__i._M_1d_idx] = __c; while(__i._M_incr());
- }
- }
-
- ~gslice_array() {}
-
-private:
- gslice_array(const gslice& __gslice, valarray<_Tp>& __array)
- : _M_gslice(__gslice), _M_array(__array)
- {}
-
- gslice _M_gslice;
- valarray<value_type>& _M_array;
-
-private: // Disable assignment
- void operator=(const gslice_array<_Tp>&);
-};
-
-// valarray member functions dealing with gslice and gslice_array. Note
-// that it is illegal (behavior is undefined) to construct a gslice_array
-// from a degenerate gslice.
-
-template <class _Tp>
-inline valarray<_Tp>::valarray(const gslice_array<_Tp>& __x)
- : _Valarray_base<_Tp>(__x._M_gslice._M_size()) {
- typedef typename __type_traits<_Tp>::has_trivial_default_constructor
- _Is_Trivial;
- _M_initialize(_Is_Trivial());
- *this = __x;
-}
-
-template <class _Tp>
-inline gslice_array<_Tp> valarray<_Tp>::operator[](const gslice& __slice) {
- return gslice_array<_Tp>(__slice, *this);
-}
-
-
-//----------------------------------------------------------------------
-// mask_array
-
-template <class _Tp>
-class mask_array {
- friend class valarray<_Tp>;
-public:
- typedef _Tp value_type;
-
- void operator=(const valarray<value_type>& __x) const {
- size_t __idx = 0;
- for (size_t __i = 0; __i < _M_array.size(); ++__i)
- if (_M_mask[__i]) _M_array[__i] = __x[__idx++];
- }
-
- void operator*=(const valarray<value_type>& __x) const {
- size_t __idx = 0;
- for (size_t __i = 0; __i < _M_array.size(); ++__i)
- if (_M_mask[__i]) _M_array[__i] *= __x[__idx++];
- }
-
- void operator/=(const valarray<value_type>& __x) const {
- size_t __idx = 0;
- for (size_t __i = 0; __i < _M_array.size(); ++__i)
- if (_M_mask[__i]) _M_array[__i] /= __x[__idx++];
- }
-
- void operator%=(const valarray<value_type>& __x) const {
- size_t __idx = 0;
- for (size_t __i = 0; __i < _M_array.size(); ++__i)
- if (_M_mask[__i]) _M_array[__i] %= __x[__idx++];
- }
-
- void operator+=(const valarray<value_type>& __x) const {
- size_t __idx = 0;
- for (size_t __i = 0; __i < _M_array.size(); ++__i)
- if (_M_mask[__i]) _M_array[__i] += __x[__idx++];
- }
-
- void operator-=(const valarray<value_type>& __x) const {
- size_t __idx = 0;
- for (size_t __i = 0; __i < _M_array.size(); ++__i)
- if (_M_mask[__i]) _M_array[__i] -= __x[__idx++];
- }
-
- void operator^=(const valarray<value_type>& __x) const {
- size_t __idx = 0;
- for (size_t __i = 0; __i < _M_array.size(); ++__i)
- if (_M_mask[__i]) _M_array[__i] ^= __x[__idx++];
- }
-
- void operator&=(const valarray<value_type>& __x) const {
- size_t __idx = 0;
- for (size_t __i = 0; __i < _M_array.size(); ++__i)
- if (_M_mask[__i]) _M_array[__i] &= __x[__idx++];
- }
-
- void operator|=(const valarray<value_type>& __x) const {
- size_t __idx = 0;
- for (size_t __i = 0; __i < _M_array.size(); ++__i)
- if (_M_mask[__i]) _M_array[__i] |= __x[__idx++];
- }
-
- void operator<<=(const valarray<value_type>& __x) const {
- size_t __idx = 0;
- for (size_t __i = 0; __i < _M_array.size(); ++__i)
- if (_M_mask[__i]) _M_array[__i] <<= __x[__idx++];
- }
-
- void operator>>=(const valarray<value_type>& __x) const {
- size_t __idx = 0;
- for (size_t __i = 0; __i < _M_array.size(); ++__i)
- if (_M_mask[__i]) _M_array[__i] >>= __x[__idx++];
- }
-
- void operator=(const value_type& __c) const {
- for (size_t __i = 0; __i < _M_array.size(); ++__i)
- if (_M_mask[__i]) _M_array[__i] = __c;
- }
-
- ~mask_array() {}
-
- // Extension: number of true values in the mask
- size_t _M_num_true() const {
- size_t __result = 0;
- for (size_t __i = 0; __i < _M_mask.size(); ++__i)
- if (_M_mask[__i]) ++__result;
- return __result;
- }
-
-private:
- mask_array(const _Valarray_bool& __mask, valarray<_Tp>& __array)
- : _M_mask(__mask), _M_array(__array)
- {}
-
- _Valarray_bool _M_mask;
- valarray<_Tp>& _M_array;
-
-private: // Disable assignment
- void operator=(const mask_array<_Tp>&);
-};
-
-// valarray member functions dealing with mask_array
-
-template <class _Tp>
-inline valarray<_Tp>::valarray(const mask_array<_Tp>& __x)
- : _Valarray_base<_Tp>(__x._M_num_true())
-{
- typedef typename __type_traits<_Tp>::has_trivial_default_constructor
- _Is_Trivial;
- _M_initialize(_Is_Trivial());
- *this = __x;
-}
-
-// Behavior is undefined if __x._M_num_true() != this->size()
-template <class _Tp>
-inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<_Tp>& __x) {
- size_t __idx = 0;
- for (size_t __i = 0; __i < __x._M_array.size(); ++__i)
- if (__x._M_mask[__i]) (*this)[__idx++] = __x._M_array[__i];
- return *this;
-}
-
-template <class _Tp>
-inline mask_array<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask)
-{
- return mask_array<_Tp>(__mask, *this);
-}
-
-
-//----------------------------------------------------------------------
-// indirect_array
-
-template <class _Tp>
-class indirect_array {
- friend class valarray<_Tp>;
-public:
- typedef _Tp value_type;
-
- void operator=(const valarray<value_type>& __x) const {
- for (size_t __i = 0; __i < _M_addr.size(); ++__i)
- _M_array[_M_addr[__i]] = __x[__i];
- }
-
- void operator*=(const valarray<value_type>& __x) const {
- for (size_t __i = 0; __i < _M_addr.size(); ++__i)
- _M_array[_M_addr[__i]] *= __x[__i];
- }
-
- void operator/=(const valarray<value_type>& __x) const {
- for (size_t __i = 0; __i < _M_addr.size(); ++__i)
- _M_array[_M_addr[__i]] /= __x[__i];
- }
-
- void operator%=(const valarray<value_type>& __x) const {
- for (size_t __i = 0; __i < _M_addr.size(); ++__i)
- _M_array[_M_addr[__i]] %= __x[__i];
- }
-
- void operator+=(const valarray<value_type>& __x) const {
- for (size_t __i = 0; __i < _M_addr.size(); ++__i)
- _M_array[_M_addr[__i]] += __x[__i];
- }
-
- void operator-=(const valarray<value_type>& __x) const {
- for (size_t __i = 0; __i < _M_addr.size(); ++__i)
- _M_array[_M_addr[__i]] -= __x[__i];
- }
-
- void operator^=(const valarray<value_type>& __x) const {
- for (size_t __i = 0; __i < _M_addr.size(); ++__i)
- _M_array[_M_addr[__i]] ^= __x[__i];
- }
-
- void operator&=(const valarray<value_type>& __x) const {
- for (size_t __i = 0; __i < _M_addr.size(); ++__i)
- _M_array[_M_addr[__i]] &= __x[__i];
- }
-
- void operator|=(const valarray<value_type>& __x) const {
- for (size_t __i = 0; __i < _M_addr.size(); ++__i)
- _M_array[_M_addr[__i]] |= __x[__i];
- }
-
- void operator<<=(const valarray<value_type>& __x) const {
- for (size_t __i = 0; __i < _M_addr.size(); ++__i)
- _M_array[_M_addr[__i]] <<= __x[__i];
- }
-
- void operator>>=(const valarray<value_type>& __x) const {
- for (size_t __i = 0; __i < _M_addr.size(); ++__i)
- _M_array[_M_addr[__i]] >>= __x[__i];
- }
-
- void operator=(const value_type& __c) const {
- for (size_t __i = 0; __i < _M_addr.size(); ++__i)
- _M_array[_M_addr[__i]] = __c;
- }
-
- ~indirect_array() {}
-
-private:
- indirect_array(const _Valarray_size_t& __addr, valarray<_Tp>& __array)
- : _M_addr(__addr), _M_array(__array)
- {}
-
- _Valarray_size_t _M_addr;
- valarray<_Tp>& _M_array;
-
-private: // Disable assignment
- void operator=(const indirect_array<_Tp>&);
-};
-
-// valarray member functions dealing with indirect_array
-
-template <class _Tp>
-inline valarray<_Tp>::valarray(const indirect_array<_Tp>& __x)
- : _Valarray_base<_Tp>(__x._M_addr.size())
-{
- typedef typename __type_traits<_Tp>::has_trivial_default_constructor
- _Is_Trivial;
- _M_initialize(_Is_Trivial());
- *this = __x;
-}
-
-
-template <class _Tp>
-inline indirect_array<_Tp>
-valarray<_Tp>::operator[](const _Valarray_size_t& __addr)
-{
- return indirect_array<_Tp>(__addr, *this);
-}
-
-_STLP_END_NAMESPACE
-
-# if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_valarray.c>
-# endif
-
-#endif /* _STLP_VALARRAY */
-
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_vector.c b/stl/_vector.c
deleted file mode 100644
index c46a23e..0000000
--- a/stl/_vector.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_VECTOR_C
-#define _STLP_VECTOR_C
-
-#if !defined (_STLP_INTERNAL_VECTOR_H)
-# include <stl/_vector.h>
-#endif
-
-#include <stl/_range_errors.h>
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Tp, class _Alloc>
-void _Vector_base<_Tp,_Alloc>::_M_throw_length_error() const {
- __stl_throw_length_error("vector");
-}
-
-template <class _Tp, class _Alloc>
-void _Vector_base<_Tp, _Alloc>::_M_throw_out_of_range() const {
- __stl_throw_out_of_range("vector");
-}
-
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-# define vector _STLP_PTR_IMPL_NAME(vector)
-#elif defined (_STLP_DEBUG)
-# define vector _STLP_NON_DBG_NAME(vector)
-#else
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
-# define __iterator__ _Tp*
-#else
-# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE vector<_Tp, _Alloc>::iterator
-#endif
-
-template <class _Tp, class _Alloc>
-void vector<_Tp, _Alloc>::reserve(size_type __n) {
- if (capacity() < __n) {
- if (max_size() < __n) {
- this->_M_throw_length_error();
- }
-
- const size_type __old_size = size();
- pointer __tmp;
- if (this->_M_start) {
- __tmp = _M_allocate_and_copy(__n, this->_M_start, this->_M_finish);
- _M_clear();
- } else {
- __tmp = this->_M_end_of_storage.allocate(__n, __n);
- }
- _M_set(__tmp, __tmp + __old_size, __tmp + __n);
- }
-}
-
-template <class _Tp, class _Alloc>
-void vector<_Tp, _Alloc>::_M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*DO NOT USE!!*/,
- size_type __fill_len, bool __atend ) {
- const size_type __old_size = size();
- size_type __len = __old_size + (max)(__old_size, __fill_len);
-
- pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
- pointer __new_finish = __new_start;
- _STLP_TRY {
- __new_finish = _STLP_PRIV __uninitialized_move(this->_M_start, __pos, __new_start, _TrivialUCopy(), _Movable());
- // handle insertion
- if (__fill_len == 1) {
- _Copy_Construct(__new_finish, __x);
- ++__new_finish;
- } else
- __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __fill_len, __x);
- if (!__atend)
- __new_finish = _STLP_PRIV __uninitialized_move(__pos, this->_M_finish, __new_finish, _TrivialUCopy(), _Movable()); // copy remainder
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
- this->_M_end_of_storage.deallocate(__new_start,__len)))
- _M_clear_after_move();
- _M_set(__new_start, __new_finish, __new_start + __len);
-}
-
-template <class _Tp, class _Alloc>
-void vector<_Tp, _Alloc>::_M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/,
- size_type __fill_len, bool __atend ) {
- const size_type __old_size = size();
- size_type __len = __old_size + (max)(__old_size, __fill_len);
-
- pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
- pointer __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(this->_M_start, __pos, __new_start));
- // handle insertion
- __new_finish = _STLP_PRIV __fill_n(__new_finish, __fill_len, __x);
- if (!__atend)
- __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(__pos, this->_M_finish, __new_finish)); // copy remainder
- _M_clear();
- _M_set(__new_start, __new_finish, __new_start + __len);
-}
-
-template <class _Tp, class _Alloc>
-void vector<_Tp, _Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n,
- const _Tp& __x, const __true_type& /*_Movable*/) {
- if (_M_is_inside(__x)) {
- _Tp __x_copy = __x;
- _M_fill_insert_aux(__pos, __n, __x_copy, __true_type());
- return;
- }
- iterator __src = this->_M_finish - 1;
- iterator __dst = __src + __n;
- for (; __src >= __pos; --__dst, --__src) {
- _STLP_STD::_Move_Construct(__dst, *__src);
- _STLP_STD::_Destroy_Moved(__src);
- }
- _STLP_PRIV __uninitialized_fill_n(__pos, __n, __x);
- this->_M_finish += __n;
-}
-
-template <class _Tp, class _Alloc>
-void vector<_Tp, _Alloc>::_M_fill_insert_aux (iterator __pos, size_type __n,
- const _Tp& __x, const __false_type& /*_Movable*/) {
- //Here self referencing needs to be checked even for non movable types.
- if (_M_is_inside(__x)) {
- _Tp __x_copy = __x;
- _M_fill_insert_aux(__pos, __n, __x_copy, __false_type());
- return;
- }
- const size_type __elems_after = this->_M_finish - __pos;
- pointer __old_finish = this->_M_finish;
- if (__elems_after > __n) {
- _STLP_PRIV __ucopy_ptrs(this->_M_finish - __n, this->_M_finish, this->_M_finish, _TrivialUCopy());
- this->_M_finish += __n;
- _STLP_PRIV __copy_backward_ptrs(__pos, __old_finish - __n, __old_finish, _TrivialCopy());
- _STLP_STD::fill(__pos, __pos + __n, __x);
- } else {
- this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_finish, __n - __elems_after, __x);
- _STLP_PRIV __ucopy_ptrs(__pos, __old_finish, this->_M_finish, _TrivialUCopy());
- this->_M_finish += __elems_after;
- _STLP_STD::fill(__pos, __old_finish, __x);
- }
-}
-
-template <class _Tp, class _Alloc>
-void vector<_Tp, _Alloc>::_M_fill_insert(iterator __pos,
- size_type __n, const _Tp& __x) {
- if (__n != 0) {
- if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) {
- _M_fill_insert_aux(__pos, __n, __x, _Movable());
- } else
- _M_insert_overflow(__pos, __x, _TrivialCopy(), __n);
- }
-}
-
-template <class _Tp, class _Alloc>
-vector<_Tp, _Alloc>& vector<_Tp, _Alloc>::operator = (const vector<_Tp, _Alloc>& __x) {
- if (&__x != this) {
- const size_type __xlen = __x.size();
- if (__xlen > capacity()) {
- size_type __len = __xlen;
- pointer __tmp = _M_allocate_and_copy(__len, __CONST_CAST(const_pointer, __x._M_start) + 0,
- __CONST_CAST(const_pointer, __x._M_finish) + 0);
- _M_clear();
- this->_M_start = __tmp;
- this->_M_end_of_storage._M_data = this->_M_start + __len;
- } else if (size() >= __xlen) {
- pointer __i = _STLP_PRIV __copy_ptrs(__CONST_CAST(const_pointer, __x._M_start) + 0,
- __CONST_CAST(const_pointer, __x._M_finish) + 0, this->_M_start, _TrivialCopy());
- _STLP_STD::_Destroy_Range(__i, this->_M_finish);
- } else {
- _STLP_PRIV __copy_ptrs(__CONST_CAST(const_pointer, __x._M_start),
- __CONST_CAST(const_pointer, __x._M_start) + size(), this->_M_start, _TrivialCopy());
- _STLP_PRIV __ucopy_ptrs(__CONST_CAST(const_pointer, __x._M_start) + size(),
- __CONST_CAST(const_pointer, __x._M_finish) + 0, this->_M_finish, _TrivialUCopy());
- }
- this->_M_finish = this->_M_start + __xlen;
- }
- return *this;
-}
-
-template <class _Tp, class _Alloc>
-void vector<_Tp, _Alloc>::_M_fill_assign(size_t __n, const _Tp& __val) {
- if (__n > capacity()) {
- vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator());
- __tmp.swap(*this);
- } else if (__n > size()) {
- fill(begin(), end(), __val);
- this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_finish, __n - size(), __val);
- } else
- erase(_STLP_PRIV __fill_n(begin(), __n, __val), end());
-}
-
-template <class _Tp, class _Alloc>
-__iterator__
-vector<_Tp, _Alloc>::insert(iterator __pos, const _Tp& __x) {
- size_type __n = __pos - begin();
- _M_fill_insert(__pos, 1, __x);
- return begin() + __n;
-}
-
-#undef __iterator__
-
-#if defined (vector)
-# undef vector
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_VECTOR_C */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/_vector.h b/stl/_vector.h
deleted file mode 100644
index a24e347..0000000
--- a/stl/_vector.h
+++ /dev/null
@@ -1,735 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_VECTOR_H
-#define _STLP_INTERNAL_VECTOR_H
-
-#ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-# include <stl/_alloc.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ITERATOR_H
-# include <stl/_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_UNINITIALIZED_H
-# include <stl/_uninitialized.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-// The vector base class serves one purpose, its constructor and
-// destructor allocate (but don't initialize) storage. This makes
-// exception safety easier.
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Tp, class _Alloc>
-class _Vector_base {
-public:
- typedef _Vector_base<_Tp, _Alloc> _Self;
- _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
- typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type;
- typedef _Tp* pointer;
- typedef _STLP_alloc_proxy<pointer, _Tp, allocator_type> _AllocProxy;
-
- _Vector_base(const _Alloc& __a)
- : _M_start(0), _M_finish(0), _M_end_of_storage(__a, 0) {}
-
- _Vector_base(size_t __n, const _Alloc& __a)
- : _M_start(0), _M_finish(0), _M_end_of_storage(__a, 0) {
- _M_start = _M_end_of_storage.allocate(__n, __n);
- _M_finish = _M_start;
- _M_end_of_storage._M_data = _M_start + __n;
- _STLP_MPWFIX_TRY _STLP_MPWFIX_CATCH
- }
-
- _Vector_base(__move_source<_Self> src)
- : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
- _M_end_of_storage(__move_source<_AllocProxy>(src.get()._M_end_of_storage)) {
- //Set the source as empty:
- src.get()._M_finish = src.get()._M_end_of_storage._M_data = src.get()._M_start = 0;
- }
-
- ~_Vector_base() {
- if (_M_start != _STLP_DEFAULT_CONSTRUCTED(pointer))
- _M_end_of_storage.deallocate(_M_start, _M_end_of_storage._M_data - _M_start);
- }
-
-protected:
- void _STLP_FUNCTION_THROWS _M_throw_length_error() const;
- void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
-
- pointer _M_start;
- pointer _M_finish;
- _AllocProxy _M_end_of_storage;
-};
-
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-# define vector _STLP_PTR_IMPL_NAME(vector)
-#elif defined (_STLP_DEBUG)
-# define vector _STLP_NON_DBG_NAME(vector)
-#else
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
-class vector : protected _STLP_PRIV _Vector_base<_Tp, _Alloc>
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (vector)
- , public __stlport_class<vector<_Tp, _Alloc> >
-#endif
-{
-private:
- typedef _STLP_PRIV _Vector_base<_Tp, _Alloc> _Base;
- typedef vector<_Tp, _Alloc> _Self;
-public:
- _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
- typedef typename _Base::allocator_type allocator_type;
-
- typedef _Tp value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type* iterator;
- typedef const value_type* const_iterator;
-
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef random_access_iterator_tag _Iterator_category;
-
- _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
-
- allocator_type get_allocator() const
- { return _STLP_CONVERT_ALLOCATOR((const allocator_type&)this->_M_end_of_storage, _Tp); }
-
-private:
- typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
- typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
-#if !defined (_STLP_NO_MOVE_SEMANTIC)
- typedef typename __move_traits<_Tp>::implemented _Movable;
-#else
- typedef __false_type _Movable;
-#endif
-
- // handles insertions on overflow
- void _M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*_Movable*/,
- size_type __fill_len, bool __atend);
- void _M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __true_type& /*_Movable*/,
- size_type __fill_len, bool __atend) {
- //We need to take care of self referencing here:
- if (_M_is_inside(__x)) {
- value_type __x_copy = __x;
- _M_insert_overflow_aux(__pos, __x_copy, __false_type(), __fill_len, __atend);
- return;
- }
- _M_insert_overflow_aux(__pos, __x, __false_type(), __fill_len, __atend);
- }
-
- void _M_insert_overflow(pointer __pos, const _Tp& __x, const __false_type& /*_TrivialCopy*/,
- size_type __fill_len, bool __atend = false)
- { _M_insert_overflow_aux(__pos, __x, _Movable(), __fill_len, __atend); }
- void _M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/,
- size_type __fill_len, bool __atend = false);
- void _M_range_check(size_type __n) const {
- if (__n >= size_type(this->_M_finish - this->_M_start))
- this->_M_throw_out_of_range();
- }
-
-public:
- iterator begin() { return this->_M_start; }
- const_iterator begin() const { return this->_M_start; }
- iterator end() { return this->_M_finish; }
- const_iterator end() const { return this->_M_finish; }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
-
- size_type size() const { return size_type(this->_M_finish - this->_M_start); }
- size_type max_size() const {
- size_type __vector_max_size = size_type(-1) / sizeof(_Tp);
- typename allocator_type::size_type __alloc_max_size = this->_M_end_of_storage.max_size();
- return (__alloc_max_size < __vector_max_size)?__alloc_max_size:__vector_max_size;
- }
-
- size_type capacity() const { return size_type(this->_M_end_of_storage._M_data - this->_M_start); }
- bool empty() const { return this->_M_start == this->_M_finish; }
-
- reference operator[](size_type __n) { return *(begin() + __n); }
- const_reference operator[](size_type __n) const { return *(begin() + __n); }
-
- reference front() { return *begin(); }
- const_reference front() const { return *begin(); }
- reference back() { return *(end() - 1); }
- const_reference back() const { return *(end() - 1); }
-
- reference at(size_type __n) { _M_range_check(__n); return (*this)[__n]; }
- const_reference at(size_type __n) const { _M_range_check(__n); return (*this)[__n]; }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit vector(const allocator_type& __a = allocator_type())
-#else
- vector()
- : _STLP_PRIV _Vector_base<_Tp, _Alloc>(allocator_type()) {}
- vector(const allocator_type& __a)
-#endif
- : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__a) {}
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
-private:
- //We always call _M_initialize with only 1 parameter. Default parameter
- //is used to allow explicit instanciation of vector with types with no
- //default constructor.
- void _M_initialize(size_type __n, const _Tp& __val = _STLP_DEFAULT_CONSTRUCTED(_Tp))
- { this->_M_finish = _STLP_PRIV __uninitialized_init(this->_M_start, __n, __val); }
-public:
- explicit vector(size_type __n)
- : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type())
- { _M_initialize(__n); }
- vector(size_type __n, const _Tp& __val, const allocator_type& __a = allocator_type())
-#else
- explicit vector(size_type __n)
- : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type())
- { this->_M_finish = _STLP_PRIV __uninitialized_init(this->_M_start, __n, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
- vector(size_type __n, const _Tp& __val)
- : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type())
- { this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); }
- vector(size_type __n, const _Tp& __val, const allocator_type& __a)
-#endif
- : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, __a)
- { this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); }
-
- vector(const _Self& __x)
- : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__x.size(), __x.get_allocator())
- { this->_M_finish = _STLP_PRIV __ucopy_ptrs(__x.begin(), __x.end(), this->_M_start, _TrivialUCopy()); }
-
- vector(__move_source<_Self> src)
- : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__move_source<_Base>(src.get()))
- {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-private:
- template <class _Integer>
- void _M_initialize_aux(_Integer __n, _Integer __val,
- const __true_type& /*_IsIntegral*/) {
- size_type __real_n;
- this->_M_start = this->_M_end_of_storage.allocate(__n, __real_n);
- this->_M_end_of_storage._M_data = this->_M_start + __real_n;
- this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val);
- }
-
- template <class _InputIterator>
- void _M_initialize_aux(_InputIterator __first, _InputIterator __last,
- const __false_type& /*_IsIntegral*/)
- { _M_range_initialize(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); }
-
-public:
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- vector(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL )
- : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__a) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_initialize_aux(__first, __last, _Integral());
- }
-
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- vector(_InputIterator __first, _InputIterator __last)
- : _STLP_PRIV _Vector_base<_Tp, _Alloc>(allocator_type()) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_initialize_aux(__first, __last, _Integral());
- }
-# endif /* _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS */
-
-#else /* _STLP_MEMBER_TEMPLATES */
- vector(const _Tp* __first, const _Tp* __last,
- const allocator_type& __a = allocator_type())
- : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__last - __first, __a)
- { this->_M_finish = _STLP_PRIV __ucopy_ptrs(__first, __last, this->_M_start, _TrivialUCopy()); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- //As the vector container is a back insert oriented container it
- //seems rather logical to destroy elements in reverse order.
- ~vector() { _STLP_STD::_Destroy_Range(rbegin(), rend()); }
-
- _Self& operator=(const _Self& __x);
-
- void reserve(size_type __n);
-
- // assign(), a generalized assignment member function. Two
- // versions: one that takes a count, and one that takes a range.
- // The range version is a member template, so we dispatch on whether
- // or not the type is an integer.
-
- void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); }
- void _M_fill_assign(size_type __n, const _Tp& __val);
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _ForwardIter>
- void _M_assign_aux(_ForwardIter __first, _ForwardIter __last, const forward_iterator_tag &) {
-#else
- void assign(const_iterator __first, const_iterator __last) {
- typedef const_iterator _ForwardIter;
-#endif
- const size_type __len = distance(__first, __last);
- if (__len > capacity()) {
- size_type __n = __len;
- iterator __tmp = _M_allocate_and_copy(__n, __first, __last);
- _M_clear();
- _M_set(__tmp, __tmp + __len, __tmp + __n);
- }
- else if (size() >= __len) {
- iterator __new_finish = copy(__first, __last, this->_M_start);
- _STLP_STD::_Destroy_Range(__new_finish, this->_M_finish);
- this->_M_finish = __new_finish;
- }
- else {
- _ForwardIter __mid = __first;
- advance(__mid, size());
- copy(__first, __mid, this->_M_start);
- this->_M_finish = uninitialized_copy(__mid, __last, this->_M_finish);
- }
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIter>
- void _M_assign_aux(_InputIter __first, _InputIter __last,
- const input_iterator_tag &) {
- iterator __cur = begin();
- for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
- *__cur = *__first;
- if (__first == __last)
- erase(__cur, end());
- else
- insert(end(), __first, __last);
- }
-
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val,
- const __true_type& /*_IsIntegral*/)
- { _M_fill_assign(__n, __val); }
-
- template <class _InputIter>
- void _M_assign_dispatch(_InputIter __first, _InputIter __last,
- const __false_type& /*_IsIntegral*/)
- { _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
-
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_back(const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
-#else
- void push_back(const _Tp& __x) {
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- if (this->_M_finish != this->_M_end_of_storage._M_data) {
- _Copy_Construct(this->_M_finish, __x);
- ++this->_M_finish;
- }
- else
- _M_insert_overflow(this->_M_finish, __x, _TrivialCopy(), 1UL, true);
- }
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp));
-#else
- iterator insert(iterator __pos, const _Tp& __x);
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
- void push_back() { push_back(_STLP_DEFAULT_CONSTRUCTED(_Tp)); }
- iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
- void swap(_Self& __x) {
- _STLP_STD::swap(this->_M_start, __x._M_start);
- _STLP_STD::swap(this->_M_finish, __x._M_finish);
- this->_M_end_of_storage.swap(__x._M_end_of_storage);
- }
-
-private:
- void _M_fill_insert_aux (iterator __pos, size_type __n, const _Tp& __x, const __true_type& /*_Movable*/);
- void _M_fill_insert_aux (iterator __pos, size_type __n, const _Tp& __x, const __false_type& /*_Movable*/);
- void _M_fill_insert (iterator __pos, size_type __n, const _Tp& __x);
-
- bool _M_is_inside(const value_type& __x) const {
- return (&__x >= this->_M_start && &__x < this->_M_finish);
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _ForwardIterator>
- void _M_range_insert_realloc(iterator __pos,
- _ForwardIterator __first, _ForwardIterator __last,
-#else
- void _M_range_insert_realloc(iterator __pos,
- const_iterator __first, const_iterator __last,
-#endif /* _STLP_MEMBER_TEMPLATES */
- size_type __n) {
- const size_type __old_size = size();
- size_type __len = __old_size + (max)(__old_size, __n);
- pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
- pointer __new_finish = __new_start;
- _STLP_TRY {
- __new_finish = _STLP_PRIV __uninitialized_move(this->_M_start, __pos, __new_start, _TrivialUCopy(), _Movable());
- __new_finish = uninitialized_copy(__first, __last, __new_finish);
- __new_finish = _STLP_PRIV __uninitialized_move(__pos, this->_M_finish, __new_finish, _TrivialUCopy(), _Movable());
- }
- _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
- this->_M_end_of_storage.deallocate(__new_start,__len)))
- _M_clear_after_move();
- _M_set(__new_start, __new_finish, __new_start + __len);
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _ForwardIterator>
- void _M_range_insert_aux(iterator __pos,
- _ForwardIterator __first, _ForwardIterator __last,
-#else
- void _M_range_insert_aux(iterator __pos,
- const_iterator __first, const_iterator __last,
-#endif /* _STLP_MEMBER_TEMPLATES */
- size_type __n, const __true_type& /*_Movable*/) {
- iterator __src = this->_M_finish - 1;
- iterator __dst = __src + __n;
- for (; __src >= __pos; --__dst, --__src) {
- _STLP_STD::_Move_Construct(__dst, *__src);
- _STLP_STD::_Destroy_Moved(__src);
- }
- uninitialized_copy(__first, __last, __pos);
- this->_M_finish += __n;
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _ForwardIterator>
- void _M_range_insert_aux(iterator __pos,
- _ForwardIterator __first, _ForwardIterator __last,
-#else
- void _M_range_insert_aux(iterator __pos,
- const_iterator __first, const_iterator __last,
-#endif /* _STLP_MEMBER_TEMPLATES */
- size_type __n, const __false_type& /*_Movable*/) {
- const size_type __elems_after = this->_M_finish - __pos;
- pointer __old_finish = this->_M_finish;
- if (__elems_after > __n) {
- _STLP_PRIV __ucopy_ptrs(this->_M_finish - __n, this->_M_finish, this->_M_finish, _TrivialUCopy());
- this->_M_finish += __n;
- _STLP_PRIV __copy_backward_ptrs(__pos, __old_finish - __n, __old_finish, _TrivialCopy());
- copy(__first, __last, __pos);
- }
- else {
-#if defined ( _STLP_MEMBER_TEMPLATES )
- _ForwardIterator __mid = __first;
- advance(__mid, __elems_after);
-#else
- const_pointer __mid = __first + __elems_after;
-#endif
- uninitialized_copy(__mid, __last, this->_M_finish);
- this->_M_finish += __n - __elems_after;
- _STLP_PRIV __ucopy_ptrs(__pos, __old_finish, this->_M_finish, _TrivialUCopy());
- this->_M_finish += __elems_after;
- copy(__first, __mid, __pos);
- } /* elems_after */
- }
-
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _Integer>
- void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
- const __true_type&)
- { _M_fill_insert(__pos, (size_type) __n, (_Tp) __val); }
-
- template <class _InputIterator>
- void _M_insert_dispatch(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- const __false_type&)
- { _M_range_insert(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); }
-
-public:
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_insert_dispatch(__pos, __first, __last, _Integral());
- }
-
-private:
- template <class _InputIterator>
- void _M_range_insert(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- const input_iterator_tag &) {
- for ( ; __first != __last; ++__first) {
- __pos = insert(__pos, *__first);
- ++__pos;
- }
- }
-
- template <class _ForwardIterator>
- void _M_range_insert(iterator __pos,
- _ForwardIterator __first, _ForwardIterator __last,
- const forward_iterator_tag &) {
-#else /* _STLP_MEMBER_TEMPLATES */
-public:
- void insert(iterator __pos,
- const_iterator __first, const_iterator __last) {
-#endif /* _STLP_MEMBER_TEMPLATES */
- /* This method do not check self referencing.
- * Standard forbids it, checked by the debug mode.
- */
- if (__first != __last) {
- size_type __n = distance(__first, __last);
-
- if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) {
- _M_range_insert_aux(__pos, __first, __last, __n, _Movable());
- }
- else {
- _M_range_insert_realloc(__pos, __first, __last, __n);
- }
- }
- }
-
-public:
- void insert (iterator __pos, size_type __n, const _Tp& __x)
- { _M_fill_insert(__pos, __n, __x); }
-
- void pop_back() {
- --this->_M_finish;
- _STLP_STD::_Destroy(this->_M_finish);
- }
-
-private:
- iterator _M_erase(iterator __pos, const __true_type& /*_Movable*/) {
- _STLP_STD::_Destroy(__pos);
- iterator __dst = __pos, __src = __dst + 1;
- iterator __end = end();
- for (; __src != __end; ++__dst, ++__src) {
- _STLP_STD::_Move_Construct(__dst, *__src);
- _STLP_STD::_Destroy_Moved(__src);
- }
- this->_M_finish = __dst;
- return __pos;
- }
- iterator _M_erase(iterator __pos, const __false_type& /*_Movable*/) {
- if (__pos + 1 != end())
- _STLP_PRIV __copy_ptrs(__pos + 1, this->_M_finish, __pos, _TrivialCopy());
- --this->_M_finish;
- _STLP_STD::_Destroy(this->_M_finish);
- return __pos;
- }
- iterator _M_erase(iterator __first, iterator __last, const __true_type& /*_Movable*/) {
- iterator __dst = __first, __src = __last;
- iterator __end = end();
- for (; __dst != __last && __src != __end; ++__dst, ++__src) {
- _STLP_STD::_Destroy(__dst);
- _STLP_STD::_Move_Construct(__dst, *__src);
- }
- if (__dst != __last) {
- //There is more elements to erase than element to move:
- _STLP_STD::_Destroy_Range(__dst, __last);
- _STLP_STD::_Destroy_Moved_Range(__last, __end);
- }
- else {
- //There is more element to move than element to erase:
- for (; __src != __end; ++__dst, ++__src) {
- _STLP_STD::_Destroy_Moved(__dst);
- _STLP_STD::_Move_Construct(__dst, *__src);
- }
- _STLP_STD::_Destroy_Moved_Range(__dst, __end);
- }
- this->_M_finish = __dst;
- return __first;
- }
- iterator _M_erase(iterator __first, iterator __last, const __false_type& /*_Movable*/) {
- pointer __i = _STLP_PRIV __copy_ptrs(__last, this->_M_finish, __first, _TrivialCopy());
- _STLP_STD::_Destroy_Range(__i, this->_M_finish);
- this->_M_finish = __i;
- return __first;
- }
-
-public:
- iterator erase(iterator __pos) {
- return _M_erase(__pos, _Movable());
- }
- iterator erase(iterator __first, iterator __last) {
- if (__first == __last)
- return __first;
- return _M_erase(__first, __last, _Movable());
- }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
-#else
- void resize(size_type __new_size, const _Tp& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- if (__new_size < size())
- erase(begin() + __new_size, end());
- else
- insert(end(), __new_size - size(), __x);
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- void clear() {
- erase(begin(), end());
- }
-
-private:
- void _M_clear() {
- _STLP_STD::_Destroy_Range(rbegin(), rend());
- this->_M_end_of_storage.deallocate(this->_M_start, this->_M_end_of_storage._M_data - this->_M_start);
- }
-
- void _M_clear_after_move() {
- _STLP_STD::_Destroy_Moved_Range(rbegin(), rend());
- this->_M_end_of_storage.deallocate(this->_M_start, this->_M_end_of_storage._M_data - this->_M_start);
- }
-
- void _M_set(pointer __s, pointer __f, pointer __e) {
- this->_M_start = __s;
- this->_M_finish = __f;
- this->_M_end_of_storage._M_data = __e;
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _ForwardIterator>
- pointer _M_allocate_and_copy(size_type& __n,
- _ForwardIterator __first, _ForwardIterator __last)
-#else /* _STLP_MEMBER_TEMPLATES */
- pointer _M_allocate_and_copy(size_type& __n,
- const_pointer __first, const_pointer __last)
-#endif /* _STLP_MEMBER_TEMPLATES */
- {
- pointer __result = this->_M_end_of_storage.allocate(__n, __n);
- _STLP_TRY {
- uninitialized_copy(__first, __last, __result);
- return __result;
- }
- _STLP_UNWIND(this->_M_end_of_storage.deallocate(__result, __n))
- _STLP_RET_AFTER_THROW(__result)
- }
-
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void _M_range_initialize(_InputIterator __first, _InputIterator __last,
- const input_iterator_tag &) {
- for ( ; __first != __last; ++__first)
- push_back(*__first);
- }
- // This function is only called by the constructor.
- template <class _ForwardIterator>
- void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
- const forward_iterator_tag &) {
- size_type __n = distance(__first, __last);
- this->_M_start = this->_M_end_of_storage.allocate(__n, __n);
- this->_M_end_of_storage._M_data = this->_M_start + __n;
- this->_M_finish = uninitialized_copy(__first, __last, this->_M_start);
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-};
-
-#if defined (vector)
-# undef vector
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-_STLP_END_NAMESPACE
-
-#if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/_vector.c>
-#endif
-
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-# include <stl/pointers/_vector.h>
-#endif
-
-//We define the bool specialization before the debug interfave
-//to benefit of the debug version of vector even for the bool
-//specialization.
-#if !defined (_STLP_NO_BOOL) || !defined (_STLP_NO_EXTENSIONS)
-# if !defined (_STLP_INTERNAL_BVECTOR_H)
-# include <stl/_bvector.h>
-# endif
-#endif
-
-#if defined (_STLP_DEBUG)
-# include <stl/debug/_vector.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#if !defined (_STLP_NO_BOOL) && !defined (_STLP_NO_EXTENSIONS)
-// This typedef is non-standard. It is provided for backward compatibility.
-typedef vector<bool, allocator<bool> > bit_vector;
-#endif
-
-#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
-#define _STLP_TEMPLATE_CONTAINER vector<_Tp, _Alloc>
-#include <stl/_relops_cont.h>
-#undef _STLP_TEMPLATE_CONTAINER
-#undef _STLP_TEMPLATE_HEADER
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp, class _Alloc>
-struct __move_traits<vector<_Tp, _Alloc> > {
- typedef __stlp_movable implemented;
- typedef typename __move_traits<_Alloc>::complete complete;
-#if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
- // disable incorrect "dependent type qualifier" error
- typedef __false_type _Ret;
-#endif
-};
-
-# if !defined (_STLP_DEBUG)
-template <class _Tp, class _Alloc>
-struct _DefaultZeroValue<vector<_Tp, _Alloc> >
-{ typedef typename __type_traits<_Alloc>::has_trivial_default_constructor _Ret; };
-# endif
-
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_VECTOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/boost_type_traits.h b/stl/boost_type_traits.h
deleted file mode 100644
index e41cc41..0000000
--- a/stl/boost_type_traits.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- *
- * Copyright (c) 2004
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_BOOST_TYPE_TRAITS_H
-#define _STLP_BOOST_TYPE_TRAITS_H
-
-#include <boost/type_traits/is_integral.hpp>
-#include <boost/type_traits/is_float.hpp>
-#include <boost/type_traits/has_trivial_constructor.hpp>
-#include <boost/type_traits/has_trivial_copy.hpp>
-#include <boost/type_traits/has_trivial_assign.hpp>
-#include <boost/type_traits/has_trivial_destructor.hpp>
-#include <boost/type_traits/is_pod.hpp>
-#include <boost/type_traits/is_pointer.hpp>
-#include <boost/type_traits/is_reference.hpp>
-#include <boost/type_traits/remove_cv.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-/*
- * This file mostly wraps boost type_traits in the STLport type_traits.
- * When checking a type traits like trivial assign operator for instance
- * both the boost value and STLport values has to be taken into account
- * as we don't know what the user might have prefer, specializing the boost
- * type traits or the STLport one.
- */
-_STLP_BEGIN_NAMESPACE
-
-template <class _Tp> struct _IsRef {
- enum { _Is = ::boost::is_reference<_Tp>::value };
- typedef typename __bool2type<_Is>::_Ret _Ret;
-};
-
-template <class _Tp> struct _IsPtr {
- enum { is_pointer = ::boost::is_pointer<_Tp>::value };
- typedef typename __bool2type<is_pointer>::_Ret _Ret;
-};
-
-template <class _Tp> struct _IsIntegral {
- enum { is_integral = ::boost::is_integral<_Tp>::value };
- typedef typename __bool2type<is_integral>::_Ret _Ret;
-};
-
-template <class _Tp> struct _IsRational {
- enum { is_float = ::boost::is_float<_Tp>::value };
- typedef typename __bool2type<is_float>::_Ret _Ret;
-};
-
-template <class _Tp>
-struct __type_traits {
- enum { trivial_constructor = ::boost::has_trivial_constructor<_Tp>::value };
- typedef typename __bool2type<trivial_constructor>::_Ret has_trivial_default_constructor;
-
- enum { trivial_copy = ::boost::has_trivial_copy<_Tp>::value };
- typedef typename __bool2type<trivial_copy>::_Ret has_trivial_copy_constructor;
-
- enum { trivial_assign = ::boost::has_trivial_assign<_Tp>::value };
- typedef typename __bool2type<trivial_assign>::_Ret has_trivial_assignment_operator;
-
- enum { trivial_destructor = ::boost::has_trivial_destructor<_Tp>::value };
- typedef typename __bool2type<trivial_destructor>::_Ret has_trivial_destructor;
-
- enum { pod = ::boost::is_pod<_Tp>::value };
- typedef typename __bool2type<pod>::_Ret is_POD_type;
-};
-
-template <class _Tp1, class _Tp2>
-struct _TrivialCopy {
- typedef typename ::boost::remove_cv<_Tp1>::type uncv1;
- typedef typename ::boost::remove_cv<_Tp2>::type uncv2;
-
- enum { same = ::boost::is_same<uncv1, uncv2>::value };
- typedef typename __bool2type<same>::_Ret _Same;
-
- enum { boost_trivial_assign = ::boost::has_trivial_assign<uncv1>::value };
- typedef typename __bool2type<boost_trivial_assign>::_Ret _BoostTrivialAssign;
- typedef typename __type_traits<uncv1>::has_trivial_assignment_operator _STLPTrivialAssign;
- typedef typename _Lor2<_BoostTrivialAssign, _STLPTrivialAssign>::_Ret _TrivialAssign;
-
- typedef typename _Land2<_Same, _TrivialAssign>::_Ret _Type;
- static _Type _Answer() { return _Type(); }
-};
-
-template <class _Tp1, class _Tp2>
-struct _TrivialUCopy {
- typedef typename ::boost::remove_cv<_Tp1>::type uncv1;
- typedef typename ::boost::remove_cv<_Tp2>::type uncv2;
-
- enum { same = ::boost::is_same<uncv1, uncv2>::value };
- typedef typename __bool2type<same>::_Ret _Same;
-
- enum { boost_trivial_copy = ::boost::has_trivial_copy<uncv1>::value };
- typedef typename __bool2type<boost_trivial_copy>::_Ret _BoostTrivialCopy;
- typedef typename __type_traits<uncv1>::has_trivial_copy_constructor _STLPTrivialCopy;
- typedef typename _Lor2<_BoostTrivialCopy, _STLPTrivialCopy>::_Ret _TrivialCopy;
-
- typedef typename _Land2<_Same, _TrivialCopy>::_Ret _Type;
- static _Type _Answer() { return _Type(); }
-};
-
-template <class _Tp>
-struct _DefaultZeroValue {
- enum { is_integral = ::boost::is_integral<_Tp>::value };
- typedef typename __bool2type<is_integral>::_Ret _IsIntegral;
- enum { is_float = ::boost::is_float<_Tp>::value };
- typedef typename __bool2type<is_float>::_Ret _IsFloat;
- enum { is_pointer = ::boost::is_pointer<_Tp>::value };
- typedef typename __bool2type<is_pointer>::_Ret _IsPointer;
-
- typedef typename _Lor3<_IsIntegral, _IsFloat, _IsPointer>::_Ret _Ret;
-};
-
-template <class _Tp>
-struct _TrivialInit {
- typedef typename ::boost::remove_cv<_Tp>::type uncv;
-
- enum { boost_trivial_constructor = ::boost::has_trivial_constructor<uncv>::value };
- typedef typename __bool2type<boost_trivial_constructor>::_Ret _BoostTrivialInit;
- typedef typename __type_traits<uncv>::has_trivial_default_constructor _STLPTrivialInit;
- typedef typename _Lor2<_BoostTrivialInit, _STLPTrivialInit>::_Ret _Tr1;
-
- typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2;
- typedef typename _Not<_Tr2>::_Ret _Tr3;
-
- typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret;
- static _Ret _Answer() { return _Ret(); }
-};
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_BOOST_TYPE_TRAITS_H */
diff --git a/stl/c_locale.h b/stl/c_locale.h
deleted file mode 100644
index 8d50bb6..0000000
--- a/stl/c_locale.h
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-
-#ifndef _STLP_C_LOCALE_H
-#define _STLP_C_LOCALE_H
-
-/*
- * Implementation dependent definitions.
- * Beware: This header is not a purely internal header, it is also included
- * from the outside world when building the STLport library. So this header
- * should not reference internal headers (stlport/stl/_*.h) directly.
- */
-#if defined (__sgi)
-# if defined (ROOT_65) /* IRIX 6.5.x */
-# include <sgidefs.h>
-# include <standards.h>
-# include <wchar.h>
-# include <ctype.h>
-# else /* IRIX pre-6.5 */
-# include <sgidefs.h>
-# include <standards.h>
-# if !defined(_SIZE_T) && !defined(_SIZE_T_)
-# define _SIZE_T
-# if (_MIPS_SZLONG == 32)
-typedef unsigned int size_t;
-# endif
-# if (_MIPS_SZLONG == 64)
-typedef unsigned long size_t;
-# endif
-# endif
-# if !defined (_WCHAR_T)
-# define _WCHAR_T
-# if (_MIPS_SZLONG == 32)
-typedef long wchar_t;
-# endif
-# if (_MIPS_SZLONG == 64)
-typedef __int32_t wchar_t;
-# endif
-# endif /* _WCHAR_T */
-# if !defined (_WINT_T)
-# define _WINT_T
-# if (_MIPS_SZLONG == 32)
-typedef long wint_t;
-# endif
-# if (_MIPS_SZLONG == 64)
-typedef __int32_t wint_t;
-# endif
-# endif /* _WINT_T */
-# if !defined (_MBSTATE_T)
-# define _MBSTATE_T
-/* _MSC_VER check is here for historical reason and seems wrong as it is the macro defined
- * by Microsoft compilers to give their version and we are currently in a SGI platform scope.
- * However _MSC_VER might also be a SGI compiler macro so we keep it this way.*/
-# if defined (_MSC_VER)
-typedef int mbstate_t;
-# else
-typedef char mbstate_t;
-# endif
-# endif /* _MBSTATE_T */
-# endif /* ROOT65 */
-#else /* __sgi */
-# include <stddef.h>
-# if !defined (ANDROID)
-/* The Android wchar.h header is broken, and tries to redefine wchar_t. */
-# include <wchar.h>
-# endif
-# include <ctype.h>
-#endif /* __sgi */
-
-/*
- * GENERAL FRAMEWORK
- */
-
-/*
- * Opaque types, implementation (if there is one) depends
- * on platform locale API.
- */
-struct _Locale_ctype;
-struct _Locale_numeric;
-struct _Locale_time;
-struct _Locale_collate;
-struct _Locale_monetary;
-struct _Locale_messages;
-struct _Locale_name_hint;
-
-/*
- Bitmask macros.
-*/
-
-/*
- * For narrow characters, we expose the lookup table interface.
- */
-
-/* Internal bitmask macros, os-specific. */
-
-#if defined (__sgi) /* IRIX */
-
-# define _Locale_S 0x00000008 /* Spacing character */
-# define _Locale_A 0x00004000 /* Alphabetical characters only */
-# define _Locale_B 0x00000040 /* Obsolete: was space char only */
-# define _Locale_PR 0x00008000 /* Printable characters only */
-# define _Locale_G 0x40000000 /* Graphic characters only */
-# define _Locale_BL 0x80000000 /* The blank character class */
-
-/* Public bitmask macros, must be defined for every OS. These values, of
- * course, are specific to IRIX. */
-
-# define _Locale_CNTRL 0x00000020 /* Control character */
-# define _Locale_UPPER 0x00000001 /* Upper case */
-# define _Locale_LOWER 0x00000002 /* Lower case */
-# define _Locale_DIGIT 0x00000004 /* Numeral (digit) */
-# define _Locale_XDIGIT 0x00000080 /* heXadecimal digit */
-# define _Locale_PUNCT 0x00000010 /* Punctuation */
-# define _Locale_SPACE (_Locale_S | _Locale_BL)
-# define _Locale_PRINT (_Locale_PUNCT | _Locale_UPPER | _Locale_LOWER | \
- _Locale_DIGIT | _Locale_A | _Locale_XDIGIT | \
- _Locale_PR)
-# define _Locale_ALPHA _Locale_A
-
-/*
-* All of these except for graph and blank are from the C standard;
-* graph and blank are XPG4. (graph in XPG4 doesn't mean quite the
-* same thing as graph in the C++ library)
-*/
-
-#endif /* IRIX */
-
-
-#if defined (__Lynx__)
- /* azov: On Lynx isalpha defined as (_U | _L), which gives us a mask
- * unusable in ctype_table. So we have to redefine it and use hard-coded
- * numbers (to avoid potential clashes if system headers change).
- *
- * P.S. Actually, I see no reason in using platform-specific masks -
- * having just one set of masks for all platforms should work just as
- * well - we only use them internally and they don't have to be equal
- * to whatever defined in local ctype.h
- *
- */
-# define _Locale_CNTRL 040 /* _C, Control character */
-# define _Locale_UPPER 01 /* _U, Upper case */
-# define _Locale_LOWER 02 /* _L, Lower case */
-# define _Locale_DIGIT 04 /* _N, Numeral (digit) */
-# define _Locale_XDIGIT 0200 /* _X, heXadecimal digit */
-# define _Locale_PUNCT 020 /* _P, Punctuation */
-# define _Locale_SPACE 010 /* _S, Spacing */
-# define _Locale_ALPHA 040000 /* none, Alphanumerical */
-# define _Locale_PRINT (_Locale_PUNCT | _Locale_UPPER | _Locale_LOWER | \
- _Locale_DIGIT | _Locale_ALPHA | _Locale_XDIGIT |\
- _Locale_SPACE ) /* Printable */
-#endif /* __Lynx__ */
-
-#if defined (__GNUC__) || defined (__BORLANDC__) || defined (__COMO__)
-
-# if defined (__CYGWIN__)
-
-# define _Locale_CNTRL 040
-# define _Locale_UPPER 02
-# define _Locale_LOWER 01
-# define _Locale_DIGIT 04
-# define _Locale_XDIGIT ( 0100 | _Locale_DIGIT )
-# define _Locale_PUNCT 020
-# define _Locale_SPACE 010
-# define _Locale_ALPHA 0200
-# define _Locale_PRINT (_Locale_ALPHA | _Locale_DIGIT | _Locale_PUNCT | 0400 )
-
-# elif defined (__FreeBSD__) || ( defined (__APPLE__) && defined (__GNUC__) && (__GNUC__ > 3) )
-
-# define _Locale_CNTRL _CTYPE_C
-# define _Locale_UPPER _CTYPE_U
-# define _Locale_LOWER _CTYPE_L
-# define _Locale_DIGIT _CTYPE_D
-# define _Locale_XDIGIT _CTYPE_X
-# define _Locale_PUNCT _CTYPE_P
-# define _Locale_SPACE _CTYPE_S
-# define _Locale_PRINT _CTYPE_R
-# define _Locale_ALPHA _CTYPE_A
-
-# elif defined (__NetBSD__) || defined (__OpenBSD__) || defined (__amigaos__) || defined(ANDROID)
-
-# define _Locale_CNTRL _C
-# define _Locale_UPPER _U
-# define _Locale_LOWER _L
-# define _Locale_DIGIT _N
-# define _Locale_XDIGIT (_N|_X)
-# define _Locale_PUNCT _P
-# define _Locale_SPACE _S
-# define _Locale_PRINT (_P|_U|_L|_N|_B)
-# define _Locale_ALPHA (_U|_L)
-# elif defined (__EMX__) /* OS/2 with emx runtime */
-# define _Locale_CNTRL _CNTRL
-# define _Locale_UPPER _UPPER
-# define _Locale_LOWER _LOWER
-# define _Locale_DIGIT _DIGIT
-# define _Locale_XDIGIT _XDIGIT
-# define _Locale_PUNCT _PUNCT
-# define _Locale_SPACE _SPACE
-# define _Locale_PRINT _PRINT
-# define _Locale_ALPHA (_UPPER|_LOWER)
-
-# elif defined (_STLP_USE_GLIBC) /* linux, using the gnu compiler */
-
-/* This section uses macros defined in the gnu libc ctype.h header */
-
-# define _Locale_CNTRL _IScntrl
-# define _Locale_UPPER _ISupper
-# define _Locale_LOWER _ISlower
-# define _Locale_DIGIT _ISdigit
-# define _Locale_XDIGIT _ISxdigit
-# define _Locale_PUNCT _ISpunct
-# define _Locale_SPACE _ISspace
-# define _Locale_PRINT _ISprint
-# define _Locale_ALPHA _ISalpha
-
-# endif /* GLIBC */
-
-#endif /* gnu */
-
-#if (defined (__sun) && defined (__SVR4)) || \
- (defined (__digital__) && defined (__unix__)) || \
- defined (_AIX)
-/* fbp : condition from AT&T code*/
-# if !(defined (__XPG4_CHAR_CLASS__) || defined (_XPG4_2) || \
- (defined (_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4))) && ! defined (_ISCNTRL)
- /* fbp : on 2.5.1, the defines are different ;( */
- /* # if ( defined (__sun) && defined (__SVR4) && ! defined (_ISCNTRL) ) */
-# define _ISCNTRL _C
-# define _ISUPPER _U
-# define _ISLOWER _L
-# define _ISDIGIT _N
-# define _ISXDIGIT _X
-# define _ISPUNCT _P
-# define _ISSPACE _S
-# define _ISPRINT (_P | _U | _L | _N | _B)
-# define _ISALPHA (_U | _L)
-# endif
-
-# define _Locale_CNTRL _ISCNTRL
-# define _Locale_UPPER _ISUPPER
-# define _Locale_LOWER _ISLOWER
-# define _Locale_DIGIT _ISDIGIT
-# define _Locale_XDIGIT _ISXDIGIT
-# define _Locale_PUNCT _ISPUNCT
-# define _Locale_SPACE _ISSPACE
-# define _Locale_PRINT _ISPRINT
-# define _Locale_ALPHA _ISALPHA
-#elif defined (__MWERKS__) && defined (N_PLAT_NLM)
-# define _Locale_CNTRL _CNTRL_
-# define _Locale_UPPER _UPPER_
-# define _Locale_LOWER _LOWER_
-# define _Locale_DIGIT _DIGIT_
-# define _Locale_XDIGIT _XDIGIT_
-# define _Locale_PUNCT _PUNCT_
-# define _Locale_SPACE _SPACE_
-# define _Locale_PRINT (_PUNCT_|_UPPER_|_LOWER_|_DIGIT_|_BLANK_)
-# define _Locale_ALPHA (_UPPER_|_LOWER_)
-#elif defined (__MWERKS__)
-# define _Locale_CNTRL __control_char
-# define _Locale_UPPER __upper_case
-# define _Locale_LOWER __lower_case
-# define _Locale_DIGIT __digit
-# define _Locale_XDIGIT __hex_digit
-# define _Locale_PUNCT __punctuation
-# define _Locale_SPACE __space_char
-# define _Locale_PRINT __printable
-# define _Locale_ALPHA __alphanumeric
-#elif defined (__BORLANDC__)
-# define _Locale_CNTRL _IS_CTL
-# define _Locale_UPPER _IS_UPP
-# define _Locale_LOWER _IS_LOW
-# define _Locale_DIGIT _IS_DIG
-# define _Locale_XDIGIT _IS_HEX
-# define _Locale_PUNCT _IS_PUN
-# define _Locale_SPACE _IS_SP
-# define _Locale_PRINT (_IS_SP|_IS_PUN|_IS_UPP|_IS_LOW|_IS_DIG)
-# define _Locale_ALPHA _IS_ALPHA
-#elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__)
-# define _Locale_CNTRL _CONTROL
-# define _Locale_UPPER _UPPER
-# define _Locale_LOWER _LOWER
-# define _Locale_DIGIT _DIGIT
-# define _Locale_XDIGIT _HEX
-# define _Locale_PUNCT _PUNCT
-# define _Locale_SPACE _SPACE
-# define _Locale_PRINT (_ALPHA | _DIGIT | _BLANK | _PUNCT)
-# define _Locale_ALPHA ( _ALPHA & ~ (_UPPER | _LOWER ))
-#elif defined (__DMC__)
-# define _Locale_CNTRL _CONTROL
-# define _Locale_UPPER _UPPER
-# define _Locale_LOWER _LOWER
-# define _Locale_DIGIT _DIGIT
-# define _Locale_XDIGIT _HEX
-# define _Locale_PUNCT _PUNCT
-# define _Locale_SPACE _SPACE
-# define _Locale_PRINT (_UPPER | _LOWER | _DIGIT | _PUNCT | _SPACE)
-# define _Locale_ALPHA _ALPHA & ~(_UPPER | _LOWER)
-#elif defined (__MRC__) || defined (__SC__) /* *TY 02/24/2000 - added support for MPW */
-# define _Locale_CNTRL _CTL
-# define _Locale_UPPER _UPP
-# define _Locale_LOWER _LOW
-# define _Locale_DIGIT _DIG
-# define _Locale_XDIGIT _HEX
-# define _Locale_PUNCT _PUN
-# define _Locale_SPACE _BLA
-# define _Locale_PRINT (_UPP | _LOW | _DIG | _PUN | _BLA)
-# define _Locale_ALPHA (_UPP | _LOW)
-#elif defined (__MLCCPP__)
-# define _Locale_CNTRL 1
-# define _Locale_UPPER 2
-# define _Locale_LOWER 4
-# define _Locale_DIGIT 8
-# define _Locale_XDIGIT 16
-# define _Locale_PUNCT 32
-# define _Locale_SPACE 64
-# define _Locale_PRINT 128
-# define _Locale_ALPHA 256
-#elif defined (__GNUC__) && (__GNUC__ == 3) && defined (__APPLE__)
-# define _Locale_CNTRL _C
-# define _Locale_UPPER _U
-# define _Locale_LOWER _L
-# define _Locale_DIGIT _D
-# define _Locale_XDIGIT _X
-# define _Locale_PUNCT _P
-# define _Locale_SPACE _S
-# define _Locale_PRINT _R
-# define _Locale_ALPHA _A
-#elif defined (__hpux) || defined (__osf__)
-# if defined (__HP_aCC) && !defined (_INCLUDE_HPUX_SOURCE)
-# define _ISALPHA 0x001
-# define _ISALNUM 0x002
-# define _ISBLANK 0x004
-# define _ISCNTRL 0x008
-# define _ISDIGIT 0x010
-# define _ISGRAPH 0x020
-# define _ISLOWER 0x040
-# define _ISPRINT 0x080
-# define _ISPUNCT 0x100
-# define _ISSPACE 0x200
-# define _ISUPPER 0x400
-# define _ISXDIGIT 0x800
-# endif
-# define _Locale_CNTRL _ISCNTRL
-# define _Locale_UPPER _ISUPPER
-# define _Locale_LOWER _ISLOWER
-# define _Locale_DIGIT _ISDIGIT
-# define _Locale_XDIGIT _ISXDIGIT
-# define _Locale_PUNCT _ISPUNCT
-# define _Locale_SPACE _ISSPACE
-# define _Locale_PRINT _ISPRINT
-# define _Locale_ALPHA _ISALPHA
-#elif defined (__MVS__) || defined (__OS400__)
-# define _Locale_CNTRL __ISCNTRL
-# define _Locale_UPPER __ISUPPER
-# define _Locale_LOWER __ISLOWER
-# define _Locale_DIGIT __ISDIGIT
-# define _Locale_XDIGIT __ISXDIGIT
-# define _Locale_PUNCT __ISPUNCT
-# define _Locale_SPACE __ISSPACE
-# define _Locale_PRINT __ISPRINT
-# define _Locale_ALPHA __ISALPHA
-#elif defined (__QNXNTO__) || defined (__WATCOMC__)
-# define _Locale_CNTRL _CNTRL
-# define _Locale_UPPER _UPPER
-# define _Locale_LOWER _LOWER
-# define _Locale_DIGIT _DIGIT
-# define _Locale_XDIGIT _XDIGT
-# define _Locale_PUNCT _PUNCT
-# define _Locale_SPACE _SPACE
-# define _Locale_PRINT _PRINT
-# define _Locale_ALPHA (_UPPER | _LOWER)
-#elif defined (__DJGPP)
-# define _Locale_CNTRL __dj_ISCNTRL
-# define _Locale_UPPER __dj_ISUPPER
-# define _Locale_LOWER __dj_ISLOWER
-# define _Locale_DIGIT __dj_ISDIGIT
-# define _Locale_XDIGIT __dj_ISXDIGIT
-# define _Locale_PUNCT __dj_ISPUNCT
-# define _Locale_SPACE __dj_ISSPACE
-# define _Locale_PRINT __dj_ISPRINT
-# define _Locale_ALPHA __dj_ISALPHA
-#elif defined (_STLP_SCO_OPENSERVER)
-# define _Locale_CNTRL _C
-# define _Locale_UPPER _U
-# define _Locale_LOWER _L
-# define _Locale_DIGIT _N
-# define _Locale_XDIGIT _X
-# define _Locale_PUNCT _P
-# define _Locale_SPACE _S
-# define _Locale_PRINT _R
-# define _Locale_ALPHA _A
-#elif defined (__NCR_SVR)
-# define _Locale_CNTRL _C
-# define _Locale_UPPER _U
-# define _Locale_LOWER _L
-# define _Locale_DIGIT _N
-# define _Locale_XDIGIT _X
-# define _Locale_PUNCT _P
-# define _Locale_SPACE _S
-# define _Locale_PRINT (_P | _U | _L | _N | _B)
-# define _Locale_ALPHA (_U | _L)
-#elif defined (_CRAY)
-# define _Locale_CNTRL _CNTRL
-# define _Locale_UPPER _UPPER
-# define _Locale_LOWER _LOWER
-# define _Locale_DIGIT _DIGIT
-# define _Locale_XDIGIT _XDIGIT
-# define _Locale_PUNCT _PUNCT
-# define _Locale_SPACE _SPACE
-# define _Locale_PRINT _PRINT
-# define _Locale_ALPHA _ALPHA
-#endif
-
-/* We arbitrarily consider _Locale_CNTRL macro to check locale facet numeric
- * identifier has been defined for the platform/compiler:
- */
-#if !defined (_Locale_CNTRL)
-# error Unable to find your platform locale facets definitions, please grant them.
-#endif
-
-#endif /* _STLP_C_LOCALE_H */
diff --git a/stl/char_traits.h b/stl/char_traits.h
deleted file mode 100644
index 12e8d08..0000000
--- a/stl/char_traits.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_CHAR_TRAITS_H
-#define _STLP_CHAR_TRAITS_H
-
-// Define char_traits
-
-#ifndef _STLP_INTERNAL_CSTDDEF
-# include <stl/_cstddef.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CSTRING
-# include <stl/_cstring.h>
-#endif
-
-#if defined (__unix) || defined (N_PLAT_NLM)
-# include <sys/types.h> // For off_t
-#endif /* __unix */
-
-#ifdef __BORLANDC__
-# include _STLP_NATIVE_C_HEADER(mem.h)
-# include _STLP_NATIVE_C_HEADER(string.h)
-# include _STLP_NATIVE_C_HEADER(_stddef.h)
-#endif
-
-#ifndef _STLP_INTERNAL_CONSTRUCT_H
-# include <stl/_construct.h>
-#endif
-
-#ifndef _STLP_INTERNAL_CWCHAR
-# include <stl/_cwchar.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-template <class _Tp> class allocator;
-
-#define _STLP_NULL_CHAR_INIT(_ChT) _STLP_DEFAULT_CONSTRUCTED(_ChT)
-
-#if defined (__sgi) && defined (_STLP_HAS_NO_NEW_C_HEADERS) /* IRIX */
-typedef off64_t streamoff;
-#elif defined(_STLP_WCE)
-typedef long streamoff;
-#elif defined (_STLP_WIN32)
-# if defined (_STLP_LONG_LONG) && !defined (__CYGWIN__)
-//The Win32 file io API support 64 bits access so streamoff and streamsize
-//has to reflect that. Do not change the stringbuf behavior.
-typedef _STLP_LONG_LONG streamoff;
-# else
-typedef ptrdiff_t streamoff;
-# endif
-#else // __unix
-# ifdef _STLP_USE_DEFAULT_FILE_OFFSET
-typedef off_t streamoff;
-# elif defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE) /* || defined(__USE_FILE_OFFSET64) */ \
- /* || (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */ /* || defined (__sgi) && defined (_STLP_HAS_NO_NEW_C_HEADERS) */
-typedef off64_t streamoff;
-# elif defined(ANDROID)
-typedef long streamoff;
-# else
-typedef off_t streamoff;
-# endif
-#endif /* ___unix */
-
-#if defined (_STLP_WIN32)
-typedef streamoff streamsize;
-#else
-typedef ptrdiff_t streamsize;
-#endif
-
-// Class fpos, which represents a position within a file. (The C++
-// standard calls for it to be defined in <ios>. This implementation
-// moves it to <iosfwd>, which is included by <ios>.)
-template <class _StateT> class fpos {
-public: // From table 88 of the C++ standard.
- fpos(streamoff __pos) : _M_pos(__pos), _M_st(_STLP_NULL_CHAR_INIT(_StateT)) {}
- fpos() : _M_pos(0), _M_st(_STLP_NULL_CHAR_INIT(_StateT)) {}
-
- operator streamoff() const { return _M_pos; }
-
- bool operator==(const fpos& __y) const
- { return _M_pos == __y._M_pos; }
- bool operator!=(const fpos& __y) const
- { return _M_pos != __y._M_pos; }
-
- fpos& operator+=(streamoff __off) {
- _M_pos += __off;
- return *this;
- }
- fpos& operator-=(streamoff __off) {
- _M_pos -= __off;
- return *this;
- }
-
- fpos operator+(streamoff __off) {
- fpos __tmp(*this);
- __tmp += __off;
- return __tmp;
- }
- fpos operator-(streamoff __off) {
- fpos __tmp(*this);
- __tmp -= __off;
- return __tmp;
- }
-
-public: // Manipulation of the state member.
- _StateT state() const { return _M_st; }
- void state(_StateT __st) { _M_st = __st; }
-private:
- streamoff _M_pos;
- _StateT _M_st;
-};
-
-#if !defined (_STLP_NO_MBSTATE_T)
-typedef fpos<mbstate_t> streampos;
-typedef fpos<mbstate_t> wstreampos;
-#endif
-
-// Class __char_traits_base.
-template <class _CharT, class _IntT>
-class __char_traits_base {
-public:
- typedef _CharT char_type;
- typedef _IntT int_type;
- typedef streamoff off_type;
- typedef streampos pos_type;
-#if defined (_STLP_NO_MBSTATE_T)
- typedef char state_type;
-#else
- typedef mbstate_t state_type;
-#endif
-
- static void _STLP_CALL assign(char_type& __c1, const char_type& __c2) { __c1 = __c2; }
- static bool _STLP_CALL eq(const char_type& __c1, const char_type& __c2)
- { return __c1 == __c2; }
- static bool _STLP_CALL lt(const char_type& __c1, const char_type& __c2)
- { return __c1 < __c2; }
-
- static int _STLP_CALL compare(const char_type* __s1, const char_type* __s2, size_t __n) {
- for (size_t __i = 0; __i < __n; ++__i)
- if (!eq(__s1[__i], __s2[__i]))
- return __s1[__i] < __s2[__i] ? -1 : 1;
- return 0;
- }
-
- static size_t _STLP_CALL length(const char_type* __s) {
- const char_type _NullChar = _STLP_DEFAULT_CONSTRUCTED(char_type);
- size_t __i(0);
- for (; !eq(__s[__i], _NullChar); ++__i) {}
- return __i;
- }
-
- static const char_type* _STLP_CALL find(const char_type* __s, size_t __n, const char_type& __c) {
- for ( ; __n > 0 ; ++__s, --__n)
- if (eq(*__s, __c))
- return __s;
- return 0;
- }
-
- static char_type* _STLP_CALL move(char_type* __s1, const char_type* __s2, size_t _Sz)
- { return (_Sz == 0 ? __s1 : (char_type*)memmove(__s1, __s2, _Sz * sizeof(char_type))); }
-
- static char_type* _STLP_CALL copy(char_type* __s1, const char_type* __s2, size_t __n) {
- return (__n == 0 ? __s1 :
- (char_type*)memcpy(__s1, __s2, __n * sizeof(char_type)));
- }
-
- static char_type* _STLP_CALL assign(char_type* __s, size_t __n, char_type __c) {
- for (size_t __i = 0; __i < __n; ++__i)
- __s[__i] = __c;
- return __s;
- }
-
- static int_type _STLP_CALL not_eof(const int_type& __c)
- { return !eq_int_type(__c, eof()) ? __c : __STATIC_CAST(int_type, 0); }
-
- static char_type _STLP_CALL to_char_type(const int_type& __c)
- { return (char_type)__c; }
-
- static int_type _STLP_CALL to_int_type(const char_type& __c)
- { return (int_type)__c; }
-
- static bool _STLP_CALL eq_int_type(const int_type& __c1, const int_type& __c2)
- { return __c1 == __c2; }
-
- static int_type _STLP_CALL eof()
- { return (int_type)-1; }
-};
-
-// Generic char_traits class. Note that this class is provided only
-// as a base for explicit specialization; it is unlikely to be useful
-// as is for any particular user-defined type. In particular, it
-// *will not work* for a non-POD type.
-
-template <class _CharT>
-class char_traits
- : public __char_traits_base<_CharT, _CharT> {};
-
-// Specialization for char.
-
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC char_traits<char>
- : public __char_traits_base<char, int> {
-public:
- typedef char char_type;
- typedef int int_type;
- typedef streamoff off_type;
-#if !defined (_STLP_NO_MBSTATE_T)
- typedef streampos pos_type;
- typedef mbstate_t state_type;
-#endif
-
- static char _STLP_CALL to_char_type(const int& __c)
- { return (char)(unsigned char)__c; }
-
- static int _STLP_CALL to_int_type(const char& __c)
- { return (unsigned char)__c; }
-
- static int _STLP_CALL compare(const char* __s1, const char* __s2, size_t __n)
- { return memcmp(__s1, __s2, __n); }
-
- static size_t _STLP_CALL length(const char* __s)
- { return strlen(__s); }
-
- static void _STLP_CALL assign(char& __c1, const char& __c2)
- { __c1 = __c2; }
-
- static char* _STLP_CALL assign(char* __s, size_t __n, char __c) {
- memset(__s, __c, __n);
- return __s;
- }
-};
-
-#if defined (_STLP_HAS_WCHAR_T)
-// Specialization for wchar_t.
-_STLP_TEMPLATE_NULL
-class _STLP_CLASS_DECLSPEC char_traits<wchar_t>
- : public __char_traits_base<wchar_t, wint_t> {
-# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && !defined (_STLP_WCHAR_HPACC_EXCLUDE)
-public:
-# if !defined (N_PLAT_NLM)
-# if !defined (__BORLANDC__)
- static wchar_t* _STLP_CALL move(wchar_t* __dest, const wchar_t* __src, size_t __n)
- { return wmemmove(__dest, __src, __n); }
-# endif
-
- static wchar_t* _STLP_CALL copy(wchar_t* __dest, const wchar_t* __src, size_t __n)
- { return wmemcpy(__dest, __src, __n); }
-
-# if !defined (__DMC__) && !defined (__BORLANDC__)
- static int _STLP_CALL compare(const wchar_t* __s1, const wchar_t* __s2, size_t __n)
- { return wmemcmp(__s1, __s2, __n); }
-# endif
-
- static wchar_t* _STLP_CALL assign(wchar_t* __s, size_t __n, wchar_t __c)
- { return wmemset(__s, __c, __n); }
-# endif
-
- static size_t _STLP_CALL length(const wchar_t* __s)
- { return wcslen(__s); }
-
- static void _STLP_CALL assign(wchar_t& __c1, const wchar_t& __c2)
- { __c1 = __c2; }
-# endif
-};
-#endif
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_CHAR_TRAITS_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/config/_aix.h b/stl/config/_aix.h
deleted file mode 100644
index bcbcb32..0000000
--- a/stl/config/_aix.h
+++ /dev/null
@@ -1 +0,0 @@
-#define _STLP_PLATFORM "AIX"
diff --git a/stl/config/_android.h b/stl/config/_android.h
deleted file mode 100644
index 1a954bf..0000000
--- a/stl/config/_android.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef __stl_config__android_h
-#define __stl_config__android_h
-
-#define _STLP_PLATFORM "Android"
-
-// The Android C library is mostly glibc-like
-#define _STLP_USE_GLIBC 1
-
-// ...and Unix-like.
-#define _STLP_UNIX 1
-
-// Have pthreads support.
-#define _PTHREADS
-
-// Don't have native <cplusplus> headers
-#define _STLP_HAS_NO_NEW_C_HEADERS 1
-
-// Don't use wchar.h etc
-#define _STLP_NO_WCHAR_T 1
-
-// Don't have (working) native wide character support.
-#define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
-
-// Don't use mbstate_t, define our own.
-#define _STLP_NO_NATIVE_MBSTATE_T 1
-
-// No (proper) wide stream support in Android
-#define _STLP_NO_NATIVE_WIDE_STREAMS 1
-
-// C library is in the global namespace.
-#define _STLP_VENDOR_GLOBAL_CSTD 1
-
-// Don't have underlying local support.
-#undef _STLP_REAL_LOCALE_IMPLEMENTED
-
-// No pthread_spinlock_t in Android
-#define _STLP_DONT_USE_PTHREAD_SPINLOCK 1
-
-// Do not enable thread support
-#define _NOTHREADS 1
-
-// Little endian platform.
-#define _STLP_LITTLE_ENDIAN 1
-
-// No <exception> headers
-#define _STLP_NO_EXCEPTION_HEADER 1
-
-// No throwing exceptions
-#define _STLP_NO_EXCEPTIONS 1
-
-// Disable all iostreams
-#define _STLP_NO_IOSTREAMS 1
-
-// No need to define our own namespace
-#define _STLP_NO_OWN_NAMESPACE 1
-
-// Need this to define STLport's own bad_alloc class (which won't be
-// thrown in any case)
-#define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
-
-// Use __new_alloc instead of __node_alloc, so we don't need static functions.
-#define _STLP_USE_SIMPLE_NODE_ALLOC 1
-
-// Don't use extern versions of range errors, so we don't need to
-// compile as a library.
-#define _STLP_USE_NO_EXTERN_RANGE_ERRORS 1
-
-// The system math library doesn't have long double variants, e.g
-// sinl, cosl, etc
-#define _STLP_NO_VENDOR_MATH_L 1
-
-// Define how to include our native headers.
-#define _STLP_NATIVE_HEADER(header) <libstdc++/include/header>
-#define _STLP_NATIVE_C_HEADER(header) <../include/header>
-#define _STLP_NATIVE_CPP_C_HEADER(header) <libstdc++/include/header>
-#define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <libstdc++/include/header>
-#define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <libstdc++/include/header>
-
-#endif /* __stl_config__android_h */
diff --git a/stl/config/_apcc.h b/stl/config/_apcc.h
deleted file mode 100644
index 5e8b115..0000000
--- a/stl/config/_apcc.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// STLport config file for Apogee 4.x
-
-#define _STLP_COMPILER "Apogee"
-
-#define _STLP_NO_NEW_NEW_HEADER 1
-#define _STLP_HAS_NO_NEW_IOSTREAMS 1
-#define _STLP_HAS_NO_NEW_C_HEADERS 1
-
-#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
-# define _STLP_RAND48 1
-#endif
-// # define _STLP_RAND48 1
-#define _STLP_LONG_LONG long long
-#define _STLP_NO_BAD_ALLOC 1
-#define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-#define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
-// # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
-#define _STLP_NO_EXCEPTION_HEADER 1
-
-#undef _STLP_LINK_TIME_INSTANTIATION
-#define _STLP_LINK_TIME_INSTANTIATION 1
-
-#ifdef __STDLIB
-# undef _STLP_NO_NEW_C_HEADERS
-# undef _STLP_NO_NEW_NEW_HEADER
-# undef _STLP_NO_BAD_ALLOC
-# undef _STLP_LONG_LONG
-#else
-# undef _STLP_NO_EXCEPTION_SPEC
-# define _STLP_NO_EXCEPTION_SPEC 1
-#endif
diff --git a/stl/config/_apple.h b/stl/config/_apple.h
deleted file mode 100644
index 4c030db..0000000
--- a/stl/config/_apple.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* STLport configuration file
- * It is internal STLport header - DO NOT include it directly
- */
-
-/* common configuration settings for Apple MPW MrCpp / SCpp */
-
-#if defined (__MRC__)
-# define _STLP_COMPILER "MPW MrCpp"
-#else
-# define _STLP_COMPILER "MPW SCpp"
-#endif
-
-#if defined(__MRC__) && __MRC__ < 0x500
-# error Apple's MPW MrCpp v.5.0.0 or better compiler required
-#endif
-#if defined(__SC__) && __SC__ < 0x890
-# error Apple's MPW SCpp v.8.9.0 or better compiler required
-#endif
-
-/* TODO: Check that this config is necessary for all compiler versions.
- * It is here for historical reasons for the moment.
- */
-#define _STLP_NO_CONTAINERS_EXTENSION
-
-#ifdef qMacApp
-# ifndef __CONDITIONALMACROS__ /* skip including ConditionalMacros_AC.h if ConditionalMacros.h is already included */
-# include <CoreSwitches_AC.h>
-# include <ConditionalMacros_AC.h>
-# include <Types_AC.h>
-# define _STLP_FILE__ _FILE_AC
-# define _STLP_DEBUG_MESSAGE
-# define __stl_debug_message ProgramBreak_AC
-# include <ConditionalMacros.h>
-# endif
-# include <Types.h>
-#else
-# include <ConditionalMacros.h>
-# include <Types.h>
-#endif
-
-#define _STLP_UINT32_T UInt32
-typedef int wint_t;
-
-#ifndef TYPE_BOOL
-# error <ConditionalMacros.h> must be included. (TYPE_BOOL)
-#endif
-#if !TYPE_BOOL
-# define _STLP_NO_BOOL
-# define _STLP_DONT_USE_BOOL_TYPEDEF
-#endif
-
-#ifndef TYPE_LONGLONG
-# error <ConditionalMacros.h> must be included. (TYPE_LONGLONG)
-#endif
-#if TYPE_LONGLONG
-# define _STLP_LONG_LONG long long
-#endif
-
-#if !__option(exceptions)
-# define _STLP_HAS_NO_EXCEPTIONS
-#endif
-
-#define _STLP_DEBUG_MESSAGE_POST DebugStr("\pSTL diagnosis issued. See 'stderr' for detail.");
-#define _STLP_ASSERT_MSG_TRAILER " "
-
-#ifdef _STLP_DEBUG
-# define _STLP_THROW(x) (DebugStr("\pSTL is about to throw exception: "#x),throw x)
-#endif
-
-#if defined(__MRC__)
-# ifndef __spillargs
-# define __spillargs 1 // MrCpp requires this symbol to be defined as 1 to properly handle va_start; ref.[ file stdarg.h; line 26 ]
-# endif
-#endif
-
-#if defined(__SC__)
-#define _STLP_VENDOR_LONG_DOUBLE_MATH //*TY 12/03/2000 - SCpp's native math type is long double
-#endif
-
-#ifndef _STLP_NATIVE_INCLUDE_PATH
-# if __option(unix_includes)
-# define _STLP_NATIVE_INCLUDE_PATH ../CIncludes // expects the alias to {CIncludes} under the same folder as {STL}
-# else
-# define _STLP_NATIVE_INCLUDE_PATH ::CIncludes // expects the alias to {CIncludes} under the same folder as {STL}
-# endif
-#endif
-#if !defined(_STLP_MAKE_HEADER)
-# if !__option(unix_includes)
-# define _STLP_MAKE_HEADER(path, header) <path:header> // Mac uses ":" for directory delimiter
-# endif
-#endif
-
-# define _STLD _DBG // to keep the length of generated symbols within the compiler limitation
-
-#define _STLP_USE_STDIO_IO 1 //*TY 02/24/2000 - see also ; ref.[ file _fstream.h; line 36 ]
-#define _STLP_NO_THREADS //*TY 12/17/2000 - multi-thread capability not explored, yet.
-#undef _REENTRANT //*ty 11/24/2001 - to make sure no thread facility is activated
-#define _NOTHREADS //*ty 12/07/2001 -
-
-// native library limitations
-#define _STLP_VENDOR_GLOBAL_STD // mpw's c++ libs do not utilize namespace std yet
-#define _STLP_NO_BAD_ALLOC // known limitation
-#define _STLP_HAS_NO_NEW_C_HEADERS // known limitation
-#define _STLP_NO_NEW_NEW_HEADER // known limitation
-#define _STLP_NO_NATIVE_MBSTATE_T // known limitation
-#define _STLP_NO_NATIVE_WIDE_FUNCTIONS // known limitation
-#define _STLP_NO_NATIVE_WIDE_STREAMS // known limitation
-#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT // known limitation
-#define _STLP_BROKEN_EXCEPTION_CLASS // known limitation
-
-// compiler limitations
-# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
-
-# define _STLP_MPWFIX_TRY try{ //*TY 06/01/2000 - exception handling bug workaround
-# define _STLP_MPWFIX_CATCH }catch(...){throw;} //*TY 06/01/2000 - exception handling bug workaround
-# define _STLP_MPWFIX_CATCH_ACTION(action) }catch(...){action;throw;} //*TY 06/01/2000 - exception handling bug workaround
-# define _STLP_THROW_RETURN_BUG // known limitation
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION // known limitation
-# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX // known limitation
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER // known limitation
-# define _STLP_NO_RELOPS_NAMESPACE // known limitation
-// end of stl_apple.h
diff --git a/stl/config/_as400.h b/stl/config/_as400.h
deleted file mode 100644
index a0261a4..0000000
--- a/stl/config/_as400.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// STLport configuration file
-// It is internal STLport header - DO NOT include it directly
-
-// AS/400 C++ config
-
-# ifdef _REENTRANT
-# define _PTHREADS
-# endif
-
-# define _STLP_NO_NEW_NEW_HEADER 1
-
-# define _STLP_NO_BOOL
-# define _STLP_LIMITED_DEFAULT_TEMPLATES
-
-# define _STLP_HAS_NO_NAMESPACES
-# define _STLP_NEED_TYPENAME
-# define _STLP_NEED_EXPLICIT
-# define _STLP_HAS_NO_EXCEPTIONS
-# define _STLP_NO_EXCEPTION_SPEC
-# define _STLP_NO_ARROW_OPERATOR
-# define _STLP_NO_NEW_STYLE_CASTS
-
-# define _STLP_NEED_MUTABLE
-# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX
-# define _STLP_NO_BAD_ALLOC
-# define _STLP_NO_MEMBER_TEMPLATES
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD
-# define _STLP_NO_FRIEND_TEMPLATES
-# define _STLP_NO_QUALIFIED_FRIENDS
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
-
-# define _STLP_NO_METHOD_SPECIALIZATION
-# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
-
-// # define _STLP_NO_EXCEPTION_HEADER
-
-# define _STLP_HAS_NO_NEW_C_HEADERS
-
-# define _STLP_STATIC_CONST_INIT_BUG
-# define _STLP_THROW_RETURN_BUG
-# define _STLP_LINK_TIME_INSTANTIATION
-# define _STLP_NO_TEMPLATE_CONVERSIONS
-
-# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
-# define _STLP_TRIVIAL_DESTRUCTOR_BUG 1
-
-# if defined(_LONG_LONG)
-# define _STLP_LONG_LONG long long
-# endif
-# if defined(_PTHREADS)
-# define _MULTI_THREADED
-# endif
-// fbp : to fix __partition() problem
-# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
diff --git a/stl/config/_auto_link.h b/stl/config/_auto_link.h
deleted file mode 100644
index 52b5232..0000000
--- a/stl/config/_auto_link.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* We do not use auto link feature when:
- * - user asked not to use it (_STLP_DONT_USE_AUTO_LINK)
- * - STLport is used only as a STL library (_STLP_NO_IOSTREAMS || _STLP_USE_NO_IOSTREAMS)
- * - we are building a C translation unit, STLport is a C++ Standard library implementation
- */
-#if !defined (__BUILDING_STLPORT) && !defined (_STLP_DONT_USE_AUTO_LINK) && \
- !defined (_STLP_NO_IOSTREAMS) && !defined (_STLP_USE_NO_IOSTREAMS) && \
- defined (__cplusplus)
-
-# define _STLP_STRINGIZE(X) _STLP_STRINGIZE_AUX(X)
-# define _STLP_STRINGIZE_AUX(X) #X
-
-# if defined (_STLP_DEBUG)
-# define _STLP_LIB_OPTIM_MODE "stld"
-# elif defined (_DEBUG)
-# define _STLP_LIB_OPTIM_MODE "d"
-# else
-# define _STLP_LIB_OPTIM_MODE ""
-# endif
-
-# if defined (_STLP_LIB_NAME_MOTIF)
-# define _STLP_LIB_MOTIF "_"_STLP_LIB_NAME_MOTIF
-# else
-# define _STLP_LIB_MOTIF ""
-# endif
-
-# if defined (_STLP_USE_DYNAMIC_LIB)
-# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
-# define _STLP_LIB_TYPE "_x"
-# else
-# define _STLP_LIB_TYPE ""
-# endif
-# else
-# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
-# define _STLP_LIB_TYPE "_statix"
-# else
-# define _STLP_LIB_TYPE "_static"
-# endif
-# endif
-
-# define _STLP_VERSION_STR _STLP_STRINGIZE(_STLPORT_MAJOR)"."_STLP_STRINGIZE(_STLPORT_MINOR)
-
-# define _STLP_STLPORT_LIB "stlport"_STLP_LIB_OPTIM_MODE""_STLP_LIB_TYPE""_STLP_LIB_MOTIF"."_STLP_VERSION_STR".lib"
-
-# if defined (_STLP_VERBOSE_AUTO_LINK)
-# pragma message ("STLport: Auto linking to "_STLP_STLPORT_LIB)
-# endif
-# pragma comment (lib, _STLP_STLPORT_LIB)
-
-# undef _STLP_STLPORT_LIB
-# undef _STLP_LIB_OPTIM_MODE
-# undef _STLP_LIB_TYPE
-# undef _STLP_STRINGIZE_AUX
-# undef _STLP_STRINGIZE
-
-#endif /* _STLP_DONT_USE_AUTO_LINK */
-
diff --git a/stl/config/_bc.h b/stl/config/_bc.h
deleted file mode 100644
index b56de07..0000000
--- a/stl/config/_bc.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// STLport configuration file
-// It is internal STLport header - DO NOT include it directly
-
-//#define _STLP_VERBOSE
-
-#define _STLP_COMPILER "Borland"
-
-#if (__BORLANDC__ < 0x551)
-# error - Borland compilers below version 5.5.1 not supported.
-#endif
-
-#if (__BORLANDC__ >= 0x580) && (__BORLANDC__ < 0x590)
-# define _STLP_NO_NEW_C_HEADERS
-# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/dinkumware/##header>
-# define _STLP_NO_FORCE_INSTANTIATE
-#endif
-
-#if (__BORLANDC__ >= 0x560) && (__BORLANDC__ < 0x570)
-# define _USE_OLD_RW_STL
-#endif
-
-#if (__BORLANDC__ >= 0x560)
-# define NOWINBASEINTERLOCK // src/fstream.cpp error in winbase.h
-#endif
-
-#if (__BORLANDC__ < 0x564)
-# define _STLP_QUALIFIED_SPECIALIZATION_BUG
-#endif
-
-#if (__BORLANDC__ < 0x560)
-# define _STLP_NO_CONTAINERS_EXTENSION
-#endif
-
-#define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
-#define _STLP_DONT_USE_PRIV_NAMESPACE
-#define _STLP_NO_VENDOR_STDLIB_L
-#define _STLP_NO_VENDOR_MATH_F
-#define _STLP_DONT_USE_SHORT_STRING_OPTIM 1
-#define _STLP_NO_NATIVE_MBSTATE_T
-#define _STLP_DLLEXPORT_NEEDS_PREDECLARATION
-#undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
-#if (__BORLANDC__ < 0x580) && !defined (_RTLDLL)
-# define _UNCAUGHT_EXCEPTION 1
-#endif
-
-// <limits> problem
-#define _STLP_STATIC_CONST_INIT_BUG
-
-// <bitset> problems
-#define _STLP_MEMBER_SPECIALIZATION_BUG 1
-#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG 1
-
-#define _STLP_LONG_LONG __int64
-
-// auto enable thread safety and exceptions:
-#ifndef _CPPUNWIND
-# define _STLP_HAS_NO_EXCEPTIONS
-#endif
-
-#if defined (__MT__) && !defined (_NOTHREADS) && !defined (_REENTRANT)
-# if defined (_STLP_VERBOSE)
-# pragma message ("multi threaded")
-# endif
-# define _REENTRANT 1
-#else
-# if defined (_STLP_VERBOSE)
-# pragma message ("single threaded")
-# endif
-#endif
-
-#define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
-#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
-
-#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
-#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
-
-#if defined (_DLL)
-# define _STLP_DLL
-#endif
-#if defined (_RTLDLL)
-# define _STLP_RUNTIME_DLL
-#endif
-#include <stl/config/_detect_dll_or_lib.h>
-#undef _STLP_RUNTIME_DLL
-#undef _STLP_DLL
-
-#if defined (_STLP_USE_DYNAMIC_LIB)
-# if defined (_STLP_VERBOSE)
-# pragma message ("Using/Building STLport dll")
-# endif
-#elif defined (_STLP_USE_STATIC_LIB)
-# if defined (_STLP_VERBOSE)
-# pragma message ("Using/Building STLport lib")
-# endif
-#else
-# error Unknown STLport usage config (dll/lib?)
-#endif
-
-#if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
-# if defined (_STLP_VERBOSE)
-# pragma message ("Using cross version of native runtime")
-# endif
-#endif
-
-#if !defined (_STLP_IMPORT_TEMPLATE_KEYWORD)
-//# define _STLP_IMPORT_TEMPLATE_KEYWORD __declspec(dllimport)
-#endif
-//#define _STLP_EXPORT_TEMPLATE_KEYWORD __declspec(dllexport)
-
-#if defined (_STLP_USE_DYNAMIC_LIB)
-# define _STLP_USE_DECLSPEC 1
-# if (__BORLANDC__ < 0x580)
-# if defined (__BUILDING_STLPORT)
-# define _STLP_CALL __cdecl __export
-# else
-# define _STLP_CALL __cdecl __import
-# endif
-#else
-# define _STLP_CALL __cdecl
-#endif
-#else
-# define _STLP_CALL __cdecl
-#endif
-
-#include <stl/config/_auto_link.h>
diff --git a/stl/config/_cray.h b/stl/config/_cray.h
deleted file mode 100644
index 32abd4f..0000000
--- a/stl/config/_cray.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#define _STLP_COMPILER "CC"
-
-// Mostly correct guess, change it for Alpha (and other environments
-// that has 64-bit "long")
-# define _STLP_UINT32_T unsigned long
-
-// Uncomment if long long is available
-# define _STLP_LONG_LONG long long
-
-// Uncomment this if your compiler can't inline while(), for()
-# define _STLP_LOOP_INLINE_PROBLEMS 1
-
-// Uncomment this if your compiler does not support exceptions
-// Cray C++ supports exceptions when '-h exceptions' option is user;
-// therefore '-D_STLP_HAS_NO_EXCEPTIONS' must be used when '-h exceptions'
-// is NOT used.
-//# define _STLP_HAS_NO_EXCEPTIONS 1
-
-// Delete?
-// Define this if compiler lacks <exception> header
-//# define _STLP_NO_EXCEPTION_HEADER 1
-
-// Uncomment this if your C library has lrand48() function
-# define _STLP_RAND48 1
-
-// Uncomment if native new-style C library headers lile <cstddef>, etc are not available.
-# define _STLP_HAS_NO_NEW_C_HEADERS 1
-
-// uncomment if new-style headers <new> is available
-# define _STLP_NO_NEW_NEW_HEADER 1
-
-// uncomment this if <iostream> and other STD headers put their stuff in ::namespace,
-// not std::
-# define _STLP_VENDOR_GLOBAL_STD
-
-// uncomment this if <cstdio> and the like put stuff in ::namespace,
-// not std::
-# define _STLP_VENDOR_GLOBAL_CSTD
-
-# define _STLP_NATIVE_C_HEADER(__x) </usr/include/##__x>
-// WARNING: Following is hardcoded to the system default C++ include files
-# define _STLP_NATIVE_CPP_RUNTIME_HEADER(__x) </opt/ctl/CC/CC/include/##__x>
-
-
-# define _STLP_NO_NATIVE_MBSTATE_T
-# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS
-//# define _STLP_VENDOR_GLOBAL_EXCEPT_STD
-
-#if !defined (_CRAYIEEE)
-# define _STLP_NO_IEC559_SUPPORT 1
-#endif
diff --git a/stl/config/_cygwin.h b/stl/config/_cygwin.h
deleted file mode 100644
index 7960d01..0000000
--- a/stl/config/_cygwin.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#define _STLP_PLATFORM "Cygwin"
-
-/* Glibc is the platform API */
-#if !defined (_STLP_USE_GLIBC)
-# define _STLP_USE_GLIBC
-#endif
diff --git a/stl/config/_dec.h b/stl/config/_dec.h
deleted file mode 100644
index 9f732d9..0000000
--- a/stl/config/_dec.h
+++ /dev/null
@@ -1,107 +0,0 @@
-#define _STLP_COMPILER "Dec"
-
-# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
-
-# define _STLP_NATIVE_HEADER(header) <../cxx/##header>
-# define _STLP_NATIVE_C_HEADER(x) <../include/##x>
-
-#if (__DECCXX_VER < 60300000)
-# define _STLP_NATIVE_CPP_C_HEADER(header) <../cxx/##header>
-#else
-# define _STLP_NATIVE_CPP_C_HEADER(header) </usr/include/cxx_cname/##header>
-#endif
-
-# define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <../cxx/##header>
-# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../cxx/##header>
-
-// Alpha is little-endian
-# define _STLP_LITTLE_ENDIAN
-
-// collisions
-# define _STLP_DONT_PUT_STLPORT_IN_STD
-
-#if (__DECCXX_VER < 60000000)
-
-// automatic template instantiation does not
-// work with namespaces ;(
-# define _STLP_HAS_NO_NAMESPACES 1
-
-# define _STLP_NO_NEW_NEW_HEADER 1
-
-# define _STLP_NO_WCHAR_T 1
-# define _STLP_NEED_EXPLICIT 1
-
-# define _STLP_NO_BOOL 1
-# define _STLP_NEED_TYPENAME 1
-# define _STLP_NO_NEW_STYLE_CASTS 1
-# define _STLP_NEED_MUTABLE 1
-# define _STLP_NO_BAD_ALLOC 1
-
-
-# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
-
-# define _STLP_NO_MEMBER_TEMPLATES 1
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-# define _STLP_NO_FRIEND_TEMPLATES 1
-# define _STLP_NO_QUALIFIED_FRIENDS 1
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
-# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
-# define _STLP_BROKEN_USING_DIRECTIVE 1
-# define _STLP_NO_EXCEPTION_HEADER 1
-# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
-# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
-
-#endif
-
-
-#ifdef __NO_USE_STD_IOSTREAM
-# define _STLP_HAS_NO_NEW_IOSTREAMS 1
-# else
-// default is to use new iostreams, anyway
-# ifndef __USE_STD_IOSTREAM
-# define __USE_STD_IOSTREAM
-# endif
-#endif
-
-//# ifndef __STD_STRICT_ANSI_ERRORS
-//# endif
-
-#ifndef __EXCEPTIONS
-# define _STLP_HAS_NO_EXCEPTIONS 1
-#endif
-
-# ifdef __IMPLICIT_INCLUDE_ENABLED
-
-// but, works with ours ;).
-# define _STLP_LINK_TIME_INSTANTIATION 1
-# else
-# undef _STLP_LINK_TIME_INSTANTIATION
-# endif
-
-# if defined (__IMPLICIT_USING_STD) && !defined (__NO_USE_STD_IOSTREAM)
-// we should ban that !
-// # error "STLport won't work with new iostreams and std:: being implicitly included. Please use -std strict_ansi[_errors] or specify __NO_USE_STD_IOSTREAM"
-# endif
-
-# if (defined (__STD_STRICT_ANSI) || defined (__STD_STRICT_ANSI_ERRORS))
-# define _STLP_STRICT_ANSI 1
-# else
-// we want to enforce it
-# define _STLP_LONG_LONG long long
-# endif
-
-// unsigned 32-bit integer type
-# define _STLP_UINT32_T unsigned int
-#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
-# define _STLP_RAND48 1
-#endif
-// # define _STLP_RAND48 1
-
-# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
-
-# if (__DECCXX_VER <= 60600000)
-# define _STLP_HAS_NO_NEW_C_HEADERS 1
-# endif
-
diff --git a/stl/config/_dec_vms.h b/stl/config/_dec_vms.h
deleted file mode 100644
index 5df8d26..0000000
--- a/stl/config/_dec_vms.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// OpenVMS version
-
-#define _STLP_COMPILER "Dec Vms"
-
-# define _STLP_NATIVE_HEADER(header) <sys$library:##header>
-# define _STLP_NATIVE_C_HEADER(x) <sys$library:##x>
-# define _STLP_NATIVE_CPP_C_HEADER(header) <sys$library:##header>
-# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <sys$library:##header>
-
-#if (__DECCXX_VER < 60000000)
-
-// automatic template instantiation does not
-// work with namespaces ;(
-# define _STLP_HAS_NO_NAMESPACES 1
-
-# define _STLP_NO_WCHAR_T 1
-# define _STLP_NEED_EXPLICIT 1
-
-# define _STLP_NO_BOOL 1
-# define _STLP_NEED_TYPENAME 1
-# define _STLP_NO_NEW_STYLE_CASTS 1
-# define _STLP_NEED_MUTABLE 1
-# define _STLP_NO_BAD_ALLOC 1
-
-# define _STLP_NO_NEW_NEW_HEADER 1
-# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
-
-# define _STLP_NO_MEMBER_TEMPLATES 1
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-# define _STLP_NO_FRIEND_TEMPLATES 1
-# define _STLP_NO_QUALIFIED_FRIENDS 1
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
-# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
-# define _STLP_BROKEN_USING_DIRECTIVE 1
-# define _STLP_NO_EXCEPTION_HEADER 1
-# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
-# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
-
-#endif
-
-
-#ifdef __NO_USE_STD_IOSTREAM
-# define _STLP_USE_NO_IOSTREAMS 1
-# else
-// default is to use new iostreams, anyway
-# ifndef __USE_STD_IOSTREAM
-# define __USE_STD_IOSTREAM
-# endif
-#endif
-
-#ifndef __EXCEPTIONS
-# define _STLP_HAS_NO_EXCEPTIONS 1
-#endif
-
-# ifdef __IMPLICIT_INCLUDE_ENABLED
-
-#ifdef _STLP_USE_NO_IOSTREAMS
-// implicit include introduces conflicts
-// between stlport and native lib.
-# undef __IMPLICIT_INCLUDE_ENABLED
-#endif
-
-// but, works with ours ;).
-# define _STLP_LINK_TIME_INSTANTIATION 1
-
-# endif
-
-# if defined (__IMPLICIT_USING_STD) && !defined (__NO_USE_STD_IOSTREAM)
-// we should ban that !
-# error "STLport won't work with new iostreams and std:: being implicitly included. Please use -std strict_ansi[_errors] or specify __NO_USE_STD_IOSTREAM"
-# endif
-
-# if !(defined (__STD_STRICT_ANSI) || defined (__STD_STRICT_ANSI_ERRORS))
-// we want to enforce it
-# define _STLP_LONG_LONG long long
-# endif
-
-// unsigned 32-bit integer type
-# define _STLP_UINT32_T unsigned int
-#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
-# define _STLP_RAND48 1
-#endif
-// # define _STLP_RAND48 1
-
-# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
-
-#define _STLP_HAS_NO_NEW_C_HEADERS 1
-
diff --git a/stl/config/_detect_dll_or_lib.h b/stl/config/_detect_dll_or_lib.h
deleted file mode 100644
index 39049fa..0000000
--- a/stl/config/_detect_dll_or_lib.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* File used to define macros:
- * _STLP_USE_DYNAMIC_LIB: To signal use STLport as a dll or build of the
- * STLport dlls.
- * _STLP_USE_STATIC_LIB: To signal use of STLport as a static lib or build of
- * the STLport static libs.
- * _STLP_USING_CROSS_NATIVE_RUNTIME_LIB: Signal that we are using a native runtime
- * in a version different from the STLport one.
- * If _STLP_USE_DYNAMIC_LIB or _STLP_USE_STATIC_LIB is alreday defined it means that
- * user forces use of a specific version. In this case _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
- * will surely be defined otherwise there is no need to force macro defines.
- *
- * Before including this file the compiler must define:
- * _STLP_DLL: If we are building a dll
- * _STLP_RUNTIME_DLL: If we are using native runtime as a dll
- */
-#if defined (__BUILDING_STLPORT)
-# undef _STLP_USE_DYNAMIC_LIB
-# undef _STLP_USE_STATIC_LIB
-# if defined (_STLP_DLL)
-/* We are building the STLport dll */
-# define _STLP_USE_DYNAMIC_LIB
-# if !defined (_STLP_RUNTIME_DLL)
-# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
-# endif
-# else
-# define _STLP_USE_STATIC_LIB
-# if defined (_STLP_RUNTIME_DLL)
-# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
-# endif
-# endif
-#else
-# if !defined (_STLP_NO_IOSTREAMS)
-/* STLport use only depend on _STLP_RUNTIME_DLL as we are replacing
- * the native runtime.
- */
-# if defined (_STLP_RUNTIME_DLL)
-# if !defined (_STLP_USE_STATIC_LIB)
-# if !defined (_STLP_USE_DYNAMIC_LIB)
-# define _STLP_USE_DYNAMIC_LIB
-# endif
-# else
-/* The user is forcing use of STLport as a dynamic library. We signal it so
- * that the STLport namespace will be modify to report such a combination
- * and force the user to link with the rebuilt STLport library.
- */
-# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
-# endif
-# else
-# if !defined(_STLP_USE_DYNAMIC_LIB)
-# if !defined (_STLP_USE_STATIC_LIB)
-# define _STLP_USE_STATIC_LIB
-# endif
-# else
-/* Idem previous remark but the user forces use of the static native runtime.
- */
-# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
-# endif
-# endif
-# else
-/* If we do not build and use STLport libs we consider that we are in a static lib
- * mode as only dynamic lib needs additional export/import specifier.
- */
-# define _STLP_USE_STATIC_LIB
-# endif
-#endif
-
-/* we don't have a static native runtime library on evc3/evc4 */
-#ifdef _STLP_WCE
-# undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
-#endif
diff --git a/stl/config/_dm.h b/stl/config/_dm.h
deleted file mode 100644
index aa027a9..0000000
--- a/stl/config/_dm.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// STLport configuration file for Digital Mars C++
-
-//#define _STLP_VERBOSE
-
-#define _STLP_COMPILER "DMC"
-
-#if defined (_STLP_VERBOSE)
-# pragma message __DMC_VERSION_STRING__
-#endif
-
-#if (__DMC__ < 0x846)
-# error "Digital Mars C++ versions prior to 8.46 are not supported!"
-#endif
-
-#ifndef _CPPUNWIND
-# define _STLP_NO_EXCEPTIONS
-#endif
-#define _STLP_VENDOR_GLOBAL_CSTD
-
-//DMC prefer enum to real static const variable because it do not consider
-//static const as const enough to be used in switch declaration...
-#define _STLP_STATIC_CONST_INIT_BUG
-
-#if !defined (_WIN32)
-// it's not fully supported on non-Win32 platforms
-# define _STLP_NO_NATIVE_WIDE_FUNCTIONS
-#endif
-
-/* _STLP_NO_OWN_NAMESPACE is defined because Digital Mars' linker and libarian
- appear to have problems with STLport namespaces. Summary of the issues:
-
- STATIC: Digital Mars' librarian (lib.exe) may fail with "len <= IDMAX" error
- if _STLP_DEBUG is defined. This is because Digital Mars' librarian uses
- Microsoft OMF format, which limits identifier length to about 512 bytes.
- With STLport namespaces, some identifiers such as Category_Map in
- src/locale_catalog.cpp may exceed the maximum OMF identifier length.
-
- DYNAMIC: Export issues with cin, cout, cerr, clog in src/iostream.cpp.
- Exports in Digital Mars 'def' file must match mangled names in iostream.cpp.
- With STLport namespaces, the mangled names in the intermediate files no
- longer match these pre-defined exports. To use STLport dynamic libraries
- and STLport namespaces with Digital Mars, the pre-defined exports in
- src/iostream.cpp and the related Digital Mars 'def' files would need to be
- revised. */
-#define _STLP_NO_OWN_NAMESPACE 1
-
-// select threads strategy
-#if defined (_MT) && !defined (_NOTHREADS)
-# define _REENTRANT
-#else
-# define _NOTHREADS
-#endif
-
-#ifndef _BOOL_DEFINED
-# define _STLP_NO_BOOL
-#else
-# define _STLP_DONT_USE_BOOL_TYPEDEF
-#endif
-
-#if _INTEGRAL_MAX_BITS >= 64
-# define _STLP_LONG_LONG long long
-#endif
-
-#define _STLP_DONT_USE_PRIV_NAMESPACE
-#define _STLP_NO_BAD_ALLOC
-#define _STLP_THROW_RETURN_BUG
-
-#if !defined (_DLL)
-# undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
-#endif
-
-#define _STLP_USE_ABBREVS
-#define _STLP_NO_CONTAINERS_EXTENSION
-#define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
-
-#define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
-#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
-
-#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
-#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
-
-#define _STLP_IMPORT_TEMPLATE_KEYWORD __declspec(dllimport)
-#define _STLP_EXPORT_TEMPLATE_KEYWORD __declspec(dllexport)
-
-#if defined (_WINDLL)
-# define _STLP_DLL
-#endif
-#if defined (_DLL)
-# define _STLP_RUNTIME_DLL
-#endif
-#include <stl/config/_detect_dll_or_lib.h>
-#undef _STLP_RUNTIME_DLL
-#undef _STLP_DLL
-
-#if defined (_STLP_USE_DYNAMIC_LIB)
-# define _STLP_USE_DECLSPEC 1
-# if defined (__BUILDING_STLPORT)
-# define _STLP_CALL __export
-# else
-# define _STLP_CALL
-# endif
-#else
-# define _STLP_CALL
-#endif
-
-#include <stl/config/_auto_link.h>
-
-# undef __SC__
-
diff --git a/stl/config/_epilog.h b/stl/config/_epilog.h
deleted file mode 100644
index ecbace5..0000000
--- a/stl/config/_epilog.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#if defined (_STLP_MSVC) || defined (__ICL) || defined (__BORLANDC__)
-
-#if defined (__BORLANDC__)
-# pragma option pop
-# pragma option -w-pow // -w-8062 Previous options and warnings not restored
-#else
-# if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200))
-# pragma warning (pop)
-# endif
-# pragma pack (pop)
-#endif
-
-#elif defined (__sgi) && !defined (__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-
-# pragma reset woff 1174
-# pragma reset woff 1375
-# pragma reset woff 1209
-/* from iterator_base.h */
-# pragma reset woff 1183
-
-#elif defined (__DECCXX)
-
-# ifdef __PRAGMA_ENVIRONMENT
-# pragma __environment __restore
-# endif
-
-#elif defined (__IBMCPP__)
-
-# pragma info(restore)
-
-#endif
-
diff --git a/stl/config/_evc.h b/stl/config/_evc.h
deleted file mode 100644
index 4881a9a..0000000
--- a/stl/config/_evc.h
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * File to have Microsoft eMbedded Visual C++ 3.0 and .NET working with STLport
- * May 2004
- * Origin : Zdenek Nemec - zero@mapfactor.com
- * Michael Fink - vividos@users.sourceforge.net
- */
-
-#ifndef _STLP_EVC_H
-#define _STLP_EVC_H
-
-#define _STLP_COMPILER "eMbedded Visual C++"
-
-// This flag is being used by STLport to support
-// old-fashioned Windows CE SDK (see stl_wince.h)
-// do not use with eMebedded Visual C++ 3 or 4!
-#ifdef _STLP_WINCE
-# undef _STLP_WINCE
-#endif
-
-/* Compiler dependent define. The following defines may be available:
- * _STLP_WCE_EVC3 when compiling under eMbedded Visual C++ 3
- * _STLP_WCE_NET when compiling under eMbedded Visual C++ .NET
- * _STLP_WCE always defined when compiling with one of the above
- */
-#undef _STLP_WCE_EVC3
-#undef _STLP_WCE_NET
-
-#if (_WIN32_WCE > 300)
-# define _STLP_WCE_NET UNDER_CE
-#elif (_WIN32_WCE == 300)
-# define _STLP_WCE_EVC3 UNDER_CE
-#else
-# error No support for Windows CE below 3.0!
-#endif
-
-// This is defined for all platforms using Windows CE
-#define _STLP_WCE
-
-/* All Windows CE versions up to at least version 5 are little-endian, even
- * if the hardware (like e.g. MIPS) can be configured for big-endian, too. */
-#define _STLP_LITTLE_ENDIAN
-
-// Ensure _DEBUG is defined.
-#if defined (DEBUG) && !defined (_DEBUG)
-# define _DEBUG
-#endif
-
-// in evc3/4, on ARM, check that _STLP_DEBUG is not defined
-// the ARM compiler has a bug that prevents that debug mode from working
-#if _WIN32_WCE < 500 && defined(ARM) && defined(_STLP_DEBUG)
-# error _STLP_DEBUG mode is not supported in evc3 and evc4 on the ARM platform!
-#endif
-
-// inherit all msvc6 options
-#include <stl/config/_msvc.h>
-
-// CE up to at least version 5 has no C locale support
-#define _STLP_NO_LOCALE_SUPPORT
-
-#if _WIN32_WCE >= 0x500
- // SDKs built with PB5 have terminate&co in namespace std...
-# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_STD
-# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_STD
- // ...and new_handler/set_new_handler in the global namespace.
-# define _STLP_GLOBAL_NEW_HANDLER 1
-#endif
-
-// Always threaded in eMbedded Visual C++ 3.0 and .NET
-#ifndef _MT
-# define _MT
-#endif
-
-// we don't have a static native runtime library
-#undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
-
-#if _WIN32_WCE < 400
-// no long double under CE3 and older
-# define _STLP_NO_LONG_DOUBLE
-#endif
-
-// no *f and *l math functions available
-#define _STLP_NO_VENDOR_MATH_F
-#define _STLP_NO_VENDOR_MATH_L
-
-/*
- * Redirect cout, cerr and clog:
- * If defined redirect cout, cerr and clog to
- * files stdout.txt, stderr.txt and stdlog.txt
- */
-//# define _STLP_REDIRECT_STDSTREAMS
-
-/*
- * Static class members may generate LNK1179:
- * Wrong COMDAT packing may cause LNK1179 error.
- * For details see http://groups.google.com/groups?th=8a05c82c4ffee280
- * example P78. This define is not used/needed at this moment
- * but may came handy in future...
- */
-//# define _STLP_STATIC_MEMBERS_BUG
-
-// Use wide-string interface of windows native functions (CreateFile...).
-// Note that this should be defined all the time while under CE.
-#if defined (UNICODE)
-# define _STLP_USE_WIDE_INTERFACE
-#endif
-
-// Force exception std to std instead of __std_alias.
-#if defined (__cplusplus) && !defined (_STLP_HAS_NO_NAMESPACES)
-# ifdef _STLP_VENDOR_EXCEPT_STD
-# undef _STLP_VENDOR_EXCEPT_STD
-# endif
-# define _STLP_VENDOR_EXCEPT_STD std
-#endif
-
-// short string optimization bug under evc3, evc4 using ARM compiler
-#if _MSC_VER<1400 && (defined (ARM) || defined (_ARM_))
-# define _STLP_DONT_USE_SHORT_STRING_OPTIM
-#endif
-
-// when using MFC, disable another placement new declaration, since there is one in wcealt.h
-#if !defined (__BUILDING_STLPORT) && defined (_MFC_VER)
-# define __PLACEMENT_NEW_INLINE
-#endif
-
-// threads
-#undef _REENTRANT
-#define _REENTRANT
-#undef _NOTHREADS
-
-// Use old fashioned headers (ctime vs. time.h).
-#undef _STLP_NO_NEW_C_HEADERS
-#define _STLP_NO_NEW_C_HEADERS
-
-// exception handling support: only on evc4 and user added /GX to project settings
-#if defined (_STLP_WCE_EVC3) || !defined (_CPPUNWIND)
-# define _STLP_NO_EXCEPTION_HEADER
-# define _STLP_NO_EXCEPTIONS
-# undef _STLP_USE_EXCEPTIONS
-# ifndef __THROW_BAD_ALLOC
-# define __THROW_BAD_ALLOC { _STLP_WINCE_TRACE(L"out of memory"); ExitThread(1); }
-# endif
-#endif
-
-#define _STLP_WINCE_TRACE(msg) OutputDebugString(msg)
-
-/*
- * eMbedded Visual C++ .NET specific settings
- */
-#if defined (_STLP_WCE_NET)
-
-// evc4 has no locale and time support
-# define _STLP_NO_LOCALE_SUPPORT
-# define _STLP_NO_TIME_SUPPORT
-
-// ptrdiff_t is not defined in evc4 headers
-# ifndef _PTRDIFF_T_DEFINED
- typedef int ptrdiff_t;
-# define _PTRDIFF_T_DEFINED
-# endif
-
-/*
- * Helper macros for including the native headers in cases where a file with
- * the same name also exists in the STLport include folder. The idea behind
- * this is that we first go up one directory and then down into a dir that
- * is only present in the native install but not in STLport.
- *
- */
-# if !defined (_STLP_NATIVE_INCLUDE_PATH)
-# if defined (_X86_)
-# if defined (_STLP_WCE_TARGET_PROC_SUBTYPE_EMULATOR)
-# define _STLP_NATIVE_INCLUDE_PATH ../Emulator
-# else
-# define _STLP_NATIVE_INCLUDE_PATH ../X86
-# endif
-# elif defined (_ARM_)
-# if _MSC_VER < 1400
- // eVC3/4
-# if defined (ARMV4)
-# define _STLP_NATIVE_INCLUDE_PATH ../Armv4
-# elif defined (ARMV4I)
-# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i
-# elif defined (ARMV4T)
-# define _STLP_NATIVE_INCLUDE_PATH ../Armv4t
-# else
-# error Unknown ARM SDK.
-# endif
-# else
- // VC8 crosscompiling for CE
-# if defined (ARMV4)
-# define _STLP_NATIVE_INCLUDE_PATH ../Armv4
-# elif defined(ARMV4I) || defined(ARMV4T)
-# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i
-# else
-# error Unknown ARM SDK.
-# endif
-# endif
-# elif defined (_MIPS_)
-# if defined (MIPS16)
-# define _STLP_NATIVE_INCLUDE_PATH ../mips16
-# elif defined (MIPSII)
-# define _STLP_NATIVE_INCLUDE_PATH ../mipsII
-# elif defined (MIPSII_FP)
-# define _STLP_NATIVE_INCLUDE_PATH ../mipsII_fp
-# elif defined (MIPSIV)
-# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV
-# elif defined (MIPSIV_FP)
-# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV_fp
-# else
-# error Unknown MIPS SDK.
-# endif
-# elif defined (SHx)
-# if defined (SH3)
-# define _STLP_NATIVE_INCLUDE_PATH ../sh3
-# elif defined (SH4)
-# define _STLP_NATIVE_INCLUDE_PATH ../sh4
-# else
-# error Unknown SHx SDK.
-# endif
-# else
-# error Unknown SDK.
-# endif
-# endif /* !_STLP_NATIVE_INCLUDE_PATH */
-
-/* Workaround when using MFCCE and using <new> together: MFCCE's wcealt.h doesn't
- * check for __PLACEMENT_NEW_INLINE before defining operator new, so when <new>
- * defines the operatore before, there will be an error C2084:
- * "function 'void *__cdecl operator new(unsigned int,void *)' already has a body".
- */
-# ifdef _STLP_USE_MFC
-# define __PLACEMENT_NEW_INLINE
-# endif
-
-#endif /* _STLP_WCE_NET */
-
-/* Workaround in _windows.h needs native headers access macros
- * to be defined */
-#include <stl/config/_native_headers.h>
-
-/*
- * eMbedded Visual C++ 3.0 specific settings
- */
-#if defined (_STLP_WCE_EVC3)
-
-# define _STLP_NO_NATIVE_MBSTATE_T
-
-// evc3 has no locale and time support
-# define _STLP_NO_LOCALE_SUPPORT
-# define _STLP_NO_TIME_SUPPORT
-
-// evc3 has new, but no explicit header
-# define _STLP_NO_NEW_HEADER
-# define _STLP_NO_NEW_NEW_HEADER
-
-// evc3 has no bad_alloc and no typeinfo
-# undef _STLP_NO_BAD_ALLOC
-# define _STLP_NO_BAD_ALLOC
-
-# undef _STLP_NO_TYPEINFO
-# define _STLP_NO_TYPEINFO
-
-// missing things in eMbedded Visual C++ 3.0 headers
-# ifndef _SIZE_T_DEFINED
- typedef unsigned int size_t;
-# define _SIZE_T_DEFINED
-# endif
-
-# ifndef _WCHAR_T_DEFINED
- typedef unsigned short wchar_t;
-# define _WCHAR_T_DEFINED
-# endif
-
-// ptrdiff_t is not defined in evc3 headers
-# ifndef _PTRDIFF_T_DEFINED
- typedef int ptrdiff_t;
-# define _PTRDIFF_T_DEFINED
-# endif
-
-// clock_t is not defined in evc3 headers
-# ifndef _CLOCK_T_DEFINED
- typedef long clock_t;
-# define _CLOCK_T_DEFINED
-# endif
-
-// Struct tm is not defined in evc3 headers
-# ifndef _TM_DEFINED
-struct tm {
- int tm_sec; /* seconds after the minute - [0,59] */
- int tm_min; /* minutes after the hour - [0,59] */
- int tm_hour; /* hours since midnight - [0,23] */
- int tm_mday; /* day of the month - [1,31] */
- int tm_mon; /* months since January - [0,11] */
- int tm_year; /* years since 1900 */
- int tm_wday; /* days since Sunday - [0,6] */
- int tm_yday; /* days since January 1 - [0,365] */
- int tm_isdst; /* daylight savings time flag */
-};
-# define _TM_DEFINED
-# endif
-
-// define placement new and delete operator
-// note: when MFCCE headers are included first, don't define the new operator,
-// since it was already defined in wcealt.h
-# ifdef __cplusplus
-# ifndef __PLACEMENT_NEW_INLINE
-# ifndef _MFC_VER
-inline void *__cdecl operator new(size_t, void *_P) { return (_P); }
-# endif /* _MFC_VER */
-inline void __cdecl operator delete(void *, void *) { return; }
-# define __PLACEMENT_NEW_INLINE
-# endif
-# endif /* __cplusplus */
-
-// evc3 doesn't have native wide functions, e.g. fgetwc, wmemmove
-# define _STLP_NO_NATIVE_WIDE_FUNCTIONS
-
-// evc3 doesn't have assert.h
-# ifndef _ASSERT_DEFINED
-# define assert(expr) _STLP_ASSERT(expr)
-# define _ASSERT_DEFINED
-# endif
-
-#endif /* _STLP_WCE_EVC3 */
-
-// Minimize windows.h includes
-#if !defined (WIN32_LEAN_AND_MEAN)
-# define WIN32_LEAN_AND_MEAN
-#endif
-#if !defined (VC_EXTRALEAN)
-# define VC_EXTRALEAN
-#endif
-#if !defined (STRICT)
-# define STRICT
-#endif
-
-// Don't let windows.h define its min and max macros.
-#if !defined (NOMINMAX)
-# define NOMINMAX
-#endif
-
-/*
- * original call: TerminateProcess(GetCurrentProcess(), 0);
- * we substitute the GetCurrentProcess() with the result of the inline function
- * defined in kfuncs.h, since we then can avoid including <windows.h> at all.
- * all needed Win32 API functions are defined in <stl/_windows.h>
- */
-#ifndef _ABORT_DEFINED
-# define _STLP_ABORT() TerminateProcess(reinterpret_cast<HANDLE>(66), 0)
-# define _ABORT_DEFINED
-#endif
-
-// Notice: windows.h isn't included here anymore; all needed defines are in
-// stl/_windows.h now
-
-#endif /* _STLP_EVC_H */
diff --git a/stl/config/_freebsd.h b/stl/config/_freebsd.h
deleted file mode 100644
index 1bb6b58..0000000
--- a/stl/config/_freebsd.h
+++ /dev/null
@@ -1 +0,0 @@
-#define _STLP_PLATFORM "Free BSD"
diff --git a/stl/config/_gcc.h b/stl/config/_gcc.h
deleted file mode 100644
index 8dae452..0000000
--- a/stl/config/_gcc.h
+++ /dev/null
@@ -1,462 +0,0 @@
-/* STLport configuration file
- * It is internal STLport header - DO NOT include it directly
- */
-
-#define _STLP_COMPILER "gcc"
-
-/* Systems having GLIBC installed have different traits */
-#if defined (__linux__)
-# ifndef _STLP_USE_GLIBC
-# define _STLP_USE_GLIBC 1
-# endif
-# if defined (__UCLIBC__) && !defined (_STLP_USE_UCLIBC)
-# define _STLP_USE_UCLIBC 1
-# endif
-#endif
-
-#if defined (__CYGWIN__) && \
- (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 3) && !defined (_GLIBCPP_USE_C99)
-# define _STLP_NO_VENDOR_MATH_L
-# define _STLP_NO_VENDOR_STDLIB_L
-#endif
-
-#if (__GNUC__ < 3)
-# define _STLP_NO_VENDOR_STDLIB_L
-#endif
-
-/* We guess if we are using the cygwin distrib that has a special include schema.
- * There is no way to distinguish a cygwin distrib used in no-cygwin mode from a
- * mingw install. We are forced to use a configuration option
- */
-#if !defined (_STLP_NATIVE_INCLUDE_PATH) && \
- (defined (__CYGWIN__) || defined (__MINGW32__) && defined (_STLP_NO_CYGWIN))
-# if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 3))
-# define _STLP_NATIVE_INCLUDE_PATH ../../../__GNUC__.__GNUC_MINOR__.__GNUC_PATCHLEVEL__/include/c++
-# elif defined (_STLP_NO_CYGWIN)
-# define _STLP_NATIVE_INCLUDE_PATH ../mingw
-/*# else
- * Before version gcc 3.4, the cygwin package include path was conform to the
- * GNU convention which is set later in this file.
- */
-# endif
-#endif
-
-#if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 4))
-/* define for gcc versions before 3.4.0. */
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD
-#endif
-
-/* azov: gcc on lynx have a bug that causes internal
- * compiler errors when compiling STLport with namespaces turned on.
- * When the compiler gets better - comment out _STLP_HAS_NO_NAMESPACES
- */
-#if defined (__Lynx__) && (__GNUC__ < 3)
-# define _STLP_HAS_NO_NAMESPACES 1
-# define _STLP_NO_STATIC_TEMPLATE_DATA 1
-/* turn off useless warning about including system headers */
-# define __NO_INCLUDE_WARN__ 1
-#endif
-
-/* Tru64 Unix, AIX, HP : gcc there by default uses native ld and hence cannot auto-instantiate
- static template data. If you are using GNU ld, please say so in user_config.h header */
-#if (__GNUC__ < 3) && !defined(_STLP_GCC_USES_GNU_LD) && \
- ((defined (__osf__) && defined (__alpha__)) || defined (_AIX) || defined (__hpux) || defined(__amigaos__) )
-# define _STLP_NO_STATIC_TEMPLATE_DATA
-#endif
-
-#if !defined (_REENTRANT) && (defined (_THREAD_SAFE) || \
- (defined (__OpenBSD__) && defined (_POSIX_THREADS)) || \
- (defined (__MINGW32__) && defined (_MT)))
-# define _REENTRANT
-#endif
-
-#if defined (__DJGPP)
-# define _STLP_RAND48 1
-# define _NOTHREADS 1
-# undef _PTHREADS
-# define _STLP_LITTLE_ENDIAN
-#endif
-
-#if defined (__MINGW32__)
-/* Mingw32, egcs compiler using the Microsoft C runtime */
-# define _STLP_VENDOR_GLOBAL_CSTD
-# undef _STLP_NO_DRAND48
-# define _STLP_NO_DRAND48
-# define _STLP_CALL
-
-# if defined (_STLP_NEW_PLATFORM_SDK)
-/* For the moment the Windows SDK coming with Mingw still mimik the old platform SDK. */
-# undef _STLP_NEW_PLATFORM_SDK
-# endif
-#endif /* __MINGW32__ */
-
-#if defined (__CYGWIN__) || defined (__MINGW32__)
-# if !defined (_STLP_USE_STATIC_LIB)
-# define _STLP_USE_DECLSPEC 1
-# if !defined (_STLP_USE_DYNAMIC_LIB)
-# define _STLP_USE_DYNAMIC_LIB
-# endif
-# define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
-# define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
-# define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
-# endif
-/* The following is defined independently of _STLP_USE_STATIC_LIB because it is also
- * used to import symbols from PSDK under MinGW
- */
-# define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
-#endif
-
-#if defined (__CYGWIN__) || defined (__MINGW32__) || !(defined (_STLP_USE_GLIBC) || defined (__sun) || defined(__APPLE__))
-# if !defined (__MINGW32__) && !defined (__CYGWIN__)
-# define _STLP_NO_NATIVE_MBSTATE_T 1
-# endif
-# if !defined (__MINGW32__) || (__GNUC__ < 3) || (__GNUC__ == 3) && (__GNUC_MINOR__ < 4)
-# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
-# endif
-# define _STLP_NO_NATIVE_WIDE_STREAMS 1
-#endif
-
-#define _STLP_NORETURN_FUNCTION __attribute__((noreturn))
-
-/* Mac OS X is a little different with namespaces and cannot instantiate
- * static data members in template classes */
-#if defined (__APPLE__)
-# if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3)))
-/* Mac OS X is missing a required typedef and standard macro */
-typedef unsigned int wint_t;
-# endif
-
-# define __unix
-
-# if (__GNUC__ < 3)
-
- /* Mac OS X needs one and only one source file to initialize all static data
- * members in template classes. Only one source file in an executable or
- * library can declare instances for such data members, otherwise duplicate
- * symbols will be generated. */
-
-# define _STLP_NO_STATIC_TEMPLATE_DATA
-# define _STLP_STATIC_CONST_INIT_BUG 1
-# define _STLP_STATIC_TEMPLATE_DATA 0
-# define _STLP_WEAK_ATTRIBUTE 1
- /* Workaround for the broken Mac OS X C++ preprocessor which cannot handle
- * parameterized macros in #include statements */
-# define _STLP_NATIVE_HEADER(header) <../g++/##header##>
-# define _STLP_NATIVE_C_HEADER(header) <../include/##header##>
-# define _STLP_NATIVE_CPP_C_HEADER(header) <../g++/##header##>
-# define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <../g++/##header##>
-# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../g++/##header##>
-# endif /* __GNUC__ < 3 */
-
-# define _STLP_NO_LONG_DOUBLE
-
-/* Mac OS X needs all "::" scope references to be "std::" */
-# define _STLP_USE_NEW_C_HEADERS
-
-# define _STLP_NO_VENDOR_STDLIB_L
-
-#endif /* __APPLE__ */
-
-
-#if defined(__BEOS__) && defined(__INTEL__)
-# define _STLP_NATIVE_HEADER(header) <../stlport/beos/##header##>
-# define _STLP_NATIVE_C_HEADER(header) <../stlport/beos/##header##>
-# define _STLP_NATIVE_CPP_C_HEADER(header) <../stlport/beos/##header##>
-# define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <../stlport/beos/##header##>
-# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../stlport/beos/##header##>
-# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
-# define _STLP_NO_NATIVE_WIDE_STREAMS 1
-/*
-# define _NOTHREADS 1
-*/
-# ifdef _PTHREADS
-# undef _PTHREADS
-# endif
-# ifdef _STLP_PTHREADS
-# undef _STLP_PTHREADS
-# endif
-# define _STLP_USE_STDIO_IO 1
-# define _STLP_USE_GLIBC 1
-#endif
-
-/* g++ 2.7.x and above */
-#define _STLP_LONG_LONG long long
-
-#ifdef _STLP_USE_UCLIBC
-/*
-# ifndef __DO_C99_MATH__
-*/
- /* No *f math fuctions variants (i.e. sqrtf, fabsf, etc.) */
-# define _STLP_NO_VENDOR_MATH_F
- /* No *l math fuctions variants (i.e. sqrtl, fabsl, etc.) */
-# define _STLP_NO_VENDOR_MATH_L
-# define _STLP_NO_LONG_DOUBLE
-/*
-# endif
-*/
-#endif
-
-#if defined (__OpenBSD__) || defined (__FreeBSD__)
-# define _STLP_NO_VENDOR_MATH_L
-# define _STLP_NO_VENDOR_STDLIB_L /* no llabs */
-# ifndef __unix
-# define __unix
-# endif
-#endif
-
-#if defined (__alpha__)
-# define _STLP_NO_VENDOR_MATH_L
-# define _STLP_NO_IEC559_SUPPORT
-#endif
-
-#if defined (__hpux)
-# define _STLP_NO_VENDOR_STDLIB_L /* no llabs */
- /* No *f math fuctions variants (i.e. sqrtf, fabsf, etc.) */
-# define _STLP_NO_VENDOR_MATH_F
-#endif
-
-#if (__GNUC__ >= 3)
-# ifndef _STLP_HAS_NO_NEW_C_HEADERS
-/*
-# ifndef _STLP_USE_UCLIBC
-*/
-# define _STLP_HAS_NATIVE_FLOAT_ABS
-/*
-# endif
-*/
-# else
-# ifdef _STLP_USE_GLIBC
-# define _STLP_VENDOR_LONG_DOUBLE_MATH 1
-# endif
-# endif
-#endif
-
-#if (__GNUC__ < 3)
-# define _STLP_HAS_NO_NEW_C_HEADERS 1
-# define _STLP_VENDOR_GLOBAL_CSTD 1
-# define _STLP_DONT_USE_PTHREAD_SPINLOCK 1
-# ifndef __HONOR_STD
-# define _STLP_VENDOR_GLOBAL_EXCEPT_STD 1
-# endif
-/* egcs fails to initialize builtin types in expr. like this : new(p) char(); */
-# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
-#endif
-
-/*
-#define _STLP_VENDOR_GLOBAL_CSTD 1
-*/
-
-#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95)
-# define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
-# define _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
-# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
-#elif !defined (ANDROID)
-// Don't drag in these externals on Android.
-# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
-# undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
-#endif
-
-#if (__GNUC_MINOR__ < 9) && (__GNUC__ < 3) /* gcc 2.8 */
-# define _STLP_NO_TEMPLATE_CONVERSIONS
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
-# define _STLP_NO_FRIEND_TEMPLATES 1
-# define _STLP_HAS_NO_NAMESPACES 1
-# define _STLP_NO_METHOD_SPECIALIZATION 1
-# define _STLP_NO_MEMBER_TEMPLATES 1
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
-# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
-/* DJGPP doesn't seem to implement it in 2.8.x */
-# ifdef DJGPP
-# define _STLP_NO_STATIC_TEMPLATE_DATA 1
-# endif
-#endif
-
-#if __GNUC__ <= 2 && __GNUC_MINOR__ <= 7 && !defined (__CYGWIN32__)
-/* Will it work with 2.6 ? I doubt it. */
-# if ( __GNUC_MINOR__ < 6 )
-__GIVE_UP_WITH_STL(GCC_272);
-# endif
-
-# define _STLP_NO_RELOPS_NAMESPACE
-# define _STLP_NON_TYPE_TMPL_PARAM_BUG
-# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
-# define _STLP_DEFAULT_TYPE_PARAM 1
-# define _STLP_NO_BAD_ALLOC
-# define _STLP_NO_ARROW_OPERATOR 1
-# ifndef _STLP_NO_STATIC_TEMPLATE_DATA
-# define _STLP_NO_STATIC_TEMPLATE_DATA
-# endif
-# define _STLP_STATIC_CONST_INIT_BUG 1
-# define _STLP_NO_METHOD_SPECIALIZATION 1
-
-# if !defined (__CYGWIN32__)
-# define _STLP_NESTED_TYPE_PARAM_BUG 1
-# define _STLP_BASE_MATCH_BUG 1
-/* unused operators are required (forward) */
-# define _STLP_CONST_CONSTRUCTOR_BUG
-# define _STLP_NO_DEFAULT_NON_TYPE_PARAM
-# endif
-# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
-# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
-# define _STLP_NO_EXCEPTION_HEADER 1
-#else /* ! <= 2.7.* */
-#endif /* ! <= 2.7.* */
-
-/* static template data members workaround strategy for gcc tries
- * to use weak symbols.
- * if you don't want to use that, #define _STLP_WEAK_ATTRIBUTE=0 ( you'll
- * have to put "#define __PUT_STATIC_DATA_MEMBERS_HERE" line in one of your
- * compilation unit ( or CFLAGS for it ) _before_ including any STL header ).
- */
-#if defined (_STLP_NO_STATIC_TEMPLATE_DATA) && ! defined (_STLP_WEAK_ATTRIBUTE )
-/* systems using GNU ld or format that supports weak symbols
- may use "weak" attribute
- Linux & Solaris ( x86 & SPARC ) are being auto-recognized here */
-# if defined(_STLP_GNU_LD) || defined(__ELF__) || defined (__CYGWIN__) || \
- (( defined (__SVR4) || defined ( __svr4__ )) && \
- ( defined (sun) || defined ( __sun__ )))
-# define _STLP_WEAK_ATTRIBUTE 1
-# endif
-#endif /* _STLP_WEAK_ATTRIBUTE */
-
-
-/* strict ANSI prohibits "long long" ( gcc) */
-#if defined ( __STRICT_ANSI__ )
-# undef _STLP_LONG_LONG
-/*
-# define _STLP_STRICT_ANSI 1
-*/
-#endif
-
-/*
-#if !defined (__STRICT_ANSI__) || defined (__BUILDING_STLPORT)
-# define _STLP_USE_TEMPLATE_EXPORT
-# define _STLP_EXPORT_TEMPLATE_KEYWORD extern
-# define _STLP_IMPORT_TEMPLATE_KEYWORD extern
-#endif
-*/
-
-#ifndef __EXCEPTIONS
-# undef _STLP_DONT_USE_EXCEPTIONS
-# define _STLP_DONT_USE_EXCEPTIONS 1
-#endif
-
-#if (__GNUC__ >= 3)
-
-# if !defined (_STLP_NATIVE_INCLUDE_PATH)
-# if ( (__GNUC__ == 3 ) && ((__GNUC_MINOR__ == 0) || ((__GNUC_MINOR__ < 3) && defined(__APPLE_CC__))))
-# define _STLP_NATIVE_INCLUDE_PATH ../g++-v3
-# else
-# if ( ((__GNUC__ == 4 ) || (__GNUC_MINOR__ >= 3)) && defined(__APPLE_CC__))
-# define _STLP_NATIVE_INCLUDE_PATH ../c++
-/*
-* Before version 3.4.0 the 0 patch level was not part of the include path:
-*/
-# elif defined (__GNUC_PATCHLEVEL__) && ((__GNUC_PATCHLEVEL__ > 0) || \
- (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ > 3))
-# define _STLP_NATIVE_INCLUDE_PATH ../__GNUC__.__GNUC_MINOR__.__GNUC_PATCHLEVEL__
-# else
-# define _STLP_NATIVE_INCLUDE_PATH ../__GNUC__.__GNUC_MINOR__
-# endif
-# endif
-# endif
-
-/* Instantiation scheme that used (default) in gcc 3 made void of sense explicit
- instantiation within library: nothing except increased library size. - ptr
- */
-# define _STLP_NO_FORCE_INSTANTIATE
-
-#elif (__GNUC_MINOR__ < 8)
-
-# if !defined (_STLP_NATIVE_INCLUDE_PATH)
-# define _STLP_NATIVE_INCLUDE_PATH ../g++-include
-# endif
-
-/* tuning of static template data members workaround */
-# if ( _STLP_STATIC_TEMPLATE_DATA < 1 )
-# if ( _STLP_WEAK_ATTRIBUTE > 0 )
-# define _STLP_WEAK __attribute__ (( weak ))
-# else
-# define _STLP_WEAK
-# endif /* _STLP_WEAK_ATTRIBUTE */
-
-# ifdef __PUT_STATIC_DATA_MEMBERS_HERE
-# define __DECLARE_INSTANCE(type,item,init) type item _STLP_WEAK init
-# else
-# define __DECLARE_INSTANCE(type,item,init)
-# endif /* __PUT_STATIC_DATA_MEMBERS_HERE */
-# endif /* _STLP_STATIC_TEMPLATE_DATA */
-
-#else
-
-/* gcc-2.95.0 used to use "g++-3" directory which has been changed to "g++" in
- * system-dependent "include" for 2.95.2 except for Cygwin and Mingw packages.
- * I expect "g++-3" not being used in later releases.
- * If your installation use "g++-3" include directory for any reason (pre-2.95.2 or Win binary kit),
- * please change the macro below to point to your directory.
- */
-
-# if !defined (_STLP_NATIVE_INCLUDE_PATH)
-# if defined(__DJGPP)
-# define _STLP_NATIVE_INCLUDE_PATH ../lang/cxx
-# elif (__GNUC__ >= 3) || (__GNUC_MINOR__ >= 97)
-# define _STLP_NATIVE_INCLUDE_PATH ../include/g++-v3
-# elif ((__GNUC_MINOR__ >= 95 && __GNUC_MINOR__ < 97) && \
- !( defined (__FreeBSD__) || defined (__NetBSD__) || defined(__sgi) || defined (__OS2__) ) )
-# define _STLP_NATIVE_INCLUDE_PATH ../g++-3
-# elif (__GNUC_MINOR__ > 8) && (__GNUC_MINOR__ < 95) && (__GNUC__ < 3) && !defined( __Lynx__ )
-/* this really sucks, as GNUpro does not really identifies itself, so we have to guess
- * depending on a platform
- */
-# ifdef __hpux
-# define _STLP_NATIVE_INCLUDE_PATH ../g++-3
-# else
-# define _STLP_NATIVE_INCLUDE_PATH ../g++-2
-# endif
-# else
-# define _STLP_NATIVE_INCLUDE_PATH g++
-# endif
-# endif
-
-/* <exception> et al */
-# ifdef __FreeBSD__
-# if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
-# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../include
-# endif
-# else
-/* azov */
-# ifndef __Lynx__
-# if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)
-/*
-# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../g++-v3
-*/
-# else
-# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../include
-# endif
-# endif
-# endif
-
-#endif /* GNUC_MINOR < 8 */
-
-#if !defined (_STLP_NATIVE_C_INCLUDE_PATH)
-# define _STLP_NATIVE_C_INCLUDE_PATH ../include
-#endif
-
-/* Tune settings for the case where static template data members are not
- * instaniated by default
- */
-#if defined ( _STLP_NO_STATIC_TEMPLATE_DATA )
-# define _STLP_STATIC_TEMPLATE_DATA 0
-# if !defined ( _STLP_WEAK_ATTRIBUTE )
-# define _STLP_WEAK_ATTRIBUTE 0
-# endif
-# ifdef __PUT_STATIC_DATA_MEMBERS_HERE
-# define __DECLARE_INSTANCE(type,item,init) type item init
-# else
-# define __DECLARE_INSTANCE(type,item,init)
-# endif
-#else
-# define _STLP_STATIC_TEMPLATE_DATA 1
-#endif
diff --git a/stl/config/_hpacc.h b/stl/config/_hpacc.h
deleted file mode 100644
index 2cc5cc4..0000000
--- a/stl/config/_hpacc.h
+++ /dev/null
@@ -1,196 +0,0 @@
-// STLport configuration file
-// It is internal STLport header - DO NOT include it directly
-
-#define _STLP_COMPILER "Acc"
-
-// system C-library dependent
-#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
-# define _STLP_RAND48 1
-#endif
-// # define _STLP_RAND48 1
-#define _STLP_NO_NATIVE_MBSTATE_T 1
-#define _STLP_HPACC_BROKEN_BUFEND 1
-#define _STLP_WCHAR_HPACC_EXCLUDE 1
-
-// this was reported to help, just as with SUN CC 4.2
-#define _STLP_INLINE_STRING_LITERAL_BUG
-
-// specific prolog is needed to select correct threads impl
-#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
-
-// HP aCC with +noeh
-#ifdef __HPACC_NOEH
-# define _STLP_HAS_NO_EXCEPTIONS 1
-#endif
-
-// HP compilers
-// At that point, we only know we are on HP (and _not_ using gcc,
-// according to "stlcomp.h"
-
-// __HP_aCC indicate HP ANSI C++, but not always (03.xx does not
-// define it before 3.13, for example).
-//
-#if defined (__HP_aCC)
-
-# define _STLP_NO_FORCE_INSTANTIATE
-# define _STLP_LONG_LONG long long
-# define _STLP_NO_VENDOR_STDLIB_L
-
-# if (__HP_aCC <= 30000 && __HP_aCC >= 12100)
-
-//Special kludge to workaround bug in aCC A.01.23, CR JAGac40634
-# ifdef _STLP_DEBUG
-static void _STLP_dummy_literal() { const char *p = "x";}
-static void _STLP_dummy_literal_2() { const char *p = "123456789"; }
-static void _STLP_dummy_literal_3() { const char *p = "123456700000000000000089";}
-# endif
-
-# define _STLP_HP_ACC 0123
-# define _STLP_NATIVE_INCLUDE_PATH ../include
-# define _STLP_VENDOR_GLOBAL_STD 1
-# define _STLP_VENDOR_GLOBAL_CSTD 1
-# define _STLP_DONT_THROW_RANGE_ERRORS 1
-# define _STLP_STATIC_CONST_INIT_BUG 1
-# if (__HP_aCC < 12700)
-//new flag: on most HP compilers cwchar is missing
-# define _STLP_NO_CWCHAR
-# endif
-
-# define _STLP_FORCE_ALLOCATORS(t,a) \
- typedef typename _Alloc_traits<t,a>::_Orig _STLP_dummy_type1;\
- typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind<t>::other _STLP_dummy_type2;
-
-# endif /* 123 */
-
-// latest version and up
-# if (__HP_aCC >= 32500 )
-# define _STLP_HP_ACC 0325
-
-# define _STLP_USE_NEW_C_HEADERS
-
-# define _STLP_FORCE_ALLOCATORS(t,a) \
- typedef typename _Alloc_traits<t,a>::_Orig _STLP_dummy_type1;\
- typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind<t>::other _STLP_dummy_type2;
-
-# if !defined ( _INCLUDE__STDC_A1_SOURCE ) // HP-UX 11i only
-# define _STLP_HAS_NO_UNIX98_WCHAR_EXTENSIONS
-# endif
-
-# if defined (_HP_NAMESPACE_STD) // option -AA
-// from now, we have a full standard lib in namespace std
-//
-// -AA indicates that we are compiling against Rogue Wave 2.2.1
-// STL shipped with the HP aCC compiler. -AA tells the compiler
-// to use the STL defined in the include_std directory.
-//
-# define _STLP_NATIVE_INCLUDE_PATH ../include_std
-
-// # define _STLP_HPACC_ONLY_NATIVE_STRING 1 // STLPort _string.c includes <locale>
-# define _STLP_HP_ACC_COMPAT -1
-# else // option -Aa
-# define _STLP_NATIVE_INCLUDE_PATH ../include
-# define _STLP_VENDOR_GLOBAL_STD 1
-# define _STLP_VENDOR_GLOBAL_CSTD 1
-# define _STLP_DONT_THROW_RANGE_ERRORS 1
-# endif /* _NAMESPACE_STD */
-# endif
-
-# if (__HP_aCC >= 31400 && __HP_aCC < 32500)
-# define _STLP_HP_ACC 0314
-
-# define _STLP_FORCE_ALLOCATORS(t,a) \
-typedef typename _Alloc_traits<t,a>::_Orig _STLP_dummy_type1;\
-typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind<t>::other _STLP_dummy_type2;
-# define _STLP_NO_CWCHAR
-# if defined (_NAMESPACE_STD) // option -AA
-// from now, we have a full standard lib in namespace std
-# define _STLP_NATIVE_INCLUDE_PATH ../include_std
-//# define _STLP_HPACC_ONLY_NATIVE_STRING 1 // STLPort _string.c includes <locale>
-# define _STLP_HP_ACC_COMPAT -1
-# else // kind of compatibility mode
-# define _STLP_NATIVE_INCLUDE_PATH ../include
-# define _STLP_VENDOR_GLOBAL_STD 1
-# define _STLP_VENDOR_GLOBAL_CSTD 1
-# define _STLP_DONT_THROW_RANGE_ERRORS 1
-# define _STLP_NO_ROPE 1
-# endif /* _NAMESPACE_STD */
-# endif /* 314 */
-
-# if ((__HP_aCC >= 30000 && __HP_aCC < 31400) || (__HP_aCC == 1)) // A.03.13: __HP_aCC == 1
-
-# if (__HP_aCC != 1)
-# define _STLP_HAS_NO_NEW_C_HEADERS 1
-# endif
-
-# define _STLP_NO_QUALIFIED_FRIENDS 1
-// aCC bug ? need explicit args on constructors of partial specialized
-// classes
-# define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS 1
-// ?? fbp : maybe present in some versions ?
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-// <exception> and stuff is in global namespace
-# define _STLP_VENDOR_GLOBAL_EXCEPT_STD
-// fbp : moved here
-# define _STLP_VENDOR_GLOBAL_CSTD 1
-// # define _INCLUDE_HPUX_SOURCE
-# define _XPG4
-# define _INCLUDE_XOPEN_SOURCE
-# define _INCLUDE_AES_SOURCE
-# endif /* < 314 */
-# if __HP_aCC == 1
-# define _STLP_BROKEN_USING_IN_CLASS
-# define _STLP_USING_BASE_MEMBER
-# define _STLP_NO_CWCHAR
-// # define _STLP_NO_WCHAR_T 1
-# endif
-#endif /* HP_ACC */
-
-//
-#ifndef __HP_aCC
-# define _STLP_NATIVE_INCLUDE_PATH ../CC
-# define _STLP_NATIVE_C_INCLUDE_PATH ../include
-// it is HP's old cfront-based compiler.
-# define _STLP_NO_BOOL 1
-// # define _STLP_DONT_USE_BOOL_TYPEDEF 1
-# define _STLP_NO_NEW_NEW_HEADER 1
-# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
-# define _STLP_NO_SIGNED_BUILTINS
-# define _STLP_HAS_NO_NAMESPACES 1
-# define _STLP_NEED_TYPENAME 1
-# define _STLP_NEED_EXPLICIT 1
-# define _STLP_NO_EXCEPTION_SPEC 1
-# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
-# define _STLP_NO_ARROW_OPERATOR 1
-# define _STLP_BASE_MATCH_BUG
-# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
-# define _STLP_NO_NEW_STYLE_CASTS 1
-// # define _STLP_NO_WCHAR_T 1
-// # define _STLP_LONG_LONG long long
-# define _STLP_NEED_MUTABLE 1
-# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
-# define _STLP_NO_BAD_ALLOC 1
-# define _STLP_NO_MEMBER_TEMPLATES 1
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-# define _STLP_NO_FRIEND_TEMPLATES 1
-# define _STLP_NO_QUALIFIED_FRIENDS 1
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
-# define _STLP_MEMBER_POINTER_PARAM_BUG 1
-# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
-# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
-// # define _STLP_NO_METHOD_SPECIALIZATION 1
-# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
-# define _STLP_NO_EXCEPTION_HEADER 1
-# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
-# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
-# define _STLP_HAS_NO_NEW_C_HEADERS 1
-// # define _STLP_STATIC_CONST_INIT_BUG 1
-// # define _STLP_THROW_RETURN_BUG 1
-// # define _STLP_LINK_TIME_INSTANTIATION 1
-// # define _STLP_NO_TEMPLATE_CONVERSIONS 1
-# define _STLP_NO_TYPEINFO 1
-# define _STLP_WCHAR_T_IS_USHORT 1
-
-#endif /* cfront */
diff --git a/stl/config/_hpux.h b/stl/config/_hpux.h
deleted file mode 100644
index 1a67c08..0000000
--- a/stl/config/_hpux.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __stl_config__hpux_h
-#define __stl_config__hpux_h
-
-#define _STLP_PLATFORM "HP Unix"
-
-#ifdef __GNUC__
-# define _STLP_NO_WCHAR_T
-# define _STLP_NO_LONG_DOUBLE
-#endif
-
-#endif /* __stl_config__hpux_h */
diff --git a/stl/config/_ibm.h b/stl/config/_ibm.h
deleted file mode 100644
index 96c504c..0000000
--- a/stl/config/_ibm.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* STLport configuration file
- * It is internal STLport header - DO NOT include it directly
- */
-
-#if defined (__IBMCPP__) || defined (__IBMC__)
-# define _STLP_COMPILER "Visual Age C++"
-#elif defined (__xlC__)
-# define _STLP_COMPILER "xlc"
-#else
-# error "Unknown compiler"
-#endif
-
-#if !defined(__IBMCPP__) || (__IBMCPP__ < 500)
-# define _STLP_HAS_NO_NEW_C_HEADERS 1
-#endif
-
-/* string literal problem, same as with SUN and aCC */
-# define _STLP_INLINE_STRING_LITERAL_BUG 1
-# define _STLP_HAS_NATIVE_FLOAT_ABS
-
-# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
-# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
-
-
-# ifdef __IBMCPP__
-# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
-# endif
-
-/* # if ( defined (__MULTI__) && defined (__WINDOWS__))
- * # define _STLP_WIN32THREADS 1 Only Visual Age 3.5 for Windows
- * # endif
- */
-
-# if ( defined (__MULTI__) && defined (__OS2__))
-# define _STLP_OS2THREADS 1
-# endif
-
-/* __TEMPINC__ is set when /Ft+ option is used */
-# ifdef __TEMPINC__
-# define _STLP_LINK_TIME_INSTANTIATION 1
-# endif
-
-# if defined (__MVS__)
-/* long long support is buggy - reported by Tinny Ng
- * # if __EXTENDED__ && __COMPILER_VER__ >= 0x22060000
- * # define _STLP_LONG_LONG long long
- * # endif
- */
-/* boris : hstash reported it can be treated like UNIX */
-# define _STLP_UNIX 1
-# define _STLP_NO_TYPEINFO 1
-# undef _STLP_NATIVE_INCLUDE_PATH
-# define _STLP_NATIVE_INCLUDE_PATH /usr/lpp/ioclib/include
-/* same for C headers like <string.h> */
-# undef _STLP_NATIVE_C_INCLUDE_PATH
-# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include
-# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH /usr/include
-
-# elif (defined (__WINDOWS__) || defined (_AIX) || defined (__OS2__) ) && (__IBMCPP__ >= 350)
-
-# define _STLP_LONG_LONG long long
-
-#endif
-
-#if !( defined( __xlC__ ) && __xlC__ >= 0x500 )
-
-/* AIX xlC 3.1 , 3.0.1 ==0x301
- * Visual Age C++ 3.x
- * OS-390 C++
- * fbp : should be more version-specific!
- */
-
-# define _STLP_NO_BOOL 1
-# define _STLP_DONT_USE_BOOL_TYPEDEF 1
-# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
-# define _STLP_HAS_NO_NAMESPACES 1
-# define _STLP_NEED_TYPENAME 1
-# define _STLP_NEED_EXPLICIT 1
-# define _STLP_NO_ARROW_OPERATOR 1
-# define _STLP_NO_NEW_STYLE_CASTS 1
-# define _STLP_NO_WCHAR_T 1
-# define _STLP_NEED_MUTABLE 1
-# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
-# define _STLP_NO_BAD_ALLOC 1
-
-# define _STLP_NO_MEMBER_TEMPLATES 1
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-# define _STLP_NO_FRIEND_TEMPLATES 1
-# define _STLP_NO_QUALIFIED_FRIENDS 1
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
-
-# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
-# define _STLP_NO_METHOD_SPECIALIZATION 1
-# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
-# define _STLP_NO_EXCEPTION_HEADER 1
-
-# define _STLP_NO_NEW_NEW_HEADER 1
-
-# if defined (__OS2__) && (__IBMCPP__ <= 350)
-# define _STLP_NO_TYPEINFO 1
-# endif
-# define _STLP_NO_NEW_NEW_HEADER 1
-
-# define _STLP_STATIC_CONST_INIT_BUG 1
-/* # define _STLP_THROW_RETURN_BUG 1 */
-
-
-# define _STLP_NO_TEMPLATE_CONVERSIONS 1
-# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
-
-/* AIX xlC, Visual Age 3.0 for OS/2 and MS */
-# define _STLP_TRIVIAL_DESTRUCTOR_BUG
-
-# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
-# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
-
-#if __IBMCPP__ <= 350
-# define _STLP_NEED_UNREACHABLE_RETURN 1
-#endif
-
-#if __IBMCPP__ < 350
-# define _STLP_NO_LONG_DOUBLE 1
-#endif
-
-#if __IBMCPP__ >= 365
-/* does not have new C headers, but has div() */
-# define _STLP_LDIV
-#endif
-
-#endif /* xlC 5 */
-
-/* detect xlC5 by: */
-#if defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 700)
-# define _STLP_USE_EXCEPTIONS 1
-# define _STLP_STATIC_CONST_INIT_BUG 1
-/* #pragma report(disable,CPPC1500029)
- * unsigned 32-bit integer type
- */
-# define _STLP_UINT32_T unsigned int
-# if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
-# define _STLP_RAND48 1
-# endif
-/* # define _STLP_RAND48 1 */
-#endif /* __IBMCPP__ == 500 */
diff --git a/stl/config/_intel.h b/stl/config/_intel.h
deleted file mode 100644
index af8022f..0000000
--- a/stl/config/_intel.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// STLport configuration file
-// It is internal STLport header - DO NOT include it directly
-
-#define _STLP_COMPILER "Intel ICL"
-
-#define _STLP_IMPORT_TEMPLATE_KEYWORD extern
-
-/* You need to undef following macro if your icl install is binded to MSVC 6
- * native lib and you are building with /Qvc7 or /Qvc7.1 or /Qvc8 option.
- */
-/* #define _STLP_MSVC_LIB 1200 */
-/* You need to undef following macro if your icl install is binded to MSVC .Net 2002
- * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7.1
- * or /Qvc8 option.
- */
-/* #define _STLP_MSVC_LIB 1300 */
-/* You need to undef following macro if your icl install is binded to MSVC .Net 2002
- * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7
- * or /Qvc8 option.
- */
-/* #define _STLP_MSVC_LIB 1310 */
-/* You need to undef following macro if your icl install is binded to MSVC .Net 2002
- * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7
- * or /Qvc7.1 option.
- */
-/* #define _STLP_MSVC_LIB 1400 */
-
-#include <stl/config/_msvc.h>
-
-#if defined (_STLP_DONT_RETURN_VOID)
-# undef _STLP_DONT_RETURN_VOID
-#endif
-
-#if (__ICL >= 900)
-/* # undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT */
-# if !defined (_STLP_DONT_USE_EXCEPTIONS)
-# define _STLP_NOTHROW throw()
-# endif
-#endif
-
-#if (__ICL <= 810)
-/* If method specialization is activated, compiler do not export some
- * symbols anymore.
- */
-# define _STLP_NO_METHOD_SPECIALIZATION 1
-#endif
-
-#if (__ICL >= 800)
-# define _STLP_STATIC_CONST_INIT_BUG 1
-#endif
-
-#if (__ICL >= 450)
-# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
-#endif
-
-#if (__ICL < 450)
-/* only static STLport lib works for ICL */
-# undef _STLP_USE_STATIC_LIB
-# undef _STLP_USE_DYNAMIC_LIB
-# define _STLP_USE_STATIC_LIB
-/* disable hook which makes template symbols to be searched for in the library */
-# undef _STLP_NO_CUSTOM_IO
-#endif
-
-#undef _STLP_LONG_LONG
-#define _STLP_LONG_LONG long long
-
-#if defined (__cplusplus) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
-namespace std
-{
- void _STLP_CALL unexpected();
-}
-#endif
diff --git a/stl/config/_kai.h b/stl/config/_kai.h
deleted file mode 100644
index 5b2bedb..0000000
--- a/stl/config/_kai.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// STLport config file for KAI C++ compiler
-
-#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
-# define _STLP_RAND48 1
-#endif
-
-# ifndef __KAI_STRICT /* _NO_LONGLONG */
-# define _STLP_LONG_LONG long long
-# endif
-
-# if !defined (__EXCEPTIONS) && ! defined (_EXCEPTIONS)
-# define _STLP_HAS_NO_EXCEPTIONS
-# endif
-
-# ifndef __BUILDING_STLPORT
-# define _STLP_LINK_TIME_INSTANTIATION 1
-# endif
-
-// two levels of macros do not work good with kcc.
-# define _STLP_NATIVE_HEADER(header) <../include/##header>
-# define _STLP_NATIVE_C_HEADER(header) <../include/##header>
-# define _STLP_NATIVE_CPP_C_HEADER(header) <../include/##header>
-# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/##header>
-
-# ifdef _WIN32
-# define _STLP_MINIMUM_IMPORT_STD
-# endif
-
-// KAI C++ uses EDG front-end, but apparently different switches
-// # define __EDG_SWITCHES 1
-
-
-# define _STLP_VENDOR_GLOBAL_CSTD 1
-# define _STLP_VENDOR_MB_NAMESPACE std
-
-// boris : some of those may also apply to KCC 3.4
-# if __KCC_VERSION < 4000
-# define _STLP_VENDOR_GLOBAL_EXCEPT_STD 1
-
-# endif
-
-# if defined (__sgi)
-// this requires some discrimination on whether we are actually on
-// a system officially supported by KAI.
-# define _STLP_HAS_NO_NEW_C_HEADERS 1
-# include <standards.h>
-# endif
-
diff --git a/stl/config/_linux.h b/stl/config/_linux.h
deleted file mode 100644
index 342cd8b..0000000
--- a/stl/config/_linux.h
+++ /dev/null
@@ -1,93 +0,0 @@
-#ifndef __stl_config__linux_h
-#define __stl_config__linux_h
-
-#define _STLP_PLATFORM "Linux"
-
-#include <features.h>
-
-/* This is defined wether library in use is glibc or not.
- This may be treated as presence of GNU libc compatible
- header files (these define is not really intended to check
- for the presence of a particular library, but rather is used
- to define an INTERFACE.) */
-#ifndef _STLP_USE_GLIBC
-# define _STLP_USE_GLIBC 1
-#endif
-
-#define _STLP_UNIX 1
-
-#if defined(_REENTRANT) && !defined(_PTHREADS)
-# define _PTHREADS
-#endif
-
-#ifdef __UCLIBC__ /* uClibc 0.9.27 */
-# define _STLP_USE_UCLIBC 1
-# if !defined(__UCLIBC_HAS_WCHAR__)
-# ifndef _STLP_NO_WCHAR_T
-# define _STLP_NO_WCHAR_T
-# endif
-# ifndef _STLP_NO_MBSTATE_T
-# define _STLP_NO_MBSTATE_T
-# endif
-# ifndef _STLP_NO_NATIVE_WIDE_STREAMS
-# define _STLP_NO_NATIVE_WIDE_STREAMS
-# endif
-# endif /* __UCLIBC_HAS_WCHAR__ */
- /* Hmm, bogus _GLIBCPP_USE_NAMESPACES seems undefined... */
-# define _STLP_VENDOR_GLOBAL_CSTD 1
-# if defined(_STLP_REAL_LOCALE_IMPLEMENTED)
- /* locale in uClibc is very restricted */
- /* recheck if __UCLIBC_HAS_LOCALE__ defined...*/
-# undef _STLP_REAL_LOCALE_IMPLEMENTED
-# endif
-#endif
-
-
-#if defined(_PTHREADS)
-# define _STLP_THREADS
-# define _STLP_PTHREADS
-/*
-# ifndef __USE_UNIX98
-# define __USE_UNIX98
-# endif
-*/
-/* This feature exist at least since glibc 2.2.4 */
-/* # define __FIT_XSI_THR */ /* Unix 98 or X/Open System Interfaces Extention */
-# ifdef __USE_XOPEN2K
-/* The IEEE Std. 1003.1j-2000 introduces functions to implement spinlocks. */
-# ifndef __UCLIBC__ /* There are no spinlocks in uClibc 0.9.27 */
-# define _STLP_USE_PTHREAD_SPINLOCK
-# else
-# ifndef _STLP_DONT_USE_PTHREAD_SPINLOCK
- /* in uClibc (0.9.26) pthread_spinlock* declared in headers
- * but absent in library */
-# define _STLP_DONT_USE_PTHREAD_SPINLOCK
-# endif
-# endif
-/* # define __FIT_PSHARED_MUTEX */
-# endif
-#endif
-
-/* Endiannes */
-#include <endian.h>
-#if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN) || !defined(__BIG_ENDIAN)
-# error "One of __BYTE_ORDER, __LITTLE_ENDIAN and __BIG_ENDIAN undefined; Fix me!"
-#endif
-
-#if ( __BYTE_ORDER == __LITTLE_ENDIAN )
-# define _STLP_LITTLE_ENDIAN 1
-#elif ( __BYTE_ORDER == __BIG_ENDIAN )
-# define _STLP_BIG_ENDIAN 1
-#else
-# error "__BYTE_ORDER neither __BIG_ENDIAN nor __LITTLE_ENDIAN; Fix me!"
-#endif
-
-#if defined(__GNUC__) && (__GNUC__ < 3)
-# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
-/*
-# define _STLP_NO_NATIVE_WIDE_STREAMS 1
-*/
-#endif
-
-
-#endif /* __stl_config__linux_h */
diff --git a/stl/config/_mac.h b/stl/config/_mac.h
deleted file mode 100644
index d80cc71..0000000
--- a/stl/config/_mac.h
+++ /dev/null
@@ -1 +0,0 @@
-#define _STLP_PLATFORM "Mac"
diff --git a/stl/config/_macosx.h b/stl/config/_macosx.h
deleted file mode 100644
index 3d3452b..0000000
--- a/stl/config/_macosx.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#define _STLP_PLATFORM "Mac OS X"
-
-#if defined (__BIG_ENDIAN__)
-# define _STLP_BIG_ENDIAN 1
-#elif defined (__LITTLE_ENDIAN__)
-# define _STLP_LITTLE_ENDIAN 1
-#endif
diff --git a/stl/config/_msvc.h b/stl/config/_msvc.h
deleted file mode 100644
index 7c5036f..0000000
--- a/stl/config/_msvc.h
+++ /dev/null
@@ -1,353 +0,0 @@
-/* STLport configuration file
- * It is internal STLport header - DO NOT include it directly
- * Microsoft Visual C++ 6.0, 7.0, 7.1, 8.0, ICL
- */
-
-#if !defined (_STLP_COMPILER)
-# define _STLP_COMPILER "Microsoft Visual Studio C++"
-#endif
-
-#if !defined (__ICL) && !defined (_STLP_MSVC)
-# define _STLP_MSVC _MSC_VER
-#endif
-
-#if !defined (_STLP_MSVC_LIB)
-# define _STLP_MSVC_LIB _MSC_VER
-#endif
-
-#if defined (__BUILDING_STLPORT) && defined (_MANAGED)
-/* Building a managed version of STLport is not supported because we haven't
- * found a good reason to support it. However, building a managed translation
- * unit using STLport _is_ supported.
- */
-# error Sorry but building a managed version of STLport is not supported.
-#endif
-
-#if defined (_STLP_USING_PLATFORM_SDK_COMPILER)
-/* This is a specific section for compilers coming with platform SDKs. Native
- * library coming with it is different from the one coming with commercial
- * MSVC compilers so there is some specific settings.
- */
-# define _STLP_NATIVE_INCLUDE_PATH ../crt
-# define _STLP_VENDOR_GLOBAL_CSTD
-# define _STLP_VENDOR_TERMINATE_STD
-# define _STLP_GLOBAL_NEW_HANDLER
-# if (_STLP_MSVC_LIB <= 1400)
-/* We hope this bug will be fixed in future versions. */
-# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
-# endif
-#endif
-
-#define _STLP_CALL __cdecl
-
-#ifndef _STLP_LONG_LONG
-# define _STLP_LONG_LONG __int64
-#endif
-
-#define _STLP_PRAGMA_ONCE
-
-/* These switches depend on compiler flags. We are hoping here that compilers
- * simulating MSVC behavior use identical macros to report compilation context.
- * Otherwise those macros will have to be undef in specific compiler configuration
- * files.
- */
-#ifndef _CPPUNWIND
-# define _STLP_DONT_USE_EXCEPTIONS 1
-#endif
-
-#ifndef _CPPRTTI
-# define _STLP_NO_RTTI 1
-#endif
-
-#if defined (_MT) && !defined (_STLP_NO_THREADS) && !defined (_REENTRANT)
-# define _REENTRANT 1
-#endif
-
-#if !defined (_NATIVE_WCHAR_T_DEFINED)
-# define _STLP_WCHAR_T_IS_USHORT 1
-#endif
-
-#define _STLP_MINIMUM_IMPORT_STD
-#define _STLP_NO_VENDOR_STDLIB_L 1
-
-#if defined (_STLP_MSVC)
-
-#define _STLP_NORETURN_FUNCTION __declspec(noreturn)
-
-/* Full compiler version comes from boost library intrinsics.hpp header. */
-# if defined (_MSC_FULL_VER) && (_MSC_FULL_VER >= 140050215)
-# define _STLP_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
-# define _STLP_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T)
-# define _STLP_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T)
-# define _STLP_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
-# define _STLP_IS_POD(T) __is_pod(T)
-# define _STLP_HAS_TYPE_TRAITS_INTRINSICS
-# endif
-
-# ifndef _STLP_MSVC50_COMPATIBILITY
-# define _STLP_MSVC50_COMPATIBILITY 1
-# endif
-
-# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
-# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG 1
-
-/* # ifndef __BUILDING_STLPORT
- * # define _STLP_USE_TEMPLATE_EXPORT 1
- * # endif
- */
-# if (_STLP_MSVC <= 1401)
-# define _STLP_STATIC_CONST_INIT_BUG 1
-# endif
-
-/** Note: the macro _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT is defined
-unconditionally and undef'ed here when applicable. */
-# if defined(UNDER_CE)
-/* eVCx:
-uncaught_exception is declared in the SDKs delivered with eVC4 (eVC3 is
-unknown) and they all reside in namespace 'std' there. However, they are not
-part of any lib so linking fails. When using VC8 to crosscompile for CE 5 on
-an ARMV4I, the uncaught_exception test fails, the function returns the wrong
-value. */
-# else
-/* VCx:
-These are present at least since VC6, but the uncaught_exception() of VC6 is
-broken, it returns the wrong value in the unittests. 7.1 and later seem to
-work, 7.0 is still unknown (we assume it works until negative report). */
-# if (_STLP_MSVC >= 1300)// VC7 and later
-# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
-# if !defined (_STLP_DONT_USE_EXCEPTIONS)
-# define _STLP_NOTHROW throw()
-# endif
-# endif
-# endif
-
-# if (_STLP_MSVC <= 1300)
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
-/* There is no partial spec, and MSVC breaks on simulating it for iterator_traits queries */
-# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
-# define _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER
-# define _STLP_NO_METHOD_SPECIALIZATION 1
-# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
-# define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1
-/* VC++ cannot handle default allocator argument in template constructors */
-# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
-# define _STLP_NO_QUALIFIED_FRIENDS 1
-# define _STLP_NO_FRIEND_TEMPLATES
-/* Fails to properly resolve call to sin() from within sin() */
-# endif
-
-# if (_STLP_MSVC < 1300)
-# define _STLP_NO_IEC559_SUPPORT 1
-# endif
-
-# if (_STLP_MSVC < 1300) /* including MSVC 6.0 */
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1
-# endif
-
-# if (_STLP_MSVC >= 1200)
-# define _STLP_HAS_NATIVE_FLOAT_ABS 1
-# endif
-
-// TODO: some eVC4 compilers report _MSC_VER 1201 or 1202, which category do they belong to?
-# if (_STLP_MSVC > 1200) && (_STLP_MSVC < 1310)
-# define _STLP_NO_MOVE_SEMANTIC
-# endif
-
-# if (_STLP_MSVC < 1300)
-/* TODO: remove this if it is handled and documented elsewhere
- * dums: VC6 do not handle correctly member templates of class that are explicitely
- * instanciated to be exported. There is a workaround, seperate the non template methods
- * from the template ones within 2 different classes and only export the non template one.
- * It is implemented for basic_string and locale at the writing of this note.
- * However this problem hos not been considered as important enough to remove template member
- * methods for other classes. Moreover Boost (www.boost.org) required it to be granted.
- * The workaround is activated thanks to the _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND macro defined
- * later in this config file.
- */
-/*
-# if defined (_DLL)
-# define _STLP_NO_MEMBER_TEMPLATES 1
-# endif
-*/
-
-/* Boris : not defining this macro for SP5 causes other problems */
-/*# if !defined (_MSC_FULL_VER) || (_MSC_FULL_VER < 12008804 ) */
-# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1
-/*# endif */
-# define _STLP_DONT_USE_BOOL_TYPEDEF 1
-# define _STLP_DONT_RETURN_VOID 1
-# endif
-
-/*
- * MSVC6 is known to have many trouble with namespace management but
- * MSVC .Net 2003 and 2005 also have a bug difficult to reproduce without
- * STLport:
- * namespace stlp_std {
- * typedef int foo_int;
- * }
- * #include <map>
- * const foo_int bar = 0;
- *
- * As you can see foo is available without namespace specification as if
- * a using namespace stlp_std has been performed. Defining _STLP_USING_NAMESPACE_BUG
- * restore the expected compilation error.
- */
-# define _STLP_USING_NAMESPACE_BUG 1
-
-# if (_STLP_MSVC < 1300) /* MSVC 6.0 and earlier */
-# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
-/* defined for DEBUG and NDEBUG too, to allow user mix own debug build with STLP release library */
-# define _STLP_USE_ABBREVS
-# endif
-
-// TODO: what is the earliest version for this? If it is 1200, use _STLP_MSVC>=1200.
-# if (_STLP_MSVC > 1100) && (_STLP_MSVC < 1300)
-typedef char __stl_char;
-# define _STLP_DEFAULTCHAR __stl_char
-# endif
-
-# if (_STLP_MSVC < 1200) /* before VC++ 6.0 */
-/* # define _STLP_NO_MEMBER_TEMPLATES 1 */
-# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS 1
-# define _STLP_DONT_USE_PARTIAL_SPEC_WRKD 1
-# define _STLP_QUALIFIED_SPECIALIZATION_BUG 1
-# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
-# define _STLP_THROW_RETURN_BUG 1
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
-# endif
-
-# if (_STLP_MSVC < 1100 )
-# ifndef _STLP_USE_NO_IOSTREAMS
-# define _STLP_USE_NO_IOSTREAMS
-# endif
-/* # define _STLP_NESTED_TYPE_PARAM_BUG 1 */
-/* Debug mode does not work for 4.2 */
-# if defined (_STLP_DEBUG)
-# pragma message ("STLport debug mode does not work for VC++ 4.2, turning _STLP_DEBUG off ...")
-# undef _STLP_DEBUG
-# endif
-# define _STLP_NO_BOOL 1
-# define _STLP_NEED_TYPENAME 1
-# define _STLP_NEED_EXPLICIT 1
-# define _STLP_NEED_MUTABLE 1
-# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX
-# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
-# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
-# define _STLP_BROKEN_USING_DIRECTIVE 1
-# define _STLP_NO_ARROW_OPERATOR 1
-# define _STLP_NO_SIGNED_BUILTINS 1
-# define _STLP_NO_EXCEPTION_SPEC 1
-# define _STLP_HAS_NO_NAMESPACES 1
-# define _STLP_NO_AT_MEMBER_FUNCTION 1
-# define _STLP_NO_MEMBER_TEMPLATES 1
-# endif /* 1100 */
-
-#endif /* _STLP_MSVC */
-
-/** The desktop variants starting with VC8 have a set of more secure replacements
-for the error-prone string handling functions of the C standard lib. */
-#if (_STLP_MSVC_LIB >= 1400) && !defined (_STLP_USING_PLATFORM_SDK_COMPILER) && !defined(UNDER_CE)
-# define _STLP_USE_SAFE_STRING_FUNCTIONS 1
-#endif
-
-#if (_STLP_MSVC_LIB <= 1310)
-# define _STLP_VENDOR_GLOBAL_CSTD
-#endif
-
-#if (_STLP_MSVC_LIB >= 1300) && !defined(UNDER_CE)
-/* Starting with MSVC 7.0 and compilers simulating it,
- * we assume that the new SDK is granted:
- */
-# define _STLP_NEW_PLATFORM_SDK 1
-#endif
-
-#if (_STLP_MSVC_LIB < 1300) /* including MSVC 6.0 */
-# define _STLP_GLOBAL_NEW_HANDLER 1
-# define _STLP_VENDOR_UNEXPECTED_STD
-# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
-#endif
-
-#if (_STLP_MSVC_LIB < 1100)
-/* up to 4.2, library is in global namespace */
-# define _STLP_VENDOR_GLOBAL_STD
-#endif
-
-#if (_STLP_MSVC_LIB <= 1010)
-/* "bool" is reserved in MSVC 4.1 while <yvals.h> absent, so : */
-# define _STLP_NO_BAD_ALLOC
-# define _STLP_HAS_NO_NEW_C_HEADERS 1
-# define _STLP_NO_NEW_NEW_HEADER 1
-#elif (_STLP_MSVC_LIB < 1100)
-/* VC++ 4.2 and higher */
-# define _STLP_YVALS_H 1
-# define _STLP_USE_NO_IOSTREAMS 1
-#endif
-
-#define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
-#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
-
-#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1100)
-# define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
-# define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
-#endif
-
-#if defined (__DLL) || defined (_DLL) || defined (_RTLDLL) || defined (_AFXDLL)
-# define _STLP_RUNTIME_DLL
-#endif
-#if defined (__BUILDING_STLPORT) && \
- (defined (_STLP_USE_DYNAMIC_LIB) || \
- defined (_STLP_RUNTIME_DLL) && !defined (_STLP_USE_STATIC_LIB))
-# define _STLP_DLL
-#endif
-#include <stl/config/_detect_dll_or_lib.h>
-#undef _STLP_RUNTIME_DLL
-#undef _STLP_DLL
-
-#if defined (_STLP_USE_DYNAMIC_LIB)
-# undef _STLP_USE_DECLSPEC
-# define _STLP_USE_DECLSPEC 1
-# if (_STLP_MSVC >= 1200) && (_STLP_MSVC < 1300)
-# define _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND 1
-# endif
-#endif
-
-#if !defined (_STLP_IMPORT_TEMPLATE_KEYWORD)
-# if !defined (_MSC_EXTENSIONS) || defined(_STLP_MSVC) && _STLP_MSVC >= 1300
-# define _STLP_IMPORT_TEMPLATE_KEYWORD
-# else
-# define _STLP_IMPORT_TEMPLATE_KEYWORD extern
-# endif
-#endif
-#define _STLP_EXPORT_TEMPLATE_KEYWORD
-
-#if defined (_STLP_MSVC) && (_STLP_MSVC < 1200)
-/* only static STLport lib now works for VC 5.0 */
-# undef _STLP_USE_STATIC_LIB
-# undef _STLP_USE_DYNAMIC_LIB
-# define _STLP_USE_STATIC_LIB
-/* disable hook which makes template symbols to be searched for in the library */
-# undef _STLP_NO_CUSTOM_IO
-#endif
-
-#include <stl/config/_auto_link.h>
-
-#if defined (_STLP_USING_PLATFORM_SDK_COMPILER)
-/* The Windows 64 bits SDK required for the moment link to bufferoverflowU.lib for
- * additional buffer overrun checks. Rather than require the STLport build system and
- * users to explicitely link with it we use the MSVC auto link feature.
- */
-# if !defined (_STLP_DONT_USE_AUTO_LINK) || defined (__BUILDING_STLPORT)
-# pragma comment (lib, "bufferoverflowU.lib")
-# if defined (_STLP_VERBOSE_AUTO_LINK)
-# pragma message ("STLport: Auto linking to bufferoverflowU.lib")
-# endif
-# endif
-#endif
-
-/* Local Variables:
- * mode:C++
- * End:
- */
diff --git a/stl/config/_mwccnlm.h b/stl/config/_mwccnlm.h
deleted file mode 100644
index 6eaf9b5..0000000
--- a/stl/config/_mwccnlm.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// STLport configuration file
-// It is internal STLport header - DO NOT include it directly
-
-#define _STLP_COMPILER "Metrowerks CodeWarrior"
-
-// Bring in definition of __MSL__ and related items
-#include <mslGlobals.h>
-#include <ansi_parms.h>
-
-// *** CodeWarrior Compiler Common Features ***
-#if __option(longlong)
-# define _STLP_LONG_LONG long long
-#endif
-
-#define _STLP_USE_UNIX_EMULATION_IO 1
-
-#define _STLP_USE_AUTO_PTR_CONVERSIONS 1
-
-#ifdef __INTEL__
-# define _STLP_LITTLE_ENDIAN
-#else
-# define _STLP_BIG_ENDIAN
-#endif
-
-#if defined(_MSL_NO_LOCALE)
-# define _STLP_NO_IMPORT_LOCALE
-#endif
-
-#if !__option( wchar_type )
-# define _STLP_WCHAR_T_IS_USHORT
-#endif
-
-#if __MWERKS__ < 0x3000
-// *** CodeWarrior Compiler Common Bugs ***
-# define __MSL_FIX_ITERATORS__(myType) // Some MSL headers rely on this
-# define _STLP_NO_FRIEND_TEMPLATES 1 // Bug mysteriously reintroduced in this version.
-# define _STLP_THROW_RETURN_BUG 1
-#endif
-
-#if __MWERKS__ >= 0x2405
-# define _STLP_HAS_NATIVE_FLOAT_ABS
-#endif
-
-#if __MWERKS__ < 0x2405
-# define _STLP_STATIC_CONST_INIT_BUG
-#endif
-
-#if __MWERKS__ <= 0x2303
-# define _STLP_NO_TEMPLATE_CONVERSIONS 1
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-#endif
-
-#if __MWERKS__ < 0x2301
-# define _STLP_MEMBER_SPECIALIZATION_BUG 1
-#endif
-
-#if __MWERKS__ < 0x2300 // CW Pro5 features
-# define _STLP_INLINE_MEMBER_TEMPLATES 1
-# define _STLP_RELOPS_IN_STD_BUG 1
-# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
-# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
-# define _STLP_NO_TYPENAME_ON_RETURN_TYPE
-#endif
-
-// fixes to native inclusion wrappers.
-#if __MWERKS__ >= 0x2300 // CWPro5 changes paths - dwa 2/28/99
-# define _STLP_NATIVE_INCLUDE_PATH ../nwsdk/include/nlm
-# define _STLP_NATIVE_C_INCLUDE_PATH ../nwsdk/include/nlm
-# define _STLP_NATIVE_HEADER(header) <../nwsdk/include/nlm/##header>
-# define _STLP_NATIVE_CPP_C_HEADER(header) <../Libraries/MSL C++/Include/##header>
-# define _STLP_NATIVE_C_HEADER(header) <../nwsdk/include/nlm/##header>
-# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../Libraries/MSL C++/Include/##header>
-
-# define _STLP_VENDOR_GLOBAL_CSTD 1
-# define _STLP_NO_VENDOR_STDLIB_L 1
-# define _STLP_NO_VENDOR_MATH_F 1
-# define _STLP_NO_VENDOR_MATH_L 1
- //# define _MSL_NO_THROW_SPECS
- //# define _STD
- //# define _CSTD
-#endif
-
-// fbp
-#if !defined( __MSL_CPP__ ) || __MSL_CPP__ <= 0x4105
-# define _STLP_NO_NATIVE_WIDE_STREAMS 1
-# endif
-
-#define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
diff --git a/stl/config/_mwerks.h b/stl/config/_mwerks.h
deleted file mode 100644
index e6da32b..0000000
--- a/stl/config/_mwerks.h
+++ /dev/null
@@ -1,161 +0,0 @@
-// STLport configuration file
-// It is internal STLport header - DO NOT include it directly
-
-#define _STLP_COMPILER "Metrowerk Codewarrior"
-
-// Bring in definition of __MSL__ and related items
-#include <mslGlobals.h>
-#include <ansi_parms.h>
-
-//
-// Compiler features
-//
-
-
-// *** CodeWarrior Compiler Common Features ***
-# if __option(longlong)
-# define _STLP_LONG_LONG long long
-# endif
-
-# define _STLP_USE_UNIX_EMULATION_IO 1
-
-# define _STLP_USE_AUTO_PTR_CONVERSIONS 1
-
-# ifdef __INTEL__
-# define _STLP_LITTLE_ENDIAN
-# else
-# define _STLP_BIG_ENDIAN
-# endif
-
-#if defined(_MSL_NO_LOCALE)
-#define _STLP_NO_IMPORT_LOCALE
-#endif
-#if !__option( wchar_type )
-# define _STLP_WCHAR_T_IS_USHORT
-#endif
-
-# if __MWERKS__ < 0x3000
-// *** CodeWarrior Compiler Common Bugs ***
-# define __MSL_FIX_ITERATORS__(myType) // Some MSL headers rely on this
-# define _STLP_NO_FRIEND_TEMPLATES 1 // Bug mysteriously reintroduced in this version.
-# define _STLP_THROW_RETURN_BUG 1
-# endif
-
-// *** Version-specific settings ***
-
-# if __MWERKS__ >= 0x2405
-# define _STLP_HAS_NATIVE_FLOAT_ABS
-# endif
-
-# if __MWERKS__ < 0x2405
-# define _STLP_STATIC_CONST_INIT_BUG
-# endif
-
-# if __MWERKS__ <= 0x2303
-# define _STLP_NO_TEMPLATE_CONVERSIONS 1
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-# endif
-
-# if __MWERKS__ < 0x2301
-# define _STLP_MEMBER_SPECIALIZATION_BUG 1
-# endif
-
-# if __MWERKS__ < 0x2300 // CW Pro5 features
-# define _STLP_INLINE_MEMBER_TEMPLATES 1
-# define _STLP_RELOPS_IN_STD_BUG 1
-# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
-# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
-# define _STLP_NO_TYPENAME_ON_RETURN_TYPE
-# endif
-
-# if __MWERKS__ < 0x2200 // CW Pro4 features
-# define _STLP_BROKEN_USING_DIRECTIVE 1
-# define _STLP_NO_MEMBER_TEMPLATES 1
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-# define _STLP_NO_FRIEND_TEMPLATES 1
-# define _STLP_NO_QUALIFIED_FRIENDS 1
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
-# endif
-
-# if __MWERKS__ < 0x2100 // CW Pro3 features
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
-# define _STLP_HAS_NO_NAMESPACES 1
-# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
-
-# define _STLP_NEED_TYPENAME 1
-# define _STLP_NO_ARROW_OPERATOR 1
-# define _STLP_TEMPLATE_PARAM_SUBTYPE_BUG 1
-# define _STLP_FORCED_INLINE_INSTANTIATION_BUG 1
-# define _STLP_MULTI_CONST_TEMPLATE_ARG_BUG 1
-# define _STLP_INLINE_NAME_RESOLUTION_BUG 1
-// *** Metrowerks Standard Library Bug ***
-# define _STLP_MSVC50_COMPATIBILITY 1
-# endif
-
-# if __MWERKS__ < 0x2000 // v. 2.0 features
-# define _STLP_NO_WCHAR_T 1
-# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
-# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 // dwa 8/21/97 - this bug fixed for CWPro2
-# endif
-
-# if __MWERKS__ < 0x1900 // dwa 8/19/97 - 1.9 Compiler feature defines
-# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
-# define _STLP_BASE_TYPEDEF_BUG 1
-# define _STLP_BASE_MATCH_BUG 1
-# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
-# define _STLP_DEFAULT_TYPE_PARAM 1 // More limited template parameters
-
-# if __MWERKS__ < 0x1800
- __GIVE_UP_WITH_STL(CW_18)
-# endif
-
-# endif
-
-
-// fixes to native inclusion wrappers.
-# if __MWERKS__ >= 0x2300 // CWPro5 changes paths - dwa 2/28/99
-# define _STLP_NATIVE_INCLUDE_PATH ../include
-# define _STLP_NATIVE_C_INCLUDE_PATH ../include
-# define _STLP_NATIVE_HEADER(header) <../include/##header>
-# define _STLP_NATIVE_CPP_C_HEADER(header) <../include/##header>
-# define _STLP_NATIVE_C_HEADER(header) <../include/##header>
-# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/##header>
-# else
-
-# define _STLP_NATIVE_INCLUDE_PATH Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include
-# define _STLP_NATIVE_C_INCLUDE_PATH Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes
-# define _STLP_NATIVE_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include:##header>
-# define _STLP_NATIVE_CPP_C_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include:##header>
-# define _STLP_NATIVE_C_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes:##header>
-# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes:##header>
-
-# endif
-
-//Following block come from boost intrinsics.hpp file:
-#if defined (__MSL_CPP__) && (__MSL_CPP__ >= 0x8000)
- // Metrowerks compiler is acquiring intrinsic type traits support
- // post version 8. We hook into the published interface to pick up
- // user defined specializations as well as compiler intrinsics as
- // and when they become available:
-# include <msl_utility>
-# define _STLP_HAS_TRIVIAL_CONSTRUCTOR(T) Metrowerks::has_trivial_default_ctor<T>::value
-# define _STLP_HAS_TRIVIAL_COPY(T) Metrowerks::has_trivial_copy_ctor<T>::value
-# define _STLP_HAS_TRIVIAL_ASSIGN(T) Metrowerks::has_trivial_assignment<T>::value
-# define _STLP_HAS_TRIVIAL_DESTRUCTOR(T) Metrowerks::has_trivial_dtor<T>::value
-# define _STLP_IS_POD(T) Metrowerks::is_POD<T>::value
-# define _STLP_HAS_TYPE_TRAITS_INTRINSICS
-#endif
-
-// fbp
-# if !defined( __MSL_CPP__ ) || __MSL_CPP__ <= 0x4105
-# define _STLP_NO_NATIVE_WIDE_STREAMS 1
-# endif
-
-# if defined(__MACH__)
-# define _STLP_MAC
-# define O_BINARY 0
-# elif defined(macintosh)
-# define _NOTHREADS
-# endif
-# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
diff --git a/stl/config/_netware.h b/stl/config/_netware.h
deleted file mode 100644
index 14debd2..0000000
--- a/stl/config/_netware.h
+++ /dev/null
@@ -1 +0,0 @@
-#define _STLP_PLATFORM "Novell Netware"
diff --git a/stl/config/_openbsd.h b/stl/config/_openbsd.h
deleted file mode 100644
index cb69825..0000000
--- a/stl/config/_openbsd.h
+++ /dev/null
@@ -1 +0,0 @@
-#define _STLP_PLATFORM "Open BSD"
diff --git a/stl/config/_prolog.h b/stl/config/_prolog.h
deleted file mode 100644
index 5ad943f..0000000
--- a/stl/config/_prolog.h
+++ /dev/null
@@ -1,52 +0,0 @@
-
-#if defined (_STLP_MSVC) || defined (__ICL)
-
-# if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1200)
-# pragma warning(push)
-# endif
-# include <stl/config/_warnings_off.h>
-/* We are forcing the alignment to guaranty that libraries are use
- * with the same alignment as the one use to build them.
- */
-# if !defined (_WIN64)
-# pragma pack(push, 8)
-# else
-# pragma pack(push, 16)
-# endif
-
-#elif defined (__BORLANDC__)
-
-# pragma option push
-# pragma option -Vx- -Ve- -a8 -b -pc
-# include <stl/config/_warnings_off.h>
-
-#elif defined (__sgi) && !defined (__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-
-# pragma set woff 1209
-# pragma set woff 1174
-# pragma set woff 1375
-/* from iterator_base.h */
-# pragma set woff 1183
-
-#elif defined (__DECCXX)
-
-# ifdef __PRAGMA_ENVIRONMENT
-# pragma __environment __save
-# pragma __environment __header_defaults
-# endif
-
-#elif defined (__IBMCPP__)
-/* supress EDC3130: A constant is being used as a conditional expression */
-# pragma info(nocnd)
-
-#elif defined (__HP_aCC)
-/* _REENTRANT selects Posix 1c threads unless draft4 selected.
- * * This usage is obsolescent, "-D_POSIX_C_SOURCE=199506" is preferred */
-# if 0 /* defined (_REENTRANT) && ! defined (_POSIX_C_SOURCE) */
-# define _POSIX_C_SOURCE 199506
-# endif
-#elif defined (__WATCOMCPLUSPLUS__)
-# pragma warning 604 10 /* must lookahead to determine... */
-# pragma warning 594 10 /* resolved as declaration/type */
-# pragma warning 595 10 /* resolved as an expression */
-#endif
diff --git a/stl/config/_sgi.h b/stl/config/_sgi.h
deleted file mode 100644
index 2f7518f..0000000
--- a/stl/config/_sgi.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// STLport configuration file
-// It is internal STLport header - DO NOT include it directly
-
-#define _STLP_COMPILER "CC"
-
-#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
-
-// define native include path before trying to include anything
-
-#define _STLP_NATIVE_HEADER(__x) </usr/include/CC/##__x>
-#define _STLP_NATIVE_C_HEADER(__x) </usr/include/##__x>
-#define _STLP_NATIVE_OLD_STREAMS_HEADER(__x) </usr/include/CC/##__x>
-#define _STLP_NATIVE_CPP_C_HEADER(__x) </usr/include/CC/##__x>
-#define _STLP_NATIVE_CPP_RUNTIME_HEADER(__x) </usr/include/CC/##__x>
-
-#define _STLP_NO_NATIVE_MBSTATE_T
-
-#define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS
-#define _STLP_NO_NATIVE_WIDE_FUNCTIONS
-#define _STLP_NO_MEMBER_TEMPLATE_CLASSES
-
-// #define _STLP_NO_BAD_ALLOC
-
-#define _STL_HAS_NAMESPACES
-
-#if ! defined (__EXCEPTIONS) && ! defined (_STLP_NO_EXCEPTIONS)
-# define _STLP_NO_EXCEPTIONS
-#endif
-
-// #define _STLP_NOTHROW throw()
-
-#define __EDG_SWITCHES
-
-#define _STLP_USE_SGI_STRING 1
-
-#define _STLP_HAS_NO_NEW_C_HEADERS 1
-// # define _STLP_VENDOR_GLOBAL_EXCEPT_STD
-
-#define _STLP_NO_POST_COMPATIBLE_SECTION
-
-#include <standards.h>
-
-#if !(_COMPILER_VERSION >= 730)
-# define _STLP_NO_NEW_NEW_HEADER 1
-#endif
-
-#if (_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
-# define _STLP_EXTERN_RANGE_ERRORS
-#endif
-
-#if !defined(_BOOL)
-# define _STLP_NO_BOOL
-#endif
-#if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32
-# define _STLP_STATIC_CONST_INIT_BUG
-#endif
-
-#if (_COMPILER_VERSION < 720) || (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32)
-# define _STLP_DEF_CONST_PLCT_NEW_BUG
-# define _STLP_DEF_CONST_DEF_PARAM_BUG
-#endif
-#if !((_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32)
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD
-#endif
-#if !defined(_STANDARD_C_PLUS_PLUS)
-# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
-#endif
-#if !((_COMPILER_VERSION >= 721) && defined(_NAMESPACES))
-# define _STLP_HAS_NO_NAMESPACES
-#endif
-#if (_COMPILER_VERSION < 721) || !defined(_STL_HAS_NAMESPACES) || defined(_STLP_NO_NAMESPACES)
-# define _STLP_NO_EXCEPTION_HEADER
-#endif
-#if _COMPILER_VERSION < 730 || !defined(_STANDARD_C_PLUS_PLUS) || !defined(_NAMESPACES)
-# define _STLP_NO_BAD_ALLOC
-#endif
-#if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI
-# define _STLP_LONG_LONG long long
-#endif
-#if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
-# define _STLP_USE_NO_IOSTREAMS
-#endif
-#if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
-# define _STLP_NO_AT_MEMBER_FUNCTION
-#endif
-// # if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
-#if !(_COMPILER_VERSION >= 721 && defined(_STANDARD_C_PLUS_PLUS))
-# define _STLP_NO_TEMPLATE_CONVERSIONS
-#endif
-#if !((_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32)
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
-#endif
diff --git a/stl/config/_solaris.h b/stl/config/_solaris.h
deleted file mode 100644
index 7e00d9c..0000000
--- a/stl/config/_solaris.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef __stl_config__solaris_h
-#define __stl_config__solaris_h
-
-#define _STLP_PLATFORM "Sun Solaris"
-
-/* include system features file */
-#include <sys/feature_tests.h>
-
-/* system-dependent defines */
-
-/*
- * Should be fixed:
- * 1. __SunOS_5_x not defined, and no way to derive this from headers only;
- * define it with -D on compiler command line is a bad idea too.
- *
- * 2. Solaris may has, but may hasn't MATH_F and MATH_L functions (even with two
- * underscores)---this depends upon system update level and seems legally present
- * only in Solaris 10 (i.e. I saw Solaris 9 with and without __acosf in libm.so.1)
- *
- * - ptr
- */
-
-#if defined (__SunOS_5_8) && ! defined (_STLP_HAS_NO_NEW_C_HEADERS) && ( __cplusplus >= 199711L)
-# define _STLP_HAS_NATIVE_FLOAT_ABS
-#endif
-
-#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
-# define _STLP_RAND48 1
-#endif
-
-#if (defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)) || defined (__SunOS_5_6)
-# define _STLP_WCHAR_SUNPRO_EXCLUDE 1
-# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
-#endif
-
-/* boris : this should always be defined for Solaris 5 & 6. Any ideas how to do it? */
-#if !(defined ( __KCC ) && __KCC_VERSION > 3400 ) && \
- ((defined(__SunOS_5_5_1) || defined(__SunOS_5_6) ))
-# ifndef _STLP_NO_NATIVE_MBSTATE_T
-# define _STLP_NO_NATIVE_MBSTATE_T 1
-# endif
-#endif /* KCC */
-
-/* For SPARC we use lightweight synchronization */
-#if defined (__sparc) /* && (defined (_REENTRANT) || defined (_PTHREADS)) */
-# if ( (defined (__GNUC__) && defined (__sparc_v9__)) || \
- defined (__sparcv9) ) \
- && !defined(_NOTHREADS) && !defined (_STLP_NO_SPARC_SOLARIS_THREADS)
-# define _STLP_SPARC_SOLARIS_THREADS
-# define _STLP_THREADS_DEFINED
-# endif
-#endif
-
-/* gcc does not support ELF64 yet ; however; it supports ultrasparc + v8plus.
- * limits.h contains invalid values for this combination
- */
-#ifdef __GNUC__
-# if (defined (__sparc_v9__) || defined (__sparcv9)) && !defined ( __WORD64 ) && !defined(__arch64__)
-# define __LONG_MAX__ 2147483647L
-# endif
-#endif
-
-/*
- * Hmm, I don't found in Solaris 9 system headers definition like __SunOS_5_9
- * (defined in SunPro?); I also can't find functions like fmodf (again,
- * I found modff in libc, but no acosf etc.). Strange, I saw __cosf functions
- * (built-in?) at least with gcc some time ago, but don't see ones with
- * gcc 3.3.2 on SunOS sparc-solaris1 5.9 Generic_112233-03 sun4u sparc SUNW,Ultra-60
- * from Sorceforge's CF.
- * 2005-12-15, - ptr
- *
- * P.S. That's why I add two defines:
- */
-
-/* #ifdef __GNUC__ */
-#define _STLP_NO_VENDOR_MATH_F
-#define _STLP_NO_VENDOR_MATH_L
-/* #endif */
-
-#ifdef __GNUC__
-# define _STLP_WCHAR_BORLAND_EXCLUDE
-# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
-#endif
-
-#endif /* __stl_config__solaris_h */
diff --git a/stl/config/_sunprocc.h b/stl/config/_sunprocc.h
deleted file mode 100644
index b54e121..0000000
--- a/stl/config/_sunprocc.h
+++ /dev/null
@@ -1,161 +0,0 @@
-// STLport configuration file
-// It is internal STLport header - DO NOT include it directly
-
-#define _STLP_COMPILER "Sunpro CC"
-
-#define _STLP_LONG_LONG long long
-
-// GAB: 11/09/05
-// Starting with 5.0 the STLport code expects to be
-// instantiated during compile time. This is due to undefing
-// a number of defines that are also used in the c versions
-// of the file. When they are undefed the c version fails to
-// compile.
-// # define _STLP_LINK_TIME_INSTANTIATION 1
-
-#if ! defined(_BOOL)
-# define _STLP_NO_BOOL 1
-#endif
-
-// compatibility mode stuff
-#if (__SUNPRO_CC >= 0x510) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 ))
-# define _STLP_NATIVE_INCLUDE_PATH ../CC/Cstd
-# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../CC
-#elif (__SUNPRO_CC >= 0x500) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 ))
-# define _STLP_NATIVE_INCLUDE_PATH ../CC
-#elif (defined (__SUNPRO_CC_COMPAT) && __SUNPRO_CC_COMPAT == 4)
-# define _STLP_NATIVE_INCLUDE_PATH ../CC4
-#else
-# define _STLP_NATIVE_INCLUDE_PATH ../CC
-#endif
-
-#define _STLP_STATIC_CONST_INIT_BUG 1
-
-#if (__SUNPRO_CC < 0x530)
-// those are tested and proved not to work...
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
-#endif
-
-#ifdef _STLP_USE_NO_IOSTREAMS
-# define _STLP_HAS_NO_NEW_C_HEADERS 1
-#endif
-
-// those do not depend on compatibility
-#if (__SUNPRO_CC < 0x510)
-# define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1
-# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
-#endif
-
-#if (__SUNPRO_CC < 0x510) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5))
-
-# define _STLP_NO_QUALIFIED_FRIENDS 1
-
-// no partial , just for explicit one
-# define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
-# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
-
-# define _STLP_NO_MEMBER_TEMPLATES 1
-# define _STLP_NO_FRIEND_TEMPLATES 1
-
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
-# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-#endif
-
-// Features that depend on compatibility switch
-#if ( __SUNPRO_CC < 0x500 ) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5))
-
-# ifndef _STLP_USE_NO_IOSTREAMS
-# define _STLP_USE_NO_IOSTREAMS 1
-# endif
-# define _STLP_NO_NEW_NEW_HEADER 1
-// # define _STLP_NO_RELOPS_NAMESPACE
-# define _STLP_HAS_NO_NAMESPACES 1
-# define _STLP_NEED_MUTABLE 1
-# define _STLP_NO_BAD_ALLOC 1
-# define _STLP_NO_EXCEPTION_HEADER 1
-# define _STLP_NATIVE_C_INCLUDE_PATH ../include
-#elif (__SUNPRO_CC < 0x510)
-// # define _STLP_NATIVE_C_HEADER(header) <../CC/##header##.SUNWCCh>
-# define _STLP_NATIVE_CPP_C_HEADER(header) <../CC/##header##.SUNWCCh>
-# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include
-#elif defined( __SunOS_5_5_1 ) || defined( __SunOS_5_6 ) || defined( __SunOS_5_7 )
-# define _STLP_NATIVE_C_INCLUDE_PATH ../CC/std
-# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std
-#else
-# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include
-# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std
-#endif
-
-#if ( __SUNPRO_CC < 0x500 )
-
-# undef _STLP_NATIVE_C_HEADER
-# undef _STLP_NATIVE_CPP_C_HEADER
-
-# define wint_t __wint_t
-// famous CC 4.2 bug
-# define _STLP_INLINE_STRING_LITERAL_BUG 1
-// /usr/include
-# define _STLP_NATIVE_C_INCLUDE_PATH ../include
-
-// 4.2 cannot handle iterator_traits<_Tp>::iterator_category as a return type ;(
-# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
-
-// 4.2 does not like it
-# undef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
-
-# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
-
-# define _STLP_NEED_TYPENAME 1
-# define _STLP_NEED_EXPLICIT 1
-# define _STLP_NO_BAD_ALLOC 1
-# define _STLP_NO_ARROW_OPERATOR 1
-
-# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
-# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
-# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG 1
-# undef _STLP_HAS_NO_NEW_C_HEADERS
-# define _STLP_HAS_NO_NEW_C_HEADERS 1
-// # define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
-
-# if ( __SUNPRO_CC < 0x420 )
-# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
-# define _STLP_NO_NEW_STYLE_CASTS 1
-# define _STLP_NO_METHOD_SPECIALIZATION 1
-# if ( __SUNPRO_CC > 0x401 )
-# if (__SUNPRO_CC==0x410)
-# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
-# endif
-# else
- // SUNPro C++ 4.0.1
-# define _STLP_BASE_MATCH_BUG 1
-# define _STLP_BASE_TYPEDEF_BUG 1
-# if (( __SUNPRO_CC < 0x401 ) && !defined(__SUNPRO_C))
- __GIVE_UP_WITH_STL(SUNPRO_401)
-# endif
-# endif /* 4.0.1 */
-# endif /* 4.2 */
-#endif /* < 5.0 */
-
-#ifndef _MBSTATET_H
-# define _MBSTATET_H
-# undef _MBSTATE_T
-# define _MBSTATE_T
-typedef struct __mbstate_t {
-# if defined(_LP64)
- long __filler[4];
-# else
- int __filler[6];
-# endif
-} __mbstate_t;
-# ifndef _STLP_HAS_NO_NAMESPACES
-namespace std {
- typedef __mbstate_t mbstate_t;
-}
-using std::mbstate_t;
-# else
-typedef __mbstate_t mbstate_t;
-# endif
-#endif /* __MBSTATET_H */
diff --git a/stl/config/_symantec.h b/stl/config/_symantec.h
deleted file mode 100644
index 7926bf5..0000000
--- a/stl/config/_symantec.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* STLport configuration file
- * It is internal STLport header - DO NOT include it directly
- */
-
-#define _STLP_COMPILER "Symantec"
-
-/* if not using maximum ANSI compatibility ( -A -Ab -Aw),
- * uncomment the following two lines:
- */
-/*# define _STLP_NO_BOOL 1 */
-/*# define _STLP_NO_WCHAR_T 1 */
-
-/* TODO: Check that this config is necessary for all compiler versions.
- * It is here for historical reasons for the moment.
- */
-#define _STLP_NO_CONTAINERS_EXTENSION
-
-# define _STLP_HAS_NO_NAMESPACES 1
-
-# define _STLP_NEED_TYPENAME 1
-# define _STLP_NEED_EXPLICIT 1
-# define _STLP_NO_NEW_STYLE_CASTS 1
-# define _STLP_NEED_MUTABLE 1
-# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
-/* # define _STLP_NO_BAD_ALLOC 1 */
-
-# define _STLP_NO_MEMBER_TEMPLATES 1
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-# define _STLP_NO_FRIEND_TEMPLATES 1
-# define _STLP_NO_QUALIFIED_FRIENDS 1
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
-
-/* # define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 */
-# define _STLP_NO_METHOD_SPECIALIZATION 1
-# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
-/* # define _STLP_NO_EXCEPTION_HEADER 1 */
-
-# define _STLP_HAS_NO_NEW_C_HEADERS 1
-
-# define _STLP_STATIC_CONST_INIT_BUG 1
-# define _STLP_THROW_RETURN_BUG 1
-/* # define _STLP_LINK_TIME_INSTANTIATION 1 */
-# define _STLP_NO_TEMPLATE_CONVERSIONS 1
-
-# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
-
diff --git a/stl/config/_system.h b/stl/config/_system.h
deleted file mode 100644
index ce22044..0000000
--- a/stl/config/_system.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/*
- * Purpose of this file :
- *
- * To hold COMPILER-SPECIFIC portion of STLport settings.
- * In general, user should not edit this file unless
- * using the compiler not recognized below.
- *
- * If your compiler is not being recognized yet,
- * please look for definitions of macros in stl_mycomp.h,
- * copy stl_mycomp.h to stl_YOUR_COMPILER_NAME,
- * adjust flags for your compiler, and add <include config/stl_YOUR_COMPILER_NAME>
- * to the secton controlled by unique macro defined internaly by your compiler.
- *
- * To change user-definable settings, please edit <user_config.h>
- *
- */
-
-#ifndef __stl_config__system_h
-#define __stl_config__system_h
-
-#if defined(__SYMBIAN32__)
-# if defined(__GCCE__) || defined(__ARMCC__)
-# include <stl/config/stl_gcce.h>
-# elif defined(__WINSCW__)
-# include <stl/config/stl_winscw.h>
-# endif
-# include <stl/config/stl_symbian.h>
-#elif defined (__sun)
-# include <stl/config/_solaris.h>
-# if defined (__GNUC__)
-# include <stl/config/_gcc.h>
-# elif defined (__SUNPRO_CC)
-# include <stl/config/_sunprocc.h>
-/*
-# ifdef __KCC
-# include <stl/config/_kai.h>
-# endif
-*/
-# elif defined (__APOGEE__) /* Apogee 4.x */
-# include <stl/config/_apcc.h>
-# elif defined (__FCC_VERSION) /* Fujitsu Compiler, v4.0 assumed */
-# include <stl/config/_fujitsu.h>
-# endif
-#elif defined (__hpux)
-# include <stl/config/_hpux.h>
-# if defined (__GNUC__)
-# include <stl/config/_gcc.h>
-# elif defined (__HP_aCC)
-# include <stl/config/_hpacc.h>
-# endif
-#elif defined (ANDROID)
- /* Android mobile phone platform. Somewhat but not entirely GNU/Linux-like */
-# include <stl/config/_android.h>
-# include <stl/config/_gcc.h>
-#elif defined (linux) || defined (__linux__)
-# include <stl/config/_linux.h>
-/* Intel's icc define __GNUC__! */
-# if defined (__INTEL_COMPILER)
-# include <stl/config/_icc.h>
-# elif defined (__GNUC__)
-# include <stl/config/_gcc.h>
-# endif
-/*
-# ifdef __KCC
-# include <stl/config/_kai.h>
-# endif
-*/
-#elif defined (__FreeBSD__)
-# include <stl/config/_freebsd.h>
-# if defined (__GNUC__)
-# include <stl/config/_gcc.h>
-# endif
-#elif defined (__OpenBSD__)
-# include <stl/config/_openbsd.h>
-# if defined (__GNUC__)
-# include <stl/config/_gcc.h>
-# endif
-#elif defined (N_PLAT_NLM) /* Novell NetWare */
-# include <stl/config/_netware.h>
-# ifdef __MWERKS__ /* Metrowerks CodeWarrior */
-# include <stl/config/_mwccnlm.h>
-# endif
-#elif defined (__sgi) /* IRIX? */
-# define _STLP_PLATFORM "SGI Irix"
-# if defined (__GNUC__)
-# include <stl/config/_gcc.h>
-# else
-# include <stl/config/_sgi.h>
-# endif
-#elif defined (__OS400__) /* AS/400 C++ */
-# define _STLP_PLATFORM "OS 400"
-# if defined (__GNUC__)
-# include <stl/config/_gcc.h>
-# else
-# include <stl/config/_as400.h>
-# endif
-#elif defined (_AIX)
-# include <stl/config/_aix.h>
-# if defined (__xlC__) || defined (__IBMC__) || defined ( __IBMCPP__ )
- /* AIX xlC, Visual Age C++ , OS-390 C++ */
-# include <stl/config/_ibm.h>
-# endif
-#elif defined (_CRAY) /* Cray C++ 3.4 or 3.5 */
-# define _STLP_PLATFORM "Cray"
-# include <config/_cray.h>
-#elif defined (__DECCXX) || defined (__DECC)
-# define _STLP_PLATFORM "DECC"
-# ifdef __vms
-# include <stl/config/_dec_vms.h>
-# else
-# include <stl/config/_dec.h>
-# endif
-#elif defined (macintosh) || defined (_MAC)
-# include <stl/config/_mac.h>
-# if defined (__MWERKS__)
-# include <stl/config/_mwerks.h>
-# elif defined (__MRC__) || (defined (__SC__) && (__SC__ >= 0x882))
- /* Apple MPW SCpp 8.8.2, Apple MPW MrCpp 4.1.0 */
-# include <stl/config/_apple.h>
-# endif
-#elif defined (__APPLE__)
-# include <stl/config/_macosx.h>
-# ifdef __GNUC__
-# include <stl/config/_gcc.h>
-# endif
-#elif defined (__CYGWIN__)
-# include <stl/config/_cygwin.h>
-# if defined (__GNUC__)
-# include <stl/config/_gcc.h>
-# endif
-#elif defined (__MINGW32__)
-# define _STLP_PLATFORM "MinGW"
-# if defined (__GNUC__)
-# include <stl/config/_gcc.h>
-# endif
-# include <stl/config/_windows.h>
-#elif defined (_WIN32) || defined (__WIN32) || defined (WIN32) || defined (__WIN32__) || \
- defined (__WIN16) || defined (WIN16) || defined (_WIN16)
-# if defined ( __BORLANDC__ ) /* Borland C++ ( 4.x - 5.x ) */
-# include <stl/config/_bc.h>
-# elif defined (__WATCOM_CPLUSPLUS__) || defined (__WATCOMC__) /* Watcom C++ */
-# include <stl/config/_watcom.h>
-# elif defined (__COMO__) || defined (__COMO_VERSION_)
-# include <stl/config/_como.h>
-# elif defined (__DMC__) /* Digital Mars C++ */
-# include <stl/config/_dm.h>
-# elif defined (__SC__) && (__SC__ < 0x800) /* Symantec 7.5 */
-# include <stl/config/_symantec.h>
-# elif defined (__ICL) /* Intel reference compiler for Win */
-# include <stl/config/_intel.h>
-# elif defined (__MWERKS__)
-# include <stl/config/_mwerks.h>
-# elif defined (_MSC_VER) && (_MSC_VER >= 1200) && defined (UNDER_CE)
- /* Microsoft eMbedded Visual C++ 3.0, 4.0 (.NET) */
-# include <stl/config/_evc.h>
-# elif defined (_MSC_VER)
- /* Microsoft Visual C++ 6.0, 7.0, 7.1, 8.0 */
-# include <stl/config/_msvc.h>
-# endif
-
-# include <stl/config/_windows.h>
-#else
-# error Unknown platform !!
-#endif
-
-#if !defined (_STLP_COMPILER)
-/* Unable to identify the compiler, issue error diagnostic.
- * Edit <config/stl_mycomp.h> to set STLport up for your compiler. */
-# include <stl/config/stl_mycomp.h>
-#endif
-
-#endif /* __stl_config__system_h */
diff --git a/stl/config/_warnings_off.h b/stl/config/_warnings_off.h
deleted file mode 100644
index 5618e6e..0000000
--- a/stl/config/_warnings_off.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This header turns off warnings that STLport headers generate for compiled
- * user code.
- */
-
-#if defined (_STLP_MSVC)
-# if (_STLP_MSVC > 1000)
-# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-/*
- * 31/07/2004: dums - now that we do not export the basic_string class anymore but only a base class
- * we have to disable this warning as the string are used as data members type of many iostream classes.
- */
-# pragma warning ( disable : 4251 ) // ignore template classes being exported in .dll's
-# endif
-
-# if (_STLP_MSVC < 1200) // VC5 and earlier
-# pragma warning( disable : 4389 ) // '==' : signed/unsigned mismatch
-// multiple copy constructors/assignment operators specified,
-// with member templates are bogus...
-# pragma warning( disable : 4521 )
-# pragma warning( disable : 4522 )
-# endif
-
-# if (_STLP_MSVC < 1300) // VC6, eVC3, eVC4
-# pragma warning( disable : 4097 ) // typedef-name used as based class of (...)
-# pragma warning( disable : 4231 ) // non standard extension : 'extern' before template instanciation
-# pragma warning( disable : 4244 ) // implicit conversion: possible loss of data
-# pragma warning( disable : 4284 ) // for -> operator
-//This warning is necessary because of the native platform headers:
-# pragma warning( disable : 4290 ) // c++ exception specification ignored
-# pragma warning( disable : 4514 ) // unreferenced inline function has been removed
-# pragma warning( disable : 4660 ) // template-class specialization '...' is already instantiated
-# pragma warning( disable : 4701 ) // local variable '...' may be used without having been initialized
-# pragma warning( disable : 4710 ) // function (...) not inlined
-# pragma warning( disable : 4786 ) // identifier truncated to 255 characters
-# endif
-
-# if (_STLP_MSVC < 1400)
-# pragma warning( disable : 4511 ) // copy constructor cannot be generated
-# endif
-
-//Pool of common warnings for all MSVC supported versions:
-//Many are only useful if warning level is set to 4.
-# pragma warning( disable : 4100 ) // unreferenced formal parameter
-# pragma warning( disable : 4127 ) // conditional expression is constant
-# pragma warning( disable : 4146 ) // unary minus operator applied to unsigned type, result still unsigned
-# pragma warning( disable : 4245 ) // conversion from 'enum ' to 'unsigned int', signed/unsigned mismatch
-# pragma warning( disable : 4355 ) // this used in base member initializer list (used in rope implementation)
-# pragma warning( disable : 4510 ) // default constructor cannot be generated
-# pragma warning( disable : 4512 ) // assignment operator could not be generated
-# pragma warning( disable : 4571 ) // catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions
-# pragma warning( disable : 4610 ) // struct '...' can never be instantiated - user defined construtor required
-# endif
-#elif defined (__BORLANDC__)
-# pragma option -w-ccc // -w-8008 Condition is always true OR Condition is always false
-# pragma option -w-inl // -w-8027 Functions containing reserved words are not expanded inline
-# pragma option -w-ngu // -w-8041 Negating unsigned value
-# pragma option -w-pow // -w-8062 Previous options and warnings not restored
-# pragma option -w-rch // -w-8066 Unreachable code
-# pragma option -w-par // -w-8057 Parameter 'parameter' is never used
-#endif
diff --git a/stl/config/_watcom.h b/stl/config/_watcom.h
deleted file mode 100644
index f960424..0000000
--- a/stl/config/_watcom.h
+++ /dev/null
@@ -1,154 +0,0 @@
-// STLport configuration file
-// It is internal STLport header - DO NOT include it directly
-
-#define _STLP_COMPILER "Watcom"
-
-# ifndef _STLP_USE_NO_IOSTREAMS
-# define _STLP_USE_NO_IOSTREAMS
-# endif
-
-# define _STLP_NO_RELOPS_NAMESPACE
-# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX
-
-# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
-# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
-# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
-
-// On QNX, headers are supposed to be found in /usr/include,
-// so default "../include" should work.
-# ifndef __QNX__
-# define _STLP_NATIVE_INCLUDE_PATH ../h
-# endif
-
-// Inline replacements for locking calls under Watcom
-// Define _STLP_NO_WATCOM_INLINE_INTERLOCK to keep using
-// standard WIN32 calls
-// Define _STL_MULTIPROCESSOR to enable lock
-#if !defined(_STLP_NO_WATCOM_INLINE_INTERLOCK)
-
-long __stl_InterlockedIncrement( long *var );
-long __stl_InterlockedDecrement( long *var );
-
-#ifdef _STL_MULTIPROCESSOR
-// Multiple Processors, add lock prefix
-#pragma aux __stl_InterlockedIncrement parm [ ecx ] = \
- ".586" \
- "mov eax, 1" \
- "lock xadd [ecx], eax" \
- "inc eax" \
- value [eax];
-
-
-#pragma aux __stl_InterlockedDecrement parm [ ecx ] = \
- ".586" \
- "mov eax, 0FFFFFFFFh" \
- "lock xadd [ecx], eax" \
- "dec eax" \
- value [eax];
-#else
-// Single Processor, lock prefix not needed
-#pragma aux __stl_InterlockedIncrement parm [ ecx ] = \
- ".586" \
- "mov eax, 1" \
- "xadd [ecx], eax" \
- "inc eax" \
- value [eax];
-
-#pragma aux __stl_InterlockedDecrement parm [ ecx ] = \
- ".586" \
- "mov eax, 0FFFFFFFFh" \
- "xadd [ecx], eax" \
- "dec eax" \
- value [eax];
-#endif // _STL_MULTIPROCESSOR
-
-long __stl_InterlockedExchange( long *Destination, long Value );
-
-// xchg has auto-lock
-#pragma aux __stl_InterlockedExchange parm [ecx] [eax] = \
- ".586" \
- "xchg eax, [ecx]" \
- value [eax];
-#else
-
-#define __stl_InterlockedIncrement InterlockedIncrement
-#define __stl_InterlockedDecrement InterlockedDecrement
-#define __stl_InterlockedExchange InterlockedExchange
-#endif /* INLINE INTERLOCK */
-
-#define _STLP_ATOMIC_INCREMENT(__x) __stl_InterlockedIncrement((long*)__x)
-#define _STLP_ATOMIC_DECREMENT(__x) __stl_InterlockedDecrement((long*)__x)
-#define _STLP_ATOMIC_EXCHANGE(__x, __y) __stl_InterlockedExchange((long*)__x, (long)__y)
-
-// boris : is this true or just the header is not in /usr/include ?
-# ifdef __QNX__
-# define _STLP_NO_TYPEINFO 1
-# endif
-
-# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-# define _STLP_NO_MEMBER_TEMPLATES 1
-# define _STLP_NO_FRIEND_TEMPLATES 1
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-
-
-# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
-# define _STLP_HAS_NO_NAMESPACES 1
-# define _STLP_NEED_TYPENAME 1
-
-# if __WATCOMC__ < 1100
-# define _STLP_NO_WCHAR_T 1
-# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
-# endif
-
-# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
-
-# define _STLP_STATIC_CONST_INIT_BUG 1
-// # define _STLP_THROW_RETURN_BUG 1
-# define _STLP_NO_TEMPLATE_CONVERSIONS 1
-
-# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
-
-# define _STLP_HAS_NO_NEW_IOSTREAMS 1
-# define _STLP_HAS_NO_NEW_C_HEADERS 1
-# define _STLP_NO_NEW_NEW_HEADER 1
-# define _STLP_VENDOR_GLOBAL_STD
-
-# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
-# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
-# define _STLP_NONTEMPL_BASE_MATCH_BUG
-# define _STLP_NO_EXCEPTION_HEADER 1
-# define _STLP_NO_BAD_ALLOC 1
-
-# define _STLP_NESTED_TYPE_PARAM_BUG 1
-
-# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1
-
-# if (__WATCOM_CPLUSPLUS__ < 1100 )
-# define _STLP_NO_BOOL 1
-# define _STLP_NEED_EXPLICIT 1
-# define _STLP_NEED_MUTABLE 1
-# define _STLP_NO_ARROW_OPERATOR 1
-# endif
-// This one is present in 11, but apparently has bugs (with auto_ptr).
-# define _STLP_NO_NEW_STYLE_CASTS 1
-
-// Get rid of Watcom's min and max macros
-#undef min
-#undef max
-
-// for switches (-xs, -xss, -xst)
-//
-#if !(defined (__SW_XS) || defined (__SW_XSS) || defined(__SW_XST))
-# define _STLP_HAS_NO_EXCEPTIONS 1
-# endif
-
-# if defined ( _MT ) && !defined (_NOTHREADS) && !defined (_REENTRANT)
-# define _REENTRANT 1
-# endif
-
-
-
-
-
diff --git a/stl/config/_windows.h b/stl/config/_windows.h
deleted file mode 100644
index 69068bc..0000000
--- a/stl/config/_windows.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (c) 1997-1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * Copyright (c) 2003
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_INTERNAL_WINDOWS_H
-#define _STLP_INTERNAL_WINDOWS_H
-
-#if !defined (_STLP_PLATFORM)
-# define _STLP_PLATFORM "Windows"
-#endif
-
-/* _STLP_WIN32_VERSION is used to detect targetted Windows platforms as
- * old ones are not supporting some Win32 functions that STLport use.
- * Limited OSs are going up to and including Windows 98 so they can be
- * detected using WINVER or _WIN32_WINDOWS macros, we do not have to use
- * _WINNT_WINDOWS macro for the moment.
- */
-#if !defined (_STLP_WIN32_VERSION)
-# if defined (WINVER)
-# define _STLP_WIN32_VERSION WINVER
-# elif defined (_WIN32_WINDOWS)
-# define _STLP_WIN32_VERSION _WIN32_WINDOWS
-# endif
-#endif
-
-#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN)
-# if defined (_MIPSEB)
-# define _STLP_BIG_ENDIAN 1
-# endif
-# if defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \
- defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \
- defined (__alpha__)
-# define _STLP_LITTLE_ENDIAN 1
-# endif
-# if defined (__ia64__)
- /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */
-# if defined (__BIG_ENDIAN__)
-# define _STLP_BIG_ENDIAN 1
-# else
-# define _STLP_LITTLE_ENDIAN 1
-# endif
-# endif
-#endif /* _STLP_BIG_ENDIAN */
-
-#if !defined (_STLP_WINDOWS_H_INCLUDED)
-# define _STLP_WINDOWS_H_INCLUDED
-# if !(defined ( _STLP_MSVC ) || defined (__BORLANDC__) || defined (__ICL) || defined (__WATCOMC__) || \
- defined (__MINGW32__) || defined (__DMC__))
-# if defined (_STLP_USE_MFC)
-# include <afx.h>
-# else
-# include <windows.h>
-# endif
-# else
-/* This section serves as a replacement for windows.h header for Visual C++ */
-# if defined (__cplusplus)
-extern "C" {
-# endif
-# if (defined (_M_AMD64) || defined (_M_IA64) || (!defined (_STLP_WCE) && defined (_M_MRX000)) || defined (_M_ALPHA) || \
- (defined (_M_PPC) && (_STLP_MSVC_LIB >= 1000))) && !defined (RC_INVOKED)
-# define InterlockedIncrement _InterlockedIncrement
-# define InterlockedDecrement _InterlockedDecrement
-# define InterlockedExchange _InterlockedExchange
-/* Here we use a different macro name than the InterlockedExchangePointer SDK function
- * to avoid macro definition conflict as the SDK might already define InterlockedExchangePointer
- * as a macro.
- */
-# define STLPInterlockedExchangePointer _InterlockedExchangePointer
-# define _STLP_STDCALL
-# else
-# if defined (_MAC)
-# define _STLP_STDCALL _cdecl
-# else
-# define _STLP_STDCALL __stdcall
-# endif
-# endif
-
-# if defined (_STLP_NEW_PLATFORM_SDK)
-_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long volatile *);
-_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long volatile *);
-_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long volatile *, long);
-# if defined (STLPInterlockedExchangePointer)
-_STLP_IMPORT_DECLSPEC void* _STLP_STDCALL STLPInterlockedExchangePointer(void* volatile *, void*);
-# endif
-_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchangeAdd(long volatile *, long);
-# elif defined (_STLP_WCE)
-
-/* start of eMbedded Visual C++ specific section */
-# include <windef.h> /* needed for basic windows types */
-
- /** in SDKs generated with PB5, windef.h somehow includes headers which then
- define setjmp. */
-# if (_WIN32_WCE >= 0x500)
-# define _STLP_NATIVE_SETJMP_H_INCLUDED
-# endif
-
-# ifndef _WINBASE_ /* winbase.h already included? */
-long WINAPI InterlockedIncrement(long*);
-long WINAPI InterlockedDecrement(long*);
-long WINAPI InterlockedExchange(long*, long);
-# endif
-
-# ifndef __WINDOWS__ /* windows.h already included? */
-
-# if defined (x86)
-# include <winbase.h> /* needed for inline versions of Interlocked* functions */
-# endif
-
-# ifndef _MFC_VER
-
-# define MessageBox MessageBoxW
-int WINAPI MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
-
-# define wvsprintf wvsprintfW
-int WINAPI wvsprintfW(LPWSTR, LPCWSTR, va_list ArgList);
-
-void WINAPI ExitThread(DWORD dwExitCode);
-
-# if !defined (COREDLL)
-# define _STLP_WCE_WINBASEAPI DECLSPEC_IMPORT
-# else
-# define _STLP_WCE_WINBASEAPI
-# endif
-
-_STLP_WCE_WINBASEAPI int WINAPI
-MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
- int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
-
-_STLP_WCE_WINBASEAPI UINT WINAPI GetACP();
-
-_STLP_WCE_WINBASEAPI BOOL WINAPI TerminateProcess(HANDLE hProcess, DWORD uExitCode);
-
-# define OutputDebugString OutputDebugStringW
-void WINAPI OutputDebugStringW(LPCWSTR);
-
-_STLP_WCE_WINBASEAPI void WINAPI Sleep(DWORD);
-
-# undef _STLP_WCE_WINBASEAPI
-
-# endif /* !_MFC_VER */
-
-# endif /* !__WINDOWS__ */
-
-/* end of eMbedded Visual C++ specific section */
-
-# else
-/* boris : for the latest SDK, you may actually need the other version of the declaration (above)
- * even for earlier VC++ versions. There is no way to tell SDK versions apart, sorry ...
- */
-_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long*);
-_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long*);
-_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long*, long);
-# endif
-
-# if !defined (STLPInterlockedExchangePointer)
-/* This API function do not exist in the old platform SDK and is equivalent to
- * InterlockedExchange on 32 bits platform:
- */
-# if defined (__cplusplus)
-/* We do not define this function if we are not in a C++ translation unit just
- * because of the inline portability issue it would introduce. We will have to
- * fix it the day we need this function for a C translation unit.
- */
-inline
-void* _STLP_CALL STLPInterlockedExchangePointer(void* volatile* __a, void* __b) {
-# if defined (_STLP_MSVC)
-/* Here MSVC produces warning if 64 bits portability issue is activated.
- * MSVC do not see that _STLP_ATOMIC_EXCHANGE_PTR is a macro which content
- * is based on the platform, Win32 or Win64
- */
-# pragma warning (push)
-# pragma warning (disable : 4311) // pointer truncation from void* to long
-# pragma warning (disable : 4312) // conversion from long to void* of greater size
-# endif
-# if !defined (_STLP_NO_NEW_STYLE_CASTS)
- return reinterpret_cast<void*>(InterlockedExchange(reinterpret_cast<long*>(const_cast<void**>(__a)),
- reinterpret_cast<long>(__b)));
-# else
- return (void*)InterlockedExchange((long*)__a, (long)__b);
-# endif
-# if defined (_STLP_MSVC)
-# pragma warning (pop)
-# endif
-}
-# endif
-# endif
-
-# if !defined (_STLP_WCE)
-_STLP_IMPORT_DECLSPEC void _STLP_STDCALL Sleep(unsigned long);
-_STLP_IMPORT_DECLSPEC void _STLP_STDCALL OutputDebugStringA(const char* lpOutputString);
-# endif
-
-# if defined (InterlockedIncrement)
-# pragma intrinsic(_InterlockedIncrement)
-# pragma intrinsic(_InterlockedDecrement)
-# pragma intrinsic(_InterlockedExchange)
-# pragma intrinsic(_InterlockedExchangePointer)
-# endif
-# if defined (__cplusplus)
-} /* extern "C" */
-# endif
-
-# endif /* STL_MSVC __BORLANDC__ __ICL __WATCOMC__ __MINGW32__ __DMC__*/
-
-#endif /* _STLP_WINDOWS_H_INCLUDED */
-
-#endif /* _STLP_INTERNAL_WINDOWS_H */
diff --git a/stl/config/compat.h b/stl/config/compat.h
deleted file mode 100644
index f03d874..0000000
--- a/stl/config/compat.h
+++ /dev/null
@@ -1,84 +0,0 @@
-
-/*
- * Compatibility section
- * This section sets new-style macros based on old-style ones, for compatibility
- */
-
-#if defined (__STL_DEBUG) && !defined (_STLP_DEBUG)
-# define _STLP_DEBUG __STL_DEBUG
-#endif
-#if defined (__STL_NO_ANACHRONISMS) && !defined (_STLP_NO_ANACHRONISMS)
-# define _STLP_NO_ANACHRONISMS __STL_NO_ANACHRONISMS
-#endif
-#if defined (__STL_NO_EXTENSIONS) && !defined (_STLP_NO_EXTENSIONS)
-# define _STLP_NO_EXTENSIONS __STL_NO_EXTENSIONS
-#endif
-#if defined (__STL_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS)
-# define _STLP_NO_EXCEPTIONS __STL_NO_EXCEPTIONS
-#endif
-#if defined (__STL_NO_NAMESPACES) && !defined (_STLP_NO_NAMESPACES)
-# define _STLP_NO_NAMESPACES __STL_NO_NAMESPACES
-#endif
-#if defined (__STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
-# define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS __STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS
-#endif
-#if defined (__STL_NO_OWN_NAMESPACE) && !defined (_STLP_NO_OWN_NAMESPACE)
-# define _STLP_NO_OWN_NAMESPACE __STL_NO_OWN_NAMESPACE
-#endif
-
-#if defined (__STL_NO_RELOPS_NAMESPACE) && !defined (_STLP_NO_RELOPS_NAMESPACE)
-# define _STLP_NO_RELOPS_NAMESPACE __STL_NO_RELOPS_NAMESPACE
-#endif
-
-#if defined (__STL_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_UNINITIALIZED)
-# define _STLP_DEBUG_UNINITIALIZED __STL_DEBUG_UNINITIALIZED
-#endif
-#if defined (__STL_SHRED_BYTE) && !defined (_STLP_SHRED_BYTE)
-# define _STLP_SHRED_BYTE __STL_SHRED_BYTE
-#endif
-#if defined (__STL_USE_MFC) && !defined (_STLP_USE_MFC)
-# define _STLP_USE_MFC __STL_USE_MFC
-#endif
-
-#if defined (__STL_USE_NEWALLOC) && !defined (_STLP_USE_NEWALLOC)
-# define _STLP_USE_NEWALLOC __STL_USE_NEWALLOC
-#endif
-#if defined (__STL_USE_MALLOC) && !defined (_STLP_USE_MALLOC)
-# define _STLP_USE_MALLOC __STL_USE_MALLOC
-#endif
-
-#if defined (__STL_DEBUG_ALLOC) && !defined (_STLP_DEBUG_ALLOC)
-# define _STLP_DEBUG_ALLOC __STL_DEBUG_ALLOC
-#endif
-
-#if defined (__STL_DEBUG_MESSAGE) && !defined (_STLP_DEBUG_MESSAGE)
-# define _STLP_DEBUG_MESSAGE __STL_DEBUG_MESSAGE
-#endif
-
-#if defined (__STL_DEBUG_TERMINATE) && !defined (_STLP_DEBUG_TERMINATE)
-# define _STLP_DEBUG_TERMINATE __STL_DEBUG_TERMINATE
-#endif
-
-#if defined (__STL_USE_ABBREVS) && !defined (_STLP_USE_ABBREVS)
-# define _STLP_USE_ABBREVS __STL_USE_ABBREVS
-#endif
-
-#if defined (__STL_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_NO_MSVC50_COMPATIBILITY)
-# define _STLP_NO_MSVC50_COMPATIBILITY __STL_NO_MSVC50_COMPATIBILITY
-#endif
-
-#if defined (__STL_USE_RAW_SGI_ALLOCATORS) && !defined (_STLP_USE_RAW_SGI_ALLOCATORS)
-# define _STLP_USE_RAW_SGI_ALLOCATORS __STL_USE_RAW_SGI_ALLOCATORS
-#endif
-
-/* STLport do not support anymore the iostream wrapper mode so this macro should
- * always been define for other libraries that was using it:
- */
-#if !defined (_STLP_OWN_IOSTREAMS)
-# define _STLP_OWN_IOSTREAMS
-#endif
-
-#if defined (_STLP_NO_OWN_IOSTREAMS)
-# error STLport do not support anymore the wrapper mode. If you want to use STLport \
-use its iostreams implementation or no iostreams at all.
-#endif
diff --git a/stl/config/features.h b/stl/config/features.h
deleted file mode 100644
index 7b285d5..0000000
--- a/stl/config/features.h
+++ /dev/null
@@ -1,1196 +0,0 @@
- /*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_FEATURES_H
-#define _STLP_FEATURES_H
-
-/*
- * Purpose of this file:
- *
- * Defines all STLport settings.
- * This file is actually a wrapper : it includes compiler-specific
- * settings from <config/stlcomp.h>
- * and user-defined settings from <config/user_config.h>.
- * See <config/stl_mycomp.h> and <config/user_config.h> for the description
- * of those macros
- *
- */
-
-/* Definition of the STLport version informations */
-#include <stl/_stlport_version.h>
-
-/* Other macros defined by this file:
-
- * bool, true, and false, if _STLP_NO_BOOL is defined.
- * typename, as a null macro if it's not already a keyword.
- * explicit, as a null macro if it's not already a keyword.
- * namespace-related macros (_STLP_STD, _STLP_BEGIN_NAMESPACE, etc.)
- * exception-related macros (_STLP_TRY, _STLP_UNWIND, etc.)
- * _STLP_ASSERT, either as a test or as a null macro, depending on
- whether or not _STLP_ASSERTIONS is defined.
-*/
-
-/* Definition of the 2 STLport debug levels */
-#define _STLP_STLPORT_DBG_LEVEL 1
-#define _STLP_STANDARD_DBG_LEVEL 2
-
-/* Placeholder for user to override settings.
- * It could be also used to mask settings from
- * different directories.
- */
-#include <stl/config/user_config.h>
-
-#if defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_LEVEL)
-# define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL
-#endif
-
-#if defined (__BUILDING_STLPORT)
-/* For the STLport implementation we can use everything:
- */
-# if defined (_STLP_NO_ANACHRONISMS)
-# undef _STLP_NO_ANACHRONISMS
-# endif
-# if defined (_STLP_NO_EXTENSIONS)
-# undef _STLP_NO_EXTENSIONS
-# endif
-/* Moreover there are things that has no sens:
- */
-# if defined (_STLP_NO_IOSTREAMS)
-# error If you do not use iostreams you do not need to build the STLport library.
-# endif
-#endif
-
-/* ========================================================= */
-/* This file is used for compatibility; it accepts old-style config
- switches */
-#include <stl/config/compat.h>
-
-/* Common configuration file for this particular installation. */
-#include <stl/config/host.h>
-
-/* Operational Environment specific */
-#include <stl/config/_system.h>
-
-/* ========================================================= */
-
-/* some fixes to configuration. This also includes modifications
- * of STLport switches depending on compiler flags,
- * or settings applicable to a group of compilers, such as
- * to all who use EDG front-end.
- */
-#include <stl/config/stl_confix.h>
-
-#ifdef _STLP_USE_BOOST_SUPPORT
-/* We are going to use the boost library support. To limit the problem
- * of self referencing headers we have to specify clearly to the boost
- * library that the Standard lib is STLport:
- */
-# ifndef BOOST_STDLIB_CONFIG
-# define BOOST_STDLIB_CONFIG <boost/config/stdlib/stlport.hpp>
-# endif
-#endif
-
-
-/*
- * Performs integrity check on user-specified parameters
- * and site-specific settings.
- */
-/*
-# include <stl/_check_config.h>
-*/
-
-/* SGI terms */
-
-#if !defined (_STLP_NO_MEMBER_TEMPLATES) && !defined (_STLP_MEMBER_TEMPLATES)
-# define _STLP_MEMBER_TEMPLATES 1
-#endif
-
-#if !defined (_STLP_NO_FRIEND_TEMPLATES) && !defined (_STLP_FRIEND_TEMPLATES)
-# define _STLP_FRIEND_TEMPLATES 1
-#endif
-
-#if !defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
-# define _STLP_MEMBER_TEMPLATE_CLASSES 1
-#endif
-
-#if defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
-# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1
-#endif
-
-#if !defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-# define _STLP_CLASS_PARTIAL_SPECIALIZATION 1
-#endif
-
-#if !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER)
-# define _STLP_FUNCTION_TMPL_PARTIAL_ORDER 1
-#endif
-
-#if !defined (_STLP_DONT_USE_SHORT_STRING_OPTIM) && !defined (_STLP_USE_SHORT_STRING_OPTIM)
-# define _STLP_USE_SHORT_STRING_OPTIM 1
-#endif
-
-#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXTENSIONS) && \
- !defined (_STLP_NO_CONTAINERS_EXTENSION) && !defined (_STLP_USE_CONTAINERS_EXTENSION)
-# define _STLP_USE_CONTAINERS_EXTENSION
-#endif
-
-#if defined (_STLP_USE_CONTAINERS_EXTENSION)
-# define _STLP_TEMPLATE_FOR_CONT_EXT template <class _KT>
-#else
-# define _STLP_TEMPLATE_FOR_CONT_EXT
-#endif
-
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS) && \
- (defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS))
-# error "Sorry but according the STLport settings your compiler can not support the pointer specialization feature."
-#endif
-
-#if defined (_STLP_NO_IOSTREAMS) && \
- !defined (_STLP_USE_NEWALLOC) && !defined (_STLP_USE_MALLOC)
-# define _STLP_USE_NEWALLOC
-#endif
-
-#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN)
-# if defined (_MIPSEB) || defined (__sparc) || defined (_AIX) || \
- defined (__hpux) || defined (macintosh) || defined (_MAC)
-# define _STLP_BIG_ENDIAN 1
-# elif defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \
- defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \
- defined (__alpha__)
-# define _STLP_LITTLE_ENDIAN 1
-# elif defined (__ia64__)
- /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */
-# if defined (__BIG_ENDIAN__)
-# define _STLP_BIG_ENDIAN 1
-# else
-# define _STLP_LITTLE_ENDIAN 1
-# endif
-# else
-# error "can't determine endianess"
-# endif
-#endif /* _STLP_BIG_ENDIAN */
-
-/* ==========================================================
- * final workaround tuning based on given flags
- * ========================================================== */
-
-#ifndef _STLP_UINT32_T
-# define _STLP_UINT32_T unsigned long
-#endif
-#ifndef _STLP_ABORT
-# define _STLP_ABORT() abort()
-#endif
-
-#if !defined (_STLP_HAS_NO_NAMESPACES)
-# if defined _STLP_NO_NAMESPACES
-# undef _STLP_USE_NAMESPACES
-# else
-/* assume it as the default, turn it off later if NO_NAMESPACES selected */
-# undef _STLP_USE_NAMESPACES
-# define _STLP_USE_NAMESPACES 1
-# endif
-#endif
-
-#if defined (_STLP_NO_IOSTREAMS)
-# define _STLP_USE_NO_IOSTREAMS
-#endif
-
-/* Operating system recognition (basic) */
-#if defined (__unix) || defined (__linux__) || defined (__QNX__) || defined (_AIX) || defined (__NetBSD__) || defined(__OpenBSD__) || defined (__Lynx__)
-# define _STLP_UNIX 1
-#elif defined(macintosh) || defined (_MAC)
-# define _STLP_MAC 1
-#elif defined (_WIN32) || defined (__WIN32) || defined (WIN32) || defined (__WIN32__)
-# ifndef __SYMBIAN32__
-# define _STLP_WIN32 1
-# endif
-#elif defined (__WIN16) || defined (WIN16) || defined (_WIN16)
-# define _STLP_WIN16
-#endif /* __unix */
-
-#if defined (_STLP_WIN16)
-# define _STLP_LDOUBLE_80
-#elif defined(_STLP_WIN32)
-# if defined (_STLP_MSVC) || defined (__ICL) || defined (__BORLANDC__) || defined (__CYGWIN__)
-# define _STLP_LDOUBLE_64
-# else
-# define _STLP_LDOUBLE_96
-# endif
-#elif defined (_STLP_UNIX)
-# if defined (__CYGWIN__)
-# define _STLP_LDOUBLE_96
-# endif
-#endif
-
-#if !defined (_STLP_LDOUBLE_64) && !defined (_STLP_LDOUBLE_80) && !defined (_STLP_LDOUBLE_96) && !defined (_STLP_LDOUBLE_128)
-# define _STLP_LDOUBLE_128
-#endif
-
-#if !defined (_STLP_NO_LONG_DOUBLE)
-# define _STLP_LONGEST_FLOAT_TYPE long double
-#else
-# define _STLP_LONGEST_FLOAT_TYPE double
-#endif
-
-/* Native headers access macros */
-#include <stl/config/_native_headers.h>
-
-/* shared library tune-up */
-
-#if defined (__BUILDING_STLPORT)
-/* if we are rebuilding right now, place everything here */
-# undef _STLP_DESIGNATED_DLL
-# define _STLP_DESIGNATED_DLL 1
-#endif
-
-/* Use own namespace always if possible and not explicitly instructed otherwise */
-#if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_BROKEN_USING_DIRECTIVE) && \
- !defined (_STLP_NO_OWN_NAMESPACE)
-# undef _STLP_USE_OWN_NAMESPACE
-# define _STLP_USE_OWN_NAMESPACE 1
-#else
-# undef _STLP_WHOLE_NATIVE_STD
-#endif
-
-#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED)
-
-# if defined (_PTHREADS)
-# define _STLP_PTHREADS
-# define _STLP_THREADS
-# endif
-# if defined (_UITHREADS)
-# define _STLP_UITHREADS
-# define _STLP_THREADS
-# endif
-
-# if defined (__sgi) && !defined (__KCC) && !defined (__GNUC__)
-# define _STLP_SGI_THREADS
-# elif defined (__DECC) || defined (__DECCXX)
-# define _STLP_DEC_THREADS
-# elif defined (_STLP_WIN32) && !defined (_STLP_PTHREADS)
-# define _STLP_WIN32THREADS 1
-# elif ((defined (__sun) && !defined (__linux__)) || defined (_UITHREADS) ) && \
- !defined(_STLP_PTHREADS)
-# define _STLP_UITHREADS
-# elif defined (__OS2__)
-# define _STLP_OS2THREADS
-# elif defined (__BEOS__)
-# define _STLP_BETHREADS
-# elif defined (__MWERKS__) && defined (N_PLAT_NLM) /* (__dest_os == __netware_os) */
-# define _STLP_NWTHREADS
-# else
-# define _STLP_PTHREADS
-# endif /* __sgi */
-# define _STLP_THREADS_DEFINED
-#endif
-
-#if (defined (_REENTRANT) || defined (_THREAD_SAFE) || \
- (defined (_POSIX_THREADS) && defined (__OpenBSD__))) && \
- !defined (_STLP_THREADS)
-# define _STLP_THREADS
-#endif /* _REENTRANT */
-
-#if defined (__linux__) && defined (_STLP_PTHREADS)
-/* # include <features.h> */
-
-# if defined (__USE_XOPEN2K) && !defined (_STLP_DONT_USE_PTHREAD_SPINLOCK)
-# define _STLP_USE_PTHREAD_SPINLOCK
-# define _STLP_STATIC_MUTEX _STLP_mutex
-# endif /* __USE_XOPEN2K */
-#endif /* __linux__ && _STLP_PTHREADS */
-
-#if defined (__OpenBSD__) && defined (_POSIX_THREADS) && !defined (_STLP_DONT_USE_PTHREAD_SPINLOCK)
-# define _STLP_USE_PTHREAD_SPINLOCK
-# define _STLP_STATIC_MUTEX _STLP_mutex
-#endif
-
-#ifndef _STLP_STATIC_MUTEX
-# define _STLP_STATIC_MUTEX _STLP_mutex_base
-#endif
-
-#if (defined (_MFC_VER) || defined (_AFXDLL)) && !defined (_STLP_USE_MFC)
-# define _STLP_USE_MFC 1
-#endif
-
-#if defined (_STLP_THREADS)
-# define _STLP_VOLATILE volatile
-/* windows.h _MUST be included before bool definition ;( */
-# if defined (_STLP_WIN32THREADS) && defined (_STLP_NO_BOOL)
-# undef NOMINMAX
-# define NOMINMAX
-# ifdef _STLP_USE_MFC
-# include <afx.h>
-# else
-# include <windows.h>
-# endif
-# define _STLP_WINDOWS_H_INCLUDED
-# endif
-#else
-# define _STLP_VOLATILE
-#endif
-
-#if !defined (_STLP_USE_NEW_C_HEADERS) && !defined (_STLP_HAS_NO_NEW_C_HEADERS)
-# define _STLP_USE_NEW_C_HEADERS
-#endif
-/* disable new-style headers if requested */
-#if defined (_STLP_NO_NEW_C_HEADERS)
-# undef _STLP_USE_NEW_C_HEADERS
-#endif
-
-#if !defined (_STLP_STATIC_TEMPLATE_DATA)
-# define _STLP_STATIC_TEMPLATE_DATA 1
-#endif
-
-#if defined (_STLP_BASE_TYPEDEF_BUG)
-# undef _STLP_BASE_TYPEDEF_OUTSIDE_BUG
-# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
-#endif
-
-#if defined (_STLP_NESTED_TYPE_PARAM_BUG) || (defined (_STLP_MSVC) && (_STLP_MSVC < 1100))
-# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG
-#endif
-
-/* SUNpro 4.2 inline string literal bug */
-#ifdef _STLP_INLINE_STRING_LITERAL_BUG
-# define _STLP_FIX_LITERAL_BUG(__x) __x = __x;
-#else
-# define _STLP_FIX_LITERAL_BUG(__x)
-#endif
-
-#if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
-# undef _STLP_NO_DEFAULT_NON_TYPE_PARAM
-# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
-#endif
-
-#define _STLP_NEW new
-#define _STLP_PLACEMENT_NEW new
-
-#ifdef _STLP_DEBUG
-# define _STLP_ASSERTIONS 1
-#endif
-
-#if !defined (_STLP_STATIC_ASSERT)
-/* Some compiler support 0 size array so we use negative size array to generate
- * a compilation time error.
- */
-# define _STLP_STATIC_ASSERT(expr) typedef char __static_assert[expr ? 1 : -1];
-#endif
-
-/* apple mpw exception handling bug */
-#ifndef _STLP_MPWFIX_TRY
-# define _STLP_MPWFIX_TRY
-#endif
-#ifndef _STLP_MPWFIX_CATCH
-# define _STLP_MPWFIX_CATCH
-#endif
-#ifndef _STLP_MPWFIX_CATCH_ACTION
-# define _STLP_MPWFIX_CATCH_ACTION(action)
-#endif
-
-/* if _STLP_DEBUG or _STLP_ASSERTIONS are set, stl/debug/_debug.h defines those */
-
-#if !defined (_STLP_ASSERTIONS) && !defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_ALLOC)
-# define _STLP_ASSERT(expr)
-#endif
-
-#if !defined (_STLP_DEBUG)
-# define _STLP_VERBOSE_ASSERT(expr,diagnostic)
-# define _STLP_DEBUG_CHECK(expr)
-# define _STLP_DEBUG_DO(expr)
-#endif
-
-#if !defined (_STLP_WEAK)
-# define _STLP_WEAK
-#endif
-
-/* default parameters as template types derived from arguments ( not always supported ) */
-#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname
-#else
-# if !defined (_STLP_DEFAULT_TYPE_PARAM)
-# define _STLP_DEFAULT_TYPE_PARAM 1
-# endif
-# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname = defval
-#endif
-
-/* default parameters as complete types */
-#if defined (_STLP_DEFAULT_TYPE_PARAM)
-# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname = defval
-# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name = val
-#else
-# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname
-# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name
-#endif
-
-/* SGI compatibility */
-
-#ifdef _STLP_NO_WCHAR_T
-# ifndef _STLP_NO_NATIVE_WIDE_STREAMS
-# define _STLP_NO_NATIVE_WIDE_STREAMS 1
-# endif
-#else
-# define _STLP_HAS_WCHAR_T 1
-#endif
-
-#if !defined (_STLP_NO_AT_MEMBER_FUNCTION)
-# define _STLP_CAN_THROW_RANGE_ERRORS 1
-#endif
-
-#if !defined (_STLP_USE_RAW_SGI_ALLOCATORS)
-# define _STLP_DEFAULT_ALLOCATOR(_Tp) allocator< _Tp >
-# define _STLP_DEFAULT_ALLOCATOR_SELECT( _Tp ) _STLP_DFL_TMPL_PARAM(_Alloc, allocator< _Tp >)
-# define _STLP_DEFAULT_PAIR_ALLOCATOR(_Key, _Tp) allocator< pair < _Key, _Tp > >
-# if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
-# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) class _Alloc
-# define _STLP_USE_WRAPPER_FOR_ALLOC_PARAM 1
-# else
-# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) \
- class _Alloc = allocator< pair < _Key, _Tp > >
-# endif
-#else
-# define _STLP_DEFAULT_ALLOCATOR( _Tp ) __sgi_alloc
-# define _STLP_DEFAULT_ALLOCATOR_SELECT( _Tp ) _STLP_DFL_TYPE_PARAM(_Alloc,__sgi_alloc)
-# define _STLP_DEFAULT_PAIR_ALLOCATOR( _Key, _Tp ) __sgi_alloc
-# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) _STLP_DFL_TYPE_PARAM(_Alloc,__sgi_alloc)
-# if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) && !defined (_STLP_DEFAULT_TYPE_PARAM)
-# define _STLP_USE_WRAPPER_FOR_ALLOC_PARAM 1
-# endif
-#endif
-
-/* debug mode tool */
-#if defined (_STLP_DEBUG)
-# define _STLP_NON_DBG_NAME(X) _NonDbg_##X
-#endif
-
-/* pointer specialization tool */
-#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
-# define _STLP_PTR_IMPL_NAME(X) _Impl_##X
-#endif
-
-#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-# define _STLP_NO_MEM_T_NAME(X) _NoMemT_##X
-# if defined (_STLP_DEBUG)
-# define _STLP_NON_DBG_NO_MEM_T_NAME(X) _NonDbg_NoMemT_##X
-# endif
-#endif
-
-/* this always mean the C library is in global namespace */
-#if defined (_STLP_HAS_NO_NEW_C_HEADERS) && !defined (_STLP_VENDOR_GLOBAL_CSTD)
-# define _STLP_VENDOR_GLOBAL_CSTD 1
-#endif
-
-/* Depending of whether compiler supports namespaces,
- * tune the parameters for vendor-supplied libraries.
- * This section is guarded by _STLP_HAS_NO_NAMESPACES, not by _STLP_USE_NAMESPACES,
- * since it depends only on the native features, not on user's preference whether
- * to use namespace for STLport or not.
- */
-#if !defined (_STLP_HAS_NO_NAMESPACES)
-/* Import some vendor's headers into corresponding STLport ones if they might be needed
- * (if we wrap native iostreams and use namepace other than std::) */
-# if defined (_STLP_WHOLE_NATIVE_STD)
-# define _STLP_IMPORT_VENDOR_STD 1
-# undef _STLP_MINIMUM_IMPORT_STD
-# endif
-
-/* if using stlport:: namespace or if C library stuff is not in vendor's std::,
- * try importing 'em.
- * MSVC has ambiguity problem when we try to import C-style std:: stuff back into global namespace */
-# if defined (_STLP_USE_NAMESPACES) && (defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_VENDOR_GLOBAL_CSTD))
-# define _STLP_IMPORT_VENDOR_CSTD 1
-# endif
-
-# if defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS) && !defined (_STLP_DO_IMPORT_CSTD_FUNCTIONS)
-# define _STLP_NO_CSTD_FUNCTION_IMPORTS
-# endif
-
-# define _STLP_USING_NAMESPACE(x) using namespace x ;
-
-namespace std { }
-namespace __std_alias = std;
-
-/* assume std:: namespace for C++ std library if not being told otherwise */
-# if defined (_STLP_VENDOR_GLOBAL_STD)
-# define _STLP_VENDOR_STD
-# else
-# define _STLP_VENDOR_STD __std_alias
-# endif
-
-/* tune things that come from C library */
-# if defined (_STLP_VENDOR_GLOBAL_CSTD) || !defined(_STLP_USE_NEW_C_HEADERS)
-/* in old-style headers, C functions go to global scope. */
-# define _STLP_VENDOR_CSTD
-# define _STLP_USING_VENDOR_CSTD
-# else
-# define _STLP_VENDOR_CSTD _STLP_VENDOR_STD
-# define _STLP_USING_VENDOR_CSTD _STLP_USING_NAMESPACE(_STLP_VENDOR_CSTD)
-# endif /* _STLP_VENDOR_CSTD */
-/* exception, typeinfo, new - always come from the vendor */
-# if !defined (_STLP_VENDOR_EXCEPT_STD)
-# if defined (_STLP_VENDOR_GLOBAL_EXCEPT_STD)
-# define _STLP_VENDOR_EXCEPT_STD
-# else
-# define _STLP_VENDOR_EXCEPT_STD _STLP_VENDOR_STD
-# endif
-# endif
-# define _STLP_OLD_IO_NAMESPACE
-# if !defined (_STLP_VENDOR_MB_NAMESPACE)
-# define _STLP_VENDOR_MB_NAMESPACE _STLP_VENDOR_CSTD
-# endif
-#else
-/* compiler has no namespace support */
-# define _STLP_VENDOR_STD
-# define _STLP_VENDOR_CSTD
-# define _STLP_USING_NAMESPACE(x)
-# define _STLP_USING_VENDOR_CSTD
-# define _STLP_VENDOR_EXCEPT_STD
-#endif
-
-#if defined (_STLP_USE_NAMESPACES)
-
-# if defined (_STLP_USE_OWN_NAMESPACE)
-# if !defined (_STLP_STD_NAME)
-# if !defined (_STLP_DEBUG)
-# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
-# ifndef _STLP_THREADS
-# define _STLP_STD_NAME stlpmtx_std
-# else
-# define _STLP_STD_NAME stlp_std
-# endif
-# else
-# ifndef _STLP_THREADS
-# define _STLP_STD_NAME stlpxmtx_std
-# else
-# define _STLP_STD_NAME stlpx_std
-# endif
-# endif
-# else
-/*
- * The STLport debug mode is binary incompatible with the other modes,
- * lets make it clear on the STLport namespace to generate link errors rather
- * than runtime.
- */
-# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
-# ifndef _STLP_THREADS
-# define _STLP_STD_NAME stlpdmtx_std
-# else
-# define _STLP_STD_NAME stlpd_std
-# endif
-# else
-# ifndef _STLP_THREADS
-# define _STLP_STD_NAME stlpdxmtx_std
-# else
-# define _STLP_STD_NAME stlpdx_std
-# endif
-# endif
-# endif
-# endif
-namespace _STLP_STD_NAME { }
-# else
-# if defined (_STLP_DEBUG)
-namespace stdD = std;
-# endif
-# define _STLP_STD_NAME std
-# endif /* _STLP_USE_OWN_NAMESPACE */
-
-# if !defined (_STLP_USING_NAMESPACE_BUG)
-# define _STLP_PRIV_NAME stlp_priv
-namespace _STLP_PRIV_NAME {
- using namespace _STLP_STD_NAME;
-}
-# else
-# define _STLP_PRIV_NAME priv
-# endif
-
-# define _STLP_BEGIN_NAMESPACE namespace _STLP_STD_NAME {
-# define _STLP_END_NAMESPACE }
-
-# if !defined (_STLP_DONT_USE_PRIV_NAMESPACE)
-# if !defined (_STLP_USING_NAMESPACE_BUG)
-/* We prefer to make private namespace a totaly seperated namespace...
- */
-# define _STLP_PRIV ::_STLP_PRIV_NAME::
-# define _STLP_MOVE_TO_PRIV_NAMESPACE } namespace _STLP_PRIV_NAME {
-# define _STLP_MOVE_TO_STD_NAMESPACE } namespace _STLP_STD_NAME {
-# else
-/* but sometimes we can't:
- */
-# define _STLP_PRIV _STLP_PRIV_NAME::
-# define _STLP_MOVE_TO_PRIV_NAMESPACE namespace _STLP_PRIV_NAME {
-# define _STLP_MOVE_TO_STD_NAMESPACE }
-# endif
-# else
-# define _STLP_PRIV
-# define _STLP_MOVE_TO_PRIV_NAMESPACE
-# define _STLP_MOVE_TO_STD_NAMESPACE
-# endif
-
-/* decide whether or not we use separate namespace for rel ops */
-# if defined (_STLP_NO_RELOPS_NAMESPACE)
-# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops {}
-# define _STLP_END_RELOPS_NAMESPACE }
-# else
-/* Use std::rel_ops namespace */
-# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops {
-# define _STLP_END_RELOPS_NAMESPACE } }
-# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-# endif /* Use std::rel_ops namespace */
-
-# define _STLP_STD ::_STLP_STD_NAME
-
-/* Official STLport namespace when std is not redefined.
- * Here we don't use a macro as stlport is used as file name by boost
- * and folder name under beos:
- */
-namespace stlport = _STLP_STD_NAME;
-
-/* Backward compatibility:
- */
-namespace _STL = _STLP_STD_NAME;
-#undef __STLPORT_NAMESPACE
-#define __STLPORT_NAMESPACE _STLP_STD_NAME
-
-#else /* _STLP_USE_NAMESPACES */
-/* STLport is being put into global namespace */
-# define _STLP_STD
-# define _STLP_PRIV
-# define _STLP_BEGIN_NAMESPACE
-# define _STLP_END_NAMESPACE
-# define _STLP_MOVE_TO_PRIV_NAMESPACE
-# define _STLP_MOVE_TO_STD_NAMESPACE
-
-/* boris : it was found out that _STLP_USE_SEPARATE_RELOPS_NAMESPACE
- causes less problems than having relational operator templates in global namespace
- Please define _STLP_NO_RELOPS_NAMESPACE in config/user_config.h if your code rely on them. */
-# if !defined (_STLP_NO_RELOPS_NAMESPACE)
-# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-# endif
-# define _STLP_BEGIN_RELOPS_NAMESPACE
-# define _STLP_END_RELOPS_NAMESPACE
-# undef _STLP_USE_OWN_NAMESPACE
-#endif /* _STLP_USE_NAMESPACES */
-
-#define STLPORT_CSTD _STLP_VENDOR_CSTD
-#define STLPORT _STLP_STD_NAME
-
-#if defined(_STLP_BOGUS_TEMPLATE_TYPE_MATCHING_BUG)
-# define _STLP_SIMPLE_TYPE(T) _stl_trivial_proxy<T>
-#else
-# define _STLP_SIMPLE_TYPE(T) T
-#endif
-
-#ifndef _STLP_RAND48
-# define _STLP_NO_DRAND48
-#endif
-
-/* advanced keywords usage */
-#define __C_CAST(__x, __y) ((__x)(__y))
-#ifndef _STLP_NO_NEW_STYLE_CASTS
-# define __CONST_CAST(__x,__y) const_cast<__x>(__y)
-# define __STATIC_CAST(__x,__y) static_cast<__x>(__y)
-# define __REINTERPRET_CAST(__x,__y) reinterpret_cast<__x>(__y)
-# define __DYNAMIC_CAST(__x,__y) dynamic_cast<__x>(__y)
-#else
-# define __STATIC_CAST(__x,__y) __C_CAST(__x, __y)
-# define __CONST_CAST(__x,__y) __C_CAST(__x, __y)
-# define __REINTERPRET_CAST(__x,__y) __C_CAST(__x, __y)
-# define __DYNAMIC_CAST(__x,__y) __C_CAST(__x, __y)
-#endif
-
-#if defined (_STLP_NEED_TYPENAME) && ! defined (typename)
-# define typename
-#endif
-
-#if defined (_STLP_NEED_TYPENAME) || defined (_STLP_NO_TYPENAME_ON_RETURN_TYPE )
-# define _STLP_TYPENAME_ON_RETURN_TYPE
-#else
-# define _STLP_TYPENAME_ON_RETURN_TYPE typename
-#endif
-
-#ifdef _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER
-# define _STLP_HEADER_TYPENAME
-#else
-# define _STLP_HEADER_TYPENAME typename
-#endif
-
-#ifndef _STLP_NO_MEMBER_TEMPLATE_KEYWORD
-# define _STLP_TEMPLATE template
-#else
-# define _STLP_TEMPLATE
-#endif
-
-#if defined (_STLP_USE_CONTAINERS_EXTENSION)
-# define _STLP_KEY_TYPE_FOR_CONT_EXT(type)
-# define _STLP_TEMPLATE_FOR_CONT_EXT template <class _KT>
-#else
-# define _STLP_KEY_TYPE_FOR_CONT_EXT(type) typedef type _KT;
-# define _STLP_TEMPLATE_FOR_CONT_EXT
-#endif
-
-#if defined (_STLP_NEED_EXPLICIT) && !defined (explicit)
-# define explicit
-#endif
-
-#if !defined (_STLP_NEED_MUTABLE)
-# define _STLP_ASSIGN_MUTABLE(type,x,y) x = y
-#else
-# define _STLP_ASSIGN_MUTABLE(type,x,y) __CONST_CAST(type,x)=y
-# define mutable
-#endif
-
-#if defined (_STLP_NO_SIGNED_BUILTINS)
-/* old HP-UX doesn't understand "signed" keyword */
-# define signed
-#endif
-
-#if defined (_STLP_LOOP_INLINE_PROBLEMS)
-# define _STLP_INLINE_LOOP
-#else
-# define _STLP_INLINE_LOOP inline
-#endif
-
-#define _STLP_PRIVATE public
-
-#ifndef _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX
-# define _STLP_TEMPLATE_NULL template<>
-#else
-# define _STLP_TEMPLATE_NULL
-#endif
-
-#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
-# define _STLP_OPERATOR_TEMPLATE
-#else
-# define _STLP_OPERATOR_TEMPLATE _STLP_TEMPLATE_NULL
-#endif
-
-#ifndef _STLP_CLASS_PARTIAL_SPECIALIZATION
-/* unless we have other compiler problem, try simulating partial spec here */
-# if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
-# define _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
-# endif
-/* For your own iterators, please use inheritance from iterator<> instead of these obsolete queries. */
-# if (defined (_STLP_NESTED_TYPE_PARAM_BUG) || !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS))
-# if ! defined ( _STLP_USE_OLD_HP_ITERATOR_QUERIES )
-# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
-# endif
-# elif defined ( _STLP_NO_ANACHRONISMS )
-# undef _STLP_USE_OLD_HP_ITERATOR_QUERIES
-# endif
-#endif
-
-#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
-# define _STLP_NULL_TMPL_ARGS <>
-# else
-# define _STLP_NULL_TMPL_ARGS
-#endif
-
-#if !defined (_STLP_ALLOCATOR_TYPE_DFL)
-# if defined (_STLP_DONT_SUP_DFLT_PARAM)
-# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
-# endif
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
-# define _STLP_ALLOCATOR_TYPE_DFL
-# else
-# define _STLP_ALLOCATOR_TYPE_DFL = allocator_type()
-# endif
-#endif
-
-/* When the compiler do not correctly initialized the basic types value in default parameters we prefer
- * to avoid them to be able to correct this bug.
- */
-#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG)
-# define _STLP_DONT_SUP_DFLT_PARAM 1
-#endif
-
-#if defined (__SGI_STL_NO_ARROW_OPERATOR) && ! defined (_STLP_NO_ARROW_OPERATOR)
-# define _STLP_NO_ARROW_OPERATOR
-#endif
-
-#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-# if !(defined (_STLP_NO_ARROW_OPERATOR)) && \
- !defined (_STLP_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_MSVC50_COMPATIBILITY)
-/* this one is needed for proper reverse_iterator<> operator ->() handling */
-# define _STLP_MSVC50_COMPATIBILITY 1
-# endif
-#endif
-
-#if defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION )
-# if (defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 600) )
-# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
- typedef typename _STLP_STD :: reverse_iterator<const_iterator> const_reverse_iterator; \
- typedef typename _STLP_STD :: reverse_iterator<iterator> reverse_iterator
-# elif (defined (__sgi) && ! defined (__GNUC__)) || defined (__SUNPRO_CC) || defined (__xlC__)
-# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
- typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator<const_iterator> const_reverse_iterator; \
- typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator<iterator> reverse_iterator
-# else
-# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
- typedef _STLP_STD::reverse_iterator<const_iterator> const_reverse_iterator; \
- typedef _STLP_STD::reverse_iterator<iterator> reverse_iterator
-# endif
-#else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-# if defined (_STLP_MSVC50_COMPATIBILITY)
-# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
- typedef _STLP_STD::__reverse_iterator<const_iterator, value_type, const_reference, \
- const_pointer, difference_type> const_reverse_iterator; \
- typedef _STLP_STD::__reverse_iterator<iterator, value_type, reference, pointer, difference_type> \
- reverse_iterator
-# else
-# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
- typedef _STLP_STD::__reverse_iterator<const_iterator, value_type, const_reference, \
- difference_type> const_reverse_iterator; \
- typedef _STLP_STD::__reverse_iterator<iterator, value_type, \
- reference, difference_type> \
- reverse_iterator
-# endif
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-#define _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS \
- _STLP_DECLARE_REVERSE_ITERATORS(reverse_bidirectional_iterator)
-#define _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS \
- _STLP_DECLARE_REVERSE_ITERATORS(reverse_iterator)
-
-#define __IMPORT_CONTAINER_TYPEDEFS(_Super) \
- typedef typename _Super::value_type value_type; \
- typedef typename _Super::size_type size_type; \
- typedef typename _Super::difference_type difference_type; \
- typedef typename _Super::reference reference; \
- typedef typename _Super::const_reference const_reference; \
- typedef typename _Super::pointer pointer; \
- typedef typename _Super::const_pointer const_pointer; \
- typedef typename _Super::allocator_type allocator_type;
-
-
-#define __IMPORT_ITERATORS(_Super) \
- typedef typename _Super::iterator iterator; \
- typedef typename _Super::const_iterator const_iterator;
-
-#define __IMPORT_REVERSE_ITERATORS(_Super) \
- typedef typename _Super::const_reverse_iterator const_reverse_iterator; \
- typedef typename _Super::reverse_iterator reverse_iterator;
-
-#define __IMPORT_SUPER_COPY_ASSIGNMENT(__derived_name, _Self, _SUPER) \
- __derived_name(const _Super& __x) : _SUPER(__x) {} \
- _Self& operator=(const _Super& __x) { \
- *(_Super*)this = __x; \
- return *this; \
- } \
- __derived_name(const _Self& __x) : _SUPER(__x) {} \
- _Self& operator=(const _Self& __x) { \
- *(_Super*)this = __x; \
- return *this; \
- }
-
-#define __IMPORT_WITH_ITERATORS(_Super) \
- __IMPORT_CONTAINER_TYPEDEFS(_Super) __IMPORT_ITERATORS(_Super)
-
-#define __IMPORT_WITH_REVERSE_ITERATORS(_Super) \
- __IMPORT_WITH_ITERATORS(_Super) __IMPORT_REVERSE_ITERATORS(_Super)
-
-#if defined (_STLP_TRIVIAL_CONSTRUCTOR_BUG)
-# define __TRIVIAL_CONSTRUCTOR(__type) __type() {}
-#else
-# define __TRIVIAL_CONSTRUCTOR(__type)
-#endif
-
-#if defined (_STLP_TRIVIAL_DESTRUCTOR_BUG)
-# define __TRIVIAL_DESTRUCTOR(__type) ~__type() {}
-#else
-# define __TRIVIAL_DESTRUCTOR(__type)
-#endif
-
-#define __TRIVIAL_STUFF(__type) \
- __TRIVIAL_CONSTRUCTOR(__type) __TRIVIAL_DESTRUCTOR(__type)
-
-#if defined (_STLP_HAS_NO_EXCEPTIONS)
-# define _STLP_NO_EXCEPTIONS
-#endif
-
-#if !defined (_STLP_DONT_USE_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_USE_EXCEPTIONS)
-# define _STLP_USE_EXCEPTIONS
-#endif
-
-#if defined (_STLP_USE_EXCEPTIONS)
-# define _STLP_TRY try
-# define _STLP_CATCH_ALL catch(...)
-# ifndef _STLP_THROW
-# define _STLP_THROW(x) throw x
-# endif
-# define _STLP_RETHROW throw
-
-# define _STLP_UNWIND(action) catch(...) { action; throw; }
-
-# ifdef _STLP_THROW_RETURN_BUG
-# define _STLP_RET_AFTER_THROW(data) return data;
-# else
-# define _STLP_RET_AFTER_THROW(data)
-# endif
-
-/* We do not use exception throw specifications unless we are forced to */
-# if !defined (_STLP_THROWS)
-# define _STLP_THROWS(x)
-# endif
-# if !defined (_STLP_NOTHROW)
-# define _STLP_NOTHROW
-# endif
-#else
-# define _STLP_TRY
-# define _STLP_CATCH_ALL if (false)
-# ifndef _STLP_THROW
-# define _STLP_THROW(x)
-# endif
-# define _STLP_RETHROW {}
-# define _STLP_UNWIND(action)
-# define _STLP_THROWS(x)
-# define _STLP_NOTHROW
-# define _STLP_RET_AFTER_THROW(data)
-#endif
-
-/*
- * Here we check _STLP_NO_EXCEPTIONS which means that the compiler has no
- * exception support but not the _STLP_USE_EXCEPTIONS which simply means
- * that the user do not want to use them.
- */
-#if !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTION_SPEC)
-# define _STLP_THROWS_INHERENTLY(x) throw x
-# define _STLP_NOTHROW_INHERENTLY throw()
-#else
-# define _STLP_THROWS_INHERENTLY(x)
-# define _STLP_NOTHROW_INHERENTLY
-#endif
-
-/* STLport function not returning are functions that throw so we translate
- * the noreturn functions in throwing functions taking also into account
- * exception support activation.
- */
-#if defined (_STLP_NORETURN_FUNCTION) && !defined (_STLP_NO_EXCEPTIONS) && \
- !defined (_STLP_FUNCTION_THROWS)
-# define _STLP_FUNCTION_THROWS _STLP_NORETURN_FUNCTION
-#else
-# define _STLP_FUNCTION_THROWS
-#endif
-
-#if defined(_STLP_NO_BOOL)
-# if (defined (__IBMCPP__) && (__IBMCPP__ < 400)) && ! defined (_AIX)
-# include <isynonym.hpp>
-# if defined (__OS400__)
-typedef int bool;
-# elif !( defined (__xlC__) || defined (_AIX))
-typedef Boolean bool;
-# endif
-# else
-# if defined(_STLP_YVALS_H)
-# include <yvals.h>
-# else
-# if defined (_STLP_DONT_USE_BOOL_TYPEDEF)
-# define bool int
-# else
-typedef int bool;
-# endif
-# define true 1
-# define false 0
-# endif
-# endif /* __IBMCPP__ */
-#else
-# define _STLP_BOOL_KEYWORD 1
-#endif /* _STLP_NO_BOOL */
-
-#ifndef _STLP_MPW_EXTRA_CONST
-# define _STLP_MPW_EXTRA_CONST
-#endif
-
-#ifndef _STLP_DEFAULTCHAR
-# define _STLP_DEFAULTCHAR char
-#endif
-
-#if defined (_STLP_DEBUG_ALLOC) && !defined (_STLP_ASSERTIONS)
-# define _STLP_ASSERTIONS 1
-#endif
-
-/* uninitialized value filler */
-#ifndef _STLP_SHRED_BYTE
-/* This value is designed to cause problems if an error occurs */
-# define _STLP_SHRED_BYTE 0xA3
-#endif /* _STLP_SHRED_BYTE */
-
-/* shared library tune-up */
-#ifndef _STLP_IMPORT_DECLSPEC
-# define _STLP_IMPORT_DECLSPEC
-#endif
-
-/* a keyword used to instantiate export template */
-#ifndef _STLP_EXPORT_TEMPLATE_KEYWORD
-# define _STLP_EXPORT_TEMPLATE_KEYWORD
-#endif
-#ifndef _STLP_IMPORT_TEMPLATE_KEYWORD
-# define _STLP_IMPORT_TEMPLATE_KEYWORD
-#endif
-
-#ifdef _STLP_USE_NO_IOSTREAMS
-/*
- * If we do not use iostreams we do not use the export/import
- * techniques to avoid build of the STLport library.
- */
-# undef _STLP_USE_DECLSPEC
-/* We also undef USE_DYNAMIC_LIB macro as this macro add some code
- * to use the dynamic (shared) STLport library for some platform/compiler
- * configuration leading to problem when do not link to the STLport lib.
- */
-# undef _STLP_USE_DYNAMIC_LIB
-#endif
-
-#if defined (_STLP_DLLEXPORT_NEEDS_PREDECLARATION) && defined (_STLP_USE_DECLSPEC)
-# if ! defined (_STLP_USE_TEMPLATE_EXPORT)
-/* this setting turns on "extern template" extension use */
-# define _STLP_USE_TEMPLATE_EXPORT
-# endif
-# if defined (_STLP_DESIGNATED_DLL) && ! defined (_STLP_NO_FORCE_INSTANTIATE)
-# define _STLP_NO_FORCE_INSTANTIATE
-# endif
-#endif
-
-#if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */
-# define _STLP_EXPORT _STLP_EXPORT_TEMPLATE_KEYWORD
-#else
-# define _STLP_EXPORT _STLP_IMPORT_TEMPLATE_KEYWORD
-#endif
-
-#ifndef _STLP_EXPORT_TEMPLATE
-# define _STLP_EXPORT_TEMPLATE _STLP_EXPORT template
-#endif
-
-#if defined (_STLP_USE_DECLSPEC) /* using export/import technique */
-
-# ifndef _STLP_EXPORT_DECLSPEC
-# define _STLP_EXPORT_DECLSPEC
-# endif
-# ifndef _STLP_IMPORT_DECLSPEC
-# define _STLP_IMPORT_DECLSPEC
-# endif
-# ifndef _STLP_CLASS_EXPORT_DECLSPEC
-# define _STLP_CLASS_EXPORT_DECLSPEC
-# endif
-# ifndef _STLP_CLASS_IMPORT_DECLSPEC
-# define _STLP_CLASS_IMPORT_DECLSPEC
-# endif
-# if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */
-# define _STLP_DECLSPEC _STLP_EXPORT_DECLSPEC
-# define _STLP_CLASS_DECLSPEC _STLP_CLASS_EXPORT_DECLSPEC
-# else
-# define _STLP_DECLSPEC _STLP_IMPORT_DECLSPEC /* Other modules, importing STLport exports */
-# define _STLP_CLASS_DECLSPEC _STLP_CLASS_IMPORT_DECLSPEC
-# endif
-
-#else /* Not using DLL export/import specifications */
-
-# define _STLP_DECLSPEC
-# define _STLP_CLASS_DECLSPEC
-
-#endif
-
-#define _STLP_EXPORT_TEMPLATE_CLASS _STLP_EXPORT template class _STLP_CLASS_DECLSPEC
-
-#if defined (_STLP_MSVC) || defined (__ICL)
-# define _STLP_STATIC_MEMBER_DECLSPEC
-#else
-# define _STLP_STATIC_MEMBER_DECLSPEC _STLP_DECLSPEC
-#endif
-
-#if !defined (_STLP_CALL)
-# define _STLP_CALL
-#endif
-
-#ifndef _STLP_USE_NO_IOSTREAMS
-
-# if defined (__DECCXX) && ! defined (__USE_STD_IOSTREAM)
-# define __USE_STD_IOSTREAM
-# endif
-
-/* We only need to expose details of streams implementation
- if we use non-standard i/o or are building STLport*/
-# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE) || !defined(_STLP_NO_CUSTOM_IO)
-# define _STLP_EXPOSE_STREAM_IMPLEMENTATION 1
-# endif
-
-/* We only need to expose details of global implementation if we are building STLport
- or have not instantiated everything in the lib */
-# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE)
-# undef _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
-# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION 1
-# endif
-
-#else /* _STLP_USE_NO_IOSTREAMS */
-/* when we are not using SGI iostreams, we must expose globals, but not streams implementation */
-# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
-#endif /* _STLP_USE_NO_IOSTREAMS */
-
-#ifdef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
-# define _STLP_PSPEC2(t1,t2) < t1,t2 >
-# define _STLP_PSPEC3(t1,t2,t3) < t1,t2,t3 >
-#else
-# define _STLP_PSPEC2(t1,t2) /* nothing */
-# define _STLP_PSPEC3(t1,t2,t3) /* nothing */
-#endif
-
-/* Activation of the partial template workaround:
- */
-#if !defined(_STLP_DONT_USE_PARTIAL_SPEC_WRKD) &&\
- (!defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) || !defined(_STLP_FUNCTION_TMPL_PARTIAL_ORDER))
-# define _STLP_USE_PARTIAL_SPEC_WORKAROUND
-#endif
-
-#ifndef _STLP_USE_NO_IOSTREAMS
-# define _STLP_NEW_IO_NAMESPACE _STLP_STD
-# define _STLP_NO_WIDE_STREAMS _STLP_NO_WCHAR_T
-#endif
-
-#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
-# define _STLP_RELOPS_OPERATORS(_TMPL, _TP) \
-_TMPL inline bool _STLP_CALL operator!=(const _TP& __x, const _TP& __y) {return !(__x == __y);}\
-_TMPL inline bool _STLP_CALL operator>(const _TP& __x, const _TP& __y) {return __y < __x;}\
-_TMPL inline bool _STLP_CALL operator<=(const _TP& __x, const _TP& __y) { return !(__y < __x);}\
-_TMPL inline bool _STLP_CALL operator>=(const _TP& __x, const _TP& __y) { return !(__x < __y);}
-#else
-# define _STLP_RELOPS_OPERATORS(_TMPL, _TP)
-#endif
-
-#if defined ( _STLP_USE_ABBREVS )
-# include <stl/_abbrevs.h>
-#endif
-
-/* A really useful macro */
-#define _STLP_ARRAY_SIZE(A) sizeof(A) / sizeof(A[0])
-#define _STLP_ARRAY_AND_SIZE(A) A, sizeof(A) / sizeof(A[0])
-
-/* some cleanup */
-#undef _STLP_DONT_USE_BOOL_TYPEDEF
-#undef _STLP_YVALS_H
-#undef _STLP_LOOP_INLINE_PROBLEMS
-#undef _STLP_NEED_EXPLICIT
-#undef _STLP_NEED_TYPENAME
-#undef _STLP_NO_NEW_STYLE_CASTS
-#undef __AUTO_CONFIGURED
-
-#endif /* _STLP_FEATURES_H */
diff --git a/stl/config/host.h b/stl/config/host.h
deleted file mode 100644
index 95b71a3..0000000
--- a/stl/config/host.h
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * This file defines site configuration.
- */
-
-/*
- * _STLP_NO_THREADS: if defined, STLport don't use any
- * multithreading support. Synonym is _NOTHREADS
- */
-/*
-#define _NOTHREADS
-#define _STLP_NO_THREADS
-*/
-
-/* _PTHREADS: if defined, use POSIX threads for multithreading support. */
-/*
-#define _PTHREADS
-*/
-
-/* compatibility section
- */
-
-#if (defined (_STLP_NOTHREADS) || defined (_STLP_NO_THREADS) || defined (NOTHREADS))
-# if !defined (_NOTHREADS)
-# define _NOTHREADS
-# endif
-# if !defined (_STLP_NO_THREADS)
-# define _STLP_NO_THREADS
-# endif
-#endif
-
-#if !defined(_STLP_USE_DYNAMIC_LIB) && !defined(_STLP_USE_STATIC_LIB)
-/*
- * Turn _STLP_USE_DYNAMIC_LIB to enforce use of .dll version of STLport library.
- * NOTE: please do that only if you know what you are doing!
- * Changing default will require you to change makefiles in "build" accordingly
- * and to rebuild STLPort library!
- * On UNIX, this has no effect, see build/lib/README for make tags.
- * See STLport configuration file (build/lib/configure.bat) for help in building
- * the require library versions.
- */
-/*
-#define _STLP_USE_DYNAMIC_LIB
-*/
-
-/*
- * Turn _STLP_USE_STATIC_LIB to enforce use of static version of STLport library.
- * NOTE: please do that only if you know what you are doing!
- * Changing default will require you to change makefile in "build" accordingly
- * and to rebuild STLPort library!
- * On UNIX, this has no effect, see build/lib/README for make tags.
- * See STLport configuration file (build/lib/configure.bat) for help in building
- * the require library versions.
- */
-/*
-#define _STLP_USE_STATIC_LIB
-*/
-#endif
-
-/*
- * Signal STLport that we are using the cygwin distrib with the -mno-cygwin option.
- * This is similar to a mingw environment except that relative path to native headers
- * is different, this is why we need this macro.
- */
-/*
-#define _STLP_NO_CYGWIN
- */
-
-/*
- * Edit relative path below (or put full path) to get native
- * compiler vendor's headers included. Default is "../include"
- * for _STLP_NATIVE_INCLUDE_PATH, default for other macros is
- * _STLP_NATIVE_INCLUDE_PATH.
- * Hint: never install STLport in the directory that ends with "include"
- */
-/*
-#undef _STLP_NATIVE_INCLUDE_PATH
-#define _STLP_NATIVE_INCLUDE_PATH ../include
-*/
-/* same for C library headers like <cstring> */
-/*
-#undef _STLP_NATIVE_CPP_C_INCLUDE_PATH
-#define _STLP_NATIVE_CPP_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
-*/
-/* same for C headers like <string.h> */
-/*
-#undef _STLP_NATIVE_C_INCLUDE_PATH
-#define _STLP_NATIVE_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
-*/
-/* Some compilers locate basic C++ runtime support headers (<new>, <typeinfo>, <exception>) in separate directory */
-/*
-#undef _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH
-#define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
-*/
-
-/*
- * If namespases available, STLport use own namespace (and masquerade
- * it as std). Disable own namespace may cause undefined behaviour.
- */
-/*
-#define _STLP_NO_OWN_NAMESPACE 1
-*/
-
-/*
- * Uncomment _STLP_LEAKS_PEDANTIC to force deallocation of ALL allocated
- * memory chunks. Normally not required. But if you worry about quazi-leaks
- * (may be reported by some leaks detection tools), use
- * _STLP_LEAKS_PEDANTIC. It should be used with _STLP_USE_NEWALLOC or
- * _STLP_USE_MALLOC (see below), the default node_alloc allocator also clean
- * its internal memory pool but only if STLport is used as a dynamic library
- * under Win32 (using MSVC like compilers).
- */
-/*
-#define _STLP_LEAKS_PEDANTIC 1
-*/
-
-/*
- * Uncomment _STLP_USE_NEWALLOC to force allocator<T> to use plain "new"
- * instead of STLport optimized node allocator engine.
- */
-/*
-#define _STLP_USE_NEWALLOC 1
-*/
-
-/*
- * Uncomment _STLP_USE_MALLOC to force allocator<T> to use plain "malloc"
- * instead of STLport optimized node allocator engine.
- */
-/*
-#define _STLP_USE_MALLOC 1
-*/
-
-/*
- * Uncomment _STLP_USE_PERTHREAD_ALLOC to force allocator<T> to use
- * a specific implementation targetting the massively multi-threaded
- * environment. The implementation is based on the POSIX pthread
- * interface.
- */
-/*
-#define _STLP_USE_PERTHREAD_ALLOC 1
-*/
-
-/*
- * Set _STLP_DEBUG_ALLOC to use allocators that perform memory debugging,
- * such as padding/checking for memory consistency
- */
-/*
-#define _STLP_DEBUG_ALLOC 1
-*/
-
-/*
- * For compiler not supporting partial template specialization or ordering of
- * template functions STLport implement a workaround based on inheritance
- * detection. This inheritance can introduce trouble in client code when
- * a user class derived a STL container (which is not advised as STL containers
- * do not have virtual destructors). To disable this workaround turn this macro on:
- */
-/*
-#define _STLP_DONT_USE_PARTIAL_SPEC_WRKD 1
-*/
-
-/*
- * Uncomment this to force all debug diagnostic to be directed through a
- * user-defined global function:
- * void __stl_debug_message(const char * format_str, ...)
- * instead of predefined STLport routine.
- * This allows you to take control of debug message output.
- * Default routine calls fprintf(stderr,...)
- * Note : If you set this macro, you must supply __stl_debug_message
- * function definition somewhere.
- */
-/*
-#define _STLP_DEBUG_MESSAGE 1
-*/
-
-/*
- * Uncomment this to force all failed assertions to be executed through
- * user-defined global function:
- * void __stl_debug_terminate(void). This allows
- * you to take control of assertion behaviour for debugging purposes.
- * Default routine calls _STLP_ABORT().
- * Note : If you set this macro, you must supply __stl_debug_terminate
- * function definition somewhere.
- */
-/*
-#define _STLP_DEBUG_TERMINATE 1
-*/
-
-/*
- * Uncomment that to disable exception handling code
- */
-/*
-#define _STLP_DONT_USE_EXCEPTIONS 1
-*/
-
-/*
- * _STLP_NO_NAMESPACES: if defined, don't put the library in namespace
- * stlport:: or std::, even if the compiler supports namespaces
- */
-/*
-#define _STLP_NO_NAMESPACES 1
-*/
-
-/*==========================================================
- * Compatibility section
- *==========================================================*/
-
-/*
- * Use abbreviated class names for linker benefit (don't affect interface).
- * This option is obsolete, but should work in this release.
- *
- */
-/*
-#define _STLP_USE_ABBREVS
-*/
-
-/*
- * This definition precludes STLport reverse_iterator to be compatible with
- * other parts of MSVC library. (With partial specialization, it just
- * has no effect).
- * Use it _ONLY_ if you use SGI-style reverse_iterator<> template explicitly
- */
-/*
-#define _STLP_NO_MSVC50_COMPATIBILITY 1
-*/
-
-/*
- * _STLP_USE_RAW_SGI_ALLOCATORS is a hook so that users can disable use of
- * allocator<T> as default parameter for containers, and use SGI
- * raw allocators as default ones, without having to edit library headers.
- * Use of this macro is strongly discouraged.
- */
-/*
-#define _STLP_USE_RAW_SGI_ALLOCATORS 1
-*/
-
-/*
- * Use obsolete overloaded template functions iterator_category(), value_type(), distance_type()
- * for querying iterator properties. Please note those names are non-standard and are not guaranteed
- * to be used by every implementation. However, this setting is on by default when partial specialization
- * is not implemented in the compiler and cannot be simulated (only if _STLP_NO_ANACHRONISMS is not set).
- * Use of those interfaces for user-defined iterators is strongly discouraged:
- * please use public inheritance from iterator<> template to achieve desired effect.
- * Second form is to disable old-style queries in any case.
- */
-/*
-#define _STLP_USE_OLD_HP_ITERATOR_QUERIES
-#define _STLP_NO_OLD_HP_ITERATOR_QUERIES
-*/
-
-
-/*
- * On systems with support of large files (_LARGEFILE_SOURCE,
- * _LARGEFILE64_SOURCE defined) we will use 64-bit file offset, even if
- * __USE_FILE_OFFSET64 or _FILE_OFFSET_BITS not defined or _FILE_OFFSET_BITS
- * less than 64. In the last case sizeof(std::streamoff) may not be equal to
- * sizeof(off_t), if you want to force equal size of off_t and streamoff,
- * uncomment macro below. But pay attention, this has influence on libstlport
- * and in future usage it may cause conflict with defined _FILE_OFFSET_BITS macro.
- */
-
-/*
-#define _STLP_USE_DEFAULT_FILE_OFFSET
-*/
-
-/*==========================================================================*/
-
-/* This section contains swithes which should be off by default,
- * but so few compilers would have it undefined, so that we set them here,
- * with the option to be turned off later in compiler-specific file
- */
-
-#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
-#define _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
-
-/*
- Local Variables:
- mode:C++
- End:
-*/
diff --git a/stl/config/stl_confix.h b/stl/config/stl_confix.h
deleted file mode 100644
index a1be1f2..0000000
--- a/stl/config/stl_confix.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/*
- * STLport configuration file
- * It is internal STLport header - DO NOT include it directly
- * Purpose of this file : to define STLport settings that depend on
- * compiler flags or can be otherwise missed
- *
- */
-
-#ifndef _STLP_CONFIX_H
-# define _STLP_CONFIX_H
-
-/* If, by any chance, C compiler gets there, try to help it to pass smoothly */
-# if ! defined (__cplusplus) && ! defined (_STLP_HAS_NO_NAMESPACES)
-# define _STLP_HAS_NO_NAMESPACES
-# endif
-
-# if defined(__MINGW32__)
-# define _STLP_NO_DRAND48
-# endif
-
-/* Modena C++ library */
-#if defined (__MWERKS__) && __MWERKS__ <= 0x2303 || (defined (__KCC) && __KCC_VERSION < 3400)
-# include <mcompile.h>
-# define _STLP_USE_MSIPL 1
-# if defined (__KCC) || (defined(__MSL_CPP__) && \
- ( (__MSL_CPP__ >= 0x5000 && defined( _MSL_NO_MESSAGE_FACET )) || \
- (__MSL_CPP__ < 0x5000 && defined( MSIPL_NL_TYPES ))) \
- )
-# define _STLP_NO_NATIVE_MESSAGE_FACET 1
-# endif
-#endif
-
-/* common switches for EDG front-end */
-# if defined (__EDG_SWITCHES)
-# if !(defined(_TYPENAME) || defined (_TYPENAME_IS_KEYWORD))
-# undef _STLP_NEED_TYPENAME
-# define _STLP_NEED_TYPENAME 1
-# endif
-# if !defined(_WCHAR_T_IS_KEYWORD)
-# undef _STLP_NO_WCHAR_T
-# define _STLP_NO_WCHAR_T 1
-# endif
-# ifndef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES
-# undef _STLP_NO_CLASS_PARTIAL_SPECIALIZATION
-# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
-# endif
-# ifndef _MEMBER_TEMPLATES
-# undef _STLP_NO_MEMBER_TEMPLATES
-# define _STLP_NO_MEMBER_TEMPLATES 1
-# undef _STLP_NO_MEMBER_TEMPLATE_CLASSES
-# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-# endif
-# if !defined(_MEMBER_TEMPLATE_KEYWORD)
-# undef _STLP_NO_MEMBER_TEMPLATE_KEYWORD
-# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-# endif
-# if !defined (__EXCEPTIONS) && ! defined (_EXCEPTIONS)
-# undef _STLP_HAS_NO_EXCEPTIONS
-# define _STLP_HAS_NO_EXCEPTIONS
-# endif
-# undef __EDG_SWITCHES
-# endif /* EDG */
-#endif
diff --git a/stl/config/stl_gcce.h b/stl/config/stl_gcce.h
deleted file mode 100644
index e5f7040..0000000
--- a/stl/config/stl_gcce.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _STLP_WINSCW_H
-#define _STLP_WINSCW_H
-
-#define _STLP_COMPILER "GCCE"
-
-//==========================================================
-
-# define _STLP_LONG_LONG long long
-
-#ifdef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
-# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
-#endif
-
-#ifdef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
-# undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
-#endif
-
-//==========================================================
-
-#endif
diff --git a/stl/config/stl_mycomp.h b/stl/config/stl_mycomp.h
deleted file mode 100644
index 710d5fa..0000000
--- a/stl/config/stl_mycomp.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/*
- * Purpose of this file :
- *
- * A list of COMPILER-SPECIFIC portion of STLport settings.
- * This file is provided to help in manual configuration
- * of STLport. This file is being included by stlcomp.h
- * when STLport is unable to identify your compiler.
- * Please remove the error diagnostic below before adjusting
- * macros.
- *
- */
-#ifndef _STLP_MYCOMP_H
-#define _STLP_MYCOMP_H
-
-#error "Your compiler version is not recognized by STLport. Please edit <stlport/stl/config/stl_mycomp.h>"
-
-//==========================================================
-
-// the values choosen here as defaults try to give
-// maximum functionality on the most conservative settings
-
-// Mostly correct guess, change it for Alpha (and other environments
-// that has 64-bit "long")
-// # define _STLP_UINT32_T unsigned long
-
-// Disables wchar_t functionality
-// # define _STLP_NO_WCHAR_T 1
-
-// Define if wchar_t is not a unique type, and is actually a typedef to unsigned short.
-// # define _STLP_WCHAR_T_IS_USHORT 1
-
-// Uncomment if long long is available
-// # define _STLP_LONG_LONG long long
-
-// Uncomment if long double is not available
-// # define _STLP_NO_LONG_DOUBLE 1
-
-// Uncomment this if your compiler does not support "typename" keyword
-// # define _STLP_NEED_TYPENAME 1
-
-// Uncomment this if your compiler does not support "mutable" keyword
-// # define _STLP_NEED_MUTABLE 1
-
-// Uncomment this if your compiler does not support "explicit" keyword
-// # define _STLP_NEED_EXPLICIT 1
-
-// Uncomment if new-style-casts like const_cast<> are not available
-// # define _STLP_NO_NEW_STYLE_CASTS 1
-
-// Uncomment this if your compiler does not have "bool" type
-// # define _STLP_NO_BOOL 1
-
-// Uncomment this if your compiler does not have "bool" type, but has "bool" keyword reserved
-// # define _STLP_DONT_USE_BOOL_TYPEDEF 1
-
-// Uncomment this if your compiler does not have "bool" type, but defines "bool" in <yvals.h>
-// # define _STLP_YVALS_H 1
-
-// Uncomment this if your compiler has limited or no default template arguments for classes
-// # define _STLP_LIMITED_DEFAULT_TEMPLATES 1
-
-// Uncomment this if your compiler support only complete (not dependent on other parameters)
-// types as default parameters for class templates
-// # define _STLP_DEFAULT_TYPE_PARAM 1
-
-// Uncomment this if your compiler do not support default parameters in template class methods
-// # define _STLP_DONT_SUP_DFLT_PARAM 1
-
-// Uncomment this if your compiler has problem with not-type
-// default template parameters
-// # define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
-
-// Define if compiler has
-// trouble with functions getting non-type-parameterized classes as parameters
-// # define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
-
-// Uncomment this if your compiler lacks static data members.
-// Uncomment next line if your compiler supports __attribute__((weak))
-// # define _STLP_NO_STATIC_TEMPLATE_DATA 1
-// # define _STLP_WEAK_ATTRIBUTE 1
-
-// Uncomment this if your compiler does not support namespaces
-// # define _STLP_HAS_NO_NAMESPACES 1
-
-// Uncomment if "using" keyword does not work with template types
-// # define _STLP_BROKEN_USING_DIRECTIVE 1
-
-// Uncomment this if your compiler does not support exceptions
-// # define _STLP_HAS_NO_EXCEPTIONS 1
-
-// Uncomment this when you are able to detect that the user do not
-// want to use the exceptions feature.
-// # define _STLP_DONT_USE_EXCEPTIONS 1
-
-// Uncomment this if your compiler does not support exception specifications
-// # define _STLP_NO_EXCEPTION_SPEC
-
-// Define this if your compiler requires return statement after throw()
-// # define _STLP_THROW_RETURN_BUG 1
-
-// Define this if your compiler do not support return of void
-// # define _STLP_DONT_RETURN_VOID 1
-
-// Header <new> that comes with the compiler
-// does not define bad_alloc exception
-// # define _STLP_NO_BAD_ALLOC 1
-
-// Define this if your compiler do not throw bad_alloc from the new operator
-// # define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
-
-// Uncomment if member template methods are not available
-// # define _STLP_NO_MEMBER_TEMPLATES 1
-
-// Uncomment if member template classes are not available
-// # define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
-
-// Uncomment if your compiler do not support the std::allocator rebind technique
-// This is a special case of bad member template classes support, it is automatically
-// defined if _STLP_NO_MEMBER_TEMPLATE_CLASSES is defined.
-// # define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1
-
-// Uncomment if no "template" keyword should be used with member template classes
-// # define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
-
-// Uncomment if friend member templates are not available
-// # define _STLP_NO_FRIEND_TEMPLATES 1
-
-// Compiler does not accept friend declaration qualified with namespace name.
-// # define _STLP_NO_QUALIFIED_FRIENDS 1
-
-// Uncomment if partial specialization is not available
-// # define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
-
-// Define if class being partially specialized require full name (template parameters)
-// of itself for method declarations
-// # define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
-
-// Compiler has problem with qualified specializations (cont int, volatile int...)
-// # define _STLP_QUALIFIED_SPECIALIZATION_BUG
-
-// Compiler has problems specializing members of partially
-// specialized class
-// # define _STLP_MEMBER_SPECIALIZATION_BUG
-
-// Uncomment if partial order of template functions is not available
-// # define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
-
-// Uncomment if specialization of methods is not allowed
-// # define _STLP_NO_METHOD_SPECIALIZATION 1
-
-// Uncomment if full specialization does not use partial spec. syntax : template <> struct ....
-// # define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
-
-// Uncomment if compiler does not support explicit template arguments for functions
-// # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
-
-// Uncomment this if your compiler can't inline while(), for()
-// # define _STLP_LOOP_INLINE_PROBLEMS 1
-
-// Define if the compiler fails to match a template function argument of base
-// # define _STLP_BASE_MATCH_BUG 1
-
-// Define if the compiler fails to match a template function argument of base
-// (non-template)
-//# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
-
-// Define if the compiler rejects outline method definition
-// explicitly taking nested types/typedefs
-// # define _STLP_NESTED_TYPE_PARAM_BUG 1
-
-// Compiler requires typename keyword on outline method definition
-// explicitly taking nested types/typedefs
-// #define _STLP_TYPENAME_ON_RETURN_TYPE
-
-// Define if the baseclass typedefs not visible from outside
-// # define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
-
-// if your compiler have serious problems with typedefs, try this one
-// # define _STLP_BASE_TYPEDEF_BUG 1
-
-// Uncomment if getting errors compiling mem_fun* adaptors
-// # define _STLP_MEMBER_POINTER_PARAM_BUG 1
-
-// * _STLP_STATIC_CONST_INIT_BUG: defined if the compiler can't handle a
-// constant-initializer in the declaration of a static const data member
-// of integer type. (See section 9.4.2, paragraph 4, of the C++ standard.)
-// # define _STLP_STATIC_CONST_INIT_BUG
-
-// Define if default constructor for builtin integer type fails to initialize it to 0
-// In expression like new(&char) char():
-//# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
-// In default function parameter like _M_method(_Tp __x = _Tp())
-//# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
-
-// Defined if constructor
-// required to explicitly call member's default constructors for const objects
-// # define _STLP_CONST_CONSTRUCTOR_BUG 1
-
-// Defined if the compiler has trouble calling POD-types constructors/destructors
-// # define _STLP_TRIVIAL_CONSTRUCTOR_BUG 1
-// # define _STLP_TRIVIAL_DESTRUCTOR_BUG 1
-
-// Define if having problems specializing maps/sets with
-// key type being const
-// # define _STLP_MULTI_CONST_TEMPLATE_ARG_BUG
-
-// Uncomment this to disable -> operators on all iterators
-// # define _STLP_NO_ARROW_OPERATOR 1
-
-// Uncomment this to disble at() member functions for containers
-// # define _STLP_NO_AT_MEMBER_FUNCTION 1
-
-// Define this if compiler lacks <exception> header
-// # define _STLP_NO_EXCEPTION_HEADER 1
-
-// Uncomment this if your C library has lrand48() function
-// # define _STLP_RAND48 1
-
-// Uncomment if native new-style C library headers lile <cstddef>, etc are not available.
-// # define _STLP_HAS_NO_NEW_C_HEADERS 1
-
-// uncomment if new-style headers <new> is available
-// # define _STLP_HAS_NEW_NEW_HEADER 1
-
-// uncomment this if <iostream> and other STD headers put their stuff in ::namespace,
-// not std::
-// # define _STLP_VENDOR_GLOBAL_STD
-
-// uncomment this if <cstdio> and the like put stuff in ::namespace,
-// not std::
-// # define _STLP_VENDOR_GLOBAL_CSTD
-
-// uncomment this if your compiler consider as ambiguous a function imported within
-// the stlport namespace and called without scope (:: or std::)
-// # define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1
-
-// uncomment this if your compiler define all the C math functions C++ additional
-// overloads in ::namespace and not only in std::.
-// # define _STLP_HAS_GLOBAL_C_MATH_FUNCTIONS 1
-
-// uncomment this if your compiler has problem with the import of a namespace in
-// an other one with the using namespace directive
-// # define _STLP_USING_NAMESPACE_BUG 1
-
-// Edit relative path below (or put full path) to get native
-// compiler headers included. Default is "../include".
-// C headers may reside in different directory, so separate macro is provided.
-// Hint : never install STLport in the directory that ends with "include"
-// # define _STLP_NATIVE_INCLUDE_PATH ../include
-// # define _STLP_NATIVE_C_INCLUDE_PATH ../include
-// # define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include
-
-// This macro constructs header path from directory and name.
-// You may change it if your compiler does not understand "/".
-// # define _STLP_MAKE_HEADER(path, header) <path/header>
-
-// This macro constructs native include header path from include path and name.
-// You may have do define it if experimenting problems with preprocessor
-// # define _STLP_NATIVE_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_INCLUDE_PATH,header)
-
-// Same for C headers
-// #define _STLP_NATIVE_C_HEADER(header)
-
-// uncomment this if your compiler/platform do not fully support the IEC 559 floating point
-// numbers specification (also known as IEEE 754 in the US). This specification define the
-// infinity and NaN (Not a Number) representation. Unit tests should tell you if your compiler
-// support it.
-// # define _STLP_NO_IEC559_SUPPORT 1
-
-
-//==========================================================
-#endif
diff --git a/stl/config/stl_symbian.h b/stl/config/stl_symbian.h
deleted file mode 100644
index 46ee3c4..0000000
--- a/stl/config/stl_symbian.h
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef __stlp_config_symbian_h
-#define __stlp_config_symbian_h
-
-//==========================================================
-
-#if defined(_WIN32)
-# undef _WIN32
-#endif
-
-//==========================================================
-
-#ifdef __cplusplus
-# include <e32cmn.h>
-#endif
-
-//==========================================================
-
-#if defined(__MARM__)
-# if !defined(_M_ARM)
-# define _M_ARM 1
-# endif
-#else
-# if !defined(_M_IX86)
-# define _M_IX86 1
-# endif
-#endif
-
-//==========================================================
-
-#define __PIPS__
-
-//==========================================================
-
-#define _STLP_HAS_NO_NEW_C_HEADERS 1
-#define _STLP_NO_NEW_NEW_HEADER 1
-#define _STLP_NO_NEW_HEADER 1
-#define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
-#define _STLP_NO_EXCEPTION_HEADER 1
-#define _STLP_NO_TYPEINFO 1
-#define _STLP_NO_VENDOR_STDLIB_L 1
-#define _STLP_USE_NOT_INIT_SEGMENT 1
-#define _STLP_NO_LONG_DOUBLE 1
-#define _STLP_NO_OWN_NAMESPACE 1
-#define _STLP_USE_MALLOC 1
-#define _STLP_USE_NO_EXTERN_RANGE_ERRORS 1
-#define _STLP_USE_SIMPLE_NODE_ALLOC 1
-#define _STLP_DONT_THROW_RANGE_ERRORS 1
-#define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION 1
-#define _STLP_USE_NEWALLOC 1
-#define _STLP_INLINE_EXCEPTION_CLASS 1
-#define _STLP_USE_PARTIAL_SPEC_WORKAROUND 1
-#define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS 1
-//==========================================================
-
-#ifdef _STLP_REAL_LOCALE_IMPLEMENTED
-# undef _STLP_REAL_LOCALE_IMPLEMENTED
-#endif
-
-//==========================================================
-
-#define _STLP_NATIVE_C_INCLUDE_PATH stdapis
-//==========================================================
-
-#define _Locale_SPACE _CTYPE_S
-#define _Locale_PRINT _CTYPE_R
-#define _Locale_CNTRL _CTYPE_C
-#define _Locale_UPPER _CTYPE_U
-#define _Locale_LOWER _CTYPE_L
-#define _Locale_ALPHA _CTYPE_A
-#define _Locale_DIGIT _CTYPE_D
-#define _Locale_PUNCT _CTYPE_P
-#define _Locale_XDIGIT _CTYPE_X
-
-//==========================================================
-
-#endif
diff --git a/stl/config/stl_winscw.h b/stl/config/stl_winscw.h
deleted file mode 100644
index ca161e9..0000000
--- a/stl/config/stl_winscw.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _STLP_WINSCW_H
-#define _STLP_WINSCW_H
-
-#define _STLP_COMPILER "WINSCW"
-
-#undef __MWERKS__
-
-//==========================================================
-
-# define _STLP_WCHAR_T_IS_USHORT 1
-# define _STLP_LONG_LONG long long
-
-//==========================================================
-
-#endif
diff --git a/stl/config/user_config.h b/stl/config/user_config.h
deleted file mode 100644
index 07ac7f9..0000000
--- a/stl/config/user_config.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-/*
- * Purpose of this file :
- *
- * To hold user-definable portion of STLport settings which may be overridden
- * on per-project basis.
- * Please note that if you use STLport iostreams (compiled library) then you have
- * to use consistent settings when you compile STLport library and your project.
- * Those settings are defined in host.h and have to be the same for a given
- * STLport installation.
- */
-
-
-/*==========================================================
- * User-settable macros that control compilation:
- * Features selection
- *==========================================================*/
-
-/*
- * Use this switch for embedded systems where no iostreams are available
- * at all. STLport own iostreams will also get disabled automatically then.
- * You can either use STLport iostreams, or no iostreams.
- * If you want iostreams, you have to compile library in ../build/lib
- * and supply resulting library at link time.
- */
-/*
-#define _STLP_NO_IOSTREAMS 1
-*/
-
-/*
- * Set _STLP_DEBUG to turn the "Debug Mode" on.
- * That gets you checked iterators/ranges in the manner
- * of "Safe STL". Very useful for debugging. Thread-safe.
- * Please do not forget to link proper STLport library flavor
- * (e.g libstlportstlg.so or libstlportstlg.a) when you set this flag
- * in STLport iostreams mode, namespace customization guaranty that you
- * link to the right library.
- */
-/*
-#define _STLP_DEBUG 1
-*/
-/*
- * You can also choose the debug level:
- * STLport debug level: Default value
- * Check only what the STLport implementation consider as invalid.
- * It also change the iterator invalidation schema.
- * Standard debug level: Check for all operations the standard consider as "undefined behavior"
- * even if STlport implement it correctly. It also invalidates iterators
- * more often.
- */
-/*
-#define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL
-#define _STLP_DEBUG_LEVEL _STLP_STANDARD_DBG_LEVEL
-*/
-/* When an inconsistency is detected by the 'safe STL' the program will abort.
- * If you prefer an exception define the following macro. The thrown exception
- * will be the Standard runtime_error exception.
- */
-/*
-#define _STLP_DEBUG_MODE_THROWS
- */
-
-/*
- * _STLP_NO_CUSTOM_IO : define this if you do not instantiate basic_xxx iostream
- * classes with custom types (which is most likely the case). Custom means types
- * other than char, wchar_t, char_traits<> and allocator<> like
- * basic_ostream<my_char_type, my_traits<my_char_type> > or
- * basic_string<char, char_traits<char>, my_allocator >
- * When this option is on, most non-inline template functions definitions for iostreams
- * are not seen by the client which saves a lot of compile time for most compilers,
- * also object and executable size for some.
- * Default is off, just not to break compilation for those who do use those types.
- * That also guarantees that you still use optimized standard i/o when you compile
- * your program without optimization. Option does not affect STLport library build; you
- * may use the same binary library with and without this option, on per-project basis.
- */
-/*
-#define _STLP_NO_CUSTOM_IO
-*/
-
-/*
- * _STLP_NO_RELOPS_NAMESPACE: if defined, don't put the relational
- * operator templates (>, <=. >=, !=) in namespace std::rel_ops, even
- * if the compiler supports namespaces.
- * Note : if the compiler do not support namespaces, those operators are not be provided by default,
- * to simulate hiding them into rel_ops. This was proved to resolve many compiler bugs with ambiguity.
- */
-/*
-#define _STLP_NO_RELOPS_NAMESPACE 1
-*/
-
-/*
- * If _STLP_USE_OWN_NAMESPACE is in effect, STLport by default will try
- * to rename std:: for the user to stlport::. If you do not want this feature,
- * please define the following switch and then use stlport::
- */
-/*
-#define _STLP_DONT_REDEFINE_STD 1
-*/
-
-/*
- * _STLP_WHOLE_NATIVE_STD : only meaningful in _STLP_USE_OWN_NAMESPACE mode.
- * Normally, STLport only imports necessary components from native std:: namespace -
- * those not yet provided by STLport (<iostream>, <complex>, etc.)
- * and their dependencies (<string>, <stdexcept>).
- * You might want everything from std:: being available in std:: namespace when you
- * include corresponding STLport header (like STLport <map> provides std::map as well, etc.),
- * if you are going to use both stlport:: and std:: components in your code.
- * Otherwise this option is not recommended as it increases the size of your object files
- * and slows down compilation.
- */
-/*
-#define _STLP_WHOLE_NATIVE_STD
-*/
-
-/*
- * Use this option to catch uninitialized members in your classes.
- * When it is set, construct() and destroy() fill the class storage
- * with _STLP_SHRED_BYTE (see below).
- * Note : _STLP_DEBUG and _STLP_DEBUG_ALLOC don't set this option automatically.
- */
-/*
-#define _STLP_DEBUG_UNINITIALIZED 1
-#define _STLP_DEBUG_ALLOC 1
-*/
-
-/*
- * Uncomment and provide a definition for the byte with which raw memory
- * will be filled if _STLP_DEBUG_ALLOC or _STLP_DEBUG_UNINITIALIZED is defined.
- * Choose a value which is likely to cause a noticeable problem if dereferenced
- * or otherwise abused. A good value may already be defined for your platform.
- */
-/*
-#define _STLP_SHRED_BYTE 0xA3
-*/
-
-/*
- * This option is for gcc users only and only affects systems where native linker
- * does not let gcc to implement automatic instantiation of static template data members/
- * It is being put in this file as there is no way to check if we are using GNU ld automatically,
- * so it becomes user's responsibility.
- */
-/*
-#define _STLP_GCC_USES_GNU_LD
-*/
-
-/*==========================================================
- * Compatibility section
- *==========================================================*/
-
-/*
- * Define this macro to disable anachronistic constructs (like the ones used in HP STL and
- * not included in final standard, etc.
- */
-/*
-#define _STLP_NO_ANACHRONISMS 1
-*/
-
-/*
- * Define this macro to disable STLport extensions (for example, to make sure your code will
- * compile with some other implementation )
- */
-/*
-#define _STLP_NO_EXTENSIONS 1
-*/
-
-/*
- * You should define this macro if compiling with MFC - STLport <stl/config/_windows.h>
- * then include <afx.h> instead of <windows.h> to get synchronisation primitives
- */
-/*
-#define _STLP_USE_MFC 1
-*/
-
-/*
- * boris : this setting is here as we cannot detect precense of new Platform SDK automatically
- * If you are using new PSDK with VC++ 6.0 or lower,
- * please define this to get correct prototypes for InterlockedXXX functions
- */
-/*
-#define _STLP_NEW_PLATFORM_SDK 1
-*/
-
-/*
- * For the same reason as the one above we are not able to detect easily use
- * of the compiler coming with the Platform SDK instead of the one coming with
- * a Microsoft Visual Studio release. This change native C/C++ library location
- * and implementation, please define this to get correct STLport configuration.
- */
-/*
-#define _STLP_USING_PLATFORM_SDK_COMPILER 1
-*/
-
-/*
- * Some compilers support the automatic linking feature.
- * Uncomment the following if you prefer to specify the STLport library
- * to link with yourself.
- * For the moment, this feature is only supported and implemented within STLport
- * by the Microsoft compilers.
- */
-/*
-#define _STLP_DONT_USE_AUTO_LINK 1
-*/
-
-/*
- * If you customize the STLport generated library names don't forget to give
- * the motif you used during configuration here if you still want the auto link
- * to work. (Do not remove double quotes in the macro value)
- */
-/*
-#define _STLP_LIB_NAME_MOTIF "???"
- */
-
-/*
- * When using automatic linking (see above), output a message that tells the
- * user which lib is getting linked via 'pragma message(..)'.
- * This setting has no effect if automatic linking is not active.
- */
-/*
-#define _STLP_VERBOSE_AUTO_LINK 1
-*/
-
-/*
- * Use minimum set of default arguments on template classes that have more
- * than one - for example map<>, set<>.
- * This has effect only if _STLP_LIMITED_DEFAULT_TEMPLATES is on.
- * If _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS is set, you'll be able to compile
- * set<T> with those compilers, but you'll have to use __set__<T, less<T>>
- *
- * Affects : map<>, multimap<>, set<>, multiset<>, hash_*<>,
- * queue<>, priority_queue<>, stack<>, istream_iterator<>
- */
-/*
-#define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS 1
-*/
-
-/*
- * The agregation of strings using the + operator is an expensive operation
- * as it requires construction of temporary objects that need memory allocation
- * and deallocation. The problem can be even more important if you are adding
- * several strings together in a single expression. To avoid this problem STLport
- * implement expression template. With this technique addition of 2 strings is not
- * a string anymore but a temporary object having a reference to each of the
- * original strings involved in the expression. This object carry information
- * directly to the destination string to set its size correctly and only make
- * a single call to the allocator. This technique also works for the addition of
- * N elements where elements are basic_string, C string or a single character.
- * The drawback can be longer compilation time and bigger executable size.
- * STLport rebuild: Yes
- */
-/*
-#define _STLP_USE_TEMPLATE_EXPRESSION 1
-*/
-
-/*
- * By default the STLport basic_string implementation use a little static buffer
- * (of 16 chars when writing this doc) to avoid systematically memory allocation
- * in case of little basic_string. The drawback of such a method is bigger
- * basic_string size and some performance penalty for method like swap. If you
- * prefer systematical dynamic allocation turn on this macro.
- * STLport rebuild: Yes
- */
-/*
-#define _STLP_DONT_USE_SHORT_STRING_OPTIM 1
-*/
-
-/*
- * To reduce the famous code bloat trouble due to the use of templates STLport grant
- * a specialization of some containers for pointer types. So all instanciations
- * of those containers with a pointer type will use the same implementation based on
- * a container of void*. This feature has show very good result on object files size
- * but after link phase and optimization you will only experiment benefit if you use
- * many container with pointer types.
- */
-/*
-#define _STLP_USE_PTR_SPECIALIZATIONS 1
-*/
-
-/*
- * To achieve many different optimizations within the template implementations STLport
- * uses some type traits technique. With this macro you can ask STLport to use the famous
- * boost type traits rather than the internal one. The advantages are more compiler
- * integration and a better support. If you only define this macro once the STLport has been
- * built you just have to add the boost install path within your include path. If you want
- * to use this feature at STLport built time you will have to define the
- * STLP_BUILD_BOOST_PATH enrironment variable with the value of the boost library path.
- */
-/*
-#define _STLP_USE_BOOST_SUPPORT 1
-*/
-
-/*==========================================================*/
-
-/*
- Local Variables:
- mode: C++
- End:
-*/
diff --git a/stl/debug/_debug.c b/stl/debug/_debug.c
deleted file mode 100644
index f932a62..0000000
--- a/stl/debug/_debug.c
+++ /dev/null
@@ -1,639 +0,0 @@
-/*
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_DEBUG_C
-#define _STLP_DEBUG_C
-
-#if defined (_STLP_DEBUG)
-#if defined (_STLP_THREADS)
-# if !defined (_STLP_NEED_MUTABLE)
-# define _STLP_ACQUIRE_LOCK(_Lock) _Lock._M_acquire_lock();
-# define _STLP_RELEASE_LOCK(_Lock) _Lock._M_release_lock();
-# else
-# define _STLP_ACQUIRE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_acquire_lock();
-# define _STLP_RELEASE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_release_lock();
-# endif /* _STLP_NEED_MUTABLE */
-#else
-# define _STLP_ACQUIRE_LOCK(_Lock)
-# define _STLP_RELEASE_LOCK(_Lock)
-#endif /* _STLP_THREADS */
-
-_STLP_BEGIN_NAMESPACE
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-//==========================================================
-// global non-inline functions
-//==========================================================
-// [ i1, i2)
-#if !defined (__DMC__)
-template <class _Iterator>
-inline bool _STLP_CALL
-__in_range_aux(const _Iterator& __it, const _Iterator& __first,
- const _Iterator& __last, const random_access_iterator_tag &) {
- return ( __it >= __first &&
- __it < __last);
-}
-#endif
-
-template <class _Iterator1, class _Iterator>
-#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1100)
-inline bool _STLP_CALL __in_range_aux(_Iterator1 __it, const _Iterator& __first,
-#else
-inline bool _STLP_CALL __in_range_aux(const _Iterator1& __it, const _Iterator& __first,
-#endif
- const _Iterator& __last, const forward_iterator_tag &) {
- _Iterator1 __i(__first);
- for (; __i != __last && __i != __it; ++__i);
- return (__i != __last);
-}
-
-#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
-template <class _Iterator1, class _Iterator>
-inline bool _STLP_CALL
-__in_range_aux(const _Iterator1& __it, const _Iterator& __first,
- const _Iterator& __last, const bidirectional_iterator_tag &) {
- _Iterator1 __i(__first);
- for (; __i != __last && __i != __it; ++__i);
- return (__i != __last);
-}
-#endif
-
-template <class _Iterator>
-bool _STLP_CALL __check_range_aux(const _Iterator& __first, const _Iterator& __last,
- const __false_type& /*_IsIntegral*/) {
- _STLP_VERBOSE_RETURN(__valid_range(__first,__last), _StlMsg_INVALID_RANGE )
- return true;
-}
-
-template <class _Integral>
-bool _STLP_CALL __check_range_aux(_Integral /*__first*/, _Integral /*__last*/,
- const __true_type& /*_IsIntegral*/)
-{ return true; }
-
-template <class _Iterator>
-bool _STLP_CALL __check_range(const _Iterator& __first, const _Iterator& __last) {
- typedef typename _IsIntegral<_Iterator>::_Ret _Integral;
- return __check_range_aux(__first, __last, _Integral());
-}
-
-template <class _Iterator>
-bool _STLP_CALL __check_range(const _Iterator& __it,
- const _Iterator& __start, const _Iterator& __finish) {
- _STLP_VERBOSE_RETURN(__in_range(__it, __start, __finish),
- _StlMsg_NOT_IN_RANGE_1)
- return true;
-}
-
-template <class _Iterator>
-bool _STLP_CALL __check_range(const _Iterator& __first, const _Iterator& __last,
- const _Iterator& __start, const _Iterator& __finish) {
- _STLP_VERBOSE_RETURN(__in_range(__first, __last, __start, __finish),
- _StlMsg_NOT_IN_RANGE_2)
- return true;
-}
-
-template <class _Tp>
-bool _STLP_CALL __check_ptr_range(const _Tp* __first, const _Tp* __last) {
- _STLP_VERBOSE_RETURN((__first != 0 || __last == 0), _StlMsg_INVALID_ARGUMENT)
- _STLP_VERBOSE_RETURN(__valid_range(__first, __last, random_access_iterator_tag()),
- _StlMsg_INVALID_RANGE)
- return true;
-}
-
-//===============================================================
-template <class _Iterator>
-void _STLP_CALL __invalidate_range(const __owned_list* __base,
- const _Iterator& __first,
- const _Iterator& __last) {
- typedef __owned_link _L_type;
- _STLP_ACQUIRE_LOCK(__base->_M_lock)
- _L_type* __prev = __CONST_CAST(_L_type*, &__base->_M_node);
- _L_type* __pos = __prev->_M_next;
-
- while (__pos != 0) {
- if (!(&__first == __STATIC_CAST(_Iterator*, __pos) || &__last == __STATIC_CAST(_Iterator*, __pos)) &&
- __in_range_aux(__STATIC_CAST(_Iterator*, __pos)->_M_iterator,
- __first._M_iterator, __last._M_iterator,
- _STLP_ITERATOR_CATEGORY(__first, _Iterator))) {
- __pos->_M_owner = 0;
- __prev->_M_next = __pos->_M_next;
- }
- else {
- __prev = __pos;
- }
- __pos = __prev->_M_next;
- }
- _STLP_RELEASE_LOCK(__base->_M_lock)
-}
-
-template <class _Iterator>
-void _STLP_CALL __invalidate_iterator(const __owned_list* __base,
- const _Iterator& __it) {
- typedef __owned_link _L_type;
- _STLP_ACQUIRE_LOCK(__base->_M_lock)
- _L_type* __prev = __CONST_CAST(_L_type*, &__base->_M_node);
- _L_type* __pos = __prev->_M_next;
- while (__pos != 0) {
- // this requires safe iterators to be derived from __owned_link
- if ((__pos != __STATIC_CAST(const _L_type*, &__it)) &&
- (__STATIC_CAST(_Iterator*, __pos)->_M_iterator == __it._M_iterator)) {
- __pos->_M_owner = 0;
- __prev->_M_next = __pos->_M_next;
- }
- else {
- __prev = __pos;
- }
- __pos = __prev->_M_next;
- }
- _STLP_RELEASE_LOCK(__base->_M_lock)
-}
-
-template <class _Iterator>
-void _STLP_CALL __change_range_owner(const _Iterator& __first,
- const _Iterator& __last,
- const __owned_list* __dst) {
- if (__first._Owner() == __dst)
- return;
-
- typedef __owned_link _L_type;
- // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here
- //_STLP_ACQUIRE_LOCK(__base->_M_lock)
- __owned_list *__base = __CONST_CAST(__owned_list*, __first._Owner());
- _L_type* __src_prev = &__base->_M_node;
- _L_type* __pos = __src_prev->_M_next;
- _L_type* __dst_prev = __CONST_CAST(_L_type*, &__dst->_M_node);
-
- while (__pos != 0) {
- if (!(&__first == __STATIC_CAST(_Iterator*, __pos) || &__last == __STATIC_CAST(_Iterator*, __pos)) &&
- __in_range_aux(__STATIC_CAST(_Iterator*, __pos)->_M_iterator,
- __first._M_iterator, __last._M_iterator,
- _STLP_ITERATOR_CATEGORY(__first, _Iterator))) {
- __pos->_M_owner = __CONST_CAST(__owned_list*, __dst);
- //remove __pos from __base:
- __src_prev->_M_next = __pos->_M_next;
- //add __pos to __dst:
- __pos->_M_next = __dst_prev->_M_next;
- __dst_prev->_M_next = __pos;
- }
- else {
- __src_prev = __pos;
- }
- __pos = __src_prev->_M_next;
- }
- //_STLP_RELEASE_LOCK(__base->_M_lock)
-}
-
-template <class _Iterator>
-void _STLP_CALL __change_ite_owner(const _Iterator& __it,
- const __owned_list* __dst) {
- if (__it._Owner() == __dst)
- return;
-
- typedef __owned_link _L_type;
- // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here
- //_STLP_ACQUIRE_LOCK(__base->_M_lock)
- __owned_list *__base = __CONST_CAST(__owned_list*, __it._Owner());
- _L_type* __prev = &__base->_M_node;
- _L_type* __pos = __prev->_M_next;
- _L_type* __dst_prev = __CONST_CAST(_L_type*, &__dst->_M_node);
-
- while (__pos != 0) {
- // this requires safe iterators to be derived from __owned_link
- if ((__pos != __STATIC_CAST(const _L_type*, &__it)) &&
- (__STATIC_CAST(_Iterator*, __pos)->_M_iterator == __it._M_iterator)) {
- __pos->_M_owner = __CONST_CAST(__owned_list*, __dst);
- //remove __pos from __base:
- __prev->_M_next = __pos->_M_next;
- //add __pos to __dst:
- __pos->_M_next = __dst_prev->_M_next;
- __dst_prev->_M_next = __pos;
- }
- else {
- __prev = __pos;
- }
- __pos = __prev->_M_next;
- }
- //_STLP_RELEASE_LOCK(__base->_M_lock)
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_DEBUG */
-
-#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
-
-# ifndef _STLP_INTERNAL_CSTDLIB
-# include <stl/_cstdlib.h>
-# endif
-
-//==========================================================
-// .c section
-// owned_list non-inline methods and global functions
-//==========================================================
-
-# if defined (_STLP_ASSERTIONS)
-
-_STLP_BEGIN_NAMESPACE
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-# if !defined (_STLP_STRING_LITERAL)
-# define _STLP_STRING_LITERAL(__x) __x
-# endif
-
-# if defined (_STLP_USE_WIDE_INTERFACE)
-// note: WinCE needs this to format single-byte strings in __stl_debug_engine::_Message
-# define _STLP_PERCENT_S "%hs"
-# else
-# define _STLP_PERCENT_S "%s"
-# endif /* _STLP_USE_WIDE_INTERFACE */
-
-# define _STLP_MESSAGE_TABLE_BODY = { \
-_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error: " _STLP_PERCENT_S "\n"), \
-_STLP_STRING_LITERAL(_STLP_PERCENT_S "(%d): STL assertion failure : " _STLP_PERCENT_S "\n" _STLP_ASSERT_MSG_TRAILER), \
-_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error : " _STLP_PERCENT_S "\n" _STLP_PERCENT_S "(%d): STL assertion failure: " _STLP_PERCENT_S " \n" _STLP_ASSERT_MSG_TRAILER), \
-_STLP_STRING_LITERAL("Invalid argument to operation (see operation documentation)"), \
-_STLP_STRING_LITERAL("Taking an iterator out of destroyed (or otherwise corrupted) container"), \
-_STLP_STRING_LITERAL("Trying to extract an object out from empty container"),\
-_STLP_STRING_LITERAL("Past-the-end iterator could not be erased"), \
-_STLP_STRING_LITERAL("Index out of bounds"), \
-_STLP_STRING_LITERAL("Container doesn't own the iterator"), \
-_STLP_STRING_LITERAL("Container is owner of the iterator, but should not"), \
-_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) iterator used"), \
-_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) lefthand iterator in expression"), \
-_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) righthand iterator in expression"), \
-_STLP_STRING_LITERAL("Iterators used in expression are from different owners"), \
-_STLP_STRING_LITERAL("Iterator could not be dereferenced (past-the-end ?)"), \
-_STLP_STRING_LITERAL("Range [first,last) is invalid"), \
-_STLP_STRING_LITERAL("Iterator is not in range [first,last)"), \
-_STLP_STRING_LITERAL("Range [first,last) is not in range [start,finish)"), \
-_STLP_STRING_LITERAL("The advance would produce invalid iterator"), \
-_STLP_STRING_LITERAL("Iterator is singular (advanced beyond the bounds ?)"), \
-_STLP_STRING_LITERAL("Invalid strict weak ordering predicate, if pred(a, b) then we should have !pred(b, a)"), \
-_STLP_STRING_LITERAL("Invalid equivalent predicate, if pred(a, b) then we should have pred(b, a)"), \
-_STLP_STRING_LITERAL("Memory block deallocated twice"), \
-_STLP_STRING_LITERAL("Deallocating a block that was never allocated"), \
-_STLP_STRING_LITERAL("Deallocating a memory block allocated for another type"), \
-_STLP_STRING_LITERAL("Size of block passed to deallocate() doesn't match block size"), \
-_STLP_STRING_LITERAL("Pointer underrun - safety margin at front of memory block overwritten"), \
-_STLP_STRING_LITERAL("Pointer overrrun - safety margin at back of memory block overwritten"), \
-_STLP_STRING_LITERAL("Attempt to dereference null pointer returned by auto_ptr::get()"), \
-_STLP_STRING_LITERAL("Memory allocation function returned a wrongly align memory block"), \
-_STLP_STRING_LITERAL("Unknown problem") \
- }
-
-# if (_STLP_STATIC_TEMPLATE_DATA > 0)
-template <class _Dummy>
-const char* __stl_debug_engine<_Dummy>::_Message_table[_StlMsg_MAX] _STLP_MESSAGE_TABLE_BODY;
-
-# if (defined (__CYGWIN__) || defined (__MINGW32__)) && \
- defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)
-/*
- * Under cygwin, when STLport is used as a shared library, the id needs
- * to be specified as imported otherwise they will be duplicated in the
- * calling executable.
- */
-_STLP_TEMPLATE_NULL
-_STLP_DECLSPEC const char* __stl_debug_engine<bool>::_Message_table[_StlMsg_MAX];
-# endif
-
-# else
-__DECLARE_INSTANCE(const char*, __stl_debug_engine<bool>::_Message_table[_StlMsg_MAX],
- _STLP_MESSAGE_TABLE_BODY);
-# endif
-
-# undef _STLP_STRING_LITERAL
-# undef _STLP_PERCENT_S
-
-_STLP_MOVE_TO_STD_NAMESPACE
-_STLP_END_NAMESPACE
-
-// abort()
-# ifndef _STLP_INTERNAL_CSTDLIB
-# include <stl/_cstdlib.h>
-# endif
-
-# if !defined (_STLP_DEBUG_MESSAGE)
-# ifndef _STLP_INTERNAL_CSTDARG
-# include <stl/_cstdarg.h>
-# endif
-# ifndef _STLP_INTERNAL_CSTDIO
-# include <stl/_cstdio.h>
-# endif
-# if defined (_STLP_DEBUG_MODE_THROWS) && !defined (_STLP_RANGE_ERRORS_H)
-# include <stl/_range_errors.h>
-# endif
-
-_STLP_BEGIN_NAMESPACE
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...) {
- STLPORT_CSTD::va_list __args;
- va_start( __args, __format_str );
-
-# if !defined (_STLP_DEBUG_MODE_THROWS)
-# if defined (_STLP_USE_WIDE_INTERFACE)
- TCHAR __buffer[512];
- int _convert = strlen(__format_str) + 1;
- LPWSTR _lpw = (LPWSTR)alloca(_convert * sizeof(wchar_t));
- _lpw[0] = '\0';
- MultiByteToWideChar(GetACP(), 0, __format_str, -1, _lpw, _convert);
- wvsprintf(__buffer, _lpw, __args);
- _STLP_WINCE_TRACE(__buffer);
-# elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL))
- char __buffer [4096];
-
-# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
- vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args);
-# else
- vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args);
-# endif
-
- OutputDebugStringA(__buffer);
-
-# elif defined (__amigaos__)
- STLPORT_CSTD::vfprintf(stderr, __format_str, (char *)__args);
-# else
- STLPORT_CSTD::vfprintf(stderr, __format_str, __args);
-# endif
-# else
- char __buffer[4096];
-
-# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
- vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args);
-# elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL))
- vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args);
-# else
- vsprintf(__buffer, __format_str, __args);
-# endif
-# endif
-
-# ifdef _STLP_DEBUG_MESSAGE_POST
- _STLP_DEBUG_MESSAGE_POST
-# endif
-
- va_end(__args);
-
-# if defined (_STLP_DEBUG_MODE_THROWS)
- __stl_throw_runtime_error(__buffer);
-# endif
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-_STLP_END_NAMESPACE
-
-# else
-_STLP_BEGIN_NAMESPACE
-_STLP_MOVE_TO_PRIV_NAMESPACE
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...)
-{}
-_STLP_MOVE_TO_STD_NAMESPACE
-_STLP_END_NAMESPACE
-# endif /* _STLP_DEBUG_MESSAGE */
-
-_STLP_BEGIN_NAMESPACE
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_IndexedError(int __error_ind, const char* __f, int __l) {
- __stl_debug_message(_Message_table[_StlFormat_ERROR_RETURN],
- __f, __l, _Message_table[__error_ind]);
-}
-
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l) {
- __stl_debug_message(_Message_table[_StlFormat_VERBOSE_ASSERTION_FAILURE],
- __f, __l, _Message_table[__error_ind], __f, __l, __expr);
- __stl_debug_terminate();
-}
-
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_Assert(const char* __expr, const char* __f, int __l) {
- __stl_debug_message(_Message_table[_StlFormat_ASSERTION_FAILURE],__f, __l, __expr);
- __stl_debug_terminate();
-}
-
-// if exceptions are present, sends unique exception
-// if not, calls abort() to terminate
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_Terminate()
-{ _STLP_ABORT(); }
-
-_STLP_MOVE_TO_STD_NAMESPACE
-_STLP_END_NAMESPACE
-
-# endif /* _STLP_ASSERTIONS */
-
-# if defined (_STLP_DEBUG)
-
-_STLP_BEGIN_NAMESPACE
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-//==========================================================
-// owned_list non-inline methods
-//==========================================================
-
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_Invalidate_all(__owned_list* __l) {
- _STLP_ACQUIRE_LOCK(__l->_M_lock);
- _Stamp_all(__l, 0);
- __l->_M_node._M_next =0;
- _STLP_RELEASE_LOCK(__l->_M_lock);
-}
-
-// boris : this is unasafe routine; should be used from within critical section only !
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_Stamp_all(__owned_list* __l, __owned_list* __o) {
- // crucial
- if (__l->_M_node._M_owner) {
- for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next;
- __pos != 0; __pos = (__owned_link*)__pos->_M_next) {
- _STLP_ASSERT(__pos->_Owner()== __l)
- __pos->_M_owner=__o;
- }
- }
-}
-
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_Verify(const __owned_list* __l) {
- _STLP_ACQUIRE_LOCK(__l->_M_lock);
- if (__l) {
- _STLP_ASSERT(__l->_M_node._Owner() != 0)
- for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next;
- __pos != 0; __pos = (__owned_link*)__pos->_M_next) {
- _STLP_ASSERT(__pos->_Owner()== __l)
- }
- }
- _STLP_RELEASE_LOCK(__l->_M_lock);
-}
-
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_Swap_owners(__owned_list& __x, __owned_list& __y) {
- /*
- * according to the standard : --no swap() function invalidates any references,
- * pointers, or iterators referring to the elements of the containers being swapped.
- */
-
- __owned_link* __tmp;
-
- /*
- * boris : there is a deadlock potential situation here if we lock two containers sequentially.
- * As user is supposed to provide its own synchronization around swap() ( it is unsafe to do any container/iterator access
- * in parallel with swap()), we just do not use any locking at all -- that behaviour is closer to non-debug version
- */
-
- __tmp = __x._M_node._M_next;
-
- _Stamp_all(&__x, &__y);
- _Stamp_all(&__y, &__x);
-
- __x._M_node._M_next = __y._M_node._M_next;
- __y._M_node._M_next = __tmp;
-}
-
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_Set_owner(__owned_list& __src, __owned_list& __dst) {
- if (&__src == &__dst)
- return;
-
- // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here
- typedef __owned_link _L_type;
- _L_type* __prev = &__src._M_node;
- _L_type* __pos = __prev->_M_next;
-
- while (__pos != 0) {
- __pos->_M_owner = &__dst;
- __prev = __pos;
- __pos = __prev->_M_next;
- }
- __prev->_M_next = __dst._M_node._M_next;
- __dst._M_node._M_next = __src._M_node._M_next;
- __src._M_node._M_next = 0;
-}
-
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_M_detach(__owned_list* __l, __owned_link* __c_node) {
- if (__l != 0) {
-
- _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER)
-
- _STLP_ACQUIRE_LOCK(__l->_M_lock)
- // boris : re-test the condition in case someone else already deleted us
- if(__c_node->_M_owner != 0) {
- __owned_link* __prev, *__next;
-
- for (__prev = &__l->_M_node; (__next = __prev->_M_next) != __c_node;
- __prev = __next) {
- _STLP_ASSERT(__next && __next->_Owner() == __l)
- }
-
- __prev->_M_next = __c_node->_M_next;
- __c_node->_M_owner=0;
- }
- _STLP_RELEASE_LOCK(__l->_M_lock)
- }
-}
-
-template <class _Dummy>
-void _STLP_CALL
-__stl_debug_engine<_Dummy>::_M_attach(__owned_list* __l, __owned_link* __c_node) {
- if (__l ==0) {
- (__c_node)->_M_owner = 0;
- } else {
- _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER)
- _STLP_ACQUIRE_LOCK(__l->_M_lock)
- __c_node->_M_owner = __l;
- __c_node->_M_next = __l->_M_node._M_next;
- __l->_M_node._M_next = __c_node;
- _STLP_RELEASE_LOCK(__l->_M_lock)
- }
-}
-
-template <class _Dummy>
-void* _STLP_CALL
-__stl_debug_engine<_Dummy>::_Get_container_ptr(const __owned_link* __l) {
- const __owned_list* __owner = __l->_Owner();
- _STLP_VERBOSE_RETURN_0(__owner != 0, _StlMsg_INVALID_ITERATOR)
- void* __ret = __CONST_CAST(void*,__owner->_Owner());
- _STLP_VERBOSE_RETURN_0(__ret !=0, _StlMsg_INVALID_CONTAINER)
- return __ret;
-}
-
-template <class _Dummy>
-bool _STLP_CALL
-__stl_debug_engine<_Dummy>::_Check_same_owner(const __owned_link& __i1,
- const __owned_link& __i2) {
- _STLP_VERBOSE_RETURN(__i1._Valid(), _StlMsg_INVALID_LEFTHAND_ITERATOR)
- _STLP_VERBOSE_RETURN(__i2._Valid(), _StlMsg_INVALID_RIGHTHAND_ITERATOR)
- _STLP_VERBOSE_RETURN((__i1._Owner() == __i2._Owner()), _StlMsg_DIFFERENT_OWNERS)
- return true;
-}
-
-template <class _Dummy>
-bool _STLP_CALL
-__stl_debug_engine<_Dummy>::_Check_same_or_null_owner(const __owned_link& __i1,
- const __owned_link& __i2) {
- _STLP_VERBOSE_RETURN(__i1._Owner() == __i2._Owner(), _StlMsg_DIFFERENT_OWNERS)
- return true;
-}
-
-template <class _Dummy>
-bool _STLP_CALL
-__stl_debug_engine<_Dummy>::_Check_if_owner( const __owned_list * __l, const __owned_link& __it) {
- const __owned_list* __owner_ptr = __it._Owner();
- _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR)
- _STLP_VERBOSE_RETURN(__l == __owner_ptr, _StlMsg_NOT_OWNER)
- return true;
-}
-
-template <class _Dummy>
-bool _STLP_CALL
-__stl_debug_engine<_Dummy>::_Check_if_not_owner( const __owned_list * __l, const __owned_link& __it) {
- const __owned_list* __owner_ptr = __it._Owner();
- _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR)
- _STLP_VERBOSE_RETURN(__l != __owner_ptr, _StlMsg_SHOULD_NOT_OWNER)
- return true;
-}
-
-_STLP_MOVE_TO_STD_NAMESPACE
-_STLP_END_NAMESPACE
-
-# endif /* _STLP_DEBUG */
-
-#endif /* if defined (EXPOSE_GLOBALS_IMPLEMENTATION) */
-
-#endif /* header guard */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/debug/_debug.h b/stl/debug/_debug.h
deleted file mode 100644
index 90e6218..0000000
--- a/stl/debug/_debug.h
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_DEBUG_H
-#define _STLP_DEBUG_H
-
-#if defined (_STLP_ASSERTIONS) || defined (_STLP_DEBUG)
-
-# ifndef _STLP_TYPE_TRAITS_H
-# include <stl/type_traits.h>
-# endif
-
-# if !defined (_STLP_EXTRA_OPERATORS_FOR_DEBUG) && \
- (defined (_STLP_BASE_MATCH_BUG) || (defined (_STLP_MSVC) && _STLP_MSVC < 1100))
-# define _STLP_EXTRA_OPERATORS_FOR_DEBUG
-# endif
-
-# if !defined (_STLP_FILE__)
-# define _STLP_FILE__ __FILE__
-# endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-enum {
- //General errors
- _StlFormat_ERROR_RETURN,
- _StlFormat_ASSERTION_FAILURE,
- _StlFormat_VERBOSE_ASSERTION_FAILURE,
- _StlMsg_INVALID_ARGUMENT,
- //Container/Iterator related errors
- _StlMsg_INVALID_CONTAINER,
- _StlMsg_EMPTY_CONTAINER,
- _StlMsg_ERASE_PAST_THE_END,
- _StlMsg_OUT_OF_BOUNDS,
- _StlMsg_NOT_OWNER,
- _StlMsg_SHOULD_NOT_OWNER,
- _StlMsg_INVALID_ITERATOR,
- _StlMsg_INVALID_LEFTHAND_ITERATOR,
- _StlMsg_INVALID_RIGHTHAND_ITERATOR,
- _StlMsg_DIFFERENT_OWNERS ,
- _StlMsg_NOT_DEREFERENCEABLE ,
- _StlMsg_INVALID_RANGE ,
- _StlMsg_NOT_IN_RANGE_1 ,
- _StlMsg_NOT_IN_RANGE_2 ,
- _StlMsg_INVALID_ADVANCE ,
- _StlMsg_SINGULAR_ITERATOR ,
- //Bad predicate for sorting
- _StlMsg_INVALID_STRICT_WEAK_PREDICATE,
- _StlMsg_INVALID_EQUIVALENT_PREDICATE,
- // debug alloc messages
- _StlMsg_DBA_DELETED_TWICE ,
- _StlMsg_DBA_NEVER_ALLOCATED ,
- _StlMsg_DBA_TYPE_MISMATCH ,
- _StlMsg_DBA_SIZE_MISMATCH ,
- _StlMsg_DBA_UNDERRUN ,
- _StlMsg_DBA_OVERRUN ,
- // auto_ptr messages
- _StlMsg_AUTO_PTR_NULL ,
- //Memory alignent message
- _StlMsg_WRONG_MEMORY_ALIGNMENT,
- _StlMsg_UNKNOWN
- /* _StlMsg_MAX */
-};
-
-/* have to hardcode that ;() */
-# define _StlMsg_MAX 31
-
-// This class is unique (not inherited from exception),
-// to disallow catch in anything but (...)
-struct __stl_debug_exception {
- // no members
-};
-
-class _STLP_CLASS_DECLSPEC __owned_link;
-class _STLP_CLASS_DECLSPEC __owned_list;
-
-#if defined (_STLP_DEBUG_MODE_THROWS)
-# define _STLP_MESSAGE_NORETURN _STLP_FUNCTION_THROWS
-#else
-# define _STLP_MESSAGE_NORETURN
-#endif
-
-template <class _Dummy>
-struct __stl_debug_engine {
-
- // Basic routine to report any debug message
- // Use _STLP_DEBUG_MESSAGE to override
- static void _STLP_MESSAGE_NORETURN _STLP_CALL _Message(const char * format_str, ...);
-
- // Micsellanous function to report indexed error message
- static void _STLP_CALL _IndexedError(int __ind, const char* __f, int __l);
-
- // Basic assertion report mechanism.
- // Reports failed assertion via __stl_debug_message and calls _Terminate
- // if _STLP_DEBUG_TERMINATE is specified, calls __stl_debug_terminate instead
- static void _STLP_CALL _Assert(const char* __expr, const char* __f, int __l);
-
- // The same, with additional diagnostics
- static void _STLP_CALL _VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l);
-
- // If exceptions are present, sends unique exception
- // If not, calls _STLP_ABORT() to terminate
- // Use _STLP_DEBUG_TERMINATE to override
- static void _STLP_CALL _Terminate();
-
-# if defined (_STLP_DEBUG)
- // owned_list/link delegate non-inline functions here
-
- static bool _STLP_CALL _Check_same_owner( const __owned_link& __i1,
- const __owned_link& __i2);
- static bool _STLP_CALL _Check_same_or_null_owner( const __owned_link& __i1,
- const __owned_link& __i2);
- static bool _STLP_CALL _Check_if_owner( const __owned_list*, const __owned_link&);
-
- static bool _STLP_CALL _Check_if_not_owner( const __owned_list*, const __owned_link&);
-
- static void _STLP_CALL _Verify(const __owned_list*);
-
- static void _STLP_CALL _Swap_owners(__owned_list&, __owned_list&);
-
- static void _STLP_CALL _Invalidate_all(__owned_list*);
-
- static void _STLP_CALL _Set_owner(__owned_list& /*src*/, __owned_list& /*dst*/);
-
- static void _STLP_CALL _Stamp_all(__owned_list*, __owned_list*);
-
- static void _STLP_CALL _M_detach(__owned_list*, __owned_link*);
-
- static void _STLP_CALL _M_attach(__owned_list*, __owned_link*);
-
- // accessor : check and get pointer to the container
- static void* _STLP_CALL _Get_container_ptr(const __owned_link*);
-# endif
-
- // debug messages and formats
- static _STLP_STATIC_MEMBER_DECLSPEC const char* _Message_table[_StlMsg_MAX];
-};
-
-#undef _STLP_MESSAGE_NORETURN
-
-# if defined (_STLP_USE_TEMPLATE_EXPORT)
-_STLP_EXPORT_TEMPLATE struct _STLP_CLASS_DECLSPEC __stl_debug_engine<bool>;
-# endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-typedef __stl_debug_engine<bool> __stl_debugger;
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-# if !defined (_STLP_ASSERT)
-# define _STLP_ASSERT(expr) \
- if (!(expr)) { _STLP_PRIV __stl_debugger::_Assert( # expr, _STLP_FILE__, __LINE__); }
-# endif
-
-#endif /* _STLP_ASSERTIONS || _STLP_DEBUG */
-
-// this section is for _STLP_DEBUG only
-#if defined (_STLP_DEBUG)
-
-# if !defined (_STLP_VERBOSE_ASSERT)
-// fbp : new form not requiring ";"
-# define _STLP_VERBOSE_ASSERT(expr, __diag_num) \
- if (!(expr)) { _STLP_PRIV __stl_debugger::_VerboseAssert\
- ( # expr, _STLP_PRIV __diag_num, _STLP_FILE__, __LINE__ ); \
- }
-# endif
-
-# define _STLP_DEBUG_CHECK(expr) _STLP_ASSERT(expr)
-# define _STLP_DEBUG_DO(expr) expr;
-
-# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
-# define _STLP_STD_DEBUG_CHECK(expr) _STLP_DEBUG_CHECK(expr)
-# define _STLP_STD_DEBUG_DO(expr) _STLP_DEBUG_DO(expr)
-# else
-# define _STLP_STD_DEBUG_CHECK(expr)
-# define _STLP_STD_DEBUG_DO(expr)
-# endif
-
-# if !defined (_STLP_VERBOSE_RETURN)
-# define _STLP_VERBOSE_RETURN(__expr,__diag_num) if (!(__expr)) { \
- _STLP_PRIV __stl_debugger::_IndexedError(__diag_num, _STLP_FILE__ , __LINE__); \
- return false; }
-# endif
-
-# if !defined (_STLP_VERBOSE_RETURN_0)
-# define _STLP_VERBOSE_RETURN_0(__expr,__diag_num) if (!(__expr)) { \
- _STLP_PRIV __stl_debugger::_IndexedError(__diag_num, _STLP_FILE__, __LINE__); \
- return 0; }
-# endif
-
-# ifndef _STLP_INTERNAL_THREADS_H
-# include <stl/_threads.h>
-# endif
-
-# ifndef _STLP_INTERNAL_ITERATOR_BASE_H
-# include <stl/_iterator_base.h>
-# endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-/*
- * Special debug iterator traits having an additionnal static member
- * method _Check. It is used by the slit debug implementation to check
- * the special before_begin iterator.
- */
-template <class _Traits>
-struct _DbgTraits : _Traits {
- typedef _DbgTraits<typename _Traits::_ConstTraits> _ConstTraits;
- typedef _DbgTraits<typename _Traits::_NonConstTraits> _NonConstTraits;
-
- template <class _Iterator>
- static bool _Check(const _Iterator&) {return true;}
-};
-
-//=============================================================
-template <class _Iterator>
-inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2,
- const random_access_iterator_tag&)
-{ return (__i1 < __i2) || (__i1 == __i2); }
-
-template <class _Iterator>
-inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2,
- const bidirectional_iterator_tag&) {
- // check if comparable
- bool __dummy(__i1==__i2);
- return (__dummy==__dummy);
-}
-
-template <class _Iterator>
-inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2,
- const forward_iterator_tag&) {
- // check if comparable
- bool __dummy(__i1==__i2);
- return (__dummy==__dummy);
-}
-
-template <class _Iterator>
-inline bool _STLP_CALL __valid_range(const _Iterator&,const _Iterator&,
- const input_iterator_tag&)
-{ return true; }
-
-template <class _Iterator>
-inline bool _STLP_CALL __valid_range(const _Iterator&,const _Iterator&,
- const output_iterator_tag&)
-{ return true; }
-
-template <class _Iterator>
-inline bool _STLP_CALL __valid_range(const _Iterator& __i1, const _Iterator& __i2)
-{ return __valid_range(__i1,__i2,_STLP_ITERATOR_CATEGORY(__i1, _Iterator)); }
-
-// Note : that means in range [i1, i2].
-template <class _Iterator>
-inline bool _STLP_CALL __in_range(const _Iterator& _It,
- const _Iterator& __i1, const _Iterator& __i2)
-{ return __valid_range(__i1,_It) && __valid_range(_It,__i2); }
-
-template <class _Iterator>
-inline bool _STLP_CALL __in_range(const _Iterator& __first, const _Iterator& __last,
- const _Iterator& __start, const _Iterator& __finish)
-{ return __valid_range(__first,__last) && __valid_range(__start,__first) && __valid_range(__last,__finish); }
-
-//==========================================================
-class _STLP_CLASS_DECLSPEC __owned_link {
-public:
- __owned_link() : _M_owner(0) {}
- __owned_link(const __owned_list* __c) : _M_owner(0), _M_next(0)
- { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__c), this); }
- __owned_link(const __owned_link& __rhs): _M_owner(0)
- { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__rhs._M_owner), this); }
- __owned_link& operator=(const __owned_link& __rhs) {
- __owned_list* __new_owner = __CONST_CAST(__owned_list*,__rhs._M_owner);
- __owned_list* __old_owner = _M_owner;
- if ( __old_owner != __new_owner ) {
- __stl_debugger::_M_detach(__old_owner, this);
- __stl_debugger::_M_attach(__new_owner, this);
- }
- return *this;
- }
- ~__owned_link() {
- __stl_debugger::_M_detach(_M_owner, this);
- _Invalidate();
- }
-
- const __owned_list* _Owner() const { return _M_owner; }
- __owned_list* _Owner() { return _M_owner; }
- void _Set_owner(const __owned_list* __o) { _M_owner= __CONST_CAST(__owned_list*,__o); }
- bool _Valid() const { return _M_owner != 0; }
- void _Invalidate() { _M_owner = 0; _M_next = 0; }
- void _Link_to_self() { _M_next = 0; }
-
- __owned_link* _Next() { return _M_next; }
- const __owned_link* _Next() const { return _M_next; }
-
-public:
- __owned_list* _M_owner;
- __owned_link* _M_next;
-};
-
-
-class _STLP_CLASS_DECLSPEC __owned_list {
-public:
- __owned_list(void* __o) {
- // fprintf(stderr, "__owned_list(): %p\n",(void*)this);
- _M_node._M_owner = __REINTERPRET_CAST(__owned_list*,__o);
- _M_node._M_next = 0;
- }
- ~__owned_list() {
- // fprintf(stderr, "~__owned_list(): %p\n",(void*)this);
- _Invalidate_all();
- // that prevents detach
- _M_node._Invalidate();
- }
- const void* _Owner() const { return (const void*)_M_node._M_owner; }
- void* _Owner() { return (void*)_M_node._M_owner; }
- bool _Valid() const { return _M_node._M_owner != 0; }
- void _Invalidate() { _M_node._M_owner = 0; }
-
- __owned_link* _First() { return _M_node._Next(); }
- __owned_link* _Last() { return 0 ; }
-
- const __owned_link* _First() const { return (__owned_link*)_M_node._M_next; }
- const __owned_link* _Last() const { return 0 ;}
-
- void _Verify() const { __stl_debugger::_Verify(this); }
- void _Swap_owners(__owned_list& __y) { __stl_debugger::_Swap_owners(*this, __y); }
- void _Invalidate_all() { __stl_debugger::_Invalidate_all(this); }
- void _Set_owner(__owned_list& __y) { __stl_debugger::_Set_owner(*this, __y); }
-
- mutable __owned_link _M_node;
- mutable _STLP_mutex _M_lock;
-
-private:
- // should never be called, should be left not implemented,
- // but some compilers complain about it ;(
- __owned_list(const __owned_list&){}
- __owned_list& operator = (const __owned_list&) { return *this; }
-
- friend class __owned_link;
- friend struct __stl_debug_engine<bool>;
-};
-
-
-//==========================================================
-
-// forward declaratioins
-
-template <class _Iterator>
-bool _STLP_CALL __check_range(const _Iterator&, const _Iterator&);
-template <class _Iterator>
-bool _STLP_CALL __check_range(const _Iterator&,
- const _Iterator&, const _Iterator&);
-template <class _Iterator>
-bool _STLP_CALL __check_range(const _Iterator&, const _Iterator& ,
- const _Iterator&, const _Iterator& );
-template <class _Tp>
-bool _STLP_CALL __check_ptr_range(const _Tp*, const _Tp*);
-
-
-template <class _Iterator>
-void _STLP_CALL __invalidate_range(const __owned_list* __base,
- const _Iterator& __first,
- const _Iterator& __last);
-
-template <class _Iterator>
-void _STLP_CALL __invalidate_iterator(const __owned_list* __base,
- const _Iterator& __it);
-
-template <class _Iterator>
-void _STLP_CALL __change_range_owner(const _Iterator& __first,
- const _Iterator& __last,
- const __owned_list* __dst);
-
-template <class _Iterator>
-void _STLP_CALL __change_ite_owner(const _Iterator& __it,
- const __owned_list* __dst);
-
-//============================================================
-inline bool _STLP_CALL
-__check_same_owner(const __owned_link& __i1, const __owned_link& __i2)
-{ return __stl_debugger::_Check_same_owner(__i1,__i2); }
-
-inline bool _STLP_CALL
-__check_same_or_null_owner(const __owned_link& __i1, const __owned_link& __i2)
-{ return __stl_debugger::_Check_same_or_null_owner(__i1,__i2); }
-
-template <class _Iterator>
-inline bool _STLP_CALL __check_if_owner( const __owned_list* __owner,
- const _Iterator& __it)
-{ return __stl_debugger::_Check_if_owner(__owner, (const __owned_link&)__it); }
-
-template <class _Iterator>
-inline bool _STLP_CALL __check_if_not_owner( const __owned_list* /*__owner*/,
- const _Iterator& /*__it*/,
- const __false_type&)
-{ return true; }
-
-template <class _Iterator>
-inline bool _STLP_CALL __check_if_not_owner( const __owned_list* __owner,
- const _Iterator& __it,
- const __true_type&)
-{ return __stl_debugger::_Check_if_not_owner(__owner, (const __owned_link&)__it); }
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_DEBUG */
-
-#if defined (_STLP_ASSERTIONS)
-
-# if !defined (_STLP_ASSERT_MSG_TRAILER)
-# define _STLP_ASSERT_MSG_TRAILER
-# endif
-
-// dwa 12/30/98 - if _STLP_DEBUG_MESSAGE is defined, the user can supply own definition.
-# if !defined (_STLP_DEBUG_MESSAGE)
-# define __stl_debug_message __stl_debugger::_Message
-# else
-extern void __stl_debug_message(const char * format_str, ...);
-# endif
-
-// fbp: if _STLP_DEBUG_TERMINATE is defined, the user can supply own definition.
-# if !defined (_STLP_DEBUG_TERMINATE)
-# define __stl_debug_terminate __stl_debugger::_Terminate
-# else
-extern void __stl_debug_terminate();
-# endif
-
-#endif
-
-#if !defined (_STLP_LINK_TIME_INSTANTIATION)
-# include <stl/debug/_debug.c>
-#endif
-
-#endif /* DEBUG_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/debug/_deque.h b/stl/debug/_deque.h
deleted file mode 100644
index 45595a0..0000000
--- a/stl/debug/_deque.h
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_DBG_DEQUE_H
-#define _STLP_INTERNAL_DBG_DEQUE_H
-
-#ifndef _STLP_DBG_ITERATOR_H
-# include <stl/debug/_iterator.h>
-#endif
-
-#define _STLP_NON_DBG_DEQUE _STLP_PRIV _STLP_NON_DBG_NAME(deque) <_Tp,_Alloc>
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
-template <class _Tp, class _Alloc>
-inline _Tp* value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_DEQUE >&)
-{ return (_Tp*)0; }
-template <class _Tp, class _Alloc>
-inline random_access_iterator_tag iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_DEQUE >&)
-{ return random_access_iterator_tag(); }
-#endif
-
-template <class _Tp, _STLP_DBG_ALLOCATOR_SELECT(_Tp) >
-class deque :
-#if !defined (__DMC__)
- private
-#endif
- _STLP_PRIV __construct_checker<_STLP_NON_DBG_DEQUE >
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- , public __stlport_class<deque<_Tp, _Alloc> >
-#endif
-{
- typedef deque<_Tp,_Alloc> _Self;
- typedef _STLP_NON_DBG_DEQUE _Base;
- typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_DEQUE > _ConstructCheck;
-
-public:
- // Basic types
- __IMPORT_CONTAINER_TYPEDEFS(_Base)
-
- // Iterators
- typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
- typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > > const_iterator;
-
- _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
-
-protected:
- _Base _M_non_dbg_impl;
- _STLP_PRIV __owned_list _M_iter_list;
-
- void _Invalidate_all()
- { _M_iter_list._Invalidate_all(); }
- void _Invalidate_iterator(const iterator& __it)
- { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); }
- void _Invalidate_iterators(const iterator& __first, const iterator& __last)
- { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
-
-public:
- // Basic accessors
- allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
-
- iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
- iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
- const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
- const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
- const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
-
- reference operator[](size_type __n) {
- _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
- return _M_non_dbg_impl[__n];
- }
- const_reference operator[](size_type __n) const {
- _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
- return _M_non_dbg_impl[__n];
- }
-
- reference at(size_type __n) { return _M_non_dbg_impl.at(__n); }
- const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); }
-
- reference front() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return *begin();
- }
- const_reference front() const {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return *begin();
- }
- reference back() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return *(--end());
- }
- const_reference back() const {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return *(--end());
- }
-
- // Constructor, destructor.
- explicit deque(const allocator_type& __a = allocator_type()) :
- _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
- deque(const _Self& __x) :
- _ConstructCheck(__x), _M_non_dbg_impl(__x._M_non_dbg_impl),
- _M_iter_list(&_M_non_dbg_impl) {}
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit deque(size_type __n, const value_type& __x = _Tp(),
-#else
- deque(size_type __n, param_type __x,
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- const allocator_type& __a = allocator_type()) :
- _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit deque(size_type __n) :
- _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- deque(__move_source<_Self> src)
- : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
- _M_iter_list(&_M_non_dbg_impl) {
-#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
- src.get()._M_iter_list._Invalidate_all();
-#else
- src.get()._M_iter_list._Set_owner(_M_iter_list);
-#endif
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- deque(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
- _M_iter_list(&_M_non_dbg_impl) {
- }
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- deque(_InputIterator __first, _InputIterator __last)
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
- _M_iter_list(&_M_non_dbg_impl) {
- }
-# endif
-#else
- deque(const value_type* __first, const value_type* __last,
- const allocator_type& __a = allocator_type())
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(__first, __last, __a),
- _M_iter_list(&_M_non_dbg_impl) {
- }
-
- deque(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type())
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
- _M_iter_list(&_M_non_dbg_impl) {
- }
-#endif
-
- _Self& operator=(const _Self& __x) {
- if (this != &__x) {
- _Invalidate_all();
- _M_non_dbg_impl = __x._M_non_dbg_impl;
- }
- return *this;
- }
-
- bool empty() const { return _M_non_dbg_impl.empty(); }
- size_type size() const { return _M_non_dbg_impl.size(); }
- size_type max_size() const { return _M_non_dbg_impl.max_size(); }
-
- void swap(_Self& __x) {
- _M_iter_list._Swap_owners(__x._M_iter_list);
- _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
- }
-
-public:
- void assign(size_type __n, const _Tp& __val) {
- _Invalidate_all();
- _M_non_dbg_impl.assign(__n, __val);
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _Invalidate_all();
- _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- }
-#else
- void assign(const_iterator __first, const_iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _Invalidate_all();
- _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
- }
- void assign(const value_type *__first, const value_type *__last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
- _Invalidate_all();
- _M_non_dbg_impl.assign(__first, __last);
- }
-#endif
-
-public: // push_* and pop_*
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_back(const value_type& __t = _Tp()) {
-#else
- void push_back(const value_type& __t) {
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- _Invalidate_all();
- _M_non_dbg_impl.push_back(__t);
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_back() {
- _Invalidate_all();
- _M_non_dbg_impl.push_back();
- }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_front(const value_type& __t = _Tp()) {
-#else
- void push_front(const value_type& __t) {
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- _Invalidate_all();
- _M_non_dbg_impl.push_front(__t);
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_front() {
- _Invalidate_all();
- _M_non_dbg_impl.push_front();
- }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
- void pop_back() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- _Invalidate_iterator(end());
- _M_non_dbg_impl.pop_back();
- }
-
- void pop_front() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- _Invalidate_iterator(begin());
- _M_non_dbg_impl.pop_front();
- }
-
-public: // Insert
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos, const value_type& __x = _Tp()) {
-#else
- iterator insert(iterator __pos, const value_type& __x) {
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _Invalidate_all();
- return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _Invalidate_all();
- return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator));
- }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
- void insert(iterator __pos, size_type __n, const value_type& __x) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- if (__n != 0) _Invalidate_all();
- _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
- typedef typename _AreSameUnCVTypes<_InputIterator, iterator>::_Ret _IsNonConstIterator;
- typedef typename _AreSameUnCVTypes<_InputIterator, const_iterator>::_Ret _IsConstIterator;
- typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _DoCheck;
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- //Sequence requirements 23.1.1 Table 67:
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first, _DoCheck()));
- _M_non_dbg_impl.insert(__pos._M_iterator,
- _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- //dums: because of self insertion iterators must be invalidated after insertion.
- if (__first != __last) _Invalidate_all();
- }
-#else
- void insert(iterator __pos,
- const value_type* __first, const value_type* __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
- _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
- //dums: because of self insertion iterators must be invalidated after insertion.
- if (__first != __last) _Invalidate_all();
- }
- void insert(iterator __pos,
- const_iterator __first, const_iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- //Sequence requirements 23.1.1 Table 67:
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first, __true_type()));
- _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
- //dums: because of self insertion iterators must be invalidated after insertion.
- if (__first != __last) _Invalidate_all();
- }
-#endif
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size, const value_type& __x = _Tp()) {
-#else
- void resize(size_type __new_size, const value_type& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- if (__new_size != size()) {
- if ((__new_size > size()) || (__new_size < size() - 1))
- _Invalidate_all();
- else
- _Invalidate_iterator(end());
- }
- _M_non_dbg_impl.resize(__new_size, __x);
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type new_size) { resize(new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- // Erase
- iterator erase(iterator __pos) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- if (__pos._M_iterator == _M_non_dbg_impl.begin())
- _Invalidate_iterator(__pos);
- else {
- typename _Base::iterator __tmp = --(_M_non_dbg_impl.end());
- if (__pos._M_iterator == __tmp)
- _Invalidate_iterator(__pos);
- else
- _Invalidate_all();
- }
- return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
- }
-
- iterator erase(iterator __first, iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
- if (!empty()) {
- if (__first._M_iterator == _M_non_dbg_impl.begin() ||
- __last._M_iterator == _M_non_dbg_impl.end())
- _Invalidate_iterators(__first, __last);
- else
- _Invalidate_all();
- }
- return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
- }
-
- void clear() {
- _Invalidate_all();
- _M_non_dbg_impl.clear();
- }
-};
-
-_STLP_END_NAMESPACE
-
-#undef _STLP_NON_DBG_DEQUE
-
-#endif /* _STLP_INTERNAL_DEQUE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/debug/_hashtable.h b/stl/debug/_hashtable.h
deleted file mode 100644
index b0d6411..0000000
--- a/stl/debug/_hashtable.h
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_DBG_HASHTABLE_H
-#define _STLP_INTERNAL_DBG_HASHTABLE_H
-
-// Hashtable class, used to implement the hashed associative containers
-// hash_set, hash_map, hash_multiset, and hash_multimap,
-// unordered_set, unordered_map, unordered_multiset, unordered_multimap
-
-#ifndef _STLP_DBG_ITERATOR_H
-# include <stl/debug/_iterator.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Key, class _Equal>
-class _DbgEqual {
-public:
- _DbgEqual() {}
- _DbgEqual(const _Equal& __eq) : _M_non_dbg_eq(__eq) {}
- _DbgEqual(const _DbgEqual& __eq) : _M_non_dbg_eq(__eq._M_non_dbg_eq) {}
-
-#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
- bool operator () (const _Key& __lhs, const _Key& __rhs) const
-#else
- template <class _Kp1, class _Kp2>
- bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const
-#endif
- {
-#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
- _STLP_VERBOSE_ASSERT(_M_non_dbg_eq(__rhs, __lhs) == _M_non_dbg_eq(__lhs, __rhs), _StlMsg_INVALID_EQUIVALENT_PREDICATE)
-#endif
- return _M_non_dbg_eq(__lhs, __rhs) ? true : false;
- }
-
- _Equal non_dbg_key_eq() const { return _M_non_dbg_eq; }
-private:
- _Equal _M_non_dbg_eq;
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-#define _STLP_NON_DBG_HT \
-_STLP_PRIV _STLP_NON_DBG_NAME(hashtable) <_Val, _Key, _HF, _Traits, _ExK, _STLP_PRIV _DbgEqual<_Key, _EqK>, _All>
-
-#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
-template <class _Val, class _Key, class _HF,
- class _ExK, class _EqK, class _All>
-inline _Val*
-value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_HT >&)
-{ return (_Val*)0; }
-
-template <class _Val, class _Key, class _HF,
- class _ExK, class _EqK, class _All>
-inline forward_iterator_tag
-iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_HT >&)
-{ return forward_iterator_tag(); }
-#endif
-
-template <class _Val, class _Key, class _HF,
- class _Traits, class _ExK, class _EqK, class _All>
-class hashtable {
- typedef hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> _Self;
- typedef _STLP_NON_DBG_HT _Base;
-
- typedef typename _Traits::_NonConstTraits _NonConstTraits;
- typedef typename _Traits::_ConstTraits _ConstTraits;
- typedef typename _Traits::_NonConstLocalTraits _NonConstLocalTraits;
- typedef typename _Traits::_ConstLocalTraits _ConstLocalTraits;
-
- _Base _M_non_dbg_impl;
- _STLP_PRIV __owned_list _M_iter_list;
-
-public:
- typedef _Key key_type;
- typedef _HF hasher;
- typedef _EqK key_equal;
-
- __IMPORT_CONTAINER_TYPEDEFS(_Base)
-
- typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstTraits> > iterator;
- typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstTraits> > const_iterator;
- //typedef _STLP_PRIV _DBG_iter<_Base, _DbgTraits<_NonConstLocalTraits> > local_iterator;
- typedef iterator local_iterator;
- //typedef _STLP_PRIV _DBG_iter<_Base, _DbgTraits<_ConstLocalTraits> > const_local_iterator;
- typedef const_iterator const_local_iterator;
-
- typedef typename _Base::iterator _Base_iterator;
- typedef typename _Base::const_iterator _Base_const_iterator;
-
- hasher hash_funct() const { return _M_non_dbg_impl.hash_funct(); }
- key_equal key_eq() const { return _M_non_dbg_impl.key_eq().non_dbg_key_eq(); }
-
-private:
- void _Invalidate_iterator(const const_iterator& __it)
- { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
- void _Invalidate_iterators(const const_iterator& __first, const const_iterator& __last)
- { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
-
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-public:
- allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
-
- hashtable(size_type __n,
- const _HF& __hf,
- const _EqK& __eql,
- const _ExK& __ext,
- const allocator_type& __a = allocator_type())
- : _M_non_dbg_impl(__n, __hf, __eql, __ext, __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-
- hashtable(size_type __n,
- const _HF& __hf,
- const _EqK& __eql,
- const allocator_type& __a = allocator_type())
- : _M_non_dbg_impl(__n, __hf, __eql, __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-
- hashtable(const _Self& __ht)
- : _M_non_dbg_impl(__ht._M_non_dbg_impl),
- _M_iter_list(&_M_non_dbg_impl) {}
-
- hashtable(__move_source<_Self> src)
- : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
- _M_iter_list(&_M_non_dbg_impl) {
-#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
- src.get()._M_iter_list._Invalidate_all();
-#else
- src.get()._M_iter_list._Set_owner(_M_iter_list);
-#endif
- }
-
- size_type size() const { return _M_non_dbg_impl.size(); }
- size_type max_size() const { return _M_non_dbg_impl.max_size(); }
- bool empty() const { return _M_non_dbg_impl.empty(); }
-
- _Self& operator=(const _Self& __ht) {
- if (this != &__ht) {
- //Should not invalidate end iterator
- _Invalidate_iterators(begin(), end());
- _M_non_dbg_impl = __ht._M_non_dbg_impl;
- }
- return *this;
- }
-
- void swap(_Self& __ht) {
- _M_iter_list._Swap_owners(__ht._M_iter_list);
- _M_non_dbg_impl.swap(__ht._M_non_dbg_impl);
- }
-
- iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
- iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
- local_iterator begin(size_type __n) {
- //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
- _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
- return local_iterator(&_M_iter_list, _M_non_dbg_impl.begin(__n));
- }
- local_iterator end(size_type __n) {
- //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
- _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
- return local_iterator(&_M_iter_list, _M_non_dbg_impl.end(__n));
- }
-
- const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
- const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
- const_local_iterator begin(size_type __n) const {
- //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
- _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
- return const_local_iterator(&_M_iter_list, _M_non_dbg_impl.begin(__n));
- }
- const_local_iterator end(size_type __n) const {
- //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
- _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
- return const_local_iterator(&_M_iter_list, _M_non_dbg_impl.end(__n));
- }
-
- pair<iterator, bool> insert_unique(const value_type& __obj) {
- pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__obj);
- return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
- }
-
- iterator insert_equal(const value_type& __obj)
- { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__obj)); }
-
- pair<iterator, bool> insert_unique_noresize(const value_type& __obj) {
- pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique_noresize(__obj);
- return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
- }
-
- iterator insert_equal_noresize(const value_type& __obj)
- { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal_noresize(__obj)); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert_unique(_InputIterator __f, _InputIterator __l) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
- _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
- }
-
- template <class _InputIterator>
- void insert_equal(_InputIterator __f, _InputIterator __l){
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
- _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
- }
-
-#else
- void insert_unique(const value_type* __f, const value_type* __l) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
- _M_non_dbg_impl.insert_unique(__f, __l);
- }
-
- void insert_equal(const value_type* __f, const value_type* __l) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
- _M_non_dbg_impl.insert_equal(__f, __l);
- }
-
- void insert_unique(const_iterator __f, const_iterator __l) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
- _M_non_dbg_impl.insert_unique(__f._M_iterator, __l._M_iterator);
- }
-
- void insert_equal(const_iterator __f, const_iterator __l) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
- _M_non_dbg_impl.insert_equal(__f._M_iterator, __l._M_iterator);
- }
-#endif
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __key)
- { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__key)); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __key) const
- { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__key)); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __key) const { return _M_non_dbg_impl.count(__key); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __key) {
- pair<_Base_iterator, _Base_iterator> __res = _M_non_dbg_impl.equal_range(__key);
- return pair<iterator,iterator> (iterator(&_M_iter_list,__res.first),
- iterator(&_M_iter_list,__res.second));
- }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __key) const {
- pair <_Base_const_iterator, _Base_const_iterator> __res = _M_non_dbg_impl.equal_range(__key);
- return pair<const_iterator,const_iterator> (const_iterator(&_M_iter_list,__res.first),
- const_iterator(&_M_iter_list,__res.second));
- }
-
- size_type erase(const key_type& __key) {
- pair<_Base_iterator, _Base_iterator> __p = _M_non_dbg_impl.equal_range(__key);
- size_type __n = _STLP_STD::distance(__p.first, __p.second);
- _Invalidate_iterators(const_iterator(&_M_iter_list, __p.first), const_iterator(&_M_iter_list, __p.second));
- _M_non_dbg_impl.erase(__p.first, __p.second);
- return __n;
- }
-
- void erase(const const_iterator& __it) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__it))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __it))
- _Invalidate_iterator(__it);
- _M_non_dbg_impl.erase(__it._M_iterator);
- }
- void erase(const_iterator __first, const_iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last,
- const_iterator(begin()), const_iterator(end())))
- _Invalidate_iterators(__first, __last);
- _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator);
- }
-
- void rehash(size_type __num_buckets_hint) { _M_non_dbg_impl.rehash(__num_buckets_hint); }
- void resize(size_type __num_elements_hint) { _M_non_dbg_impl.resize(__num_elements_hint); }
-
- void clear() {
- _Invalidate_iterators(begin(), end());
- _M_non_dbg_impl.clear();
- }
-
- reference _M_insert(const value_type& __obj) { return _M_non_dbg_impl._M_insert(__obj); }
-
- size_type bucket_count() const { return _M_non_dbg_impl.bucket_count(); }
- size_type max_bucket_count() const { return _M_non_dbg_impl.max_bucket_count(); }
- size_type elems_in_bucket(size_type __n) const {
- _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.elems_in_bucket(__n);
- }
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type bucket(const _KT& __k) const { return _M_non_dbg_impl.bucket(__k); }
-
- float load_factor() const { return _M_non_dbg_impl.load_factor(); }
- float max_load_factor() const { return _M_non_dbg_impl.max_load_factor(); }
- void max_load_factor(float __z) {
- _STLP_VERBOSE_ASSERT((__z > 0.0f), _StlMsg_INVALID_ARGUMENT)
- _M_non_dbg_impl.max_load_factor(__z);
- }
-};
-
-_STLP_END_NAMESPACE
-
-#undef _STLP_NON_DBG_HT
-
-#endif /* _STLP_INTERNAL_HASHTABLE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/debug/_iterator.h b/stl/debug/_iterator.h
deleted file mode 100644
index 2faaa9f..0000000
--- a/stl/debug/_iterator.h
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_DBG_ITERATOR_H
-#define _STLP_DBG_ITERATOR_H
-
-#ifndef _STLP_INTERNAL_PAIR_H
-# include <stl/_pair.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-# include <stl/_alloc.h>
-#endif
-
-#define _STLP_DBG_ALLOCATOR_SELECT( _Tp ) _STLP_DEFAULT_ALLOCATOR_SELECT( _Tp )
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-//============================================================
-
-template <class _Iterator>
-void _Decrement(_Iterator& __it, const bidirectional_iterator_tag &)
-{ --__it; }
-
-template <class _Iterator>
-void _Decrement(_Iterator& __it, const random_access_iterator_tag &)
-{ --__it; }
-
-template <class _Iterator>
-void _Decrement(_Iterator& __it, const forward_iterator_tag &)
-{ _STLP_ASSERT(0) }
-
-template <class _Iterator>
-void _Advance(_Iterator&, ptrdiff_t, const forward_iterator_tag &)
-{ _STLP_ASSERT(0) }
-
-template <class _Iterator>
-void _Advance(_Iterator& __it, ptrdiff_t, const bidirectional_iterator_tag &)
-{ _STLP_ASSERT(0) }
-
-template <class _Iterator>
-void _Advance(_Iterator& __it, ptrdiff_t __n, const random_access_iterator_tag &)
-{ __it += __n; }
-
-template <class _Iterator>
-ptrdiff_t _DBG_distance(const _Iterator& __x, const _Iterator& __y, const random_access_iterator_tag &)
-{ return __x - __y; }
-
-template <class _Iterator>
-ptrdiff_t _DBG_distance(const _Iterator&, const _Iterator&, const forward_iterator_tag &) {
- _STLP_ASSERT(0)
- return 0;
-}
-
-template <class _Iterator>
-ptrdiff_t _DBG_distance(const _Iterator&, const _Iterator&, const bidirectional_iterator_tag &) {
- _STLP_ASSERT(0)
- return 0;
-}
-
-template <class _Iterator>
-bool _CompareIt(const _Iterator&, const _Iterator&, const forward_iterator_tag &) {
- _STLP_ASSERT(0)
- return false;
-}
-
-template <class _Iterator>
-bool _CompareIt(const _Iterator&, const _Iterator&, const bidirectional_iterator_tag &) {
- _STLP_ASSERT(0)
- return false;
-}
-
-template <class _Iterator>
-bool _CompareIt(const _Iterator& __x, const _Iterator& __y, const random_access_iterator_tag &)
-{ return __x < __y; }
-
-template <class _Iterator>
-bool _Dereferenceable(const _Iterator& __it)
-{ return (__it._Get_container_ptr() != 0) && !(__it._M_iterator == (__it._Get_container_ptr())->end()); }
-
-template <class _Iterator>
-bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const forward_iterator_tag &)
-{ return (__n == 1) && _Dereferenceable(__it); }
-
-template <class _Iterator>
-bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const bidirectional_iterator_tag &) {
- typedef typename _Iterator::_Container_type __container_type;
- __container_type* __c = __it._Get_container_ptr();
- return (__c != 0) && ((__n == 1 && __it._M_iterator != __c->end() ) ||
- (__n == -1 && __it._M_iterator != __c->begin()));
-}
-
-template <class _Iterator>
-bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const random_access_iterator_tag &) {
- typedef typename _Iterator::_Container_type __container_type;
- __container_type* __c = __it._Get_container_ptr();
- if (__c == 0) return false;
- ptrdiff_t __new_pos = (__it._M_iterator - __c->begin()) + __n;
- return (__new_pos >= 0) && (__STATIC_CAST(typename __container_type::size_type, __new_pos) <= __c->size());
-}
-
-
-template <class _Container>
-struct _DBG_iter_base : public __owned_link {
-public:
- typedef typename _Container::value_type value_type;
- typedef typename _Container::reference reference;
- typedef typename _Container::pointer pointer;
- typedef ptrdiff_t difference_type;
- //private:
- typedef typename _Container::iterator _Nonconst_iterator;
- typedef typename _Container::const_iterator _Const_iterator;
- typedef _Container _Container_type;
-
-#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
- typedef typename iterator_traits<_Const_iterator>::iterator_category _Iterator_category;
-#else
- typedef typename _Container::_Iterator_category _Iterator_category;
-#endif
- typedef _Iterator_category iterator_category;
-
- _DBG_iter_base() : __owned_link(0) {}
- _DBG_iter_base(const __owned_list* __c, const _Const_iterator& __it) :
-#if defined(__HP_aCC) && (__HP_aCC < 60000)
- __owned_link(__c), _M_iterator(*__REINTERPRET_CAST(const _Nonconst_iterator *, &__it)) {}
-#else
- __owned_link(__c), _M_iterator(*(const _Nonconst_iterator*)&__it) {}
-#endif
- _Container* _Get_container_ptr() const {
- return (_Container*)__stl_debugger::_Get_container_ptr(this);
- }
-
- void __increment();
- void __decrement();
- void __advance(ptrdiff_t __n);
-
-// protected:
- _Nonconst_iterator _M_iterator;
-};
-
-template <class _Container>
-inline void _DBG_iter_base<_Container>::__increment() {
- _STLP_DEBUG_CHECK(_Incrementable(*this, 1, _Iterator_category()))
- ++_M_iterator;
-}
-
-template <class _Container>
-inline void _DBG_iter_base<_Container>::__decrement() {
- _STLP_DEBUG_CHECK(_Incrementable(*this, -1, _Iterator_category()))
- _Decrement(_M_iterator, _Iterator_category());
-}
-
-template <class _Container>
-inline void _DBG_iter_base<_Container>::__advance(ptrdiff_t __n) {
- _STLP_DEBUG_CHECK(_Incrementable(*this, __n, _Iterator_category()))
- _Advance(_M_iterator, __n, _Iterator_category());
-}
-
-template <class _Container>
-ptrdiff_t operator-(const _DBG_iter_base<_Container>& __x,
- const _DBG_iter_base<_Container>& __y ) {
- typedef typename _DBG_iter_base<_Container>::_Iterator_category _Iterator_category;
- _STLP_DEBUG_CHECK(__check_same_owner(__x, __y))
- return _DBG_distance(__x._M_iterator,__y._M_iterator, _Iterator_category());
-}
-
-template <class _Container, class _Traits>
-struct _DBG_iter_mid : public _DBG_iter_base<_Container> {
- typedef _DBG_iter_mid<_Container, typename _Traits::_NonConstTraits> _Nonconst_self;
- typedef typename _Container::iterator _Nonconst_iterator;
- typedef typename _Container::const_iterator _Const_iterator;
-
- _DBG_iter_mid() {}
-
- explicit _DBG_iter_mid(const _Nonconst_self& __it) :
- _DBG_iter_base<_Container>(__it) {}
-
- _DBG_iter_mid(const __owned_list* __c, const _Const_iterator& __it) :
- _DBG_iter_base<_Container>(__c, __it) {}
-};
-
-template <class _Container, class _Traits>
-struct _DBG_iter : public _DBG_iter_mid<_Container, _Traits> {
- typedef _DBG_iter_base<_Container> _Base;
-public:
- typedef typename _Base::value_type value_type;
- typedef typename _Base::difference_type difference_type;
- typedef typename _Traits::reference reference;
- typedef typename _Traits::pointer pointer;
-
- typedef typename _Base::_Nonconst_iterator _Nonconst_iterator;
- typedef typename _Base::_Const_iterator _Const_iterator;
-
-private:
- typedef _DBG_iter<_Container, _Traits> _Self;
- typedef _DBG_iter_mid<_Container, typename _Traits::_NonConstTraits> _Nonconst_mid;
-
-public:
-
-#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
- typedef typename _Base::iterator_category iterator_category;
-#endif
- typedef typename _Base::_Iterator_category _Iterator_category;
-
-public:
- _DBG_iter() {}
- // boris : real type of iter would be nice
- _DBG_iter(const __owned_list* __c, const _Const_iterator& __it) :
- _DBG_iter_mid<_Container, _Traits>(__c, __it) {}
-
- // This allows conversions from iterator to const_iterator without being
- // redundant with the copy constructor below.
- _DBG_iter(const _Nonconst_mid& __rhs) :
- _DBG_iter_mid<_Container, _Traits>(__rhs) {}
-
- _DBG_iter(const _Self& __rhs) :
- _DBG_iter_mid<_Container, _Traits>(__rhs) {}
-
- // This allows conversions from iterator to const_iterator without being
- // redundant with the copy assignment operator below.
- _Self& operator=(const _Nonconst_mid& __rhs) {
- (_Base&)*this = __rhs;
- return *this;
- }
-
- _Self& operator=(const _Self& __rhs) {
- (_Base&)*this = __rhs;
- return *this;
- }
-
- reference operator*() const;
-
- _STLP_DEFINE_ARROW_OPERATOR
-
- _Self& operator++() {
- this->__increment();
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- this->__increment();
- return __tmp;
- }
- _Self& operator--() {
- this->__decrement();
- return *this;
- }
- _Self operator--(int) {
- _Self __tmp = *this;
- this->__decrement();
- return __tmp;
- }
-
- _Self& operator+=(difference_type __n) {
- this->__advance(__n);
- return *this;
- }
-
- _Self& operator-=(difference_type __n) {
- this->__advance(-__n);
- return *this;
- }
- _Self operator+(difference_type __n) const {
- _Self __tmp(*this);
- __tmp.__advance(__n);
- return __tmp;
- }
- _Self operator-(difference_type __n) const {
- _Self __tmp(*this);
- __tmp.__advance(-__n);
- return __tmp;
- }
- reference operator[](difference_type __n) const { return *(*this + __n); }
-};
-
-template <class _Container, class _Traits>
-inline
-#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
-_STLP_TYPENAME_ON_RETURN_TYPE _Traits::reference
-#else
-_STLP_TYPENAME_ON_RETURN_TYPE _DBG_iter<_Container, _Traits>::reference
-#endif
-_DBG_iter<_Container, _Traits>::operator*() const {
- _STLP_DEBUG_CHECK(_Dereferenceable(*this))
- _STLP_DEBUG_CHECK(_Traits::_Check(*this))
- return *this->_M_iterator;
-}
-
-template <class _Container>
-inline bool
-operator==(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) {
- _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
- return __x._M_iterator == __y._M_iterator;
-}
-
-template <class _Container>
-inline bool
-operator<(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) {
- _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
- typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
- return _CompareIt(__x._M_iterator , __y._M_iterator, _Category());
-}
-
-template <class _Container>
-inline bool
-operator>(const _DBG_iter_base<_Container>& __x,
- const _DBG_iter_base<_Container>& __y) {
- typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
- return _CompareIt(__y._M_iterator , __x._M_iterator, _Category());
-}
-
-template <class _Container>
-inline bool
-operator>=(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) {
- _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
- typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
- return !_CompareIt(__x._M_iterator , __y._M_iterator, _Category());
-}
-
-template <class _Container>
-inline bool
-operator<=(const _DBG_iter_base<_Container>& __x,
- const _DBG_iter_base<_Container>& __y) {
- typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
- return !_CompareIt(__y._M_iterator , __x._M_iterator, _Category());
-}
-
-template <class _Container>
-inline bool
-operator!=(const _DBG_iter_base<_Container>& __x,
- const _DBG_iter_base<_Container>& __y) {
- _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
- return __x._M_iterator != __y._M_iterator;
-}
-
-//------------------------------------------
-
-template <class _Container, class _Traits>
-inline _DBG_iter<_Container, _Traits>
-operator+(ptrdiff_t __n, const _DBG_iter<_Container, _Traits>& __it) {
- _DBG_iter<_Container, _Traits> __tmp(__it);
- return __tmp += __n;
-}
-
-
-template <class _Iterator>
-inline _Iterator _Non_Dbg_iter(_Iterator __it)
-{ return __it; }
-
-#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
-template <class _Container, class _Traits>
-inline typename _DBG_iter<_Container, _Traits>::_Nonconst_iterator
-_Non_Dbg_iter(_DBG_iter<_Container, _Traits> __it)
-{ return __it._M_iterator; }
-#endif
-
-/*
- * Helper classes to check iterator range or pointer validity
- * at construction time.
- */
-template <class _Container>
-class __construct_checker {
- typedef typename _Container::value_type value_type;
-protected:
- __construct_checker() {}
-
- __construct_checker(const value_type* __p) {
- _STLP_VERBOSE_ASSERT((__p != 0), _StlMsg_INVALID_ARGUMENT)
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIter>
- __construct_checker(const _InputIter& __f, const _InputIter& __l) {
- typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
- _M_check_dispatch(__f, __l, _Integral());
- }
-
- template <class _Integer>
- void _M_check_dispatch(_Integer , _Integer, const __true_type& /*IsIntegral*/) {}
-
- template <class _InputIter>
- void _M_check_dispatch(const _InputIter& __f, const _InputIter& __l, const __false_type& /*IsIntegral*/) {
- _STLP_DEBUG_CHECK(__check_range(__f,__l))
- }
-#endif
-
-#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
- __construct_checker(const value_type* __f, const value_type* __l) {
- _STLP_DEBUG_CHECK(__check_ptr_range(__f,__l))
- }
-
- typedef _DBG_iter_base<_Container> _IteType;
- __construct_checker(const _IteType& __f, const _IteType& __l) {
- _STLP_DEBUG_CHECK(__check_range(__f,__l))
- }
-#endif
-};
-
-#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
-# if defined (_STLP_NESTED_TYPE_PARAM_BUG) ||\
- (defined (__SUNPRO_CC) && __SUNPRO_CC < 0x600) ||\
- (defined (_STLP_MSVC) && (_STLP_MSVC < 1100))
-# define _STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS 1
-# endif
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _Container>
-inline ptrdiff_t*
-distance_type(const _STLP_PRIV _DBG_iter_base<_Container>&) { return (ptrdiff_t*) 0; }
-
-# if !defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
-template <class _Container>
-inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _DBG_iter_base<_Container>::value_type*
-value_type(const _STLP_PRIV _DBG_iter_base<_Container>&) {
- typedef typename _STLP_PRIV _DBG_iter_base<_Container>::value_type _Val;
- return (_Val*)0;
-}
-
-template <class _Container>
-inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _DBG_iter_base<_Container>::_Iterator_category
-iterator_category(const _STLP_PRIV _DBG_iter_base<_Container>&) {
- typedef typename _STLP_PRIV _DBG_iter_base<_Container>::_Iterator_category _Category;
- return _Category();
-}
-# endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#endif /* INTERNAL_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/debug/_list.h b/stl/debug/_list.h
deleted file mode 100644
index 322ec1c..0000000
--- a/stl/debug/_list.h
+++ /dev/null
@@ -1,502 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_DBG_LIST_H
-#define _STLP_INTERNAL_DBG_LIST_H
-
-#ifndef _STLP_INTERNAL_ALGO_H
-# include <stl/_algo.h>
-#endif
-
-#ifndef _STLP_DBG_ITERATOR_H
-# include <stl/debug/_iterator.h>
-#endif
-
-#define _STLP_NON_DBG_LIST _STLP_PRIV _STLP_NON_DBG_NAME(list) <_Tp, _Alloc>
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
-template <class _Tp, class _Alloc>
-inline _Tp*
-value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&)
-{ return (_Tp*)0; }
-template <class _Tp, class _Alloc>
-inline bidirectional_iterator_tag
-iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&)
-{ return bidirectional_iterator_tag(); }
-#endif
-
-template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
-class list :
-#if !defined (__DMC__)
- private
-#endif
- _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST >
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- , public __stlport_class<list<_Tp, _Alloc> >
-#endif
-{
- typedef _STLP_NON_DBG_LIST _Base;
- typedef list<_Tp, _Alloc> _Self;
- typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST > _ConstructCheck;
-
-public:
- __IMPORT_CONTAINER_TYPEDEFS(_Base)
-
-public:
- typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
- typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > > const_iterator;
-
- _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
-
-private:
- _Base _M_non_dbg_impl;
- _STLP_PRIV __owned_list _M_iter_list;
-
- void _Invalidate_iterator(const iterator& __it)
- { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
- void _Invalidate_iterators(const iterator& __first, const iterator& __last)
- { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
-
- typedef typename _Base::iterator _Base_iterator;
-
-public:
- explicit list(const allocator_type& __a = allocator_type()) :
- _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit list(size_type __n, const _Tp& __x = _Tp(),
-#else
- list(size_type __n, const _Tp& __x,
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
- const allocator_type& __a = allocator_type())
- : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit list(size_type __n)
- : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- list(__move_source<_Self> src)
- : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
- _M_iter_list(&_M_non_dbg_impl) {
-#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
- src.get()._M_iter_list._Invalidate_all();
-#else
- src.get()._M_iter_list._Set_owner(_M_iter_list);
-#endif
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- // We don't need any dispatching tricks here, because insert does all of
- // that anyway.
- template <class _InputIterator>
- list(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- list(_InputIterator __first, _InputIterator __last)
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
- _M_iter_list(&_M_non_dbg_impl) {}
-# endif
-#else
-
- list(const value_type* __first, const value_type* __last,
- const allocator_type& __a = allocator_type())
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(__first, __last, __a),
- _M_iter_list(&_M_non_dbg_impl) {}
- list(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type())
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-
-#endif
-
- list(const _Self& __x) :
- _ConstructCheck(__x),
- _M_non_dbg_impl(__x._M_non_dbg_impl) , _M_iter_list(&_M_non_dbg_impl) {}
-
- _Self& operator=(const _Self& __x) {
- if (this != &__x) {
- //Should not invalidate end iterator
- _Invalidate_iterators(begin(), end());
- _M_non_dbg_impl = __x._M_non_dbg_impl;
- }
- return *this;
- }
-
- allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
-
- iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
- const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
-
- iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
- const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
-
- const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
- const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
-
- size_type size() const { return _M_non_dbg_impl.size(); }
- size_type max_size() const { return _M_non_dbg_impl.max_size(); }
- bool empty() const { return _M_non_dbg_impl.empty(); }
-
- // those are here to enforce checking
- reference front() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return *begin();
- }
- const_reference front() const {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return *begin();
- }
- reference back() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return *(--end());
- }
- const_reference back() const {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return *(--end());
- }
-
- void swap(_Self& __x) {
- _M_iter_list._Swap_owners(__x._M_iter_list);
- _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
- }
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos, const _Tp& __x = _Tp()) {
-#else
- iterator insert(iterator __pos, const _Tp& __x) {
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- return iterator(&_M_iter_list,_M_non_dbg_impl.insert(__pos._M_iterator, __x) );
- }
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
-# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
- typedef typename _AreSameUnCVTypes<_InputIterator, iterator>::_Ret _IsListIterator;
- typedef typename _AreSameUnCVTypes<_InputIterator, const_iterator>::_Ret _IsListConstIterator;
- typedef typename _Lor2<_IsListIterator, _IsListConstIterator>::_Ret _DoCheck;
-# endif
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first, _DoCheck()))
- _M_non_dbg_impl.insert(__pos._M_iterator,
- _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- }
-#else
- void insert(iterator __pos, const _Tp* __first, const _Tp* __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
- _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
- }
-
- void insert(iterator __pos,
- const_iterator __first, const_iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first, _DoCheck()))
- _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
- }
-#endif
-
- void insert(iterator __pos, size_type __n, const _Tp& __x) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
- }
-
- void push_back(const_reference __x) { _M_non_dbg_impl.push_back(__x); }
- void pop_back() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- _Invalidate_iterator(end());
- _M_non_dbg_impl.pop_back();
- }
-
- void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); }
- void pop_front() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- _Invalidate_iterator(begin());
- _M_non_dbg_impl.pop_front();
- }
-
- iterator erase(iterator __pos) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- _Invalidate_iterator(__pos);
- return iterator(&_M_iter_list,_M_non_dbg_impl.erase(__pos._M_iterator));
- }
- iterator erase(iterator __first, iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
- _Invalidate_iterators(__first, __last);
- return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
- }
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size, const _Tp& __x = _Tp()) {
-#else
- void resize(size_type __new_size, const _Tp& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- _Base_iterator __i = _M_non_dbg_impl.begin();
- size_type __len = 0;
- for ( ; __i != _M_non_dbg_impl.end() && __len < __new_size; ++__i, ++__len);
-
- if (__len == __new_size)
- erase(iterator(&_M_iter_list, __i), end());
- else // __i == end()
- _M_non_dbg_impl.insert(_M_non_dbg_impl.end(), __new_size - __len, __x);
- }
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-private:
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val,
- const __true_type& /*_IsIntegral*/) {
- _M_check_assign(__n);
- _M_non_dbg_impl.assign(__n, __val);
- }
-
- template <class _InputIter>
- void _M_assign_dispatch(_InputIter __first, _InputIter __last,
- const __false_type& /*_IsIntegral*/) {
- size_type __len = distance(__first, __last);
- _M_check_assign(__len);
- _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- }
-
-public:
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-#else
- void assign(const _Tp* __first, const _Tp* __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
- _M_non_dbg_impl.assign(__first, __last);
- }
-
- void assign(const_iterator __first, const_iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
- }
-#endif
-
-private:
- void _M_check_assign(size_type __n) {
- size_type __size = size();
- if (__n < __size) {
- iterator __it = begin();
- advance(__it, __n + 1);
- _Invalidate_iterators(__it, end());
- }
- }
-
-public:
- void assign(size_type __n, const _Tp& __val) {
- _M_check_assign(__n);
- _M_non_dbg_impl.assign(__n, __val);
- }
-
- void remove(const _Tp& __x) {
- _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
- while (__first != __last) {
- _Base_iterator __next = __first;
- ++__next;
- if (__x == *__first) {
- _Invalidate_iterator(iterator(&_M_iter_list, __first));
- _M_non_dbg_impl.erase(__first);
- }
- __first = __next;
- }
- }
-
- void clear() {
- _Invalidate_iterators(begin(), end());
- _M_non_dbg_impl.clear();
- }
-
-public:
- void splice(iterator __pos, _Self& __x) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl);
-#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
- if (get_allocator() == __x.get_allocator())
- __x._M_iter_list._Set_owner(_M_iter_list);
- else
-#endif
- // Std: 23.2.2.4:4
- // end iterator is not invalidated:
- __x._Invalidate_iterators(__x.begin(), __x.end());
- }
-
- void splice(iterator __pos, _Self& __x, iterator __i) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&(__x._M_iter_list),__i))
- _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator);
-#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
- if (get_allocator() == __x.get_allocator())
- _STLP_PRIV __change_ite_owner(__i, &_M_iter_list);
- else
-#endif
- // Std: 23.2.2.4:7
- __x._Invalidate_iterator(__i);
- }
-
- void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end()))
- _STLP_DEBUG_CHECK(this == &__x ? !_STLP_PRIV __check_range(__pos, __first, __last) : true)
-#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
- if (this->get_allocator() == __x.get_allocator())
- _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
- else
-#endif
- // Std: 23.2.2.4:12
- __x._Invalidate_iterators(__first, __last);
- _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __first._M_iterator, __last._M_iterator);
- }
-
- void merge(_Self& __x) {
-#if !defined (_STLP_NO_EXTENSIONS)
- _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(begin()._M_iterator, end()._M_iterator))
- _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator))
-#endif
- _M_non_dbg_impl.merge(__x._M_non_dbg_impl);
- if (this->get_allocator() == __x.get_allocator()) {
- __x._M_iter_list._Set_owner(_M_iter_list);
- }
- else {
- __x._Invalidate_iterators(__x.begin(), __x.end());
- }
- }
- void reverse() {
- _M_non_dbg_impl.reverse();
- }
- void unique() {
- _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
- if (__first == __last) return;
- _Base_iterator __next = __first;
- while (++__next != __last) {
- if (*__first == *__next) {
- _Invalidate_iterator(iterator(&_M_iter_list, __next));
- _M_non_dbg_impl.erase(__next);
- }
- else
- __first = __next;
- __next = __first;
- }
- }
- void sort() {
- _M_non_dbg_impl.sort();
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _Predicate>
- void remove_if(_Predicate __pred) {
- _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
- while (__first != __last) {
- _Base_iterator __next = __first;
- ++__next;
- if (__pred(*__first)) {
- _Invalidate_iterator(iterator(&_M_iter_list, __first));
- _M_non_dbg_impl.erase(__first);
- }
- __first = __next;
- }
- }
-
- template <class _BinaryPredicate>
- void unique(_BinaryPredicate __binary_pred) {
- _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
- if (__first == __last) return;
- _Base_iterator __next = __first;
- while (++__next != __last) {
- if (__binary_pred(*__first, *__next)) {
- _Invalidate_iterator(iterator(&_M_iter_list, __next));
- _M_non_dbg_impl.erase(__next);
- }
- else
- __first = __next;
- __next = __first;
- }
- }
-
- template <class _StrictWeakOrdering>
- void merge(_Self& __x, _StrictWeakOrdering __comp) {
-#if !defined (_STLP_NO_EXTENSIONS)
- _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __comp))
- _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __comp))
-#endif
- _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __comp);
- if (this->get_allocator() == __x.get_allocator()) {
- __x._M_iter_list._Set_owner(_M_iter_list);
- }
- else {
- __x._Invalidate_iterators(__x.begin(), __x.end());
- }
- }
-
- template <class _StrictWeakOrdering>
- void sort(_StrictWeakOrdering __comp) {
- _M_non_dbg_impl.sort(__comp);
- }
-#endif
-};
-
-
-_STLP_END_NAMESPACE
-
-#undef _STLP_NON_DBG_LIST
-
-#endif /* _STLP_INTERNAL_LIST_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/debug/_slist.h b/stl/debug/_slist.h
deleted file mode 100644
index ef57066..0000000
--- a/stl/debug/_slist.h
+++ /dev/null
@@ -1,612 +0,0 @@
-/*
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_DBG_SLIST_H
-#define _STLP_INTERNAL_DBG_SLIST_H
-
-#ifndef _STLP_DBG_ITERATOR_H
-# include <stl/debug/_iterator.h>
-#endif
-
-#define _STLP_NON_DBG_SLIST _STLP_PRIV _STLP_NON_DBG_NAME(slist) <_Tp, _Alloc>
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
-template <class _Tp, class _Alloc>
-inline _Tp*
-value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
-{ return (_Tp*)0; }
-
-template <class _Tp, class _Alloc>
-inline forward_iterator_tag
-iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
-{ return forward_iterator_tag(); }
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-/*
- * slist special debug traits version.
- */
-template <class _Traits>
-struct _SlistDbgTraits : _Traits {
- typedef _SlistDbgTraits<typename _Traits::_ConstTraits> _ConstTraits;
- typedef _SlistDbgTraits<typename _Traits::_NonConstTraits> _NonConstTraits;
-
- /*
- * We don't want the before_begin iterator to return false at _Dereferenceable
- * call to do not break the current debug framework but calling * operator should
- * fail.
- */
- template <class _Iterator>
- static bool _Check(const _Iterator& __it)
- { return !(__it._M_iterator == (__it._Get_container_ptr())->before_begin()); }
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
-class slist :
-#if !defined (__DMC__)
- private
-#endif
- _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST >
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- , public __stlport_class<slist<_Tp, _Alloc> >
-#endif
-{
-private:
- typedef _STLP_NON_DBG_SLIST _Base;
- typedef slist<_Tp,_Alloc> _Self;
- typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST > _ConstructCheck;
-
-public:
-
- __IMPORT_CONTAINER_TYPEDEFS(_Base)
-
- typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Nonconst_traits<value_type> > > iterator;
- typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Const_traits<value_type> > > const_iterator;
-
- allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
-private:
- _Base _M_non_dbg_impl;
- _STLP_PRIV __owned_list _M_iter_list;
-
- void _Invalidate_iterator(const iterator& __it)
- { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
- void _Invalidate_iterators(const iterator& __first, const iterator& __last)
- { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
-
- typedef typename _Base::iterator _Base_iterator;
-
-public:
- explicit slist(const allocator_type& __a = allocator_type())
- : _M_non_dbg_impl(__a) , _M_iter_list(&_M_non_dbg_impl) {}
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit slist(size_type __n, const value_type& __x = _Tp(),
-#else
- slist(size_type __n, const value_type& __x,
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- const allocator_type& __a = allocator_type())
- : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit slist(size_type __n) : _M_non_dbg_impl(__n) , _M_iter_list(&_M_non_dbg_impl) {}
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- slist(__move_source<_Self> src)
- : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
- _M_iter_list(&_M_non_dbg_impl) {
-#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
- src.get()._M_iter_list._Invalidate_all();
-#else
- src.get()._M_iter_list._Set_owner(_M_iter_list);
-#endif
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- // We don't need any dispatching tricks here, because _M_insert_after_range
- // already does them.
- template <class _InputIterator>
- slist(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- slist(_InputIterator __first, _InputIterator __last)
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
- _M_iter_list(&_M_non_dbg_impl) {}
-# endif
-#else
-
- slist(const value_type* __first, const value_type* __last,
- const allocator_type& __a = allocator_type())
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(__first, __last, __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-
- slist(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type() )
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-#endif
-
- slist(const _Self& __x) :
- _ConstructCheck(__x),
- _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
-
- _Self& operator= (const _Self& __x) {
- if (this != &__x) {
- _Invalidate_iterators(begin(), end());
- _M_non_dbg_impl = __x._M_non_dbg_impl;
- }
- return *this;
- }
-
- ~slist() {}
-
- void assign(size_type __n, const value_type& __val) {
- _Invalidate_iterators(begin(), end());
- _M_non_dbg_impl.assign(__n, __val);
- }
-
- iterator before_begin()
- { return iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
- const_iterator before_begin() const
- { return const_iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
-
- iterator begin()
- { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
- const_iterator begin() const
- { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin());}
-
- iterator end()
- { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
- const_iterator end() const
- { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
-
- bool empty() const { return _M_non_dbg_impl.empty(); }
- size_type size() const { return _M_non_dbg_impl.size(); }
- size_type max_size() const { return _M_non_dbg_impl.max_size(); }
-
- void swap(_Self& __x) {
- _M_iter_list._Swap_owners(__x._M_iter_list);
- _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
- }
-
- reference front() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return _M_non_dbg_impl.front();
- }
- const_reference front() const {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return _M_non_dbg_impl.front();
- }
- void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); }
- void pop_front() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- _M_non_dbg_impl.pop_front();
- }
- iterator previous(const_iterator __pos) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
- return iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
- }
- const_iterator previous(const_iterator __pos) const {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
- return const_iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
- }
-
-public:
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert_after(iterator __pos, const value_type& __x = _Tp()) {
-#else
- iterator insert_after(iterator __pos, const value_type& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- return iterator(&_M_iter_list,_M_non_dbg_impl.insert_after(__pos._M_iterator, __x));
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert_after(iterator __pos) {
- return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
- }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- void insert_after(iterator __pos, size_type __n, const value_type& __x) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _M_non_dbg_impl.insert_after(__pos._M_iterator, __n, __x);
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _Invalidate_iterators(begin(), end());
- _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- }
-#else
- void assign(const_iterator __first, const_iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _Invalidate_iterators(begin(), end());
- _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
- }
- void assign(const value_type *__first, const value_type *__last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
- _Invalidate_iterators(begin(), end());
- _M_non_dbg_impl.assign(__first, __last);
- }
-#endif
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InIter>
- void insert_after(iterator __pos, _InIter __first, _InIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _M_non_dbg_impl.insert_after(__pos._M_iterator,
- _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- }
-
- template <class _InIter>
- void insert(iterator __pos, _InIter __first, _InIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _M_non_dbg_impl.insert(__pos._M_iterator,
- _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- }
-#else
- void insert_after(iterator __pos,
- const_iterator __first, const_iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _M_non_dbg_impl.insert_after(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
- }
- void insert_after(iterator __pos,
- const value_type* __first, const value_type* __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
- _M_non_dbg_impl.insert_after(__pos._M_iterator, __first, __last);
- }
-
- void insert(iterator __pos, const_iterator __first, const_iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
- }
- void insert(iterator __pos, const value_type* __first,
- const value_type* __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
- _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
- }
-#endif
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert(iterator __pos, const value_type& __x = _Tp()) {
-#else
- iterator insert(iterator __pos, const value_type& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
- return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert(iterator __pos) {
- return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
- }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- void insert(iterator __pos, size_type __n, const value_type& __x) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
- _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
- }
-
-public:
- iterator erase_after(iterator __pos) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- iterator __tmp = __pos; ++__tmp;
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp))
- _Invalidate_iterator(__tmp);
- return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__pos._M_iterator));
- }
- iterator erase_after(iterator __before_first, iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __last, begin(), end()))
- iterator __tmp = __before_first; ++__tmp;
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp))
- _Invalidate_iterators(__tmp, __last);
- return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__before_first._M_iterator, __last._M_iterator));
- }
-
- iterator erase(iterator __pos) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_VERBOSE_ASSERT(__pos._M_iterator != _M_non_dbg_impl.before_begin(), _StlMsg_INVALID_ARGUMENT)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _Invalidate_iterator(__pos);
- return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
- }
- iterator erase(iterator __first, iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
- _Invalidate_iterators(__first, __last);
- return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
- }
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size, const value_type& __x = _Tp()) {
-#else
- void resize(size_type __new_size, const value_type& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- _M_non_dbg_impl.resize(__new_size, __x);
- }
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- void clear() {
- _Invalidate_iterators(begin(), end());
- _M_non_dbg_impl.clear();
- }
-
-public:
- // Removes all of the elements from the list __x to *this, inserting
- // them immediately after __pos. __x must not be *this. Complexity:
- // linear in __x.size().
- void splice_after(iterator __pos, _Self& __x) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
- _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl);
- if (get_allocator() == __x.get_allocator()) {
- __x._M_iter_list._Set_owner(_M_iter_list);
- }
- else {
- __x._Invalidate_iterators(__x.begin(), __x.end());
- }
- }
-
- // Moves the element that follows __prev to *this, inserting it immediately
- // after __pos. This is constant time.
- void splice_after(iterator __pos, _Self& __x, iterator __prev) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__prev))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __prev))
- iterator __elem = __prev; ++__elem;
- _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl, __prev._M_iterator);
- if (get_allocator() == __x.get_allocator()) {
- _STLP_PRIV __change_ite_owner(__elem, &_M_iter_list);
- }
- else {
- __x._Invalidate_iterator(__elem);
- }
- }
-
- // Moves the range [__before_first + 1, __before_last + 1) to *this,
- // inserting it immediately after __pos. This is constant time.
- void splice_after(iterator __pos, _Self& __x,
- iterator __before_first, iterator __before_last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __before_last))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __before_first))
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first))
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_last))
- iterator __first = __before_first; ++__first;
- iterator __last = __before_last; ++__last;
- if (get_allocator() == __x.get_allocator()) {
- _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
- }
- else {
- __x._Invalidate_iterators(__first, __last);
- }
- _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl,
- __before_first._M_iterator, __before_last._M_iterator);
- }
-
- // Linear in distance(begin(), __pos), and linear in __x.size().
- void splice(iterator __pos, _Self& __x) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
- _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
- _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl);
- if (get_allocator() == __x.get_allocator()) {
- __x._M_iter_list._Set_owner(_M_iter_list);
- }
- else {
- __x._Invalidate_iterators(__x.begin(), __x.end());
- }
- }
-
- // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i).
- void splice(iterator __pos, _Self& __x, iterator __i) {
- //__pos should be owned by *this and not be the before_begin iterator
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
- //__i should be dereferenceable, not before_begin and be owned by __x
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list ,__i))
- _STLP_VERBOSE_ASSERT(!(__i == __x.before_begin()), _StlMsg_INVALID_ARGUMENT)
- if (get_allocator() == __x.get_allocator()) {
- _STLP_PRIV __change_ite_owner(__i, &_M_iter_list);
- }
- else {
- __x._Invalidate_iterator(__i);
- }
- _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator);
- }
-
- // Linear in distance(begin(), __pos), in distance(__x.begin(), __first),
- // and in distance(__first, __last).
- void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
- //_STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end()))
- if (get_allocator() == __x.get_allocator()) {
- _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
- }
- else {
- __x._Invalidate_iterators(__first, __last);
- }
- _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl,
- __first._M_iterator, __last._M_iterator);
- }
-
- void reverse()
- { _M_non_dbg_impl.reverse(); }
-
- void remove(const value_type& __val) {
- _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
- while (__first != __last) {
- _Base_iterator __next = __first;
- ++__next;
- if (__val == *__first) {
- _Invalidate_iterator(iterator(&_M_iter_list, __first));
- _M_non_dbg_impl.erase(__first);
- }
- __first = __next;
- }
- }
- void unique() {
- _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
- if (__first == __last) return;
- _Base_iterator __next = __first;
- while (++__next != __last) {
- if (*__first == *__next) {
- _Invalidate_iterator(iterator(&_M_iter_list, __next));
- _M_non_dbg_impl.erase(__next);
- }
- else
- __first = __next;
- __next = __first;
- }
- }
- void merge(_Self& __x) {
- _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
-#if !defined (_STLP_NO_EXTENSIONS)
- /* comments below due to bug in GCC compilers: ones eat all memory and die if see
- * something like namespace_name::func_name() - ptr
- */
- _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end()))
- _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator))
-#endif
- _M_non_dbg_impl.merge(__x._M_non_dbg_impl);
- if (get_allocator() == __x.get_allocator()) {
- __x._M_iter_list._Set_owner(_M_iter_list);
- }
- else {
- __x._Invalidate_iterators(__x.begin(), __x.end());
- }
- }
- void sort() {
- _M_non_dbg_impl.sort();
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _Predicate>
- void remove_if(_Predicate __pred) {
- _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
- while (__first != __last) {
- _Base_iterator __next = __first;
- ++__next;
- if (__pred(*__first)) {
- _Invalidate_iterator(iterator(&_M_iter_list, __first));
- _M_non_dbg_impl.erase(__first);
- }
- __first = __next;
- }
- }
-
- template <class _BinaryPredicate>
- void unique(_BinaryPredicate __pred) {
- _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
- if (__first == __last) return;
- _Base_iterator __next = __first;
- while (++__next != __last) {
- if (__binary_pred(*__first, *__next)) {
- _Invalidate_iterator(iterator(&_M_iter_list, __next));
- _M_non_dbg_impl.erase(__next);
- }
- else
- __first = __next;
- __next = __first;
- }
- }
-
- template <class _StrictWeakOrdering>
- void merge(_Self& __x, _StrictWeakOrdering __ord) {
- _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
-#if !defined (_STLP_NO_EXTENSIONS)
- /* comments below due to bug in GCC compilers: ones eat all memory and die if see
- * something like namespace_name::func_name() - ptr
- */
- _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __ord))
- _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __ord))
-#endif
- _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __ord);
- if (get_allocator() == __x.get_allocator()) {
- __x._M_iter_list._Set_owner(_M_iter_list);
- }
- else {
- __x._Invalidate_iterators(__x.begin(), __x.end());
- }
- }
-
- template <class _StrictWeakOrdering>
- void sort(_StrictWeakOrdering __comp)
- { _M_non_dbg_impl.sort(__comp); }
-#endif
-};
-
-_STLP_END_NAMESPACE
-
-#undef _STLP_NON_DBG_SLIST
-
-#endif /* _STLP_INTERNAL_DBG_SLIST_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/debug/_string.h b/stl/debug/_string.h
deleted file mode 100644
index 62adc63..0000000
--- a/stl/debug/_string.h
+++ /dev/null
@@ -1,866 +0,0 @@
-/*
- * Copyright (c) 1997-1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-#ifndef _STLP_DBG_STRING_H
-#define _STLP_DBG_STRING_H
-
-#ifndef _STLP_DBG_ITERATOR_H
-# include <stl/debug/_iterator.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#define _STLP_NON_DBG_STRING_NAME _STLP_NON_DBG_NAME(str)
-#define _STLP_NON_DBG_STRING _STLP_PRIV _STLP_NON_DBG_STRING_NAME <_CharT, _Traits, _Alloc>
-
-#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
-template <class _CharT,class _Traits, class _Alloc>
-inline _CharT*
-value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&)
-{ return (_CharT*)0; }
-template <class _CharT, class _Traits, class _Alloc>
-inline random_access_iterator_tag
-iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&)
-{ return random_access_iterator_tag(); }
-#endif
-
-template <class _CharT, class _Traits, class _Alloc>
-class basic_string :
-#if !defined (__DMC__)
- private
-#else
- public
-#endif
- _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING >
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string)
- , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
-#endif
-{
-protected:
- typedef _STLP_NON_DBG_STRING _Base;
- typedef basic_string<_CharT, _Traits, _Alloc> _Self;
- typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING > _ConstructCheck;
- typedef typename _IsPOD<_CharT>::_Type _Char_Is_POD;
-
-public:
- __IMPORT_CONTAINER_TYPEDEFS(_Base)
- typedef typename _Base::traits_type traits_type;
- typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
- typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > > const_iterator;
- _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
-
-public: // Constructor, destructor, assignment.
- typedef typename _Base::_Reserve_t _Reserve_t;
-
-private:
- _Base _M_non_dbg_impl;
- _STLP_PRIV __owned_list _M_iter_list;
-
- void _Invalidate_all()
- { _M_iter_list._Invalidate_all(); }
- void _Compare_Capacity (size_type __old_capacity) {
- if (this->capacity() > __old_capacity) {
- _Invalidate_all();
- }
- }
- void _Invalidate_iterator(const iterator& __it)
- { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
- void _Invalidate_iterators(const iterator& __f, const iterator& __l)
- { _STLP_PRIV __invalidate_range(&_M_iter_list, __f, __l); }
-
-public:
-#include <stl/_string_npos.h>
-
- allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
-
- explicit basic_string(const allocator_type& __a = allocator_type())
- : _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
-
- basic_string(_Reserve_t __r, size_t __n,
- const allocator_type& __a = allocator_type())
- : _M_non_dbg_impl(__r, __n, __a), _M_iter_list(&_M_non_dbg_impl) {}
-
- basic_string(const _Self& __s)
- : _ConstructCheck(__s),
- _M_non_dbg_impl(__s._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
-
- basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
- const allocator_type& __a = allocator_type())
- : _M_non_dbg_impl(__s._M_non_dbg_impl, __pos, __n, __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-
- basic_string(const _CharT* __s, size_type __n,
- const allocator_type& __a = allocator_type())
- : _ConstructCheck(__s), _M_non_dbg_impl(__s, __n, __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-
- basic_string(const _CharT* __s,
- const allocator_type& __a = allocator_type())
- : _ConstructCheck(__s),
- _M_non_dbg_impl(__s, __a), _M_iter_list(&_M_non_dbg_impl) {}
-
- basic_string(size_type __n, _CharT __c,
- const allocator_type& __a = allocator_type())
- : _M_non_dbg_impl(__n, __c, __a), _M_iter_list(&_M_non_dbg_impl) {}
-
- basic_string(__move_source<_Self> src)
- : _M_non_dbg_impl(__move_source<_Base >(src.get()._M_non_dbg_impl)),
- _M_iter_list(&_M_non_dbg_impl) {
-#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
- src.get()._M_iter_list._Invalidate_all();
-#else
- src.get()._M_iter_list._Set_owner(_M_iter_list);
-#endif
- }
-
-#if !defined (_STLP_MEMBER_TEMPLATES) || defined(__MRC__) || defined(__SC__)
- basic_string(const _CharT* __f, const _CharT* __l,
- const allocator_type& __a = allocator_type())
- : _ConstructCheck(__f, __l),
- _M_non_dbg_impl(__f, __l, __a), _M_iter_list(&_M_non_dbg_impl) {
- }
- basic_string(const_iterator __f, const_iterator __l,
- const allocator_type & __a = allocator_type())
- : _ConstructCheck(__f, __l),
- _M_non_dbg_impl(__f._M_iterator, __l._M_iterator, __a), _M_iter_list(&_M_non_dbg_impl) {
- }
-#else
- template <class _InputIterator>
- basic_string(_InputIterator __f, _InputIterator __l,
- const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
- : _ConstructCheck(__f, __l),
- _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l), __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- basic_string(_InputIterator __f, _InputIterator __l)
- : _ConstructCheck(__f, __l),
- _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)),
- _M_iter_list(&_M_non_dbg_impl) {}
-# endif
-#endif
-
-private:
- // constructor from non-debug version for substr
- basic_string (const _Base& __x)
- : _M_non_dbg_impl(__x), _M_iter_list(&_M_non_dbg_impl) {}
-
-public:
- _Self& operator=(const _Self& __s) {
- if (this != &__s) {
- assign(__s);
- }
- return *this;
- }
-
- _Self& operator=(const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return assign(__s);
- }
-
- _Self& operator=(_CharT __c) {
- return assign(1, __c);
- }
-
- // Iterators.
- iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
- const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
- iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
- const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
-
- // Size, capacity, etc.
- size_type size() const { return _M_non_dbg_impl.size(); }
- size_type length() const { return _M_non_dbg_impl.length(); }
- size_t max_size() const { return _M_non_dbg_impl.max_size(); }
-
- void resize(size_type __n, _CharT __c) {
- if (__n > capacity())
- _Invalidate_all();
- else if (__n < size())
- _Invalidate_iterators(begin() + __n, end());
- _M_non_dbg_impl.resize(__n, __c);
- }
- void resize(size_type __n) { resize(__n, _STLP_DEFAULT_CONSTRUCTED(_CharT)); }
- size_type capacity() const { return _M_non_dbg_impl.capacity(); }
-
- void reserve(size_type __s = 0) {
- if (__s > capacity()) _Invalidate_all();
- _M_non_dbg_impl.reserve(__s);
- }
-
- void clear() {
- _Invalidate_all();
- _M_non_dbg_impl.clear();
- }
-
- bool empty() const { return _M_non_dbg_impl.empty(); }
-
- const_reference operator[](size_type __n) const {
- _STLP_VERBOSE_ASSERT(__n <= this->size(), _StlMsg_OUT_OF_BOUNDS);
- return _M_non_dbg_impl[__n];
- }
-
- reference operator[](size_type __n) {
- _STLP_VERBOSE_ASSERT(__n < this->size(), _StlMsg_OUT_OF_BOUNDS)
- return _M_non_dbg_impl[__n];
- }
-
- const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); }
- reference at(size_type __n) { return _M_non_dbg_impl.at(__n); }
-
- // Append, operator+=, push_back.
- _Self& operator+=(const _Self& __s) { return append(__s); }
- _Self& operator+=(const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return append(__s);
- }
- _Self& operator+=(_CharT __c) { return append(1, __c); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIter>
- _Self& append(_InputIter __first, _InputIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.append(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-#endif
-
-#if !defined (_STLP_MEMBER_TEMPLATES) || \
- !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
- _Self& append(const _CharT* __f, const _CharT* __l) {
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.append(__f, __l);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& append(const_iterator __f, const_iterator __l) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.append(__f._M_iterator, __l._M_iterator);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-#endif
-
- _Self& append(const _Self& __s) {
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.append(__s._M_non_dbg_impl);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& append(const _Self& __s, size_type __pos, size_type __n) {
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.append(__s._M_non_dbg_impl, __pos, __n);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& append(const _CharT* __s, size_type __n) {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.append(__s, __n);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& append(const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.append(__s);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& append(size_type __n, _CharT __c) {
- size_type __old_capacity = this->capacity();
- _M_non_dbg_impl.append(__n, __c);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- void push_back(_CharT __c) {
- size_type __old_capacity = this->capacity();
- _M_non_dbg_impl.push_back(__c);
- _Compare_Capacity(__old_capacity);
- }
-
- void pop_back() {
- _Invalidate_iterator(this->end());
- _M_non_dbg_impl.pop_back();
- }
-
- // Assign
-private:
- void _M_check_assign(size_type __n) {
- if (__n > capacity()) {
- _Invalidate_all();
- }
- else if (__n < size()) {
- _Invalidate_iterators(begin() + __n, end());
- }
- }
-
-public:
- _Self& assign(const _Self& __s) {
- _M_check_assign(__s.size());
- _M_non_dbg_impl.assign(__s._M_non_dbg_impl);
- return *this;
- }
-
- _Self& assign(const _Self& __s, size_type __pos, size_type __n) {
- if (__pos < __s.size()) {
- _M_check_assign((min) (__n, __s.size() - __pos));
- }
- _M_non_dbg_impl.assign(__s._M_non_dbg_impl, __pos, __n);
- return *this;
- }
-
- _Self& assign(const _CharT* __s, size_type __n) {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- _M_check_assign((min) (_Traits::length(__s), __n));
- _M_non_dbg_impl.assign(__s, __s + __n);
- return *this;
- }
-
- _Self& assign(const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- _M_check_assign(_Traits::length(__s));
- _M_non_dbg_impl.assign(__s);
- return *this;
- }
-
- _Self& assign(size_type __n, _CharT __c) {
- _M_check_assign(__n);
- _M_non_dbg_impl.assign(__n, __c);
- return *this;
- }
-
-#if defined(_STLP_MEMBER_TEMPLATES)
-private:
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) {
- _M_check_assign(__n);
- _M_non_dbg_impl.assign((size_type)__n, (_CharT)__x);
- }
-
- template <class _InputIter>
- void _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
- _M_check_assign(distance(__f, __l));
- _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
- }
-public:
- template <class _InputIter>
- inline _Self& assign(_InputIter __first, _InputIter __last) {
- _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- return *this;
- }
-#endif
-
-#if !defined (_STLP_MEMBER_TEMPLATES) || \
- !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
- _Self& assign(const _CharT* __f, const _CharT* __l) {
- _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
- _M_check_assign(distance(__f, __l));
- _M_non_dbg_impl.assign(__f, __l);
- return *this;
- }
- _Self& assign(const_iterator __f, const_iterator __l) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
- _M_check_assign(distance(__f, __l));
- _M_non_dbg_impl.assign(__f._M_iterator, __l._M_iterator);
- return *this;
- }
-#endif
-
- // Insert
- _Self& insert(size_type __pos, const _Self& __s) {
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& insert(size_type __pos, const _Self& __s,
- size_type __beg, size_type __n) {
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl, __beg, __n);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.insert(__pos, __s, __n);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& insert(size_type __pos, const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return insert(__pos, __s, _Traits::length(__s));
- }
-
- _Self& insert(size_type __pos, size_type __n, _CharT __c) {
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.insert(__pos, __n, __c);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- iterator insert(iterator __p, _CharT __c) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
- size_type __old_capacity = capacity();
- typename _Base::iterator __ret = _M_non_dbg_impl.insert(__p._M_iterator, __c);
- _Compare_Capacity(__old_capacity);
- return iterator(&_M_iter_list, __ret);
- }
-
- void insert(iterator __p, size_t __n, _CharT __c) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.insert(__p._M_iterator, __n, __c);
- _Compare_Capacity(__old_capacity);
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-private:
- template <class _RandomIter>
- void _M_insert_aux (iterator __p, _RandomIter __first, _RandomIter __last,
- const __true_type& /*_IsIterator*/)
- { _M_non_dbg_impl.insert(__p._M_iterator, __first._M_iterator, __last._M_iterator); }
-
- template<class _InputIter>
- void _M_insert_aux (iterator __p, _InputIter __first, _InputIter __last,
- const __false_type& /*_IsIterator*/) {
- _M_non_dbg_impl.insert(__p._M_iterator,
- _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- }
-
-public:
- template <class _InputIter>
- void insert(iterator __p, _InputIter __first, _InputIter __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
-
- /* In debug mode we are encapsulating non debug string iterators in debug one.
- * Doing so the non debug implementation will not check for self insertion
- * (x.insert(x.begin(), x.begin(), x.end()). To avoid this problem we try to
- * guess when _InputIter is iterator or const_iterator and in this case call
- * the non debug insert method with non debug string iterator.
- */
- typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsNonConstIterator;
- typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
- typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _IsIterator;
-
- size_type __old_capacity = this->capacity();
- _M_insert_aux(__p, __first, __last, _IsIterator());
- _Compare_Capacity(__old_capacity);
- }
-#endif
-
-#if !defined (_STLP_MEMBER_TEMPLATES) || \
- !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
- void insert(iterator __p, const_iterator __f, const_iterator __l) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f,__l))
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.insert(__p._M_iterator, __f._M_iterator, __l._M_iterator);
- _Compare_Capacity(__old_capacity);
- }
- void insert(iterator __p, const _CharT* __f, const _CharT* __l) {
- _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f,__l))
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.insert(__p._M_iterator, __f, __l);
- _Compare_Capacity(__old_capacity);
- }
-#endif
-
- // Erase.
- _Self& erase(size_type __pos = 0, size_type __n = npos) {
- if (__pos < size()) {
- _Invalidate_iterators(begin() + __pos, end());
- }
- _M_non_dbg_impl.erase(__pos, __n);
- return *this;
- }
- iterator erase(iterator __pos) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
- _Invalidate_iterators(__pos, end());
- return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
- }
- iterator erase(iterator __f, iterator __l) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
- _Invalidate_iterators(__f, end());
- return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__f._M_iterator, __l._M_iterator));
- }
-
- // Substring.
- _Self substr(size_type __pos = 0, size_type __n = npos) const
- { return _M_non_dbg_impl.substr(__pos, __n); }
-
- // Replace. (Conceptually equivalent to erase followed by insert.)
- _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.replace(__pos, __n, __s._M_non_dbg_impl);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
- size_type __pos2, size_type __n2) {
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.replace(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.replace(__pos, __n1, __s, __n2);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.replace(__pos, __n1, __s);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) {
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.replace(__pos, __n1, __n2, __c);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& replace(iterator __f, iterator __l, const _Self& __s) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s._M_non_dbg_impl);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& replace(iterator __f, iterator __l, const _CharT* __s, size_type __n) {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s, __n);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& replace(iterator __f, iterator __l, const _CharT* __s) {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& replace(iterator __f, iterator __l, size_type __n, _CharT __c) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __n, __c);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-private:
- template <class _RandomIter>
- void _M_replace_aux(iterator __first, iterator __last,
- _RandomIter __f, _RandomIter __l, __true_type const& /*_IsIterator*/)
- { _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, __f._M_iterator, __l._M_iterator); }
-
- template <class _InputIter>
- void _M_replace_aux(iterator __first, iterator __last,
- _InputIter __f, _InputIter __l, __false_type const& /*_IsIterator*/) {
- _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
- _STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
- }
-
-public:
- template <class _InputIter>
- _Self& replace(iterator __first, iterator __last,
- _InputIter __f, _InputIter __l) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
-
- /* See insert comment for reson of iterator detection.
- */
- typedef typename _AreSameUnCVTypes<_InputIter, iterator>::_Ret _IsNonConstIterator;
- typedef typename _AreSameUnCVTypes<_InputIter, const_iterator>::_Ret _IsConstIterator;
- typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _IsIterator;
-
- size_type __old_capacity = capacity();
- _M_replace_aux(__first, __last, __f, __l, _IsIterator());
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-#endif
-
-#if !defined (_STLP_MEMBER_TEMPLATES) || \
- !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
- _Self& replace(iterator __first, iterator __last,
- const_iterator __f, const_iterator __l) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
- __f._M_iterator, __l._M_iterator);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-
- _Self& replace(iterator __first, iterator __last,
- const _CharT* __f, const _CharT* __l) {
- _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, __f, __l);
- _Compare_Capacity(__old_capacity);
- return *this;
- }
-#endif
-
- // Other modifier member functions.
- void swap(_Self& __s) {
- _M_iter_list._Swap_owners(__s._M_iter_list);
- _M_non_dbg_impl.swap(__s._M_non_dbg_impl);
- }
-
- int compare(const _Self& __s) const
- { return _M_non_dbg_impl.compare(__s._M_non_dbg_impl); }
- int compare(size_type __pos, size_type __n, const _Self& __s) const
- { return _M_non_dbg_impl.compare(__pos, __n, __s._M_non_dbg_impl); }
- int compare(size_type __pos1, size_type __n1, const _Self& __s,
- size_type __pos2, size_type __n2) const
- { return _M_non_dbg_impl.compare(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2); }
- int compare(const _CharT* __s) const {
- _STLP_FIX_LITERAL_BUG(__s)
- return _M_non_dbg_impl.compare(__s);
- }
- int compare(size_type __pos, size_type __n, const _CharT* __s) const {
- _STLP_FIX_LITERAL_BUG(__s)
- return _M_non_dbg_impl.compare(__pos, __n, __s);
- }
- int compare(size_type __pos1, size_type __n1, const _CharT* __s,
- size_type __n2) const {
- _STLP_FIX_LITERAL_BUG(__s)
- return _M_non_dbg_impl.compare(__pos1, __n1, __s, __n2);
- }
-
- // Helper functions for compare.
- static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
- const _CharT* __f2, const _CharT* __l2)
- { return _Base::_M_compare(__f1, __l1, __f2, __l2); }
- static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1,
- const _CharT* __f2, const _CharT* __l2)
- { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2, __l2); }
- static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
- const_iterator __f2, const_iterator __l2)
- { return _Base::_M_compare(__f1, __l1, __f2._M_iterator, __l2._M_iterator); }
- static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1,
- const_iterator __f2, const_iterator __l2)
- { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2._M_iterator, __l2._M_iterator); }
-
- const _CharT* c_str() const { return _M_non_dbg_impl.c_str(); }
- const _CharT* data() const { return _M_non_dbg_impl.data(); }
-
- size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
- { return _M_non_dbg_impl.copy(__s, __n, __pos); }
-
- // find.
- size_type find(const _Self& __s, size_type __pos = 0) const
- { return _M_non_dbg_impl.find(__s._M_non_dbg_impl, __pos); }
- size_type find(const _CharT* __s, size_type __pos = 0) const {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.find(__s, __pos);
- }
- size_type find(const _CharT* __s, size_type __pos, size_type __n) const {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.find(__s, __pos, __n);
- }
- // WIE: Versant schema compiler 5.2.2 ICE workaround
- size_type find(_CharT __c) const { return find(__c, 0); }
- size_type find(_CharT __c, size_type __pos /* = 0 */) const
- { return _M_non_dbg_impl.find(__c, __pos); }
-
- // rfind.
- size_type rfind(const _Self& __s, size_type __pos = npos) const
- { return _M_non_dbg_impl.rfind(__s._M_non_dbg_impl, __pos); }
- size_type rfind(const _CharT* __s, size_type __pos = npos) const {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.rfind(__s, __pos);
- }
- size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.rfind(__s, __pos, __n);
- }
- size_type rfind(_CharT __c, size_type __pos = npos) const
- { return _M_non_dbg_impl.rfind(__c, __pos); }
-
- // find_first_of
- size_type find_first_of(const _Self& __s, size_type __pos = 0) const
- { return _M_non_dbg_impl.find_first_of(__s._M_non_dbg_impl, __pos); }
- size_type find_first_of(const _CharT* __s, size_type __pos = 0) const {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.find_first_of(__s, __pos);
- }
- size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.find_first_of(__s, __pos, __n);
- }
- size_type find_first_of(_CharT __c, size_type __pos = 0) const
- { return _M_non_dbg_impl.find_first_of(__c, __pos); }
-
- // find_last_of
- size_type find_last_of(const _Self& __s, size_type __pos = npos) const
- { return _M_non_dbg_impl.find_last_of(__s._M_non_dbg_impl, __pos); }
- size_type find_last_of(const _CharT* __s, size_type __pos = npos) const {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.find_last_of(__s, __pos);
- }
- size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.find_last_of(__s, __pos, __n);
- }
- size_type find_last_of(_CharT __c, size_type __pos = npos) const
- { return _M_non_dbg_impl.rfind(__c, __pos); }
-
- // find_first_not_of
- size_type find_first_not_of(const _Self& __s, size_type __pos = 0) const
- { return _M_non_dbg_impl.find_first_not_of(__s._M_non_dbg_impl, __pos); }
- size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.find_first_not_of(__s, __pos);
- }
- size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.find_first_not_of(__s, __pos, __n);
- }
- size_type find_first_not_of(_CharT __c, size_type __pos = 0) const
- { return _M_non_dbg_impl.find_first_not_of(__c, __pos); }
-
- // find_last_not_of
- size_type find_last_not_of(const _Self& __s, size_type __pos = npos) const
- { return _M_non_dbg_impl.find_last_not_of(__s._M_non_dbg_impl, __pos); }
- size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.find_last_not_of(__s, __pos);
- }
- size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const {
- _STLP_FIX_LITERAL_BUG(__s)
- _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
- return _M_non_dbg_impl.find_last_not_of(__s, __pos, __n);
- }
- size_type find_last_not_of(_CharT __c, size_type __pos = npos) const
- { return _M_non_dbg_impl.find_last_not_of(__c, __pos); }
-
-#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
-# include <stl/debug/_string_sum_methods.h>
-#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
-};
-
-// This is a hook to instantiate STLport exports in a designated DLL
-#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME <char, char_traits<char>, allocator<char> > >;
-_STLP_MOVE_TO_STD_NAMESPACE
-_STLP_EXPORT_TEMPLATE_CLASS basic_string<char, char_traits<char>, allocator<char> >;
-# if defined (_STLP_HAS_WCHAR_T)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME <wchar_t, char_traits<wchar_t>, allocator<wchar_t> > >;
-_STLP_MOVE_TO_STD_NAMESPACE
-_STLP_EXPORT_TEMPLATE_CLASS basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
-# endif
-#endif /* _STLP_USE_TEMPLATE_EXPORT */
-
-#undef _STLP_NON_DBG_STRING
-#undef _STLP_NON_DBG_STRING_NAME
-
-#if !defined (_STLP_STATIC_CONST_INIT_BUG)
-# if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
-template <class _CharT, class _Traits, class _Alloc>
-const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0;
-# else
-template <class _CharT, class _Traits, class _Alloc>
-const size_t basic_string<_CharT, _Traits, _Alloc>::npos;
-# endif
-#endif
-
-#if defined (basic_string)
-_STLP_MOVE_TO_STD_NAMESPACE
-#undef basic_string
-#endif
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_DBG_STRING */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/debug/_tree.h b/stl/debug/_tree.h
deleted file mode 100644
index 3ebb410..0000000
--- a/stl/debug/_tree.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_DBG_TREE_H
-#define _STLP_INTERNAL_DBG_TREE_H
-
-#ifndef _STLP_DBG_ITERATOR_H
-# include <stl/debug/_iterator.h>
-#endif
-
-#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
-# include <stl/_function_base.h>
-#endif
-
-#ifndef _STLP_INTERNAL_ALLOC_H
-# include <stl/_alloc.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Key, class _Compare>
-class _DbgCompare {
-public:
- _DbgCompare() {}
- _DbgCompare(const _Compare& __cmp) : _M_non_dbg_cmp(__cmp) {}
- _DbgCompare(const _DbgCompare& __cmp) : _M_non_dbg_cmp(__cmp._M_non_dbg_cmp) {}
-
-#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
- bool operator () (const _Key& __lhs, const _Key& __rhs) const {
-#else
- template <class _Kp1, class _Kp2>
- bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const {
-#endif
- if (_M_non_dbg_cmp(__lhs, __rhs)) {
- _STLP_VERBOSE_ASSERT(!_M_non_dbg_cmp(__rhs, __lhs), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
- return true;
- }
- return false;
- }
-
- _Compare non_dbg_key_comp() const { return _M_non_dbg_cmp; }
-private:
- _Compare _M_non_dbg_cmp;
-};
-
-#define _STLP_NON_DBG_TREE _STLP_PRIV _STLP_NON_DBG_NAME(Rb_tree) <_Key, _STLP_PRIV _DbgCompare<_Key, _Compare>, _Value, _KeyOfValue, _Traits, _Alloc>
-
-#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
-_STLP_MOVE_TO_STD_NAMESPACE
-template <class _Key, class _Compare,
- class _Value, class _KeyOfValue, class _Traits, class _Alloc >
-inline _Value*
-value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&)
-{ return (_Value*)0; }
-template <class _Key, class _Compare,
- class _Value, class _KeyOfValue, class _Traits, class _Alloc >
-inline bidirectional_iterator_tag
-iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&)
-{ return bidirectional_iterator_tag(); }
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-template <class _Key, class _Compare,
- class _Value, class _KeyOfValue, class _Traits,
- _STLP_DBG_ALLOCATOR_SELECT(_Value) >
-class _Rb_tree {
- typedef _STLP_NON_DBG_TREE _Base;
- typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self;
- _Base _M_non_dbg_impl;
- _STLP_PRIV __owned_list _M_iter_list;
-
-public:
- __IMPORT_CONTAINER_TYPEDEFS(_Base)
- typedef typename _Base::key_type key_type;
-
- typedef typename _Traits::_NonConstTraits _NonConstIteTraits;
- typedef typename _Traits::_ConstTraits _ConstIteTraits;
- typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstIteTraits> > iterator;
- typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstIteTraits> > const_iterator;
-
- _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
-
-private:
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
- void _Invalidate_iterator(const iterator& __it)
- { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); }
- void _Invalidate_iterators(const iterator& __first, const iterator& __last)
- { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
-
- typedef typename _Base::iterator _Base_iterator;
- typedef typename _Base::const_iterator _Base_const_iterator;
-
-public:
- _Rb_tree()
- : _M_non_dbg_impl(), _M_iter_list(&_M_non_dbg_impl) {}
- _Rb_tree(const _Compare& __comp)
- : _M_non_dbg_impl(__comp), _M_iter_list(&_M_non_dbg_impl) {}
- _Rb_tree(const _Compare& __comp, const allocator_type& __a)
- : _M_non_dbg_impl(__comp, __a), _M_iter_list(&_M_non_dbg_impl) {}
- _Rb_tree(const _Self& __x)
- : _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
-
- _Rb_tree(__move_source<_Self> src):
- _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
- _M_iter_list(&_M_non_dbg_impl) {
-#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
- src.get()._M_iter_list._Invalidate_all();
-#else
- src.get()._M_iter_list._Set_owner(_M_iter_list);
-#endif
- }
-
- ~_Rb_tree() {}
-
- _Self& operator=(const _Self& __x) {
- if (this != &__x) {
- //Should not invalidate end iterator:
- _Invalidate_iterators(begin(), end());
- _M_non_dbg_impl = __x._M_non_dbg_impl;
- }
- return *this;
- }
-
- allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
- _Compare key_comp() const { return _M_non_dbg_impl.key_comp().non_dbg_key_comp(); }
-
- iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
- const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
- iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
- const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
-
- bool empty() const { return _M_non_dbg_impl.empty(); }
- size_type size() const { return _M_non_dbg_impl.size(); }
- size_type max_size() const { return _M_non_dbg_impl.max_size(); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __x) const { return _M_non_dbg_impl.count(__x); }
-
- void swap(_Self& __t) {
- _M_non_dbg_impl.swap(__t._M_non_dbg_impl);
- _M_iter_list._Swap_owners(__t._M_iter_list);
- }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __k)
- { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __k) const
- { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator lower_bound(const _KT& __x)
- { return iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator lower_bound(const _KT& __x) const
- { return const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator upper_bound(const _KT& __x)
- { return iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator upper_bound(const _KT& __x) const
- { return const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator,iterator> equal_range(const _KT& __x) {
- return pair<iterator, iterator>(iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)),
- iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)));
- }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
- return pair<const_iterator,const_iterator>(const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)),
- const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)));
- }
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator,iterator> equal_range_unique(const _KT& __x) {
- _STLP_STD::pair<_Base_iterator, _Base_iterator> __p;
- __p = _M_non_dbg_impl.equal_range_unique(__x);
- return pair<iterator, iterator>(iterator(&_M_iter_list, __p.first), iterator(&_M_iter_list, __p.second));
- }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range_unique(const _KT& __x) const {
- _STLP_STD::pair<_Base_const_iterator, _Base_const_iterator> __p;
- __p = _M_non_dbg_impl.equal_range_unique(__x);
- return pair<const_iterator, const_iterator>(const_iterator(&_M_iter_list, __p.first),
- const_iterator(&_M_iter_list, __p.second));
- }
-
- pair<iterator,bool> insert_unique(const value_type& __x) {
- _STLP_STD::pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__x);
- return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
- }
- iterator insert_equal(const value_type& __x)
- { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__x)); }
-
- iterator insert_unique(iterator __pos, const value_type& __x) {
- _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos))
- return iterator(&_M_iter_list, _M_non_dbg_impl.insert_unique(__pos._M_iterator, __x));
- }
- iterator insert_equal(iterator __pos, const value_type& __x) {
- _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __pos))
- return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__pos._M_iterator, __x));
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template<class _InputIterator>
- void insert_equal(_InputIterator __first, _InputIterator __last) {
- _STLP_DEBUG_CHECK(__check_range(__first,__last))
- _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- }
- template<class _InputIterator>
- void insert_unique(_InputIterator __first, _InputIterator __last) {
- _STLP_DEBUG_CHECK(__check_range(__first,__last))
- _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- }
-#else
- void insert_unique(const_iterator __first, const_iterator __last) {
- _STLP_DEBUG_CHECK(__check_range(__first,__last))
- _M_non_dbg_impl.insert_unique(__first._M_iterator, __last._M_iterator);
- }
- void insert_unique(const value_type* __first, const value_type* __last) {
- _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last))
- _M_non_dbg_impl.insert_unique(__first, __last);
- }
- void insert_equal(const_iterator __first, const_iterator __last) {
- _STLP_DEBUG_CHECK(__check_range(__first,__last))
- _M_non_dbg_impl.insert_equal(__first._M_iterator, __last._M_iterator);
- }
- void insert_equal(const value_type* __first, const value_type* __last) {
- _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last))
- _M_non_dbg_impl.insert_equal(__first, __last);
- }
-#endif
-
- void erase(iterator __pos) {
- _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos))
- _STLP_DEBUG_CHECK(_Dereferenceable(__pos))
- _Invalidate_iterator(__pos);
- _M_non_dbg_impl.erase(__pos._M_iterator);
- }
- size_type erase(const key_type& __x) {
- pair<_Base_iterator,_Base_iterator> __p = _M_non_dbg_impl.equal_range(__x);
- size_type __n = distance(__p.first, __p.second);
- _Invalidate_iterators(iterator(&_M_iter_list, __p.first), iterator(&_M_iter_list, __p.second));
- _M_non_dbg_impl.erase(__p.first, __p.second);
- return __n;
- }
- size_type erase_unique(const key_type& __x) {
- _Base_iterator __i = _M_non_dbg_impl.find(__x);
- if (__i != _M_non_dbg_impl.end()) {
- _Invalidate_iterator(iterator(&_M_iter_list, __i));
- _M_non_dbg_impl.erase(__i);
- return 1;
- }
- return 0;
- }
-
- void erase(iterator __first, iterator __last) {
- _STLP_DEBUG_CHECK(__check_range(__first, __last, begin(), end()))
- _Invalidate_iterators(__first, __last);
- _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator);
- }
- void erase(const key_type* __first, const key_type* __last) {
- while (__first != __last) erase(*__first++);
- }
-
- void clear() {
- //should not invalidate end:
- _Invalidate_iterators(begin(), end());
- _M_non_dbg_impl.clear();
- }
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-_STLP_END_NAMESPACE
-
-#undef _STLP_NON_DBG_TREE
-
-#endif /* _STLP_INTERNAL_DBG_TREE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/debug/_vector.h b/stl/debug/_vector.h
deleted file mode 100644
index 171b764..0000000
--- a/stl/debug/_vector.h
+++ /dev/null
@@ -1,449 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_INTERNAL_DBG_VECTOR_H
-#define _STLP_INTERNAL_DBG_VECTOR_H
-
-#ifndef _STLP_DBG_ITERATOR_H
-# include <stl/debug/_iterator.h>
-#endif
-
-#define _STLP_NON_DBG_VECTOR _STLP_PRIV _STLP_NON_DBG_NAME(vector) <_Tp, _Alloc>
-
-_STLP_BEGIN_NAMESPACE
-
-#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
-template <class _Tp, class _Alloc>
-inline _Tp*
-value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_VECTOR >&)
-{ return (_Tp*)0; }
-template <class _Tp, class _Alloc>
-inline random_access_iterator_tag
-iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_VECTOR >&)
-{ return random_access_iterator_tag(); }
-#endif
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _Tp, class _NcIt>
-struct _Vector_const_traits;
-
-template <class _Tp, class _NcIt>
-struct _Vector_nonconst_traits {
- typedef _Nonconst_traits<_Tp> _BaseT;
- typedef _Tp value_type;
- typedef _Tp& reference;
- typedef _Tp* pointer;
- typedef _Vector_const_traits<_Tp, _NcIt> _ConstTraits;
- typedef _Vector_nonconst_traits<_Tp, _NcIt> _NonConstTraits;
-};
-
-template <class _Tp, class _NcIt>
-struct _Vector_const_traits {
- typedef _Const_traits<_Tp> _BaseT;
- typedef _Tp value_type;
- typedef const _Tp& reference;
- typedef const _Tp* pointer;
- typedef _Vector_const_traits<_Tp, _NcIt> _ConstTraits;
- typedef _Vector_nonconst_traits<_Tp, _NcIt> _NonConstTraits;
-};
-
-_STLP_TEMPLATE_NULL
-struct _Vector_nonconst_traits<bool, _Bit_iterator> {
- typedef _Bit_iterator::value_type value_type;
- typedef _Bit_iterator::reference reference;
- typedef _Bit_iterator::pointer pointer;
- typedef _Vector_const_traits<bool, _Bit_iterator> _ConstTraits;
- typedef _Vector_nonconst_traits<bool, _Bit_iterator> _NonConstTraits;
-};
-
-_STLP_TEMPLATE_NULL
-struct _Vector_const_traits<bool, _Bit_iterator> {
- typedef _Bit_const_iterator::value_type value_type;
- typedef _Bit_const_iterator::reference reference;
- typedef _Bit_const_iterator::pointer pointer;
- typedef _Vector_const_traits<bool, _Bit_iterator> _ConstTraits;
- typedef _Vector_nonconst_traits<bool, _Bit_iterator> _NonConstTraits;
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-template <class _Tp, _STLP_DBG_ALLOCATOR_SELECT(_Tp) >
-class vector :
-#if !defined (__DMC__)
- private
-#endif
- _STLP_PRIV __construct_checker< _STLP_NON_DBG_VECTOR >
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- , public __stlport_class<vector<_Tp, _Alloc> >
-#endif
-{
-private:
- typedef _STLP_NON_DBG_VECTOR _Base;
- typedef vector<_Tp, _Alloc> _Self;
- typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_VECTOR > _ConstructCheck;
- _Base _M_non_dbg_impl;
- _STLP_PRIV __owned_list _M_iter_list;
-
-public:
- __IMPORT_CONTAINER_TYPEDEFS(_Base)
-
- typedef _STLP_PRIV _DBG_iter<_Base,
- _STLP_PRIV _DbgTraits<_STLP_PRIV _Vector_nonconst_traits<value_type, typename _Base::iterator> > > iterator;
-
- typedef _STLP_PRIV _DBG_iter<_Base,
- _STLP_PRIV _DbgTraits<_STLP_PRIV _Vector_const_traits<value_type, typename _Base::iterator> > > const_iterator;
-
-private:
- void _Invalidate_all()
- { _M_iter_list._Invalidate_all(); }
- void _Invalidate_iterator(const iterator& __it)
- { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
- void _Invalidate_iterators(const iterator& __first, const iterator& __last)
- { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
-
- void _Check_Overflow(size_type __nb) {
- if (size() + __nb > capacity())
- _Invalidate_all();
- }
- void _Compare_Capacity (size_type __old_capacity) {
- if (capacity() > __old_capacity) {
- _Invalidate_all();
- }
- }
-
-public:
- _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
-
- allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
-
- iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
- const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
- iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
- const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
-
- size_type size() const { return _M_non_dbg_impl.size(); }
- size_type max_size() const { return _M_non_dbg_impl.max_size(); }
- size_type capacity() const { return _M_non_dbg_impl.capacity(); }
- bool empty() const { return _M_non_dbg_impl.empty(); }
-
- reference operator[](size_type __n) {
- _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
- return _M_non_dbg_impl[__n];
- }
-
- const_reference operator[](size_type __n) const {
- _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
- return _M_non_dbg_impl[__n];
- }
-
- reference at(size_type __n) { return _M_non_dbg_impl.at(__n); }
- const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); }
-
- explicit vector(const allocator_type& __a = allocator_type())
- : _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit vector(size_type __n, const _Tp& __x = _Tp(),
-#else
- vector(size_type __n, const _Tp& __x,
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- const allocator_type& __a = allocator_type())
- : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit vector(size_type __n)
- : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- vector(const _Self& __x)
- : _ConstructCheck(__x), _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
-
- vector(__move_source<_Self> src)
- : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
- _M_iter_list(&_M_non_dbg_impl) {
-#if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
- src.get()._M_iter_list._Invalidate_all();
-#else
- src.get()._M_iter_list._Set_owner(_M_iter_list);
-#endif
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- vector(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- vector(_InputIterator __first, _InputIterator __last)
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
- _M_iter_list(&_M_non_dbg_impl) {}
-# endif
-#else
- vector(const _Tp* __first, const _Tp* __last,
- const allocator_type& __a = allocator_type())
- : _ConstructCheck(__first, __last), _M_non_dbg_impl(__first, __last, __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-
- // mysterious VC++ bug ?
- vector(const_iterator __first, const_iterator __last ,
- const allocator_type& __a = allocator_type())
- : _ConstructCheck(__first, __last),
- _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
- _M_iter_list(&_M_non_dbg_impl) {}
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- _Self& operator=(const _Self& __x) {
- if (this != &__x) {
- _Invalidate_all();
- _M_non_dbg_impl = __x._M_non_dbg_impl;
- }
- return *this;
- }
-
- void reserve(size_type __n) {
- if (capacity() < __n)
- _Invalidate_all();
- _M_non_dbg_impl.reserve(__n);
- }
-
- reference front() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return *begin();
- }
- const_reference front() const {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return *begin();
- }
- reference back() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return *(--end());
- }
- const_reference back() const {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- return *(--end());
- }
-
- void swap(_Self& __x) {
- _M_iter_list._Swap_owners(__x._M_iter_list);
- _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
- }
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert(iterator __pos, const _Tp& __x = _Tp()) {
-#else
- iterator insert(iterator __pos, const _Tp& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _Check_Overflow(1);
- return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
- }
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert(iterator __pos)
- { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- void insert(iterator __pos,
- _InputIterator __first, _InputIterator __last) {
- typedef typename _AreSameUnCVTypes<_InputIterator, iterator>::_Ret _IsNonConstIterator;
- typedef typename _AreSameUnCVTypes<_InputIterator, const_iterator>::_Ret _IsConstIterator;
- typedef typename _Lor2<_IsNonConstIterator, _IsConstIterator>::_Ret _DoCheck;
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- //Sequence requirements 23.1.1 Table 67:
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first, _DoCheck()));
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.insert(__pos._M_iterator,
- _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- _Compare_Capacity(__old_capacity);
- }
-#else
- void insert (iterator __pos,
- const value_type *__first, const value_type *__last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first,__last))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
- _Compare_Capacity(__old_capacity);
- }
-
- void insert(iterator __pos,
- const_iterator __first, const_iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- //Sequence requirements 23.1.1 Table 67:
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first, __true_type()));
- size_type __old_capacity = capacity();
- _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
- _Compare_Capacity(__old_capacity);
-}
-#endif
-
- void insert (iterator __pos, size_type __n, const _Tp& __x){
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _Check_Overflow(__n);
- _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
- }
-
- void pop_back() {
- _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
- _Invalidate_iterator(end());
- _M_non_dbg_impl.pop_back();
- }
- iterator erase(iterator __pos) {
- _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
- _Invalidate_iterators(__pos, end());
- return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
- }
- iterator erase(iterator __first, iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
- _Invalidate_iterators(__first, end());
- return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
- }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
-#else
- void resize(size_type __new_size, const _Tp& __x) {
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- if (__new_size > capacity()) {
- _Invalidate_all();
- }
- else if (__new_size < size()) {
- _Invalidate_iterators(begin() + __new_size, end());
- }
- _M_non_dbg_impl.resize(__new_size, __x);
- }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-private:
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val,
- const __true_type& /*_IsIntegral*/) {
- _M_check_assign(__n);
- _M_non_dbg_impl.assign(__n, __val);
- }
-
- template <class _InputIter>
- void _M_assign_dispatch(_InputIter __first, _InputIter __last,
- const __false_type& /*_IsIntegral*/) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
- size_type __old_size = size();
- size_type __old_capacity = capacity();
- iterator __old_end = end();
- _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
- if (__old_capacity != 0) {
- if (empty() || (capacity() > __old_capacity)) {
- _Invalidate_all();
- }
- else if (size() < __old_size) {
- _Invalidate_iterators(begin() + size(), __old_end);
- }
- }
- }
-
-public:
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-#else
-private:
- void _M_assign(const value_type *__first, const value_type *__last) {
- size_type __len = distance(__first, __last);
- _M_check_assign(__len);
- _M_non_dbg_impl.assign(__first, __last);
- }
-public:
- void assign(const value_type *__first, const value_type *__last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first,__last))
- _M_assign(__first, __last);
- }
-
- void assign(const_iterator __first, const_iterator __last) {
- _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
- _M_assign(__first._M_iterator, __last._M_iterator);
- }
-#endif
-
-private:
- void _M_check_assign(size_type __n) {
- if (__n > capacity()) {
- _Invalidate_all();
- }
- else if (__n < size()) {
- _Invalidate_iterators(begin() + __n, end());
- }
- }
-
-public:
- void assign(size_type __n, const _Tp& __val) {
- _M_check_assign(__n);
- _M_non_dbg_impl.assign(__n, __val);
- }
-
- void clear() {
- _Invalidate_all();
- _M_non_dbg_impl.clear();
- }
- void push_back(const _Tp& __x) {
- _Check_Overflow(1);
- _M_non_dbg_impl.push_back(__x);
- }
-};
-
-_STLP_END_NAMESPACE
-
-#undef _STLP_NON_DBG_VECTOR
-
-#endif /* _STLP_DBG_VECTOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/msl_string.h b/stl/msl_string.h
deleted file mode 100644
index 962768c..0000000
--- a/stl/msl_string.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1998
- * Mark of the Unicorn, 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. Mark of the Unicorn, Inc. makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-#if defined( _STLP_USE_MSIPL ) && !defined( _STLP_MSL_STRING_H_ )
-#define _STLP_MSL_STRING_H_
-
-//# define char_traits __msl_char_traits
-# define basic_string __msl_basic_string
-# define b_str_ref __msl_b_str_ref
-# define basic_istream __msl_basic_istream
-# define basic_ostream __msl_basic_ostream
-# define string __msl_string
-# define wstring __msl_wstring
-# define iterator_traits __msl_iterator_traits
-
-namespace std
-{
- template<class charT, class traits> class basic_istream;
- template<class charT, class traits> class basic_ostream;
-}
-
-# include _STLP_NATIVE_HEADER(string)
-// # undef char_traits
-# undef basic_string
-# undef b_str_ref
-# undef basic_istream
-# undef basic_ostream
-# undef string
-# undef wstring
-# undef iterator_traits
-
-#endif
diff --git a/stl/pointers/_deque.h b/stl/pointers/_deque.h
deleted file mode 100644
index a2c2774..0000000
--- a/stl/pointers/_deque.h
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Copyright (c) 2004
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_SPECIALIZED_DEQUE_H
-#define _STLP_SPECIALIZED_DEQUE_H
-
-#ifndef _STLP_POINTERS_SPEC_TOOLS_H
-# include <stl/pointers/_tools.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-/*
- * struct helper to cast deque iterators:
- */
-template <class _StorageT, class _ValueT>
-struct _DequeIteCast {
- typedef _Deque_iterator<_ValueT, _Nonconst_traits<_ValueT> > iterator;
- typedef _Deque_iterator<_ValueT, _Const_traits<_ValueT> > const_iterator;
- typedef _Deque_iterator<_StorageT, _Nonconst_traits<_StorageT> > storage_iterator;
- typedef _Deque_iterator<_StorageT, _Const_traits<_StorageT> > const_storage_iterator;
- typedef _CastTraits<_StorageT, _ValueT> cast_traits;
-
- static iterator to_value_type_ite (storage_iterator const& __ite) {
- iterator tmp;
- tmp._M_cur = cast_traits::to_value_type_ptr(__ite._M_cur);
- tmp._M_first = cast_traits::to_value_type_ptr(__ite._M_first);
- tmp._M_last = cast_traits::to_value_type_ptr(__ite._M_last);
- tmp._M_node = cast_traits::to_value_type_pptr(__ite._M_node);
- return tmp;
- }
- static storage_iterator to_storage_type_ite (iterator const& __ite) {
- storage_iterator tmp;
- tmp._M_cur = cast_traits::to_storage_type_ptr(__ite._M_cur);
- tmp._M_first = cast_traits::to_storage_type_ptr(__ite._M_first);
- tmp._M_last = cast_traits::to_storage_type_ptr(__ite._M_last);
- tmp._M_node = cast_traits::to_storage_type_pptr(__ite._M_node);
- return tmp;
- }
-
- static const_iterator to_value_type_cite (const_storage_iterator const& __ite) {
- const_iterator tmp;
- tmp._M_cur = cast_traits::to_value_type_ptr(__ite._M_cur);
- tmp._M_first = cast_traits::to_value_type_ptr(__ite._M_first);
- tmp._M_last = cast_traits::to_value_type_ptr(__ite._M_last);
- tmp._M_node = cast_traits::to_value_type_pptr(__ite._M_node);
- return tmp;
- }
-
- static const_storage_iterator to_storage_type_cite (const_iterator const& __ite) {
- const_storage_iterator tmp;
- tmp._M_cur = cast_traits::to_storage_type_ptr(__ite._M_cur);
- tmp._M_first = cast_traits::to_storage_type_ptr(__ite._M_first);
- tmp._M_last = cast_traits::to_storage_type_ptr(__ite._M_last);
- tmp._M_node = cast_traits::to_storage_type_pptr(__ite._M_node);
- return tmp;
- }
-};
-
-#define DEQUE_IMPL _STLP_PTR_IMPL_NAME(deque)
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
-_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<void***, void**, allocator<void**> >;
-_STLP_EXPORT template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
-_STLP_EXPORT_TEMPLATE_CLASS _Deque_base<void*,allocator<void*> >;
-_STLP_EXPORT_TEMPLATE_CLASS DEQUE_IMPL<void*,allocator<void*> >;
-#endif
-
-#if defined (_STLP_DEBUG)
-# define deque _STLP_NON_DBG_NAME(deque)
-#else
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
-class deque
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (deque)
- : public __stlport_class<deque<_Tp, _Alloc> >
-#endif
-{
- typedef typename _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
- typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
- typedef _STLP_PRIV DEQUE_IMPL<_StorageType, _StorageTypeAlloc> _Base;
- typedef deque<_Tp, _Alloc> _Self;
-
- typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
- typedef _STLP_PRIV _DequeIteCast<_StorageType, _Tp> ite_cast_traits;
-
-public:
- typedef _Tp value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef random_access_iterator_tag _Iterator_category;
- _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
- typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
- typedef _STLP_PRIV _Deque_iterator<value_type, _Nonconst_traits<value_type> > iterator;
- typedef _STLP_PRIV _Deque_iterator<value_type, _Const_traits<value_type> > const_iterator;
-
- _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
-
-public: // Basic accessors
- iterator begin() { return ite_cast_traits::to_value_type_ite(_M_impl.begin()); }
- iterator end() { return ite_cast_traits::to_value_type_ite(_M_impl.end()); }
- const_iterator begin() const { return ite_cast_traits::to_value_type_cite(_M_impl.begin()); }
- const_iterator end() const { return ite_cast_traits::to_value_type_cite(_M_impl.end()); }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rbegin() const
- { return const_reverse_iterator(end()); }
- const_reverse_iterator rend() const
- { return const_reverse_iterator(begin()); }
-
- reference operator[](size_type __n)
- { return cast_traits::to_value_type_ref(_M_impl[__n]); }
- const_reference operator[](size_type __n) const
- { return cast_traits::to_value_type_cref(_M_impl[__n]); }
-
- reference at(size_type __n)
- { return cast_traits::to_value_type_ref(_M_impl.at(__n)); }
- const_reference at(size_type __n) const
- { return cast_traits::to_value_type_cref(_M_impl.at(__n)); }
-
- reference front() { return cast_traits::to_value_type_ref(_M_impl.front()); }
- reference back() { return cast_traits::to_value_type_ref(_M_impl.back()); }
- const_reference front() const { return cast_traits::to_value_type_cref(_M_impl.front()); }
- const_reference back() const { return cast_traits::to_value_type_cref(_M_impl.back()); }
-
- size_type size() const { return _M_impl.size(); }
- size_type max_size() const { return _M_impl.max_size(); }
- bool empty() const { return _M_impl.empty(); }
- allocator_type get_allocator() const { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
-
- explicit deque(const allocator_type& __a = allocator_type())
- : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-
- deque(const _Self& __x) : _M_impl(__x._M_impl) {}
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit deque(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
-#else
- deque(size_type __n, const value_type& __val,
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- const allocator_type& __a = allocator_type())
- : _M_impl(__n, cast_traits::to_storage_type_cref(__val), _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
- // int,long variants may be needed
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- explicit deque(size_type __n) : _M_impl(__n) {}
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- deque(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
-#if !defined (_STLP_USE_ITERATOR_WRAPPER)
- : _M_impl(__first, __last,
- _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
-#else
- : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
-#endif
-#if defined (_STLP_USE_ITERATOR_WRAPPER)
- insert(end(), __first, __last);
-#endif
- }
-
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- deque(_InputIterator __first, _InputIterator __last)
-# if !defined (_STLP_USE_ITERATOR_WRAPPER)
- : _M_impl(__first, __last) {}
-# else
- { insert(end(), __first, __last); }
-# endif
-# endif
-
-#else
- deque(const_pointer __first, const_pointer __last,
- const allocator_type& __a = allocator_type() )
- : _M_impl(cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last),
- _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-
- deque(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type() )
- : _M_impl(ite_cast_traits::to_storage_type_cite(__first),
- ite_cast_traits::to_storage_type_cite(__last),
- _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- deque(__move_source<_Self> src)
- : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
-
- _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; }
-
- void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
-
- void assign(size_type __n, const value_type& __val) {
- _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val));
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
-private:
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val,
- const __true_type&)
- { _M_impl.assign(__n, __val); }
-
- template <class _InputIterator>
- void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
- const __false_type&) {
- _M_impl.assign(typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
- }
-
-public:
-# endif
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
-# else
- _M_impl.assign(__first, __last);
-# endif
- }
-#else
- void assign(const_pointer __first, const_pointer __last)
- { _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last)); }
- void assign(const_iterator __first, const_iterator __last)
- { _M_impl.assign(ite_cast_traits::to_storage_type_cite(__first),
- ite_cast_traits::to_storage_type_cite(__last)); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- void push_back(const value_type& __t)
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- { _M_impl.push_back(cast_traits::to_storage_type_cref(__t)); }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- void push_front(const value_type& __t)
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- { _M_impl.push_front(cast_traits::to_storage_type_cref(__t)); }
-
-# if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- void push_back() { _M_impl.push_back(); }
- void push_front() { _M_impl.push_front(); }
-# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
- void pop_back() { _M_impl.pop_back(); }
- void pop_front() { _M_impl.pop_front(); }
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- iterator insert(iterator __pos, const value_type& __x)
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- { return ite_cast_traits::to_value_type_ite(_M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
- cast_traits::to_storage_type_cref(__x))); }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
- void insert(iterator __pos, size_type __n, const value_type& __x)
- { _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, cast_traits::to_storage_type_cref(__x)); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
-private:
- template <class _Integer>
- void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
- const __true_type&) {
- _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, __val);
- }
-
- template <class _InputIterator>
- void _M_insert_dispatch(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- const __false_type&) {
- _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
- typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
- }
-
-public:
-# endif
-
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- // Check whether it's an integral type. If so, it's not an iterator.
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_insert_dispatch(__pos, __first, __last, _Integral());
-# else
- _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __first, __last);
-# endif
- }
-
-#else /* _STLP_MEMBER_TEMPLATES */
- void insert(iterator __pos,
- const_pointer __first, const_pointer __last) {
- _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
- cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last));
- }
- void insert(iterator __pos,
- const_iterator __first, const_iterator __last) {
- _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
- ite_cast_traits::to_storage_type_cite(__first),
- ite_cast_traits::to_storage_type_cite(__last));
- }
-
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- void resize(size_type __new_size, const value_type& __x)
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size) { _M_impl.resize(__new_size); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- iterator erase(iterator __pos)
- { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__pos))); }
-
- iterator erase(iterator __first, iterator __last)
- { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__first),
- ite_cast_traits::to_storage_type_ite(__last))); }
- void clear() { _M_impl.clear(); }
-
-private:
- _Base _M_impl;
-};
-
-#if defined (deque)
-# undef deque
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-#undef DEQUE_IMPL
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_SPECIALIZED_DEQUE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/pointers/_list.h b/stl/pointers/_list.h
deleted file mode 100644
index 441b11d..0000000
--- a/stl/pointers/_list.h
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * Copyright (c) 2003
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_PTR_SPECIALIZED_LIST_H
-#define _STLP_PTR_SPECIALIZED_LIST_H
-
-#ifndef _STLP_POINTERS_SPEC_TOOLS_H
-# include <stl/pointers/_tools.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#define LIST_IMPL _STLP_PTR_IMPL_NAME(list)
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-_STLP_EXPORT_TEMPLATE_CLASS _List_node<void*>;
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _List_node<void*> >;
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_List_node_base, _List_node<void*>, allocator<_List_node<void*> > >;
-_STLP_EXPORT_TEMPLATE_CLASS _List_base<void*, allocator<void*> >;
-_STLP_EXPORT_TEMPLATE_CLASS LIST_IMPL<void*, allocator<void*> >;
-
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-#if defined (_STLP_DEBUG)
-# define list _STLP_NON_DBG_NAME(list)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
-class list
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list)
- : public __stlport_class<list<_Tp, _Alloc> >
-#endif
-{
- typedef typename _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
- typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
- typedef _STLP_PRIV LIST_IMPL<_StorageType, _StorageTypeAlloc> _Base;
- typedef typename _Base::iterator _BaseIte;
- typedef typename _Base::const_iterator _BaseConstIte;
- typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
- typedef list<_Tp, _Alloc> _Self;
-
-public:
- typedef _Tp value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
- typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
- typedef bidirectional_iterator_tag _Iterator_category;
-
- typedef _STLP_PRIV _List_iterator<value_type, _Nonconst_traits<value_type> > iterator;
- typedef _STLP_PRIV _List_iterator<value_type, _Const_traits<value_type> > const_iterator;
-
- _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
-
- allocator_type get_allocator() const
- { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
-
-# if !(defined(__MRC__)||(defined(__SC__) && !defined(__DMC__)))
- explicit
-# endif
- list(const allocator_type& __a = allocator_type())
- : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit list(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
-#else
- list(size_type __n, const value_type& __val,
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- const allocator_type& __a = allocator_type())
- : _M_impl(__n, cast_traits::to_storage_type_cref(__val),
- _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit list(size_type __n)
- : _M_impl(__n) {}
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- list(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
-# if !defined (_STLP_USE_ITERATOR_WRAPPER)
- : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-# else
- : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
- insert(begin(), __first, __last);
- }
-# endif
-
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- list(_InputIterator __first, _InputIterator __last)
-# if !defined (_STLP_USE_WRAPPER_ITERATOR)
- : _M_impl(__first, __last) {}
-# else
- { insert(begin(), __first, __last); }
-# endif
-# endif
-
-#else /* _STLP_MEMBER_TEMPLATES */
-
- list(const value_type *__first, const value_type *__last,
- const allocator_type& __a = allocator_type())
- : _M_impl(cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last),
- _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
- list(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type())
- : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node),
- _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- list(const _Self& __x) : _M_impl(__x._M_impl) {}
-
- list(__move_source<_Self> src)
- : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
-
- iterator begin() { return iterator(_M_impl.begin()._M_node); }
- const_iterator begin() const { return const_iterator(_M_impl.begin()._M_node); }
-
- iterator end() { return iterator(_M_impl.end()._M_node); }
- const_iterator end() const { return const_iterator(_M_impl.end()._M_node); }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
-
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
-
- bool empty() const { return _M_impl.empty(); }
- size_type size() const { return _M_impl.size(); }
- size_type max_size() const { return _M_impl.max_size(); }
-
- reference front() { return *begin(); }
- const_reference front() const { return *begin(); }
- reference back() { return *(--end()); }
- const_reference back() const { return *(--end()); }
-
- void swap(_Self &__x) { _M_impl.swap(__x._M_impl); }
- void clear() { _M_impl.clear(); }
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos, const_reference __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- iterator insert(iterator __pos, const_reference __x)
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- { return iterator(_M_impl.insert(_BaseIte(__pos._M_node),
- cast_traits::to_storage_type_cref(__x))._M_node); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
-private:
- template <class _Integer>
- void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
- const __true_type&)
- { _M_impl.insert(_BaseIte(__pos._M_node), __n, __val); }
-
- template <class _InputIterator>
- void _M_insert_dispatch(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- const __false_type&) {
- _M_impl.insert(_BaseIte(__pos._M_node),
- typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
- }
-
-public:
-# endif
-
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- // Check whether it's an integral type. If so, it's not an iterator.
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_insert_dispatch(__pos, __first, __last, _Integral());
-# else
- _M_impl.insert(_BaseIte(__pos._M_node), __first, __last);
-# endif
- }
-#else /* _STLP_MEMBER_TEMPLATES */
- void insert(iterator __pos, const value_type *__first, const value_type *__last)
- { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last)); }
- void insert(iterator __pos, const_iterator __first, const_iterator __last)
- { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- void insert(iterator __pos, size_type __n, const value_type& __x)
- { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
-
- void push_front(const value_type& __x) { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); }
- void push_back(const value_type& __x) { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); }
-
-#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos) { return iterator(_M_impl.insert(__pos._M_node)._M_node); }
- void push_front() { _M_impl.push_front();}
- void push_back() { _M_impl.push_back();}
-# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
- iterator erase(iterator __pos)
- { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); }
- iterator erase(iterator __first, iterator __last)
- { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); }
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- void resize(size_type __new_size) { _M_impl.resize(__new_size); }
- void resize(size_type __new_size, const value_type& __x)
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
- {_M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));}
-
- void pop_front() { _M_impl.pop_front(); }
- void pop_back() { _M_impl.pop_back(); }
-
- _Self& operator=(const _Self& __x)
- { _M_impl = __x._M_impl; return *this; }
- void assign(size_type __n, const value_type& __val)
- { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
-private:
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&)
- { _M_impl.assign(__n, __val); }
-
- template <class _InputIterator>
- void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
- const __false_type&) {
- _M_impl.assign(typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
- }
-
-public:
-# endif
-
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
-# else
- _M_impl.assign(__first, __last);
-# endif
- }
-#else
- void assign(const value_type *__first, const value_type *__last) {
- _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last));
- }
- void assign(const_iterator __first, const_iterator __last)
- { _M_impl.assign(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
-#endif
-
- void splice(iterator __pos, _Self& __x)
- { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); }
- void splice(iterator __pos, _Self& __x, iterator __i)
- { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); }
- void splice(iterator __pos, _Self& __x, iterator __first, iterator __last)
- { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl,
- _BaseIte(__first._M_node), _BaseIte(__last._M_node)); }
-
- void remove(const_reference __val)
- { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); }
- void unique() { _M_impl.unique(); }
- void merge(_Self& __x) { _M_impl.merge(__x._M_impl); }
- void reverse() { _M_impl.reverse(); }
- void sort() { _M_impl.sort(); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _Predicate>
- void remove_if(_Predicate __pred)
- { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); }
- template <class _BinaryPredicate>
- void unique(_BinaryPredicate __bin_pred)
- { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__bin_pred)); }
-
- template <class _StrictWeakOrdering>
- void merge(_Self &__x, _StrictWeakOrdering __comp)
- { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
-
- template <class _StrictWeakOrdering>
- void sort(_StrictWeakOrdering __comp)
- { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-private:
- _Base _M_impl;
-};
-
-#if defined (list)
-# undef list
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-#undef LIST_IMPL
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_PTR_SPECIALIZED_LIST_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/pointers/_set.h b/stl/pointers/_set.h
deleted file mode 100644
index c66fd98..0000000
--- a/stl/pointers/_set.h
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- * Copyright (c) 2005
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_PTR_SPECIALIZED_SET_H
-#define _STLP_PTR_SPECIALIZED_SET_H
-
-#ifndef _STLP_POINTERS_SPEC_TOOLS_H
-# include <stl/pointers/_tools.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//Specific iterator traits creation
-_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, Const_traits)
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-_STLP_EXPORT template struct _STLP_CLASS_DECLSPEC less<void*>;
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-typedef _Rb_tree_node<void*> _Node;
-_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Rb_tree_node_base, _Node, allocator<_Node> >;
-_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree_base<void*, allocator<void*> >;
-# if defined (_STLP_DEBUG)
-_STLP_EXPORT_TEMPLATE_CLASS _DbgCompare<void*, less<void*> >;
-# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree)
-_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree<void*, _DbgCompare<void*, less<void*> >, void*, _Identity<void*>,
- _SetTraitsT<void*>, allocator<void*> >;
-# undef _Rb_tree
-# endif
-_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree<void*, less<void*>, void*, _Identity<void*>,
- _SetTraitsT<void*>, allocator<void*> >;
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
- _STLP_DEFAULT_ALLOCATOR_SELECT(_Key) >
-class set
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<set<_Key, _Compare, _Alloc> >
-#endif
-{
- typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare> _AssocStorageTypes;
- typedef typename _AssocStorageTypes::_KeyStorageType _KeyStorageType;
- typedef typename _AssocStorageTypes::_CompareStorageType _CompareStorageType;
- typedef typename _Alloc_traits<_KeyStorageType, _Alloc>::allocator_type _StorageTypeAlloc;
- typedef _STLP_PRIV _CastTraits<_KeyStorageType, _Key> cast_traits;
-
- typedef set<_Key, _Compare, _Alloc> _Self;
-public:
- typedef _Key key_type;
- typedef _Key value_type;
- typedef _Compare key_compare;
- typedef _Compare value_compare;
-
-protected:
- //Specific iterator traits creation
- typedef _STLP_PRIV _SetTraitsT<value_type> _SetTraits;
- typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
- value_type, _STLP_PRIV _Identity<value_type>,
- _SetTraits, _Alloc> _Priv_Rep_type;
-
- typedef _STLP_PRIV _SetTraitsT<_KeyStorageType> _SetStorageTraits;
-
-public:
- //dums: need the following public for the __move_traits framework
- typedef _STLP_PRIV _Rb_tree<_KeyStorageType, _CompareStorageType,
- _KeyStorageType, _STLP_PRIV _Identity<_KeyStorageType>,
- _SetStorageTraits, _StorageTypeAlloc> _Rep_type;
-
-private:
- typedef typename _Rep_type::iterator base_iterator;
- typedef typename _Rep_type::const_iterator const_base_iterator;
-
-public:
- typedef typename _Priv_Rep_type::pointer pointer;
- typedef typename _Priv_Rep_type::const_pointer const_pointer;
- typedef typename _Priv_Rep_type::reference reference;
- typedef typename _Priv_Rep_type::const_reference const_reference;
- typedef typename _Priv_Rep_type::iterator iterator;
- typedef typename _Priv_Rep_type::const_iterator const_iterator;
- typedef typename _Priv_Rep_type::reverse_iterator reverse_iterator;
- typedef typename _Priv_Rep_type::const_reverse_iterator const_reverse_iterator;
- typedef typename _Priv_Rep_type::size_type size_type;
- typedef typename _Priv_Rep_type::difference_type difference_type;
- typedef typename _Priv_Rep_type::allocator_type allocator_type;
-
-private:
- _Rep_type _M_t; // red-black tree representing set
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-#if defined (_STLP_DEBUG)
- static iterator _S_to_value_ite(const_base_iterator __ite)
- { return iterator(__ite._Owner(), __ite._M_iterator._M_node); }
- static base_iterator _S_to_storage_ite(const_iterator __ite)
- { return base_iterator(__ite._Owner(), __ite._M_iterator._M_node); }
-#else
- static iterator _S_to_value_ite(const_base_iterator __ite)
- { return iterator(__ite._M_node); }
- static base_iterator _S_to_storage_ite(const_iterator __ite)
- { return base_iterator(__ite._M_node); }
-#endif
-
-public:
- set() : _M_t(_CompareStorageType(), _StorageTypeAlloc()) {}
- explicit set(const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- set(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), _StorageTypeAlloc()) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- _M_t.insert_unique(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
-# else
- _M_t.insert_unique(__first, __last);
-# endif
- }
-
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- set(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
- : _M_t(__comp, _StorageTypeAlloc()) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- _M_t.insert_unique(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
-# else
- _M_t.insert_unique(__first, __last);
-# endif
- }
-# endif
- template <class _InputIterator>
- set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- _M_t.insert_unique(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
-# else
- _M_t.insert_unique(__first, __last);
-# endif
- }
-#else
- set(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), _StorageTypeAlloc()) {
- _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last));
- }
-
- set(const value_type* __first, const value_type* __last,
- const _Compare& __comp, const allocator_type& __a = allocator_type())
- : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
- _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last));
- }
-
- set(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), _StorageTypeAlloc())
- { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
-
- set(const_iterator __first, const_iterator __last,
- const _Compare& __comp, const allocator_type& __a = allocator_type())
- : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType))
- { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- set(const _Self& __x) : _M_t(__x._M_t) {}
-
- set(__move_source<_Self> src)
- : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
-
- _Self& operator=(const _Self& __x) {
- _M_t = __x._M_t;
- return *this;
- }
-
- // accessors:
- key_compare key_comp() const { return _M_t.key_comp(); }
- value_compare value_comp() const { return _M_t.key_comp(); }
- allocator_type get_allocator() const
- { return _STLP_CONVERT_ALLOCATOR(_M_t.get_allocator(), value_type); }
-
- iterator begin() { return _S_to_value_ite(_M_t.begin()); }
- iterator end() { return _S_to_value_ite(_M_t.end()); }
- const_iterator begin() const { return _S_to_value_ite(_M_t.begin()); }
- const_iterator end() const { return _S_to_value_ite(_M_t.end()); }
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
- const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
- bool empty() const { return _M_t.empty(); }
- size_type size() const { return _M_t.size(); }
- size_type max_size() const { return _M_t.max_size(); }
- void swap(_Self& __x) { _M_t.swap(__x._M_t); }
-
- // insert/erase
- pair<iterator,bool> insert(const value_type& __x) {
- pair<base_iterator, bool> ret = _M_t.insert_unique(cast_traits::to_storage_type_cref(__x));
- return pair<iterator, bool>(_S_to_value_ite(ret.first), ret.second);
- }
- iterator insert(iterator __pos, const value_type& __x)
- { return _S_to_value_ite(_M_t.insert_unique(_S_to_storage_ite(__pos), cast_traits::to_storage_type_cref(__x))); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(_InputIterator __first, _InputIterator __last) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- _M_t.insert_unique(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
-# else
- _M_t.insert_unique(__first, __last);
-# endif
- }
-#else
- void insert(const_iterator __first, const_iterator __last)
- { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
- void insert(const value_type* __first, const value_type* __last) {
- _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last));
- }
-#endif
- void erase(iterator __pos)
- { _M_t.erase(_S_to_storage_ite(__pos)); }
- size_type erase(const key_type& __x)
- { return _M_t.erase_unique(cast_traits::to_storage_type_cref(__x)); }
- void erase(iterator __first, iterator __last)
- { _M_t.erase(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
- void clear() { _M_t.clear(); }
-
- // set operations:
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __x) const
- { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __x)
- { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __x) const
- { return _M_t.find(cast_traits::to_storage_type_crefT(__x)) == _M_t.end() ? 0 : 1; }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator lower_bound(const _KT& __x)
- { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator lower_bound(const _KT& __x) const
- { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator upper_bound(const _KT& __x)
- { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator upper_bound(const _KT& __x) const
- { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __x) {
- pair<base_iterator, base_iterator> __ret;
- __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x));
- return pair<iterator, iterator>(_S_to_value_ite(__ret.first),
- _S_to_value_ite(__ret.second));
- }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
- pair<const_base_iterator, const_base_iterator> __ret;
- __ret = _M_t.equal_range_unique(cast_traits::to_storage_type_crefT(__x));
- return pair<const_iterator, const_iterator>(_S_to_value_ite(__ret.first),
- _S_to_value_ite(__ret.second));
- }
-};
-
-//Specific iterator traits creation
-_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, Const_traits)
-
-template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
- _STLP_DEFAULT_ALLOCATOR_SELECT(_Key) >
-class multiset
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
- : public __stlport_class<multiset<_Key, _Compare, _Alloc> >
-#endif
-{
- typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare> _AssocStorageTypes;
- typedef typename _AssocStorageTypes::_KeyStorageType _KeyStorageType;
- typedef typename _AssocStorageTypes::_CompareStorageType _CompareStorageType;
- typedef typename _Alloc_traits<_KeyStorageType, _Alloc>::allocator_type _StorageTypeAlloc;
- typedef _STLP_PRIV _CastTraits<_KeyStorageType, _Key> cast_traits;
-
- typedef multiset<_Key, _Compare, _Alloc> _Self;
-public:
- // typedefs:
- typedef _Key key_type;
- typedef _Key value_type;
- typedef _Compare key_compare;
- typedef _Compare value_compare;
-
-protected:
- //Specific iterator traits creation
- typedef _STLP_PRIV _MultisetTraitsT<value_type> _MultisetTraits;
- typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
- value_type, _STLP_PRIV _Identity<value_type>,
- _MultisetTraits, _Alloc> _Priv_Rep_type;
-
- typedef _STLP_PRIV _MultisetTraitsT<_KeyStorageType> _MultisetStorageTraits;
-public:
- //dums: need the following public for the __move_traits framework
- typedef _STLP_PRIV _Rb_tree<_KeyStorageType, _CompareStorageType,
- _KeyStorageType, _STLP_PRIV _Identity<_KeyStorageType>,
- _MultisetStorageTraits, _StorageTypeAlloc> _Rep_type;
-
-private:
- typedef typename _Rep_type::iterator base_iterator;
- typedef typename _Rep_type::const_iterator const_base_iterator;
-
-public:
- typedef typename _Priv_Rep_type::pointer pointer;
- typedef typename _Priv_Rep_type::const_pointer const_pointer;
- typedef typename _Priv_Rep_type::reference reference;
- typedef typename _Priv_Rep_type::const_reference const_reference;
- typedef typename _Priv_Rep_type::iterator iterator;
- typedef typename _Priv_Rep_type::const_iterator const_iterator;
- typedef typename _Priv_Rep_type::reverse_iterator reverse_iterator;
- typedef typename _Priv_Rep_type::const_reverse_iterator const_reverse_iterator;
- typedef typename _Priv_Rep_type::size_type size_type;
- typedef typename _Priv_Rep_type::difference_type difference_type;
- typedef typename _Priv_Rep_type::allocator_type allocator_type;
-
-private:
- _Rep_type _M_t; // red-black tree representing multiset
- _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
-
-#if defined (_STLP_DEBUG)
- static iterator _S_to_value_ite(const_base_iterator __ite)
- { return iterator(__ite._Owner(), __ite._M_iterator._M_node); }
- static base_iterator _S_to_storage_ite(const_iterator __ite)
- { return base_iterator(__ite._Owner(), __ite._M_iterator._M_node); }
-#else
- static iterator _S_to_value_ite(const_base_iterator __ite)
- { return iterator(__ite._M_node); }
- static base_iterator _S_to_storage_ite(const_iterator __ite)
- { return base_iterator(__ite._M_node); }
-#endif
-
-public:
- multiset() : _M_t(_Compare(), _StorageTypeAlloc()) {}
- explicit multiset(const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- multiset(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), _StorageTypeAlloc()) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- _M_t.insert_equal(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
-# else
- _M_t.insert_equal(__first, __last);
-# endif
- }
-
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- multiset(_InputIterator __first, _InputIterator __last,
- const _Compare& __comp)
- : _M_t(__comp, _StorageTypeAlloc()) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- _M_t.insert_equal(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
-# else
- _M_t.insert_equal(__first, __last);
-# endif
- }
-# endif
- template <class _InputIterator>
- multiset(_InputIterator __first, _InputIterator __last,
- const _Compare& __comp,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
- : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- _M_t.insert_equal(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
-# else
- _M_t.insert_equal(__first, __last);
-# endif
- }
-
-#else
- multiset(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), _StorageTypeAlloc()) {
- _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last));
- }
-
- multiset(const value_type* __first, const value_type* __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
- _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last));
- }
-
- multiset(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), _StorageTypeAlloc())
- { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
-
- multiset(const_iterator __first, const_iterator __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType))
- { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- multiset(const _Self& __x)
- : _M_t(__x._M_t) {}
-
- _Self& operator=(const _Self& __x) {
- _M_t = __x._M_t;
- return *this;
- }
-
- multiset(__move_source<_Self> src)
- : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
-
- // accessors:
- key_compare key_comp() const { return _M_t.key_comp(); }
- value_compare value_comp() const { return _M_t.key_comp(); }
- allocator_type get_allocator() const
- { return _STLP_CONVERT_ALLOCATOR(_M_t.get_allocator(), value_type); }
-
- iterator begin() { return _S_to_value_ite(_M_t.begin()); }
- iterator end() { return _S_to_value_ite(_M_t.end()); }
- const_iterator begin() const { return _S_to_value_ite(_M_t.begin()); }
- const_iterator end() const { return _S_to_value_ite(_M_t.end()); }
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
- const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
- bool empty() const { return _M_t.empty(); }
- size_type size() const { return _M_t.size(); }
- size_type max_size() const { return _M_t.max_size(); }
- void swap(_Self& __x) { _M_t.swap(__x._M_t); }
-
- // insert/erase
- iterator insert(const value_type& __x)
- { return _S_to_value_ite(_M_t.insert_equal(cast_traits::to_storage_type_cref(__x))); }
- iterator insert(iterator __pos, const value_type& __x) {
- return _S_to_value_ite(_M_t.insert_equal(_S_to_storage_ite(__pos),
- cast_traits::to_storage_type_cref(__x)));
- }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(_InputIterator __first, _InputIterator __last) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- _M_t.insert_equal(typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
-# else
- _M_t.insert_equal(__first, __last);
-# endif
- }
-#else
- void insert(const value_type* __first, const value_type* __last) {
- _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last));
- }
- void insert(const_iterator __first, const_iterator __last)
- { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- void erase(iterator __pos)
- { _M_t.erase(_S_to_storage_ite(__pos)); }
- size_type erase(const key_type& __x)
- { return _M_t.erase(cast_traits::to_storage_type_cref(__x)); }
- void erase(iterator __first, iterator __last)
- { _M_t.erase(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
- void clear() { _M_t.clear(); }
-
- // multiset operations:
-
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator find(const _KT& __x)
- { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator find(const _KT& __x) const
- { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- size_type count(const _KT& __x) const
- { return _M_t.count(cast_traits::to_storage_type_crefT(__x)); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator lower_bound(const _KT& __x)
- { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator lower_bound(const _KT& __x) const
- { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- iterator upper_bound(const _KT& __x)
- { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- const_iterator upper_bound(const _KT& __x) const
- { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<iterator, iterator> equal_range(const _KT& __x) {
- pair<base_iterator, base_iterator> __ret;
- __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x));
- return pair<iterator, iterator>(_S_to_value_ite(__ret.first),
- _S_to_value_ite(__ret.second));
- }
- _STLP_TEMPLATE_FOR_CONT_EXT
- pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
- pair<const_base_iterator, const_base_iterator> __ret;
- __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x));
- return pair<const_iterator, const_iterator>(_S_to_value_ite(__ret.first),
- _S_to_value_ite(__ret.second));
- }
-};
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_PTR_SPECIALIZED_SET_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/pointers/_slist.h b/stl/pointers/_slist.h
deleted file mode 100644
index 93ff211..0000000
--- a/stl/pointers/_slist.h
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Copyright (c) 2003
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_SPECIALIZED_SLIST_H
-#define _STLP_SPECIALIZED_SLIST_H
-
-#ifndef _STLP_POINTERS_SPEC_TOOLS_H
-# include <stl/pointers/_tools.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#define SLIST_IMPL _STLP_PTR_IMPL_NAME(slist)
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-_STLP_EXPORT_TEMPLATE_CLASS _Slist_node<void*>;
-typedef _Slist_node<void*> _VoidPtrSNode;
-_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Slist_node_base, _VoidPtrSNode, allocator<_VoidPtrSNode> >;
-_STLP_EXPORT_TEMPLATE_CLASS _Slist_base<void*, allocator<void*> >;
-_STLP_EXPORT_TEMPLATE_CLASS SLIST_IMPL<void*, allocator<void*> >;
-
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-#if defined (_STLP_DEBUG)
-# define slist _STLP_NON_DBG_NAME(slist)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
-class slist
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (slist)
- : public __stlport_class<slist<_Tp, _Alloc> >
-#endif
-{
- typedef typename _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
- typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
- typedef _STLP_PRIV SLIST_IMPL<_StorageType, _StorageTypeAlloc> _Base;
- typedef typename _Base::iterator _BaseIte;
- typedef typename _Base::const_iterator _BaseConstIte;
- typedef slist<_Tp, _Alloc> _Self;
- typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
- typedef _STLP_PRIV _Slist_node_base _Node_base;
-
-public:
- typedef _Tp value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef forward_iterator_tag _Iterator_category;
-
- typedef _STLP_PRIV _Slist_iterator<value_type, _Nonconst_traits<value_type> > iterator;
- typedef _STLP_PRIV _Slist_iterator<value_type, _Const_traits<value_type> > const_iterator;
-
- _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
- typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
-
-public:
- allocator_type get_allocator() const
- { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
-
- explicit slist(const allocator_type& __a = allocator_type())
- : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit slist(size_type __n, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type),
-#else
- slist(size_type __n, const value_type& __x,
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- const allocator_type& __a = allocator_type())
- : _M_impl(__n, cast_traits::to_storage_type_cref(__x), _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit slist(size_type __n) : _M_impl(__n) {}
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- // We don't need any dispatching tricks here, because _M_insert_after_range
- // already does them.
- template <class _InputIterator>
- slist(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
-# if !defined (_STLP_USE_ITERATOR_WRAPPER)
- : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-# else
- : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
- insert_after(before_begin(), __first, __last);
- }
-# endif
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- // VC++ needs this crazyness
- template <class _InputIterator>
- slist(_InputIterator __first, _InputIterator __last)
-# if !defined (_STLP_USE_WRAPPER_ITERATOR)
- : _M_impl(__first, __last) {}
-# else
- { insert_after(before_begin(), __first, __last); }
-# endif
-# endif
-#else /* _STLP_MEMBER_TEMPLATES */
- slist(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type() )
- : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node),
- _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
- slist(const value_type* __first, const value_type* __last,
- const allocator_type& __a = allocator_type())
- : _M_impl(cast_traits::to_storage_type_cptr(__first), cast_traits::to_storage_type_cptr(__last),
- _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- slist(const _Self& __x) : _M_impl(__x._M_impl) {}
- slist(__move_source<_Self> src)
- : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
-
- _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; }
-
- void assign(size_type __n, const value_type& __val)
- { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
-private:
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val,
- const __true_type&)
- { _M_impl.assign(__n, __val); }
-
- template <class _InputIterator>
- void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
- const __false_type&) {
- _M_impl.assign(typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
- }
-
-public:
-# endif
-
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
-# else
- _M_impl.assign(__first, __last);
-# endif
- }
-#else
- void assign(const value_type *__first, const value_type *__last) {
- _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last));
- }
- void assign(const_iterator __first, const_iterator __last) {
- _M_impl.assign(_BaseConstIte(__first._M_node),
- _BaseConstIte(__last._M_node));
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- iterator before_begin() { return iterator(_M_impl.before_begin()._M_node); }
- const_iterator before_begin() const { return const_iterator(const_cast<_Node_base*>(_M_impl.before_begin()._M_node)); }
-
- iterator begin() { return iterator(_M_impl.begin()._M_node); }
- const_iterator begin() const { return const_iterator(const_cast<_Node_base*>(_M_impl.begin()._M_node));}
-
- iterator end() { return iterator(_M_impl.end()._M_node); }
- const_iterator end() const { return iterator(_M_impl.end()._M_node); }
-
- size_type size() const { return _M_impl.size(); }
- size_type max_size() const { return _M_impl.max_size(); }
- bool empty() const { return _M_impl.empty(); }
-
- void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
-
-public:
- reference front() { return *begin(); }
- const_reference front() const { return *begin(); }
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
- void push_front(const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- void push_front(const value_type& __x)
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); }
-
-# if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
- void push_front() { _M_impl.push_front();}
-# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
- void pop_front() { _M_impl.pop_front(); }
-
- iterator previous(const_iterator __pos)
- { return iterator(_M_impl.previous(_BaseConstIte(__pos._M_node))._M_node); }
- const_iterator previous(const_iterator __pos) const
- { return const_iterator(const_cast<_Node_base*>(_M_impl.previous(_BaseConstIte(__pos._M_node))._M_node)); }
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert_after(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- iterator insert_after(iterator __pos, const value_type& __x)
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- { return iterator(_M_impl.insert_after(_BaseIte(__pos._M_node),
- cast_traits::to_storage_type_cref(__x))._M_node); }
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert_after(iterator __pos)
- { return iterator(_M_impl.insert_after(_BaseIte(__pos._M_node))._M_node);}
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- void insert_after(iterator __pos, size_type __n, const value_type& __x)
- { _M_impl.insert_after(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
-private:
- template <class _Integer>
- void _M_insert_after_dispatch(iterator __pos, _Integer __n, _Integer __val,
- const __true_type&) {
- _M_impl.insert_after(_BaseIte(__pos._M_node), __n, __val);
- }
-
- template <class _InputIterator>
- void _M_insert_after_dispatch(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- const __false_type&) {
- _M_impl.insert_after(_BaseIte(__pos._M_node),
- typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
- }
-
-public:
-# endif
-
- template <class _InputIterator>
- void insert_after(iterator __pos, _InputIterator __first, _InputIterator __last) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- // Check whether it's an integral type. If so, it's not an iterator.
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_insert_after_dispatch(__pos, __first, __last, _Integral());
-# else
- _M_impl.insert_after(_BaseIte(__pos._M_node), __first, __last);
-# endif
- }
-
-#else /* _STLP_MEMBER_TEMPLATES */
- void insert_after(iterator __pos,
- const_iterator __first, const_iterator __last)
- { _M_impl.insert_after(_BaseIte(__pos._M_node),
- _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
- void insert_after(iterator __pos,
- const value_type* __first, const value_type* __last) {
- _M_impl.insert_after(_BaseIte(__pos._M_node),
- cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last));
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- iterator insert(iterator __pos, const value_type& __x)
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- { return iterator(_M_impl.insert(_BaseIte(__pos._M_node),
- cast_traits::to_storage_type_cref(__x))._M_node); }
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- iterator insert(iterator __pos)
- { return iterator(_M_impl.insert(_BaseIte(__pos._M_node))._M_node); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- void insert(iterator __pos, size_type __n, const value_type& __x)
- { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
-private:
- template <class _Integer>
- void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
- const __true_type&) {
- _M_impl.insert(_BaseIte(__pos._M_node), __n, __val);
- }
-
- template <class _InputIterator>
- void _M_insert_dispatch(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- const __false_type&) {
- _M_impl.insert(_BaseIte(__pos._M_node), typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
- typename _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
- }
-
-public:
-# endif
-
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
-# if defined (_STLP_USE_ITERATOR_WRAPPER)
- // Check whether it's an integral type. If so, it's not an iterator.
- typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
- _M_insert_dispatch(__pos, __first, __last, _Integral());
-# else
- _M_impl.insert(_BaseIte(__pos._M_node), __first, __last);
-# endif
- }
-
-#else /* _STLP_MEMBER_TEMPLATES */
- void insert(iterator __pos, const_iterator __first, const_iterator __last)
- { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
- void insert(iterator __pos, const value_type* __first, const value_type* __last)
- { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last)); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- iterator erase_after(iterator __pos)
- { return iterator(_M_impl.erase_after(_BaseIte(__pos._M_node))._M_node); }
- iterator erase_after(iterator __before_first, iterator __last)
- { return iterator(_M_impl.erase_after(_BaseIte(__before_first._M_node),
- _BaseIte(__last._M_node))._M_node); }
-
- iterator erase(iterator __pos)
- { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); }
- iterator erase(iterator __first, iterator __last)
- { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); }
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- void resize(size_type __new_size, const value_type& __x)
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));}
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size) { _M_impl.resize(__new_size); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- void clear() { _M_impl.clear(); }
-
- void splice_after(iterator __pos, _Self& __x,
- iterator __before_first, iterator __before_last)
- { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl,
- _BaseIte(__before_first._M_node), _BaseIte(__before_last._M_node)); }
- void splice_after(iterator __pos, _Self& __x, iterator __prev)
- { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__prev._M_node)); }
- void splice_after(iterator __pos, _Self& __x)
- { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl); }
- void splice(iterator __pos, _Self& __x)
- { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); }
- void splice(iterator __pos, _Self& __x, iterator __i)
- { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); }
- void splice(iterator __pos, _Self& __x, iterator __first, iterator __last)
- { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl,
- _BaseIte(__first._M_node), _BaseIte(__last._M_node)); }
-
- void reverse() { _M_impl.reverse(); }
-
- void remove(const value_type& __val) { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); }
- void unique() { _M_impl.unique(); }
- void merge(_Self& __x) { _M_impl.merge(__x._M_impl); }
- void sort() {_M_impl.sort(); }
-
-#ifdef _STLP_MEMBER_TEMPLATES
- template <class _Predicate>
- void remove_if(_Predicate __pred)
- { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); }
-
- template <class _BinaryPredicate>
- void unique(_BinaryPredicate __pred)
- { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__pred)); }
-
- template <class _StrictWeakOrdering>
- void merge(_Self& __x, _StrictWeakOrdering __comp)
- { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
-
- template <class _StrictWeakOrdering>
- void sort(_StrictWeakOrdering __comp)
- { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-private:
- _Base _M_impl;
-};
-
-#if defined (slist)
-# undef slist
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-#undef SLIST_IMPL
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_SPECIALIZED_SLIST_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stl/pointers/_tools.h b/stl/pointers/_tools.h
deleted file mode 100644
index e02fc42..0000000
--- a/stl/pointers/_tools.h
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * Copyright (c) 2003
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_POINTERS_SPEC_TOOLS_H
-#define _STLP_POINTERS_SPEC_TOOLS_H
-
-#ifndef _STLP_TYPE_TRAITS_H
-# include <stl/type_traits.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-//Some usefull declarations:
-template <class _Tp> struct less;
-
-_STLP_MOVE_TO_PRIV_NAMESPACE
-
-template <class _StorageT, class _ValueT, class _BinaryPredicate>
-struct _BinaryPredWrapper;
-
-/*
- * Since the compiler only allows at most one non-trivial
- * implicit conversion we can make use of a shim class to
- * be sure that functions below doesn't accept classes with
- * implicit pointer conversion operators
- */
-struct _ConstVolatileVoidPointerShim
-{ _ConstVolatileVoidPointerShim(const volatile void*); };
-
-//The dispatch functions:
-struct _VoidPointerShim
-{ _VoidPointerShim(void*); };
-struct _ConstVoidPointerShim
-{ _ConstVoidPointerShim(const void*); };
-struct _VolatileVoidPointerShim
-{ _VolatileVoidPointerShim(volatile void*); };
-
-template <class _Tp>
-char _UseVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
-char _UseVoidPtrStorageType(const __true_type& /*POD*/, ...);
-char* _UseVoidPtrStorageType(const __true_type& /*POD*/, _VoidPointerShim);
-
-template <class _Tp>
-char _UseConstVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
-char _UseConstVoidPtrStorageType(const __true_type& /*POD*/, ...);
-char* _UseConstVoidPtrStorageType(const __true_type& /*POD*/, _ConstVoidPointerShim);
-
-template <class _Tp>
-char _UseVolatileVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
-char _UseVolatileVoidPtrStorageType(const __true_type& /*POD*/, ...);
-char* _UseVolatileVoidPtrStorageType(const __true_type& /*POD*/, _VolatileVoidPointerShim);
-
-template <class _Tp>
-char _UseConstVolatileVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
-char _UseConstVolatileVoidPtrStorageType(const __true_type& /*POD*/, ...);
-char* _UseConstVolatileVoidPtrStorageType(const __true_type& /*POD*/, _ConstVolatileVoidPointerShim);
-
-template <class _Tp>
-struct _StorageType {
- typedef typename __type_traits<_Tp>::is_POD_type _PODType;
- static _Tp __null_rep();
-
- enum { use_void_ptr = (sizeof(_UseVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
- enum { use_const_void_ptr = (sizeof(_UseConstVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
- enum { use_volatile_void_ptr = (sizeof(_UseVolatileVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
- enum { use_const_volatile_void_ptr = (sizeof(_UseConstVolatileVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
-
- typedef typename __select<!use_const_volatile_void_ptr,
- _Tp,
- typename __select<use_void_ptr,
- void*,
- typename __select<use_const_void_ptr,
- const void*,
- typename __select<use_volatile_void_ptr,
- volatile void*,
- const volatile void*>::_Ret >::_Ret >::_Ret >::_Ret _QualifiedType;
-
-#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
- /* If the compiler do not support the iterator_traits structure we cannot wrap
- * iterators pass to container template methods. The iterator dereferenced value
- * has to be storable without any cast in the chosen storage type. To guaranty
- * that the void pointer has to be correctly qualified.
- */
- typedef _QualifiedType _Type;
-#else
- /* With iterator_traits we can wrap passed iterators and make the necessary casts.
- * We can always use a simple void* storage type:
- */
- typedef typename __select<use_const_volatile_void_ptr,
- void*,
- _Tp>::_Ret _Type;
-#endif
-};
-
-template <class _Tp, class _Compare>
-struct _AssocStorageTypes {
- typedef _StorageType<_Tp> _StorageTypeInfo;
- typedef typename _StorageTypeInfo::_Type _SType;
-
- //We need to also check that the comparison functor used to instanciate the assoc container
- //is the default Standard less implementation:
- typedef typename _IsSTLportClass<_Compare>::_Ret _STLportLess;
- enum { is_default_less = __type2bool<_STLportLess>::_Ret };
-
- typedef typename __select<is_default_less, _SType, _Tp>::_Ret _KeyStorageType;
- enum { ptr_type = _StorageTypeInfo::use_const_volatile_void_ptr };
- typedef typename __select<is_default_less && ptr_type,
- _BinaryPredWrapper<_KeyStorageType, _Tp, _Compare>,
- _Compare>::_Ret _CompareStorageType;
-};
-
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-/*
- * Base struct to deal with qualifiers
- */
-template <class _StorageT, class _QualifiedStorageT>
-struct _VoidCastTraitsAux {
- typedef _QualifiedStorageT void_cv_type;
- typedef _StorageT void_type;
-
- static void_type * uncv_ptr(void_cv_type *__ptr)
- { return __ptr; }
- static void_type const* uncv_cptr(void_cv_type const*__ptr)
- { return __ptr; }
- static void_type ** uncv_pptr(void_cv_type **__ptr)
- { return __ptr; }
- static void_type & uncv_ref(void_cv_type & __ref)
- { return __ref; }
- static void_type const& uncv_cref(void_cv_type const& __ref)
- { return __ref; }
- static void_cv_type* cv_ptr(void_type *__ptr)
- { return __ptr; }
- static void_cv_type const* cv_cptr(void_type const*__ptr)
- { return __ptr; }
- static void_cv_type ** cv_pptr(void_type **__ptr)
- { return __ptr; }
- static void_cv_type & cv_ref(void_type & __ref)
- { return __ref; }
- static void_cv_type const& cv_cref(void_type const& __ref)
- { return __ref; }
-};
-
-template <class _VoidCVType>
-struct _VoidCastTraitsAuxBase {
- typedef _VoidCVType* void_cv_type;
- typedef void* void_type;
-
- static void_type* uncv_ptr(void_cv_type *__ptr)
- { return __CONST_CAST(void_type*, __ptr); }
- static void_type const* uncv_cptr(void_cv_type const*__ptr)
- { return __CONST_CAST(void_type const*, __ptr); }
- static void_type** uncv_pptr(void_cv_type **__ptr)
- { return __CONST_CAST(void_type**, __ptr); }
- static void_type& uncv_ref(void_cv_type &__ref)
- { return __CONST_CAST(void_type&, __ref); }
- static void_type const& uncv_cref(void_cv_type const& __ptr)
- { return __CONST_CAST(void_type const&, __ptr); }
- // The reverse versions
- static void_cv_type * cv_ptr(void_type *__ptr)
- { return __CONST_CAST(void_cv_type *, __ptr); }
- static void_cv_type const* cv_cptr(void_type const*__ptr)
- { return __CONST_CAST(void_cv_type const*, __ptr); }
- static void_cv_type ** cv_pptr(void_type **__ptr)
- { return __CONST_CAST(void_cv_type**, __ptr); }
- static void_cv_type & cv_ref(void_type &__ref)
- { return __CONST_CAST(void_cv_type &, __ref); }
- static void_cv_type const& cv_cref(void_type const& __ref)
- { return __CONST_CAST(void_cv_type const&, __ref); }
-};
-
-_STLP_TEMPLATE_NULL
-struct _VoidCastTraitsAux<void*, const void*> : _VoidCastTraitsAuxBase<void const>
-{};
-_STLP_TEMPLATE_NULL
-struct _VoidCastTraitsAux<void*, volatile void*> : _VoidCastTraitsAuxBase<void volatile>
-{};
-_STLP_TEMPLATE_NULL
-struct _VoidCastTraitsAux<void*, const volatile void*> : _VoidCastTraitsAuxBase<void const volatile>
-{};
-
-template <class _StorageT, class _ValueT>
-struct _CastTraits {
- typedef _ValueT value_type;
- typedef typename _StorageType<_ValueT>::_QualifiedType _QualifiedStorageT;
- typedef _VoidCastTraitsAux<_StorageT, _QualifiedStorageT> cv_traits;
- typedef typename cv_traits::void_type void_type;
- typedef typename cv_traits::void_cv_type void_cv_type;
-
- static value_type * to_value_type_ptr(void_type *__ptr)
- { return __REINTERPRET_CAST(value_type *, cv_traits::cv_ptr(__ptr)); }
- static value_type const* to_value_type_cptr(void_type const*__ptr)
- { return __REINTERPRET_CAST(value_type const*, cv_traits::cv_cptr(__ptr)); }
- static value_type ** to_value_type_pptr(void_type **__ptr)
- { return __REINTERPRET_CAST(value_type **, cv_traits::cv_pptr(__ptr)); }
- static value_type & to_value_type_ref(void_type &__ref)
- { return __REINTERPRET_CAST(value_type &, cv_traits::cv_ref(__ref)); }
- static value_type const& to_value_type_cref(void_type const& __ptr)
- { return __REINTERPRET_CAST(value_type const&, cv_traits::cv_cref(__ptr)); }
- // Reverse versions
- static void_type * to_storage_type_ptr(value_type *__ptr)
- { return cv_traits::uncv_ptr(__REINTERPRET_CAST(void_cv_type *, __ptr)); }
- static void_type const* to_storage_type_cptr(value_type const*__ptr)
- { return cv_traits::uncv_cptr(__REINTERPRET_CAST(void_cv_type const*, __ptr)); }
- static void_type ** to_storage_type_pptr(value_type **__ptr)
- { return cv_traits::uncv_pptr(__REINTERPRET_CAST(void_cv_type **, __ptr)); }
- static void_type const& to_storage_type_cref(value_type const& __ref)
- { return cv_traits::uncv_cref(__REINTERPRET_CAST(void_cv_type const&, __ref)); }
-
- //Method used to treat set container template method extension
- static void_type const& to_storage_type_crefT(value_type const& __ref)
- { return to_storage_type_cref(__ref); }
-};
-
-template <class _Tp>
-struct _CastTraits<_Tp, _Tp> {
- typedef _Tp storage_type;
- typedef _Tp value_type;
-
- static value_type * to_value_type_ptr(storage_type *__ptr)
- { return __ptr; }
- static value_type const* to_value_type_cptr(storage_type const*__ptr)
- { return __ptr; }
- static value_type ** to_value_type_pptr(storage_type **__ptr)
- { return __ptr; }
- static value_type & to_value_type_ref(storage_type &__ref)
- { return __ref; }
- static value_type const& to_value_type_cref(storage_type const&__ref)
- { return __ref; }
- // Reverse versions
- static storage_type * to_storage_type_ptr(value_type *__ptr)
- { return __ptr; }
- static storage_type const* to_storage_type_cptr(value_type const*__ptr)
- { return __ptr; }
- static storage_type ** to_storage_type_pptr(value_type **__ptr)
- { return __ptr; }
- static storage_type const& to_storage_type_cref(value_type const& __ref)
- { return __ref; }
-
- //Method used to treat set container template method extension
- template <class _Tp1>
- static _Tp1 const& to_storage_type_crefT(_Tp1 const& __ref)
- { return __ref; }
-};
-
-#define _STLP_USE_ITERATOR_WRAPPER
-
-template <class _StorageT, class _ValueT, class _Iterator>
-struct _IteWrapper {
- typedef _CastTraits<_StorageT, _ValueT> cast_traits;
- typedef iterator_traits<_Iterator> _IteTraits;
-
- typedef typename _IteTraits::iterator_category iterator_category;
- typedef _StorageT value_type;
- typedef typename _IteTraits::difference_type difference_type;
- typedef value_type* pointer;
- typedef value_type const& const_reference;
- //This wrapper won't be used for input so to avoid surprise
- //the reference type will be a const reference:
- typedef const_reference reference;
-
- typedef _IteWrapper<_StorageT, _ValueT, _Iterator> _Self;
- typedef _Self _Ite;
-
- _IteWrapper(_Iterator &__ite) : _M_ite(__ite) {}
-
- const_reference operator*() const { return cast_traits::to_storage_type_cref(*_M_ite); }
-
- _Self& operator= (_Self const& __rhs) {
- _M_ite = __rhs._M_ite;
- return *this;
- }
-
- _Self& operator++() {
- ++_M_ite;
- return *this;
- }
-
- _Self& operator--() {
- --_M_ite;
- return *this;
- }
-
- _Self& operator += (difference_type __offset) {
- _M_ite += __offset;
- return *this;
- }
- difference_type operator -(_Self const& __other) const
- { return _M_ite - __other._M_ite; }
-
- bool operator == (_Self const& __other) const
- { return _M_ite == __other._M_ite; }
-
- bool operator != (_Self const& __other) const
- { return _M_ite != __other._M_ite; }
-
- bool operator < (_Self const& __rhs) const
- { return _M_ite < __rhs._M_ite; }
-
-private:
- _Iterator _M_ite;
-};
-
-template <class _Tp, class _Iterator>
-struct _IteWrapper<_Tp, _Tp, _Iterator>
-{ typedef _Iterator _Ite; };
-
-#else
-
-/*
- * In this config the storage type is qualified in respect of the
- * value_type qualification. Simple reinterpret_cast is enough.
- */
-template <class _StorageT, class _ValueT>
-struct _CastTraits {
- typedef _StorageT storage_type;
- typedef _ValueT value_type;
-
- static value_type * to_value_type_ptr(storage_type *__ptr)
- { return __REINTERPRET_CAST(value_type*, __ptr); }
- static value_type const* to_value_type_cptr(storage_type const*__ptr)
- { return __REINTERPRET_CAST(value_type const*, __ptr); }
- static value_type ** to_value_type_pptr(storage_type **__ptr)
- { return __REINTERPRET_CAST(value_type **, __ptr); }
- static value_type & to_value_type_ref(storage_type &__ref)
- { return __REINTERPRET_CAST(value_type&, __ref); }
- static value_type const& to_value_type_cref(storage_type const&__ref)
- { return __REINTERPRET_CAST(value_type const&, __ref); }
- // Reverse versions
- static storage_type * to_storage_type_ptr(value_type *__ptr)
- { return __REINTERPRET_CAST(storage_type*, __ptr); }
- static storage_type const* to_storage_type_cptr(value_type const*__ptr)
- { return __REINTERPRET_CAST(storage_type const*, __ptr); }
- static storage_type ** to_storage_type_pptr(value_type **__ptr)
- { return __REINTERPRET_CAST(storage_type **, __ptr); }
- static storage_type const& to_storage_type_cref(value_type const&__ref)
- { return __REINTERPRET_CAST(storage_type const&, __ref); }
- template <class _Tp1>
- static _Tp1 const& to_storage_type_crefT(_Tp1 const& __ref)
- { return __ref; }
-};
-
-#endif
-
-//Wrapper functors:
-template <class _StorageT, class _ValueT, class _UnaryPredicate>
-struct _UnaryPredWrapper {
- typedef _CastTraits<_StorageT, _ValueT> cast_traits;
-
- _UnaryPredWrapper (_UnaryPredicate const& __pred) : _M_pred(__pred) {}
-
- bool operator () (_StorageT const& __ref) const
- { return _M_pred(cast_traits::to_value_type_cref(__ref)); }
-
-private:
- _UnaryPredicate _M_pred;
-};
-
-template <class _StorageT, class _ValueT, class _BinaryPredicate>
-struct _BinaryPredWrapper {
- typedef _CastTraits<_StorageT, _ValueT> cast_traits;
-
- _BinaryPredWrapper () {}
- _BinaryPredWrapper (_BinaryPredicate const& __pred) : _M_pred(__pred) {}
-
- _BinaryPredicate get_pred() const { return _M_pred; }
-
- bool operator () (_StorageT const& __fst, _StorageT const& __snd) const
- { return _M_pred(cast_traits::to_value_type_cref(__fst), cast_traits::to_value_type_cref(__snd)); }
-
- //Cast operator used to transparently access underlying predicate
- //in set::key_comp() method
- operator _BinaryPredicate() const
- { return _M_pred; }
-
-private:
- _BinaryPredicate _M_pred;
-};
-
-_STLP_MOVE_TO_STD_NAMESPACE
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_POINTERS_SPEC_TOOLS_H */
diff --git a/stl/pointers/_vector.h b/stl/pointers/_vector.h
deleted file mode 100644
index 8de4c00..0000000
--- a/stl/pointers/_vector.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2003
- * Francois Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _STLP_SPECIALIZED_VECTOR_H
-#define _STLP_SPECIALIZED_VECTOR_H
-
-#ifndef _STLP_POINTERS_SPEC_TOOLS_H
-# include <stl/pointers/_tools.h>
-#endif
-
-_STLP_BEGIN_NAMESPACE
-
-#define VECTOR_IMPL _STLP_PTR_IMPL_NAME(vector)
-
-#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
-_STLP_EXPORT_TEMPLATE_CLASS _STLP_PRIV _Vector_base<void*,allocator<void*> >;
-_STLP_EXPORT_TEMPLATE_CLASS _STLP_PRIV VECTOR_IMPL<void*, allocator<void*> >;
-#endif
-
-#if defined (_STLP_DEBUG)
-# define vector _STLP_NON_DBG_NAME(vector)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-#endif
-
-template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) >
-class vector
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (vector)
- : public __stlport_class<vector<_Tp, _Alloc> >
-#endif
-{
- /* In the vector implementation iterators are pointer which give a number
- * of opportunities for optimization. To not break those optimizations
- * iterators passed to template should not be wrapped for casting purpose.
- * So vector implementation will always use a qualified void pointer type and
- * won't use iterator wrapping.
- */
- typedef typename _STLP_PRIV _StorageType<_Tp>::_QualifiedType _StorageType;
- typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
- typedef _STLP_PRIV VECTOR_IMPL<_StorageType, _StorageTypeAlloc> _Base;
- typedef vector<_Tp, _Alloc> _Self;
-
- typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
-
-public:
- typedef _Tp value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type* iterator;
- typedef const value_type* const_iterator;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef random_access_iterator_tag _Iterator_category;
-
- _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
- _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
- typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
-
- allocator_type get_allocator() const
- { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
-
- iterator begin() { return cast_traits::to_value_type_ptr(_M_impl.begin()); }
- const_iterator begin() const { return cast_traits::to_value_type_cptr(_M_impl.begin()); }
- iterator end() { return cast_traits::to_value_type_ptr(_M_impl.end()); }
- const_iterator end() const { return cast_traits::to_value_type_cptr(_M_impl.end()); }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
-
- size_type size() const { return _M_impl.size(); }
- size_type max_size() const { return _M_impl.max_size(); }
-
- size_type capacity() const { return _M_impl.capacity(); }
- bool empty() const { return _M_impl.empty(); }
-
- reference operator[](size_type __n) { return cast_traits::to_value_type_ref(_M_impl[__n]); }
- const_reference operator[](size_type __n) const { return cast_traits::to_value_type_cref(_M_impl[__n]); }
-
- reference front() { return cast_traits::to_value_type_ref(_M_impl.front()); }
- const_reference front() const { return cast_traits::to_value_type_cref(_M_impl.front()); }
- reference back() { return cast_traits::to_value_type_ref(_M_impl.back()); }
- const_reference back() const { return cast_traits::to_value_type_cref(_M_impl.back()); }
-
- reference at(size_type __n) { return cast_traits::to_value_type_ref(_M_impl.at(__n)); }
- const_reference at(size_type __n) const { return cast_traits::to_value_type_cref(_M_impl.at(__n)); }
-
- explicit vector(const allocator_type& __a = allocator_type())
- : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit vector(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
-#else
- vector(size_type __n, const value_type& __val,
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- const allocator_type& __a = allocator_type())
- : _M_impl(__n, cast_traits::to_storage_type_cref(__val),
- _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- explicit vector(size_type __n)
- : _M_impl(__n, allocator_type() ) {}
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- vector(const _Self& __x)
- : _M_impl(__x._M_impl) {}
-
- explicit vector(__move_source<_Self> src)
- : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- vector(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL )
- : _M_impl(__first, __last,
- _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-
-# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
- template <class _InputIterator>
- vector(_InputIterator __first, _InputIterator __last)
- : _M_impl(__first, __last) {}
-# endif
-
-#else
- vector(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type())
- : _M_impl(cast_traits::to_storage_type_cptr(__first), cast_traits::to_storage_type_cptr(__last),
- _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
-#endif /* _STLP_MEMBER_TEMPLATES */
-
- _Self& operator=(const _Self& __x) { _M_impl = __x._M_impl; return *this; }
-
- void reserve(size_type __n) {_M_impl.reserve(__n);}
- void assign(size_type __n, const value_type& __val)
- { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last)
- { _M_impl.assign(__first, __last); }
-#else
- void assign(const_iterator __first, const_iterator __last) {
- _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last));
- }
-#endif /* _STLP_MEMBER_TEMPLATES */
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
- void push_back(const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- void push_back(const value_type& __x)
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); }
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
- iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- iterator insert(iterator __pos, const value_type& __x)
-#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
- { return cast_traits::to_value_type_ptr(_M_impl.insert(cast_traits::to_storage_type_ptr(__pos),
- cast_traits::to_storage_type_cref(__x))); }
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
- void push_back() { _M_impl.push_back(); }
- iterator insert(iterator __pos)
- { return _M_impl.insert(cast_traits::to_storage_type_ptr(__pos)); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
-
- void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
-
-#if defined (_STLP_MEMBER_TEMPLATES)
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last)
- { _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), __first, __last); }
-#else
- void insert(iterator __pos, const_iterator __first, const_iterator __last) {
- _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), cast_traits::to_storage_type_cptr(__first),
- cast_traits::to_storage_type_cptr(__last));
- }
-#endif
-
- void insert (iterator __pos, size_type __n, const value_type& __x) {
- _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), __n, cast_traits::to_storage_type_cref(__x));
- }
-
- void pop_back() {_M_impl.pop_back();}
- iterator erase(iterator __pos)
- {return cast_traits::to_value_type_ptr(_M_impl.erase(cast_traits::to_storage_type_ptr(__pos)));}
- iterator erase(iterator __first, iterator __last) {
- return cast_traits::to_value_type_ptr(_M_impl.erase(cast_traits::to_storage_type_ptr(__first),
- cast_traits::to_storage_type_ptr(__last)));
- }
-
-#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
-#else
- void resize(size_type __new_size, const value_type& __x)
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
- { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); }
-
-#if defined(_STLP_DONT_SUP_DFLT_PARAM)
- void resize(size_type __new_size) { _M_impl.resize(__new_size); }
-#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
-
- void clear() { _M_impl.clear(); }
-
-private:
- _Base _M_impl;
-};
-
-#if defined (vector)
-# undef vector
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-#undef VECTOR_IMPL
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_SPECIALIZED_VECTOR_H */
diff --git a/stl/type_manips.h b/stl/type_manips.h
deleted file mode 100644
index 21960e0..0000000
--- a/stl/type_manips.h
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- *
- * Copyright (c) 2003
- * François Dumont
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-
-#ifndef _STLP_TYPE_MANIPS_H
-#define _STLP_TYPE_MANIPS_H
-
-_STLP_BEGIN_NAMESPACE
-
-struct __true_type {};
-struct __false_type {};
-
-#if defined (_STLP_USE_NAMESPACES)
-_STLP_MOVE_TO_PRIV_NAMESPACE
-using _STLP_STD::__true_type;
-using _STLP_STD::__false_type;
-_STLP_MOVE_TO_STD_NAMESPACE
-#endif
-
-//bool to type
-template <int _Is>
-struct __bool2type
-{ typedef __true_type _Ret; };
-
-_STLP_TEMPLATE_NULL
-struct __bool2type<1> { typedef __true_type _Ret; };
-
-_STLP_TEMPLATE_NULL
-struct __bool2type<0> { typedef __false_type _Ret; };
-
-//type to bool
-template <class __bool_type>
-struct __type2bool { enum {_Ret = 1}; };
-
-_STLP_TEMPLATE_NULL
-struct __type2bool<__true_type> { enum {_Ret = 1}; };
-
-_STLP_TEMPLATE_NULL
-struct __type2bool<__false_type> { enum {_Ret = 0}; };
-
-//Negation
-template <class _BoolType>
-struct _Not { typedef __false_type _Ret; };
-
-_STLP_TEMPLATE_NULL
-struct _Not<__false_type> { typedef __true_type _Ret; };
-
-// logical and of 2 predicated
-template <class _P1, class _P2>
-struct _Land2 { typedef __false_type _Ret; };
-
-_STLP_TEMPLATE_NULL
-struct _Land2<__true_type, __true_type> { typedef __true_type _Ret; };
-
-// logical and of 3 predicated
-template <class _P1, class _P2, class _P3>
-struct _Land3 { typedef __false_type _Ret; };
-
-_STLP_TEMPLATE_NULL
-struct _Land3<__true_type, __true_type, __true_type> { typedef __true_type _Ret; };
-
-//logical or of 2 predicated
-template <class _P1, class _P2>
-struct _Lor2 { typedef __true_type _Ret; };
-
-_STLP_TEMPLATE_NULL
-struct _Lor2<__false_type, __false_type> { typedef __false_type _Ret; };
-
-// logical or of 3 predicated
-template <class _P1, class _P2, class _P3>
-struct _Lor3 { typedef __true_type _Ret; };
-
-_STLP_TEMPLATE_NULL
-struct _Lor3<__false_type, __false_type, __false_type> { typedef __false_type _Ret; };
-
-////////////////////////////////////////////////////////////////////////////////
-// class template __select
-// Selects one of two types based upon a boolean constant
-// Invocation: __select<_Cond, T, U>::Result
-// where:
-// flag is a compile-time boolean constant
-// T and U are types
-// Result evaluates to T if flag is true, and to U otherwise.
-////////////////////////////////////////////////////////////////////////////////
-// BEWARE: If the compiler do not support partial template specialization or nested template
-//classes the default behavior of the __select is to consider the condition as false and so return
-//the second template type!!
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <bool _Cond, class _Tp1, class _Tp2>
-struct __select { typedef _Tp1 _Ret; };
-
-template <class _Tp1, class _Tp2>
-struct __select<false, _Tp1, _Tp2> { typedef _Tp2 _Ret; };
-
-# if defined (__BORLANDC__)
-template <class _CondT, class _Tp1, class _Tp2>
-struct __selectT { typedef _Tp1 _Ret; };
-
-template <class _Tp1, class _Tp2>
-struct __selectT<__false_type, _Tp1, _Tp2> { typedef _Tp2 _Ret; };
-# endif
-
-#else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
-template <int _Cond>
-struct __select_aux {
- template <class _Tp1, class _Tp2>
- struct _In {
- typedef _Tp1 _Ret;
- };
-};
-
-_STLP_TEMPLATE_NULL
-struct __select_aux<0> {
- template <class _Tp1, class _Tp2>
- struct _In {
- typedef _Tp2 _Ret;
- };
-};
-
-template <int _Cond, class _Tp1, class _Tp2>
-struct __select {
- typedef typename __select_aux<_Cond>::_STLP_TEMPLATE _In<_Tp1, _Tp2>::_Ret _Ret;
-};
-# else /* _STLP_MEMBER_TEMPLATE_CLASSES */
-//default behavior
-template <int _Cond, class _Tp1, class _Tp2>
-struct __select {
- typedef _Tp2 _Ret;
-};
-# endif /* _STLP_MEMBER_TEMPLATE_CLASSES */
-
-#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-#if defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
-// Boris : simulation technique is used here according to Adobe Open Source License Version 1.0.
-// Copyright 2000 Adobe Systems Incorporated and others. All rights reserved.
-// Authors: Mat Marcus and Jesse Jones
-// The original version of this source code may be found at
-// http://opensource.adobe.com.
-
-// These are the discriminating functions
-template <class _Tp>
-char _STLP_CALL _IsSameFun(bool, _Tp const volatile*, _Tp const volatile*); // no implementation is required
-char* _STLP_CALL _IsSameFun(bool, ...); // no implementation is required
-
-template <class _Tp1, class _Tp2>
-struct _IsSame {
- static _Tp1* __null_rep1();
- static _Tp2* __null_rep2();
- enum { _Ret = (sizeof(_IsSameFun(false,__null_rep1(), __null_rep2())) == sizeof(char)) };
- typedef typename __bool2type<_Ret>::_Ret _RetT;
-};
-
-#else
-
-template <class _Tp1, class _Tp2>
-struct _IsSameAux {
- typedef __false_type _RetT;
- enum { _Ret = 0 };
-};
-
-template <class _Tp>
-struct _UnConstType { typedef _Tp _Type; };
-
-template <class _Tp>
-struct _UnVolatileType { typedef _Tp _Type; };
-
-template <class _Tp>
-struct _UnCVType {
- typedef typename _UnVolatileType<_Tp>::_Type _UnVType;
- typedef typename _UnConstType<_UnVType>::_Type _Type;
-};
-
-# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp>
-struct _IsSameAux<_Tp, _Tp> {
- typedef __true_type _RetT;
- enum { _Ret = 1 };
-};
-
-# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
-template <class _Tp>
-struct _UnConstType<const _Tp> { typedef _Tp _Type; };
-
-template <class _Tp>
-struct _UnVolatileType<volatile _Tp> { typedef _Tp _Type; };
-# endif
-
-# if defined(__BORLANDC__)
-template<class _Tp>
-struct _UnConstPtr { typedef _Tp _Type; };
-
-template<class _Tp>
-struct _UnConstPtr<_Tp*> { typedef _Tp _Type; };
-
-template<class _Tp>
-struct _UnConstPtr<const _Tp*> { typedef _Tp _Type; };
-# endif
-# endif
-
-template <class _Tp1, class _Tp2>
-struct _IsSame {
- typedef typename _UnCVType<_Tp1>::_Type _Type1;
- typedef typename _UnCVType<_Tp2>::_Type _Type2;
-
- typedef _IsSameAux<_Type1, _Type2> _Aux;
- enum { _Ret = _Aux::_Ret };
- typedef typename _Aux::_RetT _RetT;
-};
-#endif
-
-/*
- * The following struct will tell you if 2 types are the same, the limitations are:
- * - it compares the types without the const or volatile qualifiers, int and const int
- * will be considered as same for instance.
- * - the previous remarks do not apply to pointer types, int* and int const* won't be
- * considered as comparable. (int * and int *const are).
- */
-template <class _Tp1, class _Tp2>
-struct _AreSameUnCVTypes {
- enum { _Same = _IsSame<_Tp1, _Tp2>::_Ret };
- typedef typename _IsSame<_Tp1, _Tp2>::_RetT _Ret;
-};
-
-/* Rather than introducing a new macro for the following constrution we use
- * an existing one (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) that
- * is used for a similar feature.
- */
-#if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
-template <class _Src, class _Dst>
-struct _ConversionHelper {
- static char _Test(bool, _Dst);
- static char* _Test(bool, ...);
- static _Src _MakeSource();
-};
-
-template <class _Src, class _Dst>
-struct _IsConvertible {
- typedef _ConversionHelper<_Src*, const volatile _Dst*> _H;
- enum { value = (sizeof(char) == sizeof(_H::_Test(false, _H::_MakeSource()))) };
- typedef typename __bool2type<value>::_Ret _Ret;
-};
-
-/* This struct is intended to say if a pointer can be convertible to an other
- * taking into account cv qualifications. It shouldn't be instanciated with
- * something else than pointer type as it uses pass by value parameter that
- * results in compilation error when parameter type has a special memory
- * alignment
- */
-template <class _Src, class _Dst>
-struct _IsCVConvertible {
-#if !defined (__BORLANDC__)
- typedef _ConversionHelper<_Src, _Dst> _H;
- enum { value = (sizeof(char) == sizeof(_H::_Test(false, _H::_MakeSource()))) };
-#else
- enum { _Is1 = __type2bool<_IsConst<_Src>::_Ret>::_Ret };
- enum { _Is2 = _IsConvertible<_UnConstPtr<_Src>::_Type, _UnConstPtr<_Dst>::_Type>::value };
- enum { value = _Is1 ? 0 : _Is2 };
-#endif
- typedef typename __bool2type<value>::_Ret _Ret;
-};
-
-#else
-template <class _Src, class _Dst>
-struct _IsConvertible {
- enum {value = 0};
- typedef __false_type _Ret;
-};
-#endif
-
-template <class _Tp>
-struct _IsConst { typedef __false_type _Ret; };
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
-template <class _Tp>
-struct _IsConst <const _Tp> { typedef __true_type _Ret; };
-#endif
-
-# if defined(__BORLANDC__)
-template<class _Tp>
-struct _IsConst <const _Tp*> { typedef __true_type _Ret; };
-
-template<class _Tp>
-struct _IsConst <const volatile _Tp*> { typedef __true_type _Ret; };
-# endif
-
-_STLP_END_NAMESPACE
-
-#endif /* _STLP_TYPE_MANIPS_H */
diff --git a/stl/type_traits.h b/stl/type_traits.h
deleted file mode 100644
index 37bc69f..0000000
--- a/stl/type_traits.h
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1997
- * Moscow Center for SPARC Technology
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_TYPE_TRAITS_H
-#define _STLP_TYPE_TRAITS_H
-
-/*
-This header file provides a framework for allowing compile time dispatch
-based on type attributes. This is useful when writing template code.
-For example, when making a copy of an array of an unknown type, it helps
-to know if the type has a trivial copy constructor or not, to help decide
-if a memcpy can be used.
-
-The class template __type_traits provides a series of typedefs each of
-which is either __true_type or __false_type. The argument to
-__type_traits can be any type. The typedefs within this template will
-attain their correct values by one of these means:
- 1. The general instantiation contain conservative values which work
- for all types.
- 2. Specializations may be declared to make distinctions between types.
- 3. Some compilers (such as the Silicon Graphics N32 and N64 compilers)
- will automatically provide the appropriate specializations for all
- types.
-
-EXAMPLE:
-
-//Copy an array of elements which have non-trivial copy constructors
-template <class T> void copy(T* source, T* destination, int n, __false_type);
-//Copy an array of elements which have trivial copy constructors. Use memcpy.
-template <class T> void copy(T* source, T* destination, int n, __true_type);
-
-//Copy an array of any type by using the most efficient copy mechanism
-template <class T> inline void copy(T* source,T* destination,int n) {
- copy(source, destination, n,
- typename __type_traits<T>::has_trivial_copy_constructor());
-}
-*/
-
-#ifdef __WATCOMC__
-# include <stl/_cwchar.h>
-#endif
-
-#ifndef _STLP_TYPE_MANIPS_H
-# include <stl/type_manips.h>
-#endif
-
-#ifdef _STLP_USE_BOOST_SUPPORT
-# include <stl/boost_type_traits.h>
-# include <boost/type_traits/add_reference.hpp>
-# include <boost/type_traits/add_const.hpp>
-#endif /* _STLP_USE_BOOST_SUPPORT */
-
-_STLP_BEGIN_NAMESPACE
-
-#if !defined (_STLP_USE_BOOST_SUPPORT)
-
-// The following could be written in terms of numeric_limits.
-// We're doing it separately to reduce the number of dependencies.
-
-template <class _Tp> struct _IsIntegral
-{ typedef __false_type _Ret; };
-
-# ifndef _STLP_NO_BOOL
-_STLP_TEMPLATE_NULL struct _IsIntegral<bool>
-{ typedef __true_type _Ret; };
-# endif /* _STLP_NO_BOOL */
-
-_STLP_TEMPLATE_NULL struct _IsIntegral<char>
-{ typedef __true_type _Ret; };
-
-# ifndef _STLP_NO_SIGNED_BUILTINS
-_STLP_TEMPLATE_NULL struct _IsIntegral<signed char>
-{ typedef __true_type _Ret; };
-# endif
-
-_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned char>
-{ typedef __true_type _Ret; };
-
-# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
-_STLP_TEMPLATE_NULL struct _IsIntegral<wchar_t>
-{ typedef __true_type _Ret; };
-# endif /* _STLP_HAS_WCHAR_T */
-
-_STLP_TEMPLATE_NULL struct _IsIntegral<short>
-{ typedef __true_type _Ret; };
-
-_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned short>
-{ typedef __true_type _Ret; };
-
-_STLP_TEMPLATE_NULL struct _IsIntegral<int>
-{ typedef __true_type _Ret; };
-
-_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned int>
-{ typedef __true_type _Ret; };
-
-_STLP_TEMPLATE_NULL struct _IsIntegral<long>
-{ typedef __true_type _Ret; };
-
-_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned long>
-{ typedef __true_type _Ret; };
-
-# ifdef _STLP_LONG_LONG
-_STLP_TEMPLATE_NULL struct _IsIntegral<_STLP_LONG_LONG>
-{ typedef __true_type _Ret; };
-
-_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned _STLP_LONG_LONG>
-{ typedef __true_type _Ret; };
-# endif /* _STLP_LONG_LONG */
-
-template <class _Tp> struct _IsRational
-{ typedef __false_type _Ret; };
-
-_STLP_TEMPLATE_NULL struct _IsRational<float>
-{ typedef __true_type _Ret; };
-
-_STLP_TEMPLATE_NULL struct _IsRational<double>
-{ typedef __true_type _Ret; };
-
-# if !defined ( _STLP_NO_LONG_DOUBLE )
-_STLP_TEMPLATE_NULL struct _IsRational<long double>
-{ typedef __true_type _Ret; };
-# endif
-
-// Forward declarations.
-template <class _Tp> struct __type_traits;
-template <class _IsPOD> struct __type_traits_aux {
- typedef __false_type has_trivial_default_constructor;
- typedef __false_type has_trivial_copy_constructor;
- typedef __false_type has_trivial_assignment_operator;
- typedef __false_type has_trivial_destructor;
- typedef __false_type is_POD_type;
-};
-
-_STLP_TEMPLATE_NULL
-struct __type_traits_aux<__false_type> {
- typedef __false_type has_trivial_default_constructor;
- typedef __false_type has_trivial_copy_constructor;
- typedef __false_type has_trivial_assignment_operator;
- typedef __false_type has_trivial_destructor;
- typedef __false_type is_POD_type;
-};
-
-_STLP_TEMPLATE_NULL
-struct __type_traits_aux<__true_type> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-template <class _Tp>
-struct _IsRef {
- typedef __false_type _Ret;
-};
-
-# if defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
-/*
- * Boris : simulation technique is used here according to Adobe Open Source License Version 1.0.
- * Copyright 2000 Adobe Systems Incorporated and others. All rights reserved.
- * Authors: Mat Marcus and Jesse Jones
- * The original version of this source code may be found at
- * http://opensource.adobe.com.
- */
-
-struct _PointerShim {
- /*
- * Since the compiler only allows at most one non-trivial
- * implicit conversion we can make use of a shim class to
- * be sure that IsPtr below doesn't accept classes with
- * implicit pointer conversion operators
- */
- _PointerShim(const volatile void*); // no implementation
-};
-
-// These are the discriminating functions
-char _STLP_CALL _IsP(bool, _PointerShim); // no implementation is required
-char* _STLP_CALL _IsP(bool, ...); // no implementation is required
-
-template <class _Tp>
-struct _IsPtr {
- /*
- * This template meta function takes a type T
- * and returns true exactly when T is a pointer.
- * One can imagine meta-functions discriminating on
- * other criteria.
- */
- static _Tp& __null_rep();
- enum { _Ptr = (sizeof(_IsP(false,__null_rep())) == sizeof(char)) };
- typedef typename __bool2type<_Ptr>::_Ret _Ret;
-
-};
-
-// we make general case dependant on the fact the type is actually a pointer.
-template <class _Tp>
-struct __type_traits : __type_traits_aux<typename _IsPtr<_Tp>::_Ret> {};
-
-# else /* _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS */
-
-template <class _Tp> struct _IsPtr {
- typedef __false_type _Ret;
-};
-
-template <class _Tp>
-struct __type_traits {
- typedef __true_type this_dummy_member_must_be_first;
- /* Do not remove this member. It informs a compiler which
- automatically specializes __type_traits that this
- __type_traits template is special. It just makes sure that
- things work if an implementation is using a template
- called __type_traits for something unrelated. */
-
- /* The following restrictions should be observed for the sake of
- compilers which automatically produce type specific specializations
- of this class:
- - You may reorder the members below if you wish
- - You may remove any of the members below if you wish
- - You must not rename members without making the corresponding
- name change in the compiler
- - Members you add will be treated like regular members unless
-
- you add the appropriate support in the compiler. */
-# if !defined (_STLP_HAS_TYPE_TRAITS_INTRINSICS)
- typedef __false_type has_trivial_default_constructor;
- typedef __false_type has_trivial_copy_constructor;
- typedef __false_type has_trivial_assignment_operator;
- typedef __false_type has_trivial_destructor;
- typedef __false_type is_POD_type;
-# else
- typedef typename __bool2type<_STLP_HAS_TRIVIAL_CONSTRUCTOR(_Tp)>::_Ret has_trivial_default_constructor;
- typedef typename __bool2type<_STLP_HAS_TRIVIAL_COPY(_Tp)>::_Ret has_trivial_copy_constructor;
- typedef typename __bool2type<_STLP_HAS_TRIVIAL_ASSIGN(_Tp)>::_Ret has_trivial_assignment_operator;
- typedef typename __bool2type<_STLP_HAS_TRIVIAL_DESTRUCTOR(_Tp)>::_Ret has_trivial_destructor;
- typedef typename __bool2type<_STLP_IS_POD(_Tp)>::_Ret is_POD_type;
-# endif
-};
-
-# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp> struct _IsPtr<_Tp*>
-{ typedef __true_type _Ret; };
-template <class _Tp> struct _IsRef<_Tp&>
-{ typedef __true_type _Ret; };
-
-template <class _Tp> struct __type_traits<_Tp*> : __type_traits_aux<__true_type>
-{};
-# endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
-
-# endif /* _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS */
-
-// Provide some specializations. This is harmless for compilers that
-// have built-in __types_traits support, and essential for compilers
-// that don't.
-# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
-# define _STLP_DEFINE_TYPE_TRAITS_FOR(Type) \
-_STLP_TEMPLATE_NULL struct __type_traits< Type > : __type_traits_aux<__true_type> {}; \
-_STLP_TEMPLATE_NULL struct __type_traits< const Type > : __type_traits_aux<__true_type> {}; \
-_STLP_TEMPLATE_NULL struct __type_traits< volatile Type > : __type_traits_aux<__true_type> {}; \
-_STLP_TEMPLATE_NULL struct __type_traits< const volatile Type > : __type_traits_aux<__true_type> {}
-# else
-# define _STLP_DEFINE_TYPE_TRAITS_FOR(Type) \
-_STLP_TEMPLATE_NULL struct __type_traits< Type > : __type_traits_aux<__true_type> {};
-# endif
-
-# ifndef _STLP_NO_BOOL
-_STLP_DEFINE_TYPE_TRAITS_FOR(bool);
-# endif /* _STLP_NO_BOOL */
-_STLP_DEFINE_TYPE_TRAITS_FOR(char);
-# ifndef _STLP_NO_SIGNED_BUILTINS
-_STLP_DEFINE_TYPE_TRAITS_FOR(signed char);
-# endif
-_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned char);
-# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
-_STLP_DEFINE_TYPE_TRAITS_FOR(wchar_t);
-# endif /* _STLP_HAS_WCHAR_T */
-
-_STLP_DEFINE_TYPE_TRAITS_FOR(short);
-_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned short);
-_STLP_DEFINE_TYPE_TRAITS_FOR(int);
-_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned int);
-_STLP_DEFINE_TYPE_TRAITS_FOR(long);
-_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned long);
-
-# ifdef _STLP_LONG_LONG
-_STLP_DEFINE_TYPE_TRAITS_FOR(_STLP_LONG_LONG);
-_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned _STLP_LONG_LONG);
-# endif /* _STLP_LONG_LONG */
-
-_STLP_DEFINE_TYPE_TRAITS_FOR(float);
-_STLP_DEFINE_TYPE_TRAITS_FOR(double);
-
-# if !defined ( _STLP_NO_LONG_DOUBLE )
-_STLP_DEFINE_TYPE_TRAITS_FOR(long double);
-# endif
-
-#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _ArePtrs, class _Src, class _Dst>
-struct _IsCVConvertibleIf
-{ typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; };
-
-template <class _Src, class _Dst>
-struct _IsCVConvertibleIf<__false_type, _Src, _Dst>
-{ typedef __false_type _Ret; };
-#else
-# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
-template <class _ArePtrs>
-struct _IsCVConvertibleIfAux {
- template <class _Src, class _Dst>
- struct _In
- { typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; };
-};
-
-_STLP_TEMPLATE_NULL
-struct _IsCVConvertibleIfAux<__false_type> {
- template <class _Src, class _Dst>
- struct _In
- { typedef __false_type _Ret; };
-};
-
-template <class _ArePtrs, class _Src, class _Dst>
-struct _IsCVConvertibleIf {
- typedef typename _IsCVConvertibleIfAux<_ArePtrs>::_STLP_TEMPLATE _In<_Src, _Dst>::_Ret _Ret;
-};
-# else
-/* default behavior: we prefer to miss an optimization rather than taking the risk of
- * a compilation error if playing with types with exotic memory alignment.
- */
-template <class _ArePtrs, class _Src, class _Dst>
-struct _IsCVConvertibleIf
-{ typedef __false_type _Ret; };
-# endif
-#endif
-
-template <class _Src, class _Dst>
-struct _TrivialNativeTypeCopy {
- typedef typename _IsPtr<_Src>::_Ret _Ptr1;
- typedef typename _IsPtr<_Dst>::_Ret _Ptr2;
- typedef typename _Land2<_Ptr1, _Ptr2>::_Ret _BothPtrs;
- typedef typename _IsCVConvertibleIf<_BothPtrs, _Src, _Dst>::_Ret _Convertible;
- typedef typename _Land2<_BothPtrs, _Convertible>::_Ret _Trivial1;
-
- typedef typename __bool2type<(sizeof(_Src) == sizeof(_Dst))>::_Ret _SameSize;
-
- typedef typename _IsIntegral<_Src>::_Ret _Int1;
- typedef typename _IsIntegral<_Dst>::_Ret _Int2;
- typedef typename _Land2<_Int1, _Int2>::_Ret _BothInts;
-
- typedef typename _IsRational<_Src>::_Ret _Rat1;
- typedef typename _IsRational<_Dst>::_Ret _Rat2;
- typedef typename _Land2<_Rat1, _Rat2>::_Ret _BothRats;
-
- typedef typename _Lor2<_BothInts, _BothRats>::_Ret _BothNatives;
- typedef typename _Land2<_BothNatives, _SameSize>::_Ret _Trivial2;
-
- typedef typename _Lor2<_Trivial1, _Trivial2>::_Ret _Ret;
-};
-
-template <class _Src, class _Dst>
-struct _TrivialCopy {
- typedef typename _TrivialNativeTypeCopy<_Src, _Dst>::_Ret _NativeRet;
-
-#if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
- typedef typename __type_traits<_Src>::has_trivial_assignment_operator _Tr1;
-#else
- typedef typename _UnConstPtr<_Src*>::_Type _Tp3;
- typedef typename __type_traits<_Tp3>::has_trivial_assignment_operator _Tr1;
-#endif
- typedef typename _AreSameUnCVTypes<_Src, _Dst>::_Ret _Tr2;
- typedef typename _Land2<_Tr1, _Tr2>::_Ret _UserRet;
-
- typedef typename _Lor2<_NativeRet, _UserRet>::_Ret _Ret;
- static _Ret _Answer() { return _Ret(); }
-};
-
-template <class _Src, class _Dst>
-struct _TrivialUCopy {
- typedef typename _TrivialNativeTypeCopy<_Src, _Dst>::_Ret _NativeRet;
-
-#if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
- typedef typename __type_traits<_Src>::has_trivial_copy_constructor _Tr1;
-#else
- typedef typename _UnConstPtr<_Src*>::_Type _Tp3;
- typedef typename __type_traits<_Tp3>::has_trivial_copy_constructor _Tr1;
-#endif
- typedef typename _AreSameUnCVTypes<_Src, _Dst>::_Ret _Tr2;
- typedef typename _Land2<_Tr1, _Tr2>::_Ret _UserRet;
-
- typedef typename _Lor2<_NativeRet, _UserRet>::_Ret _Ret;
- static _Ret _Answer() { return _Ret(); }
-};
-
-template <class _Tp>
-struct _DefaultZeroValue {
- typedef typename _IsIntegral<_Tp>::_Ret _Tr1;
- typedef typename _IsRational<_Tp>::_Ret _Tr2;
- typedef typename _IsPtr<_Tp>::_Ret _Tr3;
- typedef typename _Lor3<_Tr1, _Tr2, _Tr3>::_Ret _Ret;
-};
-
-template <class _Tp>
-struct _TrivialInit {
-#if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
- typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Tr1;
-#else
- typedef typename _UnConstPtr<_Tp*>::_Type _Tp1;
- typedef typename __type_traits<_Tp1>::has_trivial_copy_constructor _Tr1;
-#endif
- typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2;
- typedef typename _Not<_Tr2>::_Ret _Tr3;
- typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret;
- static _Ret _Answer() { return _Ret(); }
-};
-
-#endif /* !_STLP_USE_BOOST_SUPPORT */
-
-template <class _Tp>
-struct _IsPtrType {
- typedef typename _IsPtr<_Tp>::_Ret _Type;
- static _Type _Ret() { return _Type(); }
-};
-
-template <class _Tp>
-struct _IsRefType {
- typedef typename _IsRef<_Tp>::_Ret _Type;
- static _Type _Ret() { return _Type();}
-};
-
-template <class _Tp>
-struct __call_traits {
-#if defined (_STLP_USE_BOOST_SUPPORT) && !defined (_STLP_NO_EXTENSIONS)
- typedef typename __select< ::boost::is_reference<_Tp>::value,
- _Tp, typename ::boost::add_reference< typename ::boost::add_const<_Tp>::type >::type>::_Ret param_type;
-#else
- typedef const _Tp& param_type;
-#endif /* _STLP_USE_BOOST_SUPPORT */
-};
-
-#if !defined (_STLP_USE_BOOST_SUPPORT) && !defined (_STLP_NO_EXTENSIONS) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
-template <class _Tp>
-struct __call_traits<_Tp&>
-{ typedef _Tp& param_type; };
-#endif
-
-template <class _Tp1, class _Tp2>
-struct _BothPtrType {
- typedef typename _IsPtr<_Tp1>::_Ret _IsPtr1;
- typedef typename _IsPtr<_Tp2>::_Ret _IsPtr2;
-
- typedef typename _Land2<_IsPtr1, _IsPtr2>::_Ret _Ret;
- static _Ret _Answer() { return _Ret(); }
-};
-
-template <class _Tp1, class _Tp2, class _IsRef1, class _IsRef2>
-struct _OKToSwap {
- typedef typename _AreSameUnCVTypes<_Tp1, _Tp2>::_Ret _Same;
- typedef typename _Land3<_Same, _IsRef1, _IsRef2>::_Ret _Type;
- static _Type _Answer() { return _Type(); }
-};
-
-template <class _Tp1, class _Tp2, class _IsRef1, class _IsRef2>
-inline _OKToSwap<_Tp1, _Tp2, _IsRef1, _IsRef2>
-_IsOKToSwap(_Tp1*, _Tp2*, const _IsRef1&, const _IsRef2&)
-{ return _OKToSwap<_Tp1, _Tp2, _IsRef1, _IsRef2>(); }
-
-template <class _Src, class _Dst>
-inline _TrivialCopy<_Src, _Dst> _UseTrivialCopy(_Src*, _Dst*)
-{ return _TrivialCopy<_Src, _Dst>(); }
-
-template <class _Src, class _Dst>
-inline _TrivialUCopy<_Src, _Dst> _UseTrivialUCopy(_Src*, _Dst*)
-{ return _TrivialUCopy<_Src, _Dst>(); }
-
-template <class _Tp>
-inline _TrivialInit<_Tp> _UseTrivialInit(_Tp*)
-{ return _TrivialInit<_Tp>(); }
-
-template <class _Tp>
-struct _IsPOD {
- typedef typename __type_traits<_Tp>::is_POD_type _Type;
- static _Type _Answer() { return _Type(); }
-};
-
-template <class _Tp>
-inline _IsPOD<_Tp> _Is_POD(_Tp*)
-{ return _IsPOD<_Tp>(); }
-
-template <class _Tp>
-struct _DefaultZeroValueQuestion {
- typedef typename _DefaultZeroValue<_Tp>::_Ret _Ret;
- static _Ret _Answer() { return _Ret(); }
-};
-
-template <class _Tp>
-inline _DefaultZeroValueQuestion<_Tp> _HasDefaultZeroValue(_Tp*)
-{ return _DefaultZeroValueQuestion<_Tp>(); }
-
-/*
- * Base class used:
- * - to simulate partial template specialization
- * - to simulate partial function ordering
- * - to recognize STLport class from user specialized one
- */
-template <class _Tp>
-struct __stlport_class
-{ typedef _Tp _Type; };
-
-template <class _Tp>
-struct _IsSTLportClass {
- typedef typename _IsConvertible<_Tp, __stlport_class<_Tp> >::_Ret _Ret;
-#if defined (__BORLANDC__)
- enum { _Is = _IsConvertible<_Tp, __stlport_class<_Tp> >::value };
-#endif
-};
-
-#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
-template <class _Tp>
-struct _SwapImplemented {
- typedef typename _IsSTLportClass<_Tp>::_Ret _Ret;
-# if defined (__BORLANDC__)
- enum { _Is = _IsSTLportClass<_Tp>::_Is };
-# endif
-};
-#endif
-
-template <class _Tp>
-class _TpWithState : private _Tp {
- _TpWithState();
- int _state;
-};
-
-/* This is an internal helper struct used to guess if we are working
- * on a stateless class. It can only be instanciated with a class type. */
-template <class _Tp>
-struct _IsStateless {
- enum { _Is = sizeof(_TpWithState<_Tp>) == sizeof(int) };
- typedef typename __bool2type<_Is>::_Ret _Ret;
-};
-
-_STLP_END_NAMESPACE
-
-#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
-# if defined (__BORLANDC__) || \
- defined (__SUNPRO_CC) || \
- (defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || \
- (defined (__sgi) && defined (_COMPILER_VERSION)) || \
- defined (__DMC__)
-# define _STLP_IS_POD_ITER(_It, _Tp) __type_traits< typename iterator_traits< _Tp >::value_type >::is_POD_type()
-# else
-# define _STLP_IS_POD_ITER(_It, _Tp) typename __type_traits< typename iterator_traits< _Tp >::value_type >::is_POD_type()
-# endif
-#else
-# define _STLP_IS_POD_ITER(_It, _Tp) _Is_POD( _STLP_VALUE_TYPE( _It, _Tp ) )._Answer()
-#endif
-
-#endif /* _STLP_TYPE_TRAITS_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/stlport/algorithm b/stlport/algorithm
new file mode 100644
index 0000000..c653d8c
--- /dev/null
+++ b/stlport/algorithm
@@ -0,0 +1,62 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_ALGORITHM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1
+# include <stl/_prolog.h>
+# define _STLP_ALGORITHM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1)
+# ifndef _STLP_INTERNAL_CSTDIO
+// remove() conflicts, <cstdio> should always go first
+# include <stl/_cstdio.h>
+# endif
+
+# ifndef _STLP_INTERNAL_ALGO_H
+# include <stl/_algo.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <algorithm>
+# else
+# include _STLP_NATIVE_HEADER(algorithm)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ALGORITHM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/assert.h b/stlport/assert.h
new file mode 100644
index 0000000..112dd26
--- /dev/null
+++ b/stlport/assert.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x202
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x202) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* evc3 doesn't have assert.h; macro assert() is defined in stl_evc.h */
+#ifndef _STLP_WCE_EVC3
+# if !defined (assert)
+# define _STLP_NATIVE_ASSERT_H_INCLUDED
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <assert.h>
+# else
+# include _STLP_NATIVE_C_HEADER(assert.h)
+# endif
+# endif
+# if !defined (_STLP_NATIVE_ASSERT_H_INCLUDED)
+/* See errno.h for additional information about this #error */
+# error assert has been defined before inclusion of assert.h header.
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x202)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/stlport/bitset b/stlport/bitset
new file mode 100644
index 0000000..1d7fcf3
--- /dev/null
+++ b/stlport/bitset
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_BITSET
+
+// This implementation of bitset<> has a second template parameter,
+// _WordT, which defaults to unsigned long. *YOU SHOULD NOT USE
+// THIS FEATURE*. It is experimental, and it may be removed in
+// future releases.
+
+// A bitset of size N, using words of type _WordT, will have
+// N % (sizeof(_WordT) * CHAR_BIT) unused bits. (They are the high-
+// order bits in the highest word.) It is a class invariant
+// of class bitset<> that those unused bits are always zero.
+
+// Most of the actual code isn't contained in bitset<> itself, but in the
+// base class _Base_bitset. The base class works with whole words, not with
+// individual bits. This allows us to specialize _Base_bitset for the
+// important special case where the bitset is only a single word.
+
+// The C++ standard does not define the precise semantics of operator[].
+// In this implementation the const version of operator[] is equivalent
+// to test(), except that it does no range checking. The non-const version
+// returns a reference to a bit, again without doing any range checking.
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x2
+# include <stl/_prolog.h>
+# define _STLP_BITSET
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2)
+# ifndef _STLP_INTERNAL_BITSET
+# include <stl/_bitset.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x2) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <bitset>
+# else
+# include _STLP_NATIVE_HEADER(bitset)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x2 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_BITSET */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/cassert b/stlport/cassert
new file mode 100644
index 0000000..aabd0b4
--- /dev/null
+++ b/stlport/cassert
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x103
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x103) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if !defined (_STLP_WCE_EVC3)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cassert>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cassert)
+# endif
+# else
+# include <assert.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x103 )
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/cctype b/stlport/cctype
new file mode 100644
index 0000000..513512e
--- /dev/null
+++ b/stlport/cctype
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CCTYPE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x104
+# define _STLP_CCTYPE
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x104 )
+# ifndef _STLP_INTERNAL_CCTYPE
+# include <stl/_cctype.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x104) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cctype>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cctype)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x104 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CCTYPE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/cerrno b/stlport/cerrno
new file mode 100644
index 0000000..0d17faf
--- /dev/null
+++ b/stlport/cerrno
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CERRNO
+#define _STLP_CERRNO
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x105
+# include <stl/_prolog.h>
+#endif
+
+#ifndef _STLP_WCE
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cerrno>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cerrno)
+# endif
+# else
+# include <errno.h>
+# endif
+#endif
+
+#ifndef errno /* errno is not a macro */
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+# if !defined (__IBMCPP__) && !defined (__hpux) && !defined (__MWERKS__) && !defined (_STLP_WCE)
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::errno;
+_STLP_END_NAMESPACE
+# endif
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x105 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CERRNO */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/cfloat b/stlport/cfloat
new file mode 100644
index 0000000..cb2e0cd
--- /dev/null
+++ b/stlport/cfloat
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CFLOAT
+#define _STLP_CFLOAT
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x106
+# include <stl/_prolog.h>
+#endif
+
+// Borland defines some implementation constants in std:: namespace,
+// we do not want to import them.
+#if defined (_STLP_USE_NEW_C_HEADERS) && !defined (__BORLANDC__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cfloat>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cfloat)
+# endif
+#else
+# include <float.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x106 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CFLOAT */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/ciso646 b/stlport/ciso646
new file mode 100644
index 0000000..443449d
--- /dev/null
+++ b/stlport/ciso646
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CISO646
+#define _STLP_CISO646
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x107
+# include <stl/_prolog.h>
+#endif
+
+#if !defined(_STLP_WCE_EVC3) && !defined (__BORLANDC__)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <ciso646>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(ciso646)
+# endif
+# else
+# include <iso646.h>
+# endif /* _STLP_USE_NEW_C_HEADERS */
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x107 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CISO646 */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/climits b/stlport/climits
new file mode 100644
index 0000000..86bc413
--- /dev/null
+++ b/stlport/climits
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CLIMITS
+# define _STLP_CLIMITS
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x108
+# include <stl/_prolog.h>
+#endif
+
+#if defined (__SUNPRO_CC) && ((__SUNPRO_CC == 0x500) && (__SUNPRO_CC_COMPAT > 4))
+# include </usr/include/limits.h>
+#elif defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <climits>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(climits)
+# endif
+#else
+# if defined (__BORLANDC__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <limits.h>
+# else
+# include _STLP_NATIVE_C_HEADER(limits.h)
+# endif
+# else
+# include <limits.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x108 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CLIMITS */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/clocale b/stlport/clocale
new file mode 100644
index 0000000..28996ce
--- /dev/null
+++ b/stlport/clocale
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CLOCALE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x109
+# define _STLP_CLOCALE
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x109)
+# ifndef _STLP_INTERNAL_CLOCALE
+# include <stl/_clocale.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x109) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <clocale>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(clocale)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x109)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CLOCALE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/cmath b/stlport/cmath
new file mode 100644
index 0000000..46a8f52
--- /dev/null
+++ b/stlport/cmath
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CMATH
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x110
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x110) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_CMATH
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x110) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_CMATH
+# include <stl/_cmath.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x110) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cmath>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cmath)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x110)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif /* _STLP_CMATH */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/complex b/stlport/complex
new file mode 100644
index 0000000..6cfe605
--- /dev/null
+++ b/stlport/complex
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_COMPLEX
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x10
+# define _STLP_COMPLEX
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x10)
+// This header declares the template class complex, as described in
+// in the C++ Standard. Single-precision complex numbers
+// are complex<float>, double-precision are complex<double>, and
+// quad precision are complex<long double>.
+
+// Note that the template class complex is declared within namespace
+// std, as called for by the draft C++ standard
+# ifndef _STLP_INTERNAL_COMPLEX
+# include <stl/_complex.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x10) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <complex>
+# else
+# include _STLP_NATIVE_HEADER(complex)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x10 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_COMPLEX */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/csetjmp b/stlport/csetjmp
new file mode 100644
index 0000000..eef2bd8
--- /dev/null
+++ b/stlport/csetjmp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSETJMP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x111
+# define _STLP_CSETJMP
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x111)
+# ifndef _STLP_INTERNAL_CSETJMP
+# include <stl/_csetjmp.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x111) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <csetjmp>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(csetjmp)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x111 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSETJMP */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/csignal b/stlport/csignal
new file mode 100644
index 0000000..7b1a30d
--- /dev/null
+++ b/stlport/csignal
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSIGNAL
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x112
+# define _STLP_CSIGNAL
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x112)
+# ifndef _STLP_INTERNAL_CSIGNAL
+# include <stl/_csignal.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x112) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <csignal>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(csignal)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x112 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSIGNAL */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/cstdarg b/stlport/cstdarg
new file mode 100644
index 0000000..6882bbd
--- /dev/null
+++ b/stlport/cstdarg
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSTDARG
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x113
+# define _STLP_CSTDARG
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x113)
+# ifndef _STLP_INTERNAL_CSTDARG
+# include <stl/_cstdarg.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x113) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdarg>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdarg)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x113 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSTDARG */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/cstddef b/stlport/cstddef
new file mode 100644
index 0000000..0a66f0e
--- /dev/null
+++ b/stlport/cstddef
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSTDDEF
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x114
+# define _STLP_CSTDDEF
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x114)
+# ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x114) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstddef>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x114 )
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSTDDEF */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/cstdio b/stlport/cstdio
new file mode 100644
index 0000000..e20c8ff
--- /dev/null
+++ b/stlport/cstdio
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSTDIO
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x15
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x15) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_CSTDIO
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x15) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x15) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdio>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdio)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x15)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/cstdlib b/stlport/cstdlib
new file mode 100644
index 0000000..20afa35
--- /dev/null
+++ b/stlport/cstdlib
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSTDLIB
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x116
+# define _STLP_CSTDLIB
+# include <stl/_prolog.h>
+#endif
+
+# if defined (__GNUC__) && defined (__MINGW32__)
+/* Native cstdlib includes stdlib.h using an include_next so STLport stdlib.h
+ * is not used and the workaround in this file must be duplicated here
+ * (see stdlib.h). */
+# include "errno.h"
+# endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x116)
+# ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x116) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdlib>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x116)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSTDLIB */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/cstring b/stlport/cstring
new file mode 100644
index 0000000..d5cf58d
--- /dev/null
+++ b/stlport/cstring
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CSTRING
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x117
+# define _STLP_CSTRING
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x117)
+# ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x117) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstring>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstring)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x117)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CSTRING */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/ctime b/stlport/ctime
new file mode 100644
index 0000000..bafb7dd
--- /dev/null
+++ b/stlport/ctime
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CTIME
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x118
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x118) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_CTIME
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x118) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_CTIME
+# include <stl/_ctime.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x118) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <ctime>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(ctime)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x118)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif /* _STLP_CTIME */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/ctype.h b/stlport/ctype.h
new file mode 100644
index 0000000..f9d1000
--- /dev/null
+++ b/stlport/ctype.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CTYPE_H
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include ctype.h, which results in warnings and errors
+ */
+#if !defined(RC_INVOKED)
+
+# if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x219
+# include <stl/_prolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x219)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_CTYPE_H
+# endif
+
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <ctype.h>
+# else
+# include _STLP_NATIVE_C_HEADER(ctype.h)
+# endif
+
+/* on evc4 including ctype.h also defines setjmp macro */
+# if defined (_STLP_WCE)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# endif
+
+# ifndef _STLP_CTYPE_H_SEEN
+# define _STLP_CTYPE_H_SEEN
+
+/* Undef convenience interfaces */
+# undef isspace
+# undef isprint
+# undef iscntrl
+# undef isupper
+# undef islower
+# undef isalpha
+# undef isdigit
+# undef ispunct
+# undef isxdigit
+# undef isalnum
+# undef isgraph
+# undef toupper
+# undef tolower
+
+# if defined (UNDER_CE)
+
+# if (_WIN32_WCE < 300) /* Only wide chars for older versions */
+# define _isctype iswctype
+# endif
+
+__inline int (isalpha)(int c) { return _isctype(c, _ALPHA); }
+__inline int (isupper)(int c) { return _isctype(c, _UPPER); }
+__inline int (islower)(int c) { return _isctype(c, _LOWER); }
+__inline int (isdigit)(int c) { return _isctype(c, _DIGIT); }
+__inline int (isxdigit)(int c) { return _isctype(c, _HEX); }
+__inline int (isspace)(int c) { return _isctype(c, _SPACE); }
+__inline int (ispunct)(int c) { return _isctype(c, _PUNCT); }
+__inline int (isalnum)(int c) { return _isctype(c, _ALPHA|_DIGIT); }
+__inline int (isprint)(int c) { return _isctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); }
+__inline int (isgraph)(int c) { return _isctype(c, _PUNCT|_ALPHA|_DIGIT); }
+__inline int (iscntrl)(int c) { return _isctype(c, _CONTROL); }
+__inline int (isascii)(int c) { return ((unsigned)(c) < 0x80); }
+
+# undef _isctype
+
+__inline int (iswalpha)(int c) { return iswctype((unsigned short)(c), _ALPHA); }
+__inline int (iswupper)(int c) { return iswctype((unsigned short)(c), _UPPER); }
+__inline int (iswlower)(int c) { return iswctype((unsigned short)(c), _LOWER); }
+__inline int (iswdigit)(int c) { return iswctype((unsigned short)(c), _DIGIT); }
+__inline int (iswxdigit)(int c) { return iswctype((unsigned short)(c), _HEX); }
+__inline int (iswspace)(int c) { return iswctype((unsigned short)(c), _SPACE); }
+__inline int (iswpunct)(int c) { return iswctype((unsigned short)(c), _PUNCT); }
+__inline int (iswalnum)(int c) { return iswctype((unsigned short)(c), _ALPHA|_DIGIT); }
+__inline int (iswprint)(int c) { return iswctype((unsigned short)(c), _BLANK|_PUNCT|_ALPHA|_DIGIT); }
+__inline int (iswgraph)(int c) { return iswctype((unsigned short)(c), _PUNCT|_ALPHA|_DIGIT); }
+__inline int (iswcntrl)(int c) { return iswctype((unsigned short)(c), _CONTROL); }
+__inline int (iswascii)(int c) { return ((unsigned)(c) < 0x80); }
+
+# endif /* UNDER_CE */
+
+# endif /* _STLP_CTYPE_H_SEEN */
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x219)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+# endif
+
+#endif /* RC_INVOKED */
+
+#endif /* _STLP_CTYPE_H */
diff --git a/stlport/cwchar b/stlport/cwchar
new file mode 100644
index 0000000..0b32054
--- /dev/null
+++ b/stlport/cwchar
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CWCHAR
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x120
+# define _STLP_CWCHAR
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x120)
+# ifndef _STLP_INTERNAL_CWCHAR
+# include <stl/_cwchar.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x120) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cwchar>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cwchar)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x120)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CWCHAR */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/cwctype b/stlport/cwctype
new file mode 100644
index 0000000..0e86218
--- /dev/null
+++ b/stlport/cwctype
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CWCTYPE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x121
+# define _STLP_CWCTYPE
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x121)
+# ifndef _STLP_INTERNAL_CWCTYPE
+# include <stl/_cwctype.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x121) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cwctype>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cwctype)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x121)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_CWCTYPE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/deque b/stlport/deque
new file mode 100644
index 0000000..448f159
--- /dev/null
+++ b/stlport/deque
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_DEQUE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x22
+# include <stl/_prolog.h>
+# define _STLP_DEQUE
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x22)
+# ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x22) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <deque>
+# else
+# include _STLP_NATIVE_HEADER(deque)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x22)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_DEQUE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/errno.h b/stlport/errno.h
new file mode 100644
index 0000000..bb7999b
--- /dev/null
+++ b/stlport/errno.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x205
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x205) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#ifdef _STLP_WCE
+/* only show message when directly including this file in a non-library build */
+# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x205)
+# pragma message("eMbedded Visual C++ 3 and .NET don't have a errno.h header; STLport won't include native errno.h here")
+# endif
+#else
+# ifndef errno
+/* We define the following macro first to guaranty the header reentrancy: */
+# define _STLP_NATIVE_ERRNO_H_INCLUDED
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <errno.h>
+# else
+# include _STLP_NATIVE_C_HEADER(errno.h)
+# endif
+# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x590) && defined (__cplusplus)
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::__errno;
+_STLP_END_NAMESPACE
+# endif
+# endif /* errno */
+
+# if !defined (_STLP_NATIVE_ERRNO_H_INCLUDED)
+/* If errno has been defined before inclusion of native errno.h including it from STLport errno.h
+ * becomes impossible because if:
+ * #define errno foo
+ * then
+ * #include _STLP_NATIVE_C_HEADER(errno.h)
+ * becomes:
+ * #include _STLP_NATIVE_C_HEADER(foo.h)
+ *
+ * To fix this problem you have to find where this definition comes from and include errno.h before it.
+ */
+# error errno has been defined before inclusion of errno.h header.
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x205)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* Local Variables:
+ * mode: C
+ * End:
+ */
diff --git a/stlport/exception b/stlport/exception
new file mode 100644
index 0000000..47822e9
--- /dev/null
+++ b/stlport/exception
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+// This header exists solely for portability. Normally it just includes
+// the native header <exception>.
+
+#ifndef _STLP_EXCEPTION
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x423
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x423)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_EXCEPTION
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x423) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_EXCEPTION
+# include <stl/_exception.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x423) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+/* If we are here it means that we are in an include called
+ * from the native lib which means that we can simply forward this
+ * call to the native exception header:
+ */
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <exception>
+# else
+# if defined (__DMC__) && (_STLP_OUTERMOST_HEADER_ID == 0x874)
+// Workaround to DMC harcoded typeinfo.h inclusion.
+# include <../include/exception>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
+# endif
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x423)
+# if !defined(_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif /* _STLP_EXCEPTION */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/exception.h b/stlport/exception.h
new file mode 100644
index 0000000..f4be9af
--- /dev/null
+++ b/stlport/exception.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_OLDSTD_exception
+#define _STLP_OLDSTD_exception
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x824
+# include <stl/_prolog.h>
+#endif
+
+#if defined (__BORLANDC__) || defined (_MSC_VER)
+# include <exception>
+#else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <exception.h>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x824)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_OLDSTD_exception */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/float.h b/stlport/float.h
new file mode 100644
index 0000000..70fe3ad
--- /dev/null
+++ b/stlport/float.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x203
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x203) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x203)
+# error This header is only reentrant once, it should be modified if it has to be included more.
+#endif
+
+#if defined (_STLP_WCE_EVC3)
+struct _exception;
+#endif
+
+#if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <float.h>
+#else
+# include _STLP_NATIVE_C_HEADER(float.h)
+#endif
+
+#if !defined (__linux__)
+# if defined(__BORLANDC__) && defined (__cplusplus) && (__BORLANDC__ >= 0x560)
+_STLP_BEGIN_NAMESPACE
+using ::_max_dble;
+using ::_max_flt;
+using ::_max_ldble;
+using ::_tiny_ldble;
+_STLP_END_NAMESPACE
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x203)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
diff --git a/stlport/fstream b/stlport/fstream
new file mode 100644
index 0000000..fc4cd1e
--- /dev/null
+++ b/stlport/fstream
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+
+// This header defines classes basic_filebuf, basic_ifstream,
+// basic_ofstream, and basic_fstream. These classes represent
+// streambufs and streams whose sources or destinations are files.
+
+#ifndef _STLP_FSTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1025
+# include <stl/_prolog.h>
+# define _STLP_FSTREAM
+# if defined (__DMC__) && defined (_DLL)
+# define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1025) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_FSTREAM_H
+# include <stl/_fstream.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1025) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <fstream>
+# else
+# include _STLP_NATIVE_HEADER(fstream)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1025)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# if defined (__DMC__) && defined (_DLL)
+# undef _STLP_CLASS_IMPORT_DECLSPEC
+# define _STLP_CLASS_IMPORT_DECLSPEC
+# endif
+#endif
+
+#endif /* _STLP_FSTREAM */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/fstream.h b/stlport/fstream.h
similarity index 100%
rename from fstream.h
rename to stlport/fstream.h
diff --git a/stlport/functional b/stlport/functional
new file mode 100644
index 0000000..27e37ab
--- /dev/null
+++ b/stlport/functional
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_FUNCTIONAL
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x27
+# include <stl/_prolog.h>
+# define _STLP_FUNCTIONAL
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x27)
+# ifndef _STLP_INTERNAL_FUNCTION_H
+# include <stl/_function.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x27) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <functional>
+# else
+# include _STLP_NATIVE_HEADER(functional)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x27)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
+
+#include <boost/ref.hpp>
+#include <boost/utility/result_of.hpp>
+#include <boost/bind/placeholders.hpp>
+#include <boost/mem_fn.hpp>
+#include <boost/bind.hpp>
+
+namespace boost {
+
+template<class T> class reference_wrapper;
+template<class T> reference_wrapper<T> const ref(T &);
+template<class T> inline reference_wrapper<T const> const cref(T const &);
+
+template<typename F> struct result_of;
+
+namespace _mfi {
+template<class R, class T> class dm;
+}
+
+template<class R, class T> _mfi::dm<R, T> mem_fn(R T::*f);
+
+} // namespace boost
+
+_STLP_BEGIN_NAMESPACE
+
+namespace tr1 {
+
+using ::boost::reference_wrapper;
+using ::boost::ref;
+using ::boost::cref;
+
+using ::boost::result_of;
+
+using ::boost::mem_fn;
+
+using ::boost::bind;
+
+namespace placeholders {
+ using ::_1;
+ using ::_2;
+ using ::_3;
+ using ::_4;
+ using ::_5;
+ using ::_6;
+ using ::_7;
+ using ::_8;
+ using ::_9;
+} // placeholders
+
+} // namespace tr1
+
+_STLP_END_NAMESPACE
+
+#endif // !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT
+
+#endif /* _STLP_FUNCTIONAL */
+
+#if !defined(_STLP_FUNCTIONAL_FUN) && !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
+
+#ifndef BOOST_FUNCTION_NUM_ARGS // avoid recursive includes
+
+// #ifdef BOOST_FUNCTION_BASE_HEADER
+// #undef BOOST_FUNCTION_BASE_HEADER
+// #endif
+
+// #ifdef BOOST_FUNCTION_PROLOGUE_HPP
+// #undef BOOST_FUNCTION_PROLOGUE_HPP
+// #endif
+
+#define _STLP_FUNCTIONAL_FUN
+
+#ifndef BOOST_FUNCTION_BASE_HEADER // avoid recursive includes
+# include <boost/function.hpp>
+#else
+namespace boost {
+class bad_function_call;
+template<typename Signature, typename Allocator >
+class function;
+template<typename Signature, typename Allocator>
+void swap(function<Signature, Allocator>& f1, function<Signature, Allocator>& f2);
+}
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+namespace tr1 {
+
+using ::boost::bad_function_call;
+using ::boost::function;
+using ::boost::swap;
+
+} // namespace tr1
+
+_STLP_END_NAMESPACE
+
+#endif // !BOOST_FUNCTION_NUM_ARGS
+
+#endif // !_STLP_FUNCTIONAL_REF && !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/hash_map b/stlport/hash_map
similarity index 100%
rename from hash_map
rename to stlport/hash_map
diff --git a/hash_set b/stlport/hash_set
similarity index 100%
rename from hash_set
rename to stlport/hash_set
diff --git a/stlport/iomanip b/stlport/iomanip
new file mode 100644
index 0000000..085564f
--- /dev/null
+++ b/stlport/iomanip
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_IOMANIP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1030
+# include <stl/_prolog.h>
+# define _STLP_IOMANIP
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1030) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_IOMANIP
+# include <stl/_iomanip.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1030) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <iomanip>
+# else
+# include _STLP_NATIVE_HEADER(iomanip)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1030)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOMANIP */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/iomanip.h b/stlport/iomanip.h
similarity index 100%
rename from iomanip.h
rename to stlport/iomanip.h
diff --git a/stlport/ios b/stlport/ios
new file mode 100644
index 0000000..12492bb
--- /dev/null
+++ b/stlport/ios
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_IOS
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1032
+# include <stl/_prolog.h>
+# define _STLP_IOS
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1032) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1032) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <ios>
+# else
+# include _STLP_NATIVE_HEADER(ios)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1032)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOS */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/ios.h b/stlport/ios.h
similarity index 100%
rename from ios.h
rename to stlport/ios.h
diff --git a/stlport/iosfwd b/stlport/iosfwd
new file mode 100644
index 0000000..1401046
--- /dev/null
+++ b/stlport/iosfwd
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_IOSFWD
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1034
+# include <stl/_prolog.h>
+# define _STLP_IOSFWD
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1034) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1034) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <iosfwd>
+# else
+# include _STLP_NATIVE_HEADER(iosfwd)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1034)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOSFWD */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/iostream b/stlport/iostream
new file mode 100644
index 0000000..1241f10
--- /dev/null
+++ b/stlport/iostream
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_IOSTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1037
+# include <stl/_prolog.h>
+# define _STLP_IOSTREAM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1037) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifdef _STLP_REDIRECT_STDSTREAMS
+// for ofstream redirection
+# ifndef _STLP_INTERNAL_FSTREAM_H
+# include <stl/_fstream.h>
+# endif
+# endif
+
+# ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+# endif
+
+# ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+# ifndef _STLP_USE_NAMESPACES
+// in case of SGI iostreams, we have to rename our streams not to clash with those
+// provided in native lib
+# define cin _STLP_cin
+# define cout _STLP_cout
+# define cerr _STLP_cerr
+# define clog _STLP_clog
+# endif
+
+// Note: cin and wcin are both associated with stdio. The C standard
+// (Amendment 1, section 4.6.2.1) says that it is an error to mix
+// wide- and narrow-oriented I/O on the same stream. This implies
+// that it is an error to use both cin and wcin in the same C++
+// program; the same applies to cout and wcout, and cerr/clog and
+// wcerr/wclog.
+
+extern _STLP_DECLSPEC istream cin;
+
+# ifdef _STLP_REDIRECT_STDSTREAMS
+extern _STLP_DECLSPEC ofstream cout;
+extern _STLP_DECLSPEC ofstream cerr;
+extern _STLP_DECLSPEC ofstream clog;
+# else
+extern _STLP_DECLSPEC ostream cout;
+extern _STLP_DECLSPEC ostream cerr;
+extern _STLP_DECLSPEC ostream clog;
+# endif
+
+# ifndef _STLP_NO_WCHAR_T
+extern _STLP_DECLSPEC wistream wcin;
+extern _STLP_DECLSPEC wostream wcout;
+extern _STLP_DECLSPEC wostream wcerr;
+extern _STLP_DECLSPEC wostream wclog;
+# endif
+
+_STLP_END_NAMESPACE
+
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1037) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <iostream>
+# else
+# include _STLP_NATIVE_HEADER(iostream)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1037)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_IOSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/iostream.h b/stlport/iostream.h
similarity index 100%
rename from iostream.h
rename to stlport/iostream.h
diff --git a/stlport/iso646.h b/stlport/iso646.h
new file mode 100644
index 0000000..858863a
--- /dev/null
+++ b/stlport/iso646.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x204
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x204) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* evc3 doesn't have iso646.h */
+#if !defined (_STLP_WCE_EVC3) && !defined (__BORLANDC__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <iso646.h>
+# else
+# include _STLP_NATIVE_C_HEADER(iso646.h)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x204)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
diff --git a/stlport/istream b/stlport/istream
new file mode 100644
index 0000000..d4ca903
--- /dev/null
+++ b/stlport/istream
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_ISTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1036
+# include <stl/_prolog.h>
+# define _STLP_ISTREAM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1036) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1036) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <istream>
+# else
+# include _STLP_NATIVE_HEADER(istream)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1036)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ISTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/istream.h b/stlport/istream.h
similarity index 100%
rename from istream.h
rename to stlport/istream.h
diff --git a/stlport/iterator b/stlport/iterator
new file mode 100644
index 0000000..f8d3dee
--- /dev/null
+++ b/stlport/iterator
@@ -0,0 +1,61 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_ITERATOR
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x38
+# include <stl/_prolog.h>
+# define _STLP_ITERATOR
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x38)
+# ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+# endif
+
+# ifndef _STLP_INTERNAL_STREAM_ITERATOR_H
+# include <stl/_stream_iterator.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x38) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <iterator>
+# else
+# include _STLP_NATIVE_HEADER(iterator)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x38)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_ITERATOR */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/limits b/stlport/limits
new file mode 100644
index 0000000..5333b14
--- /dev/null
+++ b/stlport/limits
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_LIMITS
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x39
+# include <stl/_prolog.h>
+# define _STLP_LIMITS
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x39)
+# ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x39) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <limits>
+# else
+# include _STLP_NATIVE_HEADER(limits)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x39)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_LIMITS */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/limits.h b/stlport/limits.h
new file mode 100644
index 0000000..aab553b
--- /dev/null
+++ b/stlport/limits.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x201
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x201) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if defined(_STLP_WCE_EVC3)
+struct _exception;
+#endif
+
+#if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <limits.h>
+#else
+# include _STLP_NATIVE_C_HEADER(limits.h)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x201)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
diff --git a/stlport/list b/stlport/list
new file mode 100644
index 0000000..647a8be
--- /dev/null
+++ b/stlport/list
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_LIST
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x40
+# include <stl/_prolog.h>
+# define _STLP_LIST
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x40)
+# ifndef _STLP_INTERNAL_LIST_H
+# include <stl/_list.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x40) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <list>
+# else
+# include _STLP_NATIVE_HEADER(list)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x40)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_LIST */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/locale b/stlport/locale
new file mode 100644
index 0000000..22cd01f
--- /dev/null
+++ b/stlport/locale
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_LOCALE
+
+// Basic framework: class locale and class locale::facet
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1041
+# include <stl/_prolog.h>
+# define _STLP_LOCALE
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1041) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+// Individual facets
+# ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+# endif
+
+# ifndef _STLP_INTERNAL_CODECVT_H
+# include <stl/_codecvt.h>
+# endif
+
+# ifndef _STLP_INTERNAL_COLLATE_H
+# include <stl/_collate.h>
+# endif
+
+# ifndef _STLP_INTERNAL_NUM_PUT_H
+# include <stl/_num_put.h>
+# endif
+
+# ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+# endif
+
+// those never included separately anyway
+# include <stl/_monetary.h>
+# include <stl/_time_facets.h>
+# include <stl/_messages_facets.h>
+
+// some stuff for streambuf iterators ended up defined there
+// Strictly speaking, _istream.h portion is only required for <iterator>, but it may break too many
+// programs if we omit it
+# ifndef _STLP_ISTREAM_H
+# include <stl/_istream.h>
+# endif
+
+// Convenience interfaces
+#undef isspace
+#undef isprint
+#undef iscntrl
+#undef isupper
+#undef islower
+#undef isalpha
+#undef isdigit
+#undef ispunct
+#undef isxdigit
+#undef isalnum
+#undef isgraph
+#undef toupper
+#undef tolower
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT>
+inline bool isspace (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::space, c); }
+
+template <class _CharT>
+inline bool isprint (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::print, c); }
+
+template <class _CharT>
+inline bool iscntrl (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::cntrl, c); }
+
+template <class _CharT>
+inline bool isupper (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::upper, c); }
+
+template <class _CharT>
+inline bool islower (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::lower, c); }
+
+template <class _CharT>
+inline bool isalpha (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alpha, c); }
+
+template <class _CharT>
+inline bool isdigit (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::digit, c); }
+
+template <class _CharT>
+inline bool ispunct (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::punct, c); }
+
+template <class _CharT>
+inline bool isxdigit (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::xdigit, c); }
+
+template <class _CharT>
+inline bool isalnum (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alnum, c); }
+
+template <class _CharT>
+inline bool isgraph (_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::graph, c); }
+
+template <class _CharT>
+inline _CharT toupper(_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).toupper(c); }
+
+template <class _CharT>
+inline _CharT tolower(_CharT c, const locale& loc)
+{ return (use_facet<ctype<_CharT> >(loc)).tolower(c); }
+
+_STLP_END_NAMESPACE
+
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1041) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <locale>
+# else
+# include _STLP_NATIVE_HEADER(locale)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1041)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_LOCALE */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/locale.h b/stlport/locale.h
new file mode 100644
index 0000000..81b56b4
--- /dev/null
+++ b/stlport/locale.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x242
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x242)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# else
+# error STLport include schema violation
+# endif
+#endif
+
+/* evc3 doesn't have locale.h */
+#ifndef _STLP_WCE_EVC3
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <locale.h>
+# else
+# include _STLP_NATIVE_C_HEADER(locale.h)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x242)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
diff --git a/stlport/map b/stlport/map
new file mode 100644
index 0000000..f30c400
--- /dev/null
+++ b/stlport/map
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_MAP
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x43
+# include <stl/_prolog.h>
+# define _STLP_MAP
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x43)
+# ifndef _STLP_INTERNAL_MAP_H
+# include <stl/_map.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x43) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <map>
+# else
+# include _STLP_NATIVE_HEADER(map)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x43)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_MAP */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/math.h b/stlport/math.h
new file mode 100644
index 0000000..32b666f
--- /dev/null
+++ b/stlport/math.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x244
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x244) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if !defined (exception) && (!defined (__KCC) || (__KCC_VERSION < 4000)) && \
+ !(defined(__IBMCPP__) && (500 <= __IBMCPP__)) && !defined(_STLP_WCE_EVC3)
+# define _STLP_EXCEPTION_WAS_REDEFINED 1
+# define exception __math_exception
+#endif
+
+#if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <math.h>
+#else
+# include _STLP_NATIVE_C_HEADER(math.h)
+#endif
+
+#if defined (_STLP_EXCEPTION_WAS_REDEFINED)
+# undef exception
+# undef _STLP_EXCEPTION_WAS_REDEFINED
+#endif
+
+#ifdef _STLP_WCE_EVC3
+# undef _exception
+# define _exception exception
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x244)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
diff --git a/stlport/mem.h b/stlport/mem.h
new file mode 100644
index 0000000..2ebecea
--- /dev/null
+++ b/stlport/mem.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_mem_h
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x245
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x245) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x245) || defined (_STLP_DONT_POP_HEADER_ID)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <mem.h>
+# else
+# include _STLP_NATIVE_C_HEADER(mem.h)
+# endif
+#else
+# if defined (__BORLANDC__) && defined (__USING_CNAME__)
+# define _USING_CNAME_WAS_UNDEFINED
+# undef __USING_CNAME__
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <mem.h>
+# else
+# include _STLP_NATIVE_C_HEADER(mem.h)
+# endif
+
+# if defined (__BORLANDC__) && defined (_USING_CNAME_WAS_UNDEFINED)
+# define __USING_CNAME__
+# define _STLP_mem_h 1
+# undef _USING_CNAME_WAS_UNDEFINED
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x245)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
+#endif /* _STLP_mem_h */
diff --git a/stlport/memory b/stlport/memory
new file mode 100644
index 0000000..3c0ceb3
--- /dev/null
+++ b/stlport/memory
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_MEMORY
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x46
+# include <stl/_prolog.h>
+# define _STLP_MEMORY
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x46)
+# ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+# endif
+
+# ifndef _STLP_INTERNAL_TEMPBUF_H
+# include <stl/_tempbuf.h>
+# endif
+
+# ifndef _STLP_INTERNAL_RAW_STORAGE_ITER_H
+# include <stl/_raw_storage_iter.h>
+# endif
+
+# include <stl/_auto_ptr.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x46) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (__MSL__)
+# include _STLP_NATIVE_HEADER(limits)
+# endif
+
+# if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
+# define BOOST_TR1_MEMORY_INCLUDED
+# define BOOST_TR1_FULL_MEMORY_INCLUDED
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <memory>
+# else
+# include _STLP_NATIVE_HEADER(memory)
+# endif
+
+# if defined (__MSL__) && (__MSL__ >= 0x2405 && __MSL__ < 0x5201)
+/* 980401 vss MSL 2.4 Pro 3 Release */
+# include <new_mem.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x46)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
+
+namespace boost {
+
+class bad_weak_ptr;
+template<class T> class shared_ptr;
+template<class T> class weak_ptr;
+template<class T> class enable_shared_from_this;
+template<class D, class T> D * get_deleter(shared_ptr<T> const & p);
+template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r);
+template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r);
+template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r);
+template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b);
+template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b);
+
+namespace detail{
+class shared_count;
+class weak_count;
+}
+
+} // namespace boost
+
+# ifndef BOOST_SHARED_PTR_HPP_INCLUDED
+# include <boost/shared_ptr.hpp>
+# endif
+# ifndef BOOST_WEAK_PTR_HPP_INCLUDED
+# include <boost/weak_ptr.hpp>
+# endif
+# ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
+# include <boost/enable_shared_from_this.hpp>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+namespace tr1 {
+
+using ::boost::bad_weak_ptr;
+using ::boost::shared_ptr;
+using ::boost::swap;
+using ::boost::static_pointer_cast;
+using ::boost::dynamic_pointer_cast;
+using ::boost::const_pointer_cast;
+using ::boost::get_deleter;
+using ::boost::weak_ptr;
+using ::boost::enable_shared_from_this;
+
+// shared_ptr IO
+// weak_ptr IO
+
+} // namespace tr1
+
+_STLP_END_NAMESPACE
+
+#endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */
+
+#endif /* _STLP_MEMORY */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/new b/stlport/new
new file mode 100644
index 0000000..974ca44
--- /dev/null
+++ b/stlport/new
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_NEW_HEADER
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x447
+# define _STLP_NEW_HEADER
+# include <stl/_prolog.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x447)
+# ifndef _STLP_NEW_H_HEADER
+# include <stl/_new.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x447) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <new>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x447)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_NEW */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/new.h b/stlport/new.h
new file mode 100644
index 0000000..0a9bf33
--- /dev/null
+++ b/stlport/new.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x848
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x848) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if !defined(_STLP_NO_NEW_HEADER)
+# if defined (__BORLANDC__)
+# include <new>
+# elif defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <new.h>
+# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800 && !defined(_MSC_VER))
+# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h)
+# else
+# if defined (__GNUC__) && (__GNUC__ >= 3)
+# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h)
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new.h)
+# endif
+# endif
+#endif /* !defined(_STLP_NO_NEW_HEADER) */
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x848)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/numeric b/stlport/numeric
new file mode 100644
index 0000000..79e4647
--- /dev/null
+++ b/stlport/numeric
@@ -0,0 +1,54 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_NUMERIC
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x49
+# include <stl/_prolog.h>
+# define _STLP_NUMERIC
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x49)
+# ifndef _STLP_INTERNAL_NUMERIC_H
+# include <stl/_numeric.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x49) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <numeric>
+# else
+# include _STLP_NATIVE_HEADER(numeric)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x49)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_NUMERIC */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/ostream b/stlport/ostream
new file mode 100644
index 0000000..5134d9c
--- /dev/null
+++ b/stlport/ostream
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_OSTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1050
+# include <stl/_prolog.h>
+# define _STLP_OSTREAM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1050) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_OSTREAM
+# include <stl/_ostream.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1050) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <ostream>
+# else
+# include _STLP_NATIVE_HEADER(ostream)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1050)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_OSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/ostream.h b/stlport/ostream.h
similarity index 100%
rename from ostream.h
rename to stlport/ostream.h
diff --git a/stlport/pthread.h b/stlport/pthread.h
new file mode 100644
index 0000000..4f0d90c
--- /dev/null
+++ b/stlport/pthread.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x280
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x280) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if defined (__SUNPRO_CC) || defined (__HP_aCC)
+# include "/usr/include/pthread.h"
+#else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <pthread.h>
+# else
+# include _STLP_NATIVE_C_HEADER(pthread.h)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x280)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+/*
+ Local Variables:
+ mode:C++
+ End:
+*/
diff --git a/pthread_alloc b/stlport/pthread_alloc
similarity index 100%
rename from pthread_alloc
rename to stlport/pthread_alloc
diff --git a/stlport/queue b/stlport/queue
new file mode 100644
index 0000000..6acd63f
--- /dev/null
+++ b/stlport/queue
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_QUEUE
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x53
+# include <stl/_prolog.h>
+# define _STLP_QUEUE
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x53)
+# ifndef _STLP_INTERNAL_QUEUE_H
+# include <stl/_queue.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x53) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <queue>
+# else
+# include _STLP_NATIVE_HEADER(queue)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x53)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_QUEUE */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/rlocks.h b/stlport/rlocks.h
similarity index 100%
rename from rlocks.h
rename to stlport/rlocks.h
diff --git a/rope b/stlport/rope
similarity index 100%
rename from rope
rename to stlport/rope
diff --git a/stlport/set b/stlport/set
new file mode 100644
index 0000000..ed79d89
--- /dev/null
+++ b/stlport/set
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_SET
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x55
+# include <stl/_prolog.h>
+# define _STLP_SET
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x55)
+# ifndef _STLP_INTERNAL_SET_H
+# include <stl/_set.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x55) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <set>
+# else
+# include _STLP_NATIVE_HEADER(set)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x55)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_SET */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/setjmp.h b/stlport/setjmp.h
new file mode 100644
index 0000000..3d3f5ef
--- /dev/null
+++ b/stlport/setjmp.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_SETJMP_H
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x256
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x256) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_SETJMP_H
+#endif
+
+#if defined(_STLP_WCE_EVC3)
+struct _exception;
+#endif
+
+#if !defined (setjmp)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <setjmp.h>
+# else
+# include _STLP_NATIVE_C_HEADER(setjmp.h)
+# endif
+#endif
+
+#if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
+/* See errno.h file for a description of this problem. */
+# error setjmp has been defined before inclusion of setjmp.h header.
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x256)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+#endif /* _STLP_SETJMP_H */
diff --git a/stlport/signal.h b/stlport/signal.h
new file mode 100644
index 0000000..27f91be
--- /dev/null
+++ b/stlport/signal.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x257
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x257) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* evc3 and evc4 don't have signal.h */
+#ifndef _STLP_WCE
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <signal.h>
+# else
+# include _STLP_NATIVE_C_HEADER(signal.h)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x257)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# undef _STLP_DONT_POP_HEADER_ID
+#endif
+
diff --git a/slist b/stlport/slist
similarity index 100%
rename from slist
rename to stlport/slist
diff --git a/stlport/sstream b/stlport/sstream
new file mode 100644
index 0000000..336bdde
--- /dev/null
+++ b/stlport/sstream
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// This header defines classes basic_stringbuf, basic_istringstream,
+// basic_ostringstream, and basic_stringstream. These classes
+// represent streamsbufs and streams whose sources or destinations are
+// C++ strings.
+
+#ifndef _STLP_SSTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1059
+# include <stl/_prolog.h>
+# define _STLP_SSTREAM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1059) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_SSTREAM
+# include <stl/_sstream.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1059) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <sstream>
+# else
+# include _STLP_NATIVE_HEADER(sstream)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1059)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_SSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stack b/stlport/stack
new file mode 100644
index 0000000..253b31d
--- /dev/null
+++ b/stlport/stack
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STACK
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x60
+# include <stl/_prolog.h>
+# define _STLP_STACK
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x60)
+# ifndef _STLP_INTERNAL_STACK_H
+# include <stl/_stack.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x60) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stack>
+# else
+# include _STLP_NATIVE_HEADER(stack)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x60)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STACK */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stdarg.h b/stlport/stdarg.h
new file mode 100644
index 0000000..368e672
--- /dev/null
+++ b/stlport/stdarg.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include stdarg.h, which results in warnings and errors
+ */
+#if !defined (RC_INVOKED)
+
+# if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x261
+# include <stl/_cprolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x261) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# endif
+
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stdarg.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stdarg.h)
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x261)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+# endif
+#endif /* RC_INVOKED */
diff --git a/stlport/stddef.h b/stlport/stddef.h
new file mode 100644
index 0000000..f959c23
--- /dev/null
+++ b/stlport/stddef.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x262
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x262) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if defined (_MSC_VER) || defined (__DMC__)
+/* Native stddef.h contains errno macro definition making inclusion of native
+ * errno.h in STLport errno.h impossible. We are then forced to include errno.h
+ * first.
+ */
+# include "errno.h"
+#endif
+
+#if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stddef.h>
+#else
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x262)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
diff --git a/stlport/stdexcept b/stlport/stdexcept
new file mode 100644
index 0000000..dbb96b9
--- /dev/null
+++ b/stlport/stdexcept
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STDEXCEPT
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x63
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x63) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_STDEXCEPT
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x63)
+# ifndef _STLP_INTERNAL_STDEXCEPT
+# include <stl/_stdexcept.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x63) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stdexcept>
+# else
+# include _STLP_NATIVE_HEADER(stdexcept)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x63)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif /* _STLP_STDEXCEPT */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stdio.h b/stlport/stdio.h
new file mode 100644
index 0000000..e2dbdea
--- /dev/null
+++ b/stlport/stdio.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include stdarg.h, which results in warnings and errors
+ */
+#if !defined(RC_INVOKED)
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x264
+# include <stl/_cprolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x264) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# endif
+
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stdio.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stdio.h)
+# endif
+
+# if defined (__SUNPRO_CC) && !defined (_STRUCT_FILE)
+# define _STRUCT_FILE
+# endif
+
+# if defined (__BORLANDC__) && defined (__cplusplus) && !defined (__linux__)
+_STLP_BEGIN_NAMESPACE
+using __std_alias::_streams;
+_STLP_END_NAMESPACE
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x264)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+# endif
+
+#endif /* RC_INVOKED */
diff --git a/stdiostream.h b/stlport/stdiostream.h
similarity index 100%
rename from stdiostream.h
rename to stlport/stdiostream.h
diff --git a/stlport/stdlib.h b/stlport/stdlib.h
new file mode 100644
index 0000000..fd55f8a
--- /dev/null
+++ b/stlport/stdlib.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include stdlib.h, which results in warnings and errors
+ */
+#if !defined (RC_INVOKED)
+
+# if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x265
+# include <stl/_cprolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x265) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# endif
+
+# if defined (_STLP_MSVC_LIB) || (defined (__GNUC__) && defined (__MINGW32__)) || \
+ defined (__BORLANDC__) || defined (__DMC__) || \
+ (defined (__HP_aCC) && defined (_REENTRANT))
+/* Native stdlib.h contains errno macro definition making inclusion of native
+ * errno.h in STLport errno.h impossible. We are then forced to include errno.h
+ * first.
+ */
+# include "errno.h"
+# endif
+
+/*
+ forward-declaration for _exception struct; prevents warning message
+ ../include/stdlib.h(817) : warning C4115: '_exception' : named type definition in parentheses
+*/
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stdlib.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stdlib.h)
+# endif
+
+/* on evc3/evc4 including stdlib.h also defines setjmp macro */
+# if defined (_STLP_WCE)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x265)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+# endif
+
+#endif /* RC_INVOKED */
diff --git a/stl/_abbrevs.h b/stlport/stl/_abbrevs.h
similarity index 100%
rename from stl/_abbrevs.h
rename to stlport/stl/_abbrevs.h
diff --git a/stlport/stl/_algo.c b/stlport/stl/_algo.c
new file mode 100644
index 0000000..b58b92d
--- /dev/null
+++ b/stlport/stl/_algo.c
@@ -0,0 +1,2028 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_ALGO_C
+#define _STLP_ALGO_C
+
+#if !defined (_STLP_INTERNAL_ALGO_H)
+# include <stl/_algo.h>
+#endif
+
+#ifndef _STLP_INTERNAL_TEMPBUF_H
+# include <stl/_tempbuf.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter, class _Distance, class _Compare>
+void __merge_without_buffer(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last,
+ _Distance __len1, _Distance __len2,
+ _Compare __comp);
+
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _BidirectionalIter3, class _Compare>
+_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1,
+ _BidirectionalIter1 __last1,
+ _BidirectionalIter2 __first2,
+ _BidirectionalIter2 __last2,
+ _BidirectionalIter3 __result,
+ _Compare __comp);
+
+template <class _Tp>
+#if !(defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x420 ))
+inline
+#endif
+const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) {
+ if (__a < __b)
+ if (__b < __c)
+ return __b;
+ else if (__a < __c)
+ return __c;
+ else
+ return __a;
+ else if (__a < __c)
+ return __a;
+ else if (__b < __c)
+ return __c;
+ else
+ return __b;
+}
+
+template <class _Tp, class _Compare>
+#if !(defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x420 ))
+inline
+#endif
+const _Tp&
+__median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp) {
+ if (__comp(__a, __b)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__b, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ if (__comp(__b, __c)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__c, __b), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return __b;
+ }
+ else if (__comp(__a, __c)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__c, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return __c;
+ }
+ else
+ return __a;
+ }
+ else if (__comp(__a, __c)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__c, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return __a;
+ }
+ else if (__comp(__b, __c)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__c, __b), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return __c;
+ }
+ else
+ return __b;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter1, class _ForwardIter2>
+_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ // Test for empty ranges
+ if (__first1 == __last1 || __first2 == __last2)
+ return __first1;
+
+ // Test for a pattern of length 1.
+ _ForwardIter2 __p1(__first2);
+
+ if ( ++__p1 == __last2 )
+ return find(__first1, __last1, *__first2);
+
+ // General case.
+
+ for ( ; ; ) { // __first1 != __last1 will be checked in find below
+ __first1 = find(__first1, __last1, *__first2);
+ if (__first1 == __last1)
+ return __last1;
+
+ _ForwardIter2 __p = __p1;
+ _ForwardIter1 __current = __first1;
+ if (++__current == __last1)
+ return __last1;
+
+ while (*__current == *__p) {
+ if (++__p == __last2)
+ return __first1;
+ if (++__current == __last1)
+ return __last1;
+ }
+
+ ++__first1;
+ }
+ return __first1;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Integer, class _Tp,
+ class _BinaryPred, class _Distance>
+_RandomAccessIter __search_n(_RandomAccessIter __first, _RandomAccessIter __last,
+ _Integer __count, const _Tp& __val, _BinaryPred __pred,
+ _Distance*, const random_access_iterator_tag &)
+{
+ _Distance __tailSize = __last - __first;
+ const _Distance __pattSize = __count;
+ const _Distance __skipOffset = __pattSize - 1;
+ _RandomAccessIter __backTrack;
+ _Distance __remainder, __prevRemainder;
+
+ for ( _RandomAccessIter __lookAhead = __first + __skipOffset; __tailSize >= __pattSize; __lookAhead += __pattSize ) { // the main loop...
+ //__lookAhead here is always pointing to the last element of next possible match.
+ __tailSize -= __pattSize;
+
+ while ( !__pred(*__lookAhead, __val) ) { // the skip loop...
+ if (__tailSize < __pattSize)
+ return __last;
+
+ __lookAhead += __pattSize;
+ __tailSize -= __pattSize;
+ }
+
+ if ( __skipOffset == 0 ) {
+ return (__lookAhead - __skipOffset); //Success
+ }
+
+ __remainder = __skipOffset;
+
+ for (__backTrack = __lookAhead; __pred(*--__backTrack, __val); ) {
+ if (--__remainder == 0)
+ return (__lookAhead - __skipOffset); //Success
+ }
+
+ if (__remainder > __tailSize)
+ return __last; //failure
+
+ __lookAhead += __remainder;
+ __tailSize -= __remainder;
+
+ while ( __pred(*__lookAhead, __val) ) {
+ __prevRemainder = __remainder;
+ __backTrack = __lookAhead;
+
+ do {
+ if (--__remainder == 0)
+ return (__lookAhead - __skipOffset); //Success
+ } while (__pred(*--__backTrack, __val));
+
+ //adjust remainder for next comparison
+ __remainder += __pattSize - __prevRemainder;
+
+ if (__remainder > __tailSize)
+ return __last; //failure
+
+ __lookAhead += __remainder;
+ __tailSize -= __remainder;
+ }
+
+ //__lookAhead here is always pointing to the element of the last mismatch.
+ }
+
+ return __last; //failure
+}
+
+template <class _ForwardIter, class _Integer, class _Tp,
+ class _Distance, class _BinaryPred>
+_ForwardIter __search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val, _BinaryPred __pred,
+ _Distance*, const forward_iterator_tag &) {
+ for (; (__first != __last) && !__pred(*__first, __val); ++__first) {}
+ while (__first != __last) {
+ _Integer __n = __count - 1;
+ _ForwardIter __i = __first;
+ ++__i;
+ while (__i != __last && __n != 0 && __pred(*__i, __val)) {
+ ++__i;
+ --__n;
+ }
+ if (__n == 0)
+ return __first;
+ else if (__i != __last)
+ for (__first = ++__i; (__first != __last) && !__pred(*__first, __val); ++__first) {}
+ else
+ break;
+ }
+ return __last;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// search_n. Search for __count consecutive copies of __val.
+template <class _ForwardIter, class _Integer, class _Tp>
+_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__count <= 0)
+ return __first;
+ if (__count == 1)
+ //We use find when __count == 1 to use potential find overload.
+ return find(__first, __last, __val);
+ return _STLP_PRIV __search_n(__first, __last, __count, __val, equal_to<_Tp>(),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter),
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Integer, class _Tp, class _BinaryPred>
+_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val,
+ _BinaryPred __binary_pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__count <= 0)
+ return __first;
+ return _STLP_PRIV __search_n(__first, __last, __count, __val, __binary_pred,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter),
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+template <class _ForwardIter1, class _ForwardIter2>
+_ForwardIter1
+find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __find_end(__first1, __last1, __first2, __last2,
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ _STLP_ITERATOR_CATEGORY(__first1, _ForwardIter1),
+ _STLP_ITERATOR_CATEGORY(__first2, _ForwardIter2),
+#else
+ forward_iterator_tag(),
+ forward_iterator_tag(),
+#endif
+ _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _ForwardIter1))
+ );
+}
+
+// unique and unique_copy
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIterator, class _OutputIterator, class _BinaryPredicate,
+ class _Tp>
+_STLP_INLINE_LOOP _OutputIterator
+__unique_copy(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result,
+ _BinaryPredicate __binary_pred, _Tp*) {
+ _Tp __val = *__first;
+ *__result = __val;
+ while (++__first != __last)
+ if (!__binary_pred(__val, *__first)) {
+ __val = *__first;
+ *++__result = __val;
+ }
+ return ++__result;
+}
+
+template <class _InputIter, class _OutputIter, class _BinaryPredicate>
+inline _OutputIter
+__unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
+ _BinaryPredicate __binary_pred, const output_iterator_tag &) {
+ return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred,
+ _STLP_VALUE_TYPE(__first, _InputIter));
+}
+
+template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
+_STLP_INLINE_LOOP _ForwardIter
+__unique_copy(_InputIter __first, _InputIter __last, _ForwardIter __result,
+ _BinaryPredicate __binary_pred, const forward_iterator_tag &) {
+ *__result = *__first;
+ while (++__first != __last)
+ if (!__binary_pred(*__result, *__first)) *++__result = *__first;
+ return ++__result;
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _InputIterator, class _BidirectionalIterator, class _BinaryPredicate>
+inline _BidirectionalIterator
+__unique_copy(_InputIterator __first, _InputIterator __last,
+ _BidirectionalIterator __result, _BinaryPredicate __binary_pred,
+ const bidirectional_iterator_tag &) {
+ return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred, forward_iterator_tag());
+}
+
+template <class _InputIterator, class _RandomAccessIterator, class _BinaryPredicate>
+inline _RandomAccessIterator
+__unique_copy(_InputIterator __first, _InputIterator __last,
+ _RandomAccessIterator __result, _BinaryPredicate __binary_pred,
+ const random_access_iterator_tag &) {
+ return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred, forward_iterator_tag());
+}
+#endif /* _STLP_NONTEMPL_BASE_MATCH_BUG */
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _OutputIter>
+_OutputIter
+unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __result;
+ return _STLP_PRIV __unique_copy(__first, __last, __result,
+ _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _InputIter)),
+ _STLP_ITERATOR_CATEGORY(__result, _OutputIter));
+}
+
+template <class _InputIter, class _OutputIter, class _BinaryPredicate>
+_OutputIter
+unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
+ _BinaryPredicate __binary_pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __result;
+ return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred,
+ _STLP_ITERATOR_CATEGORY(__result, _OutputIter));
+}
+
+// rotate and rotate_copy, and their auxiliary functions
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Distance>
+_ForwardIter __rotate_aux(_ForwardIter __first,
+ _ForwardIter __middle,
+ _ForwardIter __last,
+ _Distance*,
+ const forward_iterator_tag &) {
+ if (__first == __middle)
+ return __last;
+ if (__last == __middle)
+ return __first;
+
+ _ForwardIter __first2 = __middle;
+ do {
+ _STLP_STD::swap(*__first++, *__first2++);
+ if (__first == __middle)
+ __middle = __first2;
+ } while (__first2 != __last);
+
+ _ForwardIter __new_middle = __first;
+
+ __first2 = __middle;
+
+ while (__first2 != __last) {
+ _STLP_STD::swap (*__first++, *__first2++);
+ if (__first == __middle)
+ __middle = __first2;
+ else if (__first2 == __last)
+ __first2 = __middle;
+ }
+
+ return __new_middle;
+}
+
+template <class _BidirectionalIter, class _Distance>
+_BidirectionalIter __rotate_aux(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last,
+ _Distance*,
+ const bidirectional_iterator_tag &) {
+ if (__first == __middle)
+ return __last;
+ if (__last == __middle)
+ return __first;
+
+ _STLP_PRIV __reverse(__first, __middle, bidirectional_iterator_tag());
+ _STLP_PRIV __reverse(__middle, __last, bidirectional_iterator_tag());
+
+ while (__first != __middle && __middle != __last)
+ _STLP_STD::swap(*__first++, *--__last);
+
+ if (__first == __middle) {
+ _STLP_PRIV __reverse(__middle, __last, bidirectional_iterator_tag());
+ return __last;
+ }
+ else {
+ _STLP_PRIV __reverse(__first, __middle, bidirectional_iterator_tag());
+ return __first;
+ }
+}
+
+// rotate and rotate_copy, and their auxiliary functions
+template <class _EuclideanRingElement>
+_STLP_INLINE_LOOP
+_EuclideanRingElement __gcd(_EuclideanRingElement __m,
+ _EuclideanRingElement __n) {
+ while (__n != 0) {
+ _EuclideanRingElement __t = __m % __n;
+ __m = __n;
+ __n = __t;
+ }
+ return __m;
+}
+
+template <class _RandomAccessIter, class _Distance, class _Tp>
+_RandomAccessIter __rotate_aux(_RandomAccessIter __first,
+ _RandomAccessIter __middle,
+ _RandomAccessIter __last,
+ _Distance *, _Tp *) {
+
+ _Distance __n = __last - __first;
+ _Distance __k = __middle - __first;
+ _Distance __l = __n - __k;
+ _RandomAccessIter __result = __first + (__last - __middle);
+
+ if (__k == 0) /* __first == middle */
+ return __last;
+
+ if (__k == __l) {
+ _STLP_STD::swap_ranges(__first, __middle, __middle);
+ return __result;
+ }
+
+ _Distance __d = _STLP_PRIV __gcd(__n, __k);
+
+ for (_Distance __i = 0; __i < __d; __i++) {
+ _Tp __tmp = *__first;
+ _RandomAccessIter __p = __first;
+
+ if (__k < __l) {
+ for (_Distance __j = 0; __j < __l/__d; __j++) {
+ if (__p > __first + __l) {
+ *__p = *(__p - __l);
+ __p -= __l;
+ }
+
+ *__p = *(__p + __k);
+ __p += __k;
+ }
+ }
+
+ else {
+ for (_Distance __j = 0; __j < __k/__d - 1; __j ++) {
+ if (__p < __last - __k) {
+ *__p = *(__p + __k);
+ __p += __k;
+ }
+
+ *__p = * (__p - __l);
+ __p -= __l;
+ }
+ }
+
+ *__p = __tmp;
+ ++__first;
+ }
+
+ return __result;
+}
+
+template <class _RandomAccessIter, class _Distance>
+inline _RandomAccessIter
+__rotate_aux(_RandomAccessIter __first, _RandomAccessIter __middle, _RandomAccessIter __last,
+ _Distance * __dis, const random_access_iterator_tag &) {
+ return _STLP_PRIV __rotate_aux(__first, __middle, __last,
+ __dis, _STLP_VALUE_TYPE(__first, _RandomAccessIter));
+}
+
+template <class _ForwardIter>
+_ForwardIter
+__rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(__check_range(__middle, __last))
+ return __rotate_aux(__first, __middle, __last,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter),
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter>
+void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last) {
+ _STLP_PRIV __rotate(__first, __middle, __last);
+}
+
+// Return a random number in the range [0, __n). This function encapsulates
+// whether we're using rand (part of the standard C library) or lrand48
+// (not standard, but a much better choice whenever it's available).
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Distance>
+inline _Distance __random_number(_Distance __n) {
+#ifdef _STLP_NO_DRAND48
+ return rand() % __n;
+#else
+ return lrand48() % __n;
+#endif
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void random_shuffle(_RandomAccessIter __first,
+ _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return;
+ for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
+ iter_swap(__i, __first + _STLP_PRIV __random_number((__i - __first) + 1));
+}
+
+template <class _RandomAccessIter, class _RandomNumberGenerator>
+void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last,
+ _RandomNumberGenerator &__rand) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return;
+ for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
+ iter_swap(__i, __first + __rand((__i - __first) + 1));
+}
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// random_sample and random_sample_n (extensions, not part of the standard).
+template <class _ForwardIter, class _OutputIter, class _Distance>
+_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
+ _OutputIter __out_ite, const _Distance __n) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Distance __remaining = _STLP_STD::distance(__first, __last);
+ _Distance __m = (min) (__n, __remaining);
+
+ while (__m > 0) {
+ if (_STLP_PRIV __random_number(__remaining) < __m) {
+ *__out_ite = *__first;
+ ++__out_ite;
+ --__m;
+ }
+
+ --__remaining;
+ ++__first;
+ }
+ return __out_ite;
+}
+
+
+template <class _ForwardIter, class _OutputIter, class _Distance,
+ class _RandomNumberGenerator>
+_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
+ _OutputIter __out_ite, const _Distance __n,
+ _RandomNumberGenerator& __rand) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Distance __remaining = _STLP_STD::distance(__first, __last);
+ _Distance __m = (min) (__n, __remaining);
+
+ while (__m > 0) {
+ if (__rand(__remaining) < __m) {
+ *__out_ite = *__first;
+ ++__out_ite;
+ --__m;
+ }
+
+ --__remaining;
+ ++__first;
+ }
+ return __out_ite;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _RandomAccessIter, class _Distance>
+_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_ite,
+ const _Distance __n) {
+ _Distance __m = 0;
+ _Distance __t = __n;
+ for ( ; __first != __last && __m < __n; ++__m, ++__first)
+ __out_ite[__m] = *__first;
+
+ while (__first != __last) {
+ ++__t;
+ _Distance __M = __random_number(__t);
+ if (__M < __n)
+ __out_ite[__M] = *__first;
+ ++__first;
+ }
+
+ return __out_ite + __m;
+}
+
+template <class _InputIter, class _RandomAccessIter,
+ class _RandomNumberGenerator, class _Distance>
+_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_ite,
+ _RandomNumberGenerator& __rand,
+ const _Distance __n) {
+ _Distance __m = 0;
+ _Distance __t = __n;
+ for ( ; __first != __last && __m < __n; ++__m, ++__first)
+ __out_ite[__m] = *__first;
+
+ while (__first != __last) {
+ ++__t;
+ _Distance __M = __rand(__t);
+ if (__M < __n)
+ __out_ite[__M] = *__first;
+ ++__first;
+ }
+
+ return __out_ite + __m;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _RandomAccessIter>
+_RandomAccessIter
+random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_first, _RandomAccessIter __out_last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__out_first, __out_last))
+ return _STLP_PRIV __random_sample(__first, __last,
+ __out_first, __out_last - __out_first);
+}
+
+template <class _InputIter, class _RandomAccessIter, class _RandomNumberGenerator>
+_RandomAccessIter
+random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_first, _RandomAccessIter __out_last,
+ _RandomNumberGenerator& __rand) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__out_first, __out_last))
+ return _STLP_PRIV __random_sample(__first, __last,
+ __out_first, __rand,
+ __out_last - __out_first);
+}
+
+#endif /* _STLP_NO_EXTENSIONS */
+
+// partition, stable_partition, and their auxiliary functions
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Predicate>
+_STLP_INLINE_LOOP _ForwardIter __partition(_ForwardIter __first,
+ _ForwardIter __last,
+ _Predicate __pred,
+ const forward_iterator_tag &) {
+ if (__first == __last) return __first;
+
+ while (__pred(*__first))
+ if (++__first == __last) return __first;
+
+ _ForwardIter __next = __first;
+
+ while (++__next != __last) {
+ if (__pred(*__next)) {
+ _STLP_STD::swap(*__first, *__next);
+ ++__first;
+ }
+ }
+ return __first;
+}
+
+template <class _BidirectionalIter, class _Predicate>
+_STLP_INLINE_LOOP _BidirectionalIter __partition(_BidirectionalIter __first,
+ _BidirectionalIter __last,
+ _Predicate __pred,
+ const bidirectional_iterator_tag &) {
+ for (;;) {
+ for (;;) {
+ if (__first == __last)
+ return __first;
+ else if (__pred(*__first))
+ ++__first;
+ else
+ break;
+ }
+ --__last;
+ for (;;) {
+ if (__first == __last)
+ return __first;
+ else if (!__pred(*__last))
+ --__last;
+ else
+ break;
+ }
+ iter_swap(__first, __last);
+ ++__first;
+ }
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _BidirectionalIter, class _Predicate>
+inline
+_BidirectionalIter __partition(_BidirectionalIter __first,
+ _BidirectionalIter __last,
+ _Predicate __pred,
+ const random_access_iterator_tag &) {
+ return __partition(__first, __last, __pred, bidirectional_iterator_tag());
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __partition(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+
+/* __pred_of_first: false if we know that __pred(*__first) is false,
+ * true when we don't know the result of __pred(*__first).
+ * __not_pred_of_before_last: true if we know that __pred(*--__last) is true,
+ * false when we don't know the result of __pred(*--__last).
+ */
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Predicate, class _Distance>
+_ForwardIter __inplace_stable_partition(_ForwardIter __first,
+ _ForwardIter __last,
+ _Predicate __pred, _Distance __len,
+ bool __pred_of_first, bool __pred_of_before_last) {
+ if (__len == 1)
+ return (__pred_of_first && (__pred_of_before_last || __pred(*__first))) ? __last : __first;
+ _ForwardIter __middle = __first;
+ _Distance __half_len = __len / 2;
+ _STLP_STD::advance(__middle, __half_len);
+ return _STLP_PRIV __rotate(_STLP_PRIV __inplace_stable_partition(__first, __middle, __pred, __half_len, __pred_of_first, false),
+ __middle,
+ _STLP_PRIV __inplace_stable_partition(__middle, __last, __pred, __len - __half_len, true, __pred_of_before_last));
+}
+
+template <class _ForwardIter, class _Pointer, class _Predicate,
+ class _Distance>
+_ForwardIter __stable_partition_adaptive(_ForwardIter __first,
+ _ForwardIter __last,
+ _Predicate __pred, _Distance __len,
+ _Pointer __buffer, _Distance __buffer_size,
+ bool __pred_of_first, bool __pred_of_before_last) {
+ if (__len <= __buffer_size) {
+ _ForwardIter __result1 = __first;
+ _Pointer __result2 = __buffer;
+ if ((__first != __last) && (!__pred_of_first || __pred(*__first))) {
+ *__result2 = *__first;
+ ++__result2; ++__first; --__len;
+ }
+ for (; __first != __last ; ++__first, --__len) {
+ if (((__len == 1) && (__pred_of_before_last || __pred(*__first))) ||
+ ((__len != 1) && __pred(*__first))){
+ *__result1 = *__first;
+ ++__result1;
+ }
+ else {
+ *__result2 = *__first;
+ ++__result2;
+ }
+ }
+ _STLP_STD::copy(__buffer, __result2, __result1);
+ return __result1;
+ }
+ else {
+ _ForwardIter __middle = __first;
+ _Distance __half_len = __len / 2;
+ _STLP_STD::advance(__middle, __half_len);
+ return _STLP_PRIV __rotate(_STLP_PRIV __stable_partition_adaptive(__first, __middle, __pred,
+ __half_len, __buffer, __buffer_size,
+ __pred_of_first, false),
+ __middle,
+ _STLP_PRIV __stable_partition_adaptive(__middle, __last, __pred,
+ __len - __half_len, __buffer, __buffer_size,
+ true, __pred_of_before_last));
+ }
+}
+
+template <class _ForwardIter, class _Predicate, class _Tp, class _Distance>
+inline _ForwardIter
+__stable_partition_aux_aux(_ForwardIter __first, _ForwardIter __last,
+ _Predicate __pred, _Tp*, _Distance*, bool __pred_of_before_last) {
+ _Temporary_buffer<_ForwardIter, _Tp> __buf(__first, __last);
+ _STLP_MPWFIX_TRY //*TY 06/01/2000 - they forget to call dtor for _Temporary_buffer if no try/catch block is present
+ return (__buf.size() > 0) ?
+ __stable_partition_adaptive(__first, __last, __pred,
+ _Distance(__buf.requested_size()),
+ __buf.begin(), __buf.size(),
+ false, __pred_of_before_last) :
+ __inplace_stable_partition(__first, __last, __pred,
+ _Distance(__buf.requested_size()),
+ false, __pred_of_before_last);
+ _STLP_MPWFIX_CATCH //*TY 06/01/2000 - they forget to call dtor for _Temporary_buffer if no try/catch block is present
+}
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter
+__stable_partition_aux(_ForwardIter __first, _ForwardIter __last, _Predicate __pred,
+ const forward_iterator_tag &) {
+ return __stable_partition_aux_aux(__first, __last, __pred,
+ _STLP_VALUE_TYPE(__first, _ForwardIter),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter), false);
+}
+
+template <class _BidirectIter, class _Predicate>
+_BidirectIter
+__stable_partition_aux(_BidirectIter __first, _BidirectIter __last, _Predicate __pred,
+ const bidirectional_iterator_tag &) {
+ for (--__last;;) {
+ if (__first == __last)
+ return __first;
+ else if (!__pred(*__last))
+ --__last;
+ else
+ break;
+ }
+ ++__last;
+ //Here we know that __pred(*--__last) is true
+ return __stable_partition_aux_aux(__first, __last, __pred,
+ _STLP_VALUE_TYPE(__first, _BidirectIter),
+ _STLP_DISTANCE_TYPE(__first, _BidirectIter), true);
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _BidirectIter, class _Predicate>
+_BidirectIter
+__stable_partition_aux(_BidirectIter __first, _BidirectIter __last, _Predicate __pred,
+ const random_access_iterator_tag &) {
+ return __stable_partition_aux(__first, __last, __pred, bidirectional_iterator_tag());
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter
+stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for (;;) {
+ if (__first == __last)
+ return __first;
+ else if (__pred(*__first))
+ ++__first;
+ else
+ break;
+ }
+ return _STLP_PRIV __stable_partition_aux(__first, __last, __pred,
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+_RandomAccessIter __unguarded_partition(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Tp __pivot, _Compare __comp) {
+ for (;;) {
+ while (__comp(*__first, __pivot)) {
+ _STLP_VERBOSE_ASSERT(!__comp(__pivot, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ ++__first;
+ }
+ --__last;
+ while (__comp(__pivot, *__last)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__last, __pivot), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ --__last;
+ }
+ if (!(__first < __last))
+ return __first;
+ iter_swap(__first, __last);
+ ++__first;
+ }
+}
+
+// sort() and its auxiliary functions.
+#define __stl_threshold 16
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val,
+ _Compare __comp) {
+ _RandomAccessIter __next = __last;
+ --__next;
+ while (__comp(__val, *__next)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__next, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__last = *__next;
+ __last = __next;
+ --__next;
+ }
+ *__last = __val;
+}
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+inline void __linear_insert(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Tp __val, _Compare __comp) {
+ //*TY 12/26/1998 - added __val as a paramter
+ // _Tp __val = *__last; //*TY 12/26/1998 - __val supplied by caller
+ if (__comp(__val, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ copy_backward(__first, __last, __last + 1);
+ *__first = __val;
+ }
+ else
+ __unguarded_linear_insert(__last, __val, __comp);
+}
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __insertion_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Tp *, _Compare __comp) {
+ if (__first == __last) return;
+ for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
+ __linear_insert<_RandomAccessIter, _Tp, _Compare>(__first, __i, *__i, __comp); //*TY 12/26/1998 - supply *__i as __val
+}
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __unguarded_insertion_sort_aux(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Tp*, _Compare __comp) {
+ for (_RandomAccessIter __i = __first; __i != __last; ++__i)
+ __unguarded_linear_insert<_RandomAccessIter, _Tp, _Compare>(__i, *__i, __comp);
+}
+
+template <class _RandomAccessIter, class _Compare>
+inline void __unguarded_insertion_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Compare __comp) {
+ __unguarded_insertion_sort_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp);
+}
+
+template <class _RandomAccessIter, class _Compare>
+void __final_insertion_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Compare __comp) {
+ if (__last - __first > __stl_threshold) {
+ __insertion_sort(__first, __first + __stl_threshold, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+ __unguarded_insertion_sort(__first + __stl_threshold, __last, __comp);
+ }
+ else
+ __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+}
+
+template <class _RandomAccessIter, class _Tp, class _Size, class _Compare>
+void __introsort_loop(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Tp*,
+ _Size __depth_limit, _Compare __comp) {
+ while (__last - __first > __stl_threshold) {
+ if (__depth_limit == 0) {
+ partial_sort(__first, __last, __last, __comp);
+ return;
+ }
+ --__depth_limit;
+ _RandomAccessIter __cut =
+ __unguarded_partition(__first, __last,
+ _Tp(__median(*__first,
+ *(__first + (__last - __first)/2),
+ *(__last - 1), __comp)),
+ __comp);
+ __introsort_loop(__cut, __last, (_Tp*) 0, __depth_limit, __comp);
+ __last = __cut;
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void sort(_RandomAccessIter __first, _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first != __last) {
+ _STLP_PRIV __introsort_loop(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __lg(__last - __first) * 2,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+ _STLP_PRIV __final_insertion_sort(__first, __last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+ }
+}
+
+template <class _RandomAccessIter, class _Compare>
+void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first != __last) {
+ _STLP_PRIV __introsort_loop(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __lg(__last - __first) * 2, __comp);
+ _STLP_PRIV __final_insertion_sort(__first, __last, __comp);
+ }
+}
+
+// stable_sort() and its auxiliary functions.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Compare>
+void __inplace_stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Compare __comp) {
+ if (__last - __first < 15) {
+ __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+ return;
+ }
+ _RandomAccessIter __middle = __first + (__last - __first) / 2;
+ __inplace_stable_sort(__first, __middle, __comp);
+ __inplace_stable_sort(__middle, __last, __comp);
+ __merge_without_buffer(__first, __middle, __last,
+ __middle - __first,
+ __last - __middle,
+ __comp);
+}
+
+template <class _RandomAccessIter1, class _RandomAccessIter2,
+ class _Distance, class _Compare>
+void __merge_sort_loop(_RandomAccessIter1 __first,
+ _RandomAccessIter1 __last,
+ _RandomAccessIter2 __result, _Distance __step_size,
+ _Compare __comp) {
+ _Distance __two_step = 2 * __step_size;
+
+ while (__last - __first >= __two_step) {
+ __result = merge(__first, __first + __step_size,
+ __first + __step_size, __first + __two_step,
+ __result,
+ __comp);
+ __first += __two_step;
+ }
+ __step_size = (min) (_Distance(__last - __first), __step_size);
+
+ merge(__first, __first + __step_size,
+ __first + __step_size, __last,
+ __result,
+ __comp);
+}
+
+const int __stl_chunk_size = 7;
+
+template <class _RandomAccessIter, class _Distance, class _Compare>
+void __chunk_insertion_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _Distance __chunk_size, _Compare __comp) {
+ while (__last - __first >= __chunk_size) {
+ __insertion_sort(__first, __first + __chunk_size,
+ _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+ __first += __chunk_size;
+ }
+ __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+}
+
+template <class _RandomAccessIter, class _Pointer, class _Distance,
+ class _Compare>
+void __merge_sort_with_buffer(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Pointer __buffer,
+ _Distance*, _Compare __comp) {
+ _Distance __len = __last - __first;
+ _Pointer __buffer_last = __buffer + __len;
+
+ _Distance __step_size = __stl_chunk_size;
+ __chunk_insertion_sort(__first, __last, __step_size, __comp);
+
+ while (__step_size < __len) {
+ __merge_sort_loop(__first, __last, __buffer, __step_size, __comp);
+ __step_size *= 2;
+ __merge_sort_loop(__buffer, __buffer_last, __first, __step_size, __comp);
+ __step_size *= 2;
+ }
+}
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _Distance>
+_BidirectionalIter1 __rotate_adaptive(_BidirectionalIter1 __first,
+ _BidirectionalIter1 __middle,
+ _BidirectionalIter1 __last,
+ _Distance __len1, _Distance __len2,
+ _BidirectionalIter2 __buffer,
+ _Distance __buffer_size) {
+ if (__len1 > __len2 && __len2 <= __buffer_size) {
+ _BidirectionalIter2 __buffer_end = _STLP_STD::copy(__middle, __last, __buffer);
+ _STLP_STD::copy_backward(__first, __middle, __last);
+ return _STLP_STD::copy(__buffer, __buffer_end, __first);
+ }
+ else if (__len1 <= __buffer_size) {
+ _BidirectionalIter2 __buffer_end = _STLP_STD::copy(__first, __middle, __buffer);
+ _STLP_STD::copy(__middle, __last, __first);
+ return _STLP_STD::copy_backward(__buffer, __buffer_end, __last);
+ }
+ else
+ return _STLP_PRIV __rotate(__first, __middle, __last);
+}
+
+template <class _BidirectionalIter, class _Distance, class _Pointer,
+ class _Compare>
+void __merge_adaptive(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last,
+ _Distance __len1, _Distance __len2,
+ _Pointer __buffer, _Distance __buffer_size,
+ _Compare __comp) {
+ if (__len1 <= __len2 && __len1 <= __buffer_size) {
+ _Pointer __buffer_end = _STLP_STD::copy(__first, __middle, __buffer);
+ _STLP_STD::merge(__buffer, __buffer_end, __middle, __last, __first, __comp);
+ }
+ else if (__len2 <= __buffer_size) {
+ _Pointer __buffer_end = _STLP_STD::copy(__middle, __last, __buffer);
+ _STLP_PRIV __merge_backward(__first, __middle, __buffer, __buffer_end, __last,
+ __comp);
+ }
+ else {
+ _BidirectionalIter __first_cut = __first;
+ _BidirectionalIter __second_cut = __middle;
+ _Distance __len11 = 0;
+ _Distance __len22 = 0;
+ if (__len1 > __len2) {
+ __len11 = __len1 / 2;
+ _STLP_STD::advance(__first_cut, __len11);
+ __second_cut = _STLP_STD::lower_bound(__middle, __last, *__first_cut, __comp);
+ __len22 += _STLP_STD::distance(__middle, __second_cut);
+ }
+ else {
+ __len22 = __len2 / 2;
+ _STLP_STD::advance(__second_cut, __len22);
+ __first_cut = _STLP_STD::upper_bound(__first, __middle, *__second_cut, __comp);
+ __len11 += _STLP_STD::distance(__first, __first_cut);
+ }
+ _BidirectionalIter __new_middle =
+ __rotate_adaptive(__first_cut, __middle, __second_cut, __len1 - __len11,
+ __len22, __buffer, __buffer_size);
+ __merge_adaptive(__first, __first_cut, __new_middle, __len11,
+ __len22, __buffer, __buffer_size, __comp);
+ __merge_adaptive(__new_middle, __second_cut, __last, __len1 - __len11,
+ __len2 - __len22, __buffer, __buffer_size, __comp);
+ }
+}
+
+template <class _RandomAccessIter, class _Pointer, class _Distance,
+ class _Compare>
+void __stable_sort_adaptive(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Pointer __buffer,
+ _Distance __buffer_size, _Compare __comp) {
+ _Distance __len = (__last - __first + 1) / 2;
+ _RandomAccessIter __middle = __first + __len;
+ if (__len > __buffer_size) {
+ __stable_sort_adaptive(__first, __middle, __buffer, __buffer_size,
+ __comp);
+ __stable_sort_adaptive(__middle, __last, __buffer, __buffer_size,
+ __comp);
+ }
+ else {
+ __merge_sort_with_buffer(__first, __middle, __buffer, (_Distance*)0,
+ __comp);
+ __merge_sort_with_buffer(__middle, __last, __buffer, (_Distance*)0,
+ __comp);
+ }
+ __merge_adaptive(__first, __middle, __last, _Distance(__middle - __first),
+ _Distance(__last - __middle), __buffer, __buffer_size,
+ __comp);
+}
+
+template <class _RandomAccessIter, class _Tp, class _Distance, class _Compare>
+void __stable_sort_aux(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Tp*, _Distance*,
+ _Compare __comp) {
+ _Temporary_buffer<_RandomAccessIter, _Tp> buf(__first, __last);
+ if (buf.begin() == 0)
+ __inplace_stable_sort(__first, __last, __comp);
+ else
+ __stable_sort_adaptive(__first, __last, buf.begin(),
+ _Distance(buf.size()),
+ __comp);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_PRIV __stable_sort_aux(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+}
+
+template <class _RandomAccessIter, class _Compare>
+void stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_PRIV __stable_sort_aux(__first, __last,
+ _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIter),
+ __comp);
+}
+
+// partial_sort, partial_sort_copy, and auxiliary functions.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle,
+ _RandomAccessIter __last, _Tp*, _Compare __comp) {
+ make_heap(__first, __middle, __comp);
+ for (_RandomAccessIter __i = __middle; __i < __last; ++__i) {
+ if (__comp(*__i, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, *__i), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __pop_heap(__first, __middle, __i, _Tp(*__i), __comp,
+ _STLP_DISTANCE_TYPE(__first, _RandomAccessIter));
+ }
+ }
+ sort_heap(__first, __middle, __comp);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
+ _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
+ _STLP_PRIV __partial_sort(__first, __middle, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+}
+
+template <class _RandomAccessIter, class _Compare>
+void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
+ _RandomAccessIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
+ _STLP_PRIV __partial_sort(__first, __middle, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _RandomAccessIter, class _Compare,
+ class _Distance, class _Tp>
+_RandomAccessIter __partial_sort_copy(_InputIter __first,
+ _InputIter __last,
+ _RandomAccessIter __result_first,
+ _RandomAccessIter __result_last,
+ _Compare __comp, _Distance*, _Tp*) {
+ if (__result_first == __result_last) return __result_last;
+ _RandomAccessIter __result_real_last = __result_first;
+ while(__first != __last && __result_real_last != __result_last) {
+ *__result_real_last = *__first;
+ ++__result_real_last;
+ ++__first;
+ }
+ make_heap(__result_first, __result_real_last, __comp);
+ while (__first != __last) {
+ if (__comp(*__first, *__result_first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__result_first, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __adjust_heap(__result_first, _Distance(0),
+ _Distance(__result_real_last - __result_first),
+ _Tp(*__first),
+ __comp);
+ }
+ ++__first;
+ }
+ sort_heap(__result_first, __result_real_last, __comp);
+ return __result_real_last;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _RandomAccessIter>
+_RandomAccessIter
+partial_sort_copy(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __result_first, _RandomAccessIter __result_last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__result_first, __result_last))
+ return _STLP_PRIV __partial_sort_copy(__first, __last, __result_first, __result_last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _InputIter)),
+ _STLP_DISTANCE_TYPE(__result_first, _RandomAccessIter),
+ _STLP_VALUE_TYPE(__first, _InputIter));
+}
+
+template <class _InputIter, class _RandomAccessIter, class _Compare>
+_RandomAccessIter
+partial_sort_copy(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __result_first,
+ _RandomAccessIter __result_last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__result_first, __result_last))
+ return _STLP_PRIV __partial_sort_copy(__first, __last, __result_first, __result_last,
+ __comp,
+ _STLP_DISTANCE_TYPE(__result_first, _RandomAccessIter),
+ _STLP_VALUE_TYPE(__first, _InputIter));
+}
+
+// nth_element() and its auxiliary functions.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Tp, class _Compare>
+void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last, _Tp*, _Compare __comp) {
+ while (__last - __first > 3) {
+ _RandomAccessIter __cut =
+ __unguarded_partition(__first, __last,
+ _Tp(__median(*__first,
+ *(__first + (__last - __first)/2),
+ *(__last - 1),
+ __comp)),
+ __comp);
+ if (__cut <= __nth)
+ __first = __cut;
+ else
+ __last = __cut;
+ }
+ __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __nth))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__nth, __last))
+ _STLP_PRIV __nth_element(__first, __nth, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter),
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)));
+}
+
+template <class _RandomAccessIter, class _Compare>
+void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __nth))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__nth, __last))
+ _STLP_PRIV __nth_element(__first, __nth, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp);
+}
+
+// Binary search (lower_bound, upper_bound, equal_range, binary_search).
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp,
+ class _Compare1, class _Compare2, class _Distance>
+_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance*) {
+ _Distance __len = _STLP_STD::distance(__first, __last);
+ _Distance __half;
+
+ while (__len > 0) {
+ __half = __len >> 1;
+ _ForwardIter __middle = __first;
+ _STLP_STD::advance(__middle, __half);
+ if (__comp2(__val, *__middle)) {
+ _STLP_VERBOSE_ASSERT(!__comp1(*__middle, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __len = __half;
+ }
+ else {
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ }
+ return __first;
+}
+
+template <class _ForwardIter, class _Tp,
+ class _Compare1, class _Compare2, class _Distance>
+pair<_ForwardIter, _ForwardIter>
+__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance* __dist) {
+ _Distance __len = _STLP_STD::distance(__first, __last);
+ _Distance __half;
+
+ while (__len > 0) {
+ __half = __len >> 1;
+ _ForwardIter __middle = __first;
+ _STLP_STD::advance(__middle, __half);
+ if (__comp1(*__middle, __val)) {
+ _STLP_VERBOSE_ASSERT(!__comp2(__val, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ else if (__comp2(__val, *__middle)) {
+ _STLP_VERBOSE_ASSERT(!__comp1(*__middle, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __len = __half;
+ }
+ else {
+ _ForwardIter __left = _STLP_PRIV __lower_bound(__first, __middle, __val, __comp1, __comp2, __dist);
+ //Small optim: If lower_bound haven't found an equivalent value
+ //there is no need to call upper_bound.
+ if (__comp1(*__left, __val)) {
+ _STLP_VERBOSE_ASSERT(!__comp2(__val, *__left), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return pair<_ForwardIter, _ForwardIter>(__left, __left);
+ }
+ _STLP_STD::advance(__first, __len);
+ _ForwardIter __right = _STLP_PRIV __upper_bound(++__middle, __first, __val, __comp1, __comp2, __dist);
+ return pair<_ForwardIter, _ForwardIter>(__left, __right);
+ }
+ }
+ return pair<_ForwardIter, _ForwardIter>(__first, __first);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (*__first2 < *__first1) {
+ *__result = *__first2;
+ ++__first2;
+ }
+ else {
+ *__result = *__first1;
+ ++__first1;
+ }
+ ++__result;
+ }
+ return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first2;
+ ++__first2;
+ }
+ else {
+ *__result = *__first1;
+ ++__first1;
+ }
+ ++__result;
+ }
+ return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter, class _Distance, class _Compare>
+void __merge_without_buffer(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last,
+ _Distance __len1, _Distance __len2,
+ _Compare __comp) {
+ if (__len1 == 0 || __len2 == 0)
+ return;
+ if (__len1 + __len2 == 2) {
+ if (__comp(*__middle, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ iter_swap(__first, __middle);
+ }
+ return;
+ }
+ _BidirectionalIter __first_cut = __first;
+ _BidirectionalIter __second_cut = __middle;
+ _Distance __len11 = 0;
+ _Distance __len22 = 0;
+ if (__len1 > __len2) {
+ __len11 = __len1 / 2;
+ _STLP_STD::advance(__first_cut, __len11);
+ __second_cut = _STLP_STD::lower_bound(__middle, __last, *__first_cut, __comp);
+ __len22 += _STLP_STD::distance(__middle, __second_cut);
+ }
+ else {
+ __len22 = __len2 / 2;
+ _STLP_STD::advance(__second_cut, __len22);
+ __first_cut = _STLP_STD::upper_bound(__first, __middle, *__second_cut, __comp);
+ __len11 += _STLP_STD::distance(__first, __first_cut);
+ }
+ _BidirectionalIter __new_middle
+ = _STLP_PRIV __rotate(__first_cut, __middle, __second_cut);
+ __merge_without_buffer(__first, __first_cut, __new_middle, __len11, __len22,
+ __comp);
+ __merge_without_buffer(__new_middle, __second_cut, __last, __len1 - __len11,
+ __len2 - __len22, __comp);
+}
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _BidirectionalIter3, class _Compare>
+_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1,
+ _BidirectionalIter1 __last1,
+ _BidirectionalIter2 __first2,
+ _BidirectionalIter2 __last2,
+ _BidirectionalIter3 __result,
+ _Compare __comp) {
+ if (__first1 == __last1)
+ return copy_backward(__first2, __last2, __result);
+ if (__first2 == __last2)
+ return copy_backward(__first1, __last1, __result);
+ --__last1;
+ --__last2;
+ for (;;) {
+ if (__comp(*__last2, *__last1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__last1, *__last2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *--__result = *__last1;
+ if (__first1 == __last1)
+ return copy_backward(__first2, ++__last2, __result);
+ --__last1;
+ }
+ else {
+ *--__result = *__last2;
+ if (__first2 == __last2)
+ return copy_backward(__first1, ++__last1, __result);
+ --__last2;
+ }
+ }
+}
+
+template <class _BidirectionalIter, class _Tp,
+ class _Distance, class _Compare>
+inline void __inplace_merge_aux(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last, _Tp*, _Distance*,
+ _Compare __comp) {
+ _Distance __len1 = _STLP_STD::distance(__first, __middle);
+ _Distance __len2 = _STLP_STD::distance(__middle, __last);
+
+ _Temporary_buffer<_BidirectionalIter, _Tp> __buf(__first, __last);
+ if (__buf.begin() == 0)
+ __merge_without_buffer(__first, __middle, __last, __len1, __len2, __comp);
+ else
+ __merge_adaptive(__first, __middle, __last, __len1, __len2,
+ __buf.begin(), _Distance(__buf.size()),
+ __comp);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _BidirectionalIter>
+void inplace_merge(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
+ if (__first == __middle || __middle == __last)
+ return;
+ _STLP_PRIV __inplace_merge_aux(__first, __middle, __last,
+ _STLP_VALUE_TYPE(__first, _BidirectionalIter), _STLP_DISTANCE_TYPE(__first, _BidirectionalIter),
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter)));
+}
+
+template <class _BidirectionalIter, class _Compare>
+void inplace_merge(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last))
+ if (__first == __middle || __middle == __last)
+ return;
+ _STLP_PRIV __inplace_merge_aux(__first, __middle, __last,
+ _STLP_VALUE_TYPE(__first, _BidirectionalIter), _STLP_DISTANCE_TYPE(__first, _BidirectionalIter),
+ __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool __includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return false;
+ }
+ else if (__comp(*__first1, *__first2))
+ ++__first1;
+ else
+ ++__first1, ++__first2;
+
+ return __first2 == __last2;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) {
+ return _STLP_PRIV __includes(__first1, __last1, __first2, __last2, __comp);
+}
+
+template <class _InputIter1, class _InputIter2>
+bool includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2) {
+ return _STLP_PRIV __includes(__first1, __last1, __first2, __last2,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter __set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first1;
+ ++__first1;
+ }
+ else if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first2;
+ ++__first2;
+ }
+ else {
+ *__result = *__first1;
+ ++__first1;
+ ++__first2;
+ }
+ ++__result;
+ }
+ return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ return _STLP_PRIV __set_union(__first1, __last1, __first2, __last2, __result,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ return _STLP_PRIV __set_union(__first1, __last1, __first2, __last2, __result, __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter __set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ ++__first1;
+ }
+ else if (__comp(*__first2, *__first1))
+ ++__first2;
+ else {
+ *__result = *__first1;
+ ++__first1;
+ ++__first2;
+ ++__result;
+ }
+ return __result;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ return _STLP_PRIV __set_intersection(__first1, __last1, __first2, __last2, __result,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ return _STLP_PRIV __set_intersection(__first1, __last1, __first2, __last2, __result, __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter __set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first1;
+ ++__first1;
+ ++__result;
+ }
+ else if (__comp(*__first2, *__first1))
+ ++__first2;
+ else {
+ ++__first1;
+ ++__first2;
+ }
+ return _STLP_STD::copy(__first1, __last1, __result);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ return _STLP_PRIV __set_difference(__first1, __last1, __first2, __last2, __result,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ return _STLP_PRIV __set_difference(__first1, __last1, __first2, __last2, __result, __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter, class _Compare>
+_OutputIter
+__set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ *__result = *__first1;
+ ++__first1;
+ ++__result;
+ }
+ else if (__comp(*__first2, *__first1)) {
+ *__result = *__first2;
+ ++__first2;
+ ++__result;
+ }
+ else {
+ ++__first1;
+ ++__first2;
+ }
+ }
+ return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter
+set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result) {
+ return _STLP_PRIV __set_symmetric_difference(__first1, __last1, __first2, __last2, __result,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1)));
+}
+
+template <class _InputIter1, class _InputIter2, class _OutputIter, class _Compare>
+_OutputIter
+set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result,
+ _Compare __comp) {
+ return _STLP_PRIV __set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp);
+}
+
+// min_element and max_element, with and without an explicitly supplied
+// comparison function.
+
+template <class _ForwardIter>
+_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __first;
+ _ForwardIter __result = __first;
+ while (++__first != __last)
+ if (*__result < *__first) {
+ _STLP_VERBOSE_ASSERT(!(*__first < *__result), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __result = __first;
+ }
+ return __result;
+}
+
+template <class _ForwardIter, class _Compare>
+_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __first;
+ _ForwardIter __result = __first;
+ while (++__first != __last) {
+ if (__comp(*__result, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, *__result), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __result = __first;
+ }
+ }
+ return __result;
+}
+
+template <class _ForwardIter>
+_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __first;
+ _ForwardIter __result = __first;
+ while (++__first != __last)
+ if (*__first < *__result) {
+ _STLP_VERBOSE_ASSERT(!(*__result < *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __result = __first;
+ }
+ return __result;
+}
+
+template <class _ForwardIter, class _Compare>
+_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last) return __first;
+ _ForwardIter __result = __first;
+ while (++__first != __last) {
+ if (__comp(*__first, *__result)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__result, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __result = __first;
+ }
+ }
+ return __result;
+}
+
+// next_permutation and prev_permutation, with and without an explicitly
+// supplied comparison function.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter, class _Compare>
+bool __next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last)
+ return false;
+ _BidirectionalIter __i = __first;
+ ++__i;
+ if (__i == __last)
+ return false;
+ __i = __last;
+ --__i;
+
+ for(;;) {
+ _BidirectionalIter __ii = __i;
+ --__i;
+ if (__comp(*__i, *__ii)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__ii, *__i), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ _BidirectionalIter __j = __last;
+ while (!__comp(*__i, *--__j)) {}
+ iter_swap(__i, __j);
+ reverse(__ii, __last);
+ return true;
+ }
+ if (__i == __first) {
+ reverse(__first, __last);
+ return false;
+ }
+ }
+#if defined (_STLP_NEED_UNREACHABLE_RETURN)
+ return false;
+#endif
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _BidirectionalIter>
+bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __next_permutation(__first, __last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter)));
+}
+
+template <class _BidirectionalIter, class _Compare>
+bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __next_permutation(__first, __last, __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter, class _Compare>
+bool __prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp) {
+ if (__first == __last)
+ return false;
+ _BidirectionalIter __i = __first;
+ ++__i;
+ if (__i == __last)
+ return false;
+ __i = __last;
+ --__i;
+
+ for(;;) {
+ _BidirectionalIter __ii = __i;
+ --__i;
+ if (__comp(*__ii, *__i)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__i, *__ii), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ _BidirectionalIter __j = __last;
+ while (!__comp(*--__j, *__i)) {}
+ iter_swap(__i, __j);
+ reverse(__ii, __last);
+ return true;
+ }
+ if (__i == __first) {
+ reverse(__first, __last);
+ return false;
+ }
+ }
+#if defined (_STLP_NEED_UNREACHABLE_RETURN)
+ return false;
+#endif
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _BidirectionalIter>
+bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __prev_permutation(__first, __last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter)));
+}
+
+template <class _BidirectionalIter, class _Compare>
+bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __prev_permutation(__first, __last, __comp);
+}
+
+#if !defined (_STLP_NO_EXTENSIONS)
+
+// is_heap, a predicate testing whether or not a range is
+// a heap. This function is an extension, not part of the C++
+// standard.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Distance, class _StrictWeakOrdering>
+bool __is_heap(_RandomAccessIter __first, _StrictWeakOrdering __comp,
+ _Distance __n) {
+ _Distance __parent = 0;
+ for (_Distance __child = 1; __child < __n; ++__child) {
+ if (__comp(__first[__parent], __first[__child])) {
+ _STLP_VERBOSE_ASSERT(!__comp(__first[__child], __first[__parent]), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return false;
+ }
+ if ((__child & 1) == 0)
+ ++__parent;
+ }
+ return true;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __is_heap(__first, _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)), __last - __first);
+}
+
+template <class _RandomAccessIter, class _StrictWeakOrdering>
+bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last,
+ _StrictWeakOrdering __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __is_heap(__first, __comp, __last - __first);
+}
+
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _StrictWeakOrdering>
+bool __is_sorted(_ForwardIter __first, _ForwardIter __last,
+ _StrictWeakOrdering __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last)
+ return true;
+
+ _ForwardIter __next = __first;
+ for (++__next; __next != __last; __first = __next, ++__next) {
+ if (__comp(*__next, *__first)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first, *__next), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return false;
+ }
+ }
+
+ return true;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif /* _STLP_NO_EXTENSIONS */
+
+_STLP_END_NAMESPACE
+
+#undef __stl_threshold
+
+#endif /* _STLP_ALGO_C */
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_algo.h b/stlport/stl/_algo.h
new file mode 100644
index 0000000..01e5f93
--- /dev/null
+++ b/stlport/stl/_algo.h
@@ -0,0 +1,745 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ALGO_H
+#define _STLP_INTERNAL_ALGO_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_HEAP_H
+# include <stl/_heap.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#if defined (__SUNPRO_CC) && !defined (_STLP_INTERNAL_CSTDIO)
+// remove() conflict
+# include <stl/_cstdio.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// for_each. Apply a function to every element of a range.
+template <class _InputIter, class _Function>
+_STLP_INLINE_LOOP _Function
+for_each(_InputIter __first, _InputIter __last, _Function __f) {
+ for ( ; __first != __last; ++__first)
+ __f(*__first);
+ return __f;
+}
+
+// count_if
+template <class _InputIter, class _Predicate>
+_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter)
+count_if(_InputIter __first, _InputIter __last, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0;
+ for ( ; __first != __last; ++__first) {
+ if (__pred(*__first))
+ ++__n;
+ }
+ return __n;
+}
+
+// adjacent_find.
+
+template <class _ForwardIter, class _BinaryPredicate>
+_STLP_INLINE_LOOP _ForwardIter
+adjacent_find(_ForwardIter __first, _ForwardIter __last,
+ _BinaryPredicate __binary_pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ if (__first == __last)
+ return __last;
+ _ForwardIter __next = __first;
+ while(++__next != __last) {
+ if (__binary_pred(*__first, *__next))
+ return __first;
+ __first = __next;
+ }
+ return __last;
+}
+
+template <class _ForwardIter>
+_STLP_INLINE_LOOP _ForwardIter
+adjacent_find(_ForwardIter __first, _ForwardIter __last) {
+ return adjacent_find(__first, __last,
+ _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _ForwardIter)));
+}
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+template <class _InputIter, class _Tp, class _Size>
+_STLP_INLINE_LOOP void
+count(_InputIter __first, _InputIter __last, const _Tp& __val, _Size& __n) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ if (*__first == __val)
+ ++__n;
+}
+
+template <class _InputIter, class _Predicate, class _Size>
+_STLP_INLINE_LOOP void
+count_if(_InputIter __first, _InputIter __last, _Predicate __pred, _Size& __n) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ if (__pred(*__first))
+ ++__n;
+}
+#endif
+
+template <class _ForwardIter1, class _ForwardIter2>
+_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2);
+
+// search_n. Search for __count consecutive copies of __val.
+template <class _ForwardIter, class _Integer, class _Tp>
+_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val);
+template <class _ForwardIter, class _Integer, class _Tp, class _BinaryPred>
+_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
+ _Integer __count, const _Tp& __val, _BinaryPred __binary_pred);
+
+template <class _InputIter, class _ForwardIter>
+inline _InputIter find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2);
+}
+
+template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
+inline _InputIter
+find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2, _BinaryPredicate __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2, __comp);
+}
+
+template <class _ForwardIter1, class _ForwardIter2>
+_ForwardIter1
+find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2);
+
+// swap_ranges
+template <class _ForwardIter1, class _ForwardIter2>
+_STLP_INLINE_LOOP _ForwardIter2
+swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ iter_swap(__first1, __first2);
+ return __first2;
+}
+
+// transform
+template <class _InputIter, class _OutputIter, class _UnaryOperation>
+_STLP_INLINE_LOOP _OutputIter
+transform(_InputIter __first, _InputIter __last, _OutputIter __result, _UnaryOperation __opr) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first, ++__result)
+ *__result = __opr(*__first);
+ return __result;
+}
+template <class _InputIter1, class _InputIter2, class _OutputIter, class _BinaryOperation>
+_STLP_INLINE_LOOP _OutputIter
+transform(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _OutputIter __result,_BinaryOperation __binary_op) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2, ++__result)
+ *__result = __binary_op(*__first1, *__first2);
+ return __result;
+}
+
+// replace_if, replace_copy, replace_copy_if
+
+template <class _ForwardIter, class _Predicate, class _Tp>
+_STLP_INLINE_LOOP void
+replace_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, const _Tp& __new_value) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ if (__pred(*__first))
+ *__first = __new_value;
+}
+
+template <class _InputIter, class _OutputIter, class _Tp>
+_STLP_INLINE_LOOP _OutputIter
+replace_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
+ const _Tp& __old_value, const _Tp& __new_value) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first, ++__result)
+ *__result = *__first == __old_value ? __new_value : *__first;
+ return __result;
+}
+
+template <class _Iterator, class _OutputIter, class _Predicate, class _Tp>
+_STLP_INLINE_LOOP _OutputIter
+replace_copy_if(_Iterator __first, _Iterator __last,
+ _OutputIter __result,
+ _Predicate __pred, const _Tp& __new_value) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first, ++__result)
+ *__result = __pred(*__first) ? __new_value : *__first;
+ return __result;
+}
+
+// generate and generate_n
+
+template <class _ForwardIter, class _Generator>
+_STLP_INLINE_LOOP void
+generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ *__first = __gen();
+}
+
+template <class _OutputIter, class _Size, class _Generator>
+_STLP_INLINE_LOOP void
+generate_n(_OutputIter __first, _Size __n, _Generator __gen) {
+ for ( ; __n > 0; --__n, ++__first)
+ *__first = __gen();
+}
+
+// remove, remove_if, remove_copy, remove_copy_if
+
+template <class _InputIter, class _OutputIter, class _Tp>
+_STLP_INLINE_LOOP _OutputIter
+remove_copy(_InputIter __first, _InputIter __last,_OutputIter __result, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first) {
+ if (!(*__first == __val)) {
+ *__result = *__first;
+ ++__result;
+ }
+ }
+ return __result;
+}
+
+template <class _InputIter, class _OutputIter, class _Predicate>
+_STLP_INLINE_LOOP _OutputIter
+remove_copy_if(_InputIter __first, _InputIter __last, _OutputIter __result, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first) {
+ if (!__pred(*__first)) {
+ *__result = *__first;
+ ++__result;
+ }
+ }
+ return __result;
+}
+
+template <class _ForwardIter, class _Tp>
+_STLP_INLINE_LOOP _ForwardIter
+remove(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ __first = find(__first, __last, __val);
+ if (__first == __last)
+ return __first;
+ else {
+ _ForwardIter __next = __first;
+ return remove_copy(++__next, __last, __first, __val);
+ }
+}
+
+template <class _ForwardIter, class _Predicate>
+_STLP_INLINE_LOOP _ForwardIter
+remove_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ __first = find_if(__first, __last, __pred);
+ if ( __first == __last )
+ return __first;
+ else {
+ _ForwardIter __next = __first;
+ return remove_copy_if(++__next, __last, __first, __pred);
+ }
+}
+
+// unique and unique_copy
+template <class _InputIter, class _OutputIter>
+_OutputIter unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result);
+
+template <class _InputIter, class _OutputIter, class _BinaryPredicate>
+_OutputIter unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
+ _BinaryPredicate __binary_pred);
+
+template <class _ForwardIter>
+inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last) {
+ __first = adjacent_find(__first, __last);
+ return unique_copy(__first, __last, __first);
+}
+
+template <class _ForwardIter, class _BinaryPredicate>
+inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last,
+ _BinaryPredicate __binary_pred) {
+ __first = adjacent_find(__first, __last, __binary_pred);
+ return unique_copy(__first, __last, __first, __binary_pred);
+}
+
+// reverse and reverse_copy, and their auxiliary functions
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter>
+_STLP_INLINE_LOOP void
+__reverse(_BidirectionalIter __first, _BidirectionalIter __last, const bidirectional_iterator_tag &) {
+ for (; __first != __last && __first != --__last; ++__first)
+ _STLP_STD::iter_swap(__first,__last);
+}
+
+template <class _RandomAccessIter>
+_STLP_INLINE_LOOP void
+__reverse(_RandomAccessIter __first, _RandomAccessIter __last, const random_access_iterator_tag &) {
+ for (; __first < __last; ++__first)
+ _STLP_STD::iter_swap(__first, --__last);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _BidirectionalIter>
+inline void
+reverse(_BidirectionalIter __first, _BidirectionalIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_PRIV __reverse(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _BidirectionalIter));
+}
+
+template <class _BidirectionalIter, class _OutputIter>
+_STLP_INLINE_LOOP
+_OutputIter reverse_copy(_BidirectionalIter __first,
+ _BidirectionalIter __last,
+ _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ while (__first != __last) {
+ --__last;
+ *__result = *__last;
+ ++__result;
+ }
+ return __result;
+}
+
+template <class _ForwardIter>
+void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last);
+
+template <class _ForwardIter, class _OutputIter>
+inline _OutputIter rotate_copy(_ForwardIter __first, _ForwardIter __middle,
+ _ForwardIter __last, _OutputIter __result) {
+ return _STLP_STD::copy(__first, __middle, copy(__middle, __last, __result));
+}
+
+// random_shuffle
+
+template <class _RandomAccessIter>
+void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _RandomNumberGenerator>
+void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last,
+ _RandomNumberGenerator& __rand);
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// random_sample and random_sample_n (extensions, not part of the standard).
+
+template <class _ForwardIter, class _OutputIter, class _Distance>
+_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
+ _OutputIter __out_ite, const _Distance __n);
+
+template <class _ForwardIter, class _OutputIter, class _Distance,
+ class _RandomNumberGenerator>
+_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
+ _OutputIter __out_ite, const _Distance __n,
+ _RandomNumberGenerator& __rand);
+
+template <class _InputIter, class _RandomAccessIter>
+_RandomAccessIter
+random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_first, _RandomAccessIter __out_last);
+
+template <class _InputIter, class _RandomAccessIter,
+ class _RandomNumberGenerator>
+_RandomAccessIter
+random_sample(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __out_first, _RandomAccessIter __out_last,
+ _RandomNumberGenerator& __rand);
+
+#endif /* _STLP_NO_EXTENSIONS */
+
+// partition, stable_partition, and their auxiliary functions
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred);
+
+template <class _ForwardIter, class _Predicate>
+_ForwardIter
+stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred);
+
+// sort() and its auxiliary functions.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Size>
+inline _Size __lg(_Size __n) {
+ _Size __k;
+ for (__k = 0; __n != 1; __n >>= 1) ++__k;
+ return __k;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _RandomAccessIter>
+void sort(_RandomAccessIter __first, _RandomAccessIter __last);
+template <class _RandomAccessIter, class _Compare>
+void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp);
+
+// stable_sort() and its auxiliary functions.
+template <class _RandomAccessIter>
+void stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _Compare>
+void stable_sort(_RandomAccessIter __first,
+ _RandomAccessIter __last, _Compare __comp);
+
+// partial_sort, partial_sort_copy, and auxiliary functions.
+
+template <class _RandomAccessIter>
+void partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle,
+ _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _Compare>
+void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
+ _RandomAccessIter __last, _Compare __comp);
+
+template <class _InputIter, class _RandomAccessIter>
+_RandomAccessIter
+partial_sort_copy(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __result_first, _RandomAccessIter __result_last);
+
+template <class _InputIter, class _RandomAccessIter, class _Compare>
+_RandomAccessIter
+partial_sort_copy(_InputIter __first, _InputIter __last,
+ _RandomAccessIter __result_first,
+ _RandomAccessIter __result_last, _Compare __comp);
+
+// nth_element() and its auxiliary functions.
+template <class _RandomAccessIter>
+void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _Compare>
+void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
+ _RandomAccessIter __last, _Compare __comp);
+
+// auxiliary class for lower_bound, etc.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _T1, class _T2>
+struct __less_2 {
+ bool operator() (const _T1& __x, const _T2& __y) const { return __x < __y ; }
+};
+
+template <class _T1, class _T2>
+__less_2<_T1,_T2> __less2(_T1*, _T2* ) { return __less_2<_T1, _T2>(); }
+
+#if defined (_STLP_FUNCTION_PARTIAL_ORDER)
+template <class _Tp>
+less<_Tp> __less2(_Tp*, _Tp* ) { return less<_Tp>(); }
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Binary search (lower_bound, upper_bound, equal_range, binary_search).
+template <class _ForwardIter, class _Tp>
+inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __lower_bound(__first, __last, __val,
+ _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
+ _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Tp, class _Compare>
+inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
+_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance*);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __upper_bound(__first, __last, __val,
+ _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
+ _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Tp, class _Compare>
+inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val, _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __upper_bound(__first, __last, __val, __comp, __comp,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
+pair<_ForwardIter, _ForwardIter>
+__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance*);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+inline pair<_ForwardIter, _ForwardIter>
+equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __equal_range(__first, __last, __val,
+ _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
+ _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Tp, class _Compare>
+inline pair<_ForwardIter, _ForwardIter>
+equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __equal_range(__first, __last, __val, __comp, __comp,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+template <class _ForwardIter, class _Tp>
+inline bool binary_search(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val,
+ _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
+ _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+ return __i != __last && !(__val < *__i);
+}
+
+template <class _ForwardIter, class _Tp, class _Compare>
+inline bool binary_search(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp,
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+ return __i != __last && !__comp(__val, *__i);
+}
+
+// merge, with and without an explicitly supplied comparison function.
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp);
+
+
+// inplace_merge and its auxiliary functions.
+
+
+template <class _BidirectionalIter>
+void inplace_merge(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last) ;
+
+template <class _BidirectionalIter, class _Compare>
+void inplace_merge(_BidirectionalIter __first,
+ _BidirectionalIter __middle,
+ _BidirectionalIter __last, _Compare __comp);
+
+// Set algorithms: includes, set_union, set_intersection, set_difference,
+// set_symmetric_difference. All of these algorithms have the precondition
+// that their input ranges are sorted and the postcondition that their output
+// ranges are sorted.
+
+template <class _InputIter1, class _InputIter2>
+bool includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2);
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool includes(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2, _Compare __comp);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp);
+
+
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result, _Compare __comp);
+
+template <class _InputIter1, class _InputIter2, class _OutputIter>
+_OutputIter
+set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result);
+
+
+template <class _InputIter1, class _InputIter2, class _OutputIter,
+ class _Compare>
+_OutputIter
+set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _OutputIter __result,
+ _Compare __comp);
+
+
+// min_element and max_element, with and without an explicitly supplied
+// comparison function.
+
+template <class _ForwardIter>
+_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last);
+template <class _ForwardIter, class _Compare>
+_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last,
+ _Compare __comp);
+
+template <class _ForwardIter>
+_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last);
+
+template <class _ForwardIter, class _Compare>
+_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last,
+ _Compare __comp);
+
+// next_permutation and prev_permutation, with and without an explicitly
+// supplied comparison function.
+
+template <class _BidirectionalIter>
+bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last);
+
+template <class _BidirectionalIter, class _Compare>
+bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp);
+
+
+template <class _BidirectionalIter>
+bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last);
+
+
+template <class _BidirectionalIter, class _Compare>
+bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
+ _Compare __comp);
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// is_heap, a predicate testing whether or not a range is
+// a heap. This function is an extension, not part of the C++
+// standard.
+
+template <class _RandomAccessIter>
+bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last);
+
+template <class _RandomAccessIter, class _StrictWeakOrdering>
+bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last,
+ _StrictWeakOrdering __comp);
+
+// is_sorted, a predicated testing whether a range is sorted in
+// nondescending order. This is an extension, not part of the C++
+// standard.
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _StrictWeakOrdering>
+bool __is_sorted(_ForwardIter __first, _ForwardIter __last,
+ _StrictWeakOrdering __comp);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _ForwardIter>
+inline bool is_sorted(_ForwardIter __first, _ForwardIter __last) {
+ return _STLP_PRIV __is_sorted(__first, __last,
+ _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _ForwardIter)));
+}
+
+template <class _ForwardIter, class _StrictWeakOrdering>
+inline bool is_sorted(_ForwardIter __first, _ForwardIter __last,
+ _StrictWeakOrdering __comp) {
+ return _STLP_PRIV __is_sorted(__first, __last, __comp);
+}
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_algo.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ALGO_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_algobase.c b/stlport/stl/_algobase.c
new file mode 100644
index 0000000..157e25c
--- /dev/null
+++ b/stlport/stl/_algobase.c
@@ -0,0 +1,483 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_ALGOBASE_C
+#define _STLP_ALGOBASE_C
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _InputIter1, class _InputIter2>
+bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ for ( ; __first1 != __last1 && __first2 != __last2
+ ; ++__first1, ++__first2) {
+ if (*__first1 < *__first2) {
+ _STLP_VERBOSE_ASSERT(!(*__first2 < *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return true;
+ }
+ if (*__first2 < *__first1)
+ return false;
+ }
+ return __first1 == __last1 && __first2 != __last2;
+}
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _Compare __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ for ( ; __first1 != __last1 && __first2 != __last2
+ ; ++__first1, ++__first2) {
+ if (__comp(*__first1, *__first2)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1),
+ _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return true;
+ }
+ if (__comp(*__first2, *__first1))
+ return false;
+ }
+ return __first1 == __last1 && __first2 != __last2;
+}
+
+#if !defined (_STLP_NO_EXTENSIONS)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2>
+int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2) {
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (*__first1 < *__first2) {
+ _STLP_VERBOSE_ASSERT(!(*__first2 < *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ return -1;
+ }
+ if (*__first2 < *__first1)
+ return 1;
+ ++__first1;
+ ++__first2;
+ }
+ if (__first2 == __last2) {
+ return !(__first1 == __last1);
+ }
+ else {
+ return -1;
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter1, class _InputIter2>
+int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __lexicographical_compare_3way(__first1, __last1, __first2, __last2);
+}
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _RandomAccessIter, class _Tp>
+_STLP_INLINE_LOOP _RandomAccessIter __find(_RandomAccessIter __first, _RandomAccessIter __last,
+ const _Tp& __val,
+ const random_access_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2;
+
+ for ( ; __trip_count > 0 ; --__trip_count) {
+ if (*__first == __val) return __first;
+ ++__first;
+
+ if (*__first == __val) return __first;
+ ++__first;
+
+ if (*__first == __val) return __first;
+ ++__first;
+
+ if (*__first == __val) return __first;
+ ++__first;
+ }
+
+ switch (__last - __first) {
+ case 3:
+ if (*__first == __val) return __first;
+ ++__first;
+ case 2:
+ if (*__first == __val) return __first;
+ ++__first;
+ case 1:
+ if (*__first == __val) return __first;
+ //++__first;
+ case 0:
+ default:
+ return __last;
+ }
+}
+
+inline char*
+__find(char* __first, char* __last, char __val, const random_access_iterator_tag &) {
+ void *res = memchr(__first, __val, __last - __first);
+ return res != 0 ? __STATIC_CAST(char*, res) : __last;
+}
+inline const char*
+__find(const char* __first, const char* __last, char __val, const random_access_iterator_tag &) {
+ const void *res = memchr(__first, __val, __last - __first);
+ return res != 0 ? __STATIC_CAST(const char*, res) : __last;
+}
+
+template <class _RandomAccessIter, class _Predicate>
+_STLP_INLINE_LOOP _RandomAccessIter __find_if(_RandomAccessIter __first, _RandomAccessIter __last,
+ _Predicate __pred,
+ const random_access_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2;
+
+ for ( ; __trip_count > 0 ; --__trip_count) {
+ if (__pred(*__first)) return __first;
+ ++__first;
+
+ if (__pred(*__first)) return __first;
+ ++__first;
+
+ if (__pred(*__first)) return __first;
+ ++__first;
+
+ if (__pred(*__first)) return __first;
+ ++__first;
+ }
+
+ switch(__last - __first) {
+ case 3:
+ if (__pred(*__first)) return __first;
+ ++__first;
+ case 2:
+ if (__pred(*__first)) return __first;
+ ++__first;
+ case 1:
+ if (__pred(*__first)) return __first;
+ //++__first;
+ case 0:
+ default:
+ return __last;
+ }
+}
+
+template <class _InputIter, class _Tp>
+_STLP_INLINE_LOOP _InputIter __find(_InputIter __first, _InputIter __last,
+ const _Tp& __val,
+ const input_iterator_tag &) {
+ while (__first != __last && !(*__first == __val)) ++__first;
+ return __first;
+}
+
+template <class _InputIter, class _Predicate>
+_STLP_INLINE_LOOP _InputIter __find_if(_InputIter __first, _InputIter __last,
+ _Predicate __pred,
+ const input_iterator_tag &) {
+ while (__first != __last && !__pred(*__first))
+ ++__first;
+ return __first;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _Predicate>
+_InputIter find_if(_InputIter __first, _InputIter __last,
+ _Predicate __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __find_if(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+}
+
+template <class _InputIter, class _Tp>
+_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __find(__first, __last, __val, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+}
+
+template <class _ForwardIter1, class _ForwardIter2, class _BinaryPred>
+_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2,
+ _BinaryPred __pred) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ // Test for empty ranges
+ if (__first1 == __last1 || __first2 == __last2)
+ return __first1;
+
+ // Test for a pattern of length 1.
+ _ForwardIter2 __p1(__first2);
+
+ if ( ++__p1 == __last2 ) {
+ while (__first1 != __last1 && !__pred(*__first1, *__first2)) {
+ ++__first1;
+ }
+ return __first1;
+ }
+
+ // General case.
+
+ for ( ; ; ) { // __first1 != __last1 will be checked below
+ while (__first1 != __last1 && !__pred(*__first1, *__first2)) {
+ ++__first1;
+ }
+ if (__first1 == __last1) {
+ return __last1;
+ }
+ _ForwardIter2 __p = __p1;
+ _ForwardIter1 __current = __first1;
+ if (++__current == __last1) return __last1;
+
+ while (__pred(*__current, *__p)) {
+ if (++__p == __last2)
+ return __first1;
+ if (++__current == __last1)
+ return __last1;
+ }
+ ++__first1;
+ }
+ return __first1;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template <class _Tp>
+struct _IsCharLikeType
+{ typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsCharLikeType<char>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsCharLikeType<unsigned char>
+{ typedef __true_type _Ret; };
+
+# ifndef _STLP_NO_SIGNED_BUILTINS
+_STLP_TEMPLATE_NULL struct _IsCharLikeType<signed char>
+{ typedef __true_type _Ret; };
+# endif
+
+template <class _Tp1, class _Tp2>
+inline bool __stlp_eq(_Tp1 __val1, _Tp2 __val2)
+{ return __val1 == __val2; }
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _Tp>
+inline bool __stlp_eq(_Tp, _Tp)
+{ return true; }
+#endif
+
+template <class _InputIter, class _ForwardIter, class _Tp2, class _Predicate>
+inline _InputIter __find_first_of_aux2(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2,
+ _Tp2*, _Predicate __pred,
+ const __true_type& /* _UseStrcspnLikeAlgo */) {
+ unsigned char __hints[(UCHAR_MAX + 1) / CHAR_BIT];
+ memset(__hints, 0, sizeof(__hints) / sizeof(unsigned char));
+ for (; __first2 != __last2; ++__first2) {
+ unsigned char __tmp = (unsigned char)*__first2;
+ __hints[__tmp / CHAR_BIT] |= (1 << (__tmp % CHAR_BIT));
+ }
+
+ for (; __first1 != __last1; ++__first1) {
+ _Tp2 __tmp = (_Tp2)*__first1;
+ if (__stlp_eq(*__first1, __tmp) &&
+ __pred((__hints[(unsigned char)__tmp / CHAR_BIT] & (1 << ((unsigned char)__tmp % CHAR_BIT))) != 0))
+ break;
+ }
+ return __first1;
+}
+
+template <class _InputIter, class _ForwardIter, class _Tp2, class _Predicate>
+inline _InputIter __find_first_of_aux2(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2,
+ _Tp2* /* __dummy */, _Predicate /* __pred */,
+ const __false_type& /* _UseStrcspnLikeAlgo */) {
+ return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2,
+ _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _InputIter)));
+}
+
+template <class _InputIter, class _ForwardIter, class _Tp1, class _Tp2>
+inline _InputIter __find_first_of_aux1(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2,
+ _Tp1* __pt1, _Tp2* __pt2) {
+ typedef _STLP_TYPENAME _STLP_STD::_IsIntegral<_Tp1>::_Ret _IsIntegral;
+ typedef _STLP_TYPENAME _STLP_PRIV _IsCharLikeType<_Tp2>::_Ret _IsCharLike;
+ typedef _STLP_TYPENAME _STLP_STD::_Land2<_IsIntegral, _IsCharLike>::_Ret _UseStrcspnLikeAlgo;
+ return _STLP_PRIV __find_first_of_aux2(__first1, __last1,
+ __first2, __last2,
+ __pt2, _Identity<bool>(), _UseStrcspnLikeAlgo());
+}
+
+template <class _InputIter, class _ForwardIter>
+inline _InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2) {
+ return _STLP_PRIV __find_first_of_aux1(__first1, __last1, __first2, __last2,
+ _STLP_VALUE_TYPE(__first1, _InputIter),
+ _STLP_VALUE_TYPE(__first2, _ForwardIter));
+}
+
+// find_first_of, with and without an explicitly supplied comparison function.
+template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
+_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2,
+ _BinaryPredicate __comp) {
+ for ( ; __first1 != __last1; ++__first1) {
+ for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter) {
+ if (__comp(*__first1, *__iter)) {
+ return __first1;
+ }
+ }
+ }
+ return __last1;
+}
+
+// find_end, with and without an explicitly supplied comparison function.
+// Search [first2, last2) as a subsequence in [first1, last1), and return
+// the *last* possible match. Note that find_end for bidirectional iterators
+// is much faster than for forward iterators.
+
+// find_end for forward iterators.
+template <class _ForwardIter1, class _ForwardIter2,
+ class _BinaryPredicate>
+_ForwardIter1 __find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2,
+ const forward_iterator_tag &, const forward_iterator_tag &,
+ _BinaryPredicate __comp) {
+ if (__first2 == __last2)
+ return __last1;
+ else {
+ _ForwardIter1 __result = __last1;
+ for (;;) {
+ _ForwardIter1 __new_result = _STLP_STD::search(__first1, __last1, __first2, __last2, __comp);
+ if (__new_result == __last1)
+ return __result;
+ else {
+ __result = __new_result;
+ __first1 = __new_result;
+ ++__first1;
+ }
+ }
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// find_end for bidirectional iterators. Requires partial specialization.
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+
+# ifndef _STLP_INTERNAL_ITERATOR_H
+_STLP_END_NAMESPACE
+# include <stl/_iterator.h>
+_STLP_BEGIN_NAMESPACE
+# endif /*_STLP_INTERNAL_ITERATOR_H*/
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _BinaryPredicate>
+_BidirectionalIter1
+__find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1,
+ _BidirectionalIter2 __first2, _BidirectionalIter2 __last2,
+ const bidirectional_iterator_tag &, const bidirectional_iterator_tag &,
+ _BinaryPredicate __comp) {
+ typedef _STLP_STD::reverse_iterator<_BidirectionalIter1> _RevIter1;
+ typedef _STLP_STD::reverse_iterator<_BidirectionalIter2> _RevIter2;
+
+ _RevIter1 __rlast1(__first1);
+ _RevIter2 __rlast2(__first2);
+ _RevIter1 __rresult = _STLP_STD::search(_RevIter1(__last1), __rlast1,
+ _RevIter2(__last2), __rlast2,
+ __comp);
+
+ if (__rresult == __rlast1)
+ return __last1;
+ else {
+ _BidirectionalIter1 __result = __rresult.base();
+ _STLP_STD::advance(__result, -_STLP_STD::distance(__first2, __last2));
+ return __result;
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+template <class _ForwardIter1, class _ForwardIter2,
+ class _BinaryPredicate>
+_ForwardIter1
+find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2,
+ _BinaryPredicate __comp) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+ return _STLP_PRIV __find_end(__first1, __last1, __first2, __last2,
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ _STLP_ITERATOR_CATEGORY(__first1, _ForwardIter1),
+ _STLP_ITERATOR_CATEGORY(__first2, _ForwardIter2),
+#else
+ forward_iterator_tag(),
+ forward_iterator_tag(),
+#endif
+ __comp);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
+_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ _Compare1 __comp1, _Compare2 __comp2, _Distance*) {
+ _Distance __len = _STLP_STD::distance(__first, __last);
+ _Distance __half;
+ _ForwardIter __middle;
+
+ while (__len > 0) {
+ __half = __len >> 1;
+ __middle = __first;
+ _STLP_STD::advance(__middle, __half);
+ if (__comp1(*__middle, __val)) {
+ _STLP_VERBOSE_ASSERT(!__comp2(__val, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ else
+ __len = __half;
+ }
+ return __first;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_ALGOBASE_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_algobase.h b/stlport/stl/_algobase.h
new file mode 100644
index 0000000..597dcbe
--- /dev/null
+++ b/stlport/stl/_algobase.h
@@ -0,0 +1,728 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+#define _STLP_INTERNAL_ALGOBASE_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+#endif
+
+#ifndef _STLP_CLIMITS
+# include <climits>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#ifndef _STLP_INTERNAL_PAIR_H
+# include <stl/_pair.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template <class _Tp>
+inline void __swap_aux(_Tp& __a, _Tp& __b, const __true_type& /*SwapImplemented*/) {
+ __a._M_swap_workaround(__b);
+}
+
+template <class _Tp>
+inline void __swap_aux(_Tp& __a, _Tp& __b, const __false_type& /*SwapImplemented*/) {
+ _Tp __tmp = __a;
+ __a = __b;
+ __b = __tmp;
+}
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+// swap and iter_swap
+template <class _Tp>
+inline void swap(_Tp& __a, _Tp& __b) {
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+# if !defined(__BORLANDC__)
+ typedef typename _SwapImplemented<_Tp>::_Ret _Implemented;
+# else
+ enum { _Is = _SwapImplemented<_Tp>::_Is };
+ typedef typename __bool2type<_Is>::_Ret _Implemented;
+# endif
+ _STLP_PRIV __swap_aux(__a, __b, _Implemented());
+#else
+ _Tp __tmp = __a;
+ __a = __b;
+ __b = __tmp;
+#endif
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter1, class _ForwardIter2, class _Value>
+inline void __iter_swap_aux_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, _Value *) {
+ _Value tmp = *__i1;
+ *__i1 = *__i2;
+ *__i2 = tmp;
+}
+
+template <class _ForwardIter1, class _ForwardIter2>
+inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __true_type& /*OKToSwap*/) {
+ /* namespace specification breaks access to the right swap template overload (at least for gcc) */
+ /*_STLP_STD::*/ swap(*__i1, *__i2);
+}
+
+template <class _ForwardIter1, class _ForwardIter2>
+inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __false_type& /*OKToSwap*/) {
+ _STLP_PRIV __iter_swap_aux_aux( __i1, __i2, _STLP_VALUE_TYPE(__i1,_ForwardIter1) );
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter1, class _ForwardIter2>
+inline void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2) {
+ _STLP_PRIV __iter_swap_aux( __i1, __i2, _IsOKToSwap(_STLP_VALUE_TYPE(__i1, _ForwardIter1), _STLP_VALUE_TYPE(__i2, _ForwardIter2),
+ _STLP_IS_REF_TYPE_REAL_REF(__i1, _ForwardIter1),
+ _STLP_IS_REF_TYPE_REAL_REF(__i2, _ForwardIter2))._Answer());
+}
+
+//--------------------------------------------------
+// min and max
+
+#if !defined (__BORLANDC__) || defined (_STLP_USE_OWN_NAMESPACE)
+# if (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) && !defined (__STDC__)
+//In not ANSI mode Borland import min/max in global namespace which conflict
+//with STLport min/max when user does a 'using namespace std' in its code
+//(see test/unit/alg_test.cpp). To avoid this clash we simply import Borland min/max
+//in STLport namespace.
+using _STLP_VENDOR_STD::min;
+using _STLP_VENDOR_STD::max;
+# else
+template <class _Tp>
+inline const _Tp& (min)(const _Tp& __a, const _Tp& __b) { return __b < __a ? __b : __a; }
+template <class _Tp>
+inline const _Tp& (max)(const _Tp& __a, const _Tp& __b) { return __a < __b ? __b : __a; }
+# endif
+#endif
+
+# if defined (__BORLANDC__) && defined (_STLP_USE_OWN_NAMESPACE)
+inline unsigned long (min) (unsigned long __a, unsigned long __b) { return __b < __a ? __b : __a; }
+inline unsigned long (max) (unsigned long __a, unsigned long __b) { return __a < __b ? __b : __a; }
+# endif
+
+# if !defined (__BORLANDC__) || (__BORLANDC__ < 0x590)
+template <class _Tp, class _Compare>
+inline const _Tp& (min)(const _Tp& __a, const _Tp& __b, _Compare __comp) {
+ return __comp(__b, __a) ? __b : __a;
+}
+
+template <class _Tp, class _Compare>
+inline const _Tp& (max)(const _Tp& __a, const _Tp& __b, _Compare __comp) {
+ return __comp(__a, __b) ? __b : __a;
+}
+# else
+template <class _Tp, class _Compare>
+inline const _Tp (min)(const _Tp __a, const _Tp __b, _Compare __comp) {
+ return __comp(__b, __a) ? __b : __a;
+}
+
+template <class _Tp, class _Compare>
+inline const _Tp (max)(const _Tp __a, const _Tp __b, _Compare __comp) {
+ return __comp(__a, __b) ? __b : __a;
+}
+# endif
+
+//--------------------------------------------------
+// copy
+
+// All of these auxiliary functions serve two purposes. (1) Replace
+// calls to copy with memmove whenever possible. (Memmove, not memcpy,
+// because the input and output ranges are permitted to overlap.)
+// (2) If we're using random access iterators, then write the loop as
+// a for loop with an explicit count.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __copy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const input_iterator_tag &, _Distance*) {
+ for ( ; __first != __last; ++__result, ++__first)
+ *__result = *__first;
+ return __result;
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __copy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const forward_iterator_tag &, _Distance* ) {
+ for ( ; __first != __last; ++__result, ++__first)
+ *__result = *__first;
+ return __result;
+}
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __copy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const bidirectional_iterator_tag &, _Distance* ) {
+ for ( ; __first != __last; ++__result, ++__first)
+ *__result = *__first;
+ return __result;
+}
+#endif
+
+template <class _RandomAccessIter, class _OutputIter, class _Distance>
+inline _OutputIter
+__copy(_RandomAccessIter __first, _RandomAccessIter __last,
+ _OutputIter __result, const random_access_iterator_tag &, _Distance*) {
+ for (_Distance __n = __last - __first; __n > 0; --__n) {
+ *__result = *__first;
+ ++__first;
+ ++__result;
+ }
+ return __result;
+}
+
+inline void*
+__copy_trivial(const void* __first, const void* __last, void* __result) {
+ size_t __n = (const char*)__last - (const char*)__first;
+ return __n ? (void *)((char*)memmove(__result, __first, __n) + __n) : __result;
+}
+
+//--------------------------------------------------
+// copy_backward auxiliary functions
+
+template <class _BidirectionalIter1, class _BidirectionalIter2,
+ class _Distance>
+inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first,
+ _BidirectionalIter1 __last,
+ _BidirectionalIter2 __result,
+ const bidirectional_iterator_tag &,
+ _Distance*) {
+ while (__first != __last)
+ *--__result = *--__last;
+ return __result;
+}
+
+template <class _RandomAccessIter, class _BidirectionalIter, class _Distance>
+inline _BidirectionalIter __copy_backward(_RandomAccessIter __first,
+ _RandomAccessIter __last,
+ _BidirectionalIter __result,
+ const random_access_iterator_tag &,
+ _Distance*) {
+ for (_Distance __n = __last - __first; __n > 0; --__n)
+ *--__result = *--__last;
+ return __result;
+}
+
+inline void*
+__copy_trivial_backward(const void* __first, const void* __last, void* __result) {
+ const ptrdiff_t _Num = (const char*)__last - (const char*)__first;
+ return (_Num > 0) ? memmove((char*)__result - _Num, __first, _Num) : __result ;
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __false_type& /*IsOKToMemCpy*/) {
+ return _STLP_PRIV __copy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0);
+}
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __true_type& /*IsOKToMemCpy*/) {
+ // we know they all pointers, so this cast is OK
+ // return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result));
+ return (_OutputIter)_STLP_PRIV __copy_trivial(__first, __last, __result);
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __true_type& /*BothPtrType*/) {
+ return _STLP_PRIV __copy_ptrs(__first, __last, __result,
+ _UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter),
+ _STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __false_type& /*BothPtrType*/) {
+ return _STLP_PRIV __copy(__first, __last, __result,
+ _STLP_ITERATOR_CATEGORY(__first, _InputIter),
+ _STLP_DISTANCE_TYPE(__first, _InputIter));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter copy(_InputIter __first, _InputIter __last, _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __copy_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer());
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const __false_type& /*TrivialAssignment*/) {
+ return _STLP_PRIV __copy_backward(__first, __last, __result,
+ _STLP_ITERATOR_CATEGORY(__first, _InputIter),
+ _STLP_DISTANCE_TYPE(__first, _InputIter));
+}
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const __true_type& /*TrivialAssignment*/) {
+ return (_OutputIter)_STLP_PRIV __copy_trivial_backward(__first, __last, __result);
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __false_type&) {
+ return _STLP_PRIV __copy_backward(__first, __last, __result,
+ _STLP_ITERATOR_CATEGORY(__first,_InputIter),
+ _STLP_DISTANCE_TYPE(__first, _InputIter));
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __true_type&) {
+ return _STLP_PRIV __copy_backward_ptrs(__first, __last, __result,
+ _UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter),
+ _STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter copy_backward(_InputIter __first, _InputIter __last, _OutputIter __result) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ return _STLP_PRIV __copy_backward_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer() );
+}
+
+#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+# define _STLP_DECLARE_COPY_TRIVIAL(_Tp) \
+inline _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) \
+{ return (_Tp*)_STLP_PRIV __copy_trivial(__first, __last, __result); } \
+inline _Tp* copy_backward(const _Tp* __first, const _Tp* __last, _Tp* __result) \
+{ return (_Tp*)_STLP_PRIV __copy_trivial_backward(__first, __last, __result); }
+
+# if !defined (_STLP_NO_BOOL)
+_STLP_DECLARE_COPY_TRIVIAL(bool)
+# endif
+_STLP_DECLARE_COPY_TRIVIAL(char)
+# if !defined (_STLP_NO_SIGNED_BUILTINS)
+_STLP_DECLARE_COPY_TRIVIAL(signed char)
+# endif
+_STLP_DECLARE_COPY_TRIVIAL(unsigned char)
+_STLP_DECLARE_COPY_TRIVIAL(short)
+_STLP_DECLARE_COPY_TRIVIAL(unsigned short)
+_STLP_DECLARE_COPY_TRIVIAL(int)
+_STLP_DECLARE_COPY_TRIVIAL(unsigned int)
+_STLP_DECLARE_COPY_TRIVIAL(long)
+_STLP_DECLARE_COPY_TRIVIAL(unsigned long)
+# if !defined(_STLP_NO_WCHAR_T) && !defined (_STLP_WCHAR_T_IS_USHORT)
+_STLP_DECLARE_COPY_TRIVIAL(wchar_t)
+# endif
+# if defined (_STLP_LONG_LONG)
+_STLP_DECLARE_COPY_TRIVIAL(_STLP_LONG_LONG)
+_STLP_DECLARE_COPY_TRIVIAL(unsigned _STLP_LONG_LONG)
+# endif
+_STLP_DECLARE_COPY_TRIVIAL(float)
+_STLP_DECLARE_COPY_TRIVIAL(double)
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLARE_COPY_TRIVIAL(long double)
+# endif
+# undef _STLP_DECLARE_COPY_TRIVIAL
+#endif
+
+//--------------------------------------------------
+// copy_n (not part of the C++ standard)
+
+#if !defined (_STLP_NO_EXTENSIONS)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _Size, class _OutputIter>
+_STLP_INLINE_LOOP _STLP_STD::pair<_InputIter, _OutputIter>
+__copy_n(_InputIter __first, _Size __count, _OutputIter __result,
+ const input_iterator_tag &) {
+ for ( ; __count > 0; --__count) {
+ *__result = *__first;
+ ++__first;
+ ++__result;
+ }
+ return _STLP_STD::pair<_InputIter, _OutputIter>(__first, __result);
+}
+
+template <class _RAIter, class _Size, class _OutputIter>
+inline _STLP_STD::pair<_RAIter, _OutputIter>
+__copy_n(_RAIter __first, _Size __count, _OutputIter __result,
+ const random_access_iterator_tag &) {
+ _RAIter __last = __first + __count;
+ return _STLP_STD::pair<_RAIter, _OutputIter>(__last, _STLP_STD::copy(__first, __last, __result));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _Size, class _OutputIter>
+inline pair<_InputIter, _OutputIter>
+copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
+ _STLP_FIX_LITERAL_BUG(__first)
+ return _STLP_PRIV __copy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+}
+#endif
+
+//--------------------------------------------------
+// fill and fill_n
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+_STLP_INLINE_LOOP
+void __fill_fwd(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
+ for ( ; __first != __last; ++__first)
+ *__first = __val;
+}
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ const input_iterator_tag &, _Distance*) {
+ _STLP_PRIV __fill_fwd(__first, __last, __val);
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIter, class _Tp, class _Distance>
+_STLP_INLINE_LOOP
+void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ const forward_iterator_tag &, _Distance*) {
+ _STLP_PRIV __fill_fwd(__first, __last, __val);
+}
+
+template <class _ForwardIter, class _Tp, class _Distance>
+_STLP_INLINE_LOOP
+void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
+ const bidirectional_iterator_tag &, _Distance*) {
+ _STLP_PRIV __fill_fwd(__first, __last, __val);
+}
+#endif
+
+template <class _RandomAccessIter, class _Tp, class _Distance>
+_STLP_INLINE_LOOP
+void __fill(_RandomAccessIter __first, _RandomAccessIter __last, const _Tp& __val,
+ const random_access_iterator_tag &, _Distance*) {
+ for (_Distance __n = __last - __first ; __n > 0; ++__first, --__n)
+ *__first = __val;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+inline void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_PRIV __fill(__first, __last, __val,
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+// Specialization: for one-byte types we can use memset.
+inline void fill(unsigned char* __first, unsigned char* __last,
+ const unsigned char& __val) {
+ unsigned char __tmp = __val;
+ memset(__first, __tmp, __last - __first);
+}
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+inline void fill(signed char* __first, signed char* __last,
+ const signed char& __val) {
+ signed char __tmp = __val;
+ memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
+}
+#endif
+inline void fill(char* __first, char* __last, const char& __val) {
+ char __tmp = __val;
+ memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _OutputIter, class _Size, class _Tp>
+_STLP_INLINE_LOOP
+_OutputIter __fill_n(_OutputIter __first, _Size __n, const _Tp& __val) {
+ _STLP_FIX_LITERAL_BUG(__first)
+ for ( ; __n > 0; --__n, ++__first)
+ *__first = __val;
+ return __first;
+}
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _Size>
+inline unsigned char* __fill_n(unsigned char* __first, _Size __n,
+ const unsigned char& __val) {
+ _STLP_STD::fill(__first, __first + __n, __val);
+ return __first + __n;
+}
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+template <class _Size>
+inline signed char* __fill_n(signed char* __first, _Size __n,
+ const signed char& __val) {
+ _STLP_STD::fill(__first, __first + __n, __val);
+ return __first + __n;
+}
+#endif
+template <class _Size>
+inline char* __fill_n(char* __first, _Size __n,
+ const char& __val) {
+ _STLP_STD::fill(__first, __first + __n, __val);
+ return __first + __n;
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _OutputIter, class _Size, class _Tp>
+inline void fill_n(_OutputIter __first, _Size __n, const _Tp& __val) {
+ _STLP_FIX_LITERAL_BUG(__first)
+ _STLP_PRIV __fill_n(__first, __n, __val);
+}
+
+
+//--------------------------------------------------
+// equal and mismatch
+
+template <class _InputIter1, class _InputIter2>
+_STLP_INLINE_LOOP
+_STLP_STD::pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
+ _InputIter1 __last1,
+ _InputIter2 __first2) {
+ _STLP_FIX_LITERAL_BUG(__first2)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ while (__first1 != __last1 && *__first1 == *__first2) {
+ ++__first1;
+ ++__first2;
+ }
+ return _STLP_STD::pair<_InputIter1, _InputIter2>(__first1, __first2);
+}
+
+template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
+_STLP_INLINE_LOOP
+_STLP_STD::pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
+ _InputIter1 __last1,
+ _InputIter2 __first2,
+ _BinaryPredicate __binary_pred) {
+ _STLP_FIX_LITERAL_BUG(__first2)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) {
+ ++__first1;
+ ++__first2;
+ }
+ return _STLP_STD::pair<_InputIter1, _InputIter2>(__first1, __first2);
+}
+
+template <class _InputIter1, class _InputIter2>
+_STLP_INLINE_LOOP
+bool equal(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2) {
+ _STLP_FIX_LITERAL_BUG(__first1) _STLP_FIX_LITERAL_BUG(__last1) _STLP_FIX_LITERAL_BUG(__first2)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ if (!(*__first1 == *__first2))
+ return false;
+ return true;
+}
+
+template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
+_STLP_INLINE_LOOP
+bool equal(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _BinaryPredicate __binary_pred) {
+ _STLP_FIX_LITERAL_BUG(__first2)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ for ( ; __first1 != __last1; ++__first1, ++__first2)
+ if (!__binary_pred(*__first1, *__first2))
+ return false;
+ return true;
+}
+
+//--------------------------------------------------
+// lexicographical_compare and lexicographical_compare_3way.
+// (the latter is not part of the C++ standard.)
+
+template <class _InputIter1, class _InputIter2>
+bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2);
+
+template <class _InputIter1, class _InputIter2, class _Compare>
+bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _Compare __comp);
+
+inline bool
+lexicographical_compare(const unsigned char* __first1,
+ const unsigned char* __last1,
+ const unsigned char* __first2,
+ const unsigned char* __last2) {
+ const size_t __len1 = __last1 - __first1;
+ const size_t __len2 = __last2 - __first2;
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+
+ const int __result = memcmp(__first1, __first2, (min) (__len1, __len2));
+ return __result != 0 ? (__result < 0) : (__len1 < __len2);
+}
+
+
+#if !(CHAR_MAX == SCHAR_MAX)
+inline bool lexicographical_compare(const char* __first1, const char* __last1,
+ const char* __first2, const char* __last2) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
+
+ return lexicographical_compare((const unsigned char*) __first1,
+ (const unsigned char*) __last1,
+ (const unsigned char*) __first2,
+ (const unsigned char*) __last2);
+}
+#endif /* CHAR_MAX == SCHAR_MAX */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2>
+int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2);
+
+inline int
+__lexicographical_compare_3way(const unsigned char* __first1,
+ const unsigned char* __last1,
+ const unsigned char* __first2,
+ const unsigned char* __last2) {
+ const ptrdiff_t __len1 = __last1 - __first1;
+ const ptrdiff_t __len2 = __last2 - __first2;
+ const int __result = memcmp(__first1, __first2, (min) (__len1, __len2));
+ return __result != 0 ? __result
+ : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
+}
+
+
+#if !(CHAR_MAX == SCHAR_MAX)
+inline int
+__lexicographical_compare_3way(const char* __first1, const char* __last1,
+ const char* __first2, const char* __last2) {
+ return __lexicographical_compare_3way((const unsigned char*) __first1,
+ (const unsigned char*) __last1,
+ (const unsigned char*) __first2,
+ (const unsigned char*) __last2);
+}
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if !defined (_STLP_NO_EXTENSIONS)
+template <class _InputIter1, class _InputIter2>
+int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2);
+
+#endif
+
+// count
+template <class _InputIter, class _Tp>
+_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter)
+count(_InputIter __first, _InputIter __last, const _Tp& __val) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0;
+ for ( ; __first != __last; ++__first)
+ if (*__first == __val)
+ ++__n;
+ return __n;
+}
+
+// find and find_if. Note find may be expressed in terms of find_if if appropriate binder was available.
+template <class _InputIter, class _Tp>
+_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val);
+
+template <class _InputIter, class _Predicate>
+_InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred);
+
+// search.
+template <class _ForwardIter1, class _ForwardIter2, class _BinaryPred>
+_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2, _BinaryPred __predicate);
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// find_first_of
+template <class _InputIter, class _ForwardIter>
+_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2);
+
+template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
+_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
+ _ForwardIter __first2, _ForwardIter __last2,
+ _BinaryPredicate __comp);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter1, class _ForwardIter2,
+ class _BinaryPredicate>
+_ForwardIter1
+find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
+ _ForwardIter2 __first2, _ForwardIter2 __last2,
+ _BinaryPredicate __comp);
+
+// replace
+template <class _ForwardIter, class _Tp>
+_STLP_INLINE_LOOP void
+replace(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __old_value, const _Tp& __new_value) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ for ( ; __first != __last; ++__first)
+ if (*__first == __old_value)
+ *__first = __new_value;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
+_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __val, _Compare1 __comp1, _Compare2 __comp2, _Distance*);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_algobase.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ALGOBASE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_alloc.c b/stlport/stl/_alloc.c
new file mode 100644
index 0000000..467405b
--- /dev/null
+++ b/stlport/stl/_alloc.c
@@ -0,0 +1,87 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_ALLOC_C
+#define _STLP_ALLOC_C
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#if defined (__WATCOMC__)
+# pragma warning 13 9
+# pragma warning 367 9
+# pragma warning 368 9
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Alloc>
+void * _STLP_CALL __debug_alloc<_Alloc>::allocate(size_t __n) {
+ size_t __total_extra = __extra_before_chunk() + __extra_after_chunk();
+ size_t __real_n = __n + __total_extra;
+ if (__real_n < __n) {
+ //It means that we rolled on size_t, __n must be very large:
+ _STLP_THROW_BAD_ALLOC;
+ }
+ __alloc_header *__result = (__alloc_header *)__allocator_type::allocate(__real_n);
+ memset((char*)__result, __shred_byte, __real_n * sizeof(value_type));
+ __result->__magic = __magic;
+ __result->__type_size = sizeof(value_type);
+ __result->_M_size = (_STLP_UINT32_T)__n;
+ return ((char*)__result) + (long)__extra_before;
+}
+
+template <class _Alloc>
+void _STLP_CALL
+__debug_alloc<_Alloc>::deallocate(void *__p, size_t __n) {
+ __alloc_header * __real_p = (__alloc_header*)((char *)__p -(long)__extra_before);
+ // check integrity
+ _STLP_VERBOSE_ASSERT(__real_p->__magic != __deleted_magic, _StlMsg_DBA_DELETED_TWICE)
+ _STLP_VERBOSE_ASSERT(__real_p->__magic == __magic, _StlMsg_DBA_NEVER_ALLOCATED)
+ _STLP_VERBOSE_ASSERT(__real_p->__type_size == 1,_StlMsg_DBA_TYPE_MISMATCH)
+ _STLP_VERBOSE_ASSERT(__real_p->_M_size == __n, _StlMsg_DBA_SIZE_MISMATCH)
+ // check pads on both sides
+ unsigned char* __tmp;
+ for (__tmp = (unsigned char*)(__real_p + 1); __tmp < (unsigned char*)__p; ++__tmp) {
+ _STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_UNDERRUN)
+ }
+
+ size_t __real_n = __n + __extra_before_chunk() + __extra_after_chunk();
+
+ for (__tmp= ((unsigned char*)__p) + __n * sizeof(value_type);
+ __tmp < ((unsigned char*)__real_p) + __real_n ; ++__tmp) {
+ _STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_OVERRUN)
+ }
+
+ // that may be unfortunate, just in case
+ __real_p->__magic = __deleted_magic;
+ memset((char*)__p, __shred_byte, __n * sizeof(value_type));
+ __allocator_type::deallocate(__real_p, __real_n);
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_ALLOC_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_alloc.h b/stlport/stl/_alloc.h
new file mode 100644
index 0000000..09b8af5
--- /dev/null
+++ b/stlport/stl/_alloc.h
@@ -0,0 +1,580 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+#define _STLP_INTERNAL_ALLOC_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NEW_HEADER
+# include <stl/_new.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// Malloc-based allocator. Typically slower than default alloc below.
+// Typically thread-safe and more storage efficient.
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+typedef void (* __oom_handler_type)();
+#endif
+
+class _STLP_CLASS_DECLSPEC __malloc_alloc {
+public:
+ // this one is needed for proper simple_alloc wrapping
+ typedef char value_type;
+ static void* _STLP_CALL allocate(size_t __n)
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+ ;
+#else
+ {
+ void *__result = malloc(__n);
+ if (__result == 0) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ return __result;
+ }
+#endif
+
+ static void _STLP_CALL deallocate(void* __p, size_t /* __n */) { free((char*)__p); }
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+ static __oom_handler_type _STLP_CALL set_malloc_handler(__oom_handler_type __f);
+#endif
+};
+
+// New-based allocator. Typically slower than default alloc below.
+// Typically thread-safe and more storage efficient.
+class _STLP_CLASS_DECLSPEC __new_alloc {
+public:
+ // this one is needed for proper simple_alloc wrapping
+ typedef char value_type;
+ static void* _STLP_CALL allocate(size_t __n) { return __stl_new(__n); }
+ static void _STLP_CALL deallocate(void* __p, size_t) { __stl_delete(__p); }
+};
+
+// Allocator adaptor to check size arguments for debugging.
+// Reports errors using assert. Checking can be disabled with
+// NDEBUG, but it's far better to just use the underlying allocator
+// instead when no checking is desired.
+// There is some evidence that this can confuse Purify.
+// This adaptor can only be applied to raw allocators
+
+template <class _Alloc>
+class __debug_alloc : public _Alloc {
+public:
+ typedef _Alloc __allocator_type;
+ typedef typename _Alloc::value_type value_type;
+private:
+ struct __alloc_header {
+ size_t __magic: 16;
+ size_t __type_size:16;
+ _STLP_UINT32_T _M_size;
+ }; // that is 8 bytes for sure
+ // Sunpro CC has bug on enums, so extra_before/after set explicitly
+ enum { __pad = 8, __magic = 0xdeba, __deleted_magic = 0xdebd,
+ __shred_byte = _STLP_SHRED_BYTE };
+
+ enum { __extra_before = 16, __extra_after = 8 };
+ // Size of space used to store size. Note
+ // that this must be large enough to preserve
+ // alignment.
+ static size_t _STLP_CALL __extra_before_chunk() {
+ return (long)__extra_before / sizeof(value_type) +
+ (size_t)((long)__extra_before % sizeof(value_type) > 0);
+ }
+ static size_t _STLP_CALL __extra_after_chunk() {
+ return (long)__extra_after / sizeof(value_type) +
+ (size_t)((long)__extra_after % sizeof(value_type) > 0);
+ }
+public:
+ __debug_alloc() {}
+ ~__debug_alloc() {}
+ static void* _STLP_CALL allocate(size_t);
+ static void _STLP_CALL deallocate(void *, size_t);
+};
+
+# if defined (__OS400__)
+// dums 02/05/2007: is it really necessary ?
+enum { _MAX_BYTES = 256 };
+# else
+enum { _MAX_BYTES = 32 * sizeof(void*) };
+# endif
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+// Default node allocator.
+// With a reasonable compiler, this should be roughly as fast as the
+// original STL class-specific allocators, but with less fragmentation.
+class _STLP_CLASS_DECLSPEC __node_alloc {
+ static void * _STLP_CALL _M_allocate(size_t& __n);
+ /* __p may not be 0 */
+ static void _STLP_CALL _M_deallocate(void *__p, size_t __n);
+
+public:
+ // this one is needed for proper simple_alloc wrapping
+ typedef char value_type;
+ /* __n must be > 0 */
+ static void* _STLP_CALL allocate(size_t& __n)
+ { return (__n > (size_t)_MAX_BYTES) ? __stl_new(__n) : _M_allocate(__n); }
+ /* __p may not be 0 */
+ static void _STLP_CALL deallocate(void *__p, size_t __n)
+ { if (__n > (size_t)_MAX_BYTES) __stl_delete(__p); else _M_deallocate(__p, __n); }
+};
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__node_alloc>;
+# endif
+
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__new_alloc>;
+_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__malloc_alloc>;
+#endif
+
+/* macro to convert the allocator for initialization
+ * not using MEMBER_TEMPLATE_CLASSES as it should work given template constructor */
+#if defined (_STLP_MEMBER_TEMPLATES) || ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/* if _STLP_NO_TEMPLATE_CONVERSIONS is set, the member template constructor is
+ * not used implicitly to convert allocator parameter, so let us do it explicitly */
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_NO_TEMPLATE_CONVERSIONS)
+# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
+# else
+# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __a
+# endif
+/* else convert, but only if partial specialization works, since else
+ * Container::allocator_type won't be different */
+#else
+# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
+#endif
+
+// Another allocator adaptor: _Alloc_traits. This serves two
+// purposes. First, make it possible to write containers that can use
+// either SGI-style allocators or standard-conforming allocator.
+
+// The fully general version.
+template <class _Tp, class _Allocator>
+struct _Alloc_traits {
+ typedef _Allocator _Orig;
+#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+ typedef typename _Allocator::_STLP_TEMPLATE rebind<_Tp> _Rebind_type;
+ typedef typename _Rebind_type::other allocator_type;
+ static allocator_type create_allocator(const _Orig& __a)
+ { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); }
+#else
+ // this is not actually true, used only to pass this type through
+ // to dynamic overload selection in _STLP_alloc_proxy methods
+ typedef _Allocator allocator_type;
+#endif
+};
+
+#if defined (_STLP_USE_PERTHREAD_ALLOC)
+
+_STLP_END_NAMESPACE
+// include additional header here
+# include <stl/_pthread_alloc.h>
+_STLP_BEGIN_NAMESPACE
+
+typedef __pthread_alloc __alloc_type;
+#elif defined (_STLP_USE_NEWALLOC)
+typedef __new_alloc __alloc_type;
+#elif defined (_STLP_USE_MALLOC)
+typedef __malloc_alloc __alloc_type;
+#else
+typedef __node_alloc __alloc_type;
+#endif
+
+#if defined (_STLP_DEBUG_ALLOC)
+typedef __debug_alloc<__alloc_type> __sgi_alloc;
+#else
+typedef __alloc_type __sgi_alloc;
+#endif
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+typedef __sgi_alloc __single_client_alloc;
+typedef __sgi_alloc __multithreaded_alloc;
+#endif
+
+// This implements allocators as specified in the C++ standard.
+//
+// Note that standard-conforming allocators use many language features
+// that are not yet widely implemented. In particular, they rely on
+// member templates, partial specialization, partial ordering of function
+// templates, the typename keyword, and the use of the template keyword
+// to refer to a template member of a dependent type.
+
+/*
+template <class _Tp>
+struct _AllocatorAux {
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+
+ pointer address(reference __x) const {return &__x;}
+ const_pointer address(const_reference __x) const { return &__x; }
+};
+
+template <class _Tp>
+struct _AllocatorAux<const _Tp> {
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+
+ const_pointer address(const_reference __x) const { return &__x; }
+};
+*/
+
+template <class _Tp>
+class allocator //: public _AllocatorAux<_Tp>
+/* A small helper struct to recognize STLport allocator implementation
+ * from any user specialization one.
+ */
+ : public __stlport_class<allocator<_Tp> >
+{
+public:
+ typedef _Tp value_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Tp1> struct rebind {
+ typedef allocator<_Tp1> other;
+ };
+#endif
+ allocator() _STLP_NOTHROW {}
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Tp1> allocator(const allocator<_Tp1>&) _STLP_NOTHROW {}
+#endif
+ allocator(const allocator<_Tp>&) _STLP_NOTHROW {}
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ allocator(__move_source<allocator<_Tp> > src) _STLP_NOTHROW {}
+#endif
+ ~allocator() _STLP_NOTHROW {}
+ pointer address(reference __x) const {return &__x;}
+ const_pointer address(const_reference __x) const { return &__x; }
+ // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0.
+ _Tp* allocate(size_type __n, const void* = 0) {
+ if (__n > max_size()) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+#endif
+ return __ret;
+ }
+
+ return 0;
+ }
+ // __p is permitted to be a null pointer, only if n==0.
+ void deallocate(pointer __p, size_type __n) {
+ _STLP_ASSERT( (__p == 0) == (__n == 0) )
+ if (__p != 0) {
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
+#endif
+ __sgi_alloc::deallocate((void*)__p, __n * sizeof(value_type));
+ }
+ }
+#if !defined (_STLP_NO_ANACHRONISMS)
+ // backwards compatibility
+ void deallocate(pointer __p) const { if (__p != 0) __sgi_alloc::deallocate((void*)__p, sizeof(value_type)); }
+#endif
+ size_type max_size() const _STLP_NOTHROW { return size_t(-1) / sizeof(value_type); }
+ void construct(pointer __p, const_reference __val) { _STLP_STD::_Copy_Construct(__p, __val); }
+ void destroy(pointer __p) { _STLP_STD::_Destroy(__p); }
+
+#if defined (_STLP_NO_EXTENSIONS)
+ /* STLport extension giving rounded size of an allocated memory buffer
+ * This method do not have to be part of a user defined allocator implementation
+ * and won't even be called if such a function was granted.
+ */
+protected:
+#endif
+ _Tp* _M_allocate(size_type __n, size_type& __allocated_n) {
+ if (__n > max_size()) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+#endif
+ __allocated_n = __buf_size / sizeof(value_type);
+ return __ret;
+ }
+
+ return 0;
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(allocator<_Tp>& __other) {}
+#endif
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC allocator<void> {
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ typedef void value_type;
+#endif
+#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Tp1> struct rebind {
+ typedef allocator<_Tp1> other;
+ };
+#endif
+};
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator==(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW
+{ return true; }
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator!=(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW
+{ return false; }
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS allocator<char>;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS allocator<wchar_t>;
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_EXPORT_TEMPLATE_CLASS allocator<void*>;
+# endif
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+struct __alloc_type_traits {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<allocator<_Tp> >::_Ret _STLportAlloc;
+#else
+ enum { _Is = _IsSTLportClass<allocator<_Tp> >::_Is };
+ typedef typename __bool2type<_Is>::_Ret _STLportAlloc;
+#endif
+ //The default allocator implementation which is recognize thanks to the
+ //__stlport_class inheritance is a stateless object so:
+ typedef _STLportAlloc has_trivial_default_constructor;
+ typedef _STLportAlloc has_trivial_copy_constructor;
+ typedef _STLportAlloc has_trivial_assignment_operator;
+ typedef _STLportAlloc has_trivial_destructor;
+ typedef _STLportAlloc is_POD_type;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __type_traits<allocator<_Tp> > : _STLP_PRIV __alloc_type_traits<_Tp> {};
+#else
+_STLP_TEMPLATE_NULL
+struct __type_traits<allocator<char> > : _STLP_PRIV __alloc_type_traits<char> {};
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_TEMPLATE_NULL
+struct __type_traits<allocator<wchar_t> > : _STLP_PRIV __alloc_type_traits<wchar_t> {};
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_TEMPLATE_NULL
+struct __type_traits<allocator<void*> > : _STLP_PRIV __alloc_type_traits<void*> {};
+# endif
+#endif
+
+
+#if !defined (_STLP_FORCE_ALLOCATORS)
+# define _STLP_FORCE_ALLOCATORS(a,y)
+#endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+// The version for the default allocator, for rare occasion when we have partial spec w/o member template classes
+template <class _Tp, class _Tp1>
+struct _Alloc_traits<_Tp, allocator<_Tp1> > {
+ typedef allocator<_Tp1> _Orig;
+ typedef allocator<_Tp> allocator_type;
+ static allocator_type create_allocator(const allocator<_Tp1 >& __a)
+ { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); }
+};
+#endif
+
+#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) && defined (_STLP_MEMBER_TEMPLATES)
+template <class _Tp, class _Alloc>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _Alloc_traits<_Tp, _Alloc>::allocator_type _STLP_CALL
+__stl_alloc_create(const _Alloc& __a, const _Tp*) {
+ typedef typename _Alloc::_STLP_TEMPLATE rebind<_Tp>::other _Rebound_type;
+ return _Rebound_type(__a);
+}
+#else
+// If custom allocators are being used without member template classes support :
+// user (on purpose) is forced to define rebind/get operations !!!
+template <class _Tp1, class _Tp2>
+inline allocator<_Tp2>& _STLP_CALL
+__stl_alloc_rebind(allocator<_Tp1>& __a, const _Tp2*) { return (allocator<_Tp2>&)(__a); }
+template <class _Tp1, class _Tp2>
+inline allocator<_Tp2> _STLP_CALL
+__stl_alloc_create(const allocator<_Tp1>&, const _Tp2*) { return allocator<_Tp2>(); }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// inheritance is being used for EBO optimization
+template <class _Value, class _Tp, class _MaybeReboundAlloc>
+class _STLP_alloc_proxy : public _MaybeReboundAlloc {
+private:
+ typedef _MaybeReboundAlloc _Base;
+ typedef typename _Base::size_type size_type;
+ typedef _STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc> _Self;
+public:
+ _Value _M_data;
+
+ _STLP_alloc_proxy (const _MaybeReboundAlloc& __a, _Value __p) :
+ _MaybeReboundAlloc(__a), _M_data(__p) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _STLP_alloc_proxy (__move_source<_Self> src) :
+ _Base(_STLP_PRIV _AsMoveSource(src.get()._M_base())),
+ _M_data(_STLP_PRIV _AsMoveSource(src.get()._M_data)) {}
+
+ _Base& _M_base()
+ { return *this; }
+#endif
+
+private:
+ /* Following are helper methods to detect stateless allocators and avoid
+ * swap in this case. For some compilers (VC6) it is a workaround for a
+ * compiler bug in the Empty Base class Optimization feature, for others
+ * it is a small optimization or nothing if no EBO. */
+ void _M_swap_alloc(_Self&, const __true_type& /*_IsStateless*/)
+ {}
+
+ void _M_swap_alloc(_Self& __x, const __false_type& /*_IsStateless*/) {
+ _MaybeReboundAlloc &__base_this = *this;
+ _MaybeReboundAlloc &__base_x = __x;
+ _STLP_STD::swap(__base_this, __base_x);
+ }
+
+public:
+ void _M_swap_alloc(_Self& __x) {
+#if !defined (__BORLANDC__)
+ typedef typename _IsStateless<_MaybeReboundAlloc>::_Ret _StatelessAlloc;
+#else
+ typedef typename __bool2type<_IsStateless<_MaybeReboundAlloc>::_Is>::_Ret _StatelessAlloc;
+#endif
+ _M_swap_alloc(__x, _StatelessAlloc());
+ }
+
+ /* We need to define the following swap implementation for allocator with state
+ * as those allocators might have implement a special swap function to correctly
+ * move datas from an instance to the oher, _STLP_alloc_proxy should not break
+ * this mecanism. */
+ void swap(_Self& __x) {
+ _M_swap_alloc(__x);
+ _STLP_STD::swap(_M_data, __x._M_data);
+ }
+
+ _Tp* allocate(size_type __n, size_type& __allocated_n) {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<_MaybeReboundAlloc>::_Ret _STLportAlloc;
+#else
+ typedef typename __bool2type<_IsSTLportClass<_MaybeReboundAlloc>::_Is>::_Ret _STLportAlloc;
+#endif
+ return allocate(__n, __allocated_n, _STLportAlloc());
+ }
+
+ // Unified interface to perform allocate()/deallocate() with limited
+ // language support
+#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+ // else it is rebound already, and allocate() member is accessible
+ _Tp* allocate(size_type __n)
+ { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).allocate(__n, 0); }
+ void deallocate(_Tp* __p, size_type __n)
+ { __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).deallocate(__p, __n); }
+private:
+ _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/)
+ { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0))._M_allocate(__n, __allocated_n); }
+#else
+ //Expose Standard allocate overload (using expression do not work for some compilers (Borland))
+ _Tp* allocate(size_type __n)
+ { return _Base::allocate(__n); }
+private:
+ _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/)
+ { return _Base::_M_allocate(__n, __allocated_n); }
+#endif
+
+ _Tp* allocate(size_type __n, size_type& __allocated_n, const __false_type& /*STLport allocator*/)
+ { __allocated_n = __n; return allocate(__n); }
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<char*, char, allocator<char> >;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<wchar_t*, wchar_t, allocator<wchar_t> >;
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<void**, void*, allocator<void*> >;
+# endif
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_alloc.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ALLOC_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_auto_ptr.h b/stlport/stl/_auto_ptr.h
new file mode 100644
index 0000000..c750534
--- /dev/null
+++ b/stlport/stl/_auto_ptr.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_AUTO_PTR_H
+#define _STLP_AUTO_PTR_H
+
+_STLP_BEGIN_NAMESPACE
+// implementation primitive
+class __ptr_base {
+public:
+ void* _M_p;
+ void __set(const volatile void* p) { _M_p = __CONST_CAST(void*,p); }
+ void __set(void* p) { _M_p = p; }
+};
+
+template <class _Tp>
+class auto_ptr_ref {
+public:
+ __ptr_base& _M_r;
+ _Tp* const _M_p;
+
+ auto_ptr_ref(__ptr_base& __r, _Tp* __p) : _M_r(__r), _M_p(__p) { }
+
+ _Tp* release() const { _M_r.__set(__STATIC_CAST(void*, 0)); return _M_p; }
+
+private:
+ //explicitely defined as private to avoid warnings:
+ typedef auto_ptr_ref<_Tp> _Self;
+ _Self& operator = (_Self const&);
+};
+
+template<class _Tp>
+class auto_ptr : public __ptr_base {
+public:
+ typedef _Tp element_type;
+ typedef auto_ptr<_Tp> _Self;
+
+ _Tp* release() _STLP_NOTHROW {
+ _Tp* __px = this->get();
+ this->_M_p = 0;
+ return __px;
+ }
+
+ void reset(_Tp* __px = 0) _STLP_NOTHROW {
+ _Tp* __pt = this->get();
+ if (__px != __pt)
+ delete __pt;
+ this->__set(__px);
+ }
+
+ _Tp* get() const _STLP_NOTHROW
+#if !defined (__GNUC__) || (__GNUC__ > 2)
+ { return __STATIC_CAST(_Tp*, _M_p); }
+#else
+ { return __REINTERPRET_CAST(_Tp*, _M_p); }
+#endif
+
+#if !defined (_STLP_NO_ARROW_OPERATOR)
+ _Tp* operator->() const _STLP_NOTHROW {
+ _STLP_VERBOSE_ASSERT(get() != 0, _StlMsg_AUTO_PTR_NULL)
+ return get();
+ }
+#endif
+ _Tp& operator*() const _STLP_NOTHROW {
+ _STLP_VERBOSE_ASSERT(get() != 0, _StlMsg_AUTO_PTR_NULL)
+ return *get();
+ }
+
+ explicit auto_ptr(_Tp* __px = 0) _STLP_NOTHROW { this->__set(__px); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if !defined (_STLP_NO_TEMPLATE_CONVERSIONS)
+ template<class _Tp1> auto_ptr(auto_ptr<_Tp1>& __r) _STLP_NOTHROW {
+ _Tp* __conversionCheck = __r.release();
+ this->__set(__conversionCheck);
+ }
+# endif
+ template<class _Tp1> auto_ptr<_Tp>& operator=(auto_ptr<_Tp1>& __r) _STLP_NOTHROW {
+ _Tp* __conversionCheck = __r.release();
+ reset(__conversionCheck);
+ return *this;
+ }
+#endif
+
+ auto_ptr(_Self& __r) _STLP_NOTHROW { this->__set(__r.release()); }
+
+ _Self& operator=(_Self& __r) _STLP_NOTHROW {
+ reset(__r.release());
+ return *this;
+ }
+
+ ~auto_ptr() _STLP_NOTHROW { /* boris : reset(0) might be better */ delete this->get(); }
+
+ auto_ptr(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW
+ { this->__set(__r.release()); }
+
+ _Self& operator=(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW {
+ reset(__r.release());
+ return *this;
+ }
+
+#if defined(_STLP_MEMBER_TEMPLATES) && !defined(_STLP_NO_TEMPLATE_CONVERSIONS)
+ template<class _Tp1> operator auto_ptr_ref<_Tp1>() _STLP_NOTHROW
+ { return auto_ptr_ref<_Tp1>(*this, this->get()); }
+ template<class _Tp1> operator auto_ptr<_Tp1>() _STLP_NOTHROW
+ { return auto_ptr<_Tp1>(release()); }
+#else
+ operator auto_ptr_ref<_Tp>() _STLP_NOTHROW
+ { return auto_ptr_ref<_Tp>(*this, this->get()); }
+#endif
+};
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_AUTO_PTR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_bitset.c b/stlport/stl/_bitset.c
similarity index 100%
rename from stl/_bitset.c
rename to stlport/stl/_bitset.c
diff --git a/stl/_bitset.h b/stlport/stl/_bitset.h
similarity index 100%
rename from stl/_bitset.h
rename to stlport/stl/_bitset.h
diff --git a/stlport/stl/_bvector.h b/stlport/stl/_bvector.h
new file mode 100644
index 0000000..bf417f1
--- /dev/null
+++ b/stlport/stl/_bvector.h
@@ -0,0 +1,841 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_BVECTOR_H
+#define _STLP_INTERNAL_BVECTOR_H
+
+#ifndef _STLP_INTERNAL_VECTOR_H
+# include <stl/_vector.h>
+#endif
+
+#define _STLP_WORD_BIT (int(CHAR_BIT * sizeof(unsigned int)))
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _Bit_reference {
+ unsigned int* _M_p;
+ unsigned int _M_mask;
+ _Bit_reference(unsigned int* __x, unsigned int __y)
+ : _M_p(__x), _M_mask(__y) {}
+
+public:
+ _Bit_reference() : _M_p(0), _M_mask(0) {}
+
+ operator bool() const {
+ return !(!(*_M_p & _M_mask));
+ }
+ _Bit_reference& operator = (bool __x) {
+ if (__x) *_M_p |= _M_mask;
+ else *_M_p &= ~_M_mask;
+ return *this;
+ }
+ _Bit_reference& operator = (const _Bit_reference& __x) {
+ return *this = bool(__x);
+ }
+ bool operator == (const _Bit_reference& __x) const {
+ return bool(*this) == bool(__x);
+ }
+ bool operator < (const _Bit_reference& __x) const {
+ return !bool(*this) && bool(__x);
+ }
+
+ _Bit_reference& operator |= (bool __x) {
+ if (__x)
+ *_M_p |= _M_mask;
+ return *this;
+ }
+ _Bit_reference& operator &= (bool __x) {
+ if (!__x)
+ *_M_p &= ~_M_mask;
+ return *this;
+ }
+ void flip() { *_M_p ^= _M_mask; }
+};
+
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+inline void swap(_STLP_PRIV _Bit_reference& __x, _STLP_PRIV _Bit_reference& __y) {
+ bool __tmp = (bool)__x;
+ __x = __y;
+ __y = __tmp;
+}
+
+// Might not be very useful but costs nothing!
+_STLP_TEMPLATE_NULL
+struct __type_traits<_STLP_PRIV _Bit_reference> {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __false_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _Bit_iterator_base {
+ typedef ptrdiff_t difference_type;
+
+ unsigned int* _M_p;
+ unsigned int _M_offset;
+
+ void _M_bump_up() {
+ if (_M_offset++ == _STLP_WORD_BIT - 1) {
+ _M_offset = 0;
+ ++_M_p;
+ }
+ }
+
+ void _M_bump_down() {
+ if (_M_offset-- == 0) {
+ _M_offset = _STLP_WORD_BIT - 1;
+ --_M_p;
+ }
+ }
+
+ _Bit_iterator_base() : _M_p(0), _M_offset(0) {}
+ _Bit_iterator_base(unsigned int* __x, unsigned int __y) : _M_p(__x), _M_offset(__y) {}
+// see comment in doc/README.evc4 and doc/README.evc8
+#if defined(_MSC_VER) && _MSC_VER<=1401 && defined(MIPS) && defined(NDEBUG)
+ _Bit_iterator_base( const _Bit_iterator_base& __x) : _M_p(__x._M_p), _M_offset(__x._M_offset) {}
+#endif
+ // _Bit_iterator_base& operator = ( const _Bit_iterator_base& __x) { _M_p = __x._M_p ; _M_offset = __x._M_offset ; return *this; }
+
+ void _M_advance (difference_type __i) {
+ difference_type __n = __i + _M_offset;
+ _M_p += __n / _STLP_WORD_BIT;
+ __n = __n % _STLP_WORD_BIT;
+ if (__n < 0) {
+ _M_offset = (unsigned int) __n + _STLP_WORD_BIT;
+ --_M_p;
+ } else
+ _M_offset = (unsigned int) __n;
+ }
+
+ difference_type _M_subtract(const _Bit_iterator_base& __x) const {
+ return _STLP_WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
+ }
+};
+
+inline bool _STLP_CALL operator==(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return __y._M_p == __x._M_p && __y._M_offset == __x._M_offset;
+}
+inline bool _STLP_CALL operator!=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return __y._M_p != __x._M_p || __y._M_offset != __x._M_offset;
+}
+
+inline bool _STLP_CALL operator<(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return __x._M_p < __y._M_p || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset);
+}
+
+inline bool _STLP_CALL operator>(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return operator <(__y , __x);
+}
+inline bool _STLP_CALL operator<=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return !(__y < __x);
+}
+inline bool _STLP_CALL operator>=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
+ return !(__x < __y);
+}
+
+template <class _Ref, class _Ptr>
+struct _Bit_iter : public _Bit_iterator_base {
+ typedef _Ref reference;
+ typedef _Ptr pointer;
+ typedef _Bit_iter<_Ref, _Ptr> _Self;
+ typedef random_access_iterator_tag iterator_category;
+ typedef bool value_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+
+ _Bit_iter(unsigned int* __x, unsigned int __y) : _Bit_iterator_base(__x, __y) {}
+ _Bit_iter() {}
+
+ _Bit_iter(const _Bit_iter<_Bit_reference, _Bit_reference*>& __x):
+ _Bit_iterator_base((const _Bit_iterator_base&)__x) {}
+
+ // _Self& operator = (const _Bit_iter<_Bit_reference, _Bit_reference*>& __x)
+ // { (_Bit_iterator_base&)*this = (const _Bit_iterator_base&)__x; return *this; }
+
+ reference operator*() const {
+ return _Bit_reference(_M_p, 1UL << _M_offset);
+ }
+ _Self& operator++() {
+ _M_bump_up();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ _M_bump_up();
+ return __tmp;
+ }
+ _Self& operator--() {
+ _M_bump_down();
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ _M_bump_down();
+ return __tmp;
+ }
+ _Self& operator+=(difference_type __i) {
+ _M_advance(__i);
+ return *this;
+ }
+ _Self& operator-=(difference_type __i) {
+ *this += -__i;
+ return *this;
+ }
+ _Self operator+(difference_type __i) const {
+ _Self __tmp = *this;
+ return __tmp += __i;
+ }
+ _Self operator-(difference_type __i) const {
+ _Self __tmp = *this;
+ return __tmp -= __i;
+ }
+ difference_type operator-(const _Self& __x) const {
+ return _M_subtract(__x);
+ }
+ reference operator[](difference_type __i) { return *(*this + __i); }
+};
+
+template <class _Ref, class _Ptr>
+inline _Bit_iter<_Ref,_Ptr> _STLP_CALL
+operator+(ptrdiff_t __n, const _Bit_iter<_Ref, _Ptr>& __x) {
+ return __x + __n;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Ref, class _Ptr>
+struct __type_traits< _STLP_PRIV _Bit_iter<_Ref, _Ptr> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+inline random_access_iterator_tag iterator_category(const _STLP_PRIV _Bit_iterator_base&)
+{ return random_access_iterator_tag(); }
+inline ptrdiff_t* distance_type(const _STLP_PRIV _Bit_iterator_base&)
+{ return (ptrdiff_t*)0; }
+inline bool* value_type(const _STLP_PRIV _Bit_iter<_STLP_PRIV _Bit_reference, _STLP_PRIV _Bit_reference*>&)
+{ return (bool*)0; }
+inline bool* value_type(const _STLP_PRIV _Bit_iter<bool, const bool*>&)
+{ return (bool*)0; }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+typedef _Bit_iter<bool, const bool*> _Bit_const_iterator;
+typedef _Bit_iter<_Bit_reference, _Bit_reference*> _Bit_iterator;
+
+// Bit-vector base class, which encapsulates the difference between
+// old SGI-style allocators and standard-conforming allocators.
+template <class _Alloc>
+class _Bvector_base {
+ typedef _Bvector_base<_Alloc> _Self;
+public:
+ _STLP_FORCE_ALLOCATORS(bool, _Alloc)
+ typedef _Alloc allocator_type;
+ typedef unsigned int __chunk_type;
+ typedef typename _Alloc_traits<__chunk_type, _Alloc>::allocator_type __chunk_allocator_type;
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(__STATIC_CAST(const __chunk_allocator_type&, _M_end_of_storage), bool); }
+
+ _Bvector_base(const allocator_type& __a)
+ : _M_start(), _M_finish(), _M_end_of_storage(_STLP_CONVERT_ALLOCATOR(__a, __chunk_type),
+ (__chunk_type*)0)
+ {}
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Bvector_base(__move_source<_Self> src)
+ : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
+ _M_end_of_storage(src.get()._M_end_of_storage) {
+ //Make the source destroyable
+ src.get()._M_start._M_p = 0;
+ }
+#endif
+
+ ~_Bvector_base() {
+ _M_deallocate();
+ }
+
+protected:
+
+ static size_t _M_bits_to_chunks(size_t __n_bits)
+ { return (__n_bits + _STLP_WORD_BIT - 1) / _STLP_WORD_BIT; }
+
+ __chunk_type* _M_bit_alloc(size_t __n)
+ { return _M_end_of_storage.allocate(_M_bits_to_chunks(__n)); }
+
+ void _M_deallocate() {
+ if (_M_start._M_p)
+ _M_end_of_storage.deallocate(_M_start._M_p,
+ _M_end_of_storage._M_data - _M_start._M_p);
+ }
+
+ _Bit_iterator _M_start;
+ _Bit_iterator _M_finish;
+ _STLP_alloc_proxy<__chunk_type*, __chunk_type, __chunk_allocator_type> _M_end_of_storage;
+};
+
+
+// The next few lines are confusing. What we're doing is declaring a
+// partial specialization of vector<T, Alloc> if we have the necessary
+// compiler support. Otherwise, we define a class bit_vector which uses
+// the default allocator.
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_BOOL) && !defined (__SUNPRO_CC)
+# define _STLP_VECBOOL_TEMPLATE
+# define __BVEC_TMPL_HEADER template <class _Alloc>
+#else
+# undef _STLP_VECBOOL_TEMPLATE
+# ifdef _STLP_NO_BOOL
+# define __BVEC_TMPL_HEADER
+# else
+# define __BVEC_TMPL_HEADER _STLP_TEMPLATE_NULL
+# endif
+# define _Alloc allocator<bool>
+#endif
+
+#if defined (_STLP_DEBUG)
+# define vector _STLP_NON_DBG_NAME(vector)
+#endif
+
+#ifdef _STLP_NO_BOOL
+# define __BVECTOR_QUALIFIED bit_vector
+# define __BVECTOR bit_vector
+#else
+# ifdef _STLP_VECBOOL_TEMPLATE
+# define __BVECTOR_QUALIFIED vector<bool, _Alloc>
+# else
+# define __BVECTOR_QUALIFIED vector<bool, allocator<bool> >
+# endif
+# if defined (_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS)
+# define __BVECTOR __BVECTOR_QUALIFIED
+# else
+# define __BVECTOR vector
+# endif
+#endif
+
+#if !defined (_STLP_DEBUG) || defined (_STLP_NO_BOOL)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+__BVEC_TMPL_HEADER
+class __BVECTOR_QUALIFIED : public _STLP_PRIV _Bvector_base<_Alloc >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_DEBUG)
+ , public __stlport_class< __BVECTOR_QUALIFIED >
+#endif
+{
+ typedef _STLP_PRIV _Bvector_base<_Alloc > _Base;
+ typedef __BVECTOR_QUALIFIED _Self;
+public:
+ typedef bool value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _STLP_PRIV _Bit_reference reference;
+ typedef bool const_reference;
+ typedef _STLP_PRIV _Bit_reference* pointer;
+ typedef const bool* const_pointer;
+ typedef random_access_iterator_tag _Iterator_category;
+
+ typedef _STLP_PRIV _Bit_iterator iterator;
+ typedef _STLP_PRIV _Bit_const_iterator const_iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+#ifdef _STLP_VECBOOL_TEMPLATE
+ typedef _STLP_TYPENAME _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type;
+ typedef _STLP_TYPENAME _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type;
+#else
+ typedef _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type;
+ typedef _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type;
+#endif
+
+protected:
+
+ void _M_initialize(size_type __n) {
+ __chunk_type* __q = this->_M_bit_alloc(__n);
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__n);
+ this->_M_start = iterator(__q, 0);
+ this->_M_finish = this->_M_start + difference_type(__n);
+ }
+ void _M_insert_aux(iterator __position, bool __x) {
+ if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
+ _STLP_PRIV __copy_backward(__position, this->_M_finish, this->_M_finish + 1,
+ random_access_iterator_tag(), (difference_type*)0 );
+ *__position = __x;
+ ++this->_M_finish;
+ }
+ else {
+ size_type __len = size() ? 2 * size() : _STLP_WORD_BIT;
+ __chunk_type* __q = this->_M_bit_alloc(__len);
+ iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
+ *__i++ = __x;
+ this->_M_finish = _STLP_STD::copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void _M_initialize_range(_InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ this->_M_start = iterator();
+ this->_M_finish = iterator();
+ this->_M_end_of_storage._M_data = 0;
+ for ( ; __first != __last; ++__first)
+ push_back(*__first);
+ }
+
+ template <class _ForwardIterator>
+ void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ _M_initialize(__n);
+ _STLP_STD::copy(__first, __last, this->_M_start);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_range(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first) {
+ __pos = insert(__pos, *__first);
+ ++__pos;
+ }
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert_range(iterator __position,
+ _ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ if (capacity() - size() >= __n) {
+ _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n),
+ random_access_iterator_tag(), (difference_type*)0 );
+ _STLP_STD::copy(__first, __last, __position);
+ this->_M_finish += difference_type(__n);
+ }
+ else {
+ size_type __len = size() + (max)(size(), __n);
+ __chunk_type* __q = this->_M_bit_alloc(__len);
+ iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
+ __i = _STLP_STD::copy(__first, __last, __i);
+ this->_M_finish = _STLP_STD::copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+ }
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+public:
+ iterator begin() { return this->_M_start; }
+ const_iterator begin() const { return this->_M_start; }
+ iterator end() { return this->_M_finish; }
+ const_iterator end() const { return this->_M_finish; }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(begin());
+ }
+
+ size_type size() const { return size_type(end() - begin()); }
+ size_type max_size() const { return size_type(-1); }
+ size_type capacity() const {
+ return size_type(const_iterator(this->_M_end_of_storage._M_data, 0) - begin());
+ }
+ bool empty() const { return begin() == end(); }
+ reference operator[](size_type __n)
+ { return *(begin() + difference_type(__n)); }
+ const_reference operator[](size_type __n) const
+ { return *(begin() + difference_type(__n)); }
+
+ void _M_range_check(size_type __n) const {
+ if (__n >= this->size())
+ __stl_throw_range_error("vector<bool>");
+ }
+
+ reference at(size_type __n)
+ { _M_range_check(__n); return (*this)[__n]; }
+ const_reference at(size_type __n) const
+ { _M_range_check(__n); return (*this)[__n]; }
+
+ explicit __BVECTOR(const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {}
+
+ __BVECTOR(size_type __n, bool __val,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
+ _M_initialize(__n);
+ fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __val ? ~0 : 0);
+ }
+
+ explicit __BVECTOR(size_type __n)
+ : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) {
+ _M_initialize(__n);
+ fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), 0);
+ }
+
+ __BVECTOR(const _Self& __x)
+ : _STLP_PRIV _Bvector_base<_Alloc >(__x.get_allocator()) {
+ _M_initialize(__x.size());
+ _STLP_STD::copy(__x.begin(), __x.end(), this->_M_start);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Integer>
+ void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) {
+ _M_initialize(__n);
+ fill(this->_M_start._M_p, this->_M_end_of_storage._M_data, __x ? ~0 : 0);
+ }
+
+ template <class _InputIterator>
+ void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_initialize_range(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ __BVECTOR(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+# endif
+ template <class _InputIterator>
+ __BVECTOR(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+#else /* _STLP_MEMBER_TEMPLATES */
+ __BVECTOR(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ _M_initialize(__n);
+ _STLP_STD::copy(__first, __last, this->_M_start);
+ }
+ __BVECTOR(const bool* __first, const bool* __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ _M_initialize(__n);
+ _STLP_STD::copy(__first, __last, this->_M_start);
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ __BVECTOR(__move_source<_Self> src)
+ : _STLP_PRIV _Bvector_base<_Alloc >(__move_source<_Base>(src.get())) {}
+#endif
+
+ ~__BVECTOR() {}
+
+ __BVECTOR_QUALIFIED& operator=(const __BVECTOR_QUALIFIED& __x) {
+ if (&__x == this) return *this;
+ if (__x.size() > capacity()) {
+ this->_M_deallocate();
+ _M_initialize(__x.size());
+ }
+ _STLP_STD::copy(__x.begin(), __x.end(), begin());
+ this->_M_finish = begin() + difference_type(__x.size());
+ return *this;
+ }
+
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void _M_fill_assign(size_t __n, bool __x) {
+ if (__n > size()) {
+ fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0);
+ insert(end(), __n - size(), __x);
+ }
+ else {
+ erase(begin() + __n, end());
+ fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0);
+ }
+ }
+ void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&)
+ { _M_fill_assign((size_t) __n, (bool) __val); }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __first, _InputIter __last, const __false_type&)
+ { _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
+
+ template <class _InputIterator>
+ void _M_assign_aux(_InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ iterator __cur = begin();
+ for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
+ *__cur = *__first;
+ if (__first == __last)
+ erase(__cur, end());
+ else
+ insert(end(), __first, __last);
+ }
+
+ template <class _ForwardIterator>
+ void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ size_type __len = _STLP_STD::distance(__first, __last);
+ if (__len < size())
+ erase(_STLP_STD::copy(__first, __last, begin()), end());
+ else {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, size());
+ _STLP_STD::copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void reserve(size_type __n) {
+ if (capacity() < __n) {
+ if (max_size() < __n)
+ __stl_throw_length_error("vector<bool>");
+ __chunk_type* __q = this->_M_bit_alloc(__n);
+ _STLP_PRIV _Bit_iterator __z(__q, 0);
+ this->_M_finish = _STLP_STD::copy(begin(), end(), __z);
+ this->_M_deallocate();
+ this->_M_start = iterator(__q, 0);
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__n);
+ }
+ }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(end() - 1); }
+ const_reference back() const { return *(end() - 1); }
+ void push_back(bool __x) {
+ if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
+ *(this->_M_finish) = __x;
+ ++this->_M_finish;
+ }
+ else
+ _M_insert_aux(end(), __x);
+ }
+ void swap(__BVECTOR_QUALIFIED& __x) {
+ _STLP_STD::swap(this->_M_start, __x._M_start);
+ _STLP_STD::swap(this->_M_finish, __x._M_finish);
+ this->_M_end_of_storage.swap(__x._M_end_of_storage);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(__BVECTOR_QUALIFIED& __x) { swap(__x); }
+#endif
+
+ iterator insert(iterator __position, bool __x = bool()) {
+ difference_type __n = __position - begin();
+ if (this->_M_finish._M_p != this->_M_end_of_storage._M_data && __position == end()) {
+ *(this->_M_finish) = __x;
+ ++this->_M_finish;
+ }
+ else
+ _M_insert_aux(__position, __x);
+ return begin() + __n;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ const __true_type&) {
+ _M_fill_insert(__pos, (size_type) __n, (bool) __x);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_insert_range(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+ }
+
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ void insert(iterator __position,
+ _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__position, __first, __last, _Integral());
+ }
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __position,
+ const_iterator __first, const_iterator __last) {
+ if (__first == __last) return;
+ size_type __n = _STLP_STD::distance(__first, __last);
+ if (capacity() - size() >= __n) {
+ _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n,
+ random_access_iterator_tag(), (difference_type*)0 );
+ _STLP_STD::copy(__first, __last, __position);
+ this->_M_finish += __n;
+ }
+ else {
+ size_type __len = size() + (max)(size(), __n);
+ __chunk_type* __q = this->_M_bit_alloc(__len);
+ iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
+ __i = _STLP_STD::copy(__first, __last, __i);
+ this->_M_finish = _STLP_STD::copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+
+ void insert(iterator __position, const bool* __first, const bool* __last) {
+ if (__first == __last) return;
+ size_type __n = _STLP_STD::distance(__first, __last);
+ if (capacity() - size() >= __n) {
+ _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n,
+ random_access_iterator_tag(), (difference_type*)0 );
+ _STLP_STD::copy(__first, __last, __position);
+ this->_M_finish += __n;
+ }
+ else {
+ size_type __len = size() + (max)(size(), __n);
+ __chunk_type* __q = this->_M_bit_alloc(__len);
+ iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
+ __i = _STLP_STD::copy(__first, __last, __i);
+ this->_M_finish = _STLP_STD::copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void _M_fill_insert(iterator __position, size_type __n, bool __x) {
+ if (__n == 0) return;
+ if (capacity() - size() >= __n) {
+ _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n),
+ random_access_iterator_tag(), (difference_type*)0 );
+ fill(__position, __position + difference_type(__n), __x);
+ this->_M_finish += difference_type(__n);
+ }
+ else {
+ size_type __len = size() + (max)(size(), __n);
+ __chunk_type* __q = this->_M_bit_alloc(__len);
+ iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
+ fill_n(__i, __n, __x);
+ this->_M_finish = _STLP_STD::copy(__position, end(), __i + difference_type(__n));
+ this->_M_deallocate();
+ this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
+ this->_M_start = iterator(__q, 0);
+ }
+ }
+
+ void insert(iterator __position, size_type __n, bool __x) {
+ _M_fill_insert(__position, __n, __x);
+ }
+
+ void pop_back() {
+ --this->_M_finish;
+ }
+ iterator erase(iterator __position) {
+ if (__position + 1 != end())
+ _STLP_STD::copy(__position + 1, end(), __position);
+ --this->_M_finish;
+ return __position;
+ }
+ iterator erase(iterator __first, iterator __last) {
+ this->_M_finish = _STLP_STD::copy(__last, end(), __first);
+ return __first;
+ }
+ void resize(size_type __new_size, bool __x = bool()) {
+ if (__new_size < size())
+ erase(begin() + difference_type(__new_size), end());
+ else
+ insert(end(), __new_size - size(), __x);
+ }
+ void flip() {
+ for (__chunk_type* __p = this->_M_start._M_p; __p != this->_M_end_of_storage._M_data; ++__p)
+ *__p = ~*__p;
+ }
+
+ void clear() { erase(begin(), end()); }
+};
+
+#if defined (_STLP_NO_BOOL) || defined (__HP_aCC) // fixed soon (03/17/2000)
+# define _STLP_TEMPLATE_HEADER __BVEC_TMPL_HEADER
+# define _STLP_TEMPLATE_CONTAINER __BVECTOR_QUALIFIED
+# include <stl/_relops_cont.h>
+# undef _STLP_TEMPLATE_CONTAINER
+# undef _STLP_TEMPLATE_HEADER
+#endif /* NO_BOOL */
+
+#if defined (_STLP_DEBUG) && !defined (_STLP_NO_BOOL)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef vector
+#undef _Alloc
+#undef _STLP_VECBOOL_TEMPLATE
+#undef __BVECTOR
+#undef __BVECTOR_QUALIFIED
+#undef __BVEC_TMPL_HEADER
+
+#undef _STLP_WORD_BIT
+
+#endif /* _STLP_INTERNAL_BVECTOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_carray.h b/stlport/stl/_carray.h
similarity index 100%
rename from stl/_carray.h
rename to stlport/stl/_carray.h
diff --git a/stlport/stl/_cctype.h b/stlport/stl/_cctype.h
new file mode 100644
index 0000000..cf82524
--- /dev/null
+++ b/stlport/stl/_cctype.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CCTYPE
+#define _STLP_INTERNAL_CCTYPE
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cctype>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cctype)
+# endif
+#else
+# include <ctype.h>
+#endif /* _STLP_USE_NEW_C_HEADERS */
+
+#if ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+# if defined ( _STLP_IMPORT_VENDOR_CSTD )
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::isalnum;
+using _STLP_VENDOR_CSTD::isalpha;
+using _STLP_VENDOR_CSTD::iscntrl;
+using _STLP_VENDOR_CSTD::isdigit;
+using _STLP_VENDOR_CSTD::isgraph;
+using _STLP_VENDOR_CSTD::islower;
+using _STLP_VENDOR_CSTD::isprint;
+using _STLP_VENDOR_CSTD::ispunct;
+using _STLP_VENDOR_CSTD::isspace;
+using _STLP_VENDOR_CSTD::isupper;
+using _STLP_VENDOR_CSTD::isxdigit;
+using _STLP_VENDOR_CSTD::tolower;
+using _STLP_VENDOR_CSTD::toupper;
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD*/
+#endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+
+#endif
diff --git a/stlport/stl/_clocale.h b/stlport/stl/_clocale.h
new file mode 100644
index 0000000..091a9b6
--- /dev/null
+++ b/stlport/stl/_clocale.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CLOCALE
+#define _STLP_INTERNAL_CLOCALE
+
+#if !defined (_STLP_WCE_EVC3)
+
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <clocale>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(clocale)
+# endif
+# else
+# include <locale.h>
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::lconv;
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::localeconv;
+using _STLP_VENDOR_CSTD::setlocale;
+# endif
+_STLP_END_NAMESPACE
+# endif
+
+#endif /* !_STLP_WCE_EVC3 */
+
+#endif
diff --git a/stlport/stl/_cmath.h b/stlport/stl/_cmath.h
new file mode 100644
index 0000000..8dc0fe2
--- /dev/null
+++ b/stlport/stl/_cmath.h
@@ -0,0 +1,579 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CMATH
+#define _STLP_INTERNAL_CMATH
+
+/* gcc do not like when a using directive appear after a function
+ * declaration. cmath have abs overloads and cstdlib a using directive
+ * so cstdlib has to be included first.
+ */
+#if defined (__GNUC__) && defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdlib>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
+# endif
+#endif
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_NO_NAMESPACES) && !defined (exception)
+# define exception __math_exception
+# endif
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cmath>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cmath)
+# endif
+# if defined (_STLP_HAS_NO_NAMESPACES)
+# undef exception
+# endif
+#else
+# include <math.h>
+#endif
+
+#if (defined (__SUNPRO_CC) && (__SUNPRO_CC > 0x500)) || \
+ !(defined (__IBMCPP__) && (__IBMCPP__ >= 500) || !(defined(__HP_aCC) && (__HP_aCC >= 30000) ))
+# if !defined(_STLP_HAS_NO_NAMESPACES) && !defined(__SUNPRO_CC)
+// All the other hypot stuff is going to be at file scope, so follow along here.
+namespace std {
+# endif
+extern "C" double hypot(double x, double y);
+# if !defined(_STLP_HAS_NO_NAMESPACES) && !defined(__SUNPRO_CC)
+}
+# endif
+
+#endif
+
+#if defined (__sun) && defined (__GNUC__)
+extern "C" {
+ float __cosf(float v);
+ float __sinf(float v);
+ float __atan2f(float, float);
+ float __coshf(float v);
+ float __sinhf(float v);
+ float __sqrtf(float v);
+ float __expf(float v);
+ float __logf(float v);
+ float __log10f(float v);
+
+ long double __cosl(long double v);
+ long double __sinl(long double v);
+ long double __atan2l(long double, long double);
+ long double __coshl(long double v);
+ long double __sinhl(long double v);
+ long double __sqrtl(long double v);
+ long double __expl(long double v);
+ long double __logl(long double v);
+ long double __log10l(long double v);
+}
+
+extern "C" {
+ inline float cosf(float v) { return __cosf(v); }
+ inline float sinf(float v) { return __sinf(v); }
+ inline float atan2f(float v1, float v2) { return __atan2f(v1,v2); }
+ inline float coshf(float v) { return __coshf(v); }
+ inline float sinhf(float v) { return __sinhf(v); }
+ inline float sqrtf(float v) { return __sqrtf(v); }
+ inline float expf(float v) { return __expf(v); }
+ inline float logf(float v) { return __logf(v); }
+ inline float log10f(float v) { return __log10f(v); }
+
+ inline long double cosl(long double v) { return __cosl(v); }
+ inline long double sinl(long double v) { return __sinl(v); }
+ inline long double atan2l(long double v1, long double v2) { return __atan2l(v1,v2); }
+ inline long double coshl(long double v) { return __coshl(v); }
+ inline long double sinhl(long double v) { return __sinhl(v); }
+ inline long double sqrtl(long double v) { return __sqrtl(v); }
+ inline long double expl(long double v) { return __expl(v); }
+ inline long double logl(long double v) { return __logl(v); }
+ inline long double log10l(long double v) { return __log10l(v); }
+}
+#endif // __sun && __GNUC__
+
+#if defined (__sun)
+extern "C" {
+extern float __acosf(float);
+extern float __asinf(float);
+extern float __atanf(float);
+extern float __atan2f(float, float);
+extern float __ceilf(float);
+extern float __cosf(float);
+extern float __coshf(float);
+extern float __expf(float);
+extern float __fabsf(float);
+extern float __floorf(float);
+extern float __fmodf(float, float);
+extern float __frexpf(float, int *);
+extern float __ldexpf(float, int);
+extern float __logf(float);
+extern float __log10f(float);
+extern float __modff(float, float *);
+extern float __powf(float, float);
+extern float __sinf(float);
+extern float __sinhf(float);
+extern float __sqrtf(float);
+extern float __tanf(float);
+extern float __tanhf(float);
+
+extern long double __acosl(long double);
+extern long double __asinl(long double);
+extern long double __atanl(long double);
+extern long double __atan2l(long double, long double);
+extern long double __ceill(long double);
+extern long double __cosl(long double);
+extern long double __coshl(long double);
+extern long double __expl(long double);
+extern long double __fabsl(long double);
+extern long double __floorl(long double);
+extern long double __fmodl(long double, long double);
+extern long double __frexpl(long double, int *);
+extern long double __ldexpl(long double, int);
+extern long double __logl(long double);
+extern long double __log10l(long double);
+extern long double __modfl(long double, long double *);
+extern long double __powl(long double, long double);
+extern long double __sinl(long double);
+extern long double __sinhl(long double);
+extern long double __sqrtl(long double);
+extern long double __tanl(long double);
+extern long double __tanhl(long double);
+}
+#endif
+
+#if defined (__BORLANDC__)
+# define _STLP_CMATH_FUNC_NAMESPACE _STLP_VENDOR_CSTD
+#else
+# define _STLP_CMATH_FUNC_NAMESPACE
+#endif
+
+#if !defined (__sun) || defined (__GNUC__)
+# define _STLP_MATH_INLINE(float_type, func, cfunc) \
+ inline float_type func (float_type x) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x); }
+# define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
+ inline float_type func (float_type x, type y) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x, y); }
+# define _STLP_MATH_INLINE_D(float_type, func, cfunc)
+# define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc)
+#else
+# ifdef __SUNPRO_CC
+# define _STLP_MATH_INLINE(float_type, func, cfunc) \
+ inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::__##cfunc(x); }
+# define _STLP_MATH_INLINE_D(float_type, func, cfunc) \
+ inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::cfunc(x); }
+# define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \
+ inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::__##cfunc(x,y); }
+# define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc) \
+ inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::cfunc(x,y); }
+# else
+# error Unknown compiler for the Sun platform
+# endif
+#endif
+
+/** macros to define math functions
+These macros (having an X somewhere in the name) forward to the C library's
+double functions but cast the arguments and return values to the given type. */
+
+#define _STLP_MATH_INLINEX(__type,func,cfunc) \
+ inline __type func (__type x) \
+ { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x)); }
+#define _STLP_MATH_INLINE2X(__type1,__type2,func,cfunc) \
+ inline __type1 func (__type1 x, __type2 y) \
+ { return __STATIC_CAST(__type1, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, y)); }
+#define _STLP_MATH_INLINE2PX(__type,func,cfunc) \
+ inline __type func (__type x, __type *y) { \
+ double tmp1, tmp2; \
+ tmp1 = _STLP_CMATH_FUNC_NAMESPACE::cfunc(__STATIC_CAST(double, x), &tmp2); \
+ *y = __STATIC_CAST(__type, tmp2); \
+ return __STATIC_CAST(__type, tmp1); \
+ }
+#define _STLP_MATH_INLINE2XX(__type,func,cfunc) \
+ inline __type func (__type x, __type y) \
+ { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, (double)y)); }
+
+
+/** rough characterization of compiler and native C library
+For the compiler, it can either support long double or not. If it doesn't, the
+macro _STLP_NO_LONG_DOUBLE is not defined and we don't define any long double
+overloads.
+For the native C library the question is whether it has variants with an 'f'
+suffix (for float as opposed to double) or an 'l' suffix (for long double). If
+the float variants are missing, _STLP_NO_VENDOR_MATH_F is defined, when the
+long double variants are missing, _STLP_NO_VENDOR_MATH_L is defined. Of course
+the latter doesn't make sense anyway when the compiler already has no long
+double support.
+
+Those two traits determine a) which overloads get defined and b) how they are
+defined.
+
+Meaning of suffixes:
+"" : function returning and taking a float_type
+"2" : function returning a float_type and taking to float_types
+"2P" : function returning a float_type and taking a float_type and a float_type*
+"2PI": function returning a float_type and taking a float_type and an int*
+"2I" : function returning a float_type and taking a float_Type and an int
+*/
+
+#if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_NO_VENDOR_MATH_L) && !defined (_STLP_NO_VENDOR_MATH_F)
+ // long double support and both e.g. sinl(long double) and sinf(float)
+ // This is the default for a correct and complete native library.
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINE(float,func,cf##f) \
+ _STLP_MATH_INLINE_D(double,func,cf) \
+ _STLP_MATH_INLINE(long double,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2(float,float,func,cf##f) \
+ _STLP_MATH_INLINE2_D(double,double,func,cf) \
+ _STLP_MATH_INLINE2(long double,long double,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2(float,float *,func,cf##f) \
+ _STLP_MATH_INLINE2_D(double,double *,func,cf) \
+ _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2(float,int *,func,cf##f) \
+ _STLP_MATH_INLINE2_D(double,int *,func,cf) \
+ _STLP_MATH_INLINE2(long double,int *,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2(float,int,func,cf##f) \
+ _STLP_MATH_INLINE2_D(double,int,func,cf) \
+ _STLP_MATH_INLINE2(long double,int,func,cf##l)
+#else
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# if !defined (_STLP_NO_VENDOR_MATH_F)
+ // long double support and e.g. sinf(float) but not e.g. sinl(long double)
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINE(float,func,cf##f) \
+ _STLP_MATH_INLINEX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2(float,float,func,cf##f) \
+ _STLP_MATH_INLINE2XX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2(float,float *,func,cf##f) \
+ _STLP_MATH_INLINE2PX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2(float,int *,func,cf##f) \
+ _STLP_MATH_INLINE2X(long double,int *,func,cf)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2(float,int,func,cf##f) \
+ _STLP_MATH_INLINE2X(long double,int,func,cf)
+# elif !defined (_STLP_NO_VENDOR_MATH_L)
+ // long double support and e.g. sinl(long double) but not e.g. sinf(float)
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINEX(float,func,cf) \
+ _STLP_MATH_INLINE(long double,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2XX(float,func,cf) \
+ _STLP_MATH_INLINE2(long double,long double,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2PX(float,func,cf) \
+ _STLP_MATH_INLINE2(long double,long double *,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2X(float,int *,func,cf) \
+ _STLP_MATH_INLINE2(long double,int *,func,cf##l)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2X(float,int,func,cf) \
+ _STLP_MATH_INLINE2(long double,int,func,cf##l)
+# else
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINEX(float,func,cf) \
+ _STLP_MATH_INLINEX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2XX(float,func,cf) \
+ _STLP_MATH_INLINE2XX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2PX(float,func,cf) \
+ _STLP_MATH_INLINE2PX(long double,func,cf)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2X(float,int *,func,cf) \
+ _STLP_MATH_INLINE2X(long double,int *,func,cf)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2X(float,int,func,cf) \
+ _STLP_MATH_INLINE2X(long double,int,func,cf)
+# endif
+# else
+# if !defined (_STLP_NO_VENDOR_MATH_F)
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINE(float,func,cf##f)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2(float,float,func,cf##f)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2(float,float *,func,cf##f)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2(float,int *,func,cf##f)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2(float,int,func,cf##f)
+# else // _STLP_NO_VENDOR_MATH_F
+ // neither long double support nor e.g. sinf(float) functions
+# define _STLP_DEF_MATH_INLINE(func,cf) \
+ _STLP_MATH_INLINEX(float,func,cf)
+# define _STLP_DEF_MATH_INLINE2(func,cf) \
+ _STLP_MATH_INLINE2XX(float,func,cf)
+# define _STLP_DEF_MATH_INLINE2P(func,cf) \
+ _STLP_MATH_INLINE2PX(float,func,cf)
+# define _STLP_DEF_MATH_INLINE2PI(func,cf) \
+ _STLP_MATH_INLINE2X(float,int *,func,cf)
+# define _STLP_DEF_MATH_INLINE2I(func,cf) \
+ _STLP_MATH_INLINE2X(float,int,func,cf)
+# endif // _STLP_NO_VENDOR_MATH_F
+# endif
+#endif
+
+#if defined (_STLP_WCE) || \
+ (defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) && defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */)
+/*
+ * dums: VC6 has all the required C++ functions but only define them if
+ * _MSC_EXTENSIONS is not defined (a bug?). STLport just do the same
+ * thing also when _MSC_EXTENSIONS is defined.
+ * TODO: above check (_STLP_MSVC <= 1300) also catches VC7.0, is that intended?
+ */
+//We have to tell the compilers that abs, acos ... math functions are not intrinsic
+//otherwise we have Internal Compiler Error in release mode...
+# pragma warning(push)
+# pragma warning(disable: 4162) // no function with C linkage found
+# pragma warning(disable: 4163) // not available as an intrinsic function
+# pragma function (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
+# if defined (_STLP_WCE)
+# pragma function (ceil, floor)
+# endif
+# define _STLP_RESTORE_FUNCTION_INTRINSIC
+#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
+
+#if (defined (__BORLANDC__) || defined (__WATCOMC__)) && defined (_STLP_USE_NEW_C_HEADERS)
+/* In this config Borland native lib only define functions in std namespace.
+ * In order to have all overloads in STLport namespace we need to add the
+ * double overload in global namespace. We do not use a using statement to avoid
+ * import of invalid overload.
+ */
+# define _STLP_DMATH_INLINE(func) _STLP_MATH_INLINE(double, func, func)
+# define _STLP_DMATH_INLINE2(func) _STLP_MATH_INLINE2(double, double, func, func)
+
+_STLP_DMATH_INLINE(acos)
+_STLP_DMATH_INLINE(asin)
+_STLP_DMATH_INLINE(atan)
+_STLP_DMATH_INLINE2(atan2)
+_STLP_DMATH_INLINE(ceil)
+_STLP_DMATH_INLINE(cos)
+_STLP_DMATH_INLINE(cosh)
+_STLP_DMATH_INLINE(exp)
+_STLP_DMATH_INLINE(fabs)
+_STLP_DMATH_INLINE(floor)
+_STLP_DMATH_INLINE2(fmod)
+_STLP_MATH_INLINE2X(double, int*, frexp, frexp)
+_STLP_MATH_INLINE2X(double, int, ldexp, ldexp)
+_STLP_DMATH_INLINE(log)
+_STLP_DMATH_INLINE(log10)
+_STLP_MATH_INLINE2PX(double, modf, modf)
+_STLP_DMATH_INLINE(sin)
+_STLP_DMATH_INLINE(sinh)
+_STLP_DMATH_INLINE(sqrt)
+_STLP_DMATH_INLINE(tan)
+_STLP_DMATH_INLINE(tanh)
+_STLP_DMATH_INLINE2(pow)
+_STLP_DMATH_INLINE2(hypot)
+
+# undef _STLP_DMATH_INLINE
+# undef _STLP_DMATH_INLINE2
+#endif
+
+#if defined (__DMC__)
+# if defined (fabs)
+inline double __stlp_fabs(double __x) { return fabs(__x); }
+# undef fabs
+inline double fabs(double __x) { return __stlp_fabs(__x); }
+# endif
+# if defined (cos)
+inline double __stlp_cos(double __x) { return cos(__x); }
+# undef cos
+inline double cos(double __x) { return __stlp_cos(__x); }
+# endif
+# if defined (sin)
+inline double __stlp_sin(double __x) { return sin(__x); }
+# undef sin
+inline double sin(double __x) { return __stlp_sin(__x); }
+# endif
+# if defined (sqrt)
+inline double __stlp_sqrt(double __x) { return sqrt(__x); }
+# undef sqrt
+inline double sqrt(double __x) { return __stlp_sqrt(__x); }
+# endif
+# if defined (ldexp)
+inline double __stlp_ldexp(double __x, int __y) { return ldexp(__x, __y); }
+# undef ldexp
+inline double ldexp(double __x, int __y) { return __stlp_ldexp(__x, __y); }
+# endif
+#endif
+
+/* MSVC native lib starting with .Net 2003 has already all math functions
+ * in global namespace.
+ * HP-UX native lib has math functions in the global namespace.
+ */
+#if (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)) && \
+ (!defined (__HP_aCC) || (__HP_aCC < 30000)) && \
+ !defined (__WATCOMC__)
+inline double abs(double __x)
+{ return ::fabs(__x); }
+# if !defined (__MVS__)
+_STLP_DEF_MATH_INLINE(abs, fabs)
+# else // __MVS__ has native long double abs?
+inline float abs(float __x) { return ::fabsf(__x); }
+# endif
+
+_STLP_DEF_MATH_INLINE(acos, acos)
+_STLP_DEF_MATH_INLINE(asin, asin)
+_STLP_DEF_MATH_INLINE(atan, atan)
+_STLP_DEF_MATH_INLINE2(atan2, atan2)
+_STLP_DEF_MATH_INLINE(ceil, ceil)
+_STLP_DEF_MATH_INLINE(cos, cos)
+_STLP_DEF_MATH_INLINE(cosh, cosh)
+_STLP_DEF_MATH_INLINE(exp, exp)
+_STLP_DEF_MATH_INLINE(fabs, fabs)
+_STLP_DEF_MATH_INLINE(floor, floor)
+_STLP_DEF_MATH_INLINE2(fmod, fmod)
+_STLP_DEF_MATH_INLINE2PI(frexp, frexp)
+_STLP_DEF_MATH_INLINE2I(ldexp, ldexp)
+_STLP_DEF_MATH_INLINE(log, log)
+_STLP_DEF_MATH_INLINE(log10, log10)
+_STLP_DEF_MATH_INLINE2P(modf, modf)
+_STLP_DEF_MATH_INLINE(sin, sin)
+_STLP_DEF_MATH_INLINE(sinh, sinh)
+_STLP_DEF_MATH_INLINE(sqrt, sqrt)
+_STLP_DEF_MATH_INLINE(tan, tan)
+_STLP_DEF_MATH_INLINE(tanh, tanh)
+_STLP_DEF_MATH_INLINE2(pow, pow)
+
+# if !defined(_STLP_MSVC) /* || (_STLP_MSVC > 1300) */ || defined(_STLP_WCE) || !defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */
+# ifndef _STLP_NO_VENDOR_MATH_F
+# ifndef __sun
+inline float pow(float __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powf(__x, __STATIC_CAST(float,__y)); }
+# else
+inline float pow(float __x, int __y) { return ::__powf(__x, __STATIC_CAST(float,__y)); }
+# endif
+# else
+inline float pow(float __x, int __y) { return __STATIC_CAST(float, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(float,__y))); }
+# endif
+inline double pow(double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(double,__y)); }
+# if !defined (_STLP_NO_LONG_DOUBLE)
+# if !defined(_STLP_NO_VENDOR_MATH_L)
+# ifndef __sun
+inline long double pow(long double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powl(__x, __STATIC_CAST(long double,__y)); }
+# else
+# ifndef __SUNPRO_CC
+inline long double pow(long double __x, int __y) { return ::__powl(__x, __STATIC_CAST(long double,__y)); }
+# else
+inline long double pow(long double __x, int __y) { return _STLP_VENDOR_CSTD::__powl(__x, __STATIC_CAST(long double,__y)); }
+# endif
+# endif
+# else
+inline long double pow(long double __x, int __y) { return __STATIC_CAST(long double, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(long double,__y))); }
+# endif
+# endif
+# else
+//The MS native pow version has a bugged overload so it is not imported
+//in the STLport namespace.
+//Here is the bugged version:
+//inline double pow(int __x, int __y) { return (_Pow_int(__x, __y)); }
+inline double pow(double __x, int __y) { return (_Pow_int(__x, __y)); }
+inline float pow(float __x, int __y) { return (_Pow_int(__x, __y)); }
+inline long double pow(long double __x, int __y) { return (_Pow_int(__x, __y)); }
+# endif
+#endif
+
+#if (defined (_STLP_MSVC) && !defined (_STLP_WCE)) || defined (__ICL) || defined (__sun)
+# if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
+# pragma warning (push)
+# pragma warning (disable : 4996) // hypot is deprecated.
+# endif
+_STLP_MATH_INLINE2XX(float, hypot, hypot)
+inline long double hypot(long double x, long double y) { return sqrt(x * x + y * y); }
+# if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400)
+# pragma warning (pop)
+# endif
+#else
+# if defined (_STLP_USE_UCLIBC)
+inline double hypot(double x, double y) { return sqrt(x * x + y * y); }
+_STLP_DEF_MATH_INLINE2(hypot, hypot)
+# elif defined (_STLP_WCE)
+ /* CE has a double _hypot(double,double) which we use */
+inline double hypot(double __x, double __y) { return _hypot(__x,__y); }
+_STLP_DEF_MATH_INLINE2(hypot, _hypot)
+# endif
+#endif
+
+#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
+//restoration of the default intrinsic status of those functions:
+# pragma intrinsic (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh)
+# if defined (_STLP_WCE)
+# pragma intrinsic (ceil, floor)
+# endif
+# pragma warning(pop)
+# undef _STLP_RESTORE_FUNCTION_INTRINSIC
+#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS
+
+/* C++ Standard is unclear about several call to 'using ::func' if new overloads
+ * of ::func appears between 2 successive 'using' calls. To avoid this potential
+ * problem we provide all abs overload before the 'using' call.
+ * Beware: This header inclusion has to be after all abs overload of this file.
+ * The first 'using ::abs' call is going to be in the other header.
+ */
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+_STLP_BEGIN_NAMESPACE
+using ::abs;
+using ::acos;
+using ::asin;
+using ::atan;
+using ::atan2;
+using ::ceil;
+using ::cos;
+using ::cosh;
+using ::exp;
+using ::fabs;
+using ::floor;
+using ::fmod;
+using ::frexp;
+/*
+ Because of some weird interaction between STLport headers
+ and native HP-UX headers, when compiled with _STLP_DEBUG
+ macro defined with aC++, hypot() is not declared.
+ At some point we'll need to get to the bottom line of
+ this problem.
+*/
+#if !(defined(__HP_aCC) && defined(_STLP_DEBUG))
+using ::hypot;
+#endif
+using ::ldexp;
+using ::log;
+using ::log10;
+using ::modf;
+using ::pow;
+using ::sin;
+using ::sinh;
+using ::sqrt;
+using ::tan;
+using ::tanh;
+_STLP_END_NAMESPACE
+# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x560) && !defined (__linux__)
+using _STLP_VENDOR_CSTD::_ecvt;
+using _STLP_VENDOR_CSTD::_fcvt;
+# endif
+#endif
+
+#endif /* _STLP_INTERNAL_CMATH */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_codecvt.h b/stlport/stl/_codecvt.h
new file mode 100644
index 0000000..29b408b
--- /dev/null
+++ b/stlport/stl/_codecvt.h
@@ -0,0 +1,442 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_CODECVT_H
+#define _STLP_INTERNAL_CODECVT_H
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+# include <stl/_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class _STLP_CLASS_DECLSPEC codecvt_base {
+public:
+ enum result {ok, partial, error, noconv};
+};
+
+template <class _InternT, class _ExternT, class _StateT>
+class codecvt : public locale::facet, public codecvt_base {
+public:
+ typedef _InternT intern_type;
+ typedef _ExternT extern_type;
+ typedef _StateT state_type;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC < 1300)
+ /* For the moment VC6 do not support this facet default implementation
+ * because of the static locale::id instance. When VC6 see this definition
+ * it goes crasy with locale::id static instances and all the has_facet tests
+ * unit tests are failing.
+ */
+};
+#else
+ explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ result out(state_type& __state,
+ const intern_type* __from,
+ const intern_type* __from_end,
+ const intern_type*& __from_next,
+ extern_type* __to,
+ extern_type* __to_limit,
+ extern_type*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_out(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ result unshift(state_type& __state,
+ extern_type* __to,
+ extern_type* __to_limit,
+ extern_type*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_unshift(__state, __to, __to_limit, __to_next);
+ }
+
+ result in(state_type& __state,
+ const extern_type* __from,
+ const extern_type* __from_end,
+ const extern_type*& __from_next,
+ intern_type* __to,
+ intern_type* __to_limit,
+ intern_type*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_in(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ int encoding() const _STLP_NOTHROW { return do_encoding(); }
+
+ bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
+
+ int length(state_type& __state,
+ const extern_type* __from,
+ const extern_type* __from_end,
+ size_t __max) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ return do_length(__state, __from, __from_end, __max);
+ }
+
+ int max_length() const _STLP_NOTHROW { return do_max_length(); }
+
+ static locale::id id;
+
+protected:
+ ~codecvt() {}
+
+ virtual result do_out(state_type&,
+ const intern_type* __from,
+ const intern_type*,
+ const intern_type*& __from_next,
+ extern_type* __to,
+ extern_type*,
+ extern_type*& __to_next) const
+ { __from_next = __from; __to_next = __to; return noconv; }
+
+ virtual result do_in (state_type&,
+ const extern_type* __from,
+ const extern_type*,
+ const extern_type*& __from_next,
+ intern_type* __to,
+ intern_type*,
+ intern_type*& __to_next) const
+ { __from_next = __from; __to_next = __to; return noconv; }
+
+ virtual result do_unshift(state_type&,
+ extern_type* __to,
+ extern_type*,
+ extern_type*& __to_next) const
+ { __to_next = __to; return noconv; }
+
+ virtual int do_encoding() const _STLP_NOTHROW
+ { return 1; }
+
+ virtual bool do_always_noconv() const _STLP_NOTHROW
+ { return true; }
+
+ virtual int do_length(state_type&,
+ const extern_type* __from,
+ const extern_type* __end,
+ size_t __max) const
+ { return (int)(min) ( __STATIC_CAST(size_t, (__end - __from)), __max); }
+
+ virtual int do_max_length() const _STLP_NOTHROW
+ { return 1; }
+
+private:
+ codecvt(const codecvt<intern_type, extern_type, state_type>&);
+ codecvt<intern_type, extern_type, state_type>& operator = (const codecvt<intern_type, extern_type, state_type>&);
+};
+
+# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x590)
+template <class _InternT, class _ExternT, class _StateT>
+locale::id codecvt<_InternT, _ExternT, _StateT>::id;
+# endif
+# endif
+#endif
+
+template <class _InternT, class _ExternT, class _StateT>
+class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> {};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC codecvt<char, char, mbstate_t>
+ : public locale::facet, public codecvt_base {
+public:
+ typedef char intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ result out(state_type& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_out(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ result unshift(state_type& __state,
+ char* __to, char* __to_limit, char*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_unshift(__state, __to, __to_limit, __to_next);
+ }
+
+ result in(state_type& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_in(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ int encoding() const _STLP_NOTHROW { return do_encoding(); }
+
+ bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
+
+ int length(state_type& __state,
+ const char* __from, const char* __from_end,
+ size_t __max) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ return do_length(__state, __from, __from_end, __max);
+ }
+
+ int max_length() const _STLP_NOTHROW { return do_max_length(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~codecvt();
+
+ virtual result do_out(state_type& /* __state */,
+ const char* __from,
+ const char* /* __from_end */,
+ const char*& __from_next,
+ char* __to,
+ char* /* __to_limit */,
+ char*& __to_next) const;
+
+ virtual result do_in (state_type& /* __state */ ,
+ const char* __from,
+ const char* /* __from_end */,
+ const char*& __from_next,
+ char* __to,
+ char* /* __to_end */,
+ char*& __to_next) const;
+
+ virtual result do_unshift(state_type& /* __state */,
+ char* __to,
+ char* /* __to_limit */,
+ char*& __to_next) const;
+
+ virtual int do_encoding() const _STLP_NOTHROW;
+ virtual bool do_always_noconv() const _STLP_NOTHROW;
+ virtual int do_length(state_type& __state,
+ const char* __from,
+ const char* __end,
+ size_t __max) const;
+ virtual int do_max_length() const _STLP_NOTHROW;
+private:
+ codecvt(const codecvt<char, char, mbstate_t>&);
+ codecvt<char, char, mbstate_t>& operator =(const codecvt<char, char, mbstate_t>&);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC codecvt<wchar_t, char, mbstate_t>
+ : public locale::facet, public codecvt_base {
+public:
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+
+ result out(state_type& __state,
+ const wchar_t* __from,
+ const wchar_t* __from_end,
+ const wchar_t*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_out(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ result unshift(state_type& __state,
+ char* __to, char* __to_limit, char*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_unshift(__state, __to, __to_limit, __to_next);
+ }
+
+ result in(state_type& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ wchar_t* __to,
+ wchar_t* __to_limit,
+ wchar_t*& __to_next) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT)
+ return do_in(__state,
+ __from, __from_end, __from_next,
+ __to, __to_limit, __to_next);
+ }
+
+ int encoding() const _STLP_NOTHROW { return do_encoding(); }
+
+ bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
+
+ int length(state_type& __state,
+ const char* __from, const char* __from_end,
+ size_t __max) const {
+ _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT)
+ return do_length(__state, __from, __from_end, __max);
+ }
+
+ int max_length() const _STLP_NOTHROW { return do_max_length(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~codecvt();
+
+ virtual result do_out(state_type& __state,
+ const wchar_t* __from,
+ const wchar_t* __from_end,
+ const wchar_t*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const;
+
+ virtual result do_in (state_type& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ wchar_t* __to,
+ wchar_t* __to_limit,
+ wchar_t*& __to_next) const;
+
+ virtual result do_unshift(state_type& __state,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const;
+
+ virtual int do_encoding() const _STLP_NOTHROW;
+
+ virtual bool do_always_noconv() const _STLP_NOTHROW;
+
+ virtual int do_length(state_type& __state,
+ const char* __from,
+ const char* __end,
+ size_t __max) const;
+
+ virtual int do_max_length() const _STLP_NOTHROW;
+
+private:
+ codecvt(const codecvt<wchar_t, char, mbstate_t>&);
+ codecvt<wchar_t, char, mbstate_t>& operator = (const codecvt<wchar_t, char, mbstate_t>&);
+};
+
+# endif
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC codecvt_byname<char, char, mbstate_t>
+ : public codecvt<char, char, mbstate_t> {
+public:
+ explicit codecvt_byname(const char* __name, size_t __refs = 0);
+ ~codecvt_byname();
+private:
+ codecvt_byname(const codecvt_byname<char, char, mbstate_t>&);
+ codecvt_byname<char, char, mbstate_t>& operator =(const codecvt_byname<char, char, mbstate_t>&);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC codecvt_byname<wchar_t, char, mbstate_t>
+ : public codecvt<wchar_t, char, mbstate_t> {
+ friend class _Locale_impl;
+public:
+ explicit codecvt_byname(const char * __name, size_t __refs = 0);
+
+protected:
+ ~codecvt_byname();
+
+ virtual result do_out(state_type& __state,
+ const wchar_t* __from,
+ const wchar_t* __from_end,
+ const wchar_t*& __from_next,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const;
+
+ virtual result do_in (state_type& __state,
+ const char* __from,
+ const char* __from_end,
+ const char*& __from_next,
+ wchar_t* __to,
+ wchar_t* __to_limit,
+ wchar_t*& __to_next) const;
+
+ virtual result do_unshift(state_type& __state,
+ char* __to,
+ char* __to_limit,
+ char*& __to_next) const;
+
+ virtual int do_encoding() const _STLP_NOTHROW;
+
+ virtual bool do_always_noconv() const _STLP_NOTHROW;
+
+ virtual int do_length(state_type& __state,
+ const char* __from,
+ const char* __end,
+ size_t __max) const;
+
+ virtual int do_max_length() const _STLP_NOTHROW;
+
+private:
+ codecvt_byname(_Locale_codecvt* __cvt)
+ : _M_codecvt(__cvt) {}
+
+ codecvt_byname(const codecvt_byname<wchar_t, char, mbstate_t>&);
+ codecvt_byname<wchar_t, char, mbstate_t>& operator =(const codecvt_byname<wchar_t, char, mbstate_t>&);
+ _Locale_codecvt* _M_codecvt;
+};
+
+# endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_CODECVT_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_collate.h b/stlport/stl/_collate.h
new file mode 100644
index 0000000..4384f2e
--- /dev/null
+++ b/stlport/stl/_collate.h
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+#ifndef _STLP_INTERNAL_COLLATE_H
+#define _STLP_INTERNAL_COLLATE_H
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+# include <stl/_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT> class collate {};
+template <class _CharT> class collate_byname {};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC collate<char> : public locale::facet {
+public:
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit collate(size_t __refs = 0) : locale::facet(__refs) {}
+
+ int compare(const char* __low1, const char* __high1,
+ const char* __low2, const char* __high2) const {
+ return do_compare( __low1, __high1, __low2, __high2);
+ }
+
+ string_type transform(const char* __low, const char* __high) const {
+ return do_transform(__low, __high);
+ }
+
+ long hash(const char* __low, const char* __high) const
+ { return do_hash(__low, __high); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~collate();
+
+ virtual int do_compare(const char*, const char*,
+ const char*, const char*) const;
+ virtual string_type do_transform(const char*, const char*) const;
+ virtual long do_hash(const char*, const char*) const;
+private:
+ collate(const collate<char>&);
+ collate<char>& operator =(const collate<char>&);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC collate<wchar_t> : public locale::facet {
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit collate(size_t __refs = 0) : locale::facet(__refs) {}
+
+ int compare(const wchar_t* __low1, const wchar_t* __high1,
+ const wchar_t* __low2, const wchar_t* __high2) const {
+ return do_compare( __low1, __high1, __low2, __high2);
+ }
+
+ string_type transform(const wchar_t* __low, const wchar_t* __high) const {
+ return do_transform(__low, __high);
+ }
+
+ long hash(const wchar_t* __low, const wchar_t* __high) const
+ { return do_hash(__low, __high); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~collate();
+
+ virtual int do_compare(const wchar_t*, const wchar_t*,
+ const wchar_t*, const wchar_t*) const;
+ virtual string_type do_transform(const wchar_t*, const wchar_t*) const;
+ virtual long do_hash(const wchar_t* __low, const wchar_t* __high) const;
+private:
+ collate(const collate<wchar_t>&);
+ collate<wchar_t>& operator = (const collate<wchar_t>&);
+};
+
+# endif /* NO_WCHAR_T */
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC collate_byname<char>: public collate<char> {
+ friend class _Locale_impl;
+public:
+ explicit collate_byname(const char* __name, size_t __refs = 0);
+
+protected:
+ ~collate_byname();
+
+ virtual int do_compare(const char*, const char*,
+ const char*, const char*) const;
+ virtual string_type do_transform(const char*, const char*) const;
+
+private:
+ collate_byname(_Locale_collate *__coll)
+ : _M_collate(__coll) {}
+ _Locale_collate* _M_collate;
+ collate_byname(const collate_byname<char>&);
+ collate_byname<char>& operator =(const collate_byname<char>&);
+};
+
+# ifndef _STLP_NO_WCHAR_T
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC collate_byname<wchar_t>: public collate<wchar_t> {
+ friend class _Locale_impl;
+public:
+ explicit collate_byname(const char * __name, size_t __refs = 0);
+
+protected:
+ ~collate_byname();
+
+ virtual int do_compare(const wchar_t*, const wchar_t*,
+ const wchar_t*, const wchar_t*) const;
+ virtual string_type do_transform(const wchar_t*, const wchar_t*) const;
+
+private:
+ collate_byname(_Locale_collate *__coll)
+ : _M_collate(__coll) {}
+ _Locale_collate* _M_collate;
+ collate_byname(const collate_byname<wchar_t>&);
+ collate_byname<wchar_t>& operator =(const collate_byname<wchar_t>&);
+};
+
+# endif /* NO_WCHAR_T */
+
+template <class _CharT, class _Traits, class _Alloc>
+bool
+__locale_do_operator_call (const locale& __loc,
+ const basic_string<_CharT, _Traits, _Alloc>& __x,
+ const basic_string<_CharT, _Traits, _Alloc>& __y) {
+ collate<_CharT> const& __coll = use_facet<collate<_CharT> >(__loc);
+ return __coll.compare(__x.data(), __x.data() + __x.size(),
+ __y.data(), __y.data() + __y.size()) < 0;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_COLLATE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_complex.c b/stlport/stl/_complex.c
new file mode 100644
index 0000000..204fa1e
--- /dev/null
+++ b/stlport/stl/_complex.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_COMPLEX_C
+#define _STLP_COMPLEX_C
+
+#ifndef _STLP_INTERNAL_COMPLEX
+# include <stl/_complex.h>
+#endif
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+# ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+# endif
+
+# ifndef _STLP_INTERNAL_SSTREAM
+# include <stl/_sstream.h>
+# endif
+
+# ifndef _STLP_STRING_IO_H
+# include <stl/_string_io.h>
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// Non-inline member functions.
+
+template <class _Tp>
+void complex<_Tp>::_div(const _Tp& __z1_r, const _Tp& __z1_i,
+ const _Tp& __z2_r, const _Tp& __z2_i,
+ _Tp& __res_r, _Tp& __res_i) {
+ _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
+ _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
+
+ if (__ar <= __ai) {
+ _Tp __ratio = __z2_r / __z2_i;
+ _Tp __denom = __z2_i * (1 + __ratio * __ratio);
+ __res_r = (__z1_r * __ratio + __z1_i) / __denom;
+ __res_i = (__z1_i * __ratio - __z1_r) / __denom;
+ }
+ else {
+ _Tp __ratio = __z2_i / __z2_r;
+ _Tp __denom = __z2_r * (1 + __ratio * __ratio);
+ __res_r = (__z1_r + __z1_i * __ratio) / __denom;
+ __res_i = (__z1_i - __z1_r * __ratio) / __denom;
+ }
+}
+
+template <class _Tp>
+void complex<_Tp>::_div(const _Tp& __z1_r,
+ const _Tp& __z2_r, const _Tp& __z2_i,
+ _Tp& __res_r, _Tp& __res_i) {
+ _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r;
+ _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i;
+
+ if (__ar <= __ai) {
+ _Tp __ratio = __z2_r / __z2_i;
+ _Tp __denom = __z2_i * (1 + __ratio * __ratio);
+ __res_r = (__z1_r * __ratio) / __denom;
+ __res_i = - __z1_r / __denom;
+ }
+ else {
+ _Tp __ratio = __z2_i / __z2_r;
+ _Tp __denom = __z2_r * (1 + __ratio * __ratio);
+ __res_r = __z1_r / __denom;
+ __res_i = - (__z1_r * __ratio) / __denom;
+ }
+}
+
+// I/O.
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+
+// Complex output, in the form (re,im). We use a two-step process
+// involving stringstream so that we get the padding right.
+template <class _Tp, class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z) {
+ basic_ostringstream<_CharT, _Traits, allocator<_CharT> > __tmp;
+ __tmp.flags(__os.flags());
+ __tmp.imbue(__os.getloc());
+ __tmp.precision(__os.precision());
+ __tmp << '(' << __z.real() << ',' << __z.imag() << ')';
+ return __os << __tmp.str();
+}
+
+// Complex input from arbitrary streams. Note that results in some
+// locales may be confusing, since the decimal character varies with
+// locale and the separator between real and imaginary parts does not.
+
+template <class _Tp, class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z) {
+ _Tp __re = 0;
+ _Tp __im = 0;
+
+ const ctype<_CharT>& __c_type = *__is._M_ctype_facet();
+
+ const char __punct[4] = "(,)";
+ _CharT __wpunct[3];
+ __c_type.widen(__punct, __punct + 3, __wpunct);
+
+ _CharT __c;
+
+ __is >> __c;
+ if (_Traits::eq(__c, __wpunct[0])) { // Left paren
+ __is >> __re >> __c;
+ if (_Traits::eq(__c, __wpunct[1])) // Comma
+ __is >> __im >> __c;
+ if (!_Traits::eq(__c, __wpunct[2])) // Right paren
+ __is.setstate(ios_base::failbit);
+ }
+ else {
+ __is.putback(__c);
+ __is >> __re;
+ }
+
+ if (__is)
+ __z = complex<_Tp>(__re, __im);
+ return __is;
+}
+
+#endif /* _STLP_USE_NO_IOSTREAMS */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_COMPLEX_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_complex.h b/stlport/stl/_complex.h
new file mode 100644
index 0000000..5dba0ad
--- /dev/null
+++ b/stlport/stl/_complex.h
@@ -0,0 +1,935 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_INTERNAL_COMPLEX
+#define _STLP_INTERNAL_COMPLEX
+
+// This header declares the template class complex, as described in
+// in the draft C++ standard. Single-precision complex numbers
+// are complex<float>, double-precision are complex<double>, and
+// quad precision are complex<long double>.
+
+// Note that the template class complex is declared within namespace
+// std, as called for by the draft C++ standard.
+
+#ifndef _STLP_INTERNAL_CMATH
+# include <stl/_cmath.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+struct complex {
+ typedef _Tp value_type;
+ typedef complex<_Tp> _Self;
+
+ // Constructors, destructor, assignment operator.
+ complex() : _M_re(0), _M_im(0) {}
+ complex(const value_type& __x)
+ : _M_re(__x), _M_im(0) {}
+ complex(const value_type& __x, const value_type& __y)
+ : _M_re(__x), _M_im(__y) {}
+ complex(const _Self& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+
+ _Self& operator=(const _Self& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ template <class _Tp2>
+ explicit complex(const complex<_Tp2>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+
+ template <class _Tp2>
+ _Self& operator=(const complex<_Tp2>& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ // Element access.
+ value_type real() const { return _M_re; }
+ value_type imag() const { return _M_im; }
+
+ // Arithmetic op= operations involving one real argument.
+
+ _Self& operator= (const value_type& __x) {
+ _M_re = __x;
+ _M_im = 0;
+ return *this;
+ }
+ _Self& operator+= (const value_type& __x) {
+ _M_re += __x;
+ return *this;
+ }
+ _Self& operator-= (const value_type& __x) {
+ _M_re -= __x;
+ return *this;
+ }
+ _Self& operator*= (const value_type& __x) {
+ _M_re *= __x;
+ _M_im *= __x;
+ return *this;
+ }
+ _Self& operator/= (const value_type& __x) {
+ _M_re /= __x;
+ _M_im /= __x;
+ return *this;
+ }
+
+ // Arithmetic op= operations involving two complex arguments.
+
+ static void _STLP_CALL _div(const value_type& __z1_r, const value_type& __z1_i,
+ const value_type& __z2_r, const value_type& __z2_i,
+ value_type& __res_r, value_type& __res_i);
+
+ static void _STLP_CALL _div(const value_type& __z1_r,
+ const value_type& __z2_r, const value_type& __z2_i,
+ value_type& __res_r, value_type& __res_i);
+
+#if defined (_STLP_MEMBER_TEMPLATES) // && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+
+ template <class _Tp2> _Self& operator+= (const complex<_Tp2>& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2> _Self& operator-= (const complex<_Tp2>& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2> _Self& operator*= (const complex<_Tp2>& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ template <class _Tp2> _Self& operator/= (const complex<_Tp2>& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator+= (const _Self& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ _Self& operator-= (const _Self& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ _Self& operator*= (const _Self& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ _Self& operator/= (const _Self& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ // Data members.
+ value_type _M_re;
+ value_type _M_im;
+};
+
+// Explicit specializations for float, double, long double. The only
+// reason for these specializations is to enable automatic conversions
+// from complex<float> to complex<double>, and complex<double> to
+// complex<long double>.
+
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC complex<float> {
+ typedef float value_type;
+ typedef complex<float> _Self;
+ // Constructors, destructor, assignment operator.
+
+ complex(value_type __x = 0.0f, value_type __y = 0.0f)
+ : _M_re(__x), _M_im(__y) {}
+
+ complex(const complex<float>& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {}
+
+ inline explicit complex(const complex<double>& __z);
+#ifndef _STLP_NO_LONG_DOUBLE
+ inline explicit complex(const complex<long double>& __z);
+#endif
+ // Element access.
+ value_type real() const { return _M_re; }
+ value_type imag() const { return _M_im; }
+
+ // Arithmetic op= operations involving one real argument.
+
+ _Self& operator= (value_type __x) {
+ _M_re = __x;
+ _M_im = 0.0f;
+ return *this;
+ }
+ _Self& operator+= (value_type __x) {
+ _M_re += __x;
+ return *this;
+ }
+ _Self& operator-= (value_type __x) {
+ _M_re -= __x;
+ return *this;
+ }
+ _Self& operator*= (value_type __x) {
+ _M_re *= __x;
+ _M_im *= __x;
+ return *this;
+ }
+ _Self& operator/= (value_type __x) {
+ _M_re /= __x;
+ _M_im /= __x;
+ return *this;
+ }
+
+ // Arithmetic op= operations involving two complex arguments.
+
+ static void _STLP_CALL _div(const float& __z1_r, const float& __z1_i,
+ const float& __z2_r, const float& __z2_i,
+ float& __res_r, float& __res_i);
+
+ static void _STLP_CALL _div(const float& __z1_r,
+ const float& __z2_r, const float& __z2_i,
+ float& __res_r, float& __res_i);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Tp2>
+ complex<float>& operator=(const complex<_Tp2>& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<float>& operator+= (const complex<_Tp2>& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<float>& operator-= (const complex<_Tp2>& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<float>& operator*= (const complex<_Tp2>& __z) {
+ float __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ float __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<float>& operator/= (const complex<_Tp2>& __z) {
+ float __r;
+ float __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ _Self& operator+= (const _Self& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ _Self& operator-= (const _Self& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ _Self& operator*= (const _Self& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ _Self& operator/= (const _Self& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ // Data members.
+ value_type _M_re;
+ value_type _M_im;
+};
+
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC complex<double> {
+ typedef double value_type;
+ typedef complex<double> _Self;
+
+ // Constructors, destructor, assignment operator.
+
+ complex(value_type __x = 0.0, value_type __y = 0.0)
+ : _M_re(__x), _M_im(__y) {}
+
+ complex(const complex<double>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+ inline complex(const complex<float>& __z);
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ explicit inline complex(const complex<long double>& __z);
+#endif
+ // Element access.
+ value_type real() const { return _M_re; }
+ value_type imag() const { return _M_im; }
+
+ // Arithmetic op= operations involving one real argument.
+
+ _Self& operator= (value_type __x) {
+ _M_re = __x;
+ _M_im = 0.0;
+ return *this;
+ }
+ _Self& operator+= (value_type __x) {
+ _M_re += __x;
+ return *this;
+ }
+ _Self& operator-= (value_type __x) {
+ _M_re -= __x;
+ return *this;
+ }
+ _Self& operator*= (value_type __x) {
+ _M_re *= __x;
+ _M_im *= __x;
+ return *this;
+ }
+ _Self& operator/= (value_type __x) {
+ _M_re /= __x;
+ _M_im /= __x;
+ return *this;
+ }
+
+ // Arithmetic op= operations involving two complex arguments.
+
+ static void _STLP_CALL _div(const double& __z1_r, const double& __z1_i,
+ const double& __z2_r, const double& __z2_i,
+ double& __res_r, double& __res_i);
+ static void _STLP_CALL _div(const double& __z1_r,
+ const double& __z2_r, const double& __z2_i,
+ double& __res_r, double& __res_i);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ template <class _Tp2>
+ complex<double>& operator=(const complex<_Tp2>& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<double>& operator+= (const complex<_Tp2>& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<double>& operator-= (const complex<_Tp2>& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<double>& operator*= (const complex<_Tp2>& __z) {
+ double __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ double __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<double>& operator/= (const complex<_Tp2>& __z) {
+ double __r;
+ double __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ _Self& operator+= (const _Self& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ _Self& operator-= (const _Self& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ _Self& operator*= (const _Self& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ _Self& operator/= (const _Self& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ // Data members.
+ value_type _M_re;
+ value_type _M_im;
+};
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC complex<long double> {
+ typedef long double value_type;
+ typedef complex<long double> _Self;
+
+ // Constructors, destructor, assignment operator.
+ complex(value_type __x = 0.0l, value_type __y = 0.0l)
+ : _M_re(__x), _M_im(__y) {}
+
+ complex(const complex<long double>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+ inline complex(const complex<float>& __z);
+ inline complex(const complex<double>& __z);
+
+ // Element access.
+ value_type real() const { return _M_re; }
+ value_type imag() const { return _M_im; }
+
+ // Arithmetic op= operations involving one real argument.
+
+ _Self& operator= (value_type __x) {
+ _M_re = __x;
+ _M_im = 0.0l;
+ return *this;
+ }
+ _Self& operator+= (value_type __x) {
+ _M_re += __x;
+ return *this;
+ }
+ _Self& operator-= (value_type __x) {
+ _M_re -= __x;
+ return *this;
+ }
+ _Self& operator*= (value_type __x) {
+ _M_re *= __x;
+ _M_im *= __x;
+ return *this;
+ }
+ _Self& operator/= (value_type __x) {
+ _M_re /= __x;
+ _M_im /= __x;
+ return *this;
+ }
+
+ // Arithmetic op= operations involving two complex arguments.
+
+ static void _STLP_CALL _div(const long double& __z1_r, const long double& __z1_i,
+ const long double& __z2_r, const long double& __z2_i,
+ long double& __res_r, long double& __res_i);
+
+ static void _STLP_CALL _div(const long double& __z1_r,
+ const long double& __z2_r, const long double& __z2_i,
+ long double& __res_r, long double& __res_i);
+
+# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+
+ template <class _Tp2>
+ complex<long double>& operator=(const complex<_Tp2>& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<long double>& operator+= (const complex<_Tp2>& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<long double>& operator-= (const complex<_Tp2>& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<long double>& operator*= (const complex<_Tp2>& __z) {
+ long double __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ long double __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ template <class _Tp2>
+ complex<long double>& operator/= (const complex<_Tp2>& __z) {
+ long double __r;
+ long double __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+# endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __z) {
+ _M_re = __z._M_re;
+ _M_im = __z._M_im;
+ return *this;
+ }
+
+ _Self& operator+= (const _Self& __z) {
+ _M_re += __z._M_re;
+ _M_im += __z._M_im;
+ return *this;
+ }
+
+ _Self& operator-= (const _Self& __z) {
+ _M_re -= __z._M_re;
+ _M_im -= __z._M_im;
+ return *this;
+ }
+
+ _Self& operator*= (const _Self& __z) {
+ value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
+ value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ _Self& operator/= (const _Self& __z) {
+ value_type __r;
+ value_type __i;
+ _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i);
+ _M_re = __r;
+ _M_im = __i;
+ return *this;
+ }
+
+ // Data members.
+ value_type _M_re;
+ value_type _M_im;
+};
+
+#endif /* _STLP_NO_LONG_DOUBLE */
+
+// Converting constructors from one of these three specialized types
+// to another.
+
+inline complex<float>::complex(const complex<double>& __z)
+ : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {}
+inline complex<double>::complex(const complex<float>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+#ifndef _STLP_NO_LONG_DOUBLE
+inline complex<float>::complex(const complex<long double>& __z)
+ : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {}
+inline complex<double>::complex(const complex<long double>& __z)
+ : _M_re((double)__z._M_re), _M_im((double)__z._M_im) {}
+inline complex<long double>::complex(const complex<float>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+inline complex<long double>::complex(const complex<double>& __z)
+ : _M_re(__z._M_re), _M_im(__z._M_im) {}
+#endif
+
+// Unary non-member arithmetic operators.
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z)
+{ return __z; }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z)
+{ return complex<_Tp>(-__z._M_re, -__z._M_im); }
+
+// Non-member arithmetic operations involving one real argument.
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z)
+{ return complex<_Tp>(__x + __z._M_re, __z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x)
+{ return complex<_Tp>(__z._M_re + __x, __z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z)
+{ return complex<_Tp>(__x - __z._M_re, -__z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x)
+{ return complex<_Tp>(__z._M_re - __x, __z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z)
+{ return complex<_Tp>(__x * __z._M_re, __x * __z._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x)
+{ return complex<_Tp>(__z._M_re * __x, __z._M_im * __x); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator/(const _Tp& __x, const complex<_Tp>& __z) {
+ complex<_Tp> __result;
+ complex<_Tp>::_div(__x,
+ __z._M_re, __z._M_im,
+ __result._M_re, __result._M_im);
+ return __result;
+}
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x)
+{ return complex<_Tp>(__z._M_re / __x, __z._M_im / __x); }
+
+// Non-member arithmetic operations involving two complex arguments
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL
+operator+(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
+{ return complex<_Tp>(__z1._M_re + __z2._M_re, __z1._M_im + __z2._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL
+operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
+{ return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im); }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL
+operator*(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
+ return complex<_Tp>(__z1._M_re * __z2._M_re - __z1._M_im * __z2._M_im,
+ __z1._M_re * __z2._M_im + __z1._M_im * __z2._M_re);
+}
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL
+operator/(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
+ complex<_Tp> __result;
+ complex<_Tp>::_div(__z1._M_re, __z1._M_im,
+ __z2._M_re, __z2._M_im,
+ __result._M_re, __result._M_im);
+ return __result;
+}
+
+// Comparison operators.
+
+template <class _Tp>
+inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
+{ return __z1._M_re == __z2._M_re && __z1._M_im == __z2._M_im; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x)
+{ return __z._M_re == __x && __z._M_im == 0; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z)
+{ return __x == __z._M_re && 0 == __z._M_im; }
+
+//04/27/04 dums: removal of this check, if it is restablish
+//please explain why the other operators are not macro guarded
+//#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+
+template <class _Tp>
+inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
+{ return __z1._M_re != __z2._M_re || __z1._M_im != __z2._M_im; }
+
+//#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
+
+template <class _Tp>
+inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x)
+{ return __z._M_re != __x || __z._M_im != 0; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z)
+{ return __x != __z._M_re || 0 != __z._M_im; }
+
+// Other basic arithmetic operations
+template <class _Tp>
+inline _Tp _STLP_CALL real(const complex<_Tp>& __z)
+{ return __z._M_re; }
+
+template <class _Tp>
+inline _Tp _STLP_CALL imag(const complex<_Tp>& __z)
+{ return __z._M_im; }
+
+template <class _Tp>
+_Tp _STLP_CALL abs(const complex<_Tp>& __z);
+
+template <class _Tp>
+_Tp _STLP_CALL arg(const complex<_Tp>& __z);
+
+template <class _Tp>
+inline _Tp _STLP_CALL norm(const complex<_Tp>& __z)
+{ return __z._M_re * __z._M_re + __z._M_im * __z._M_im; }
+
+template <class _Tp>
+inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z)
+{ return complex<_Tp>(__z._M_re, -__z._M_im); }
+
+template <class _Tp>
+complex<_Tp> _STLP_CALL polar(const _Tp& __rho)
+{ return complex<_Tp>(__rho, 0); }
+
+template <class _Tp>
+complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi);
+
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC float _STLP_CALL abs(const complex<float>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC double _STLP_CALL abs(const complex<double>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC float _STLP_CALL arg(const complex<float>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC double _STLP_CALL arg(const complex<double>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi);
+
+template <class _Tp>
+_Tp _STLP_CALL abs(const complex<_Tp>& __z)
+{ return _Tp(abs(complex<double>(double(__z.real()), double(__z.imag())))); }
+
+template <class _Tp>
+_Tp _STLP_CALL arg(const complex<_Tp>& __z)
+{ return _Tp(arg(complex<double>(double(__z.real()), double(__z.imag())))); }
+
+template <class _Tp>
+complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) {
+ complex<double> __tmp = polar(double(__rho), double(__phi));
+ return complex<_Tp>(_Tp(__tmp.real()), _Tp(__tmp.imag()));
+}
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>&);
+_STLP_TEMPLATE_NULL
+_STLP_DECLSPEC complex<long double> _STLP_CALL polar(const long double&, const long double&);
+#endif
+
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+
+_STLP_END_NAMESPACE
+
+# ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+// Complex output, in the form (re,im). We use a two-step process
+// involving stringstream so that we get the padding right.
+template <class _Tp, class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z);
+
+template <class _Tp, class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z);
+
+// Specializations for narrow characters; lets us avoid widen.
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z);
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z);
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<float>& __z);
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<double>& __z);
+
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
+operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z);
+
+_STLP_OPERATOR_TEMPLATE
+_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<long double>& __z);
+
+# endif
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T)
+
+_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
+_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
+_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
+_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
+
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
+_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
+operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
+# endif
+# endif
+#endif
+
+
+// Transcendental functions. These are defined only for float,
+// double, and long double. (Sqrt isn't transcendental, of course,
+// but it's included in this section anyway.)
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sqrt(const complex<float>&);
+
+_STLP_DECLSPEC complex<float> _STLP_CALL exp(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL log(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>&);
+
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, int);
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const float&);
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const float&, const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL pow(const complex<float>&, const complex<float>&);
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sin(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL cos(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL tan(const complex<float>&);
+
+_STLP_DECLSPEC complex<float> _STLP_CALL sinh(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL cosh(const complex<float>&);
+_STLP_DECLSPEC complex<float> _STLP_CALL tanh(const complex<float>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sqrt(const complex<double>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL exp(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL log(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, int);
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const double&);
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const double&, const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL pow(const complex<double>&, const complex<double>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sin(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL cos(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL tan(const complex<double>&);
+
+_STLP_DECLSPEC complex<double> _STLP_CALL sinh(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL cosh(const complex<double>&);
+_STLP_DECLSPEC complex<double> _STLP_CALL tanh(const complex<double>&);
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_DECLSPEC complex<long double> _STLP_CALL sqrt(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL exp(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL log(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>&);
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, int);
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&, const long double&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const long double&, const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL pow(const complex<long double>&,
+ const complex<long double>&);
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL sin(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL cos(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL tan(const complex<long double>&);
+
+_STLP_DECLSPEC complex<long double> _STLP_CALL sinh(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL cosh(const complex<long double>&);
+_STLP_DECLSPEC complex<long double> _STLP_CALL tanh(const complex<long double>&);
+#endif
+
+_STLP_END_NAMESPACE
+
+#ifndef _STLP_LINK_TIME_INSTANTIATION
+# include <stl/_complex.c>
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_config_compat_post.h b/stlport/stl/_config_compat_post.h
new file mode 100644
index 0000000..e3b4111
--- /dev/null
+++ b/stlport/stl/_config_compat_post.h
@@ -0,0 +1,51 @@
+/*========================================== */
+#if 1 /* def _STLP_3_COMPATIBILITY */
+
+# define __SGI_STL_PORT _STLPORT_VERSION
+
+# if defined (_STLP_DEBUG) && ! defined ( __STL_DEBUG )
+# define __STL_DEBUG _STLP_DEBUG
+# endif
+
+# if defined (_STLP_USE_NAMESPACES)
+# undef __STL_USE_NAMESPACES
+# define __STL_USE_NAMESPACES _STLP_USE_NAMESPACES
+# endif
+
+# if defined (_STLP_USE_EXCEPTIONS)
+# undef __STL_USE_EXCEPTIONS
+# define __STL_USE_EXCEPTIONS _STLP_USE_EXCEPTIONS
+# endif
+
+# if defined (_STLP_BEGIN_NAMESPACE) && ! defined ( __STL_BEGIN_NAMESPACE )
+# define __STL_BEGIN_NAMESPACE _STLP_BEGIN_NAMESPACE
+# define __STL_END_NAMESPACE _STLP_END_NAMESPACE
+# define __STL_VENDOR_STD _STLP_VENDOR_STD
+# define __STL_VENDOR_CSTD _STLP_VENDOR_CSTD
+# endif
+# endif
+
+/*
+# if defined (_STLP_XXX) && ! defined ( __STL_XXX )
+# define __STL_XXX _STLP_XXX
+# endif
+*/
+
+/* 5.0 -> 4.6 compatibility section */
+#if 1 /* def _STLP_46_COMPATIBILITY */
+
+/* provide a uniform way to access full functionality */
+# define __slist__ slist
+# define __map__ map
+# define __multimap__ multimap
+# define __set__ set
+# define __multiset__ multiset
+# define __list__ list
+# define __hash_map__ hash_map
+# define __hash_multimap__ hash_multimap
+# define __hash_set__ hash_set
+# define __hash_multiset__ hash_multiset
+# define __vector__ vector
+
+#endif
+
diff --git a/stlport/stl/_construct.h b/stlport/stl/_construct.h
new file mode 100644
index 0000000..9361878
--- /dev/null
+++ b/stlport/stl/_construct.h
@@ -0,0 +1,289 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+#define _STLP_INTERNAL_CONSTRUCT_H
+
+#if !defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_INTERNAL_CSTRING)
+# include <stl/_cstring.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NEW
+# include <stl/_new.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+#if !defined (_STLP_MOVE_CONSTRUCT_FWK_H) && !defined (_STLP_NO_MOVE_SEMANTIC)
+# include <stl/_move_construct_fwk.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+inline void __destroy_aux(_Tp* __pointer, const __false_type& /*_Trivial_destructor*/)
+{ __pointer->~_Tp(); }
+
+template <class _Tp>
+inline void __destroy_aux(_Tp*, const __true_type& /*_Trivial_destructor*/) {}
+
+template <class _Tp>
+inline void _Destroy(_Tp* __pointer) {
+ typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor;
+ __destroy_aux(__pointer, _Trivial_destructor());
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset(__REINTERPRET_CAST(char*, __pointer), _STLP_SHRED_BYTE, sizeof(_Tp));
+#endif
+}
+
+template <class _Tp>
+inline void _Destroy_Moved(_Tp* __pointer) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::complete _Trivial_destructor;
+ __destroy_aux(__pointer, _Trivial_destructor());
+# if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__pointer, _STLP_SHRED_BYTE, sizeof(_Tp));
+# endif
+#else
+ _Destroy(__pointer);
+#endif
+}
+
+#if defined (new)
+# define _STLP_NEW_REDEFINE new
+# undef new
+#endif
+
+template <class _T1>
+inline void _Construct_aux (_T1* __p, const __false_type&) {
+ new(__p) _T1();
+}
+
+template <class _T1>
+inline void _Construct_aux (_T1* __p, const __true_type&) {
+#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG)
+ *__p = _T1(0);
+#else
+ // We use binary copying for POD types since it results
+ // in a considerably better code at least on MSVC.
+ *__p = _T1();
+#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */
+}
+
+template <class _T1>
+inline void _Construct(_T1* __p) {
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
+#endif
+#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG)
+ _Construct_aux (__p, _HasDefaultZeroValue(__p)._Answer());
+#else
+ _Construct_aux (__p, _Is_POD(__p)._Answer());
+#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */
+}
+
+template <class _Tp>
+inline void _Copy_Construct_aux(_Tp* __p, const _Tp& __val, const __false_type&) {
+ new(__p) _Tp(__val);
+}
+
+template <class _Tp>
+inline void _Copy_Construct_aux(_Tp* __p, const _Tp& __val, const __true_type&) {
+ // We use binary copying for POD types since it results
+ // in a considerably better code at least on MSVC.
+ *__p = __val;
+}
+
+template <class _Tp>
+inline void _Copy_Construct(_Tp* __p, const _Tp& __val) {
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_Tp));
+#endif
+ _Copy_Construct_aux(__p, __val, _Is_POD(__p)._Answer());
+}
+
+template <class _T1, class _T2>
+inline void _Param_Construct_aux(_T1* __p, const _T2& __val, const __false_type&) {
+ new(__p) _T1(__val);
+}
+
+template <class _T1, class _T2>
+inline void _Param_Construct_aux(_T1* __p, const _T2& __val, const __true_type&) {
+ // We use binary copying for POD types since it results
+ // in a considerably better code at least on MSVC.
+ *__p = _T1(__val);
+}
+
+template <class _T1, class _T2>
+inline void _Param_Construct(_T1* __p, const _T2& __val) {
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
+#endif
+ _Param_Construct_aux(__p, __val, _Is_POD(__p)._Answer());
+}
+
+template <class _T1, class _T2>
+inline void _Move_Construct_Aux(_T1* __p, _T2& __val, const __false_type& /*_IsPOD*/) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ new(__p) _T1(_STLP_PRIV _AsMoveSource(__val));
+#else
+ _Param_Construct(__p, __val);
+#endif
+}
+
+template <class _T1, class _T2>
+inline void _Move_Construct_Aux(_T1* __p, _T2& __val, const __true_type& /*_IsPOD*/) {
+ // We use binary copying for POD types since it results
+ // in a considerably better code at least on MSVC.
+ *__p = _T1(__val);
+}
+
+template <class _T1, class _T2>
+inline void _Move_Construct(_T1* __p, _T2& __val) {
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
+#endif
+ _Move_Construct_Aux(__p, __val, _Is_POD(__p)._Answer());
+}
+
+#if defined(_STLP_NEW_REDEFINE)
+# if defined (DEBUG_NEW)
+# define new DEBUG_NEW
+# endif
+# undef _STLP_NEW_REDEFINE
+#endif
+
+template <class _ForwardIterator, class _Tp>
+_STLP_INLINE_LOOP void
+__destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp*, const __false_type& /*_Trivial_destructor*/) {
+ for ( ; __first != __last; ++__first) {
+ __destroy_aux(&(*__first), __false_type());
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+ memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp));
+#endif
+ }
+}
+
+template <class _ForwardIterator, class _Tp>
+#if defined (_STLP_DEBUG_UNINITIALIZED)
+_STLP_INLINE_LOOP void
+__destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp*, const __true_type& /*_Trivial_destructor*/) {
+ for ( ; __first != __last; ++__first)
+ memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp));
+}
+#else
+inline void
+__destroy_range_aux(_ForwardIterator, _ForwardIterator, _Tp*, const __true_type& /*_Trivial_destructor*/) {}
+#endif
+
+template <class _ForwardIterator, class _Tp>
+inline void
+__destroy_range(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr) {
+ typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor;
+ __destroy_range_aux(__first, __last, __ptr, _Trivial_destructor());
+}
+
+template <class _ForwardIterator>
+inline void _Destroy_Range(_ForwardIterator __first, _ForwardIterator __last) {
+ __destroy_range(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator));
+}
+
+inline void _Destroy_Range(char*, char*) {}
+#if defined (_STLP_HAS_WCHAR_T) // dwa 8/15/97
+inline void _Destroy_Range(wchar_t*, wchar_t*) {}
+inline void _Destroy_Range(const wchar_t*, const wchar_t*) {}
+#endif
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _ForwardIterator, class _Tp>
+inline void
+__destroy_mv_srcs(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr) {
+ typedef typename __move_traits<_Tp>::complete _CompleteMove;
+ __destroy_range_aux(__first, __last, __ptr, _CompleteMove());
+}
+#endif
+
+template <class _ForwardIterator>
+inline void _Destroy_Moved_Range(_ForwardIterator __first, _ForwardIterator __last)
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+{ __destroy_mv_srcs(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator)); }
+#else
+{ _Destroy_Range(__first, __last); }
+#endif
+
+#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG)
+// Those adaptors are here to fix common compiler bug regarding builtins:
+// expressions like int k = int() should initialize k to 0
+template <class _Tp>
+inline _Tp __default_constructed_aux(_Tp*, const __false_type&) {
+ return _Tp();
+}
+template <class _Tp>
+inline _Tp __default_constructed_aux(_Tp*, const __true_type&) {
+ return _Tp(0);
+}
+
+template <class _Tp>
+inline _Tp __default_constructed(_Tp* __p) {
+ return __default_constructed_aux(__p, _HasDefaultZeroValue(__p)._Answer());
+}
+
+# define _STLP_DEFAULT_CONSTRUCTED(_TTp) __default_constructed((_TTp*)0)
+#else
+# define _STLP_DEFAULT_CONSTRUCTED(_TTp) _TTp()
+#endif /* _STLP_DEF_CONST_DEF_PARAM_BUG */
+
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+// --------------------------------------------------
+// Old names from the HP STL.
+
+template <class _T1, class _T2>
+inline void construct(_T1* __p, const _T2& __val) {_Param_Construct(__p, __val); }
+template <class _T1>
+inline void construct(_T1* __p) { _STLP_STD::_Construct(__p); }
+template <class _Tp>
+inline void destroy(_Tp* __pointer) { _STLP_STD::_Destroy(__pointer); }
+template <class _ForwardIterator>
+inline void destroy(_ForwardIterator __first, _ForwardIterator __last) { _STLP_STD::_Destroy_Range(__first, __last); }
+#endif /* _STLP_NO_ANACHRONISMS */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_CONSTRUCT_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_prolog.h b/stlport/stl/_cprolog.h
similarity index 100%
rename from stl/_prolog.h
rename to stlport/stl/_cprolog.h
diff --git a/stlport/stl/_csetjmp.h b/stlport/stl/_csetjmp.h
new file mode 100644
index 0000000..ca132c1
--- /dev/null
+++ b/stlport/stl/_csetjmp.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CSETJMP
+#define _STLP_INTERNAL_CSETJMP
+
+// if the macro is on, the header is already there
+#if !defined (setjmp)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <csetjmp>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(csetjmp)
+# endif
+# else
+# include <setjmp.h>
+# endif
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_CSTD)
+
+# if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
+/* For Borland, even if stdjmp.h is included symbols won't be in global namespace
+ * so we need to reach them in vendor namespace:
+ */
+# undef _STLP_NATIVE_SETJMP_H_INCLUDED
+# endif
+
+_STLP_BEGIN_NAMESPACE
+# if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
+using _STLP_VENDOR_CSTD::jmp_buf;
+# else
+// if setjmp.h was included first, this is in global namespace, not in
+// vendor's std. - 2005-08-04, ptr
+using ::jmp_buf;
+# endif
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+# if !defined (setjmp)
+# if !defined (__MSL__) || ((__MSL__ > 0x7001) && (__MSL__ < 0x8000))
+# ifndef _STLP_NATIVE_SETJMP_H_INCLUDED
+using _STLP_VENDOR_CSTD::setjmp;
+# else
+using ::setjmp;
+# endif
+# endif
+# endif
+# if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
+using _STLP_VENDOR_CSTD::longjmp;
+# else
+using ::longjmp;
+# endif
+# endif
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif
diff --git a/stlport/stl/_csignal.h b/stlport/stl/_csignal.h
new file mode 100644
index 0000000..551846b
--- /dev/null
+++ b/stlport/stl/_csignal.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CSIGNAL
+#define _STLP_INTERNAL_CSIGNAL
+
+#if !defined (_STLP_WCE)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <csignal>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(csignal)
+# endif
+# else
+# include <signal.h>
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+_STLP_BEGIN_NAMESPACE
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::signal;
+using _STLP_VENDOR_CSTD::raise;
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+using _STLP_VENDOR_CSTD::sig_atomic_t;
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+#endif
+
+#endif /* _STLP_INTERNAL_CSIGNAL */
diff --git a/stlport/stl/_cstdarg.h b/stlport/stl/_cstdarg.h
new file mode 100644
index 0000000..e98f31c
--- /dev/null
+++ b/stlport/stl/_cstdarg.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#ifndef _STLP_INTERNAL_CSTDARG
+#define _STLP_INTERNAL_CSTDARG
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdarg>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdarg)
+# endif
+#else
+# include <stdarg.h>
+#endif
+
+#ifdef _STLP_IMPORT_VENDOR_CSTD
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::va_list;
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif
diff --git a/stlport/stl/_cstddef.h b/stlport/stl/_cstddef.h
new file mode 100644
index 0000000..35a585c
--- /dev/null
+++ b/stlport/stl/_cstddef.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+#define _STLP_INTERNAL_CSTDDEF
+
+# if (__GNUC__ >= 3) && defined (__CYGWIN__) // this total HACK is the only expedient way I could cygwin to work with GCC 3.0
+# define __need_wint_t // mostly because wint_t didn't seem to get defined otherwise :(
+# define __need_wchar_t
+# define __need_size_t
+# define __need_ptrdiff_t
+# define __need_NULL
+# endif
+
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstddef>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
+# endif
+# else
+# include <stddef.h>
+# endif
+
+# ifdef _STLP_IMPORT_VENDOR_CSTD
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::ptrdiff_t;
+using _STLP_VENDOR_CSTD::size_t;
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif /* _STLP_INTERNAL_CSTDDEF */
diff --git a/stlport/stl/_cstdio.h b/stlport/stl/_cstdio.h
new file mode 100644
index 0000000..67236f2
--- /dev/null
+++ b/stlport/stl/_cstdio.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CSTDIO
+#define _STLP_INTERNAL_CSTDIO
+
+#if defined (__Lynx__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stdarg.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stdarg.h)
+# endif
+#endif
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdio>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdio)
+# endif
+#else
+# include <stdio.h>
+#endif
+
+#if defined (__MWERKS__)
+# undef stdin
+# undef stdout
+# undef stderr
+# define stdin (&_STLP_VENDOR_CSTD::__files[0])
+# define stdout (&_STLP_VENDOR_CSTD::__files[1])
+# define stderr (&_STLP_VENDOR_CSTD::__files[2])
+#endif
+
+#if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER)
+inline int vsnprintf(char *s1, size_t n, const char *s2, va_list v)
+{ return _STLP_VENDOR_CSTD::_vsnprintf(s1, n, s2, v); }
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_CSTD )
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::FILE;
+using _STLP_VENDOR_CSTD::fpos_t;
+using _STLP_VENDOR_CSTD::size_t;
+
+// undef obsolete macros
+# undef putc
+# undef getc
+# undef getchar
+# undef putchar
+# undef feof
+# undef ferror
+
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::clearerr;
+using _STLP_VENDOR_CSTD::fclose;
+using _STLP_VENDOR_CSTD::feof;
+using _STLP_VENDOR_CSTD::ferror;
+using _STLP_VENDOR_CSTD::fflush;
+using _STLP_VENDOR_CSTD::fgetc;
+using _STLP_VENDOR_CSTD::fgetpos;
+using _STLP_VENDOR_CSTD::fgets;
+using _STLP_VENDOR_CSTD::fopen;
+using _STLP_VENDOR_CSTD::fprintf;
+using _STLP_VENDOR_CSTD::fputc;
+using _STLP_VENDOR_CSTD::fputs;
+using _STLP_VENDOR_CSTD::fread;
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 400)
+using _STLP_VENDOR_CSTD::freopen;
+# endif
+using _STLP_VENDOR_CSTD::fscanf;
+using _STLP_VENDOR_CSTD::fseek;
+using _STLP_VENDOR_CSTD::fsetpos;
+using _STLP_VENDOR_CSTD::ftell;
+using _STLP_VENDOR_CSTD::fwrite;
+
+# if !(defined (__IBMCPP__) && (__IBMCPP__ >= 500))
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 400) // Supplied as macros, TODO: use inline function to redirect to the macros?
+ using _STLP_VENDOR_CSTD::getc;
+ using _STLP_VENDOR_CSTD::putc;
+# endif
+ using _STLP_VENDOR_CSTD::getchar;
+ using _STLP_VENDOR_CSTD::putchar;
+# endif
+
+using _STLP_VENDOR_CSTD::gets;
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 400)
+using _STLP_VENDOR_CSTD::perror;
+# endif
+using _STLP_VENDOR_CSTD::printf;
+using _STLP_VENDOR_CSTD::puts;
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 400)
+using _STLP_VENDOR_CSTD::remove;
+using _STLP_VENDOR_CSTD::rename;
+using _STLP_VENDOR_CSTD::rewind;
+using _STLP_VENDOR_CSTD::setbuf;
+using _STLP_VENDOR_CSTD::tmpfile;
+using _STLP_VENDOR_CSTD::tmpnam;
+# endif
+using _STLP_VENDOR_CSTD::scanf;
+using _STLP_VENDOR_CSTD::setvbuf;
+using _STLP_VENDOR_CSTD::sprintf;
+using _STLP_VENDOR_CSTD::sscanf;
+using _STLP_VENDOR_CSTD::ungetc;
+using _STLP_VENDOR_CSTD::vfprintf;
+using _STLP_VENDOR_CSTD::vprintf;
+using _STLP_VENDOR_CSTD::vsprintf;
+# if (defined (__MWERKS__) || (defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400)) || \
+ (defined (__BORLANDC__)))
+using _STLP_VENDOR_CSTD::vsnprintf;
+# endif
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif /* _STLP_INTERNAL_CSTDIO */
diff --git a/stlport/stl/_cstdlib.h b/stlport/stl/_cstdlib.h
new file mode 100644
index 0000000..4d1dd35
--- /dev/null
+++ b/stlport/stl/_cstdlib.h
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+#define _STLP_INTERNAL_CSTDLIB
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstdlib>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
+# endif
+#else
+# include <stdlib.h>
+#endif
+
+#if defined (__BORLANDC__) && !defined (__linux__)
+/* Borland process.h header do not bring anything here and is just included
+ * in order to avoid inclusion later. This header cannot be included later
+ * because Borland compiler consider that for instance the abort function
+ * defined as extern "C" cannot be overloaded and it finds 2 "overloads",
+ * once in native std namespace and the other in STLport namespace...
+ */
+# include <process.h>
+#endif
+
+/* on evc3/evc4 including stdlib.h also defines setjmp macro */
+#if defined (_STLP_WCE)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+#endif
+
+#if defined (__MSL__) && (__MSL__ <= 0x5003)
+namespace std {
+ typedef ::div_t div_t;
+ typedef ::ldiv_t ldiv_t;
+# ifdef __MSL_LONGLONG_SUPPORT__
+ typedef ::lldiv_t lldiv_t;
+# endif
+}
+#endif
+
+#ifdef _STLP_IMPORT_VENDOR_CSTD
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::div_t;
+using _STLP_VENDOR_CSTD::ldiv_t;
+using _STLP_VENDOR_CSTD::size_t;
+
+# ifndef _STLP_NO_CSTD_FUNCTION_IMPORTS
+# ifndef _STLP_WCE
+// these functions just don't exist on Windows CE
+using _STLP_VENDOR_CSTD::abort;
+using _STLP_VENDOR_CSTD::getenv;
+using _STLP_VENDOR_CSTD::mblen;
+using _STLP_VENDOR_CSTD::mbtowc;
+using _STLP_VENDOR_CSTD::system;
+using _STLP_VENDOR_CSTD::bsearch;
+# endif
+using _STLP_VENDOR_CSTD::atexit;
+using _STLP_VENDOR_CSTD::exit;
+using _STLP_VENDOR_CSTD::calloc;
+using _STLP_VENDOR_CSTD::free;
+using _STLP_VENDOR_CSTD::malloc;
+using _STLP_VENDOR_CSTD::realloc;
+using _STLP_VENDOR_CSTD::atof;
+using _STLP_VENDOR_CSTD::atoi;
+using _STLP_VENDOR_CSTD::atol;
+using _STLP_VENDOR_CSTD::mbstowcs;
+using _STLP_VENDOR_CSTD::strtod;
+using _STLP_VENDOR_CSTD::strtol;
+using _STLP_VENDOR_CSTD::strtoul;
+
+# if !(defined (_STLP_NO_NATIVE_WIDE_STREAMS) || defined (_STLP_NO_NATIVE_MBSTATE_T))
+using _STLP_VENDOR_CSTD::wcstombs;
+# ifndef _STLP_WCE
+using _STLP_VENDOR_CSTD::wctomb;
+# endif
+# endif
+using _STLP_VENDOR_CSTD::qsort;
+using _STLP_VENDOR_CSTD::labs;
+using _STLP_VENDOR_CSTD::ldiv;
+# if defined (_STLP_LONG_LONG) && !defined (_STLP_NO_VENDOR_STDLIB_L)
+# if !defined(__sun)
+using _STLP_VENDOR_CSTD::llabs;
+using _STLP_VENDOR_CSTD::lldiv_t;
+using _STLP_VENDOR_CSTD::lldiv;
+# else
+using ::llabs;
+using ::lldiv_t;
+using ::lldiv;
+# endif
+# endif
+using _STLP_VENDOR_CSTD::rand;
+using _STLP_VENDOR_CSTD::srand;
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#if (defined (__BORLANDC__) || defined (__WATCOMC__)) && defined (_STLP_USE_NEW_C_HEADERS)
+//In this config bcc define everything in std namespace and not in
+//the global one.
+inline int abs(int __x) { return _STLP_VENDOR_CSTD::abs(__x); }
+inline _STLP_VENDOR_CSTD::div_t div(int __x, int __y) { return _STLP_VENDOR_CSTD::div(__x, __y); }
+#endif
+
+#if defined(_MSC_EXTENSIONS) && defined(_STLP_MSVC) && (_STLP_MSVC <= 1300)
+# define _STLP_RESTORE_FUNCTION_INTRINSIC
+# pragma warning (push)
+# pragma warning (disable: 4162)
+# pragma function (abs)
+#endif
+
+//HP-UX native lib has abs() and div() functions in global namespace
+#if !defined (__SUNPRO_CC) && \
+ (!defined (__HP_aCC) || (__HP_aCC < 30000))
+
+//MSVC starting with .Net 2003 already define all math functions in global namespace:
+# if !defined (__WATCOMC__) && \
+ (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined (UNDER_CE))
+inline long abs(long __x) { return _STLP_VENDOR_CSTD::labs(__x); }
+# endif
+
+/** VC since version 8 has this, the platform SDK and CE SDKs hanging behind. */
+# if !defined (__WATCOMC__) && \
+ (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER) || defined (UNDER_CE))
+inline _STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y) { return _STLP_VENDOR_CSTD::ldiv(__x, __y); }
+# endif
+
+#endif
+
+#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
+# pragma intrinsic (abs)
+# pragma warning (pop)
+# undef _STLP_RESTORE_FUNCTION_INTRINSIC
+#endif
+
+#if defined (_STLP_LONG_LONG)
+# if !defined (_STLP_NO_VENDOR_STDLIB_L)
+# if !defined (__sun)
+inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return _STLP_VENDOR_CSTD::llabs(__x); }
+inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return _STLP_VENDOR_CSTD::lldiv(__x, __y); }
+# else
+inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return ::llabs(__x); }
+inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return ::lldiv(__x, __y); }
+# endif
+# else
+inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; }
+# endif
+#endif
+
+/* C++ Standard is unclear about several call to 'using ::func' if new overloads
+ * of ::func appears between 2 successive 'using' calls. To avoid this potential
+ * problem we provide all abs overload before the 'using' call.
+ * Beware: This header inclusion has to be after all abs overload of this file.
+ * The first 'using ::abs' call is going to be in the other header.
+ */
+#ifndef _STLP_INTERNAL_CMATH
+# include <stl/_cmath.h>
+#endif
+
+#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+// ad hoc, don't replace with _STLP_VENDOR_CSTD::abs here! - ptr 2005-03-05
+_STLP_BEGIN_NAMESPACE
+using ::abs;
+using ::div;
+_STLP_END_NAMESPACE
+#endif
+
+#endif /* _STLP_INTERNAL_CSTDLIB */
diff --git a/stlport/stl/_cstring.h b/stlport/stl/_cstring.h
new file mode 100644
index 0000000..fe0fd5f
--- /dev/null
+++ b/stlport/stl/_cstring.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CSTRING
+#define _STLP_INTERNAL_CSTRING
+
+#if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstring>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstring)
+# endif
+#else
+# include <string.h>
+#endif
+
+#ifdef _STLP_IMPORT_VENDOR_CSTD
+_STLP_BEGIN_NAMESPACE
+# include <using/cstring>
+_STLP_END_NAMESPACE
+#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif /* _STLP_INTERNAL_CSTRING */
diff --git a/stlport/stl/_ctime.h b/stlport/stl/_ctime.h
new file mode 100644
index 0000000..56e433b
--- /dev/null
+++ b/stlport/stl/_ctime.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CTIME
+#define _STLP_INTERNAL_CTIME
+
+#if !defined (_STLP_WCE_EVC3)
+
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <ctime>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(ctime)
+# endif
+# else
+# include <time.h>
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD::size_t;
+using _STLP_VENDOR_CSTD::clock_t;
+using _STLP_VENDOR_CSTD::time_t;
+using _STLP_VENDOR_CSTD::tm;
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::clock;
+using _STLP_VENDOR_CSTD::asctime;
+using _STLP_VENDOR_CSTD::ctime;
+using _STLP_VENDOR_CSTD::gmtime;
+
+# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this
+using _STLP_VENDOR_CSTD::difftime;
+# endif
+using _STLP_VENDOR_CSTD::mktime;
+using _STLP_VENDOR_CSTD::localtime;
+using _STLP_VENDOR_CSTD::strftime;
+using _STLP_VENDOR_CSTD::time;
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#endif
+
+#endif /* _STLP_INTERNAL_CTIME */
diff --git a/stl/_ctraits_fns.h b/stlport/stl/_ctraits_fns.h
similarity index 100%
rename from stl/_ctraits_fns.h
rename to stlport/stl/_ctraits_fns.h
diff --git a/stlport/stl/_ctype.h b/stlport/stl/_ctype.h
new file mode 100644
index 0000000..33a5d3c
--- /dev/null
+++ b/stlport/stl/_ctype.h
@@ -0,0 +1,280 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+#define _STLP_INTERNAL_CTYPE_H
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+# include <stl/_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class _STLP_CLASS_DECLSPEC ctype_base {
+public:
+ enum mask {
+ space = _Locale_SPACE,
+ print = _Locale_PRINT,
+ cntrl = _Locale_CNTRL,
+ upper = _Locale_UPPER,
+ lower = _Locale_LOWER,
+ alpha = _Locale_ALPHA,
+ digit = _Locale_DIGIT,
+ punct = _Locale_PUNCT,
+ xdigit = _Locale_XDIGIT,
+ alnum = alpha | digit,
+ graph = alnum | punct
+ };
+};
+
+// ctype<> template
+
+template <class charT> class ctype {};
+template <class charT> class ctype_byname {};
+
+//ctype specializations
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC ctype<char> : public locale::facet, public ctype_base {
+#ifndef _STLP_NO_WCHAR_T
+# ifdef _STLP_MSVC
+ typedef ctype<wchar_t> _Wctype;
+ friend _Wctype;
+# else
+ friend class ctype<wchar_t>;
+# endif
+#endif
+public:
+
+ typedef char char_type;
+
+ explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0);
+ bool is(mask __m, char __c) const
+ { return ((*(_M_ctype_table+(unsigned char)__c)) & __m) != 0; }
+
+ const char* is(const char* __low, const char* __high, mask* __vec) const {
+ for (const char* __p = __low;__p != __high; ++__p, ++__vec) {
+ *__vec = _M_ctype_table[(unsigned char)*__p];
+ }
+ return __high;
+ }
+
+ const char* scan_is(mask __m, const char* __low, const char* __high) const;
+ const char* scan_not(mask __m, const char* __low, const char* __high) const;
+
+ char (toupper)(char __c) const { return do_toupper(__c); }
+ const char* (toupper)(char* __low, const char* __high) const {
+ return do_toupper(__low, __high);
+ }
+
+ char (tolower)(char __c) const { return do_tolower(__c); }
+ const char* (tolower)(char* __low, const char* __high) const {
+ return do_tolower(__low, __high);
+ }
+
+ char widen(char __c) const { return do_widen(__c); }
+ const char* widen(const char* __low, const char* __high, char* __to) const {
+ return do_widen(__low, __high, __to);
+ }
+
+ char narrow(char __c, char __dfault) const {
+ return do_narrow(__c, __dfault);
+ }
+ const char* narrow(const char* __low, const char* __high,
+ char __dfault, char* __to) const {
+ return do_narrow(__low, __high, __dfault, __to);
+ }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+ _STLP_STATIC_CONSTANT(size_t, table_size = 256);
+
+protected:
+ const mask* table() const _STLP_NOTHROW { return _M_ctype_table; }
+ static const mask* _STLP_CALL classic_table() _STLP_NOTHROW;
+
+ ~ctype();
+
+ virtual char do_toupper(char __c) const;
+ virtual char do_tolower(char __c) const;
+ virtual const char* do_toupper(char* __low, const char* __high) const;
+ virtual const char* do_tolower(char* __low, const char* __high) const;
+ virtual char do_widen(char __c) const;
+ virtual const char* do_widen(const char* __low, const char* __high,
+ char* __to) const;
+ virtual char do_narrow(char __c, char /* dfault */ ) const;
+ virtual const char* do_narrow(const char* __low, const char* __high,
+ char /* dfault */, char* __to) const;
+private:
+ struct _Is_mask {
+ mask __m;
+ _Is_mask(mask __x): __m(__x) {}
+ bool operator()(char __c) {return (__m & (unsigned char) __c) != 0;}
+ };
+
+protected:
+ const mask* _M_ctype_table;
+private:
+ bool _M_delete;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC ctype_byname<char>: public ctype<char> {
+ friend class _Locale_impl;
+public:
+ explicit ctype_byname(const char*, size_t = 0);
+ ~ctype_byname();
+
+ virtual char do_toupper(char __c) const;
+ virtual char do_tolower(char __c) const;
+
+ virtual const char* do_toupper(char*, const char*) const;
+ virtual const char* do_tolower(char*, const char*) const;
+
+private:
+ ctype_byname(_Locale_ctype* __ctype)
+ : _M_ctype(__ctype)
+ { _M_init(); }
+
+ void _M_init();
+
+ //explicitely defined as private to avoid warnings:
+ typedef ctype_byname<char> _Self;
+ ctype_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ mask _M_byname_table[table_size];
+ _Locale_ctype* _M_ctype;
+};
+
+# ifndef _STLP_NO_WCHAR_T
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC ctype<wchar_t> : public locale::facet, public ctype_base {
+public:
+ typedef wchar_t char_type;
+
+ explicit ctype(size_t __refs = 0) : locale::facet(__refs) {}
+
+ bool is(mask __m, wchar_t __c) const
+ { return do_is(__m, __c); }
+
+ const wchar_t* is(const wchar_t* __low, const wchar_t* __high,
+ mask* __vec) const
+ { return do_is(__low, __high, __vec); }
+
+ const wchar_t* scan_is(mask __m,
+ const wchar_t* __low, const wchar_t* __high) const
+ { return do_scan_is(__m, __low, __high); }
+
+ const wchar_t* scan_not (mask __m,
+ const wchar_t* __low, const wchar_t* __high) const
+ { return do_scan_not(__m, __low, __high); }
+
+ wchar_t (toupper)(wchar_t __c) const { return do_toupper(__c); }
+ const wchar_t* (toupper)(wchar_t* __low, const wchar_t* __high) const
+ { return do_toupper(__low, __high); }
+
+ wchar_t (tolower)(wchar_t __c) const { return do_tolower(__c); }
+ const wchar_t* (tolower)(wchar_t* __low, const wchar_t* __high) const
+ { return do_tolower(__low, __high); }
+
+ wchar_t widen(char __c) const { return do_widen(__c); }
+ const char* widen(const char* __low, const char* __high,
+ wchar_t* __to) const
+ { return do_widen(__low, __high, __to); }
+
+ char narrow(wchar_t __c, char __dfault) const
+ { return do_narrow(__c, __dfault); }
+ const wchar_t* narrow(const wchar_t* __low, const wchar_t* __high,
+ char __dfault, char* __to) const
+ { return do_narrow(__low, __high, __dfault, __to); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~ctype();
+
+ virtual bool do_is(mask __m, wchar_t __c) const;
+ virtual const wchar_t* do_is(const wchar_t*, const wchar_t*, mask*) const;
+ virtual const wchar_t* do_scan_is(mask,
+ const wchar_t*, const wchar_t*) const;
+ virtual const wchar_t* do_scan_not(mask,
+ const wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_toupper(wchar_t __c) const;
+ virtual const wchar_t* do_toupper(wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_tolower(wchar_t c) const;
+ virtual const wchar_t* do_tolower(wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_widen(char c) const;
+ virtual const char* do_widen(const char*, const char*, wchar_t*) const;
+ virtual char do_narrow(wchar_t __c, char __dfault) const;
+ virtual const wchar_t* do_narrow(const wchar_t*, const wchar_t*,
+ char, char*) const;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC ctype_byname<wchar_t>: public ctype<wchar_t> {
+ friend class _Locale_impl;
+public:
+ explicit ctype_byname(const char* __name, size_t __refs = 0);
+
+protected:
+ ~ctype_byname();
+
+ virtual bool do_is(mask __m, wchar_t __c) const;
+ virtual const wchar_t* do_is(const wchar_t*, const wchar_t*, mask*) const;
+ virtual const wchar_t* do_scan_is(mask,
+ const wchar_t*, const wchar_t*) const;
+ virtual const wchar_t* do_scan_not(mask,
+ const wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_toupper(wchar_t __c) const;
+ virtual const wchar_t* do_toupper(wchar_t*, const wchar_t*) const;
+ virtual wchar_t do_tolower(wchar_t c) const;
+ virtual const wchar_t* do_tolower(wchar_t*, const wchar_t*) const;
+
+private:
+ ctype_byname(_Locale_ctype* __ctype)
+ : _M_ctype(__ctype) {}
+
+ //explicitely defined as private to avoid warnings:
+ typedef ctype_byname<wchar_t> _Self;
+ ctype_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_ctype* _M_ctype;
+};
+
+# endif /* WCHAR_T */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_CTYPE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_cwchar.h b/stlport/stl/_cwchar.h
new file mode 100644
index 0000000..87cb82b
--- /dev/null
+++ b/stlport/stl/_cwchar.h
@@ -0,0 +1,342 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CWCHAR
+#define _STLP_INTERNAL_CWCHAR
+
+#if defined (_STLP_WCE_EVC3)
+# ifndef _STLP_INTERNAL_MBSTATE_T
+# include <stl/_mbstate_t.h>
+# endif
+#else
+# if defined (__GNUC__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cstddef>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
+# endif
+# endif
+
+# if !defined (_STLP_NO_CWCHAR) && defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cwchar>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cwchar)
+# endif
+# if defined (__OpenBSD__)
+typedef _BSD_WINT_T_ wint_t;
+# endif /* __OpenBSD__ */
+
+# if defined (__DMC__)
+# define __STDC_LIMIT_MACROS
+# include <stdint.h> // WCHAR_MIN, WCHAR_MAX
+# endif
+# elif defined (_STLP_NO_WCHAR_T) || \
+ (defined (__BORLANDC__) && (__BORLANDC__ < 0x570)) || \
+ defined (__OpenBSD__) || defined (__FreeBSD__) || \
+ (defined (__GNUC__) && (defined (__APPLE__) || defined ( __Lynx__ )))
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stddef.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+# endif
+# if defined (__Lynx__)
+# ifndef _WINT_T
+typedef long int wint_t;
+# define _WINT_T
+# endif /* _WINT_T */
+# endif
+# if defined(__OpenBSD__)
+typedef _BSD_WINT_T_ wint_t;
+# endif /* __OpenBSD__ */
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <wchar.h>
+# else
+# include _STLP_NATIVE_C_HEADER(wchar.h)
+# endif
+
+# if defined (__sun) && (defined (_XOPEN_SOURCE) || (_XOPEN_VERSION - 0 == 4))
+extern wint_t btowc();
+extern int fwprintf();
+extern int fwscanf();
+extern int fwide();
+extern int mbsinit();
+extern size_t mbrlen();
+extern size_t mbrtowc();
+extern size_t mbsrtowcs();
+extern int swprintf();
+extern int swscanf();
+extern int vfwprintf();
+extern int vwprintf();
+extern int vswprintf();
+extern size_t wcrtomb();
+extern size_t wcsrtombs();
+extern wchar_t *wcsstr();
+extern int wctob();
+extern wchar_t *wmemchr();
+extern int wmemcmp();
+extern wchar_t *wmemcpy();
+extern wchar_t *wmemmove();
+extern wchar_t *wmemset();
+extern int wprintf();
+extern int wscanf();
+# endif
+# endif
+
+# if defined (__MSL__) && (__MSL__ <= 0x51FF) /* dwa 2/28/99 - not yet implemented by MSL */
+# define _STLP_WCHAR_MSL_EXCLUDE 1
+namespace std {
+ extern "C" size_t wcsftime(wchar_t * str, size_t max_size, const wchar_t * format_str, const struct tm * timeptr);
+}
+# define _STLP_NO_NATIVE_MBSTATE_T 1
+# elif defined (__BORLANDC__)
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+# define _STLP_NO_NATIVE_MBSTATE_T
+# endif
+# define _STLP_WCHAR_BORLAND_EXCLUDE 1
+# endif
+
+# ifndef _STLP_INTERNAL_MBSTATE_T
+# include <stl/_mbstate_t.h>
+# endif
+
+# if !defined (_STLP_NO_WCHAR_T)
+# ifndef WCHAR_MIN
+# define WCHAR_MIN 0
+/* SUNpro has some bugs with casts. wchar_t is size of int there anyway. */
+# if defined (__SUNPRO_CC) || defined (__DJGPP)
+# define WCHAR_MAX (~0)
+# else
+# define WCHAR_MAX ((wchar_t)~0)
+# endif
+# endif
+# if defined (__DMC__) || (defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400)) || defined(_WIN32_WCE)
+/* Compilers that do not define WCHAR_MIN and WCHAR_MAX to be testable at
+ * preprocessing time. */
+# undef WCHAR_MIN
+# define WCHAR_MIN 0
+# undef WCHAR_MAX
+# define WCHAR_MAX 0xffff
+# endif
+# if defined (__GNUC__) && defined (__alpha__)
+/* Definition of WCHAR_MIN and MAX are wrong for alpha platform
+ * as gcc consider wchar_t as an unsigned type but WCHAR_MIN is defined as
+ * a negative value. Static assertion is here to check that a future alpha
+ * SDK or a future gcc won't change the situation making this workaround
+ * useless.
+ */
+/* Check that gcc still consider wchar_t as unsigned */
+_STLP_STATIC_ASSERT(((wchar_t)-1 > 0))
+/* Check that WCHAR_MIN value hasn't been fixed */
+_STLP_STATIC_ASSERT((WCHAR_MIN < 0))
+# undef WCHAR_MIN
+# define WCHAR_MIN 0
+# undef WCHAR_MAX
+# define WCHAR_MAX 0xffffffff
+# endif
+# if defined(__HP_aCC) && (__HP_aCC >= 60000)
+/* Starting with B.11.31, HP-UX/ia64 provides C99-compliant definitions
+ * of WCHAR_MIN/MAX macros without having to define
+ * _INCLUDE_STDC__SOURCE_199901 macro (which aCC compiler does not
+ * predefine). Let STLport provide B.11.31 definitions on any version of
+ * HP-UX/ia64.
+ */
+# undef WCHAR_MIN
+# define WCHAR_MIN 0
+# undef WCHAR_MAX
+# define WCHAR_MAX UINT_MAX
+# endif
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD)
+
+# if defined (__SUNPRO_CC) && !defined (_STLP_HAS_NO_NEW_C_HEADERS)
+using _STLP_VENDOR_CSTD::wint_t;
+# endif
+
+_STLP_BEGIN_NAMESPACE
+# if defined (_STLP_NO_WCHAR_T)
+typedef int wint_t;
+# else
+// gcc 3.0 has a glitch : wint_t only sucked into the global namespace if _GLIBCPP_USE_WCHAR_T is defined
+// __MWERKS__ has definition in wchar_t.h (MSL C++), but ones differ from definition
+// in stdio.h; I prefer settings from last file.
+# if (defined (__GNUC__) && ! defined (_GLIBCPP_USE_WCHAR_T))
+using ::wint_t;
+# else
+using _STLP_VENDOR_CSTD::wint_t;
+# endif
+# endif
+
+using _STLP_VENDOR_CSTD::size_t;
+
+# if !defined (_STLP_NO_NATIVE_MBSTATE_T) && !defined (_STLP_USE_OWN_MBSTATE_T)
+using _STLP_VENDOR_MB_NAMESPACE::mbstate_t;
+
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && \
+ (!defined(__MSL__) || __MSL__ > 0x6001)
+# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \
+ !(defined (__KCC) || defined (__GNUC__)) && !defined(_STLP_WCE_NET)
+using _STLP_VENDOR_MB_NAMESPACE::btowc;
+# if (!defined(__MSL__) || __MSL__ > 0x7001)
+using _STLP_VENDOR_MB_NAMESPACE::mbsinit;
+# endif
+# endif
+# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \
+ !defined (__GNUC__) && !defined(_STLP_WCE_NET)
+using _STLP_VENDOR_MB_NAMESPACE::mbrlen;
+using _STLP_VENDOR_MB_NAMESPACE::mbrtowc;
+using _STLP_VENDOR_MB_NAMESPACE::mbsrtowcs;
+using _STLP_VENDOR_MB_NAMESPACE::wcrtomb;
+using _STLP_VENDOR_MB_NAMESPACE::wcsrtombs;
+# endif
+# endif /* BORLAND && !__MSL__ || __MSL__ > 0x6001 */
+
+# endif /* _STLP_NO_NATIVE_MBSTATE_T */
+
+# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+
+# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+using _STLP_VENDOR_CSTD::fgetwc;
+using _STLP_VENDOR_CSTD::fgetws;
+using _STLP_VENDOR_CSTD::fputwc;
+using _STLP_VENDOR_CSTD::fputws;
+# endif
+
+# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \
+ defined(_STLP_WCHAR_HPACC_EXCLUDE) )
+# if !defined (__DECCXX)
+using _STLP_VENDOR_CSTD::fwide;
+# endif
+using _STLP_VENDOR_CSTD::fwprintf;
+using _STLP_VENDOR_CSTD::fwscanf;
+using _STLP_VENDOR_CSTD::getwchar;
+# endif
+
+# if !defined(_STLP_WCHAR_BORLAND_EXCLUDE)
+# ifndef _STLP_WCE_NET
+using _STLP_VENDOR_CSTD::getwc;
+# endif
+using _STLP_VENDOR_CSTD::ungetwc;
+# ifndef _STLP_WCE_NET
+using _STLP_VENDOR_CSTD::putwc;
+# endif
+using _STLP_VENDOR_CSTD::putwchar;
+# endif
+
+# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \
+ defined (_STLP_WCHAR_HPACC_EXCLUDE) )
+# if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB <= 1300) || \
+ defined (__MINGW32__)
+# undef swprintf
+# define swprintf _snwprintf
+# undef vswprintf
+# define vswprintf _vsnwprintf
+using ::swprintf;
+using ::vswprintf;
+# else
+using _STLP_VENDOR_CSTD::swprintf;
+using _STLP_VENDOR_CSTD::vswprintf;
+# endif
+using _STLP_VENDOR_CSTD::swscanf;
+using _STLP_VENDOR_CSTD::vfwprintf;
+using _STLP_VENDOR_CSTD::vwprintf;
+
+# if (!defined(__MSL__) || __MSL__ > 0x7001 ) && !defined(_STLP_WCE_NET) && \
+ !defined(_STLP_USE_UCLIBC) /* at least in uClibc 0.9.26 */
+
+using _STLP_VENDOR_CSTD::wcsftime;
+# endif
+using _STLP_VENDOR_CSTD::wcstok;
+
+# endif
+
+# if !defined (_STLP_WCE_NET)
+using _STLP_VENDOR_CSTD::wcscoll;
+using _STLP_VENDOR_CSTD::wcsxfrm;
+# endif
+using _STLP_VENDOR_CSTD::wcscat;
+using _STLP_VENDOR_CSTD::wcsrchr;
+using _STLP_VENDOR_CSTD::wcscmp;
+
+using _STLP_VENDOR_CSTD::wcscpy;
+using _STLP_VENDOR_CSTD::wcscspn;
+
+using _STLP_VENDOR_CSTD::wcslen;
+using _STLP_VENDOR_CSTD::wcsncat;
+using _STLP_VENDOR_CSTD::wcsncmp;
+using _STLP_VENDOR_CSTD::wcsncpy;
+using _STLP_VENDOR_CSTD::wcspbrk;
+using _STLP_VENDOR_CSTD::wcschr;
+
+using _STLP_VENDOR_CSTD::wcsspn;
+
+# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE)
+using _STLP_VENDOR_CSTD::wcstod;
+using _STLP_VENDOR_CSTD::wcstol;
+# endif
+
+# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_HPACC_EXCLUDE) )
+using _STLP_VENDOR_CSTD::wcsstr;
+using _STLP_VENDOR_CSTD::wmemchr;
+
+# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE)
+# if !defined (_STLP_WCE_NET)
+using _STLP_VENDOR_CSTD::wctob;
+# endif
+# if !defined (__DMC__)
+using _STLP_VENDOR_CSTD::wmemcmp;
+using _STLP_VENDOR_CSTD::wmemmove;
+# endif
+using _STLP_VENDOR_CSTD::wprintf;
+using _STLP_VENDOR_CSTD::wscanf;
+# endif
+
+# if defined (__BORLANDC__) && !defined (__linux__)
+inline wchar_t* _STLP_wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n)
+{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::wmemcpy(__wdst, __wsrc, __n)); }
+inline wchar_t* _STLP_wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
+{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::memset(__wdst, __wc, __n)); }
+# undef wmemcpy
+# undef wmemset
+inline wchar_t* wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n)
+{ return _STLP_wmemcpy(__wdst, __wsrc, __n); }
+inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
+{ return _STLP_wmemset(__wdst, __wc, __n); }
+# elif defined (__DMC__)
+inline wchar_t* wmemcpy(wchar_t* __RESTRICT __wdst, const wchar_t* __RESTRICT __wsrc, size_t __n)
+{ return __STATIC_CAST(wchar_t*, memcpy(__wdst, __wsrc, __n * sizeof(wchar_t))); }
+inline wchar_t* wmemmove(wchar_t* __RESTRICT __wdst, const wchar_t * __RESTRICT __wc, size_t __n)
+{ return __STATIC_CAST(wchar_t*, memmove(__wdst, __wc, __n * sizeof(wchar_t))); }
+inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n)
+{ for (size_t i = 0; i < __n; i++) __wdst[i] = __wc; return __wdst; }
+# else
+using _STLP_VENDOR_CSTD::wmemcpy;
+using _STLP_VENDOR_CSTD::wmemset;
+# endif
+# endif
+
+# endif /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+# undef _STLP_WCHAR_SUNPRO_EXCLUDE
+# undef _STLP_WCHAR_MSL_EXCLUDE
+
+# endif /* !defined(_STLP_WCE_EVC3) */
+
+#endif /* _STLP_INTERNAL_CWCHAR */
diff --git a/stlport/stl/_cwctype.h b/stlport/stl/_cwctype.h
new file mode 100644
index 0000000..83b551f
--- /dev/null
+++ b/stlport/stl/_cwctype.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_CWCTYPE
+#define _STLP_INTERNAL_CWCTYPE
+
+#if defined (__BORLANDC__) && !defined (_STLP_INTERNAL_CCTYPE)
+# include <stl/_cctype.h>
+#endif
+
+#if !defined (_STLP_WCE_EVC3)
+# if defined (_STLP_USE_NEW_C_HEADERS)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <cwctype>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(cwctype)
+# endif
+# if defined (__MSL__)
+namespace std {
+ typedef wchar_t wctrans_t;
+ wint_t towctrans(wint_t c, wctrans_t value);
+ wctrans_t wctrans(const char *name);
+}
+using std::wctrans_t;
+using std::towctrans;
+using std::wctrans;
+# endif
+# else
+# include <wctype.h>
+# endif
+
+# if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (__hpux)
+
+# if defined (_STLP_USE_GLIBC) && !(defined (_GLIBCPP_USE_WCHAR_T) || defined (_GLIBCXX_USE_WCHAR_T)) || \
+ defined (__sun) || defined (__FreeBSD__) || \
+ defined (__CYGWIN__) || \
+ defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION < 3) || (__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION <= 0))
+//We take wide functions from global namespace:
+# define _STLP_VENDOR_CSTD_WFUNC
+# else
+# define _STLP_VENDOR_CSTD_WFUNC _STLP_VENDOR_CSTD
+# endif
+
+_STLP_BEGIN_NAMESPACE
+using _STLP_VENDOR_CSTD_WFUNC::wctype_t;
+using _STLP_VENDOR_CSTD_WFUNC::wint_t;
+# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+# if !defined (__BORLANDC__) && !defined (__MSL__)
+using _STLP_VENDOR_CSTD_WFUNC::wctrans_t;
+# if !defined (__DMC__) && (!defined(_WIN32_WCE) || (_WIN32_WCE < 400))
+using _STLP_VENDOR_CSTD_WFUNC::towctrans;
+using _STLP_VENDOR_CSTD_WFUNC::wctrans;
+using _STLP_VENDOR_CSTD_WFUNC::wctype;
+# endif
+using _STLP_VENDOR_CSTD_WFUNC::iswctype;
+# endif
+using _STLP_VENDOR_CSTD_WFUNC::iswalnum;
+using _STLP_VENDOR_CSTD_WFUNC::iswalpha;
+using _STLP_VENDOR_CSTD_WFUNC::iswcntrl;
+
+using _STLP_VENDOR_CSTD_WFUNC::iswdigit;
+using _STLP_VENDOR_CSTD_WFUNC::iswgraph;
+using _STLP_VENDOR_CSTD_WFUNC::iswlower;
+using _STLP_VENDOR_CSTD_WFUNC::iswprint;
+using _STLP_VENDOR_CSTD_WFUNC::iswpunct;
+using _STLP_VENDOR_CSTD_WFUNC::iswspace;
+using _STLP_VENDOR_CSTD_WFUNC::iswupper;
+using _STLP_VENDOR_CSTD_WFUNC::iswxdigit;
+
+using _STLP_VENDOR_CSTD_WFUNC::towlower;
+using _STLP_VENDOR_CSTD_WFUNC::towupper;
+# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
+_STLP_END_NAMESPACE
+# endif /* _STLP_IMPORT_VENDOR_CSTD */
+#endif /* _STLP_WCE_EVC3 */
+
+#endif /* _STLP_INTERNAL_CWCTYPE */
diff --git a/stlport/stl/_deque.c b/stlport/stl/_deque.c
new file mode 100644
index 0000000..74e9ef6
--- /dev/null
+++ b/stlport/stl/_deque.c
@@ -0,0 +1,823 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_DEQUE_C
+#define _STLP_DEQUE_C
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Non-inline member functions from _Deque_base.
+
+template <class _Tp, class _Alloc >
+_Deque_base<_Tp,_Alloc >::~_Deque_base() {
+ if (_M_map._M_data) {
+ _M_destroy_nodes(_M_start._M_node, this->_M_finish._M_node + 1);
+ _M_map.deallocate(_M_map._M_data, _M_map_size._M_data);
+ }
+}
+
+template <class _Tp, class _Alloc >
+void _Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t __num_elements) {
+ size_t __num_nodes = __num_elements / this->buffer_size() + 1 ;
+
+ _M_map_size._M_data = (max)((size_t) _S_initial_map_size, __num_nodes + 2);
+ _M_map._M_data = _M_map.allocate(_M_map_size._M_data);
+
+ _Tp** __nstart = _M_map._M_data + (_M_map_size._M_data - __num_nodes) / 2;
+ _Tp** __nfinish = __nstart + __num_nodes;
+
+ _STLP_TRY {
+ _M_create_nodes(__nstart, __nfinish);
+ }
+ _STLP_UNWIND((_M_map.deallocate(_M_map._M_data, _M_map_size._M_data),
+ _M_map._M_data = 0, _M_map_size._M_data = 0))
+ _M_start._M_set_node(__nstart);
+ this->_M_finish._M_set_node(__nfinish - 1);
+ _M_start._M_cur = _M_start._M_first;
+ this->_M_finish._M_cur = this->_M_finish._M_first + __num_elements % this->buffer_size();
+}
+
+template <class _Tp, class _Alloc >
+void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart,
+ _Tp** __nfinish) {
+ _Tp** __cur = __nstart;
+ _STLP_TRY {
+ for (; __cur < __nfinish; ++__cur)
+ *__cur = _M_map_size.allocate(this->buffer_size());
+ }
+ _STLP_UNWIND(_M_destroy_nodes(__nstart, __cur))
+}
+
+template <class _Tp, class _Alloc >
+void _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart,
+ _Tp** __nfinish) {
+ for (_Tp** __n = __nstart; __n < __nfinish; ++__n)
+ _M_map_size.deallocate(*__n, this->buffer_size());
+}
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define deque _STLP_PTR_IMPL_NAME(deque)
+#elif defined (_STLP_DEBUG)
+# define deque _STLP_NON_DBG_NAME(deque)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+// qualified references
+# define __iterator__ _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >
+# define const_iterator _Deque_iterator<_Tp, _Const_traits<_Tp> >
+# define iterator __iterator__
+# define size_type size_t
+# define value_type _Tp
+#else
+# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE deque<_Tp, _Alloc>::iterator
+#endif
+
+template <class _Tp, class _Alloc >
+deque<_Tp, _Alloc >&
+deque<_Tp, _Alloc >::operator= (const deque<_Tp, _Alloc >& __x) {
+ const size_type __len = size();
+ if (&__x != this) {
+ if (__len >= __x.size())
+ erase(_STLP_STD::copy(__x.begin(), __x.end(), this->_M_start), this->_M_finish);
+ else {
+ const_iterator __mid = __x.begin() + difference_type(__len);
+ _STLP_STD::copy(__x.begin(), __mid, this->_M_start);
+ insert(this->_M_finish, __mid, __x.end());
+ }
+ }
+ return *this;
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp, _Alloc >::_M_fill_insert(iterator __pos,
+ size_type __n, const value_type& __x) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ _STLP_TRY {
+ uninitialized_fill(__new_start, this->_M_start, __x);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ this->_M_start = __new_start;
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ _STLP_TRY {
+ uninitialized_fill(this->_M_finish, __new_finish, __x);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node+1, __new_finish._M_node+1))
+ this->_M_finish = __new_finish;
+ }
+ else
+ _M_fill_insert_aux(__pos, __n, __x, _Movable());
+}
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+
+template <class _Tp, class _Alloc >
+void deque<_Tp, _Alloc>::insert(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __n = __last - __first;
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ _STLP_TRY {
+ _STLP_PRIV __ucopy(__first, __last, __new_start);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ this->_M_start = __new_start;
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ _STLP_TRY {
+ _STLP_PRIV __ucopy(__first, __last, this->_M_finish);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1,
+ __new_finish._M_node + 1))
+ this->_M_finish = __new_finish;
+ }
+ else
+ _M_insert_range_aux(__pos, __first, __last, __n, _Movable());
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __n = __last - __first;
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ _STLP_TRY {
+ _STLP_PRIV __ucopy(__first, __last, __new_start);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ this->_M_start = __new_start;
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ _STLP_TRY {
+ _STLP_PRIV __ucopy(__first, __last, this->_M_finish);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1,
+ __new_finish._M_node + 1))
+ this->_M_finish = __new_finish;
+ }
+ else
+ _M_insert_range_aux(__pos, __first, __last, __n, _Movable());
+}
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __pos,
+ const __true_type& /*_Movable*/) {
+ difference_type __index = __pos - this->_M_start;
+ if (size_type(__index) < this->size() >> 1) {
+ //We move the start of the deque one position to the right
+ //starting from the rightmost element to move.
+ iterator __src = __pos, __dst = __pos;
+ _STLP_STD::_Destroy(&(*__dst));
+ if (__src != this->_M_start) {
+ for (--__src; __dst != this->_M_start; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ }
+ _M_pop_front_aux();
+ }
+ else {
+ iterator __src = __pos, __dst = __pos;
+ _STLP_STD::_Destroy(&(*__dst));
+ for (++__src; __src != this->_M_finish; ++__src, ++__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ //Duplication of the pop_back code without the destroy which has already been done:
+ if (this->_M_finish._M_cur != this->_M_finish._M_first) {
+ --this->_M_finish._M_cur;
+ }
+ else {
+ _M_pop_back_aux();
+ }
+ }
+ return this->_M_start + __index;
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __pos,
+ const __false_type& /*_Movable*/) {
+ iterator __next = __pos;
+ ++__next;
+ difference_type __index = __pos - this->_M_start;
+ if (size_type(__index) < this->size() >> 1) {
+ copy_backward(this->_M_start, __pos, __next);
+ pop_front();
+ }
+ else {
+ _STLP_STD::copy(__next, this->_M_finish, __pos);
+ pop_back();
+ }
+ return this->_M_start + __index;
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __first, iterator __last,
+ const __true_type& /*_Movable*/) {
+ difference_type __n = __last - __first;
+ difference_type __elems_before = __first - this->_M_start;
+ if (__elems_before <= difference_type(this->size() - __n) / 2) {
+ iterator __src = __first, __dst = __last;
+ if (__src != this->_M_start) {
+ for (--__src, --__dst; (__src >= this->_M_start) && (__dst >= __first); --__src, --__dst) {
+ _STLP_STD::_Destroy(&(*__dst));
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ }
+ if (__dst >= __first) {
+ //There are more elements to erase than elements to move
+ _STLP_STD::_Destroy_Range(__first, ++__dst);
+ _STLP_STD::_Destroy_Moved_Range(this->_M_start, __first);
+ }
+ else {
+ //There are more elements to move than elements to erase
+ for (; __src >= this->_M_start; --__src, --__dst) {
+ _STLP_STD::_Destroy_Moved(&(*__dst));
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ }
+ _STLP_STD::_Destroy_Moved_Range(this->_M_start, ++__dst);
+ }
+ }
+ else {
+ _STLP_STD::_Destroy_Range(this->_M_start, __last);
+ }
+ iterator __new_start = this->_M_start + __n;
+ this->_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node);
+ this->_M_start = __new_start;
+ }
+ else {
+ if (__last != this->_M_finish) {
+ iterator __src = __last, __dst = __first;
+ for (; (__src != this->_M_finish) && (__dst != __last); ++__src, ++__dst) {
+ _STLP_STD::_Destroy(&(*__dst));
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ }
+ if (__dst != __last) {
+ //There are more elements to erase than elements to move
+ _STLP_STD::_Destroy_Range(__dst, __last);
+ _STLP_STD::_Destroy_Moved_Range(__last, this->_M_finish);
+ }
+ else {
+ //There are more elements to move than elements to erase
+ for (; __src != this->_M_finish; ++__src, ++__dst) {
+ _STLP_STD::_Destroy_Moved(&(*__dst));
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ }
+ _STLP_STD::_Destroy_Moved_Range(__dst, this->_M_finish);
+ }
+ }
+ else {
+ _STLP_STD::_Destroy_Range(__first, this->_M_finish);
+ }
+ iterator __new_finish = this->_M_finish - __n;
+ this->_M_destroy_nodes(__new_finish._M_node + 1, this->_M_finish._M_node + 1);
+ this->_M_finish = __new_finish;
+ }
+ return this->_M_start + __elems_before;
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __first, iterator __last,
+ const __false_type& /*_Movable*/) {
+ difference_type __n = __last - __first;
+ difference_type __elems_before = __first - this->_M_start;
+ if (__elems_before <= difference_type(this->size() - __n) / 2) {
+ copy_backward(this->_M_start, __first, __last);
+ iterator __new_start = this->_M_start + __n;
+ _STLP_STD::_Destroy_Range(this->_M_start, __new_start);
+ this->_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node);
+ this->_M_start = __new_start;
+ }
+ else {
+ _STLP_STD::copy(__last, this->_M_finish, __first);
+ iterator __new_finish = this->_M_finish - __n;
+ _STLP_STD::_Destroy_Range(__new_finish, this->_M_finish);
+ this->_M_destroy_nodes(__new_finish._M_node + 1, this->_M_finish._M_node + 1);
+ this->_M_finish = __new_finish;
+ }
+ return this->_M_start + __elems_before;
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::clear() {
+ for (_Map_pointer __node = this->_M_start._M_node + 1;
+ __node < this->_M_finish._M_node;
+ ++__node) {
+ _STLP_STD::_Destroy_Range(*__node, *__node + this->buffer_size());
+ this->_M_map_size.deallocate(*__node, this->buffer_size());
+ }
+
+ if (this->_M_start._M_node != this->_M_finish._M_node) {
+ _STLP_STD::_Destroy_Range(this->_M_start._M_cur, this->_M_start._M_last);
+ _STLP_STD::_Destroy_Range(this->_M_finish._M_first, this->_M_finish._M_cur);
+ this->_M_map_size.deallocate(this->_M_finish._M_first, this->buffer_size());
+ }
+ else
+ _STLP_STD::_Destroy_Range(this->_M_start._M_cur, this->_M_finish._M_cur);
+
+ this->_M_finish = this->_M_start;
+}
+
+// Precondition: this->_M_start and this->_M_finish have already been initialized,
+// but none of the deque's elements have yet been constructed.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_fill_initialize(const value_type& __val,
+ const __false_type& /*_TrivialInit*/) {
+ _Map_pointer __cur = this->_M_start._M_node;
+ _STLP_TRY {
+ for (; __cur < this->_M_finish._M_node; ++__cur)
+ uninitialized_fill(*__cur, *__cur + this->buffer_size(), __val);
+ uninitialized_fill(this->_M_finish._M_first, this->_M_finish._M_cur, __val);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(this->_M_start, iterator(*__cur, __cur)))
+}
+
+
+// Called only if this->_M_finish._M_cur == this->_M_finish._M_last - 1.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_push_back_aux_v(const value_type& __t) {
+ _M_reserve_map_at_back();
+ *(this->_M_finish._M_node + 1) = this->_M_map_size.allocate(this->buffer_size());
+ _STLP_TRY {
+ _Copy_Construct(this->_M_finish._M_cur, __t);
+ this->_M_finish._M_set_node(this->_M_finish._M_node + 1);
+ this->_M_finish._M_cur = this->_M_finish._M_first;
+ }
+ _STLP_UNWIND(this->_M_map_size.deallocate(*(this->_M_finish._M_node + 1),
+ this->buffer_size()))
+}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+// Called only if this->_M_finish._M_cur == this->_M_finish._M_last - 1.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_push_back_aux() {
+ _M_reserve_map_at_back();
+ *(this->_M_finish._M_node + 1) = this->_M_map_size.allocate(this->buffer_size());
+ _STLP_TRY {
+ _STLP_STD::_Construct(this->_M_finish._M_cur);
+ this->_M_finish._M_set_node(this->_M_finish._M_node + 1);
+ this->_M_finish._M_cur = this->_M_finish._M_first;
+ }
+ _STLP_UNWIND(this->_M_map_size.deallocate(*(this->_M_finish._M_node + 1),
+ this->buffer_size()))
+}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+// Called only if this->_M_start._M_cur == this->_M_start._M_first.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_push_front_aux_v(const value_type& __t) {
+ _M_reserve_map_at_front();
+ *(this->_M_start._M_node - 1) = this->_M_map_size.allocate(this->buffer_size());
+ _STLP_TRY {
+ this->_M_start._M_set_node(this->_M_start._M_node - 1);
+ this->_M_start._M_cur = this->_M_start._M_last - 1;
+ _Copy_Construct(this->_M_start._M_cur, __t);
+ }
+ _STLP_UNWIND((++this->_M_start,
+ this->_M_map_size.deallocate(*(this->_M_start._M_node - 1), this->buffer_size())))
+}
+
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+// Called only if this->_M_start._M_cur == this->_M_start._M_first.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_push_front_aux() {
+ _M_reserve_map_at_front();
+ *(this->_M_start._M_node - 1) = this->_M_map_size.allocate(this->buffer_size());
+ _STLP_TRY {
+ this->_M_start._M_set_node(this->_M_start._M_node - 1);
+ this->_M_start._M_cur = this->_M_start._M_last - 1;
+ _STLP_STD::_Construct(this->_M_start._M_cur);
+ }
+ _STLP_UNWIND((++this->_M_start, this->_M_map_size.deallocate(*(this->_M_start._M_node - 1),
+ this->buffer_size())))
+}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+// Called only if this->_M_finish._M_cur == this->_M_finish._M_first.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_pop_back_aux() {
+ this->_M_map_size.deallocate(this->_M_finish._M_first, this->buffer_size());
+ this->_M_finish._M_set_node(this->_M_finish._M_node - 1);
+ this->_M_finish._M_cur = this->_M_finish._M_last - 1;
+}
+
+// Note that if the deque has at least one element (a precondition for this member
+// function), and if this->_M_start._M_cur == this->_M_start._M_last, then the deque
+// must have at least two nodes.
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_pop_front_aux() {
+ if (this->_M_start._M_cur != this->_M_start._M_last - 1)
+ ++this->_M_start._M_cur;
+ else {
+ this->_M_map_size.deallocate(this->_M_start._M_first, this->buffer_size());
+ this->_M_start._M_set_node(this->_M_start._M_node + 1);
+ this->_M_start._M_cur = this->_M_start._M_first;
+ }
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n,
+ const value_type& __x,
+ const __true_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = this->size();
+ value_type __x_copy = __x;
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ iterator __dst = __new_start;
+ iterator __src = this->_M_start;
+ for (; __src != __pos; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_start = __new_start;
+ uninitialized_fill(__dst, __src, __x_copy);
+ __pos = __dst;
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ const difference_type __elems_after = difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ iterator __dst = __new_finish;
+ iterator __src = this->_M_finish;
+ for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_finish = __new_finish;
+ uninitialized_fill(__pos, __pos + __n, __x_copy);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ return __pos;
+}
+
+template <class _Tp, class _Alloc >
+__iterator__ deque<_Tp,_Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n,
+ const value_type& __x,
+ const __false_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = this->size();
+ value_type __x_copy = __x;
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_start;
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ if (__elems_before >= difference_type(__n)) {
+ iterator __start_n = this->_M_start + difference_type(__n);
+ _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__start_n, __pos, __old_start);
+ _STLP_STD::fill(__pos - difference_type(__n), __pos, __x_copy);
+ __pos -= difference_type(__n);
+ }
+ else {
+ _STLP_PRIV __uninitialized_copy_fill(this->_M_start, __pos, __new_start,
+ this->_M_start, __x_copy);
+ this->_M_start = __new_start;
+ fill(__old_start, __pos, __x_copy);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_finish;
+ const difference_type __elems_after =
+ difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ if (__elems_after > difference_type(__n)) {
+ iterator __finish_n = this->_M_finish - difference_type(__n);
+ _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ copy_backward(__pos, __finish_n, __old_finish);
+ fill(__pos, __pos + difference_type(__n), __x_copy);
+ }
+ else {
+ _STLP_PRIV __uninitialized_fill_copy(this->_M_finish, __pos + difference_type(__n),
+ __x_copy, __pos, this->_M_finish);
+ this->_M_finish = __new_finish;
+ fill(__pos, __old_finish, __x_copy);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ return __pos;
+}
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
+ const value_type* __first, const value_type* __last,
+ size_type __n, const __true_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ iterator __dst = __new_start;
+ iterator __src = this->_M_start;
+ for (; __src != __pos; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_start = __new_start;
+ _STLP_PRIV __ucopy(__first, __last, __dst);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ const difference_type __elems_after = difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ iterator __dst = __new_finish;
+ iterator __src = this->_M_finish;
+ for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_finish = __new_finish;
+ _STLP_PRIV __ucopy(__first, __last, __pos);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
+ const value_type* __first, const value_type* __last,
+ size_type __n, const __false_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_start;
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ if (__elems_before >= difference_type(__n)) {
+ iterator __start_n = this->_M_start + difference_type(__n);
+ _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__start_n, __pos, __old_start);
+ _STLP_STD::copy(__first, __last, __pos - difference_type(__n));
+ }
+ else {
+ const value_type* __mid = __first + (difference_type(__n) - __elems_before);
+ _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__mid, __last, __old_start);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_finish;
+ const difference_type __elems_after =
+ difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+
+ if (__elems_after > difference_type(__n)) {
+ iterator __finish_n = this->_M_finish - difference_type(__n);
+ _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy_backward(__pos, __finish_n, __old_finish);
+ _STLP_STD::copy(__first, __last, __pos);
+ }
+ else {
+ const value_type* __mid = __first + __elems_after;
+ _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy(__first, __mid, __pos);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+ size_type __n, const __true_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elems_before <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ iterator __dst = __new_start;
+ iterator __src = this->_M_start;
+ for (; __src != __pos; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_start = __new_start;
+ _STLP_PRIV __ucopy(__first, __last, __dst);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ const difference_type __elems_after = difference_type(__length) - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ iterator __dst = __new_finish;
+ iterator __src = this->_M_finish;
+ for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_finish = __new_finish;
+ _STLP_PRIV __ucopy(__first, __last, __pos);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+ size_type __n, const __false_type& /*_Movable*/) {
+ const difference_type __elems_before = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elems_before < difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_start;
+ __pos = this->_M_start + __elems_before;
+ _STLP_TRY {
+ if (__elems_before >= difference_type(__n)) {
+ iterator __start_n = this->_M_start + __n;
+ _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__start_n, __pos, __old_start);
+ _STLP_STD::copy(__first, __last, __pos - difference_type(__n));
+ }
+ else {
+ const_iterator __mid = __first + (__n - __elems_before);
+ _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__mid, __last, __old_start);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_finish;
+ const difference_type __elems_after = __length - __elems_before;
+ __pos = this->_M_finish - __elems_after;
+ _STLP_TRY {
+ if (__elems_after > difference_type(__n)) {
+ iterator __finish_n = this->_M_finish - difference_type(__n);
+ _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy_backward(__pos, __finish_n, __old_finish);
+ _STLP_STD::copy(__first, __last, __pos);
+ }
+ else {
+ const_iterator __mid = __first + __elems_after;
+ _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy(__first, __mid, __pos);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_new_elements_at_front(size_type __new_elems) {
+ size_type __new_nodes
+ = (__new_elems + this->buffer_size() - 1) / this->buffer_size();
+ _M_reserve_map_at_front(__new_nodes);
+ size_type __i = 1;
+ _STLP_TRY {
+ for (; __i <= __new_nodes; ++__i)
+ *(this->_M_start._M_node - __i) = this->_M_map_size.allocate(this->buffer_size());
+ }
+ _STLP_UNWIND(for (size_type __j = 1; __j < __i; ++__j)
+ this->_M_map_size.deallocate(*(this->_M_start._M_node - __j), this->buffer_size()))
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_new_elements_at_back(size_type __new_elems) {
+ size_type __new_nodes
+ = (__new_elems + this->buffer_size() - 1) / this->buffer_size();
+ _M_reserve_map_at_back(__new_nodes);
+ size_type __i = 1;
+ _STLP_TRY {
+ for (; __i <= __new_nodes; ++__i)
+ *(this->_M_finish._M_node + __i) = this->_M_map_size.allocate(this->buffer_size());
+ }
+ _STLP_UNWIND(for (size_type __j = 1; __j < __i; ++__j)
+ this->_M_map_size.deallocate(*(this->_M_finish._M_node + __j), this->buffer_size()))
+}
+
+template <class _Tp, class _Alloc >
+void deque<_Tp,_Alloc>::_M_reallocate_map(size_type __nodes_to_add,
+ bool __add_at_front) {
+ size_type __old_num_nodes = this->_M_finish._M_node - this->_M_start._M_node + 1;
+ size_type __new_num_nodes = __old_num_nodes + __nodes_to_add;
+
+ _Map_pointer __new_nstart;
+ if (this->_M_map_size._M_data > 2 * __new_num_nodes) {
+ __new_nstart = this->_M_map._M_data + (this->_M_map_size._M_data - __new_num_nodes) / 2
+ + (__add_at_front ? __nodes_to_add : 0);
+ if (__new_nstart < this->_M_start._M_node)
+ _STLP_STD::copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart);
+ else
+ _STLP_STD::copy_backward(this->_M_start._M_node, this->_M_finish._M_node + 1,
+ __new_nstart + __old_num_nodes);
+ }
+ else {
+ size_type __new_map_size =
+ this->_M_map_size._M_data + (max)((size_t)this->_M_map_size._M_data, __nodes_to_add) + 2;
+
+ _Map_pointer __new_map = this->_M_map.allocate(__new_map_size);
+ __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2
+ + (__add_at_front ? __nodes_to_add : 0);
+ _STLP_STD::copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart);
+ this->_M_map.deallocate(this->_M_map._M_data, this->_M_map_size._M_data);
+
+ this->_M_map._M_data = __new_map;
+ this->_M_map_size._M_data = __new_map_size;
+ }
+
+ this->_M_start._M_set_node(__new_nstart);
+ this->_M_finish._M_set_node(__new_nstart + __old_num_nodes - 1);
+}
+
+#if defined (deque)
+# undef deque
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef __iterator__
+#undef iterator
+#undef const_iterator
+#undef size_type
+#undef value_type
+
+#endif /* _STLP_DEQUE_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_deque.h b/stlport/stl/_deque.h
new file mode 100644
index 0000000..a8faeef
--- /dev/null
+++ b/stlport/stl/_deque.h
@@ -0,0 +1,1115 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+#define _STLP_INTERNAL_DEQUE_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+#ifndef _STLP_RANGE_ERRORS_H
+# include <stl/_range_errors.h>
+#endif
+
+/* Class invariants:
+ * For any nonsingular iterator i:
+ * i.node is the address of an element in the map array. The
+ * contents of i.node is a pointer to the beginning of a node.
+ * i.first == *(i.node)
+ * i.last == i.first + node_size
+ * i.cur is a pointer in the range [i.first, i.last). NOTE:
+ * the implication of this is that i.cur is always a dereferenceable
+ * pointer, even if i is a past-the-end iterator.
+ * Start and Finish are always nonsingular iterators. NOTE: this means
+ * that an empty deque must have one node, and that a deque
+ * with N elements, where N is the buffer size, must have two nodes.
+ * For every node other than start.node and finish.node, every element
+ * in the node is an initialized object. If start.node == finish.node,
+ * then [start.cur, finish.cur) are initialized objects, and
+ * the elements outside that range are uninitialized storage. Otherwise,
+ * [start.cur, start.last) and [finish.first, finish.cur) are initialized
+ * objects, and [start.first, start.cur) and [finish.cur, finish.last)
+ * are uninitialized storage.
+ * [map, map + map_size) is a valid, non-empty range.
+ * [start.node, finish.node] is a valid range contained within
+ * [map, map + map_size).
+ * A pointer in the range [map, map + map_size) points to an allocated node
+ * if and only if the pointer is in the range [start.node, finish.node].
+ */
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+struct _Deque_iterator_base {
+
+ static size_t _S_buffer_size() {
+ const size_t blocksize = _MAX_BYTES;
+ return (sizeof(_Tp) < blocksize ? (blocksize / sizeof(_Tp)) : 1);
+ }
+
+ typedef random_access_iterator_tag iterator_category;
+
+ typedef _Tp value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ typedef value_type** _Map_pointer;
+
+ typedef _Deque_iterator_base< _Tp > _Self;
+
+ value_type* _M_cur;
+ value_type* _M_first;
+ value_type* _M_last;
+ _Map_pointer _M_node;
+
+ _Deque_iterator_base(value_type* __x, _Map_pointer __y)
+ : _M_cur(__x), _M_first(*__y),
+ _M_last(*__y + _S_buffer_size()), _M_node(__y) {}
+
+ _Deque_iterator_base() : _M_cur(0), _M_first(0), _M_last(0), _M_node(0) {}
+
+// see comment in doc/README.evc4 and doc/README.evc8
+#if defined (_STLP_MSVC) && (_STLP_MSVC <= 1401) && defined (MIPS) && defined (NDEBUG)
+ _Deque_iterator_base(_Deque_iterator_base const& __other)
+ : _M_cur(__other._M_cur), _M_first(__other._M_first),
+ _M_last(__other._M_last), _M_node(__other._M_node) {}
+#endif
+
+ difference_type _M_subtract(const _Self& __x) const {
+ return difference_type(_S_buffer_size()) * (_M_node - __x._M_node - 1) +
+ (_M_cur - _M_first) + (__x._M_last - __x._M_cur);
+ }
+
+ void _M_increment() {
+ if (++_M_cur == _M_last) {
+ _M_set_node(_M_node + 1);
+ _M_cur = _M_first;
+ }
+ }
+
+ void _M_decrement() {
+ if (_M_cur == _M_first) {
+ _M_set_node(_M_node - 1);
+ _M_cur = _M_last;
+ }
+ --_M_cur;
+ }
+
+ void _M_advance(difference_type __n) {
+ const size_t buffersize = _S_buffer_size();
+ difference_type __offset = __n + (_M_cur - _M_first);
+ if (__offset >= 0 && __offset < difference_type(buffersize))
+ _M_cur += __n;
+ else {
+ difference_type __node_offset =
+ __offset > 0 ? __offset / buffersize
+ : -difference_type((-__offset - 1) / buffersize) - 1;
+ _M_set_node(_M_node + __node_offset);
+ _M_cur = _M_first +
+
+ (__offset - __node_offset * difference_type(buffersize));
+ }
+ }
+
+ void _M_set_node(_Map_pointer __new_node) {
+ _M_last = (_M_first = *(_M_node = __new_node)) + difference_type(_S_buffer_size());
+ }
+};
+
+
+template <class _Tp, class _Traits>
+struct _Deque_iterator : public _Deque_iterator_base< _Tp> {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef typename _Traits::reference reference;
+ typedef typename _Traits::pointer pointer;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef value_type** _Map_pointer;
+
+ typedef _Deque_iterator_base< _Tp > _Base;
+ typedef _Deque_iterator<_Tp, _Traits> _Self;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef _Deque_iterator<_Tp, _NonConstTraits> iterator;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _Deque_iterator<_Tp, _ConstTraits> const_iterator;
+
+ _Deque_iterator(value_type* __x, _Map_pointer __y) :
+ _Deque_iterator_base<value_type>(__x,__y) {}
+
+ _Deque_iterator() {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _Deque_iterator(const iterator& __x) :
+ _Deque_iterator_base<value_type>(__x) {}
+
+ reference operator*() const {
+ return *this->_M_cur;
+ }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ difference_type operator-(const const_iterator& __x) const { return this->_M_subtract(__x); }
+
+ _Self& operator++() { this->_M_increment(); return *this; }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ _Self& operator--() { this->_M_decrement(); return *this; }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ --*this;
+ return __tmp;
+ }
+
+ _Self& operator+=(difference_type __n) { this->_M_advance(__n); return *this; }
+ _Self operator+(difference_type __n) const {
+ _Self __tmp = *this;
+ return __tmp += __n;
+ }
+
+ _Self& operator-=(difference_type __n) { return *this += -__n; }
+ _Self operator-(difference_type __n) const {
+ _Self __tmp = *this;
+ return __tmp -= __n;
+ }
+
+ reference operator[](difference_type __n) const { return *(*this + __n); }
+};
+
+
+template <class _Tp, class _Traits>
+inline _Deque_iterator<_Tp, _Traits> _STLP_CALL
+operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Traits>& __x)
+{ return __x + __n; }
+
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template <class _Tp>
+inline bool _STLP_CALL
+operator==(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return __x._M_cur == __y._M_cur; }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator < (const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y) {
+ return (__x._M_node == __y._M_node) ?
+ (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node);
+}
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator!=(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return __x._M_cur != __y._M_cur; }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator>(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return __y < __x; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator>=(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return !(__x < __y); }
+
+template <class _Tp>
+inline bool _STLP_CALL operator<=(const _Deque_iterator_base<_Tp >& __x,
+ const _Deque_iterator_base<_Tp >& __y)
+{ return !(__y < __x); }
+
+#else /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _Tp, class _Traits1, class _Traits2>
+inline bool _STLP_CALL
+operator==(const _Deque_iterator<_Tp, _Traits1 >& __x,
+ const _Deque_iterator<_Tp, _Traits2 >& __y)
+{ return __x._M_cur == __y._M_cur; }
+
+template <class _Tp, class _Traits1, class _Traits2>
+inline bool _STLP_CALL
+operator < (const _Deque_iterator<_Tp, _Traits1 >& __x,
+ const _Deque_iterator<_Tp, _Traits2 >& __y) {
+ return (__x._M_node == __y._M_node) ?
+ (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node);
+}
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator!=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
+ const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
+{ return __x._M_cur != __y._M_cur; }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator>(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
+ const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
+{ return __y < __x; }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator>=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
+ const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
+{ return !(__x < __y); }
+
+template <class _Tp>
+inline bool _STLP_CALL
+operator<=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x,
+ const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y)
+{ return !(__y < __x); }
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+struct __type_traits<_STLP_PRIV _Deque_iterator<_Tp, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits> inline _Tp* _STLP_CALL
+value_type(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return (_Tp*)0; }
+template <class _Tp, class _Traits> inline random_access_iterator_tag _STLP_CALL
+iterator_category(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return random_access_iterator_tag(); }
+template <class _Tp, class _Traits> inline ptrdiff_t* _STLP_CALL
+distance_type(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return 0; }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+/* Deque base class. It has two purposes. First, its constructor
+ * and destructor allocate (but don't initialize) storage. This makes
+ * exception safety easier. Second, the base class encapsulates all of
+ * the differences between SGI-style allocators and standard-conforming
+ * allocators.
+ */
+
+template <class _Tp, class _Alloc>
+class _Deque_base {
+ typedef _Deque_base<_Tp, _Alloc> _Self;
+public:
+ typedef _Tp value_type;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _Alloc allocator_type;
+ typedef _STLP_alloc_proxy<size_t, value_type, allocator_type> _Alloc_proxy;
+
+ typedef typename _Alloc_traits<_Tp*, _Alloc>::allocator_type _Map_alloc_type;
+ typedef _STLP_alloc_proxy<value_type**, value_type*, _Map_alloc_type> _Map_alloc_proxy;
+
+ typedef _Deque_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
+ typedef _Deque_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
+
+ static size_t _STLP_CALL buffer_size() { return _Deque_iterator_base<_Tp>::_S_buffer_size(); }
+
+ _Deque_base(const allocator_type& __a, size_t __num_elements)
+ : _M_start(), _M_finish(), _M_map(_STLP_CONVERT_ALLOCATOR(__a, _Tp*), 0),
+ _M_map_size(__a, (size_t)0)
+ { _M_initialize_map(__num_elements); }
+
+ _Deque_base(const allocator_type& __a)
+ : _M_start(), _M_finish(), _M_map(_STLP_CONVERT_ALLOCATOR(__a, _Tp*), 0),
+ _M_map_size(__a, (size_t)0) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Deque_base(__move_source<_Self> src)
+ : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
+ _M_map(__move_source<_Map_alloc_proxy>(src.get()._M_map)),
+ _M_map_size(__move_source<_Alloc_proxy>(src.get()._M_map_size)) {
+ src.get()._M_map._M_data = 0;
+ src.get()._M_map_size._M_data = 0;
+ src.get()._M_finish = src.get()._M_start;
+ }
+#endif
+
+ ~_Deque_base();
+
+protected:
+ void _M_initialize_map(size_t);
+ void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish);
+ void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish);
+ enum { _S_initial_map_size = 8 };
+
+protected:
+ iterator _M_start;
+ iterator _M_finish;
+ _Map_alloc_proxy _M_map;
+ _Alloc_proxy _M_map_size;
+};
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define deque _STLP_PTR_IMPL_NAME(deque)
+#elif defined (_STLP_DEBUG)
+# define deque _STLP_NON_DBG_NAME(deque)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class deque : protected _STLP_PRIV _Deque_base<_Tp, _Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (deque)
+ , public __stlport_class<deque<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_PRIV _Deque_base<_Tp, _Alloc> _Base;
+ typedef deque<_Tp, _Alloc> _Self;
+public: // Basic types
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag _Iterator_category;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Base::allocator_type allocator_type;
+
+public: // Iterators
+ typedef typename _Base::iterator iterator;
+ typedef typename _Base::const_iterator const_iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+protected: // Internal typedefs
+ typedef pointer* _Map_pointer;
+#if defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef __false_type _Movable;
+#endif
+
+public: // Basic accessors
+ iterator begin() { return this->_M_start; }
+ iterator end() { return this->_M_finish; }
+ const_iterator begin() const { return const_iterator(this->_M_start); }
+ const_iterator end() const { return const_iterator(this->_M_finish); }
+
+ reverse_iterator rbegin() { return reverse_iterator(this->_M_finish); }
+ reverse_iterator rend() { return reverse_iterator(this->_M_start); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(this->_M_finish); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(this->_M_start); }
+
+ reference operator[](size_type __n)
+ { return this->_M_start[difference_type(__n)]; }
+ const_reference operator[](size_type __n) const
+ { return this->_M_start[difference_type(__n)]; }
+
+ void _M_range_check(size_type __n) const {
+ if (__n >= this->size())
+ __stl_throw_out_of_range("deque");
+ }
+ reference at(size_type __n)
+ { _M_range_check(__n); return (*this)[__n]; }
+ const_reference at(size_type __n) const
+ { _M_range_check(__n); return (*this)[__n]; }
+
+ reference front() { return *this->_M_start; }
+ reference back() {
+ iterator __tmp = this->_M_finish;
+ --__tmp;
+ return *__tmp;
+ }
+ const_reference front() const { return *this->_M_start; }
+ const_reference back() const {
+ const_iterator __tmp = this->_M_finish;
+ --__tmp;
+ return *__tmp;
+ }
+
+ size_type size() const { return this->_M_finish - this->_M_start; }
+ size_type max_size() const { return size_type(-1); }
+ bool empty() const { return this->_M_finish == this->_M_start; }
+ allocator_type get_allocator() const { return this->_M_map_size; }
+
+public: // Constructor, destructor.
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(const allocator_type& __a = allocator_type())
+#else
+ deque()
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), 0) {}
+ deque(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, 0) {}
+
+ deque(const _Self& __x)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__x.get_allocator(), __x.size())
+ { _STLP_PRIV __ucopy(__x.begin(), __x.end(), this->_M_start); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+private:
+ void _M_initialize(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+ typedef typename _TrivialInit<_Tp>::_Ret _TrivialInit;
+ _M_fill_initialize(__val, _TrivialInit());
+ }
+public:
+ explicit deque(size_type __n)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n)
+ { _M_initialize(__n); }
+ deque(size_type __n, const value_type& __val, const allocator_type& __a = allocator_type())
+#else
+ explicit deque(size_type __n)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n) {
+ typedef typename _TrivialInit<_Tp>::_Ret _TrivialInit;
+ _M_fill_initialize(_STLP_DEFAULT_CONSTRUCTED(_Tp), _TrivialInit());
+ }
+ deque(size_type __n, const value_type& __val)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n)
+ { _M_fill_initialize(__val, __false_type()); }
+ deque(size_type __n, const value_type& __val, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __n)
+ { _M_fill_initialize(__val, __false_type()); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+protected:
+ template <class _Integer>
+ void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) {
+ this->_M_initialize_map(__n);
+ _M_fill_initialize(__x, __false_type());
+ }
+
+ template <class _InputIter>
+ void _M_initialize_dispatch(_InputIter __first, _InputIter __last,
+ const __false_type&) {
+ _M_range_initialize(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+ }
+
+public:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+# endif
+
+#else
+ deque(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type() )
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __last - __first)
+ { _STLP_PRIV __ucopy(__first, __last, this->_M_start); }
+
+ deque(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __last - __first)
+ { _STLP_PRIV __ucopy(__first, __last, this->_M_start); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ deque(__move_source<_Self> src)
+ : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__move_source<_Base>(src.get()))
+ {}
+#endif
+
+ ~deque()
+ { _STLP_STD::_Destroy_Range(this->_M_start, this->_M_finish); }
+
+ _Self& operator= (const _Self& __x);
+
+ void swap(_Self& __x) {
+ _STLP_STD::swap(this->_M_start, __x._M_start);
+ _STLP_STD::swap(this->_M_finish, __x._M_finish);
+ this->_M_map.swap(__x._M_map);
+ this->_M_map_size.swap(__x._M_map_size);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public:
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void _M_fill_assign(size_type __n, const _Tp& __val) {
+ if (__n > size()) {
+ _STLP_STD::fill(begin(), end(), __val);
+ insert(end(), __n - size(), __val);
+ }
+ else {
+ erase(begin() + __n, end());
+ _STLP_STD::fill(begin(), end(), __val);
+ }
+ }
+
+ void assign(size_type __n, const _Tp& __val) {
+ _M_fill_assign(__n, __val);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+private: // helper functions for assign()
+
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/)
+ { _M_fill_assign((size_type) __n, (_Tp) __val); }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type& /*_IsIntegral*/) {
+ _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+ }
+
+ template <class _InputIter>
+ void _M_assign_aux(_InputIter __first, _InputIter __last, const input_iterator_tag &) {
+ iterator __cur = begin();
+ for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
+ *__cur = *__first;
+ if (__first == __last)
+ erase(__cur, end());
+ else
+ insert(end(), __first, __last);
+ }
+
+ template <class _ForwardIterator>
+ void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+#else
+ void assign(const value_type *__first, const value_type *__last) {
+ size_type __size = size();
+ size_type __len = __last - __first;
+ if (__len > __size) {
+ const value_type *__mid = __first + __size;
+ _STLP_STD::copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ else {
+ erase(_STLP_STD::copy(__first, __last, begin()), end());
+ }
+ }
+ void assign(const_iterator __first, const_iterator __last) {
+ typedef const_iterator _ForwardIterator;
+#endif /* _STLP_MEMBER_TEMPLATES */
+ size_type __len = _STLP_STD::distance(__first, __last);
+ if (__len > size()) {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, size());
+ _STLP_STD::copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ else {
+ erase(_STLP_STD::copy(__first, __last, begin()), end());
+ }
+ }
+
+
+public: // push_* and pop_*
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void push_back(const value_type& __t) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) {
+ _Copy_Construct(this->_M_finish._M_cur, __t);
+ ++this->_M_finish._M_cur;
+ }
+ else
+ _M_push_back_aux_v(__t);
+ }
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void push_front(const value_type& __t) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ if (this->_M_start._M_cur != this->_M_start._M_first) {
+ _Copy_Construct(this->_M_start._M_cur - 1, __t);
+ --this->_M_start._M_cur;
+ }
+ else
+ _M_push_front_aux_v(__t);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back() {
+ if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) {
+ _STLP_STD::_Construct(this->_M_finish._M_cur);
+ ++this->_M_finish._M_cur;
+ }
+ else
+ _M_push_back_aux();
+ }
+ void push_front() {
+ if (this->_M_start._M_cur != this->_M_start._M_first) {
+ _STLP_STD::_Construct(this->_M_start._M_cur - 1);
+ --this->_M_start._M_cur;
+ }
+ else
+ _M_push_front_aux();
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_back() {
+ if (this->_M_finish._M_cur != this->_M_finish._M_first) {
+ --this->_M_finish._M_cur;
+ _STLP_STD::_Destroy(this->_M_finish._M_cur);
+ }
+ else {
+ _M_pop_back_aux();
+ _STLP_STD::_Destroy(this->_M_finish._M_cur);
+ }
+ }
+
+ void pop_front() {
+ _STLP_STD::_Destroy(this->_M_start._M_cur);
+ _M_pop_front_aux();
+ }
+
+public: // Insert
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ iterator insert(iterator __pos, const value_type& __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ push_front(__x);
+ return this->_M_start;
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ push_back(__x);
+ iterator __tmp = this->_M_finish;
+ --__tmp;
+ return __tmp;
+ }
+ else {
+ return _M_fill_insert_aux(__pos, 1, __x, _Movable());
+ }
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos)
+ { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_fill_insert(__pos, __n, __x); }
+
+protected:
+ iterator _M_fill_insert_aux(iterator __pos, size_type __n, const value_type& __x, const __true_type& /*_Movable*/);
+ iterator _M_fill_insert_aux(iterator __pos, size_type __n, const value_type& __x, const __false_type& /*_Movable*/);
+
+ void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_insert(__pos, (size_type) __n, (value_type) __x);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type& /*_IsIntegral*/) {
+ _M_insert(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
+ }
+
+public:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_insert_range_aux(iterator __pos,
+ const value_type* __first, const value_type* __last,
+ size_type __n, const __true_type& /*_Movable*/);
+ void _M_insert_range_aux(iterator __pos,
+ const value_type* __first, const value_type* __last,
+ size_type __n, const __false_type& /*_Movable*/);
+ void _M_insert_range_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+ size_type __n, const __true_type& /*_Movable*/);
+ void _M_insert_range_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+ size_type __n, const __false_type& /*_Movable*/);
+public:
+ void insert(iterator __pos,
+ const value_type* __first, const value_type* __last);
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last);
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+public:
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size,
+ const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void resize(size_type __new_size, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const size_type __len = size();
+ if (__new_size < __len)
+ erase(this->_M_start + __new_size, this->_M_finish);
+ else
+ insert(this->_M_finish, __new_size - __len, __x);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size)
+ { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+protected:
+ iterator _M_erase(iterator __pos, const __true_type& /*_Movable*/);
+ iterator _M_erase(iterator __pos, const __false_type& /*_Movable*/);
+
+ iterator _M_erase(iterator __first, iterator __last, const __true_type& /*_Movable*/);
+ iterator _M_erase(iterator __first, iterator __last, const __false_type& /*_Movable*/);
+public: // Erase
+ iterator erase(iterator __pos) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ return _M_erase(__pos, _Movable());
+ }
+ iterator erase(iterator __first, iterator __last) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__first == this->_M_start && __last == this->_M_finish) {
+ clear();
+ return this->_M_finish;
+ }
+ else {
+ if (__first == __last)
+ return __first;
+ return _M_erase(__first, __last, _Movable());
+ }
+ }
+ void clear();
+
+protected: // Internal construction/destruction
+
+ void _M_fill_initialize(const value_type& __val, const __true_type& /*_TrivialInit*/)
+ {}
+ void _M_fill_initialize(const value_type& __val, const __false_type& /*_TrivialInit*/);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void _M_range_initialize(_InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ this->_M_initialize_map(0);
+ _STLP_TRY {
+ for ( ; __first != __last; ++__first)
+ push_back(*__first);
+ }
+ _STLP_UNWIND(clear())
+ }
+ template <class _ForwardIterator>
+ void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ this->_M_initialize_map(__n);
+ _Map_pointer __cur_node = this->_M_start._M_node;
+ _STLP_TRY {
+ for (; __cur_node < this->_M_finish._M_node; ++__cur_node) {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, this->buffer_size());
+ _STLP_STD::uninitialized_copy(__first, __mid, *__cur_node);
+ __first = __mid;
+ }
+ _STLP_STD::uninitialized_copy(__first, __last, this->_M_finish._M_first);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(this->_M_start, iterator(*__cur_node, __cur_node)))
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+protected: // Internal push_* and pop_*
+
+ void _M_push_back_aux_v(const value_type&);
+ void _M_push_front_aux_v(const value_type&);
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void _M_push_back_aux();
+ void _M_push_front_aux();
+#endif /*_STLP_DONT_SUP_DFLT_PARAM !_STLP_NO_ANACHRONISMS*/
+ void _M_pop_back_aux();
+ void _M_pop_front_aux();
+
+protected: // Internal insert functions
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+
+ template <class _InputIterator>
+ void _M_insert(iterator __pos,
+ _InputIterator __first,
+ _InputIterator __last,
+ const input_iterator_tag &) {
+ _STLP_STD::copy(__first, __last, inserter(*this, __pos));
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __n = _STLP_STD::distance(__first, __last);
+ if (__pos._M_cur == this->_M_start._M_cur) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ _STLP_TRY {
+ uninitialized_copy(__first, __last, __new_start);
+ this->_M_start = __new_start;
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else if (__pos._M_cur == this->_M_finish._M_cur) {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ _STLP_TRY {
+ uninitialized_copy(__first, __last, this->_M_finish);
+ this->_M_finish = __new_finish;
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ else
+ _M_insert_range_aux(__pos, __first, __last, __n, _Movable());
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert_range_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ size_type __n, const __true_type& /*_Movable*/) {
+ const difference_type __elemsbefore = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elemsbefore <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __pos = this->_M_start + __elemsbefore;
+ _STLP_TRY {
+ iterator __dst = __new_start;
+ iterator __src = this->_M_start;
+ for (; __src != __pos; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_start = __new_start;
+ uninitialized_copy(__first, __last, __dst);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ const difference_type __elemsafter = difference_type(__length) - __elemsbefore;
+ __pos = this->_M_finish - __elemsafter;
+ _STLP_TRY {
+ iterator __dst = __new_finish;
+ iterator __src = this->_M_finish;
+ for (--__src, --__dst; __src >= __pos; --__src, --__dst) {
+ _STLP_STD::_Move_Construct(&(*__dst), *__src);
+ _STLP_STD::_Destroy_Moved(&(*__src));
+ }
+ this->_M_finish = __new_finish;
+ uninitialized_copy(__first, __last, __pos);
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ }
+
+ template <class _ForwardIterator>
+ void _M_insert_range_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ size_type __n, const __false_type& /*_Movable*/) {
+ const difference_type __elemsbefore = __pos - this->_M_start;
+ size_type __length = size();
+ if (__elemsbefore <= difference_type(__length / 2)) {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_start;
+ __pos = this->_M_start + __elemsbefore;
+ _STLP_TRY {
+ if (__elemsbefore >= difference_type(__n)) {
+ iterator __start_n = this->_M_start + difference_type(__n);
+ _STLP_STD::uninitialized_copy(this->_M_start, __start_n, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__start_n, __pos, __old_start);
+ _STLP_STD::copy(__first, __last, __pos - difference_type(__n));
+ }
+ else {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, difference_type(__n) - __elemsbefore);
+ _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start);
+ this->_M_start = __new_start;
+ _STLP_STD::copy(__mid, __last, __old_start);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node))
+ }
+ else {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_finish;
+ const difference_type __elemsafter = difference_type(__length) - __elemsbefore;
+ __pos = this->_M_finish - __elemsafter;
+ _STLP_TRY {
+ if (__elemsafter > difference_type(__n)) {
+ iterator __finish_n = this->_M_finish - difference_type(__n);
+ _STLP_STD::uninitialized_copy(__finish_n, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy_backward(__pos, __finish_n, __old_finish);
+ _STLP_STD::copy(__first, __last, __pos);
+ }
+ else {
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, __elemsafter);
+ _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ _STLP_STD::copy(__first, __mid, __pos);
+ }
+ }
+ _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1))
+ }
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ iterator _M_reserve_elements_at_front(size_type __n) {
+ size_type __vacancies = this->_M_start._M_cur - this->_M_start._M_first;
+ if (__n > __vacancies)
+ _M_new_elements_at_front(__n - __vacancies);
+ return this->_M_start - difference_type(__n);
+ }
+
+ iterator _M_reserve_elements_at_back(size_type __n) {
+ size_type __vacancies = (this->_M_finish._M_last - this->_M_finish._M_cur) - 1;
+ if (__n > __vacancies)
+ _M_new_elements_at_back(__n - __vacancies);
+ return this->_M_finish + difference_type(__n);
+ }
+
+ void _M_new_elements_at_front(size_type __new_elements);
+ void _M_new_elements_at_back(size_type __new_elements);
+
+protected: // Allocation of _M_map and nodes
+
+ // Makes sure the _M_map has space for new nodes. Does not actually
+ // add the nodes. Can invalidate _M_map pointers. (And consequently,
+ // deque iterators.)
+
+ void _M_reserve_map_at_back (size_type __nodes_to_add = 1) {
+ if (__nodes_to_add + 1 > this->_M_map_size._M_data - (this->_M_finish._M_node - this->_M_map._M_data))
+ _M_reallocate_map(__nodes_to_add, false);
+ }
+
+ void _M_reserve_map_at_front (size_type __nodes_to_add = 1) {
+ if (__nodes_to_add > size_type(this->_M_start._M_node - this->_M_map._M_data))
+ _M_reallocate_map(__nodes_to_add, true);
+ }
+
+ void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front);
+};
+
+#if defined (deque)
+# undef deque
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_deque.c>
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# include <stl/pointers/_deque.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_deque.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define _STLP_TEMPLATE_CONTAINER deque<_Tp, _Alloc>
+#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Alloc>
+struct __move_traits<deque<_Tp, _Alloc> > {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_DEQUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stl/_epilog.h b/stlport/stl/_epilog.h
similarity index 100%
rename from stl/_epilog.h
rename to stlport/stl/_epilog.h
diff --git a/stlport/stl/_exception.h b/stlport/stl/_exception.h
new file mode 100644
index 0000000..a0bf4ad
--- /dev/null
+++ b/stlport/stl/_exception.h
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+// The header <exception> contains low-level functions that interact
+// with a compiler's exception-handling mechanism. It is assumed to
+// be supplied with the compiler, rather than with the library, because
+// it is inherently tied very closely to the compiler itself.
+
+// On platforms where <exception> does not exist, this header defines
+// an exception base class. This is *not* a substitute for everything
+// in <exception>, but it suffices to support a bare minimum of STL
+// functionality.
+
+#ifndef _STLP_INTERNAL_EXCEPTION
+#define _STLP_INTERNAL_EXCEPTION
+
+#if !defined (_STLP_NO_EXCEPTION_HEADER)
+
+# if defined ( _UNCAUGHT_EXCEPTION )
+# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+# endif
+
+# if defined (_STLP_BROKEN_EXCEPTION_CLASS)
+# define exception _STLP_NULLIFIED_BROKEN_EXCEPTION_CLASS
+# define bad_exception _STLP_NULLIFIED_BROKEN_BAD_EXCEPTION_CLASS
+# if defined (_STLP_NO_NEW_NEW_HEADER)
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h)
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception)
+# endif
+# undef exception
+# undef bad_exception
+# else
+# if defined (_STLP_NO_NEW_NEW_HEADER)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <exception.h>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
+# endif
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <exception>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
+# endif
+# endif
+# endif
+
+# if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) && defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1300)
+// dwa 02/04/00
+// The header <yvals.h> which ships with vc6 and is included by its native <exception>
+// actually turns on warnings, so we have to turn them back off.
+# include <stl/config/_warnings_off.h>
+# endif
+
+# if defined (_STLP_USE_OWN_NAMESPACE)
+
+_STLP_BEGIN_NAMESPACE
+# if !defined (_STLP_BROKEN_EXCEPTION_CLASS)
+# if !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64)
+using _STLP_VENDOR_EXCEPT_STD::exception;
+# else
+using ::exception;
+# endif
+using _STLP_VENDOR_EXCEPT_STD::bad_exception;
+# endif
+
+# if !defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS)
+// fbp : many platforms present strange mix of
+// those in various namespaces
+# if !defined (_STLP_VENDOR_UNEXPECTED_STD)
+# define _STLP_VENDOR_UNEXPECTED_STD _STLP_VENDOR_EXCEPT_STD
+# else
+/* The following definitions are for backward compatibility as _STLP_VENDOR_TERMINATE_STD
+ * and _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD has been introduce after _STLP_VENDOR_UNEXPECTED_STD
+ * and _STLP_VENDOR_UNEXPECTED_STD was the macro used in their place before that introduction.
+ */
+# if !defined (_STLP_VENDOR_TERMINATE_STD)
+# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_UNEXPECTED_STD
+# endif
+# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
+# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_UNEXPECTED_STD
+# endif
+# endif
+# if !defined (_STLP_VENDOR_TERMINATE_STD)
+# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
+# endif
+# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
+# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
+# endif
+# if !defined (_STLP_VENDOR_TERMINATE_STD)
+# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
+# endif
+# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
+# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
+# endif
+// weird errors
+# if !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
+# if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
+//See config/_intel.h for reason about this workaround
+using std::unexpected;
+# else
+using _STLP_VENDOR_UNEXPECTED_STD::unexpected;
+# endif
+using _STLP_VENDOR_UNEXPECTED_STD::unexpected_handler;
+using _STLP_VENDOR_UNEXPECTED_STD::set_unexpected;
+# endif
+using _STLP_VENDOR_TERMINATE_STD::terminate;
+using _STLP_VENDOR_TERMINATE_STD::terminate_handler;
+using _STLP_VENDOR_TERMINATE_STD::set_terminate;
+
+# if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
+using _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD::uncaught_exception;
+# endif
+# endif /* !_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS */
+_STLP_END_NAMESPACE
+# endif /* _STLP_OWN_NAMESPACE */
+#else /* _STLP_NO_EXCEPTION_HEADER */
+
+/* fbp : absence of <exception> usually means that those
+ * functions are not going to be called by compiler.
+ * Still, define them for the user.
+ * dums: Policy modification, if the function do not behave like the Standard
+ * defined it we do not grant it in the STLport namespace. We will have
+ * compile time error rather than runtime error.
+ */
+#if 0
+/*
+typedef void (*unexpected_handler)();
+unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY;
+void unexpected();
+
+typedef void (*terminate_handler)();
+terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY;
+void terminate();
+
+bool uncaught_exception(); // not implemented under mpw as of Jan/1999
+*/
+#endif
+
+#endif /* _STLP_NO_EXCEPTION_HEADER */
+
+#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
+_STLP_BEGIN_NAMESPACE
+
+// section 18.6.1
+class _STLP_CLASS_DECLSPEC exception {
+public:
+# ifndef _STLP_USE_NO_IOSTREAMS
+ exception() _STLP_NOTHROW;
+ virtual ~exception() _STLP_NOTHROW;
+ virtual const char* what() const _STLP_NOTHROW;
+# else
+ exception() _STLP_NOTHROW {}
+ virtual ~exception() _STLP_NOTHROW {}
+ virtual const char* what() const _STLP_NOTHROW {return "class exception";}
+# endif
+};
+
+// section 18.6.2.1
+class _STLP_CLASS_DECLSPEC bad_exception : public exception {
+public:
+# ifndef _STLP_USE_NO_IOSTREAMS
+ bad_exception() _STLP_NOTHROW;
+ ~bad_exception() _STLP_NOTHROW;
+ const char* what() const _STLP_NOTHROW;
+# else
+ bad_exception() _STLP_NOTHROW {}
+ ~bad_exception() _STLP_NOTHROW {}
+ const char* what() const _STLP_NOTHROW {return "class bad_exception";}
+# endif
+};
+
+// forward declaration
+class __Named_exception;
+_STLP_END_NAMESPACE
+#endif
+
+#endif /* _STLP_INTERNAL_EXCEPTION */
diff --git a/stlport/stl/_facets_fwd.h b/stlport/stl/_facets_fwd.h
new file mode 100644
index 0000000..d4c8451
--- /dev/null
+++ b/stlport/stl/_facets_fwd.h
@@ -0,0 +1,53 @@
+#ifndef _STLP_FACETS_FWD_H
+#define _STLP_FACETS_FWD_H
+
+
+#include <stl/_iosfwd.h>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT, class _InputIter>
+#else
+template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
+#endif
+class money_get;
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT, class _OutputIter>
+#else
+template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
+#endif
+class money_put;
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT, class _InputIter>
+#else
+template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
+#endif
+class num_get;
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT, class _OutputIter>
+#else
+template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
+#endif
+class num_put;
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _Ch, class _InIt>
+#else
+template <class _Ch, class _InIt = istreambuf_iterator<_Ch, char_traits<_Ch> > >
+#endif
+class time_get;
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _Ch, class _OutIt>
+#else
+template <class _Ch, class _OutIt = ostreambuf_iterator<_Ch, char_traits<_Ch> > >
+#endif
+class time_put;
+
+_STLP_END_NAMESPACE
+
+#endif
diff --git a/stlport/stl/_fstream.c b/stlport/stl/_fstream.c
new file mode 100644
index 0000000..f1548ae
--- /dev/null
+++ b/stlport/stl/_fstream.c
@@ -0,0 +1,766 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_FSTREAM_C
+#define _STLP_FSTREAM_C
+
+#ifndef _STLP_INTERNAL_FSTREAM_H
+# include <stl/_fstream.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+// no wchar_t is supported for this mode
+# define __BF_int_type__ int
+# define __BF_pos_type__ streampos
+# define __BF_off_type__ streamoff
+# else
+# define __BF_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::int_type
+# define __BF_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::pos_type
+# define __BF_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::off_type
+# endif
+
+
+//----------------------------------------------------------------------
+// Public basic_filebuf<> member functions
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>::basic_filebuf()
+ : basic_streambuf<_CharT, _Traits>(), _M_base(),
+ _M_constant_width(false), _M_always_noconv(false),
+ _M_int_buf_dynamic(false),
+ _M_in_input_mode(false), _M_in_output_mode(false),
+ _M_in_error_mode(false), _M_in_putback_mode(false),
+ _M_int_buf(0), _M_int_buf_EOS(0),
+ _M_ext_buf(0), _M_ext_buf_EOS(0),
+ _M_ext_buf_converted(0), _M_ext_buf_end(0),
+ _M_state(_STLP_DEFAULT_CONSTRUCTED(_State_type)),
+ _M_end_state(_STLP_DEFAULT_CONSTRUCTED(_State_type)),
+ _M_mmap_base(0), _M_mmap_len(0),
+ _M_saved_eback(0), _M_saved_gptr(0), _M_saved_egptr(0),
+ _M_codecvt(0),
+ _M_width(1), _M_max_width(1)
+{
+ this->_M_setup_codecvt(locale(), false);
+}
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>::~basic_filebuf() {
+ this->close();
+ _M_deallocate_buffers();
+}
+
+
+template <class _CharT, class _Traits>
+_STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::int_type
+basic_filebuf<_CharT, _Traits>::underflow() {
+ return _Underflow<_CharT, _Traits>::_M_doit(this);
+}
+
+template <class _CharT, class _Traits>
+basic_filebuf<_CharT, _Traits>*
+basic_filebuf<_CharT, _Traits>::close() {
+ bool __ok = this->is_open();
+
+ if (_M_in_output_mode) {
+ __ok = __ok && !_Traits::eq_int_type(this->overflow(traits_type::eof()),
+ traits_type::eof());
+ __ok == __ok && this->_M_unshift();
+ }
+ else if (_M_in_input_mode)
+ this->_M_exit_input_mode();
+
+ // Note order of arguments. We close the file even if __ok is false.
+ __ok = _M_base._M_close() && __ok;
+
+ // Restore the initial state, except that we don't deallocate the buffer
+ // or mess with the cached codecvt information.
+ _M_state = _M_end_state = _State_type();
+ _M_ext_buf_converted = _M_ext_buf_end = 0;
+
+ _M_mmap_base = 0;
+ _M_mmap_len = 0;
+
+ this->setg(0, 0, 0);
+ this->setp(0, 0);
+
+ _M_saved_eback = _M_saved_gptr = _M_saved_egptr = 0;
+
+ _M_in_input_mode = _M_in_output_mode = _M_in_error_mode = _M_in_putback_mode
+ = false;
+
+ return __ok ? this : 0;
+}
+
+// This member function is called whenever we exit input mode.
+// It unmaps the memory-mapped file, if any, and sets
+// _M_in_input_mode to false.
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::_M_exit_input_mode() {
+ if (_M_mmap_base != 0) {
+ _M_base._M_unmap(_M_mmap_base, _M_mmap_len);
+ _M_mmap_base = 0;
+ _M_mmap_len = 0;
+ }
+ _M_in_input_mode = false;
+}
+
+
+//----------------------------------------------------------------------
+// basic_filebuf<> overridden protected virtual member functions
+
+template <class _CharT, class _Traits>
+streamsize basic_filebuf<_CharT, _Traits>::showmanyc() {
+ // Is there any possibility that reads can succeed?
+ if (!this->is_open() || _M_in_output_mode || _M_in_error_mode)
+ return -1;
+ else if (_M_in_putback_mode)
+ return this->egptr() - this->gptr();
+ else if (_M_constant_width) {
+ streamoff __pos = _M_base._M_seek(0, ios_base::cur);
+ streamoff __size = _M_base._M_file_size();
+ return __pos >= 0 && __size > __pos ? __size - __pos : 0;
+ }
+ else
+ return 0;
+}
+
+
+// Make a putback position available, if necessary, by switching to a
+// special internal buffer used only for putback. The buffer is
+// [_M_pback_buf, _M_pback_buf + _S_pback_buf_size), but the base
+// class only sees a piece of it at a time. (We want to make sure
+// that we don't try to read a character that hasn't been initialized.)
+// The end of the putback buffer is always _M_pback_buf + _S_pback_buf_size,
+// but the beginning is usually not _M_pback_buf.
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c) {
+ const int_type __eof = traits_type::eof();
+
+ // If we aren't already in input mode, pushback is impossible.
+ if (!_M_in_input_mode)
+ return __eof;
+
+ // We can use the ordinary get buffer if there's enough space, and
+ // if it's a buffer that we're allowed to write to.
+ if (this->gptr() != this->eback() &&
+ (traits_type::eq_int_type(__c, __eof) ||
+ traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]) ||
+ !_M_mmap_base)) {
+ this->gbump(-1);
+ if (traits_type::eq_int_type(__c, __eof) ||
+ traits_type::eq(traits_type::to_char_type(__c), *this->gptr()))
+ return traits_type::to_int_type(*this->gptr());
+ }
+ else if (!traits_type::eq_int_type(__c, __eof)) {
+ // Are we in the putback buffer already?
+ _CharT* __pback_end = _M_pback_buf + __STATIC_CAST(int,_S_pback_buf_size);
+ if (_M_in_putback_mode) {
+ // Do we have more room in the putback buffer?
+ if (this->eback() != _M_pback_buf)
+ this->setg(this->egptr() - 1, this->egptr() - 1, __pback_end);
+ else
+ return __eof; // No more room in the buffer, so fail.
+ }
+ else { // We're not yet in the putback buffer.
+ _M_saved_eback = this->eback();
+ _M_saved_gptr = this->gptr();
+ _M_saved_egptr = this->egptr();
+ this->setg(__pback_end - 1, __pback_end - 1, __pback_end);
+ _M_in_putback_mode = true;
+ }
+ }
+ else
+ return __eof;
+
+ // We have made a putback position available. Assign to it, and return.
+ *this->gptr() = traits_type::to_char_type(__c);
+ return __c;
+}
+
+// This member function flushes the put area, and also outputs the
+// character __c (unless __c is eof). Invariant: we always leave room
+// in the internal buffer for one character more than the base class knows
+// about. We see the internal buffer as [_M_int_buf, _M_int_buf_EOS), but
+// the base class only sees [_M_int_buf, _M_int_buf_EOS - 1).
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::overflow(int_type __c) {
+ // Switch to output mode, if necessary.
+ if (!_M_in_output_mode)
+ if (!_M_switch_to_output_mode())
+ return traits_type::eof();
+
+ _CharT* __ibegin = this->_M_int_buf;
+ _CharT* __iend = this->pptr();
+ this->setp(_M_int_buf, _M_int_buf_EOS - 1);
+
+ // Put __c at the end of the internal buffer.
+ if (!traits_type::eq_int_type(__c, traits_type::eof()))
+ *__iend++ = _Traits::to_char_type(__c);
+
+ // For variable-width encodings, output may take more than one pass.
+ while (__ibegin != __iend) {
+ const _CharT* __inext = __ibegin;
+ char* __enext = _M_ext_buf;
+ typename _Codecvt::result __status
+ = _M_codecvt->out(_M_state, __ibegin, __iend, __inext,
+ _M_ext_buf, _M_ext_buf_EOS, __enext);
+ if (__status == _Codecvt::noconv) {
+ return _Noconv_output<_Traits>::_M_doit(this, __ibegin, __iend)
+ ? traits_type::not_eof(__c)
+ : _M_output_error();
+ }
+
+ // For a constant-width encoding we know that the external buffer
+ // is large enough, so failure to consume the entire internal buffer
+ // or to produce the correct number of external characters, is an error.
+ // For a variable-width encoding, however, we require only that we
+ // consume at least one internal character
+ else if (__status != _Codecvt::error &&
+ (((__inext == __iend) &&
+ (__enext - _M_ext_buf == _M_width * (__iend - __ibegin))) ||
+ (!_M_constant_width && __inext != __ibegin))) {
+ // We successfully converted part or all of the internal buffer.
+ ptrdiff_t __n = __enext - _M_ext_buf;
+ if (_M_write(_M_ext_buf, __n))
+ __ibegin += __inext - __ibegin;
+ else
+ return _M_output_error();
+ }
+ else
+ return _M_output_error();
+ }
+
+ return traits_type::not_eof(__c);
+}
+
+// This member function must be called before any I/O has been
+// performed on the stream, otherwise it has no effect.
+//
+// __buf == 0 && __n == 0 means to make this stream unbuffered.
+// __buf != 0 && __n > 0 means to use __buf as the stream's internal
+// buffer, rather than the buffer that would otherwise be allocated
+// automatically. __buf must be a pointer to an array of _CharT whose
+// size is at least __n.
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>*
+basic_filebuf<_CharT, _Traits>::setbuf(_CharT* __buf, streamsize __n) {
+ if (!_M_in_input_mode &&! _M_in_output_mode && !_M_in_error_mode &&
+ _M_int_buf == 0) {
+ if (__buf == 0 && __n == 0)
+ _M_allocate_buffers(0, 1);
+ else if (__buf != 0 && __n > 0)
+ _M_allocate_buffers(__buf, __n);
+ }
+ return this;
+}
+
+#if defined (_STLP_ASSERTIONS)
+// helper class.
+template <class _CharT>
+struct _Filebuf_Tmp_Buf {
+ _CharT* _M_ptr;
+ _Filebuf_Tmp_Buf(ptrdiff_t __n) : _M_ptr(0) { _M_ptr = new _CharT[__n]; }
+ ~_Filebuf_Tmp_Buf() { delete[] _M_ptr; }
+};
+#endif
+
+template <class _CharT, class _Traits>
+__BF_pos_type__
+basic_filebuf<_CharT, _Traits>::seekoff(off_type __off,
+ ios_base::seekdir __whence,
+ ios_base::openmode /* dummy */) {
+ if (!this->is_open())
+ return pos_type(-1);
+
+ if (!_M_constant_width && __off != 0)
+ return pos_type(-1);
+
+ if (!_M_seek_init(__off != 0 || __whence != ios_base::cur))
+ return pos_type(-1);
+
+ // Seek to beginning or end, regardless of whether we're in input mode.
+ if (__whence == ios_base::beg || __whence == ios_base::end)
+ return _M_seek_return(_M_base._M_seek(_M_width * __off, __whence),
+ _State_type());
+
+ // Seek relative to current position. Complicated if we're in input mode.
+ _STLP_ASSERT(__whence == ios_base::cur)
+ if (!_M_in_input_mode)
+ return _M_seek_return(_M_base._M_seek(_M_width * __off, __whence),
+ _State_type());
+
+ if (_M_mmap_base != 0) {
+ // __off is relative to gptr(). We need to do a bit of arithmetic
+ // to get an offset relative to the external file pointer.
+ streamoff __adjust = _M_mmap_len - (this->gptr() - (_CharT*) _M_mmap_base);
+
+ // if __off == 0, we do not need to exit input mode and to shift file pointer
+ return __off == 0 ? pos_type(_M_base._M_seek(0, ios_base::cur) - __adjust)
+ : _M_seek_return(_M_base._M_seek(__off - __adjust, ios_base::cur), _State_type());
+ }
+
+ if (_M_constant_width) { // Get or set the position.
+ streamoff __iadj = _M_width * (this->gptr() - this->eback());
+
+ // Compensate for offset relative to gptr versus offset relative
+ // to external pointer. For a text-oriented stream, where the
+ // compensation is more than just pointer arithmetic, we may get
+ // but not set the current position.
+
+ if (__iadj <= _M_ext_buf_end - _M_ext_buf) {
+ streamoff __eadj = _M_base._M_get_offset(_M_ext_buf + __STATIC_CAST(ptrdiff_t, __iadj), _M_ext_buf_end);
+
+ return __off == 0 ? pos_type(_M_base._M_seek(0, ios_base::cur) - __eadj)
+ : _M_seek_return(_M_base._M_seek(__off - __eadj, ios_base::cur), _State_type());
+ }
+ }
+ else { // Get the position. Encoding is var width.
+ // Get position in internal buffer.
+ ptrdiff_t __ipos = this->gptr() - this->eback();
+
+ // Get corresponding position in external buffer.
+ _State_type __state = _M_state;
+ int __epos = _M_codecvt->length(__state, _M_ext_buf, _M_ext_buf_converted,
+ __ipos);
+#if defined (_STLP_ASSERTIONS)
+ // Sanity check (expensive): make sure __epos is the right answer.
+ _STLP_ASSERT(__epos >= 0)
+ _State_type __tmp_state = _M_state;
+ _Filebuf_Tmp_Buf<_CharT> __buf(__ipos);
+ _CharT* __ibegin = __buf._M_ptr;
+ _CharT* __inext = __ibegin;
+ const char* __dummy;
+ typename _Codecvt::result __status
+ = _M_codecvt->in(__tmp_state,
+ _M_ext_buf, _M_ext_buf + __epos, __dummy,
+ __ibegin, __ibegin + __ipos, __inext);
+ // The result code is necessarily ok because:
+ // - noconv: impossible for a variable encoding
+ // - error: length method is supposed to count until it reach max value or find an error so we cannot have
+ // an error again when decoding an external buffer up to length return value.
+ // - partial: idem error, it is also a reason for length to stop counting.
+ _STLP_ASSERT(__status == _Codecvt::ok)
+ _STLP_ASSERT(__inext == __ibegin + __ipos)
+ _STLP_ASSERT(equal(this->eback(), this->gptr(), __ibegin, _STLP_PRIV _Eq_traits<traits_type>()))
+#endif
+ // Get the current position (at the end of the external buffer),
+ // then adjust it. Again, it might be a text-oriented stream.
+ streamoff __cur = _M_base._M_seek(0, ios_base::cur);
+ streamoff __adj = _M_base._M_get_offset(_M_ext_buf, _M_ext_buf + __epos) -
+ _M_base._M_get_offset(_M_ext_buf, _M_ext_buf_end);
+ if (__cur != -1 && __cur + __adj >= 0)
+ return __off == 0 ? pos_type(__cur + __adj)
+ : _M_seek_return(__cur + __adj, __state);
+ }
+
+ return pos_type(-1);
+}
+
+
+template <class _CharT, class _Traits>
+__BF_pos_type__
+basic_filebuf<_CharT, _Traits>::seekpos(pos_type __pos,
+ ios_base::openmode /* dummy */) {
+ if (this->is_open()) {
+ if (!_M_seek_init(true))
+ return pos_type(-1);
+
+ streamoff __off = off_type(__pos);
+ if (__off != -1 && _M_base._M_seek(__off, ios_base::beg) != -1) {
+ _M_state = __pos.state();
+ return _M_seek_return(__off, __pos.state());
+ }
+ }
+
+ return pos_type(-1);
+}
+
+
+template <class _CharT, class _Traits>
+int basic_filebuf<_CharT, _Traits>::sync() {
+ if (_M_in_output_mode)
+ return traits_type::eq_int_type(this->overflow(traits_type::eof()),
+ traits_type::eof()) ? -1 : 0;
+ return 0;
+}
+
+
+// Change the filebuf's locale. This member function has no effect
+// unless it is called before any I/O is performed on the stream.
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) {
+ if (!_M_in_input_mode && !_M_in_output_mode && !_M_in_error_mode) {
+ this->_M_setup_codecvt(__loc);
+ }
+}
+
+//----------------------------------------------------------------------
+// basic_filebuf<> helper functions.
+
+//----------------------------------------
+// Helper functions for switching between modes.
+
+// This member function is called if we're performing the first I/O
+// operation on a filebuf, or if we're performing an input operation
+// immediately after a seek.
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_switch_to_input_mode() {
+ if (this->is_open() && (((int)_M_base.__o_mode() & (int)ios_base::in) !=0)
+ && (_M_in_output_mode == 0) && (_M_in_error_mode == 0)) {
+ if (!_M_int_buf && !_M_allocate_buffers())
+ return false;
+
+ _M_ext_buf_converted = _M_ext_buf;
+ _M_ext_buf_end = _M_ext_buf;
+
+ _M_end_state = _M_state;
+
+ _M_in_input_mode = true;
+ return true;
+ }
+
+ return false;
+}
+
+
+// This member function is called if we're performing the first I/O
+// operation on a filebuf, or if we're performing an output operation
+// immediately after a seek.
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_switch_to_output_mode() {
+ if (this->is_open() && (_M_base.__o_mode() & (int)ios_base::out) &&
+ _M_in_input_mode == 0 && _M_in_error_mode == 0) {
+
+ if (!_M_int_buf && !_M_allocate_buffers())
+ return false;
+
+ // In append mode, every write does an implicit seek to the end
+ // of the file. Whenever leaving output mode, the end of file
+ // get put in the initial shift state.
+ if (_M_base.__o_mode() & ios_base::app)
+ _M_state = _State_type();
+
+ this->setp(_M_int_buf, _M_int_buf_EOS - 1);
+ _M_in_output_mode = true;
+ return true;
+ }
+
+ return false;
+}
+
+
+//----------------------------------------
+// Helper functions for input
+
+// This member function is called if there is an error during input.
+// It puts the filebuf in error mode, clear the get area buffer, and
+// returns eof.
+// returns eof. Error mode is sticky; it is cleared only by close or
+// seek.
+
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::_M_input_error() {
+ this->_M_exit_input_mode();
+ _M_in_output_mode = false;
+ _M_in_error_mode = true;
+ this->setg(0, 0, 0);
+ return traits_type::eof();
+}
+
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::_M_underflow_aux() {
+ // We have the state and file position from the end of the internal
+ // buffer. This round, they become the beginning of the internal buffer.
+ _M_state = _M_end_state;
+
+ // Fill the external buffer. Start with any leftover characters that
+ // didn't get converted last time.
+ if (_M_ext_buf_end > _M_ext_buf_converted)
+
+ _M_ext_buf_end = _STLP_STD::copy(_M_ext_buf_converted, _M_ext_buf_end, _M_ext_buf);
+ // boris : copy_backward did not work
+ //_M_ext_buf_end = copy_backward(_M_ext_buf_converted, _M_ext_buf_end,
+ //_M_ext_buf+ (_M_ext_buf_end - _M_ext_buf_converted));
+ else
+ _M_ext_buf_end = _M_ext_buf;
+
+ // Now fill the external buffer with characters from the file. This is
+ // a loop because occasionally we don't get enough external characters
+ // to make progress.
+ for (;;) {
+ ptrdiff_t __n = _M_base._M_read(_M_ext_buf_end, _M_ext_buf_EOS - _M_ext_buf_end);
+ if (__n < 0) {
+ // Read failed, maybe we should set err bit on associated stream...
+ this->setg(0, 0, 0);
+ return traits_type::eof();
+ }
+
+ _M_ext_buf_end += __n;
+
+ // If external buffer is empty there is nothing to do.
+ if (_M_ext_buf == _M_ext_buf_end) {
+ this->setg(0, 0, 0);
+ return traits_type::eof();
+ }
+
+ // Convert the external buffer to internal characters.
+ const char* __enext;
+ _CharT* __inext;
+
+ typename _Codecvt::result __status
+ = _M_codecvt->in(_M_end_state,
+ _M_ext_buf, _M_ext_buf_end, __enext,
+ _M_int_buf, _M_int_buf_EOS, __inext);
+
+ /* Error conditions:
+ * (1) Return value of error.
+ * (2) Producing internal characters without consuming external characters.
+ * (3) In fixed-width encodings, producing an internal sequence whose length
+ * is inconsistent with that of the internal sequence.
+ * (4) Failure to produce any characters if we have enough characters in
+ * the external buffer, where "enough" means the largest possible width
+ * of a single character. */
+ if (__status == _Codecvt::noconv)
+ return _Noconv_input<_Traits>::_M_doit(this);
+ else if (__status == _Codecvt::error ||
+ (__inext != _M_int_buf && __enext == _M_ext_buf) ||
+ (_M_constant_width && (__inext - _M_int_buf) * _M_width != (__enext - _M_ext_buf)) ||
+ (__inext == _M_int_buf && __enext - _M_ext_buf >= _M_max_width))
+ return _M_input_error();
+ else if (__inext != _M_int_buf) {
+ _M_ext_buf_converted = _M_ext_buf + (__enext - _M_ext_buf);
+ this->setg(_M_int_buf, _M_int_buf, __inext);
+ return traits_type::to_int_type(*_M_int_buf);
+ }
+ /* We need to go around the loop again to get more external characters.
+ * But if the previous read failed then don't try again for now.
+ * Don't enter error mode for a failed read. Error mode is sticky,
+ * and we might succeed if we try again. */
+ if (__n <= 0) {
+ this->setg(0, 0, 0);
+ return traits_type::eof();
+ }
+ }
+}
+
+//----------------------------------------
+// Helper functions for output
+
+// This member function is called if there is an error during output.
+// It puts the filebuf in error mode, clear the put area buffer, and
+// returns eof. Error mode is sticky; it is cleared only by close or
+// seek.
+template <class _CharT, class _Traits>
+__BF_int_type__
+basic_filebuf<_CharT, _Traits>::_M_output_error() {
+ _M_in_output_mode = false;
+ _M_in_input_mode = false;
+ _M_in_error_mode = true;
+ this->setp(0, 0);
+ return traits_type::eof();
+}
+
+
+// Write whatever sequence of characters is necessary to get back to
+// the initial shift state. This function overwrites the external
+// buffer, changes the external file position, and changes the state.
+// Precondition: the internal buffer is empty.
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_unshift() {
+ if (_M_in_output_mode && !_M_constant_width) {
+ typename _Codecvt::result __status;
+ do {
+ char* __enext = _M_ext_buf;
+ __status = _M_codecvt->unshift(_M_state,
+ _M_ext_buf, _M_ext_buf_EOS, __enext);
+ if (__status == _Codecvt::noconv ||
+ (__enext == _M_ext_buf && __status == _Codecvt::ok))
+ return true;
+ else if (__status == _Codecvt::error)
+ return false;
+ else if (!_M_write(_M_ext_buf, __enext - _M_ext_buf))
+ return false;
+ } while (__status == _Codecvt::partial);
+ }
+
+ return true;
+}
+
+
+//----------------------------------------
+// Helper functions for buffer allocation and deallocation
+
+// This member function is called when we're initializing a filebuf's
+// internal and external buffers. The argument is the size of the
+// internal buffer; the external buffer is sized using the character
+// width in the current encoding. Preconditions: the buffers are currently
+// null. __n >= 1. __buf is either a null pointer or a pointer to an
+// array show size is at least __n.
+
+// We need __n >= 1 for two different reasons. For input, the base
+// class always needs a buffer because of the semantics of underflow().
+// For output, we want to have an internal buffer that's larger by one
+// element than the buffer that the base class knows about. (See
+// basic_filebuf<>::overflow() for the reason.)
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers(_CharT* __buf, streamsize __n) {
+ //The major hypothesis in the following implementation is that size_t is unsigned.
+ //We also need streamsize byte representation to be larger or equal to the int
+ //representation to correctly store the encoding information.
+ _STLP_STATIC_ASSERT(!numeric_limits<size_t>::is_signed &&
+ sizeof(streamsize) >= sizeof(int))
+
+ if (__buf == 0) {
+ streamsize __bufsize = __n * sizeof(_CharT);
+ //We first check that the streamsize representation can't overflow a size_t one.
+ //If it can, we check that __bufsize is not higher than the size_t max value.
+ if ((sizeof(streamsize) > sizeof(size_t)) &&
+ (__bufsize > __STATIC_CAST(streamsize, (numeric_limits<size_t>::max)())))
+ return false;
+ _M_int_buf = __STATIC_CAST(_CharT*, malloc(__STATIC_CAST(size_t, __bufsize)));
+ if (!_M_int_buf)
+ return false;
+ _M_int_buf_dynamic = true;
+ }
+ else {
+ _M_int_buf = __buf;
+ _M_int_buf_dynamic = false;
+ }
+
+ streamsize __ebufsiz = (max)(__n * __STATIC_CAST(streamsize, _M_width),
+ __STATIC_CAST(streamsize, _M_codecvt->max_length()));
+
+ _M_ext_buf = 0;
+ if ((sizeof(streamsize) < sizeof(size_t)) ||
+ ((sizeof(streamsize) == sizeof(size_t)) && numeric_limits<streamsize>::is_signed) ||
+ (__ebufsiz <= __STATIC_CAST(streamsize, (numeric_limits<size_t>::max)()))) {
+ _M_ext_buf = __STATIC_CAST(char*, malloc(__STATIC_CAST(size_t, __ebufsiz)));
+ }
+
+ if (!_M_ext_buf) {
+ _M_deallocate_buffers();
+ return false;
+ }
+
+ _M_int_buf_EOS = _M_int_buf + __STATIC_CAST(ptrdiff_t, __n);
+ _M_ext_buf_EOS = _M_ext_buf + __STATIC_CAST(ptrdiff_t, __ebufsiz);
+ return true;
+}
+
+// Abbreviation for the most common case.
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers() {
+ // Choose a buffer that's at least 4096 characters long and that's a
+ // multiple of the page size.
+ streamsize __default_bufsiz =
+ ((_M_base.__page_size() + 4095UL) / _M_base.__page_size()) * _M_base.__page_size();
+ return _M_allocate_buffers(0, __default_bufsiz);
+}
+
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::_M_deallocate_buffers() {
+ if (_M_int_buf_dynamic)
+ free(_M_int_buf);
+ free(_M_ext_buf);
+ _M_int_buf = 0;
+ _M_int_buf_EOS = 0;
+ _M_ext_buf = 0;
+ _M_ext_buf_EOS = 0;
+}
+
+
+//----------------------------------------
+// Helper functiosn for seek and imbue
+
+template <class _CharT, class _Traits>
+bool basic_filebuf<_CharT, _Traits>::_M_seek_init(bool __do_unshift) {
+ // If we're in error mode, leave it.
+ _M_in_error_mode = false;
+
+ // Flush the output buffer if we're in output mode, and (conditionally)
+ // emit an unshift sequence.
+ if (_M_in_output_mode) {
+ bool __ok = !traits_type::eq_int_type(this->overflow(traits_type::eof()),
+ traits_type::eof());
+ if (__do_unshift)
+ __ok = __ok && this->_M_unshift();
+ if (!__ok) {
+ _M_in_output_mode = false;
+ _M_in_error_mode = true;
+ this->setp(0, 0);
+ return false;
+ }
+ }
+
+ // Discard putback characters, if any.
+ if (_M_in_input_mode && _M_in_putback_mode)
+ _M_exit_putback_mode();
+
+ return true;
+}
+
+
+/* Change the filebuf's locale. This member function has no effect
+ * unless it is called before any I/O is performed on the stream.
+ * This function is called on construction and on an imbue call. In the
+ * case of the construction the codecvt facet might be a custom one if
+ * the basic_filebuf user has instanciate it with a custom char_traits.
+ * The user will have to call imbue before any I/O operation.
+ */
+template <class _CharT, class _Traits>
+void basic_filebuf<_CharT, _Traits>::_M_setup_codecvt(const locale& __loc, bool __on_imbue) {
+ if (has_facet<_Codecvt>(__loc)) {
+ _M_codecvt = &use_facet<_Codecvt>(__loc) ;
+ int __encoding = _M_codecvt->encoding();
+
+ _M_width = (max)(__encoding, 1);
+ _M_max_width = _M_codecvt->max_length();
+ _M_constant_width = __encoding > 0;
+ _M_always_noconv = _M_codecvt->always_noconv();
+ }
+ else {
+ _M_codecvt = 0;
+ _M_width = _M_max_width = 1;
+ _M_constant_width = _M_always_noconv = false;
+ if (__on_imbue) {
+ //This call will generate an exception reporting the problem.
+ use_facet<_Codecvt>(__loc);
+ }
+ }
+}
+
+_STLP_END_NAMESPACE
+
+# undef __BF_int_type__
+# undef __BF_pos_type__
+# undef __BF_off_type__
+
+#endif /* _STLP_FSTREAM_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_fstream.h b/stlport/stl/_fstream.h
new file mode 100644
index 0000000..1945e41
--- /dev/null
+++ b/stlport/stl/_fstream.h
@@ -0,0 +1,714 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// This header defines classes basic_filebuf, basic_ifstream,
+// basic_ofstream, and basic_fstream. These classes represent
+// streambufs and streams whose sources or destinations are files.
+
+#ifndef _STLP_INTERNAL_FSTREAM_H
+#define _STLP_INTERNAL_FSTREAM_H
+
+#if defined(__sgi) && !defined(__GNUC__) && !defined(_STANDARD_C_PLUS_PLUS)
+# error This header file requires the -LANG:std option
+#endif
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CODECVT_H
+# include <stl/_codecvt.h>
+#endif
+
+#if defined (_STLP_USE_WIN32_IO)
+typedef void* _STLP_fd;
+#elif defined (_STLP_USE_UNIX_EMULATION_IO) || defined (_STLP_USE_STDIO_IO) || defined (_STLP_USE_UNIX_IO)
+typedef int _STLP_fd;
+#else
+# error "Configure i/o !"
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Class _Filebuf_base, a private base class to factor out the system-
+// dependent code from basic_filebuf<>.
+
+class _STLP_CLASS_DECLSPEC _Filebuf_base {
+public: // Opening and closing files.
+ _Filebuf_base();
+
+ bool _M_open(const char*, ios_base::openmode, long __protection);
+ bool _M_open(const char*, ios_base::openmode);
+ bool _M_open(int __id, ios_base::openmode = ios_base::__default_mode);
+#if defined (_STLP_USE_WIN32_IO)
+ bool _M_open(_STLP_fd __id, ios_base::openmode = ios_base::__default_mode);
+#endif /* _STLP_USE_WIN32_IO */
+ bool _M_close();
+
+public: // Low-level I/O, like Unix read/write
+ ptrdiff_t _M_read(char* __buf, ptrdiff_t __n);
+ streamoff _M_seek(streamoff __offset, ios_base::seekdir __dir);
+ streamoff _M_file_size();
+ bool _M_write(char* __buf, ptrdiff_t __n);
+
+public: // Memory-mapped I/O.
+ void* _M_mmap(streamoff __offset, streamoff __len);
+ void _M_unmap(void* __mmap_base, streamoff __len);
+
+public:
+ // Returns a value n such that, if pos is the file pointer at the
+ // beginning of the range [first, last), pos + n is the file pointer at
+ // the end. On many operating systems n == __last - __first.
+ // In Unix, writing n characters always bumps the file position by n.
+ // In Windows text mode, however, it bumps the file position by n + m,
+ // where m is the number of newlines in the range. That's because an
+ // internal \n corresponds to an external two-character sequence.
+ streamoff _M_get_offset(char* __first, char* __last) {
+#if defined (_STLP_UNIX) || defined (_STLP_MAC)
+ return __last - __first;
+#else // defined (_STLP_WIN32)
+ return ( (_M_openmode & ios_base::binary) != 0 )
+ ? (__last - __first)
+ : count(__first, __last, '\n') + (__last - __first);
+#endif
+ }
+
+ // Returns true if we're in binary mode or if we're using an OS or file
+ // system where there is no distinction between text and binary mode.
+ bool _M_in_binary_mode() const {
+#if defined (_STLP_UNIX) || defined (_STLP_MAC) || defined(__BEOS__) || defined (__amigaos__)
+ return true;
+#elif defined (_STLP_WIN32) || defined (_STLP_VM)
+ return (_M_openmode & ios_base::binary) != 0;
+#else
+# error "Port!"
+#endif
+ }
+
+ static void _S_initialize();
+
+protected: // Static data members.
+ static size_t _M_page_size;
+
+protected: // Data members.
+ _STLP_fd _M_file_id;
+#if defined (_STLP_USE_STDIO_IO)
+ // for stdio, the whole FILE* is being kept here
+ FILE* _M_file;
+#endif
+ ios_base::openmode _M_openmode ;
+ unsigned char _M_is_open ;
+ unsigned char _M_should_close ;
+ unsigned char _M_regular_file ;
+
+#if defined (_STLP_USE_WIN32_IO)
+ _STLP_fd _M_view_id;
+#endif
+
+public :
+ static size_t _STLP_CALL __page_size() { return _M_page_size; }
+ int __o_mode() const { return (int)_M_openmode; }
+ bool __is_open() const { return (_M_is_open !=0 ); }
+ bool __should_close() const { return (_M_should_close != 0); }
+ bool __regular_file() const { return (_M_regular_file != 0); }
+ _STLP_fd __get_fd() const { return _M_file_id; }
+};
+
+//----------------------------------------------------------------------
+// Class basic_filebuf<>.
+
+// Forward declaration of two helper classes.
+template <class _Traits> class _Noconv_input;
+template <class _Traits> class _Noconv_output;
+
+// There is a specialized version of underflow, for basic_filebuf<char>,
+// in fstream.cpp.
+template <class _CharT, class _Traits>
+class _Underflow;
+
+template <class _CharT, class _Traits>
+class basic_filebuf : public basic_streambuf<_CharT, _Traits> {
+public: // Types.
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef typename _Traits::state_type _State_type;
+ typedef basic_streambuf<_CharT, _Traits> _Base;
+ typedef basic_filebuf<_CharT, _Traits> _Self;
+
+public: // Constructors, destructor.
+ basic_filebuf();
+ ~basic_filebuf();
+
+public: // Opening and closing files.
+ bool is_open() const { return _M_base.__is_open(); }
+
+ _Self* open(const char* __s, ios_base::openmode __m) {
+ return _M_base._M_open(__s, __m) ? this : 0;
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ // These two version of open() and file descriptor getter are extensions.
+ _Self* open(const char* __s, ios_base::openmode __m,
+ long __protection) {
+ return _M_base._M_open(__s, __m, __protection) ? this : 0;
+ }
+
+ _STLP_fd fd() const { return _M_base.__get_fd(); }
+
+ _Self* open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
+ return this->_M_open(__id, _Init_mode);
+ }
+
+# if defined (_STLP_USE_WIN32_IO)
+ _Self* open(_STLP_fd __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
+ return _M_base._M_open(__id, _Init_mode) ? this : 0;
+ }
+# endif /* _STLP_USE_WIN32_IO */
+
+#endif
+
+ _Self* _M_open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
+ return _M_base._M_open(__id, _Init_mode) ? this : 0;
+ }
+
+ _Self* close();
+
+protected: // Virtual functions from basic_streambuf.
+ virtual streamsize showmanyc();
+ virtual int_type underflow();
+
+ virtual int_type pbackfail(int_type = traits_type::eof());
+ virtual int_type overflow(int_type = traits_type::eof());
+
+ virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize);
+ virtual pos_type seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type,
+ ios_base::openmode = ios_base::in | ios_base::out);
+
+ virtual int sync();
+ virtual void imbue(const locale&);
+
+private: // Helper functions.
+
+ // Precondition: we are currently in putback input mode. Effect:
+ // switches back to ordinary input mode.
+ void _M_exit_putback_mode() {
+ this->setg(_M_saved_eback, _M_saved_gptr, _M_saved_egptr);
+ _M_in_putback_mode = false;
+ }
+ bool _M_switch_to_input_mode();
+ void _M_exit_input_mode();
+ bool _M_switch_to_output_mode();
+
+ int_type _M_input_error();
+ int_type _M_underflow_aux();
+ friend class _Underflow<_CharT, _Traits>;
+
+ int_type _M_output_error();
+ bool _M_unshift();
+
+ bool _M_allocate_buffers(_CharT* __buf, streamsize __n);
+ bool _M_allocate_buffers();
+ void _M_deallocate_buffers();
+
+ pos_type _M_seek_return(off_type __off, _State_type __state) {
+ if (__off != -1) {
+ if (_M_in_input_mode)
+ _M_exit_input_mode();
+ _M_in_input_mode = false;
+ _M_in_output_mode = false;
+ _M_in_putback_mode = false;
+ _M_in_error_mode = false;
+ this->setg(0, 0, 0);
+ this->setp(0, 0);
+ }
+
+ pos_type __result(__off);
+ __result.state(__state);
+ return __result;
+ }
+
+ bool _M_seek_init(bool __do_unshift);
+
+ void _M_setup_codecvt(const locale&, bool __on_imbue = true);
+
+private: // Data members used in all modes.
+
+ _Filebuf_base _M_base;
+
+private: // Locale-related information.
+
+ unsigned char _M_constant_width;
+ unsigned char _M_always_noconv;
+
+ // private: // Mode flags.
+ unsigned char _M_int_buf_dynamic; // True if internal buffer is heap allocated,
+ // false if it was supplied by the user.
+ unsigned char _M_in_input_mode;
+ unsigned char _M_in_output_mode;
+ unsigned char _M_in_error_mode;
+ unsigned char _M_in_putback_mode;
+
+ // Internal buffer: characters seen by the filebuf's clients.
+ _CharT* _M_int_buf;
+ _CharT* _M_int_buf_EOS;
+
+ // External buffer: characters corresponding to the external file.
+ char* _M_ext_buf;
+ char* _M_ext_buf_EOS;
+
+ // The range [_M_ext_buf, _M_ext_buf_converted) contains the external
+ // characters corresponding to the sequence in the internal buffer. The
+ // range [_M_ext_buf_converted, _M_ext_buf_end) contains characters that
+ // have been read into the external buffer but have not been converted
+ // to an internal sequence.
+ char* _M_ext_buf_converted;
+ char* _M_ext_buf_end;
+
+ // State corresponding to beginning of internal buffer.
+ _State_type _M_state;
+
+private: // Data members used only in input mode.
+
+ // Similar to _M_state except that it corresponds to
+ // the end of the internal buffer instead of the beginning.
+ _State_type _M_end_state;
+
+ // This is a null pointer unless we are in mmap input mode.
+ void* _M_mmap_base;
+ streamoff _M_mmap_len;
+
+private: // Data members used only in putback mode.
+ _CharT* _M_saved_eback;
+ _CharT* _M_saved_gptr;
+ _CharT* _M_saved_egptr;
+
+ typedef codecvt<_CharT, char, _State_type> _Codecvt;
+ const _Codecvt* _M_codecvt;
+
+ int _M_width; // Width of the encoding (if constant), else 1
+ int _M_max_width; // Largest possible width of single character.
+
+
+ enum { _S_pback_buf_size = 8 };
+ _CharT _M_pback_buf[_S_pback_buf_size];
+
+ // for _Noconv_output
+public:
+ bool _M_write(char* __buf, ptrdiff_t __n) {return _M_base._M_write(__buf, __n); }
+
+public:
+ int_type
+ _M_do_noconv_input() {
+ _M_ext_buf_converted = _M_ext_buf_end;
+ /* this-> */ _Base::setg((char_type*)_M_ext_buf, (char_type*)_M_ext_buf, (char_type*)_M_ext_buf_end);
+ return traits_type::to_int_type(*_M_ext_buf);
+ }
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_filebuf<char, char_traits<char> >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_filebuf<wchar_t, char_traits<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+//
+// This class had to be designed very carefully to work
+// with Visual C++.
+//
+template <class _Traits>
+class _Noconv_output {
+public:
+ typedef typename _Traits::char_type char_type;
+ static bool _STLP_CALL _M_doit(basic_filebuf<char_type, _Traits >*,
+ char_type*, char_type*)
+ { return false; }
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC _Noconv_output< char_traits<char> > {
+public:
+ static bool _STLP_CALL
+ _M_doit(basic_filebuf<char, char_traits<char> >* __buf,
+ char* __first, char* __last) {
+ ptrdiff_t __n = __last - __first;
+ return (__buf->_M_write(__first, __n));
+ }
+};
+
+//----------------------------------------------------------------------
+// basic_filebuf<> helper functions.
+
+
+//----------------------------------------
+// Helper functions for switching between modes.
+
+//
+// This class had to be designed very carefully to work
+// with Visual C++.
+//
+template <class _Traits>
+class _Noconv_input {
+public:
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::char_type char_type;
+
+ static inline int_type _STLP_CALL
+ _M_doit(basic_filebuf<char_type, _Traits>*)
+ { return _Traits::eof(); }
+};
+
+_STLP_TEMPLATE_NULL
+class _Noconv_input<char_traits<char> > {
+public:
+ static inline int _STLP_CALL
+ _M_doit(basic_filebuf<char, char_traits<char> >* __buf) {
+ return __buf->_M_do_noconv_input();
+ }
+};
+
+// underflow() may be called for one of two reasons. (1) We've
+// been going through the special putback buffer, and we need to move back
+// to the regular internal buffer. (2) We've exhausted the internal buffer,
+// and we need to replentish it.
+template <class _CharT, class _Traits>
+class _Underflow {
+public:
+ typedef typename _Traits::int_type int_type;
+ typedef _Traits traits_type;
+
+ // There is a specialized version of underflow, for basic_filebuf<char>,
+ // in fstream.cpp.
+ static int_type _STLP_CALL _M_doit(basic_filebuf<_CharT, _Traits>* __this) {
+ if (!__this->_M_in_input_mode) {
+ if (!__this->_M_switch_to_input_mode())
+ return traits_type::eof();
+ }
+ else if (__this->_M_in_putback_mode) {
+ __this->_M_exit_putback_mode();
+ if (__this->gptr() != __this->egptr()) {
+ int_type __c = traits_type::to_int_type(*__this->gptr());
+ return __c;
+ }
+ }
+
+ return __this->_M_underflow_aux();
+ }
+};
+
+// Specialization of underflow: if the character type is char, maybe
+// we can use mmap instead of read.
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC _Underflow< char, char_traits<char> >
+{
+ public:
+ typedef char_traits<char>::int_type int_type;
+ typedef char_traits<char> traits_type;
+ static int_type _STLP_CALL _M_doit(basic_filebuf<char, traits_type >* __this);
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS _Underflow<wchar_t, char_traits<wchar_t> >;
+#endif
+
+//----------------------------------------------------------------------
+// Class basic_ifstream<>
+
+template <class _CharT, class _Traits>
+class basic_ifstream : public basic_istream<_CharT, _Traits> {
+public: // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_istream<_CharT, _Traits> _Base;
+ typedef basic_filebuf<_CharT, _Traits> _Buf;
+
+public: // Constructors, destructor.
+
+ basic_ifstream() :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ }
+
+ explicit basic_ifstream(const char* __s, ios_base::openmode __mod = ios_base::in) :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0),
+ _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __mod | ios_base::in))
+ this->setstate(ios_base::failbit);
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ explicit basic_ifstream(int __id, ios_base::openmode __mod = ios_base::in) :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod | ios_base::in))
+ this->setstate(ios_base::failbit);
+ }
+ basic_ifstream(const char* __s, ios_base::openmode __m,
+ long __protection) :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __m | ios_base::in, __protection))
+ this->setstate(ios_base::failbit);
+ }
+
+# if defined (_STLP_USE_WIN32_IO)
+ explicit basic_ifstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::in) :
+ basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod | ios_base::in))
+ this->setstate(ios_base::failbit);
+ }
+# endif /* _STLP_USE_WIN32_IO */
+#endif
+
+ ~basic_ifstream() {}
+
+public: // File and buffer operations.
+ basic_filebuf<_CharT, _Traits>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ bool is_open() {
+ return this->rdbuf()->is_open();
+ }
+
+ void open(const char* __s, ios_base::openmode __mod = ios_base::in) {
+ if (!this->rdbuf()->open(__s, __mod | ios_base::in))
+ this->setstate(ios_base::failbit);
+ }
+
+ void close() {
+ if (!this->rdbuf()->close())
+ this->setstate(ios_base::failbit);
+ }
+
+private:
+ basic_filebuf<_CharT, _Traits> _M_buf;
+};
+
+
+//----------------------------------------------------------------------
+// Class basic_ofstream<>
+
+template <class _CharT, class _Traits>
+class basic_ofstream : public basic_ostream<_CharT, _Traits> {
+public: // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_ostream<_CharT, _Traits> _Base;
+ typedef basic_filebuf<_CharT, _Traits> _Buf;
+
+public: // Constructors, destructor.
+ basic_ofstream() :
+ basic_ios<_CharT, _Traits>(),
+ basic_ostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ }
+ explicit basic_ofstream(const char* __s, ios_base::openmode __mod = ios_base::out)
+ : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __mod | ios_base::out))
+ this->setstate(ios_base::failbit);
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ explicit basic_ofstream(int __id, ios_base::openmode __mod = ios_base::out)
+ : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0),
+ _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod | ios_base::out))
+ this->setstate(ios_base::failbit);
+ }
+ basic_ofstream(const char* __s, ios_base::openmode __m, long __protection) :
+ basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __m | ios_base::out, __protection))
+ this->setstate(ios_base::failbit);
+ }
+# if defined (_STLP_USE_WIN32_IO)
+ explicit basic_ofstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::out)
+ : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0),
+ _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod | ios_base::out))
+ this->setstate(ios_base::failbit);
+ }
+# endif /* _STLP_USE_WIN32_IO */
+#endif
+
+ ~basic_ofstream() {}
+
+public: // File and buffer operations.
+ basic_filebuf<_CharT, _Traits>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ bool is_open() {
+ return this->rdbuf()->is_open();
+ }
+
+ void open(const char* __s, ios_base::openmode __mod= ios_base::out) {
+ if (!this->rdbuf()->open(__s, __mod | ios_base::out))
+ this->setstate(ios_base::failbit);
+ }
+
+ void close() {
+ if (!this->rdbuf()->close())
+ this->setstate(ios_base::failbit);
+ }
+
+private:
+ basic_filebuf<_CharT, _Traits> _M_buf;
+};
+
+
+//----------------------------------------------------------------------
+// Class basic_fstream<>
+
+template <class _CharT, class _Traits>
+class basic_fstream : public basic_iostream<_CharT, _Traits> {
+public: // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_iostream<_CharT, _Traits> _Base;
+ typedef basic_filebuf<_CharT, _Traits> _Buf;
+
+public: // Constructors, destructor.
+
+ basic_fstream()
+ : basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ }
+
+ explicit basic_fstream(const char* __s,
+ ios_base::openmode __mod = ios_base::in | ios_base::out) :
+ basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __mod))
+ this->setstate(ios_base::failbit);
+ }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+ explicit basic_fstream(int __id,
+ ios_base::openmode __mod = ios_base::in | ios_base::out) :
+ basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod))
+ this->setstate(ios_base::failbit);
+ }
+ basic_fstream(const char* __s, ios_base::openmode __m, long __protection) :
+ basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__s, __m, __protection))
+ this->setstate(ios_base::failbit);
+ }
+# if defined (_STLP_USE_WIN32_IO)
+ explicit basic_fstream(_STLP_fd __id,
+ ios_base::openmode __mod = ios_base::in | ios_base::out) :
+ basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
+ this->init(&_M_buf);
+ if (!_M_buf.open(__id, __mod))
+ this->setstate(ios_base::failbit);
+ }
+# endif /* _STLP_USE_WIN32_IO */
+#endif
+ ~basic_fstream() {}
+
+public: // File and buffer operations.
+
+ basic_filebuf<_CharT, _Traits>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ bool is_open() {
+ return this->rdbuf()->is_open();
+ }
+
+ void open(const char* __s,
+ ios_base::openmode __mod =
+ ios_base::in | ios_base::out) {
+ if (!this->rdbuf()->open(__s, __mod))
+ this->setstate(ios_base::failbit);
+ }
+
+ void close() {
+ if (!this->rdbuf()->close())
+ this->setstate(ios_base::failbit);
+ }
+
+private:
+ basic_filebuf<_CharT, _Traits> _M_buf;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ typedef basic_fstream<_CharT, _Traits> _Self;
+ //explicitely defined as private to avoid warnings:
+ basic_fstream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+};
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_fstream.c>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ifstream<char, char_traits<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_ofstream<char, char_traits<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_fstream<char, char_traits<char> >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ifstream<wchar_t, char_traits<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_ofstream<wchar_t, char_traits<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_fstream<wchar_t, char_traits<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_FSTREAM */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_function.h b/stlport/stl/_function.h
new file mode 100644
index 0000000..bf4ad3e
--- /dev/null
+++ b/stlport/stl/_function.h
@@ -0,0 +1,433 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_FUNCTION_H
+#define _STLP_INTERNAL_FUNCTION_H
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+struct not_equal_to : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; }
+};
+
+template <class _Tp>
+struct greater : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; }
+};
+
+template <class _Tp>
+struct greater_equal : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; }
+};
+
+template <class _Tp>
+struct less_equal : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; }
+};
+
+template <class _Tp>
+struct divides : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; }
+};
+
+template <class _Tp>
+struct modulus : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; }
+};
+
+template <class _Tp>
+struct negate : public unary_function<_Tp, _Tp> {
+ _Tp operator()(const _Tp& __x) const { return -__x; }
+};
+
+template <class _Tp>
+struct logical_and : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; }
+};
+
+template <class _Tp>
+struct logical_or : public binary_function<_Tp, _Tp,bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; }
+};
+
+template <class _Tp>
+struct logical_not : public unary_function<_Tp, bool> {
+ bool operator()(const _Tp& __x) const { return !__x; }
+};
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// identity_element (not part of the C++ standard).
+template <class _Tp> inline _Tp identity_element(plus<_Tp>) { return _Tp(0); }
+template <class _Tp> inline _Tp identity_element(multiplies<_Tp>) { return _Tp(1); }
+#endif
+
+#if defined (_STLP_BASE_TYPEDEF_BUG)
+// this workaround is needed for SunPro 4.0.1
+// suggested by "Martin Abernethy" <gma@paston.co.uk>:
+
+// We have to introduce the XXary_predicate_aux structures in order to
+// access the argument and return types of predicate functions supplied
+// as type parameters. SUN C++ 4.0.1 compiler gives errors for template type parameters
+// of the form 'name1::name2', where name1 is itself a type parameter.
+template <class _Pair>
+struct __pair_aux : private _Pair {
+ typedef typename _Pair::first_type first_type;
+ typedef typename _Pair::second_type second_type;
+};
+
+template <class _Operation>
+struct __unary_fun_aux : private _Operation {
+ typedef typename _Operation::argument_type argument_type;
+ typedef typename _Operation::result_type result_type;
+};
+
+template <class _Operation>
+struct __binary_fun_aux : private _Operation {
+ typedef typename _Operation::first_argument_type first_argument_type;
+ typedef typename _Operation::second_argument_type second_argument_type;
+ typedef typename _Operation::result_type result_type;
+};
+
+# define __UNARY_ARG(__Operation,__type) __unary_fun_aux<__Operation>::__type
+# define __BINARY_ARG(__Operation,__type) __binary_fun_aux<__Operation>::__type
+# define __PAIR_ARG(__Pair,__type) __pair_aux<__Pair>::__type
+#else
+# define __UNARY_ARG(__Operation,__type) __Operation::__type
+# define __BINARY_ARG(__Operation,__type) __Operation::__type
+# define __PAIR_ARG(__Pair,__type) __Pair::__type
+#endif
+
+template <class _Predicate>
+class unary_negate
+ : public unary_function<typename __UNARY_ARG(_Predicate, argument_type), bool> {
+ typedef unary_function<typename __UNARY_ARG(_Predicate, argument_type), bool> _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+private:
+ typedef typename __call_traits<argument_type>::const_param_type _ArgParamType;
+protected:
+ _Predicate _M_pred;
+public:
+ explicit unary_negate(const _Predicate& __x) : _M_pred(__x) {}
+ bool operator()(_ArgParamType __x) const {
+ return !_M_pred(__x);
+ }
+};
+
+template <class _Predicate>
+inline unary_negate<_Predicate>
+not1(const _Predicate& __pred) {
+ return unary_negate<_Predicate>(__pred);
+}
+
+template <class _Predicate>
+class binary_negate
+ : public binary_function<typename __BINARY_ARG(_Predicate, first_argument_type),
+ typename __BINARY_ARG(_Predicate, second_argument_type),
+ bool> {
+ typedef binary_function<typename __BINARY_ARG(_Predicate, first_argument_type),
+ typename __BINARY_ARG(_Predicate, second_argument_type),
+ bool> _Base;
+public:
+ typedef typename _Base::first_argument_type first_argument_type;
+ typedef typename _Base::second_argument_type second_argument_type;
+private:
+ typedef typename __call_traits<first_argument_type>::const_param_type _FstArgParamType;
+ typedef typename __call_traits<second_argument_type>::const_param_type _SndArgParamType;
+protected:
+ _Predicate _M_pred;
+public:
+ explicit binary_negate(const _Predicate& __x) : _M_pred(__x) {}
+ bool operator()(_FstArgParamType __x, _SndArgParamType __y) const {
+ return !_M_pred(__x, __y);
+ }
+};
+
+template <class _Predicate>
+inline binary_negate<_Predicate>
+not2(const _Predicate& __pred) {
+ return binary_negate<_Predicate>(__pred);
+}
+
+template <class _Operation>
+class binder1st :
+ public unary_function<typename __BINARY_ARG(_Operation, second_argument_type),
+ typename __BINARY_ARG(_Operation, result_type) > {
+ typedef unary_function<typename __BINARY_ARG(_Operation, second_argument_type),
+ typename __BINARY_ARG(_Operation, result_type) > _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+ typedef typename _Base::result_type result_type;
+private:
+ typedef typename __call_traits<argument_type>::param_type _ArgParamType;
+ typedef typename __call_traits<argument_type>::const_param_type _ConstArgParamType;
+ typedef typename __call_traits<typename _Operation::first_argument_type>::const_param_type _ValueParamType;
+protected:
+ //op is a Standard name (20.3.6.1), do no make it STLport naming convention compliant.
+ _Operation op;
+ typename _Operation::first_argument_type _M_value;
+public:
+ binder1st(const _Operation& __x, _ValueParamType __y)
+ : op(__x), _M_value(__y) {}
+
+ result_type operator()(_ConstArgParamType __x) const
+ { return op(_M_value, __x); }
+ // DR 109 Missing binders for non-const sequence elements
+ result_type operator()(_ArgParamType __x) const
+ { return op(_M_value, __x); }
+};
+
+template <class _Operation, class _Tp>
+inline binder1st<_Operation>
+bind1st(const _Operation& __fn, const _Tp& __x) {
+ typedef typename _Operation::first_argument_type _Arg1_type;
+ return binder1st<_Operation>(__fn, _Arg1_type(__x));
+}
+
+template <class _Operation>
+class binder2nd
+ : public unary_function<typename __BINARY_ARG(_Operation, first_argument_type),
+ typename __BINARY_ARG(_Operation, result_type)> {
+ typedef unary_function<typename __BINARY_ARG(_Operation, first_argument_type),
+ typename __BINARY_ARG(_Operation, result_type)> _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+ typedef typename _Base::result_type result_type;
+private:
+ typedef typename __call_traits<argument_type>::param_type _ArgParamType;
+ typedef typename __call_traits<argument_type>::const_param_type _ConstArgParamType;
+ typedef typename __call_traits<typename _Operation::second_argument_type>::const_param_type _ValueParamType;
+protected:
+ //op is a Standard name (20.3.6.3), do no make it STLport naming convention compliant.
+ _Operation op;
+ typename _Operation::second_argument_type value;
+public:
+ binder2nd(const _Operation& __x, _ValueParamType __y)
+ : op(__x), value(__y) {}
+
+ result_type operator()(_ConstArgParamType __x) const
+ { return op(__x, value); }
+ // DR 109 Missing binders for non-const sequence elements
+ result_type operator()(_ArgParamType __x) const
+ { return op(__x, value); }
+};
+
+template <class _Operation, class _Tp>
+inline binder2nd<_Operation>
+bind2nd(const _Operation& __fn, const _Tp& __x) {
+ typedef typename _Operation::second_argument_type _Arg2_type;
+ return binder2nd<_Operation>(__fn, _Arg2_type(__x));
+}
+
+#if !defined (_STLP_NO_EXTENSIONS)
+// unary_compose and binary_compose (extensions, not part of the standard).
+
+template <class _Operation1, class _Operation2>
+class unary_compose :
+ public unary_function<typename __UNARY_ARG(_Operation2, argument_type),
+ typename __UNARY_ARG(_Operation1, result_type)> {
+ typedef unary_function<typename __UNARY_ARG(_Operation2, argument_type),
+ typename __UNARY_ARG(_Operation1, result_type)> _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+ typedef typename _Base::result_type result_type;
+private:
+ typedef typename __call_traits<argument_type>::const_param_type _ArgParamType;
+protected:
+ _Operation1 _M_fn1;
+ _Operation2 _M_fn2;
+public:
+ unary_compose(const _Operation1& __x, const _Operation2& __y)
+ : _M_fn1(__x), _M_fn2(__y) {}
+
+ result_type operator()(_ArgParamType __x) const {
+ return _M_fn1(_M_fn2(__x));
+ }
+};
+
+template <class _Operation1, class _Operation2>
+inline unary_compose<_Operation1,_Operation2>
+compose1(const _Operation1& __fn1, const _Operation2& __fn2) {
+ return unary_compose<_Operation1,_Operation2>(__fn1, __fn2);
+}
+
+template <class _Operation1, class _Operation2, class _Operation3>
+class binary_compose :
+ public unary_function<typename __UNARY_ARG(_Operation2, argument_type),
+ typename __BINARY_ARG(_Operation1, result_type)> {
+ typedef unary_function<typename __UNARY_ARG(_Operation2, argument_type),
+ typename __BINARY_ARG(_Operation1, result_type)> _Base;
+public:
+ typedef typename _Base::argument_type argument_type;
+ typedef typename _Base::result_type result_type;
+private:
+ typedef typename __call_traits<argument_type>::const_param_type _ArgParamType;
+protected:
+ _Operation1 _M_fn1;
+ _Operation2 _M_fn2;
+ _Operation3 _M_fn3;
+public:
+ binary_compose(const _Operation1& __x, const _Operation2& __y,
+ const _Operation3& __z)
+ : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
+
+ result_type operator()(_ArgParamType __x) const {
+ return _M_fn1(_M_fn2(__x), _M_fn3(__x));
+ }
+};
+
+template <class _Operation1, class _Operation2, class _Operation3>
+inline binary_compose<_Operation1, _Operation2, _Operation3>
+compose2(const _Operation1& __fn1, const _Operation2& __fn2,
+ const _Operation3& __fn3) {
+ return binary_compose<_Operation1,_Operation2,_Operation3>(__fn1, __fn2, __fn3);
+}
+
+// identity is an extension: it is not part of the standard.
+template <class _Tp> struct identity : public _STLP_PRIV _Identity<_Tp> {};
+// select1st and select2nd are extensions: they are not part of the standard.
+template <class _Pair> struct select1st : public _STLP_PRIV _Select1st<_Pair> {};
+template <class _Pair> struct select2nd : public _STLP_PRIV _Select2nd<_Pair> {};
+
+template <class _Arg1, class _Arg2>
+struct project1st : public _STLP_PRIV _Project1st<_Arg1, _Arg2> {};
+
+template <class _Arg1, class _Arg2>
+struct project2nd : public _STLP_PRIV _Project2nd<_Arg1, _Arg2> {};
+
+
+// constant_void_fun, constant_unary_fun, and constant_binary_fun are
+// extensions: they are not part of the standard. (The same, of course,
+// is true of the helper functions constant0, constant1, and constant2.)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Result>
+struct _Constant_void_fun {
+ typedef _Result result_type;
+ result_type _M_val;
+
+ _Constant_void_fun(const result_type& __v) : _M_val(__v) {}
+ const result_type& operator()() const { return _M_val; }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Result>
+struct constant_void_fun : public _STLP_PRIV _Constant_void_fun<_Result> {
+ constant_void_fun(const _Result& __v)
+ : _STLP_PRIV _Constant_void_fun<_Result>(__v) {}
+};
+
+template <class _Result, _STLP_DFL_TMPL_PARAM( _Argument , _Result) >
+struct constant_unary_fun : public _STLP_PRIV _Constant_unary_fun<_Result, _Argument> {
+ constant_unary_fun(const _Result& __v)
+ : _STLP_PRIV _Constant_unary_fun<_Result, _Argument>(__v) {}
+};
+
+template <class _Result, _STLP_DFL_TMPL_PARAM( _Arg1 , _Result), _STLP_DFL_TMPL_PARAM( _Arg2 , _Arg1) >
+struct constant_binary_fun
+ : public _STLP_PRIV _Constant_binary_fun<_Result, _Arg1, _Arg2> {
+ constant_binary_fun(const _Result& __v)
+ : _STLP_PRIV _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
+};
+
+template <class _Result>
+inline constant_void_fun<_Result> constant0(const _Result& __val) {
+ return constant_void_fun<_Result>(__val);
+}
+
+template <class _Result>
+inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val) {
+ return constant_unary_fun<_Result,_Result>(__val);
+}
+
+template <class _Result>
+inline constant_binary_fun<_Result,_Result,_Result>
+constant2(const _Result& __val) {
+ return constant_binary_fun<_Result,_Result,_Result>(__val);
+}
+
+// subtractive_rng is an extension: it is not part of the standard.
+// Note: this code assumes that int is 32 bits.
+class subtractive_rng : public unary_function<_STLP_UINT32_T, _STLP_UINT32_T> {
+private:
+ _STLP_UINT32_T _M_table[55];
+ _STLP_UINT32_T _M_index1;
+ _STLP_UINT32_T _M_index2;
+public:
+ _STLP_UINT32_T operator()(_STLP_UINT32_T __limit) {
+ _M_index1 = (_M_index1 + 1) % 55;
+ _M_index2 = (_M_index2 + 1) % 55;
+ _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
+ return _M_table[_M_index1] % __limit;
+ }
+
+ void _M_initialize(_STLP_UINT32_T __seed) {
+ _STLP_UINT32_T __k = 1;
+ _M_table[54] = __seed;
+ _STLP_UINT32_T __i;
+ for (__i = 0; __i < 54; __i++) {
+ _STLP_UINT32_T __ii = (21 * (__i + 1) % 55) - 1;
+ _M_table[__ii] = __k;
+ __k = __seed - __k;
+ __seed = _M_table[__ii];
+ }
+ for (int __loop = 0; __loop < 4; __loop++) {
+ for (__i = 0; __i < 55; __i++)
+ _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
+ }
+ _M_index1 = 0;
+ _M_index2 = 31;
+ }
+
+ subtractive_rng(unsigned int __seed) { _M_initialize(__seed); }
+ subtractive_rng() { _M_initialize(161803398ul); }
+};
+
+#endif /* _STLP_NO_EXTENSIONS */
+
+_STLP_END_NAMESPACE
+
+#include <stl/_function_adaptors.h>
+
+#endif /* _STLP_INTERNAL_FUNCTION_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_function_adaptors.h b/stlport/stl/_function_adaptors.h
new file mode 100644
index 0000000..0da419b
--- /dev/null
+++ b/stlport/stl/_function_adaptors.h
@@ -0,0 +1,783 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * Copyright (c) 2000
+ * Pavel Kuznetsov
+ *
+ * Copyright (c) 2001
+ * Meridian'93
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+// This file has noo macro protection as it is meant to be included several times
+// from other header.
+// Adaptor function objects: pointers to member functions.
+
+// There are a total of 16 = 2^4 function objects in this family.
+// (1) Member functions taking no arguments vs member functions taking
+// one argument.
+// (2) Call through pointer vs call through reference.
+// (3) Member function with void return type vs member function with
+// non-void return type.
+// (4) Const vs non-const member function.
+
+// Note that choice (3) is nothing more than a workaround: according
+// to the draft, compilers should handle void and non-void the same way.
+// This feature is not yet widely implemented, though. You can only use
+// member functions returning void if your compiler supports partial
+// specialization.
+
+// All of this complexity is in the function objects themselves. You can
+// ignore it by using the helper function mem_fun and mem_fun_ref,
+// which create whichever type of adaptor is appropriate.
+
+_STLP_BEGIN_NAMESPACE
+
+//This implementation will only be used if needed, that is to say when there is the return void bug
+//and when there is no partial template specialization
+#if defined (_STLP_DONT_RETURN_VOID) && defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+
+template<class _Result, class _Tp>
+class _Mem_fun0_ptr : public unary_function<_Tp*, _Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) ();
+ explicit _Mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(_Tp* __p) const { return (__p->*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp, class _Arg>
+class _Mem_fun1_ptr : public binary_function<_Tp*,_Arg,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) (_Arg);
+ explicit _Mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp>
+class _Const_mem_fun0_ptr : public unary_function<const _Tp*,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) () const;
+ explicit _Const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(const _Tp* __p) const { return (__p->*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp, class _Arg>
+class _Const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) (_Arg) const;
+ explicit _Const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(const _Tp* __p, _Arg __x) const {
+ return (__p->*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp>
+class _Mem_fun0_ref : public unary_function<_Tp,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) ();
+ explicit _Mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(_Tp& __p) const { return (__p.*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp, class _Arg>
+class _Mem_fun1_ref : public binary_function<_Tp,_Arg,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) (_Arg);
+ explicit _Mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(_Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp>
+class _Const_mem_fun0_ref : public unary_function<_Tp,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) () const;
+ explicit _Const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(const _Tp& __p) const { return (__p.*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result, class _Tp, class _Arg>
+class _Const_mem_fun1_ref : public binary_function<_Tp,_Arg,_Result> {
+protected:
+ typedef _Result (_Tp::*__fun_type) (_Arg) const;
+ explicit _Const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator ()(const _Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result>
+struct _Mem_fun_traits {
+ template<class _Tp>
+ struct _Args0 {
+ typedef _Mem_fun0_ptr<_Result,_Tp> _Ptr;
+ typedef _Const_mem_fun0_ptr<_Result,_Tp> _Ptr_const;
+ typedef _Mem_fun0_ref<_Result,_Tp> _Ref;
+ typedef _Const_mem_fun0_ref<_Result,_Tp> _Ref_const;
+ };
+
+ template<class _Tp, class _Arg>
+ struct _Args1 {
+ typedef _Mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr;
+ typedef _Const_mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr_const;
+ typedef _Mem_fun1_ref<_Result,_Tp,_Arg> _Ref;
+ typedef _Const_mem_fun1_ref<_Result,_Tp,_Arg> _Ref_const;
+ };
+};
+
+template<class _Arg, class _Result>
+class _Ptr_fun1_base : public unary_function<_Arg, _Result> {
+protected:
+ typedef _Result (*__fun_type) (_Arg);
+ explicit _Ptr_fun1_base(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator()(_Arg __x) const { return _M_f(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+class _Ptr_fun2_base : public binary_function<_Arg1,_Arg2,_Result> {
+protected:
+ typedef _Result (*__fun_type) (_Arg1, _Arg2);
+ explicit _Ptr_fun2_base(__fun_type __f) : _M_f(__f) {}
+
+public:
+ _Result operator()(_Arg1 __x, _Arg2 __y) const { return _M_f(__x, __y); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Result>
+struct _Ptr_fun_traits {
+ template<class _Arg> struct _Args1 {
+ typedef _Ptr_fun1_base<_Arg,_Result> _Fun;
+ };
+
+ template<class _Arg1, class _Arg2> struct _Args2 {
+ typedef _Ptr_fun2_base<_Arg1,_Arg2,_Result> _Fun;
+ };
+};
+
+/* Specializations for void return type */
+template<class _Tp>
+class _Void_mem_fun0_ptr : public unary_function<_Tp*,void> {
+protected:
+ typedef void (_Tp::*__fun_type) ();
+ explicit _Void_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(_Tp* __p) const { (__p->*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp, class _Arg>
+class _Void_mem_fun1_ptr : public binary_function<_Tp*,_Arg,void> {
+protected:
+ typedef void (_Tp::*__fun_type) (_Arg);
+ explicit _Void_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp>
+class _Void_const_mem_fun0_ptr : public unary_function<const _Tp*,void> {
+protected:
+ typedef void (_Tp::*__fun_type) () const;
+ explicit _Void_const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(const _Tp* __p) const { (__p->*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp, class _Arg>
+class _Void_const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,void> {
+protected:
+ typedef void (_Tp::*__fun_type) (_Arg) const;
+ explicit _Void_const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp>
+class _Void_mem_fun0_ref : public unary_function<_Tp,void> {
+protected:
+ typedef void (_Tp::*__fun_type) ();
+ explicit _Void_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(_Tp& __p) const { (__p.*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp, class _Arg>
+class _Void_mem_fun1_ref : public binary_function<_Tp,_Arg,void> {
+protected:
+ typedef void (_Tp::*__fun_type) (_Arg);
+ explicit _Void_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(_Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp>
+class _Void_const_mem_fun0_ref : public unary_function<_Tp,void> {
+protected:
+ typedef void (_Tp::*__fun_type) () const;
+ explicit _Void_const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(const _Tp& __p) const { (__p.*_M_f)(); }
+
+private:
+ __fun_type _M_f;
+};
+
+template<class _Tp, class _Arg>
+class _Void_const_mem_fun1_ref : public binary_function<_Tp,_Arg,void> {
+protected:
+ typedef void (_Tp::*__fun_type) (_Arg) const;
+ explicit _Void_const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator ()(const _Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+_STLP_TEMPLATE_NULL
+struct _Mem_fun_traits<void> {
+ template<class _Tp> struct _Args0 {
+ typedef _Void_mem_fun0_ptr<_Tp> _Ptr;
+ typedef _Void_const_mem_fun0_ptr<_Tp> _Ptr_const;
+ typedef _Void_mem_fun0_ref<_Tp> _Ref;
+ typedef _Void_const_mem_fun0_ref<_Tp> _Ref_const;
+ };
+
+ template<class _Tp, class _Arg> struct _Args1 {
+ typedef _Void_mem_fun1_ptr<_Tp,_Arg> _Ptr;
+ typedef _Void_const_mem_fun1_ptr<_Tp,_Arg> _Ptr_const;
+ typedef _Void_mem_fun1_ref<_Tp,_Arg> _Ref;
+ typedef _Void_const_mem_fun1_ref<_Tp,_Arg> _Ref_const;
+ };
+};
+
+template<class _Arg>
+class _Ptr_void_fun1_base : public unary_function<_Arg, void> {
+protected:
+ typedef void (*__fun_type) (_Arg);
+ explicit _Ptr_void_fun1_base(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator()(_Arg __x) const { _M_f(__x); }
+
+private:
+ __fun_type _M_f;
+};
+
+template <class _Arg1, class _Arg2>
+class _Ptr_void_fun2_base : public binary_function<_Arg1,_Arg2,void> {
+protected:
+ typedef void (*__fun_type) (_Arg1, _Arg2);
+ explicit _Ptr_void_fun2_base(__fun_type __f) : _M_f(__f) {}
+
+public:
+ void operator()(_Arg1 __x, _Arg2 __y) const { _M_f(__x, __y); }
+
+private:
+ __fun_type _M_f;
+};
+
+_STLP_TEMPLATE_NULL
+struct _Ptr_fun_traits<void> {
+ template<class _Arg> struct _Args1 {
+ typedef _Ptr_void_fun1_base<_Arg> _Fun;
+ };
+
+ template<class _Arg1, class _Arg2> struct _Args2 {
+ typedef _Ptr_void_fun2_base<_Arg1,_Arg2> _Fun;
+ };
+};
+
+// pavel: need extra level of inheritance here since MSVC++ does not
+// accept traits-based fake partial specialization for template
+// arguments other than first
+
+template<class _Result, class _Arg>
+class _Ptr_fun1 :
+ public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun {
+protected:
+ typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun _Base;
+ explicit _Ptr_fun1(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template<class _Result, class _Arg1, class _Arg2>
+class _Ptr_fun2 :
+ public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun {
+protected:
+ typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun _Base;
+ explicit _Ptr_fun2(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp>
+class mem_fun_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr _Base;
+public:
+ explicit mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp>
+class const_mem_fun_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const _Base;
+public:
+ explicit const_mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp>
+class mem_fun_ref_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref _Base;
+public:
+ explicit mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp>
+class const_mem_fun_ref_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const _Base;
+public:
+ explicit const_mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp, class _Arg>
+class mem_fun1_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr _Base;
+public:
+ explicit mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp, class _Arg>
+class const_mem_fun1_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const _Base;
+public:
+ explicit const_mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp, class _Arg>
+class mem_fun1_ref_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref _Base;
+public:
+ explicit mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Result, class _Tp, class _Arg>
+class const_mem_fun1_ref_t :
+ public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const {
+ typedef typename
+ _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const _Base;
+public:
+ explicit const_mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
+};
+
+template <class _Arg, class _Result>
+class pointer_to_unary_function :
+ public _Ptr_fun1<_Result,_Arg> {
+ typedef typename
+ _Ptr_fun1<_Result,_Arg>::__fun_type __fun_type;
+public:
+ explicit pointer_to_unary_function(__fun_type __f)
+ : _Ptr_fun1<_Result,_Arg>(__f) {}
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+class pointer_to_binary_function :
+ public _Ptr_fun2<_Result,_Arg1,_Arg2> {
+ typedef typename
+ _Ptr_fun2<_Result,_Arg1,_Arg2>::__fun_type __fun_type;
+public:
+ explicit pointer_to_binary_function(__fun_type __f)
+ : _Ptr_fun2<_Result,_Arg1,_Arg2>(__f) {}
+};
+
+#else
+
+template <class _Ret, class _Tp>
+class mem_fun_t : public unary_function<_Tp*,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(void);
+public:
+ explicit mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp>
+class const_mem_fun_t : public unary_function<const _Tp*,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(void) const;
+public:
+ explicit const_mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp>
+class mem_fun_ref_t : public unary_function<_Tp,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(void);
+public:
+ explicit mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp>
+class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(void) const;
+public:
+ explicit const_mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp, class _Arg>
+class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(_Arg);
+public:
+ explicit mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp, class _Arg>
+class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(_Arg) const;
+public:
+ explicit const_mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(const _Tp* __p, _Arg __x) const
+ { return (__p->*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp, class _Arg>
+class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(_Arg);
+public:
+ explicit mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Ret, class _Tp, class _Arg>
+class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
+ typedef _Ret (_Tp::*__fun_type)(_Arg) const;
+public:
+ explicit const_mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
+ _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Arg, class _Result>
+class pointer_to_unary_function : public unary_function<_Arg, _Result> {
+protected:
+ _Result (*_M_ptr)(_Arg);
+public:
+ pointer_to_unary_function() {}
+ explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {}
+ _Result operator()(_Arg __x) const { return _M_ptr(__x); }
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+class pointer_to_binary_function :
+ public binary_function<_Arg1,_Arg2,_Result> {
+protected:
+ _Result (*_M_ptr)(_Arg1, _Arg2);
+public:
+ pointer_to_binary_function() {}
+ explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))
+ : _M_ptr(__x) {}
+ _Result operator()(_Arg1 __x, _Arg2 __y) const {
+ return _M_ptr(__x, __y);
+ }
+};
+
+# if defined (_STLP_DONT_RETURN_VOID) && !defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION)
+//Partial specializations for the void type
+template <class _Tp>
+class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {
+ typedef void (_Tp::*__fun_type)(void);
+public:
+ explicit mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp* __p) const { (__p->*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp>
+class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> {
+ typedef void (_Tp::*__fun_type)(void) const;
+public:
+ explicit const_mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(const _Tp* __p) const { (__p->*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp>
+class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
+ typedef void (_Tp::*__fun_type)(void);
+public:
+ explicit mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp& __r) const { (__r.*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp>
+class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
+ typedef void (_Tp::*__fun_type)(void) const;
+public:
+ explicit const_mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(const _Tp& __r) const { (__r.*_M_f)(); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> {
+ typedef void (_Tp::*__fun_type)(_Arg);
+public:
+ explicit mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+class const_mem_fun1_t<void, _Tp, _Arg>
+ : public binary_function<const _Tp*,_Arg,void> {
+ typedef void (_Tp::*__fun_type)(_Arg) const;
+public:
+ explicit const_mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+class mem_fun1_ref_t<void, _Tp, _Arg>
+ : public binary_function<_Tp,_Arg,void> {
+ typedef void (_Tp::*__fun_type)(_Arg);
+public:
+ explicit mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+class const_mem_fun1_ref_t<void, _Tp, _Arg>
+ : public binary_function<_Tp,_Arg,void> {
+ typedef void (_Tp::*__fun_type)(_Arg) const;
+public:
+ explicit const_mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
+ void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
+private:
+ __fun_type _M_f;
+};
+
+template <class _Arg>
+class pointer_to_unary_function<_Arg, void> : public unary_function<_Arg, void> {
+ typedef void (*__fun_type)(_Arg);
+ __fun_type _M_ptr;
+public:
+ pointer_to_unary_function() {}
+ explicit pointer_to_unary_function(__fun_type __x) : _M_ptr(__x) {}
+ void operator()(_Arg __x) const { _M_ptr(__x); }
+};
+
+template <class _Arg1, class _Arg2>
+class pointer_to_binary_function<_Arg1, _Arg2, void> : public binary_function<_Arg1,_Arg2,void> {
+ typedef void (*__fun_type)(_Arg1, _Arg2);
+ __fun_type _M_ptr;
+public:
+ pointer_to_binary_function() {}
+ explicit pointer_to_binary_function(__fun_type __x) : _M_ptr(__x) {}
+ void operator()(_Arg1 __x, _Arg2 __y) const { _M_ptr(__x, __y); }
+};
+
+# endif
+
+#endif
+
+#if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
+// Mem_fun adaptor helper functions. There are only two:
+// mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref
+// are provided for backward compatibility, but they are no longer
+// part of the C++ standard.)
+
+template <class _Result, class _Tp>
+inline mem_fun_t<_Result,_Tp>
+mem_fun(_Result (_Tp::*__f)()) { return mem_fun_t<_Result,_Tp>(__f); }
+
+template <class _Result, class _Tp>
+inline const_mem_fun_t<_Result,_Tp>
+mem_fun(_Result (_Tp::*__f)() const) { return const_mem_fun_t<_Result,_Tp>(__f); }
+
+template <class _Result, class _Tp>
+inline mem_fun_ref_t<_Result,_Tp>
+mem_fun_ref(_Result (_Tp::*__f)()) { return mem_fun_ref_t<_Result,_Tp>(__f); }
+
+template <class _Result, class _Tp>
+inline const_mem_fun_ref_t<_Result,_Tp>
+mem_fun_ref(_Result (_Tp::*__f)() const) { return const_mem_fun_ref_t<_Result,_Tp>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline mem_fun1_t<_Result,_Tp,_Arg>
+mem_fun(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline const_mem_fun1_t<_Result,_Tp,_Arg>
+mem_fun(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline mem_fun1_ref_t<_Result,_Tp,_Arg>
+mem_fun_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
+mem_fun_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
+
+# if !(defined (_STLP_NO_EXTENSIONS) || defined (_STLP_NO_ANACHRONISMS))
+// mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,
+// but they are provided for backward compatibility.
+template <class _Result, class _Tp, class _Arg>
+inline mem_fun1_t<_Result,_Tp,_Arg>
+mem_fun1(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline const_mem_fun1_t<_Result,_Tp,_Arg>
+mem_fun1(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline mem_fun1_ref_t<_Result,_Tp,_Arg>
+mem_fun1_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
+
+template <class _Result, class _Tp, class _Arg>
+inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
+mem_fun1_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
+
+# endif
+
+#endif
+
+template <class _Arg, class _Result>
+inline pointer_to_unary_function<_Arg, _Result>
+ptr_fun(_Result (*__f)(_Arg))
+{ return pointer_to_unary_function<_Arg, _Result>(__f); }
+
+template <class _Arg1, class _Arg2, class _Result>
+inline pointer_to_binary_function<_Arg1,_Arg2,_Result>
+ptr_fun(_Result (*__f)(_Arg1, _Arg2))
+{ return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f); }
+
+_STLP_END_NAMESPACE
diff --git a/stlport/stl/_function_base.h b/stlport/stl/_function_base.h
new file mode 100644
index 0000000..1e7f4f5
--- /dev/null
+++ b/stlport/stl/_function_base.h
@@ -0,0 +1,217 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+#define _STLP_INTERNAL_FUNCTION_BASE_H
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_TYPE_TRAITS_H)
+# include <stl/type_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Arg, class _Result>
+struct unary_function {
+ typedef _Arg argument_type;
+ typedef _Result result_type;
+#if !defined (__BORLANDC__) || (__BORLANDC__ < 0x580)
+protected:
+ /* This class purpose is to be derived but it is not polymorphic so users should never try
+ * to destroy an instance of it directly. The protected non-virtual destructor make this
+ * fact obvious at compilation time. */
+ ~unary_function() {}
+#endif
+};
+
+template <class _Arg1, class _Arg2, class _Result>
+struct binary_function {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
+#if !defined (__BORLANDC__) || (__BORLANDC__ < 0x580)
+protected:
+ /* See unary_function comment. */
+ ~binary_function() {}
+#endif
+};
+
+template <class _Tp>
+struct equal_to : public binary_function<_Tp, _Tp, bool> {
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; }
+};
+
+template <class _Tp>
+struct less : public binary_function<_Tp,_Tp,bool>
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/* less is the default template parameter for many STL containers, to fully use
+ * the move constructor feature we need to know that the default less is just a
+ * functor.
+ */
+ , public __stlport_class<less<_Tp> >
+#endif
+{
+ bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; }
+
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(less<_Tp>& __x) {}
+#endif
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __type_traits<less<_Tp> > {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<less<_Tp> >::_Ret _STLportLess;
+#else
+ enum { _Is = _IsSTLportClass<less<_Tp> >::_Is };
+ typedef typename __bool2type<_Is>::_Ret _STLportLess;
+#endif
+ typedef _STLportLess has_trivial_default_constructor;
+ typedef _STLportLess has_trivial_copy_constructor;
+ typedef _STLportLess has_trivial_assignment_operator;
+ typedef _STLportLess has_trivial_destructor;
+ typedef _STLportLess is_POD_type;
+};
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+less<_Tp> __less(_Tp* ) { return less<_Tp>(); }
+
+template <class _Tp>
+equal_to<_Tp> __equal_to(_Tp* ) { return equal_to<_Tp>(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp>
+struct plus : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; }
+};
+
+template <class _Tp>
+struct minus : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; }
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+plus<_Tp> __plus(_Tp* ) { return plus<_Tp>(); }
+
+template <class _Tp>
+minus<_Tp> __minus(_Tp* ) { return minus<_Tp>(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp>
+struct multiplies : public binary_function<_Tp, _Tp, _Tp> {
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; }
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Pair>
+struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> {
+ const typename _Pair::first_type& operator()(const _Pair& __x) const {
+ return __x.first;
+ }
+};
+
+template <class _Pair>
+struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> {
+ const typename _Pair::second_type& operator()(const _Pair& __x) const {
+ return __x.second;
+ }
+};
+
+// project1st and project2nd are extensions: they are not part of the standard
+template <class _Arg1, class _Arg2>
+struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> {
+ _Arg1 operator()(const _Arg1& __x, const _Arg2&) const { return __x; }
+};
+
+template <class _Arg1, class _Arg2>
+struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> {
+ _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; }
+};
+
+#if defined (_STLP_MULTI_CONST_TEMPLATE_ARG_BUG)
+// fbp : sort of select1st just for maps
+template <class _Pair, class _Whatever>
+// JDJ (CW Pro1 doesn't like const when first_type is also const)
+struct __Select1st_hint : public unary_function<_Pair, _Whatever> {
+ const _Whatever& operator () (const _Pair& __x) const { return __x.first; }
+};
+# define _STLP_SELECT1ST(__x,__y) _STLP_PRIV __Select1st_hint< __x, __y >
+#else
+# define _STLP_SELECT1ST(__x, __y) _STLP_PRIV _Select1st< __x >
+#endif
+
+template <class _Tp>
+struct _Identity : public unary_function<_Tp,_Tp> {
+ const _Tp& operator()(const _Tp& __x) const { return __x; }
+};
+
+template <class _Result, class _Argument>
+struct _Constant_unary_fun {
+ typedef _Argument argument_type;
+ typedef _Result result_type;
+ result_type _M_val;
+
+ _Constant_unary_fun(const result_type& __v) : _M_val(__v) {}
+ const result_type& operator()(const _Argument&) const { return _M_val; }
+};
+
+template <class _Result, class _Arg1, class _Arg2>
+struct _Constant_binary_fun {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
+ _Result _M_val;
+
+ _Constant_binary_fun(const _Result& __v) : _M_val(__v) {}
+ const result_type& operator()(const _Arg1&, const _Arg2&) const {
+ return _M_val;
+ }
+};
+
+// identity_element (not part of the C++ standard).
+template <class _Tp> inline _Tp __identity_element(plus<_Tp>) { return _Tp(0); }
+template <class _Tp> inline _Tp __identity_element(multiplies<_Tp>) { return _Tp(1); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_FUNCTION_BASE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_hash_fun.h b/stlport/stl/_hash_fun.h
new file mode 100644
index 0000000..6197d7b
--- /dev/null
+++ b/stlport/stl/_hash_fun.h
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 1996-1998
+ * 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 (c) 1994
+ * Hewlett-Packard Company
+ *
+ * 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. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_HASH_FUN_H
+#define _STLP_HASH_FUN_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Key> struct hash { };
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+inline size_t __stl_hash_string(const char* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ unsigned long __h = 0;
+ for ( ; *__s; ++__s)
+ __h = 5*__h + *__s;
+
+ return size_t(__h);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_TEMPLATE_NULL
+struct hash<char*> {
+ size_t operator()(const char* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _STLP_PRIV __stl_hash_string(__s);
+ }
+};
+
+_STLP_TEMPLATE_NULL
+struct hash<const char*> {
+ size_t operator()(const char* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _STLP_PRIV __stl_hash_string(__s);
+ }
+};
+
+_STLP_TEMPLATE_NULL struct hash<char> {
+ size_t operator()(char __x) const { return __x; }
+};
+_STLP_TEMPLATE_NULL struct hash<unsigned char> {
+ size_t operator()(unsigned char __x) const { return __x; }
+};
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+_STLP_TEMPLATE_NULL struct hash<signed char> {
+ size_t operator()(unsigned char __x) const { return __x; }
+};
+#endif
+_STLP_TEMPLATE_NULL struct hash<short> {
+ size_t operator()(short __x) const { return __x; }
+};
+_STLP_TEMPLATE_NULL struct hash<unsigned short> {
+ size_t operator()(unsigned short __x) const { return __x; }
+};
+_STLP_TEMPLATE_NULL struct hash<int> {
+ size_t operator()(int __x) const { return __x; }
+};
+
+#if !defined (_STLP_MSVC) || (_STLP_MSVC < 1300) || defined (_WIN64)
+_STLP_TEMPLATE_NULL struct hash<unsigned int> {
+ size_t operator()(unsigned int __x) const { return __x; }
+};
+#else
+/* MSVC .Net since 2002 has a 64 bits portability warning feature. typedef
+ * like size_t are tagged as potential 64 bits variables making them different from
+ * unsigned int. To avoid the warning when a hash container is instanciated with
+ * the size_t key we prefer to grant the size_t specialization rather than the
+ * unsigned int one.
+ */
+_STLP_TEMPLATE_NULL struct hash<size_t> {
+ size_t operator()(size_t __x) const { return __x; }
+};
+#endif
+
+_STLP_TEMPLATE_NULL struct hash<long> {
+ size_t operator()(long __x) const { return __x; }
+};
+_STLP_TEMPLATE_NULL struct hash<unsigned long> {
+ size_t operator()(unsigned long __x) const { return __x; }
+};
+
+#if defined (_STLP_LONG_LONG)
+_STLP_TEMPLATE_NULL struct hash<_STLP_LONG_LONG> {
+ size_t operator()(_STLP_LONG_LONG x) const { return (size_t)x; }
+};
+_STLP_TEMPLATE_NULL struct hash<unsigned _STLP_LONG_LONG> {
+ size_t operator()(unsigned _STLP_LONG_LONG x) const { return (size_t)x; }
+};
+#endif
+
+_STLP_TEMPLATE_NULL
+struct hash<void *>
+{
+ union __vp {
+ size_t s;
+ void *p;
+ };
+
+ size_t operator()(void *__x) const
+ {
+ __vp vp;
+ vp.p = __x;
+ return vp.s;
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_HASH_FUN_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_hash_map.h b/stlport/stl/_hash_map.h
new file mode 100644
index 0000000..cd46603
--- /dev/null
+++ b/stlport/stl/_hash_map.h
@@ -0,0 +1,500 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_HASH_MAP_H
+#define _STLP_INTERNAL_HASH_MAP_H
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMapTraitsT, traits)
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class hash_map
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+private:
+ typedef hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST key_type, data_type> value_type;
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _HashMapTraitsT<value_type> _HashMapTraits;
+
+public:
+ typedef hashtable<value_type, key_type, _HashFcn, _HashMapTraits,
+ _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
+
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_funct() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+public:
+ hash_map() : _M_ht(0, hasher(), key_equal(), allocator_type()) {}
+ explicit hash_map(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ hash_map(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+ hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hash_map(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {
+ }
+#endif
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+# endif
+ template <class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+#else
+ hash_map(const value_type* __f, const value_type* __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const value_type* __f, const value_type* __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ hash_map(const_iterator __f, const_iterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const_iterator __f, const_iterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_map(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+public:
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+public:
+ pair<iterator,bool> insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_unique(__f,__l); }
+#else
+ void insert(const value_type* __f, const value_type* __l)
+ { _M_ht.insert_unique(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+ pair<iterator,bool> insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_unique_noresize(__obj); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Tp& operator[](const _KT& __key) {
+ iterator __it = _M_ht.find(__key);
+ return (__it == _M_ht.end() ?
+ _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second :
+ (*__it).second );
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
+ void erase(iterator __it) { _M_ht.erase(__it); }
+ void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ void resize(size_type __hint) { _M_ht.resize(__hint); }
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultimapTraitsT, traits)
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class hash_multimap
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+private:
+ typedef hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST key_type, data_type> value_type;
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _HashMultimapTraitsT<value_type> _HashMultimapTraits;
+
+public:
+ typedef hashtable<value_type, key_type, _HashFcn, _HashMultimapTraits,
+ _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
+
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_funct() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+public:
+ hash_multimap() : _M_ht(0, hasher(), key_equal(), allocator_type()) {}
+ explicit hash_multimap(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ hash_multimap(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+ hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hash_multimap(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {
+ }
+#endif
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+# endif
+ template <class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+#else
+ hash_multimap(const value_type* __f, const value_type* __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const value_type* __f, const value_type* __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ hash_multimap(const_iterator __f, const_iterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const_iterator __f, const_iterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+public:
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+public:
+ iterator insert(const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_equal(__f,__l); }
+#else
+ void insert(const value_type* __f, const value_type* __l) {
+ _M_ht.insert_equal(__f,__l);
+ }
+ void insert(const_iterator __f, const_iterator __l)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+ iterator insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_equal_noresize(__obj); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator>
+ equal_range(const _KT& __key) { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator>
+ equal_range(const _KT& __key) const { return _M_ht.equal_range(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
+ void erase(iterator __it) { _M_ht.erase(__it); }
+ void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+public:
+ void resize(size_type __hint) { _M_ht.resize(__hint); }
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
+#include <stl/_relops_hash_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
+#include <stl/_relops_hash_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+struct __move_traits<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
+ _STLP_PRIV __move_traits_help<typename hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
+{};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+struct __move_traits<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
+ _STLP_PRIV __move_traits_help<typename hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
+{};
+# endif
+
+// Specialization of insert_iterator so that it will work for hash_map
+// and hash_multimap.
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
+ _Container* container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_HASH_MAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_hash_set.h b/stlport/stl/_hash_set.h
new file mode 100644
index 0000000..29b168b
--- /dev/null
+++ b/stlport/stl/_hash_set.h
@@ -0,0 +1,495 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_HASH_SET_H
+#define _STLP_INTERNAL_HASH_SET_H
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(HashSetTraitsT, Const_traits)
+
+template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class hash_set
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+ typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _HashSetTraitsT<_Value> _HashSetTraits;
+public:
+ typedef hashtable<_Value, _Value, _HashFcn,
+ _HashSetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
+public:
+ typedef typename _Ht::key_type key_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_funct() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ hash_set()
+ : _M_ht(0, hasher(), key_equal(), allocator_type()) {}
+ explicit hash_set(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ hash_set(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+#else
+ hash_set(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type()) {}
+ hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a)
+#endif
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hash_set(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+# endif
+#else
+ hash_set(const value_type* __f, const value_type* __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const value_type* __f, const value_type* __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ hash_set(const_iterator __f, const_iterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const_iterator __f, const_iterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+ hash_set(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+public:
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+public:
+ pair<iterator, bool> insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+#else
+ void insert(const_iterator __f, const_iterator __l)
+ {_M_ht.insert_unique(__f, __l); }
+ void insert(const value_type* __f, const value_type* __l)
+#endif
+ { _M_ht.insert_unique(__f,__l); }
+
+ pair<iterator, bool> insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_unique_noresize(__obj); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
+ void erase(iterator __it) { _M_ht.erase(__it); }
+ void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+public:
+ void resize(size_type __hint) { _M_ht.resize(__hint); }
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultisetTraitsT, Const_traits)
+
+template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class hash_multiset
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+ typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _HashMultisetTraitsT<_Value> _HashMultisetTraits;
+public:
+ typedef hashtable<_Value, _Value, _HashFcn,
+ _HashMultisetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
+
+ typedef typename _Ht::key_type key_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_funct() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ hash_multiset()
+ : _M_ht(0, hasher(), key_equal(), allocator_type()) {}
+ explicit hash_multiset(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ hash_multiset(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+ hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type()) {}
+ hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a)
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hash_multiset(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql)
+ : _M_ht(__n, __hf, __eql, allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+# endif
+#else
+ hash_multiset(const value_type* __f, const value_type* __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ hash_multiset(const_iterator __f, const_iterator __l)
+ : _M_ht(0, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+ hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+public:
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& hs) { _M_ht.swap(hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+public:
+ iterator insert(const value_type& __obj) { return _M_ht.insert_equal(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_equal(__f,__l); }
+#else
+ void insert(const value_type* __f, const value_type* __l)
+ { _M_ht.insert_equal(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+ iterator insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_equal_noresize(__obj); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type erase(const _KT& __key) {return _M_ht.erase(__key); }
+ void erase(iterator __it) { _M_ht.erase(__it); }
+ void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+public:
+ void resize(size_type __hint) { _M_ht.resize(__hint); }
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER hash_set<_Value,_HashFcn,_EqualKey,_Alloc>
+
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc>
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+// Specialization of insert_iterator so that it will work for hash_set
+// and hash_multiset.
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+struct __move_traits<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename hash_set<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
+{};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+struct __move_traits<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
+{};
+# endif
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
+ _Container* container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_HASH_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_hashtable.c b/stlport/stl/_hashtable.c
new file mode 100644
index 0000000..b743156
--- /dev/null
+++ b/stlport/stl/_hashtable.c
@@ -0,0 +1,553 @@
+/*
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_HASHTABLE_C
+#define _STLP_HASHTABLE_C
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+# define __PRIME_LIST_BODY { \
+ 7ul, 23ul, \
+ 53ul, 97ul, 193ul, 389ul, 769ul, \
+ 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, \
+ 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, \
+ 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, \
+ 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,\
+ 1610612741ul, 3221225473ul, 4294967291ul \
+}
+
+template <class _Dummy>
+const size_t* _STLP_CALL
+_Stl_prime<_Dummy>::_S_primes(size_t &__size) {
+ static const size_t _list[] = __PRIME_LIST_BODY;
+# ifndef __MWERKS__
+ __size = sizeof(_list) / sizeof(_list[0]);
+# else
+ __size = 30;
+# endif
+ return _list;
+}
+
+template <class _Dummy>
+size_t _STLP_CALL
+_Stl_prime<_Dummy>::_S_max_nb_buckets() {
+ size_t __size;
+ const size_t* __first = _S_primes(__size);
+ return *(__first + __size - 1);
+}
+
+template <class _Dummy>
+size_t _STLP_CALL
+_Stl_prime<_Dummy>::_S_next_size(size_t __n) {
+ size_t __size;
+ const size_t* __first = _S_primes(__size);
+ const size_t* __last = __first + __size;
+ const size_t* pos = __lower_bound(__first, __last, __n,
+ __less((size_t*)0), __less((size_t*)0), (ptrdiff_t*)0);
+ return (pos == __last ? *(__last - 1) : *pos);
+}
+
+template <class _Dummy>
+void _STLP_CALL
+_Stl_prime<_Dummy>::_S_prev_sizes(size_t __n, size_t const*&__begin, size_t const*&__pos) {
+ size_t __size;
+ __begin = _S_primes(__size);
+ const size_t* __last = __begin + __size;
+ __pos = __lower_bound(__begin, __last, __n,
+ __less((size_t*)0), __less((size_t*)0), (ptrdiff_t*)0);
+
+ if (__pos== __last)
+ --__pos;
+ else if (*__pos == __n) {
+ if (__pos != __begin)
+ --__pos;
+ }
+}
+
+# undef __PRIME_LIST_BODY
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif
+
+#if defined (_STLP_DEBUG)
+# define hashtable _STLP_NON_DBG_NAME(hashtable)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// fbp: these defines are for outline methods definitions.
+// needed to definitions to be portable. Should not be used in method bodies.
+
+#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+# define __size_type__ size_t
+# define size_type size_t
+# define value_type _Val
+# define key_type _Key
+# define __reference__ _Val&
+
+# define __iterator__ _Ht_iterator<_Val, _STLP_HEADER_TYPENAME _Traits::_NonConstTraits, \
+ _Key, _HF, _ExK, _EqK, _All>
+# define __const_iterator__ _Ht_iterator<_Val, _STLP_HEADER_TYPENAME _Traits::_ConstTraits, \
+ _Key, _HF, _ExK, _EqK, _All>
+#else
+# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::size_type
+# define __reference__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::reference
+# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::iterator
+# define __const_iterator__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::const_iterator
+#endif
+
+/*
+ * This method is too difficult to implement for hashtable that do not
+ * require a sorted operation on the stored type.
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+bool hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::_M_equal(
+ const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht1,
+ const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht2) {
+ return __ht1._M_buckets == __ht2._M_buckets &&
+ __ht1._M_elems == __ht2._M_elems;
+}
+*/
+
+/* Returns the iterator before the first iterator of the bucket __n and set
+ * __n to the first previous bucket having the same first iterator as bucket
+ * __n.
+ */
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__iterator__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_before_begin(size_type &__n) const {
+ return _S_before_begin(_M_elems, _M_buckets, __n);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__iterator__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_S_before_begin(const _ElemsCont& __elems, const _BucketVector& __buckets,
+ size_type &__n) {
+ _ElemsCont &__mutable_elems = __CONST_CAST(_ElemsCont&, __elems);
+ typename _BucketVector::const_iterator __bpos(__buckets.begin() + __n);
+
+ _ElemsIte __pos(*__bpos);
+ if (__pos == __mutable_elems.begin()) {
+ __n = 0;
+ return __mutable_elems.before_begin();
+ }
+
+ typename _BucketVector::const_iterator __bcur(__bpos);
+ _BucketType *__pos_node = __pos._M_node;
+ for (--__bcur; __pos_node == *__bcur; --__bcur);
+
+ __n = __bcur - __buckets.begin() + 1;
+ _ElemsIte __cur(*__bcur);
+ _ElemsIte __prev = __cur++;
+ for (; __cur != __pos; ++__prev, ++__cur);
+ return __prev;
+}
+
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__iterator__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_insert_noresize(size_type __n, const value_type& __obj) {
+ //We always insert this element as 1st in the bucket to not break
+ //the elements order as equal elements must be kept next to each other.
+ size_type __prev = __n;
+ _ElemsIte __pos = _M_before_begin(__prev)._M_ite;
+
+ fill(_M_buckets.begin() + __prev, _M_buckets.begin() + __n + 1,
+ _M_elems.insert_after(__pos, __obj)._M_node);
+ ++_M_num_elements;
+ return iterator(_ElemsIte(_M_buckets[__n]));
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+pair<__iterator__, bool>
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::insert_unique_noresize(const value_type& __obj) {
+ const size_type __n = _M_bkt_num(__obj);
+ _ElemsIte __cur(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+
+ if (__cur != __last) {
+ for (; __cur != __last; ++__cur) {
+ if (_M_equals(_M_get_key(*__cur), _M_get_key(__obj))) {
+ //We check that equivalent keys have equals hash code as otherwise, on resize,
+ //equivalent value might not be in the same bucket
+ _STLP_ASSERT(_M_hash(_M_get_key(*__cur)) == _M_hash(_M_get_key(__obj)))
+ return pair<iterator, bool>(iterator(__cur), false);
+ }
+ }
+ /* Here we do not rely on the _M_insert_noresize method as we know
+ * that we cannot break element orders, elements are unique, and
+ * insertion after the first bucket element is faster than what is
+ * done in _M_insert_noresize.
+ */
+ __cur = _M_elems.insert_after(_ElemsIte(_M_buckets[__n]), __obj);
+ ++_M_num_elements;
+ return pair<iterator, bool>(iterator(__cur), true);
+ }
+
+ return pair<iterator, bool>(_M_insert_noresize(__n, __obj), true);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__iterator__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::insert_equal_noresize(const value_type& __obj) {
+ const size_type __n = _M_bkt_num(__obj);
+ {
+ _ElemsIte __cur(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+
+ for (; __cur != __last; ++__cur) {
+ if (_M_equals(_M_get_key(*__cur), _M_get_key(__obj))) {
+ //We check that equivalent keys have equals hash code as otherwise, on resize,
+ //equivalent value might not be in the same bucket
+ _STLP_ASSERT(_M_hash(_M_get_key(*__cur)) == _M_hash(_M_get_key(__obj)))
+ ++_M_num_elements;
+ return _M_elems.insert_after(__cur, __obj);
+ }
+ }
+ }
+
+ return _M_insert_noresize(__n, __obj);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__reference__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_insert(const value_type& __obj) {
+ _M_enlarge(_M_num_elements + 1);
+ return *insert_unique_noresize(__obj).first;
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+__size_type__
+hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::erase(const key_type& __key) {
+ const size_type __n = _M_bkt_num_key(__key);
+
+ _ElemsIte __cur(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+ if (__cur == __last)
+ return 0;
+
+ size_type __erased = 0;
+ if (_M_equals(_M_get_key(*__cur), __key)) {
+ //We look for the pos before __cur:
+ size_type __prev_b = __n;
+ _ElemsIte __prev = _M_before_begin(__prev_b)._M_ite;
+ do {
+ __cur = _M_elems.erase_after(__prev);
+ ++__erased;
+ } while ((__cur != __last) && _M_equals(_M_get_key(*__cur), __key));
+ fill(_M_buckets.begin() + __prev_b, _M_buckets.begin() + __n + 1, __cur._M_node);
+ }
+ else {
+ _ElemsIte __prev = __cur++;
+ for (; __cur != __last; ++__prev, ++__cur) {
+ if (_M_equals(_M_get_key(*__cur), __key)) {
+ do {
+ __cur = _M_elems.erase_after(__prev);
+ ++__erased;
+ } while ((__cur != __last) && _M_equals(_M_get_key(*__cur), __key));
+ break;
+ }
+ }
+ }
+
+ _M_num_elements -= __erased;
+ _M_reduce();
+ return __erased;
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::erase(const_iterator __it) {
+ const size_type __n = _M_bkt_num(*__it);
+ _ElemsIte __cur(_M_buckets[__n]);
+
+ size_type __erased = 0;
+ if (__cur == __it._M_ite) {
+ size_type __prev_b = __n;
+ _ElemsIte __prev = _M_before_begin(__prev_b)._M_ite;
+ fill(_M_buckets.begin() + __prev_b, _M_buckets.begin() + __n + 1,
+ _M_elems.erase_after(__prev)._M_node);
+ ++__erased;
+ }
+ else {
+ _ElemsIte __prev = __cur++;
+ _ElemsIte __last(_M_buckets[__n + 1]);
+ for (; __cur != __last; ++__prev, ++__cur) {
+ if (__cur == __it._M_ite) {
+ _M_elems.erase_after(__prev);
+ ++__erased;
+ break;
+ }
+ }
+ }
+
+ _M_num_elements -= __erased;
+ _M_reduce();
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::erase(const_iterator __first, const_iterator __last) {
+ if (__first == __last)
+ return;
+ size_type __f_bucket = _M_bkt_num(*__first);
+ size_type __l_bucket = __last != end() ? _M_bkt_num(*__last) : (_M_buckets.size() - 1);
+
+ _ElemsIte __cur(_M_buckets[__f_bucket]);
+ _ElemsIte __prev;
+ if (__cur == __first._M_ite) {
+ __prev = _M_before_begin(__f_bucket)._M_ite;
+ }
+ else {
+ _ElemsIte __last(_M_buckets[++__f_bucket]);
+ __prev = __cur++;
+ for (; (__cur != __last) && (__cur != __first._M_ite); ++__prev, ++__cur);
+ }
+ size_type __erased = 0;
+ //We do not use the slist::erase_after method taking a range to count the
+ //number of erased elements:
+ while (__cur != __last._M_ite) {
+ __cur = _M_elems.erase_after(__prev);
+ ++__erased;
+ }
+ fill(_M_buckets.begin() + __f_bucket, _M_buckets.begin() + __l_bucket + 1, __cur._M_node);
+ _M_num_elements -= __erased;
+ _M_reduce();
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::rehash(size_type __num_buckets_hint) {
+ if (bucket_count() >= __num_buckets_hint) {
+ // We are trying to reduce number of buckets, we have to validate it:
+ size_type __limit_num_buckets = (size_type)((float)size() / max_load_factor());
+ if (__num_buckets_hint < __limit_num_buckets) {
+ // Targetted number of buckets __num_buckets_hint would break
+ // load_factor() <= max_load_factor() rule.
+ return;
+ }
+ }
+
+ _M_rehash(__num_buckets_hint);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_enlarge(size_type __to_size) {
+ size_type __num_buckets = bucket_count();
+ size_type __num_buckets_hint = (size_type)((float)__to_size / max_load_factor());
+ if (__num_buckets_hint <= __num_buckets) {
+ return;
+ }
+ __num_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__num_buckets_hint);
+
+ _M_rehash(__num_buckets);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_reduce() {
+ size_type __num_buckets = bucket_count();
+ // We only try to reduce the hashtable if the theorical load factor
+ // is lower than a fraction of the max load factor:
+ // 4 factor is coming from the fact that prime number list is almost a
+ // geometrical suite with reason 2, as we try to jump 2 levels is means
+ // a 4 factor.
+ if ((float)size() / (float)__num_buckets > max_load_factor() / 4.0f)
+ return;
+
+ const size_type *__first;
+ const size_type *__prev;
+ _STLP_PRIV _Stl_prime_type::_S_prev_sizes(__num_buckets, __first, __prev);
+
+ /* We are only going to reduce number of buckets if moving to yet the previous number
+ * of buckets in the prime numbers would respect the load rule. Otherwise algorithm
+ * successively removing and adding an element would each time perform an expensive
+ * rehash operation. */
+ const size_type *__prev_prev = __prev;
+ if (__prev_prev != __first) {
+ --__prev_prev;
+ if ((float)size() / (float)*__prev_prev > max_load_factor())
+ return;
+ }
+ else {
+ if (*__prev >= __num_buckets)
+ return;
+ }
+
+ // Can we reduce further:
+ while (__prev_prev != __first) {
+ --__prev_prev;
+ if ((float)size() / (float)*__prev_prev > max_load_factor())
+ // We cannot reduce further.
+ break;
+ --__prev;
+ }
+
+ _M_rehash(*__prev);
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_resize() {
+ if (load_factor() > max_load_factor()) {
+ // We have to enlarge
+ _M_enlarge(size());
+ }
+ else {
+ // We can try to reduce size:
+ _M_reduce();
+ }
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_rehash(size_type __num_buckets) {
+#if defined (_STLP_DEBUG)
+ _M_check();
+#endif
+ _ElemsCont __tmp_elems(_M_elems.get_allocator());
+ _BucketVector __tmp(__num_buckets + 1, __STATIC_CAST(_BucketType*, 0), _M_buckets.get_allocator());
+ _ElemsIte __cur, __last(_M_elems.end());
+ while (!_M_elems.empty()) {
+ __cur = _M_elems.begin();
+ size_type __new_bucket = _M_bkt_num(*__cur, __num_buckets);
+ _ElemsIte __ite(__cur), __before_ite(__cur);
+ for (++__ite;
+ __ite != __last && _M_equals(_M_get_key(*__cur), _M_get_key(*__ite));
+ ++__ite, ++__before_ite);
+ size_type __prev_bucket = __new_bucket;
+ _ElemsIte __prev = _S_before_begin(__tmp_elems, __tmp, __prev_bucket)._M_ite;
+ __tmp_elems.splice_after(__prev, _M_elems, _M_elems.before_begin(), __before_ite);
+ fill(__tmp.begin() + __prev_bucket, __tmp.begin() + __new_bucket + 1, __cur._M_node);
+ }
+ _M_elems.swap(__tmp_elems);
+ _M_buckets.swap(__tmp);
+}
+
+#if defined (_STLP_DEBUG)
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::_M_check() const {
+ //We check that hash code of stored keys haven't change and also that equivalent
+ //relation hasn't been modified
+ size_t __num_buckets = bucket_count();
+ for (size_t __b = 0; __b < __num_buckets; ++__b) {
+ _ElemsIte __cur(_M_buckets[__b]), __last(_M_buckets[__b + 1]);
+ _ElemsIte __fst(__cur), __snd(__cur);
+ for (; __cur != __last; ++__cur) {
+ _STLP_ASSERT( _M_bkt_num(*__cur, __num_buckets) == __b )
+ _STLP_ASSERT( !_M_equals(_M_get_key(*__fst), _M_get_key(*__cur)) || _M_equals(_M_get_key(*__snd), _M_get_key(*__cur)) )
+ if (__fst != __snd)
+ ++__fst;
+ if (__snd != __cur)
+ ++__snd;
+ }
+ }
+}
+#endif
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::clear() {
+ _M_elems.clear();
+ _M_buckets.assign(_M_buckets.size(), __STATIC_CAST(_BucketType*, 0));
+ _M_num_elements = 0;
+}
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+ ::_M_copy_from(const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht) {
+ _M_elems.clear();
+ _M_elems.insert(_M_elems.end(), __ht._M_elems.begin(), __ht._M_elems.end());
+ _M_buckets.resize(__ht._M_buckets.size());
+ _ElemsConstIte __src(__ht._M_elems.begin()), __src_end(__ht._M_elems.end());
+ _ElemsIte __dst(_M_elems.begin());
+ typename _BucketVector::const_iterator __src_b(__ht._M_buckets.begin()),
+ __src_end_b(__ht._M_buckets.end());
+ typename _BucketVector::iterator __dst_b(_M_buckets.begin()), __dst_end_b(_M_buckets.end());
+ for (; __src != __src_end; ++__src, ++__dst) {
+ for (; __src_b != __src_end_b; ++__src_b, ++__dst_b) {
+ if (*__src_b == __src._M_node) {
+ *__dst_b = __dst._M_node;
+ }
+ else
+ break;
+ }
+ }
+ fill(__dst_b, __dst_end_b, __STATIC_CAST(_BucketType*, 0));
+ _M_num_elements = __ht._M_num_elements;
+ _M_max_load_factor = __ht._M_max_load_factor;
+}
+
+#undef __iterator__
+#undef const_iterator
+#undef __size_type__
+#undef __reference__
+#undef size_type
+#undef value_type
+#undef key_type
+#undef __stl_num_primes
+
+#if defined (_STLP_DEBUG)
+# undef hashtable
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_HASHTABLE_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_hashtable.h b/stlport/stl/_hashtable.h
new file mode 100644
index 0000000..1c8e2f5
--- /dev/null
+++ b/stlport/stl/_hashtable.h
@@ -0,0 +1,658 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+#define _STLP_INTERNAL_HASHTABLE_H
+
+#ifndef _STLP_INTERNAL_VECTOR_H
+# include <stl/_vector.h>
+#endif
+
+#ifndef _STLP_INTERNAL_SLIST_H
+# include <stl/_slist.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_HASH_FUN_H
+# include <stl/_hash_fun.h>
+#endif
+
+/*
+ * Hashtable class, used to implement the hashed associative containers
+ * hash_set, hash_map, hash_multiset, hash_multimap,
+ * unordered_set, unordered_map, unordered_multiset, unordered_multimap.
+ */
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+//Export of the classes used to represent buckets in the hashtable implementation.
+# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
+//If pointer specialization is enabled vector<_Slist_node_base*> will use the void*
+//storage type for which internal classes have already been exported.
+_STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _Slist_node_base*>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
+ allocator<_Slist_node_base*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Vector_base<_Slist_node_base*,
+ allocator<_Slist_node_base*> >;
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+# if defined (_STLP_DEBUG)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
+_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_VECTOR<_Slist_node_base*, allocator<_Slist_node_base*> > >;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_NON_DBG_VECTOR<_Slist_node_base*, allocator<_Slist_node_base*> >;
+# undef _STLP_NON_DBG_VECTOR
+_STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+_STLP_EXPORT_TEMPLATE_CLASS vector<_STLP_PRIV _Slist_node_base*,
+ allocator<_STLP_PRIV _Slist_node_base*> >;
+#endif
+
+#if defined (_STLP_DEBUG)
+# define hashtable _STLP_NON_DBG_NAME(hashtable)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// some compilers require the names of template parameters to be the same
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+class hashtable;
+
+#if !defined (_STLP_DEBUG)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _BaseIte, class _Traits>
+struct _Ht_iterator {
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+
+ typedef _Ht_iterator<_BaseIte,_Traits> _Self;
+
+ typedef typename _Traits::value_type value_type;
+ typedef typename _Traits::pointer pointer;
+ typedef typename _Traits::reference reference;
+ typedef forward_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+
+ typedef _Ht_iterator<_BaseIte, _NonConstTraits> iterator;
+ typedef _Ht_iterator<_BaseIte, _ConstTraits> const_iterator;
+
+ _Ht_iterator() {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _Ht_iterator(const iterator& __it) : _M_ite(__it._M_ite) {}
+ _Ht_iterator(_BaseIte __it) : _M_ite(__it) {}
+
+ reference operator*() const {
+ return *_M_ite;
+ }
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ ++_M_ite;
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ bool operator == (const_iterator __rhs) const {
+ return _M_ite == __rhs._M_ite;
+ }
+ bool operator != (const_iterator __rhs) const {
+ return _M_ite != __rhs._M_ite;
+ }
+
+ _BaseIte _M_ite;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _BaseIte, class _Traits>
+struct __type_traits<_STLP_PRIV _Ht_iterator<_BaseIte, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+template <class _BaseIte, class _Traits>
+inline
+# if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+_STLP_TYPENAME_ON_RETURN_TYPE _Traits::value_type *
+# else
+_STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>::value_type *
+# endif
+value_type(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&) {
+ typedef _STLP_TYPENAME _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>::value_type _Val;
+ return (_Val*) 0;
+}
+template <class _BaseIte, class _Traits>
+inline forward_iterator_tag iterator_category(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&)
+{ return forward_iterator_tag(); }
+template <class _BaseIte, class _Traits>
+inline ptrdiff_t* distance_type(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&)
+{ return (ptrdiff_t*) 0; }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Dummy>
+class _Stl_prime {
+ // Returns begining of primes list and size by reference.
+ static const size_t* _S_primes(size_t&);
+public:
+ //Returns the maximum number of buckets handled by the hashtable implementation
+ static size_t _STLP_CALL _S_max_nb_buckets();
+
+ //Returns the bucket size next to a required size
+ static size_t _STLP_CALL _S_next_size(size_t);
+
+ // Returns the bucket range containing sorted list of prime numbers <= __hint.
+ static void _STLP_CALL _S_prev_sizes(size_t __hint, const size_t *&__begin, const size_t *&__end);
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _Stl_prime<bool>;
+#endif
+
+typedef _Stl_prime<bool> _Stl_prime_type;
+
+#if !defined (_STLP_DEBUG)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+/*
+ * Hashtables handle allocators a bit differently than other containers
+ * do. If we're using standard-conforming allocators, then a hashtable
+ * unconditionally has a member variable to hold its allocator, even if
+ * it so happens that all instances of the allocator type are identical.
+ * This is because, for hashtables, this extra storage is negligible.
+ * Additionally, a base class wouldn't serve any other purposes; it
+ * wouldn't, for example, simplify the exception-handling code.
+ */
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+class hashtable {
+ typedef hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> _Self;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef typename _Traits::_NonConstLocalTraits _NonConstLocalTraits;
+ typedef typename _Traits::_ConstLocalTraits _ConstLocalTraits;
+
+public:
+ typedef _Key key_type;
+ typedef _Val value_type;
+ typedef _HF hasher;
+ typedef _EqK key_equal;
+
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef typename _NonConstTraits::pointer pointer;
+ typedef const value_type* const_pointer;
+ typedef typename _NonConstTraits::reference reference;
+ typedef const value_type& const_reference;
+ typedef forward_iterator_tag _Iterator_category;
+
+ hasher hash_funct() const { return _M_hash; }
+ key_equal key_eq() const { return _M_equals; }
+
+private:
+ _STLP_FORCE_ALLOCATORS(_Val, _All)
+#if defined (_STLP_DEBUG)
+ typedef _STLP_PRIV _STLP_NON_DBG_NAME(slist)<value_type, _All> _ElemsCont;
+#else
+ typedef slist<value_type, _All> _ElemsCont;
+#endif
+ typedef typename _ElemsCont::iterator _ElemsIte;
+ typedef typename _ElemsCont::const_iterator _ElemsConstIte;
+ typedef _STLP_PRIV _Slist_node_base _BucketType;
+ typedef typename _Alloc_traits<_BucketType*, _All>::allocator_type _BucketAllocType;
+ /*
+ * We are going to use vector of _Slist_node_base pointers for 2 reasons:
+ * - limit code bloat, all hashtable instanciation use the same buckets representation.
+ * - avoid _STLP_DEBUG performance trouble: with a vector of iterator on slist the resize
+ * method would be too slow because the slist::splice_after method become linear on
+ * the number of iterators in the buckets rather than constant in time as the iterator
+ * has to be move from a slist to the other.
+ */
+#if defined (_STLP_DEBUG)
+ typedef _STLP_PRIV _STLP_NON_DBG_NAME(vector)<_BucketType*, _BucketAllocType> _BucketVector;
+#else
+ typedef vector<_BucketType*, _BucketAllocType> _BucketVector;
+#endif
+
+ hasher _M_hash;
+ key_equal _M_equals;
+ _ElemsCont _M_elems;
+ _BucketVector _M_buckets;
+ size_type _M_num_elements;
+ float _M_max_load_factor;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+ static const key_type& _M_get_key(const value_type& __val) {
+ _ExK k;
+ return k(__val);
+ }
+public:
+ typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _NonConstTraits> iterator;
+ typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _ConstTraits> const_iterator;
+ //TODO: Avoids this debug check and make the local_iterator different from
+ //iterator in debug mode too.
+#if !defined (_STLP_DEBUG)
+ typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _NonConstLocalTraits> local_iterator;
+ typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _ConstLocalTraits> const_local_iterator;
+#else
+ typedef iterator local_iterator;
+ typedef const_iterator const_local_iterator;
+#endif
+
+ typedef _All allocator_type;
+ allocator_type get_allocator() const { return _M_elems.get_allocator(); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const allocator_type& __a = allocator_type())
+#else
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql)
+ : _M_hash(__hf),
+ _M_equals(__eql),
+ _M_elems(allocator_type()),
+ _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)),
+ _M_num_elements(0),
+ _M_max_load_factor(1.0f)
+ { _M_initialize_buckets(__n); }
+
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const allocator_type& __a)
+#endif
+ : _M_hash(__hf),
+ _M_equals(__eql),
+ _M_elems(__a),
+ _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)),
+ _M_num_elements(0),
+ _M_max_load_factor(1.0f)
+ { _M_initialize_buckets(__n); }
+
+ hashtable(const _Self& __ht)
+ : _M_hash(__ht._M_hash),
+ _M_equals(__ht._M_equals),
+ _M_elems(__ht.get_allocator()),
+ _M_buckets(_STLP_CONVERT_ALLOCATOR(__ht.get_allocator(), _BucketType*)),
+ _M_num_elements(0),
+ _M_max_load_factor(1.0f)
+ { _M_copy_from(__ht); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hashtable(__move_source<_Self> src)
+ : _M_hash(_STLP_PRIV _AsMoveSource(src.get()._M_hash)),
+ _M_equals(_STLP_PRIV _AsMoveSource(src.get()._M_equals)),
+ _M_elems(__move_source<_ElemsCont>(src.get()._M_elems)),
+ _M_buckets(__move_source<_BucketVector>(src.get()._M_buckets)),
+ _M_num_elements(src.get()._M_num_elements),
+ _M_max_load_factor(src.get()._M_max_load_factor) {}
+#endif
+
+ _Self& operator= (const _Self& __ht) {
+ if (&__ht != this) {
+ clear();
+ _M_hash = __ht._M_hash;
+ _M_equals = __ht._M_equals;
+ _M_copy_from(__ht);
+ }
+ return *this;
+ }
+
+ ~hashtable() { clear(); }
+
+ size_type size() const { return _M_num_elements; }
+ size_type max_size() const { return size_type(-1); }
+ bool empty() const { return size() == 0; }
+
+ void swap(_Self& __ht) {
+ _STLP_STD::swap(_M_hash, __ht._M_hash);
+ _STLP_STD::swap(_M_equals, __ht._M_equals);
+ _M_elems.swap(__ht._M_elems);
+ _M_buckets.swap(__ht._M_buckets);
+ _STLP_STD::swap(_M_num_elements, __ht._M_num_elements);
+ _STLP_STD::swap(_M_max_load_factor, __ht._M_max_load_factor);
+ }
+
+ iterator begin() { return _M_elems.begin(); }
+ iterator end() { return _M_elems.end(); }
+ local_iterator begin(size_type __n) { return _ElemsIte(_M_buckets[__n]); }
+ local_iterator end(size_type __n) { return _ElemsIte(_M_buckets[__n + 1]); }
+
+ const_iterator begin() const { return __CONST_CAST(_ElemsCont&, _M_elems).begin(); }
+ const_iterator end() const { return __CONST_CAST(_ElemsCont&, _M_elems).end(); }
+ const_local_iterator begin(size_type __n) const { return _ElemsIte(_M_buckets[__n]); }
+ const_local_iterator end(size_type __n) const { return _ElemsIte(_M_buckets[__n + 1]); }
+
+ //static bool _STLP_CALL _M_equal (const _Self&, const _Self&);
+
+public:
+ //The number of buckets is size() - 1 because the last bucket always contains
+ //_M_elems.end() to make algo easier to implement.
+ size_type bucket_count() const { return _M_buckets.size() - 1; }
+ size_type max_bucket_count() const { return _STLP_PRIV _Stl_prime_type::_S_max_nb_buckets(); }
+ size_type elems_in_bucket(size_type __bucket) const
+ { return _STLP_STD::distance(_ElemsIte(_M_buckets[__bucket]), _ElemsIte(_M_buckets[__bucket + 1])); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_bkt_num_key(__k); }
+
+ // hash policy
+ float load_factor() const { return (float)size() / (float)bucket_count(); }
+ float max_load_factor() const { return _M_max_load_factor; }
+ void max_load_factor(float __z) {
+ _M_max_load_factor = __z;
+ _M_resize();
+ }
+
+ pair<iterator, bool> insert_unique(const value_type& __obj) {
+ _M_enlarge(_M_num_elements + 1);
+ return insert_unique_noresize(__obj);
+ }
+
+ iterator insert_equal(const value_type& __obj) {
+ _M_enlarge(_M_num_elements + 1);
+ return insert_equal_noresize(__obj);
+ }
+
+protected:
+ iterator _M_insert_noresize(size_type __n, const value_type& __obj);
+public:
+ pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
+ iterator insert_equal_noresize(const value_type& __obj);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert_unique(_InputIterator __f, _InputIterator __l)
+ { insert_unique(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator)); }
+
+ template <class _InputIterator>
+ void insert_equal(_InputIterator __f, _InputIterator __l)
+ { insert_equal(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator)); }
+
+ template <class _InputIterator>
+ void insert_unique(_InputIterator __f, _InputIterator __l,
+ const input_iterator_tag &) {
+ for ( ; __f != __l; ++__f)
+ insert_unique(*__f);
+ }
+
+ template <class _InputIterator>
+ void insert_equal(_InputIterator __f, _InputIterator __l,
+ const input_iterator_tag &) {
+ for ( ; __f != __l; ++__f)
+ insert_equal(*__f);
+ }
+
+ template <class _ForwardIterator>
+ void insert_unique(_ForwardIterator __f, _ForwardIterator __l,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__f, __l);
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_unique_noresize(*__f);
+ }
+
+ template <class _ForwardIterator>
+ void insert_equal(_ForwardIterator __f, _ForwardIterator __l,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__f, __l);
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_equal_noresize(*__f);
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert_unique(const value_type* __f, const value_type* __l) {
+ size_type __n = __l - __f;
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_unique_noresize(*__f);
+ }
+
+ void insert_equal(const value_type* __f, const value_type* __l) {
+ size_type __n = __l - __f;
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_equal_noresize(*__f);
+ }
+
+ void insert_unique(const_iterator __f, const_iterator __l) {
+ size_type __n = _STLP_STD::distance(__f, __l);
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_unique_noresize(*__f);
+ }
+
+ void insert_equal(const_iterator __f, const_iterator __l) {
+ size_type __n = _STLP_STD::distance(__f, __l);
+ _M_enlarge(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_equal_noresize(*__f);
+ }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ //reference find_or_insert(const value_type& __obj);
+
+private:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _ElemsIte _M_find(const _KT& __key) const {
+ size_type __n = _M_bkt_num_key(__key);
+ _ElemsIte __first(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+ for ( ; (__first != __last) && !_M_equals(_M_get_key(*__first), __key); ++__first);
+ if (__first != __last)
+ return __first;
+ else
+ return __CONST_CAST(_ElemsCont&, _M_elems).end();
+ }
+
+public:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const {
+ const size_type __n = _M_bkt_num_key(__key);
+
+ _ElemsIte __cur(_M_buckets[__n]);
+ _ElemsIte __last(_M_buckets[__n + 1]);
+ for (; __cur != __last; ++__cur) {
+ if (_M_equals(_M_get_key(*__cur), __key)) {
+ size_type __result = 1;
+ for (++__cur;
+ __cur != __last && _M_equals(_M_get_key(*__cur), __key);
+ ++__result, ++__cur);
+ return __result;
+ }
+ }
+ return 0;
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key) {
+ typedef pair<iterator, iterator> _Pii;
+ const size_type __n = _M_bkt_num_key(__key);
+
+ for (_ElemsIte __first(_M_buckets[__n]), __last(_M_buckets[__n + 1]);
+ __first != __last; ++__first) {
+ if (_M_equals(_M_get_key(*__first), __key)) {
+ _ElemsIte __cur(__first);
+ for (++__cur; (__cur != __last) && _M_equals(_M_get_key(*__cur), __key); ++__cur);
+ return _Pii(__first, __cur);
+ }
+ }
+ return _Pii(end(), end());
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const {
+ typedef pair<const_iterator, const_iterator> _Pii;
+ const size_type __n = _M_bkt_num_key(__key);
+
+ for (_ElemsIte __first(_M_buckets[__n]), __last(_M_buckets[__n + 1]);
+ __first != __last; ++__first) {
+ if (_M_equals(_M_get_key(*__first), __key)) {
+ _ElemsIte __cur(__first);
+ for (++__cur; (__cur != __last) && _M_equals(_M_get_key(*__cur), __key); ++__cur);
+ return _Pii(__first, __cur);
+ }
+ }
+ return _Pii(end(), end());
+ }
+
+ size_type erase(const key_type& __key);
+ void erase(const_iterator __it);
+ void erase(const_iterator __first, const_iterator __last);
+
+private:
+ void _M_enlarge(size_type __n);
+ void _M_reduce();
+ void _M_resize();
+ void _M_rehash(size_type __num_buckets);
+#if defined (_STLP_DEBUG)
+ void _M_check() const;
+#endif
+
+public:
+ void rehash(size_type __num_buckets_hint);
+ void resize(size_type __num_buckets_hint)
+ { rehash(__num_buckets_hint); }
+ void clear();
+
+ // this is for hash_map::operator[]
+ reference _M_insert(const value_type& __obj);
+
+private:
+ //__n is set to the first bucket that has to be modified if any
+ //erase/insert operation is done after the returned iterator.
+ iterator _M_before_begin(size_type &__n) const;
+
+ static iterator _S_before_begin(const _ElemsCont& __elems, const _BucketVector& __buckets,
+ size_type &__n);
+
+ void _M_initialize_buckets(size_type __n) {
+ const size_type __n_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__n) + 1;
+ _M_buckets.reserve(__n_buckets);
+ _M_buckets.assign(__n_buckets, __STATIC_CAST(_BucketType*, 0));
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type _M_bkt_num_key(const _KT& __key) const
+ { return _M_bkt_num_key(__key, bucket_count()); }
+
+ size_type _M_bkt_num(const value_type& __obj) const
+ { return _M_bkt_num_key(_M_get_key(__obj)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type _M_bkt_num_key(const _KT& __key, size_type __n) const
+ { return _M_hash(__key) % __n; }
+
+ size_type _M_bkt_num(const value_type& __obj, size_t __n) const
+ { return _M_bkt_num_key(_M_get_key(__obj), __n); }
+
+ void _M_copy_from(const _Self& __ht);
+};
+
+#if defined (_STLP_DEBUG)
+# undef hashtable
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_hashtable.c>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define _STLP_TEMPLATE_HEADER template <class _Val, class _Key, class _HF, class _Traits, class _ExK, class _EqK, class _All>
+#define _STLP_TEMPLATE_CONTAINER hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>
+#include <stl/_relops_hash_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Val, class _Key, class _HF, class _Traits, class _ExK, class _EqK, class _All>
+struct __move_traits<hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> > {
+ //Hashtables are movable:
+ typedef __true_type implemented;
+
+ //Completeness depends on many template parameters, for the moment we consider it not complete:
+ typedef __false_type complete;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_HASHTABLE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_heap.c b/stlport/stl/_heap.c
similarity index 100%
rename from stl/_heap.c
rename to stlport/stl/_heap.c
diff --git a/stl/_heap.h b/stlport/stl/_heap.h
similarity index 100%
rename from stl/_heap.h
rename to stlport/stl/_heap.h
diff --git a/stlport/stl/_iomanip.h b/stlport/stl/_iomanip.h
new file mode 100644
index 0000000..a27d951
--- /dev/null
+++ b/stlport/stl/_iomanip.h
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_IOMANIP
+#define _STLP_INTERNAL_IOMANIP
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h> // Includes <ostream> and <ios>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//----------------------------------------------------------------------
+// Machinery for defining manipulators.
+
+// Class that calls one of ios_base's single-argument member functions.
+template <class _Arg>
+struct _Ios_Manip_1 {
+ typedef _Arg (ios_base::*__f_ptr_type)(_Arg);
+
+ _Ios_Manip_1(__f_ptr_type __f, const _Arg& __arg)
+ : _M_f(__f), _M_arg(__arg) {}
+
+ void operator()(ios_base& __ios) const
+ { (__ios.*_M_f)(_M_arg); }
+
+ __f_ptr_type _M_f;
+ _Arg _M_arg;
+};
+
+// Class that calls one of ios_base's two-argument member functions.
+struct _Ios_Setf_Manip {
+ ios_base::fmtflags _M_flag;
+ ios_base::fmtflags _M_mask;
+ bool _M_two_args;
+
+ _Ios_Setf_Manip(ios_base::fmtflags __f)
+ : _M_flag(__f), _M_mask(0), _M_two_args(false) {}
+
+ _Ios_Setf_Manip(ios_base::fmtflags __f, ios_base::fmtflags __m)
+ : _M_flag(__f), _M_mask(__m), _M_two_args(true) {}
+
+ void operator()(ios_base& __ios) const {
+ if (_M_two_args)
+ __ios.setf(_M_flag, _M_mask);
+ else
+ __ios.setf(_M_flag);
+ }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _Traits, class _Arg>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __istr,
+ const _STLP_PRIV _Ios_Manip_1<_Arg>& __f) {
+ __f(__istr);
+ return __istr;
+}
+
+template <class _CharT, class _Traits, class _Arg>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const _STLP_PRIV _Ios_Manip_1<_Arg>& __f) {
+ __f(__os);
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __istr,
+ const _STLP_PRIV _Ios_Setf_Manip& __f) {
+ __f(__istr);
+ return __istr;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const _STLP_PRIV _Ios_Setf_Manip& __f) {
+ __f(__os);
+ return __os;
+}
+
+//----------------------------------------------------------------------
+// The ios_base manipulators.
+inline _STLP_PRIV _Ios_Setf_Manip _STLP_CALL resetiosflags(ios_base::fmtflags __mask)
+{ return _STLP_PRIV _Ios_Setf_Manip(0, __mask); }
+
+inline _STLP_PRIV _Ios_Setf_Manip _STLP_CALL setiosflags(ios_base::fmtflags __flag)
+{ return _STLP_PRIV _Ios_Setf_Manip(__flag); }
+
+inline _STLP_PRIV _Ios_Setf_Manip _STLP_CALL setbase(int __n) {
+ ios_base::fmtflags __base = __n == 8 ? ios_base::oct :
+ __n == 10 ? ios_base::dec :
+ __n == 16 ? ios_base::hex :
+ ios_base::fmtflags(0);
+ return _STLP_PRIV _Ios_Setf_Manip(__base, ios_base::basefield);
+}
+
+inline _STLP_PRIV _Ios_Manip_1<streamsize> _STLP_CALL
+setprecision(int __n) {
+ _STLP_PRIV _Ios_Manip_1<streamsize>::__f_ptr_type __f = &ios_base::precision;
+ return _STLP_PRIV _Ios_Manip_1<streamsize>(__f, __n);
+}
+
+inline _STLP_PRIV _Ios_Manip_1<streamsize> _STLP_CALL
+setw(int __n) {
+ _STLP_PRIV _Ios_Manip_1<streamsize>::__f_ptr_type __f = &ios_base::width;
+ return _STLP_PRIV _Ios_Manip_1<streamsize>(__f, __n);
+}
+
+//----------------------------------------------------------------------
+// setfill, a manipulator that operates on basic_ios<> instead of ios_base.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT>
+struct _Setfill_Manip {
+ _Setfill_Manip(_CharT __c) : _M_c(__c) {}
+ _CharT _M_c;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _CharT2, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const _STLP_PRIV _Setfill_Manip<_CharT2>& __m) {
+ __os.fill(__m._M_c);
+ return __os;
+}
+
+template <class _CharT, class _CharT2, class _Traits>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __is,
+ const _STLP_PRIV _Setfill_Manip<_CharT2>& __m) {
+ __is.fill(__m._M_c);
+ return __is;
+}
+
+template <class _CharT>
+inline _STLP_PRIV _Setfill_Manip<_CharT> _STLP_CALL setfill(_CharT __c)
+{ return _STLP_PRIV _Setfill_Manip<_CharT>(__c); }
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_IOMANIP */
diff --git a/stlport/stl/_ios.c b/stlport/stl/_ios.c
new file mode 100644
index 0000000..7dec77f
--- /dev/null
+++ b/stlport/stl/_ios.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_IOS_C
+#define _STLP_IOS_C
+
+#ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+# include <stl/_numpunct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// basic_ios<>'s non-inline member functions
+
+// Public constructor, taking a streambuf.
+template <class _CharT, class _Traits>
+basic_ios<_CharT, _Traits>
+ ::basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf)
+ : ios_base(), _M_cached_ctype(0),
+ _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) {
+ basic_ios<_CharT, _Traits>::init(__streambuf);
+}
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>*
+basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf) {
+ basic_streambuf<_CharT, _Traits>* __tmp = _M_streambuf;
+ _M_streambuf = __buf;
+ this->clear();
+ return __tmp;
+}
+
+template <class _CharT, class _Traits>
+basic_ios<_CharT, _Traits>&
+basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x) {
+ _M_invoke_callbacks(erase_event);
+ _M_copy_state(__x); // Inherited from ios_base.
+ _M_cached_ctype = __x._M_cached_ctype;
+ _M_fill = __x._M_fill;
+ _M_tied_ostream = __x._M_tied_ostream;
+ _M_invoke_callbacks(copyfmt_event);
+ this->_M_set_exception_mask(__x.exceptions());
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) {
+ locale __tmp = ios_base::imbue(__loc);
+ _STLP_TRY {
+ if (_M_streambuf)
+ _M_streambuf->pubimbue(__loc);
+
+ // no throwing here
+ _M_cached_ctype = &use_facet<ctype<char_type> >(__loc);
+ }
+ _STLP_CATCH_ALL {
+ __tmp = ios_base::imbue(__tmp);
+ _M_handle_exception(ios_base::failbit);
+ }
+ return __tmp;
+}
+
+// Protected constructor and initialization functions. The default
+// constructor creates an uninitialized basic_ios, and init() initializes
+// all of the members to the values in Table 89 of the C++ standard.
+
+template <class _CharT, class _Traits>
+basic_ios<_CharT, _Traits>::basic_ios()
+ : ios_base(),
+ _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0)
+{}
+
+template <class _CharT, class _Traits>
+void
+basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)
+{
+ this->rdbuf(__sb);
+ this->imbue(locale());
+ this->tie(0);
+ this->_M_set_exception_mask(ios_base::goodbit);
+ this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit);
+ ios_base::flags(ios_base::skipws | ios_base::dec);
+ ios_base::width(0);
+ ios_base::precision(6);
+ this->fill(widen(' '));
+ // We don't need to worry about any of the three arrays: they are
+ // initialized correctly in ios_base's constructor.
+}
+
+// This is never called except from within a catch clause.
+template <class _CharT, class _Traits>
+void basic_ios<_CharT, _Traits>::_M_handle_exception(ios_base::iostate __flag)
+{
+ this->_M_setstate_nothrow(__flag);
+ if (this->_M_get_exception_mask() & __flag)
+ _STLP_RETHROW;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_IOS_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_ios.h b/stlport/stl/_ios.h
new file mode 100644
index 0000000..20422f0
--- /dev/null
+++ b/stlport/stl/_ios.h
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_INTERNAL_IOS_H
+#define _STLP_INTERNAL_IOS_H
+
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+# include <stl/_numpunct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// ----------------------------------------------------------------------
+
+// Class basic_ios, a subclass of ios_base. The only important difference
+// between the two is that basic_ios is a class template, parameterized
+// by the character type. ios_base exists to factor out all of the
+// common properties that don't depend on the character type.
+
+// The second template parameter, _Traits, defaults to char_traits<_CharT>.
+// The default is declared in header <iosfwd>, and it isn't declared here
+// because C++ language rules do not allow it to be declared twice.
+
+template <class _CharT, class _Traits>
+class basic_ios : public ios_base {
+ friend class ios_base;
+public: // Synonyms for types.
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+public: // Constructor, destructor.
+ explicit basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf);
+ virtual ~basic_ios() {}
+
+public: // Members from clause 27.4.4.2
+ basic_ostream<_CharT, _Traits>* tie() const {
+ return _M_tied_ostream;
+ }
+ basic_ostream<_CharT, _Traits>*
+ tie(basic_ostream<char_type, traits_type>* __new_tied_ostream) {
+ basic_ostream<char_type, traits_type>* __tmp = _M_tied_ostream;
+ _M_tied_ostream = __new_tied_ostream;
+ return __tmp;
+ }
+
+ basic_streambuf<_CharT, _Traits>* rdbuf() const
+ { return _M_streambuf; }
+
+ basic_streambuf<_CharT, _Traits>*
+ rdbuf(basic_streambuf<char_type, traits_type>*);
+
+ // Copies __x's state to *this.
+ basic_ios<_CharT, _Traits>& copyfmt(const basic_ios<_CharT, _Traits>& __x);
+
+ char_type fill() const { return _M_fill; }
+ char_type fill(char_type __fill) {
+ char_type __tmp(_M_fill);
+ _M_fill = __fill;
+ return __tmp;
+ }
+
+public: // Members from 27.4.4.3. These four functions
+ // can almost be defined in ios_base.
+
+ void clear(iostate __state = goodbit) {
+ _M_clear_nothrow(this->rdbuf() ? __state : iostate(__state|ios_base::badbit));
+ _M_check_exception_mask();
+ }
+ void setstate(iostate __state) { this->clear(rdstate() | __state); }
+
+ iostate exceptions() const { return this->_M_get_exception_mask(); }
+ void exceptions(iostate __mask) {
+ this->_M_set_exception_mask(__mask);
+ this->clear(this->rdstate());
+ }
+
+public: // Locale-related member functions.
+ locale imbue(const locale&);
+
+ inline char narrow(_CharT, char) const ;
+ inline _CharT widen(char) const;
+
+ // Helper function that makes testing for EOF more convenient.
+ static bool _STLP_CALL _S_eof(int_type __c) {
+ const int_type __eof = _Traits::eof();
+ return _Traits::eq_int_type(__c, __eof);
+ }
+
+protected:
+ // Cached copy of the curent locale's ctype facet. Set by init() and imbue().
+ const ctype<char_type>* _M_cached_ctype;
+
+public:
+ // Equivalent to &use_facet< Facet >(getloc()), but faster.
+ const ctype<char_type>* _M_ctype_facet() const { return _M_cached_ctype; }
+
+protected:
+ basic_ios();
+
+ void init(basic_streambuf<_CharT, _Traits>* __streambuf);
+
+public:
+
+ // Helper function used in istream and ostream. It is called only from
+ // a catch clause.
+ void _M_handle_exception(ios_base::iostate __flag);
+
+private: // Data members
+ char_type _M_fill; // The fill character, used for padding.
+
+ basic_streambuf<_CharT, _Traits>* _M_streambuf;
+ basic_ostream<_CharT, _Traits>* _M_tied_ostream;
+
+};
+
+
+template <class _CharT, class _Traits>
+inline char
+basic_ios<_CharT, _Traits>::narrow(_CharT __c, char __default) const
+{ return _M_ctype_facet()->narrow(__c, __default); }
+
+template <class _CharT, class _Traits>
+inline _CharT
+basic_ios<_CharT, _Traits>::widen(char __c) const
+{ return _M_ctype_facet()->widen(__c); }
+
+# if !defined (_STLP_NO_METHOD_SPECIALIZATION)
+_STLP_TEMPLATE_NULL
+inline char
+basic_ios<char, char_traits<char> >::narrow(char __c, char) const
+{
+ return __c;
+}
+
+_STLP_TEMPLATE_NULL
+inline char
+basic_ios<char, char_traits<char> >::widen(char __c) const
+{
+ return __c;
+}
+# endif /* _STLP_NO_METHOD_SPECIALIZATION */
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ios<char, char_traits<char> >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ios<wchar_t, char_traits<wchar_t> >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_ios.c>
+#endif
+
+#endif /* _STLP_IOS */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_ios_base.h b/stlport/stl/_ios_base.h
new file mode 100644
index 0000000..c9e10ad
--- /dev/null
+++ b/stlport/stl/_ios_base.h
@@ -0,0 +1,345 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_IOS_BASE_H
+#define _STLP_IOS_BASE_H
+
+#ifndef _STLP_INTERNAL_STDEXCEPT_BASE
+# include <stl/_stdexcept_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_PAIR_H
+# include <stl/_pair.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+# include <stl/_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// ----------------------------------------------------------------------
+
+// Class ios_base. This is the base class of the ios hierarchy, which
+// includes basic_istream and basic_ostream. Classes in the ios
+// hierarchy are actually quite simple: they are just glorified
+// wrapper classes. They delegate buffering and physical character
+// manipulation to the streambuf classes, and they delegate most
+// formatting tasks to a locale.
+
+class _STLP_CLASS_DECLSPEC ios_base {
+public:
+
+ class _STLP_CLASS_DECLSPEC failure : public __Named_exception {
+ public:
+ explicit failure(const string&);
+ virtual ~failure() _STLP_NOTHROW_INHERENTLY;
+ };
+
+ typedef int fmtflags;
+ typedef int iostate;
+ typedef int openmode;
+ typedef int seekdir;
+
+# ifndef _STLP_NO_ANACHRONISMS
+ typedef fmtflags fmt_flags;
+# endif
+
+ // Formatting flags.
+ _STLP_STATIC_CONSTANT(int, left = 0x0001);
+ _STLP_STATIC_CONSTANT(int, right = 0x0002);
+ _STLP_STATIC_CONSTANT(int, internal = 0x0004);
+ _STLP_STATIC_CONSTANT(int, dec = 0x0008);
+ _STLP_STATIC_CONSTANT(int, hex = 0x0010);
+ _STLP_STATIC_CONSTANT(int, oct = 0x0020);
+ _STLP_STATIC_CONSTANT(int, fixed = 0x0040);
+ _STLP_STATIC_CONSTANT(int, scientific = 0x0080);
+ _STLP_STATIC_CONSTANT(int, boolalpha = 0x0100);
+ _STLP_STATIC_CONSTANT(int, showbase = 0x0200);
+ _STLP_STATIC_CONSTANT(int, showpoint = 0x0400);
+ _STLP_STATIC_CONSTANT(int, showpos = 0x0800);
+ _STLP_STATIC_CONSTANT(int, skipws = 0x1000);
+ _STLP_STATIC_CONSTANT(int, unitbuf = 0x2000);
+ _STLP_STATIC_CONSTANT(int, uppercase = 0x4000);
+ _STLP_STATIC_CONSTANT(int, adjustfield = left | right | internal);
+ _STLP_STATIC_CONSTANT(int, basefield = dec | hex | oct);
+ _STLP_STATIC_CONSTANT(int, floatfield = scientific | fixed);
+
+ // State flags.
+ _STLP_STATIC_CONSTANT(int, goodbit = 0x00);
+ _STLP_STATIC_CONSTANT(int, badbit = 0x01);
+ _STLP_STATIC_CONSTANT(int, eofbit = 0x02);
+ _STLP_STATIC_CONSTANT(int, failbit = 0x04);
+
+ // Openmode flags.
+ _STLP_STATIC_CONSTANT(int, __default_mode = 0x0); /* implementation detail */
+ _STLP_STATIC_CONSTANT(int, app = 0x01);
+ _STLP_STATIC_CONSTANT(int, ate = 0x02);
+ _STLP_STATIC_CONSTANT(int, binary = 0x04);
+ _STLP_STATIC_CONSTANT(int, in = 0x08);
+ _STLP_STATIC_CONSTANT(int, out = 0x10);
+ _STLP_STATIC_CONSTANT(int, trunc = 0x20);
+
+ // Seekdir flags
+ _STLP_STATIC_CONSTANT(int, beg = 0x01);
+ _STLP_STATIC_CONSTANT(int, cur = 0x02);
+ _STLP_STATIC_CONSTANT(int, end = 0x04);
+
+public: // Flag-manipulation functions.
+ fmtflags flags() const { return _M_fmtflags; }
+ fmtflags flags(fmtflags __flags) {
+ fmtflags __tmp = _M_fmtflags;
+ _M_fmtflags = __flags;
+ return __tmp;
+ }
+
+ fmtflags setf(fmtflags __flag) {
+ fmtflags __tmp = _M_fmtflags;
+ _M_fmtflags |= __flag;
+ return __tmp;
+ }
+ fmtflags setf(fmtflags __flag, fmtflags __mask) {
+ fmtflags __tmp = _M_fmtflags;
+ _M_fmtflags &= ~__mask;
+ _M_fmtflags |= __flag & __mask;
+ return __tmp;
+ }
+ void unsetf(fmtflags __mask) { _M_fmtflags &= ~__mask; }
+
+ streamsize precision() const { return _M_precision; }
+ streamsize precision(streamsize __newprecision) {
+ streamsize __tmp = _M_precision;
+ _M_precision = __newprecision;
+ return __tmp;
+ }
+
+ streamsize width() const { return _M_width; }
+ streamsize width(streamsize __newwidth) {
+ streamsize __tmp = _M_width;
+ _M_width = __newwidth;
+ return __tmp;
+ }
+
+public: // Locales
+ locale imbue(const locale&);
+ locale getloc() const { return _M_locale; }
+
+public: // Auxiliary storage.
+ static int _STLP_CALL xalloc();
+ long& iword(int __index);
+ void*& pword(int __index);
+
+public: // Destructor.
+ virtual ~ios_base();
+
+public: // Callbacks.
+ enum event { erase_event, imbue_event, copyfmt_event };
+ typedef void (*event_callback)(event, ios_base&, int __index);
+ void register_callback(event_callback __fn, int __index);
+
+public: // This member function affects only
+ // the eight predefined ios objects:
+ // cin, cout, etc.
+ static bool _STLP_CALL sync_with_stdio(bool __sync = true);
+
+public: // The C++ standard requires only that these
+ // member functions be defined in basic_ios.
+ // We define them in the non-template
+ // base class to avoid code duplication.
+ operator void*() const { return !fail() ? (void*) __CONST_CAST(ios_base*,this) : (void*) 0; }
+ bool operator!() const { return fail(); }
+
+ iostate rdstate() const { return _M_iostate; }
+
+ bool good() const { return _M_iostate == 0; }
+ bool eof() const { return (_M_iostate & eofbit) != 0; }
+ bool fail() const { return (_M_iostate & (failbit | badbit)) != 0; }
+ bool bad() const { return (_M_iostate & badbit) != 0; }
+
+protected: // The functional protected interface.
+
+ // Copies the state of __x to *this. This member function makes it
+ // possible to implement basic_ios::copyfmt without having to expose
+ // ios_base's private data members. Does not copy _M_exception_mask
+ // or _M_iostate.
+ void _M_copy_state(const ios_base& __x);
+
+ void _M_setstate_nothrow(iostate __state) { _M_iostate |= __state; }
+ void _M_clear_nothrow(iostate __state) { _M_iostate = __state; }
+ iostate _M_get_exception_mask() const { return _M_exception_mask; }
+ void _M_set_exception_mask(iostate __mask) { _M_exception_mask = __mask; }
+ void _M_check_exception_mask() {
+ if (_M_iostate & _M_exception_mask)
+ _M_throw_failure();
+ }
+
+ void _M_invoke_callbacks(event);
+ void _STLP_FUNCTION_THROWS _M_throw_failure();
+
+ ios_base(); // Default constructor.
+
+protected: // Initialization of the I/O system
+ static void _STLP_CALL _S_initialize();
+ static void _STLP_CALL _S_uninitialize();
+ static bool _S_is_synced;
+
+private: // Invalidate the copy constructor and
+ // assignment operator.
+ ios_base(const ios_base&);
+ void operator=(const ios_base&);
+
+private: // Data members.
+
+ fmtflags _M_fmtflags; // Flags
+ iostate _M_iostate;
+ openmode _M_openmode;
+ seekdir _M_seekdir;
+ iostate _M_exception_mask;
+
+ streamsize _M_precision;
+ streamsize _M_width;
+
+ locale _M_locale;
+
+ pair<event_callback, int>* _M_callbacks;
+ size_t _M_num_callbacks; // Size of the callback array.
+ size_t _M_callback_index; // Index of the next available callback;
+ // initially zero.
+
+ long* _M_iwords; // Auxiliary storage. The count is zero
+ size_t _M_num_iwords; // if and only if the pointer is null.
+
+ void** _M_pwords;
+ size_t _M_num_pwords;
+
+public:
+ // ----------------------------------------------------------------------
+ // Nested initializer class. This is an implementation detail, but it's
+ // prescribed by the standard. The static initializer object (on
+ // implementations where such a thing is required) is declared in
+ // <iostream>
+ class _STLP_CLASS_DECLSPEC Init
+ {
+ public:
+ Init();
+ ~Init();
+ private:
+ static long _S_count;
+ friend class ios_base;
+ };
+
+ friend class Init;
+
+public:
+# ifndef _STLP_NO_ANACHRONISMS
+ // 31.6 Old iostreams members [depr.ios.members]
+ typedef iostate io_state;
+ typedef openmode open_mode;
+ typedef seekdir seek_dir;
+ typedef _STLP_STD::streamoff streamoff;
+ typedef _STLP_STD::streampos streampos;
+# endif
+};
+
+// ----------------------------------------------------------------------
+// ios_base manipulator functions, from section 27.4.5 of the C++ standard.
+// All of them are trivial one-line wrapper functions.
+
+// fmtflag manipulators, section 27.4.5.1
+inline ios_base& _STLP_CALL boolalpha(ios_base& __s)
+ { __s.setf(ios_base::boolalpha); return __s;}
+
+inline ios_base& _STLP_CALL noboolalpha(ios_base& __s)
+ { __s.unsetf(ios_base::boolalpha); return __s;}
+
+inline ios_base& _STLP_CALL showbase(ios_base& __s)
+ { __s.setf(ios_base::showbase); return __s;}
+
+inline ios_base& _STLP_CALL noshowbase(ios_base& __s)
+ { __s.unsetf(ios_base::showbase); return __s;}
+
+inline ios_base& _STLP_CALL showpoint(ios_base& __s)
+ { __s.setf(ios_base::showpoint); return __s;}
+
+inline ios_base& _STLP_CALL noshowpoint(ios_base& __s)
+ { __s.unsetf(ios_base::showpoint); return __s;}
+
+inline ios_base& _STLP_CALL showpos(ios_base& __s)
+ { __s.setf(ios_base::showpos); return __s;}
+
+inline ios_base& _STLP_CALL noshowpos(ios_base& __s)
+ { __s.unsetf(ios_base::showpos); return __s;}
+
+inline ios_base& _STLP_CALL skipws(ios_base& __s)
+ { __s.setf(ios_base::skipws); return __s;}
+
+inline ios_base& _STLP_CALL noskipws(ios_base& __s)
+ { __s.unsetf(ios_base::skipws); return __s;}
+
+inline ios_base& _STLP_CALL uppercase(ios_base& __s)
+ { __s.setf(ios_base::uppercase); return __s;}
+
+inline ios_base& _STLP_CALL nouppercase(ios_base& __s)
+ { __s.unsetf(ios_base::uppercase); return __s;}
+
+inline ios_base& _STLP_CALL unitbuf(ios_base& __s)
+ { __s.setf(ios_base::unitbuf); return __s;}
+
+inline ios_base& _STLP_CALL nounitbuf(ios_base& __s)
+ { __s.unsetf(ios_base::unitbuf); return __s;}
+
+
+// adjustfield manipulators, section 27.4.5.2
+inline ios_base& _STLP_CALL internal(ios_base& __s)
+ { __s.setf(ios_base::internal, ios_base::adjustfield); return __s; }
+
+inline ios_base& _STLP_CALL left(ios_base& __s)
+ { __s.setf(ios_base::left, ios_base::adjustfield); return __s; }
+
+inline ios_base& _STLP_CALL right(ios_base& __s)
+ { __s.setf(ios_base::right, ios_base::adjustfield); return __s; }
+
+// basefield manipulators, section 27.4.5.3
+inline ios_base& _STLP_CALL dec(ios_base& __s)
+ { __s.setf(ios_base::dec, ios_base::basefield); return __s; }
+
+inline ios_base& _STLP_CALL hex(ios_base& __s)
+ { __s.setf(ios_base::hex, ios_base::basefield); return __s; }
+
+inline ios_base& _STLP_CALL oct(ios_base& __s)
+ { __s.setf(ios_base::oct, ios_base::basefield); return __s; }
+
+
+// floatfield manipulators, section 27.4.5.3
+inline ios_base& _STLP_CALL fixed(ios_base& __s)
+ { __s.setf(ios_base::fixed, ios_base::floatfield); return __s; }
+
+inline ios_base& _STLP_CALL scientific(ios_base& __s)
+ { __s.setf(ios_base::scientific, ios_base::floatfield); return __s; }
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_IOS_BASE */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stl/_ioserr.h b/stlport/stl/_ioserr.h
similarity index 100%
rename from stl/_ioserr.h
rename to stlport/stl/_ioserr.h
diff --git a/stlport/stl/_iosfwd.h b/stlport/stl/_iosfwd.h
new file mode 100644
index 0000000..e31db31
--- /dev/null
+++ b/stlport/stl/_iosfwd.h
@@ -0,0 +1,159 @@
+#ifndef _STLP_INTERNAL_IOSFWD
+#define _STLP_INTERNAL_IOSFWD
+
+#if defined (__sgi) && !defined (__GNUC__) && !defined (_STANDARD_C_PLUS_PLUS)
+# error This header file requires the -LANG:std option
+#endif
+
+// This file provides forward declarations of the most important I/O
+// classes. Note that almost all of those classes are class templates,
+// with default template arguments. According to the C++ standard,
+// if a class template is declared more than once in the same scope
+// then only one of those declarations may have default arguments.
+
+// <iosfwd> contains the same declarations as other headers, and including
+// both <iosfwd> and (say) <iostream> is permitted. This means that only
+// one header may contain those default template arguments.
+
+// In this implementation, the declarations in <iosfwd> contain default
+// template arguments. All of the other I/O headers include <iosfwd>.
+
+#ifndef _STLP_CHAR_TRAITS_H
+# include <stl/char_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class ios_base;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_ios;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_streambuf;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_istream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_ostream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_iostream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM( _Traits , char_traits<_CharT>),
+ _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
+class basic_stringbuf;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>),
+ _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
+class basic_istringstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>),
+ _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
+class basic_ostringstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>),
+ _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
+class basic_stringstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_filebuf;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_ifstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_ofstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class basic_fstream;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class istreambuf_iterator;
+
+template <class _CharT, _STLP_DFL_TMPL_PARAM(_Traits , char_traits<_CharT>) >
+class ostreambuf_iterator;
+
+typedef basic_ios<char, char_traits<char> > ios;
+
+#if !defined (_STLP_NO_WCHAR_T)
+typedef basic_ios<wchar_t, char_traits<wchar_t> > wios;
+#endif
+
+// Forward declaration of class locale, and of the most important facets.
+class locale;
+template <class _Facet>
+#if defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)
+struct _Use_facet {
+ const locale& __loc;
+ _Use_facet(const locale& __p_loc) : __loc(__p_loc) {}
+ inline const _Facet& operator *() const;
+};
+# define use_facet *_Use_facet
+#else
+inline const _Facet& use_facet(const locale&);
+#endif
+
+template <class _CharT> class ctype;
+template <class _CharT> class ctype_byname;
+template <class _CharT> class collate;
+template <class _CharT> class collate_byname;
+
+_STLP_TEMPLATE_NULL class ctype<char>;
+_STLP_TEMPLATE_NULL class ctype_byname<char>;
+_STLP_TEMPLATE_NULL class collate<char>;
+_STLP_TEMPLATE_NULL class collate_byname<char>;
+
+#if !defined (_STLP_NO_WCHAR_T)
+_STLP_TEMPLATE_NULL class ctype<wchar_t>;
+_STLP_TEMPLATE_NULL class ctype_byname<wchar_t>;
+_STLP_TEMPLATE_NULL class collate<wchar_t>;
+_STLP_TEMPLATE_NULL class collate_byname<wchar_t>;
+#endif
+
+#if !(defined (__SUNPRO_CC) && __SUNPRO_CC < 0x500 )
+// Typedefs for ordinary (narrow-character) streams.
+//_STLP_TEMPLATE_NULL class basic_streambuf<char, char_traits<char> >;
+#endif
+
+typedef basic_istream<char, char_traits<char> > istream;
+typedef basic_ostream<char, char_traits<char> > ostream;
+typedef basic_iostream<char, char_traits<char> > iostream;
+typedef basic_streambuf<char,char_traits<char> > streambuf;
+
+typedef basic_stringbuf<char, char_traits<char>, allocator<char> > stringbuf;
+typedef basic_istringstream<char, char_traits<char>, allocator<char> > istringstream;
+typedef basic_ostringstream<char, char_traits<char>, allocator<char> > ostringstream;
+typedef basic_stringstream<char, char_traits<char>, allocator<char> > stringstream;
+
+typedef basic_filebuf<char, char_traits<char> > filebuf;
+typedef basic_ifstream<char, char_traits<char> > ifstream;
+typedef basic_ofstream<char, char_traits<char> > ofstream;
+typedef basic_fstream<char, char_traits<char> > fstream;
+
+#if !defined (_STLP_NO_WCHAR_T)
+// Typedefs for wide-character streams.
+typedef basic_streambuf<wchar_t, char_traits<wchar_t> > wstreambuf;
+typedef basic_istream<wchar_t, char_traits<wchar_t> > wistream;
+typedef basic_ostream<wchar_t, char_traits<wchar_t> > wostream;
+typedef basic_iostream<wchar_t, char_traits<wchar_t> > wiostream;
+
+typedef basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstringbuf;
+typedef basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wistringstream;
+typedef basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wostringstream;
+typedef basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstringstream;
+
+typedef basic_filebuf<wchar_t, char_traits<wchar_t> > wfilebuf;
+typedef basic_ifstream<wchar_t, char_traits<wchar_t> > wifstream;
+typedef basic_ofstream<wchar_t, char_traits<wchar_t> > wofstream;
+typedef basic_fstream<wchar_t, char_traits<wchar_t> > wfstream;
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_iostream_string.h b/stlport/stl/_iostream_string.h
similarity index 100%
rename from stl/_iostream_string.h
rename to stlport/stl/_iostream_string.h
diff --git a/stlport/stl/_istream.c b/stlport/stl/_istream.c
new file mode 100644
index 0000000..ab327b2
--- /dev/null
+++ b/stlport/stl/_istream.c
@@ -0,0 +1,1429 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_ISTREAM_C
+#define _STLP_ISTREAM_C
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+// no wchar_t is supported for this mode
+# define __BIS_int_type__ int
+# define __BIS_pos_type__ streampos
+# define __BIS_off_type__ streamoff
+#else
+# define __BIS_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::int_type
+# define __BIS_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::pos_type
+# define __BIS_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::off_type
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Function object structs used by some member functions.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Traits>
+struct _Is_not_wspace {
+ typedef typename _Traits::char_type argument_type;
+ typedef bool result_type;
+
+ const ctype<argument_type>* _M_ctype;
+
+ _Is_not_wspace(const ctype<argument_type>* __c_type) : _M_ctype(__c_type) {}
+ bool operator()(argument_type __c) const
+ { return !_M_ctype->is(ctype_base::space, __c); }
+};
+
+template <class _Traits>
+struct _Is_wspace_null {
+ typedef typename _Traits::char_type argument_type;
+ typedef bool result_type;
+
+ const ctype<argument_type>* _M_ctype;
+
+ _Is_wspace_null(const ctype<argument_type>* __c_type) : _M_ctype(__c_type) {}
+ bool operator()(argument_type __c) const {
+ return _Traits::eq(__c, argument_type()) ||
+ _M_ctype->is(ctype_base::space, __c);
+ }
+};
+
+template <class _Traits>
+struct _Scan_for_wspace {
+ typedef typename _Traits::char_type char_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ const ctype<char_type>* _M_ctype;
+
+ _Scan_for_wspace(const ctype<char_type>* __ctype) : _M_ctype(__ctype) {}
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ return _M_ctype->scan_is(ctype_base::space, __first, __last);
+ }
+};
+
+template <class _Traits>
+struct _Scan_wspace_null {
+ typedef typename _Traits::char_type char_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ const ctype<char_type>* _M_ctype;
+
+ _Scan_wspace_null(const ctype<char_type>* __c_type) : _M_ctype(__c_type) {}
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ __last = find_if(__first, __last,
+ _Eq_char_bound<_Traits>(char_type()));
+ return _M_ctype->scan_is(ctype_base::space, __first, __last);
+ }
+};
+
+template <class _Traits>
+struct _Scan_for_not_wspace {
+ typedef typename _Traits::char_type char_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ const ctype<char_type>* _M_ctype;
+
+ _Scan_for_not_wspace(const ctype<char_type>* __c_type) : _M_ctype(__c_type) {}
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ return _M_ctype->scan_not(ctype_base::space, __first, __last);
+ }
+};
+
+template <class _Traits>
+struct _Scan_for_char_val {
+ typedef typename _Traits::char_type char_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ char_type _M_val;
+
+ _Scan_for_char_val(char_type __val) : _M_val(__val) {}
+
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ return find_if(__first, __last, _Eq_char_bound<_Traits>(_M_val));
+ }
+};
+
+template <class _Traits>
+struct _Scan_for_int_val {
+ typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef char_type* first_argument_type;
+ typedef char_type* second_argument_type;
+ typedef char_type* result_type;
+
+ int_type _M_val;
+
+ _Scan_for_int_val(int_type __val) : _M_val(__val) {}
+
+ const char_type*
+ operator()(const char_type* __first, const char_type* __last) const {
+ return find_if(__first, __last,
+ _Eq_int_bound<_Traits>(_M_val));
+ }
+};
+
+// Helper function: try to push back a character to a streambuf,
+// return true if the pushback succeeded. Does not throw.
+
+template <class _CharT, class _Traits>
+bool _STLP_CALL
+__pushback(basic_streambuf<_CharT, _Traits>* __buf, _CharT __c) {
+ bool ret;
+ _STLP_TRY {
+ const typename _Traits::int_type __eof = _Traits::eof();
+ ret = !_Traits::eq_int_type(__buf->sputbackc(__c), __eof);
+ }
+ _STLP_CATCH_ALL {
+ ret = false;
+ }
+ return ret;
+}
+
+//----------------------------------------------------------------------
+// Definitions of basic_istream<>'s noninline member functions.
+
+// Helper function for formatted input of numbers.
+template <class _CharT, class _Traits, class _Number>
+ios_base::iostate _STLP_CALL
+__get_num(basic_istream<_CharT, _Traits>& __that, _Number& __val) {
+ typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
+ ios_base::iostate __err = 0;
+ _Sentry __sentry( __that ); // Skip whitespace.
+ if (__sentry) {
+ typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > _Num_get;
+ _STLP_TRY {
+ // Do not remove additional parenthesis around use_facet instanciation, some compilers (VC6)
+ // require it when building the library.
+ (use_facet<_Num_get>(__that.getloc())).get(istreambuf_iterator<_CharT, _Traits>(__that.rdbuf()),
+ 0, __that, __err, __val);
+ }
+ _STLP_CATCH_ALL {
+ __that._M_handle_exception(ios_base::badbit);
+ }
+ if (__err) __that.setstate(__err);
+ }
+ return __err;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (short& __val) {
+ long __lval;
+ _STLP_PRIV __get_num(*this, __lval);
+ if ( this->fail() ) {
+ return *this;
+ }
+ short __tmp = __STATIC_CAST(short, __lval);
+ unsigned short __uval = __STATIC_CAST(unsigned short, __lval);
+ // check if we lose digits
+ // if ((__val != __lval) && ((unsigned short)__val != __lval))
+ if ((__tmp != __lval) && ((long)__uval != __lval))
+ this->setstate(ios_base::failbit);
+ else
+ __val = __tmp;
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (int& __val) {
+ long __lval;
+ _STLP_PRIV __get_num(*this, __lval);
+ if ( this->fail() ) {
+ return *this;
+ }
+ int __tmp = __lval;
+ unsigned int __uval = __lval;
+ // check if we lose digits
+ // if ((__val != __lval) && ((unsigned int)__val != __lval))
+ if ((__tmp != __lval) && ((long)__uval != __lval))
+ this->setstate(ios_base::failbit);
+ else
+ __val = __tmp;
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned short& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned int& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (long& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned long& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+#if defined (_STLP_LONG_LONG)
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (_STLP_LONG_LONG& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned _STLP_LONG_LONG& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+#endif
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (float& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (double& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+#if !defined (_STLP_NO_LONG_DOUBLE)
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (long double& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+#endif
+#if !defined (_STLP_NO_BOOL)
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (bool& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+#endif
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (void*& __val) {
+ _STLP_PRIV __get_num(*this, __val);
+ return *this;
+}
+
+// Unformatted input
+
+template <class _CharT, class _Traits>
+__BIS_int_type__
+basic_istream<_CharT, _Traits>::peek() {
+ typename _Traits::int_type __tmp = _Traits::eof();
+
+ this->_M_gcount = 0;
+ sentry __sentry(*this, _No_Skip_WS());
+
+ if (__sentry) {
+ _STLP_TRY {
+ __tmp = this->rdbuf()->sgetc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ if (this->_S_eof(__tmp))
+ this->setstate(ios_base::eofbit);
+ }
+
+ return __tmp;
+}
+
+
+template <class _CharT, class _Traits>
+__BIS_int_type__
+basic_istream<_CharT, _Traits>::get() {
+ typename _Traits::int_type __tmp = _Traits::eof();
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ _STLP_TRY {
+ __tmp = this->rdbuf()->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (!this->_S_eof(__tmp))
+ this->_M_gcount = 1;
+ }
+
+ if (_M_gcount == 0)
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+
+ return __tmp;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::get(_CharT& __c) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ typename _Traits::int_type __tmp = _Traits::eof();
+ _STLP_TRY {
+ __tmp = this->rdbuf()->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (!this->_S_eof(__tmp)) {
+ this->_M_gcount = 1;
+ __c = _Traits::to_char_type(__tmp);
+ }
+ }
+
+ if (this->_M_gcount == 0)
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+
+ return *this;
+}
+
+
+// Read characters and discard them. The standard specifies a single
+// function with two arguments, each with a default. We instead use
+// three overloded functions, because it's possible to implement the
+// first two more efficiently than the fully general third version.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore() {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ int_type __c;
+ _STLP_TRY {
+ __c = this->rdbuf()->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ return *this;
+ }
+
+ if (!this->_S_eof(__c))
+ this->_M_gcount = 1;
+ else
+ this->setstate(ios_base::eofbit);
+ }
+
+ return *this;
+}
+
+// Putback
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::putback(_CharT __c) {
+ this->_M_gcount = 0;
+ sentry __sentry(*this, _No_Skip_WS());
+
+ if (__sentry) {
+ typename _Traits::int_type __tmp = _Traits::eof();
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+// if (!__buf || this->_S_eof(__buf->sputbackc(__c)))
+ if (__buf) {
+ _STLP_TRY {
+ __tmp = __buf->sputbackc(__c);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ }
+ if (this->_S_eof(__tmp))
+ this->setstate(ios_base::badbit);
+ }
+ else
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() {
+ this->_M_gcount = 0;
+
+ sentry __sentry(*this, _No_Skip_WS());
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ // if (!__buf || _Traits::eq_int_type(__buf->sungetc(), _Traits::eof()))
+ if (__buf) {
+ _STLP_TRY {
+ if (this->_S_eof(__buf->sungetc()))
+ this->setstate(ios_base::badbit);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ } else
+ this->setstate(ios_base::badbit);
+ }
+ else
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// Positioning and buffer control.
+
+template <class _CharT, class _Traits>
+int basic_istream<_CharT, _Traits>::sync() {
+ sentry __sentry(*this, _No_Skip_WS());
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ if (__buf) {
+ if (__buf->pubsync() == -1) {
+ this->setstate(ios_base::badbit);
+ return -1;
+ }
+ else
+ return 0;
+ }
+ else
+ return -1;
+}
+
+template <class _CharT, class _Traits>
+__BIS_pos_type__
+basic_istream<_CharT, _Traits>::tellg() {
+ sentry __sentry(*this, _No_Skip_WS());
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ return (__buf && !this->fail()) ? __buf->pubseekoff(0, ios_base::cur, ios_base::in)
+ : pos_type(-1);
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::seekg(pos_type __pos) {
+ sentry __sentry(*this, _No_Skip_WS());
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ if (!this->fail() && __buf) {
+ if (__buf->pubseekpos(__pos, ios_base::in) == pos_type(-1)) {
+ this->setstate(ios_base::failbit);
+ }
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) {
+ sentry __sentry(*this, _No_Skip_WS());
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ if (!this->fail() && __buf)
+ __buf->pubseekoff(__off, __dir, ios_base::in);
+ return *this;
+}
+
+// Formatted input of characters and character arrays.
+
+template <class _CharT, class _Traits>
+void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT& __c) {
+// typename _Traits::int_type __tmp = _Traits::eof();
+
+ sentry __sentry(*this); // Skip whitespace.
+
+ if (__sentry) {
+ typename _Traits::int_type __tmp;// = _Traits::eof();
+
+ _STLP_TRY {
+ __tmp = this->rdbuf()->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ return;
+ }
+
+ if (!this->_S_eof(__tmp))
+ __c = _Traits::to_char_type(__tmp);
+ else
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+ }
+}
+
+
+//---------------------------------------------------------------------------
+// istream's helper functions.
+
+// A generic function for unbuffered input. We stop when we reach EOF,
+// or when we have extracted _Num characters, or when the function object
+// __is_delim return true. In the last case, it extracts the character
+// for which __is_delim is true, if and only if __extract_delim is true.
+// It appends a null character to the end of the string; this means that
+// it may store up to _Num + 1 characters.
+//
+// __is_getline governs two corner cases: reading _Num characters without
+// encountering delim or eof (in which case failbit is set if __is_getline
+// is true); and reading _Num characters where the _Num+1'st character is
+// eof (in which case eofbit is set if __is_getline is true).
+//
+// It is assumed that __is_delim never throws.
+//
+// Return value is the number of characters extracted, including the
+// delimiter if it is extracted. Note that the number of characaters
+// extracted isn't necessarily the same as the number stored.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template < class _CharT, class _Traits, class _Is_Delim>
+streamsize _STLP_CALL
+__read_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num, _CharT* __s,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __append_null,
+ bool __is_getline)
+{
+ streamsize __n = 0;
+ ios_base::iostate __status = 0;
+
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+ // The operations that can potentially throw are sbumpc, snextc, and sgetc.
+ _STLP_TRY {
+ for (;;) {
+ if (__n == _Num) {
+ if (__is_getline) // didn't find delimiter as one of the _Num chars
+ __status |= ios_base::failbit;
+ break;
+ }
+ int_type __c = __buf->sbumpc(); // sschwarz
+
+ if (__that->_S_eof(__c)) {
+ if (__n < _Num || __is_getline)
+ __status |= ios_base::eofbit;
+ break;
+ } else if (__is_delim(_Traits::to_char_type(__c))) {
+ if (__extract_delim) { // Extract and discard current character.
+ ++__n;
+ } else if ( !__pushback(__buf, _Traits::to_char_type(__c)) ) { // leave delimiter
+ __status |= ios_base::failbit;
+ }
+ break;
+ }
+ // regular character
+ *__s++ = _Traits::to_char_type(__c);
+ ++__n;
+ }
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ return __n;
+ }
+
+ if (__append_null)
+ *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ if (__status)
+ __that->setstate(__status); // This might throw.
+ return __n;
+}
+
+// Much like __read_unbuffered, but with one additional function object:
+// __scan_delim(first, last) returns the first pointer p in [first, last)
+// such that __is_delim(p) is true.
+
+template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
+streamsize _STLP_CALL
+__read_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num, _CharT* __s,
+ _Is_Delim __is_delim, _Scan_Delim __scan_delim,
+ bool __extract_delim, bool __append_null,
+ bool __is_getline) {
+ streamsize __n = 0;
+ ios_base::iostate __status = 0;
+ bool __done = false;
+
+ _STLP_TRY {
+ while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) {
+ const _CharT* __first = __buf->_M_gptr();
+ const _CharT* __last = __buf->_M_egptr();
+ //casting numeric_limits<ptrdiff_t>::max to streamsize only works is ptrdiff_t is signed or streamsize representation
+ //is larger than ptrdiff_t one.
+ _STLP_STATIC_ASSERT((sizeof(streamsize) > sizeof(ptrdiff_t)) ||
+ ((sizeof(streamsize) == sizeof(ptrdiff_t)) && numeric_limits<ptrdiff_t>::is_signed))
+ ptrdiff_t __request = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()), _Num - __n));
+
+ const _CharT* __p = __scan_delim(__first, __last);
+ ptrdiff_t __chunk = (min) (ptrdiff_t(__p - __first), __request);
+ _Traits::copy(__s, __first, __chunk);
+ __s += __chunk;
+ __n += __chunk;
+ __buf->_M_gbump((int)__chunk);
+
+ // We terminated by finding delim.
+ if (__p != __last && __p - __first <= __request) {
+ if (__extract_delim) {
+ __n += 1;
+ __buf->_M_gbump(1);
+ }
+ __done = true;
+ }
+
+ // We terminated by reading all the characters we were asked for.
+ else if (__n == _Num) {
+
+ // Find out if we have reached eof. This matters for getline.
+ if (__is_getline) {
+ if (__chunk == __last - __first) {
+ if (__that->_S_eof(__buf->sgetc()))
+ __status |= ios_base::eofbit;
+ }
+ else
+ __status |= ios_base::failbit;
+ }
+ __done = true;
+ }
+
+ // The buffer contained fewer than _Num - __n characters. Either we're
+ // at eof, or we should refill the buffer and try again.
+ else {
+ if (__that->_S_eof(__buf->sgetc())) {
+ __status |= ios_base::eofbit;
+ __done = true;
+ }
+ }
+ } // Close the while loop.
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ __done = true;
+ }
+
+ if (__done) {
+ if (__append_null)
+ *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ if (__status != 0)
+ __that->setstate(__status); // This might throw.
+ return __n;
+ }
+
+ // If execution has reached this point, then we have an empty buffer but
+ // we have not reached eof. What that means is that the streambuf has
+ // decided to switch from buffered to unbuffered input. We switch to
+ // to __read_unbuffered.
+
+ return __n + __read_unbuffered(__that, __buf, _Num - __n, __s, __is_delim,
+ __extract_delim,__append_null,__is_getline);
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::get(_CharT* __s, streamsize __n,
+ _CharT __delim) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ if (__n > 0) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+
+ if (__buf->egptr() != __buf->gptr())
+ this->_M_gcount =
+ _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ _STLP_PRIV _Scan_for_char_val<_Traits>(__delim),
+ false, true, false);
+ else
+ this->_M_gcount =
+ _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ false, true, false);
+ }
+ }
+
+ if (this->_M_gcount == 0)
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// Getline is essentially identical to get, except that it extracts
+// the delimiter.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::getline(_CharT* __s, streamsize __n,
+ _CharT __delim) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ if (__n > 0) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ this->_M_gcount = __buf->egptr() != __buf->gptr()
+ ? _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ _STLP_PRIV _Scan_for_char_val<_Traits>(__delim),
+ true, true, true)
+ : _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ true, true, true);
+ }
+ }
+
+ if (this->_M_gcount == 0)
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// Read n characters. We don't look for any delimiter, and we don't
+// put in a terminating null character.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry && !this->eof()) {
+ basic_streambuf<_CharT, _Traits>*__buf = this->rdbuf();
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount
+ = _STLP_PRIV __read_buffered(this, __buf, __n, __s,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ false, false, false);
+ else
+ _M_gcount
+ = _STLP_PRIV __read_unbuffered(this, __buf, __n, __s,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ false, false, false);
+ }
+ else
+ this->setstate(ios_base::failbit);
+
+ if (this->eof())
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+
+ return *this;
+}
+
+
+// Read n or fewer characters. We don't look for any delimiter, and
+// we don't put in a terminating null character.
+template <class _CharT, class _Traits>
+streamsize
+basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __nmax) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry && !this->eof() && __nmax >= 0) {
+
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ streamsize __avail = __buf->in_avail();
+
+ // fbp : isn't full-blown setstate required here ?
+ if (__avail == -1)
+ this->_M_setstate_nothrow(ios_base::eofbit);
+
+ else if (__avail != 0) {
+
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount
+ = _STLP_PRIV __read_buffered(this, __buf, (min) (__avail, __nmax), __s,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ false, false, false);
+ else
+ _M_gcount
+ = _STLP_PRIV __read_unbuffered(this, __buf, (min) (__avail, __nmax), __s,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ false, false, false);
+ }
+ }
+ else {
+ // fbp : changed so that failbit is set only there, to pass Dietmar's test
+ if (this->eof())
+ this->setstate(ios_base::eofbit | ios_base::failbit);
+ else
+ this->setstate(ios_base::failbit);
+ }
+
+ // if (this->eof())
+ // this->setstate(ios_base::eofbit | ios_base::failbit);
+
+ return _M_gcount;
+}
+
+template <class _CharT, class _Traits>
+void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT* __s) {
+ sentry __sentry(*this); // Skip whitespace.
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ streamsize __nmax = this->width() > 0
+ ? this->width() - 1
+ : ((numeric_limits<streamsize>::max)() / sizeof(_CharT)) - 1;
+
+ streamsize __n = __buf->gptr() != __buf->egptr()
+ ? _STLP_PRIV __read_buffered(this, __buf, __nmax, __s,
+ _STLP_PRIV _Is_wspace_null<_Traits>(this->_M_ctype_facet()),
+ _STLP_PRIV _Scan_wspace_null<_Traits>(this->_M_ctype_facet()),
+ false, true, false)
+ : _STLP_PRIV __read_unbuffered(this, __buf, __nmax, __s,
+ _STLP_PRIV _Is_wspace_null<_Traits>(this->_M_ctype_facet()),
+ false, true, false);
+ if (__n == 0)
+ this->setstate(ios_base::failbit);
+ }
+ this->width(0);
+}
+
+// A generic unbuffered function for ignoring characters. We stop
+// when we reach EOF, or when the function object __is_delim returns
+// true. In the last case, it extracts the character for which
+// __is_delim is true, if and only if __extract_delim is true.
+
+template < class _CharT, class _Traits, class _Is_Delim>
+void _STLP_CALL
+_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __set_failbit) {
+ bool __done = false;
+ ios_base::iostate __status = 0;
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+
+ _STLP_TRY {
+ while (!__done) {
+ int_type __c = __buf->sbumpc();
+
+ if (__that->_S_eof(__c)) {
+ __done = true;
+ __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
+ : ios_base::eofbit;
+ }
+
+ else if (__is_delim(_Traits::to_char_type(__c))) {
+ __done = true;
+ if (!__extract_delim)
+ if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c))))
+ __status |= ios_base::failbit;
+ }
+ }
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ }
+
+ __that->setstate(__status);
+}
+
+// A generic buffered function for ignoring characters. Much like
+// _M_ignore_unbuffered, but with one additional function object:
+// __scan_delim(first, last) returns the first pointer p in [first,
+// last) such that __is_delim(p) is true.
+
+template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
+void _STLP_CALL
+_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ _Is_Delim __is_delim, _Scan_Delim __scan_delim,
+ bool __extract_delim, bool __set_failbit) {
+ bool __at_eof = false;
+ bool __found_delim = false;
+
+ _STLP_TRY {
+ while (__buf->_M_egptr() != __buf->_M_gptr() && !__at_eof && !__found_delim) {
+ const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr());
+ __buf->_M_gbump((int)(__p - __buf->_M_gptr()));
+
+ if (__p != __buf->_M_egptr()) { // We found delim, so we're done.
+ if (__extract_delim)
+ __buf->_M_gbump(1);
+ __found_delim = true;
+ }
+
+ else // No delim. Try to refil the buffer.
+ __at_eof = __that->_S_eof(__buf->sgetc());
+ } // Close the while loop.
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ return;
+ }
+
+ if (__at_eof) {
+ __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
+ : ios_base::eofbit);
+ return;
+ }
+ if (__found_delim)
+ return;
+
+ // If execution has reached this point, then we have an empty buffer but
+ // we have not reached eof. What that means is that the streambuf has
+ // decided to switch from a buffered to an unbuffered mode. We switch
+ // to _M_ignore_unbuffered.
+ _M_ignore_unbuffered(__that, __buf, __is_delim, __extract_delim, __set_failbit);
+}
+
+// Overloaded versions of _M_ignore_unbuffered and _M_ignore_unbuffered
+// with an explicit count _Num. Return value is the number of
+// characters extracted.
+//
+// The function object __max_chars takes two arguments, _Num and __n
+// (the latter being the number of characters we have already read),
+// and returns the maximum number of characters to read from the buffer.
+// We parameterize _M_ignore_buffered so that we can use it for both
+// bounded and unbounded input; for the former the function object should
+// be minus<>, and for the latter it should return a constant maximum value.
+
+template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim>
+streamsize _STLP_CALL
+_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num, _Max_Chars __max_chars,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __set_failbit) {
+ streamsize __n = 0;
+ ios_base::iostate __status = 0;
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+
+ _STLP_TRY {
+ while (__max_chars(_Num, __n) > 0) {
+ int_type __c = __buf->sbumpc();
+
+ if (__that->_S_eof(__c)) {
+ __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit
+ : ios_base::eofbit;
+ break;
+ }
+
+ else if (__is_delim(_Traits::to_char_type(__c))) {
+ if (__extract_delim)
+ ++__n;
+ else if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c))))
+ __status |= ios_base::failbit;
+
+ break;
+ }
+ // fbp : added counter increment to pass Dietmar's test
+ ++__n;
+ }
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (__status)
+ __that->setstate(__status); // This might throw.
+ return __n;
+}
+
+template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim, class _Scan_Delim>
+streamsize _STLP_CALL
+_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num,
+ _Max_Chars __max_chars,
+ _Is_Delim __is_delim, _Scan_Delim __scan_delim,
+ bool __extract_delim, bool __set_failbit) {
+ streamsize __n = 0;
+ bool __at_eof = false;
+ bool __done = false;
+
+ _STLP_TRY {
+ while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) {
+ ptrdiff_t __avail = __buf->_M_egptr() - __buf->_M_gptr();
+ streamsize __m = __max_chars(_Num, __n);
+
+ if (__avail >= __m) { // We have more characters than we need.
+ const _CharT* __last = __buf->_M_gptr() + __STATIC_CAST(ptrdiff_t, __m);
+ const _CharT* __p = __scan_delim(__buf->_M_gptr(), __last);
+ ptrdiff_t __chunk = __p - __buf->_M_gptr();
+ __n += __chunk;
+ __buf->_M_gbump((int)__chunk);
+
+ if (__extract_delim && __p != __last) {
+ __n += 1;
+ __buf->_M_gbump(1);
+ }
+
+ __done = true;
+ }
+
+ else {
+ const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr());
+ ptrdiff_t __chunk = __p - __buf->_M_gptr();
+ __n += __chunk;
+ __buf->_M_gbump((int)__chunk);
+
+ if (__p != __buf->_M_egptr()) { // We found delim.
+ if (__extract_delim) {
+ __n += 1;
+ __buf->_M_gbump(1);
+ }
+
+ __done = true;
+ }
+
+ // We didn't find delim. Try to refill the buffer.
+ else if (__that->_S_eof(__buf->sgetc())) {
+ __done = true;
+ __at_eof = true;
+ }
+ }
+ } // Close the while loop.
+ }
+ _STLP_CATCH_ALL {
+ __that->_M_handle_exception(ios_base::badbit);
+ return __n;
+ }
+
+ if (__at_eof)
+ __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit
+ : ios_base::eofbit);
+
+ if (__done)
+ return __n;
+
+ // If execution has reached this point, then we have an empty buffer but
+ // we have not reached eof. What that means is that the streambuf has
+ // decided to switch from buffered to unbuffered input. We switch to
+ // to _M_ignore_unbuffered.
+
+ return __n + _M_ignore_unbuffered(__that, __buf, _Num, __max_chars,
+ __is_delim, __extract_delim, __set_failbit);
+}
+
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::ignore(streamsize __n) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ typedef _STLP_PRIV _Constant_unary_fun<bool, int_type> _Const_bool;
+ typedef _STLP_PRIV _Constant_binary_fun<streamsize, streamsize, streamsize> _Const_streamsize;
+ const streamsize __maxss = (numeric_limits<streamsize>::max)();
+
+ if (__n == (numeric_limits<int>::max)()) {
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount = _M_ignore_buffered(this, __buf,
+ __maxss, _Const_streamsize(__maxss),
+ _Const_bool(false),
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ false, false);
+ else
+ _M_gcount = _M_ignore_unbuffered(this, __buf,
+ __maxss, _Const_streamsize(__maxss),
+ _Const_bool(false), false, false);
+ }
+ else {
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount = _M_ignore_buffered(this, __buf,
+ __n, minus<streamsize>(),
+ _Const_bool(false),
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ false, false);
+ else
+ _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus<streamsize>(),
+ _Const_bool(false), false, false);
+ }
+ }
+
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __delim) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ typedef _STLP_PRIV _Constant_unary_fun<bool, int_type> _Const_bool;
+ typedef _STLP_PRIV _Constant_binary_fun<streamsize, streamsize, streamsize>
+ _Const_streamsize;
+ const streamsize __maxss = (numeric_limits<streamsize>::max)();
+
+ if (__n == (numeric_limits<int>::max)()) {
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount = _M_ignore_buffered(this, __buf,
+ __maxss, _Const_streamsize(__maxss),
+ _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
+ _STLP_PRIV _Scan_for_int_val<_Traits>(__delim),
+ true, false);
+ else
+ _M_gcount = _M_ignore_unbuffered(this, __buf,
+ __maxss, _Const_streamsize(__maxss),
+ _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
+ true, false);
+ }
+ else {
+ if (__buf->gptr() != __buf->egptr())
+ _M_gcount = _M_ignore_buffered(this, __buf,
+ __n, minus<streamsize>(),
+ _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
+ _STLP_PRIV _Scan_for_int_val<_Traits>(__delim),
+ true, false);
+ else
+ _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus<streamsize>(),
+ _STLP_PRIV _Eq_int_bound<_Traits>(__delim),
+ true, false);
+ }
+ }
+
+ return *this;
+}
+
+// This member function does not construct a sentry object, because
+// it is called from sentry's constructor.
+template <class _CharT, class _Traits>
+void basic_istream<_CharT, _Traits>::_M_skip_whitespace(bool __set_failbit) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+ if (!__buf)
+ this->setstate(ios_base::badbit);
+ else if (__buf->gptr() != __buf->egptr())
+ _M_ignore_buffered(this, __buf,
+ _STLP_PRIV _Is_not_wspace<_Traits>(this->_M_ctype_facet()),
+ _STLP_PRIV _Scan_for_not_wspace<_Traits>(this->_M_ctype_facet()),
+ false, __set_failbit);
+ else
+ _M_ignore_unbuffered(this, __buf,
+ _STLP_PRIV _Is_not_wspace<_Traits>(this->_M_ctype_facet()),
+ false, __set_failbit);
+}
+
+
+// This is a very simple loop that reads characters from __src and puts
+// them into __dest. It looks complicated because of the (standard-
+// mandated) exception handling policy.
+//
+// We stop when we get an exception, when we fail to insert into the
+// output streambuf, or when __is_delim is true.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template < class _CharT, class _Traits, class _Is_Delim>
+streamsize _STLP_CALL
+__copy_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src,
+ basic_streambuf<_CharT, _Traits>* __dest,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __rethrow) {
+ streamsize __extracted = 0;
+ ios_base::iostate __status = 0;
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+ int_type __c;
+
+ _STLP_TRY {
+ for (;;) {
+ // Get a character. If there's an exception, catch and (maybe) rethrow it.
+ __c = __src->sbumpc();
+
+ // If we failed to get a character, then quit.
+ if (__that->_S_eof(__c)) {
+ __status |= ios_base::eofbit;
+ break;
+ }
+ // If it's the delimiter, then quit.
+ else if (__is_delim(_Traits::to_char_type(__c))) {
+ if (!__extract_delim && !__pushback(__src, _Traits::to_char_type(__c)))
+ __status |= ios_base::failbit;
+ break;
+ }
+ else {
+ // Try to put the character in the output streambuf.
+ bool __failed = false;
+ _STLP_TRY {
+ if (!__that->_S_eof(__dest->sputc(_Traits::to_char_type(__c))))
+ ++__extracted;
+ else
+ __failed = true;
+ }
+ _STLP_CATCH_ALL {
+ __failed = true;
+ }
+
+ // If we failed to put the character in the output streambuf, then
+ // try to push it back to the input streambuf.
+ if (__failed && !__pushback(__src, _Traits::to_char_type(__c)))
+ __status |= ios_base::failbit;
+
+ // fbp : avoiding infinite loop in io-27-6-1-2-3.exp
+ if (__failed)
+ break;
+ }
+
+ } /* for (;;) */
+
+ }
+ // fbp : this try/catch moved here in reasonable assumption
+ // __is_delim never throw (__pushback is guaranteed not to)
+ _STLP_CATCH_ALL {
+ // See 27.6.1.2.3, paragraph 13.
+ if (__rethrow && __extracted == 0)
+ __that->_M_handle_exception(ios_base::failbit);
+ }
+ __that->setstate(__status);
+ return __extracted;
+}
+
+// Buffered copying from one streambuf to another. We copy the characters
+// in chunks, rather than one at a time. We still have to worry about all
+// of the error conditions we checked in __copy_unbuffered, plus one more:
+// the streambuf might decide to switch from a buffered to an unbuffered mode.
+
+template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim>
+streamsize _STLP_CALL
+__copy_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src,
+ basic_streambuf<_CharT, _Traits>* __dest,
+ _Scan_Delim __scan_delim, _Is_Delim __is_delim,
+ bool __extract_delim, bool __rethrow) {
+ streamsize __extracted = 0;
+ ios_base::iostate __status = 0;
+ typedef typename basic_istream<_CharT, _Traits>::int_type int_type;
+ //Borland compiler generates a warning if assignment because value is never used:
+ int_type __c /*= _Traits::eof()*/;
+ _CharT* __first = __src->_M_gptr();
+ ptrdiff_t __avail = __src->_M_egptr() - __first;
+ // fbp : introduced to move catch/try blocks out of the loop
+ bool __do_handle_exceptions = false;
+
+ _STLP_TRY {
+ for (;;) {
+ const _CharT* __last = __scan_delim(__first, __src->_M_egptr());
+
+ // Try to copy the entire input buffer to the output buffer.
+ streamsize __n = __dest->sputn(__first, __extract_delim && __last != __src->_M_egptr()
+ ? (__last - __first) + 1
+ : (__last - __first));
+ __src->_M_gbump((int)__n);
+ __extracted += __n;
+
+ // from this on, catch() will call _M_handle_exceptions()
+ __do_handle_exceptions = true;
+
+ if (__n < __avail) // We found the delimiter, or else failed to
+ break; // copy some characters.
+
+ __c = __src->sgetc();
+
+ // Three possibilities: we succeeded in refilling the buffer, or
+ // we got EOF, or the streambuf has switched to unbuffered mode.
+ __first = __src->_M_gptr();
+ __avail = __src->_M_egptr() - __first;
+
+ if (__avail > 0)
+ {} // dwa 1/16/00 -- suppress a Metrowerks warning
+ else if (__that->_S_eof(__c)) {
+ __status |= ios_base::eofbit;
+ break;
+ }
+ else {
+ return __extracted + __copy_unbuffered(__that, __src, __dest, __is_delim,
+ __extract_delim, __rethrow);
+ }
+
+ __do_handle_exceptions = false;
+ }
+ }
+
+ _STLP_CATCH_ALL {
+ // See 27.6.1.2.3, paragraph 13.
+ if (__rethrow && __do_handle_exceptions && __extracted == 0)
+ __that->_M_handle_exception(ios_base::failbit);
+ }
+
+ if (__status)
+ __that->setstate(__status); // This might throw.
+ return __extracted;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>
+ ::get(basic_streambuf<_CharT, _Traits>& __dest, _CharT __delim) {
+ sentry __sentry(*this, _No_Skip_WS());
+ this->_M_gcount = 0;
+
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
+
+ if (__src)
+ this->_M_gcount = __src->egptr() != __src->gptr()
+ ? _STLP_PRIV __copy_buffered(this, __src, &__dest,
+ _STLP_PRIV _Scan_for_char_val<_Traits>(__delim),
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ false, false)
+ : _STLP_PRIV __copy_unbuffered(this, __src, &__dest,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__delim),
+ false, false);
+ }
+
+ if (this->_M_gcount == 0)
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// Copying characters into a streambuf.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>&
+basic_istream<_CharT, _Traits>
+ ::operator>>(basic_streambuf<_CharT, _Traits>* __dest) {
+ streamsize __n = 0;
+ typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
+ _Sentry __sentry(*this);
+ if (__sentry) {
+ basic_streambuf<_CharT, _Traits>* __src = this->rdbuf();
+ if (__src && __dest)
+ __n = __src->egptr() != __src->gptr()
+ ? _STLP_PRIV __copy_buffered(this, __src, __dest,
+ _STLP_PRIV _Project2nd<const _CharT*, const _CharT*>(),
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ false, true)
+ : _STLP_PRIV __copy_unbuffered(this, __src, __dest,
+ _STLP_PRIV _Constant_unary_fun<bool, int_type>(false),
+ false, true);
+ }
+
+ if (__n == 0)
+ this->setstate(ios_base::failbit);
+
+ return *this;
+}
+
+// ----------------------------------------------------------------
+// basic_iostream<> class
+// ----------------------------------------------------------------
+
+template <class _CharT, class _Traits>
+basic_iostream<_CharT, _Traits>
+ ::basic_iostream(basic_streambuf<_CharT, _Traits>* __buf)
+ : basic_ios<_CharT, _Traits>(),
+ basic_istream<_CharT, _Traits>(__buf),
+ basic_ostream<_CharT, _Traits>(__buf) {
+ this->init(__buf);
+}
+
+template <class _CharT, class _Traits>
+basic_iostream<_CharT, _Traits>::~basic_iostream()
+{}
+
+_STLP_END_NAMESPACE
+
+#undef __BIS_int_type__
+#undef __BIS_pos_type__
+#undef __BIS_off_type__
+
+#endif /* _STLP_ISTREAM_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_istream.h b/stlport/stl/_istream.h
new file mode 100644
index 0000000..6b38d03
--- /dev/null
+++ b/stlport/stl/_istream.h
@@ -0,0 +1,359 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_INTERNAL_ISTREAM
+#define _STLP_INTERNAL_ISTREAM
+
+// this block is included by _ostream.h, we include it here to lower #include level
+#if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR)
+# include <stl/_cwchar.h>
+#endif
+
+#ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h> // For basic_ios<>. Includes <iosfwd>.
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAM_H
+# include <stl/_ostream.h> // Needed as a base class of basic_iostream.
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+# include <stl/_istreambuf_iterator.h>
+#endif
+
+#include <stl/_ctraits_fns.h> // Helper functions that allow char traits
+ // to be used as function objects.
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+template <class _CharT, class _Traits>
+class _Isentry;
+#endif
+
+struct _No_Skip_WS {}; // Dummy class used by sentry.
+
+template <class _CharT, class _Traits>
+bool _M_init_skip(basic_istream<_CharT, _Traits>& __istr);
+template <class _CharT, class _Traits>
+bool _M_init_noskip(basic_istream<_CharT, _Traits>& __istr);
+
+//----------------------------------------------------------------------
+// Class basic_istream, a class that performs formatted input through
+// a stream buffer.
+
+// The second template parameter, _Traits, defaults to char_traits<_CharT>.
+// The default is declared in header <iosfwd>, and it isn't declared here
+// because C++ language rules do not allow it to be declared twice.
+
+template <class _CharT, class _Traits>
+class basic_istream : virtual public basic_ios<_CharT, _Traits> {
+ typedef basic_istream<_CharT, _Traits> _Self;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ //explicitely defined as private to avoid warnings:
+ basic_istream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+
+public:
+ // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+
+ typedef basic_ios<_CharT, _Traits>& (_STLP_CALL *__ios_fn)(basic_ios<_CharT, _Traits>&);
+ typedef ios_base& (_STLP_CALL *__ios_base_fn)(ios_base&);
+ typedef _Self& (_STLP_CALL *__istream_fn)(_Self&);
+
+public: // Constructor and destructor.
+ explicit basic_istream(basic_streambuf<_CharT, _Traits>* __buf) :
+ basic_ios<_CharT, _Traits>(), _M_gcount(0) {
+ this->init(__buf);
+ }
+ ~basic_istream() {};
+
+public: // Nested sentry class.
+
+public: // Hooks for manipulators. The arguments are
+ // function pointers.
+ _Self& operator>> (__istream_fn __f) { return __f(*this); }
+ _Self& operator>> (__ios_fn __f) { __f(*this); return *this; }
+ _Self& operator>> (__ios_base_fn __f) { __f(*this); return *this; }
+
+public: // Formatted input of numbers.
+ _Self& operator>> (short& __val);
+ _Self& operator>> (int& __val);
+ _Self& operator>> (unsigned short& __val);
+ _Self& operator>> (unsigned int& __val);
+ _Self& operator>> (long& __val);
+ _Self& operator>> (unsigned long& __val);
+#ifdef _STLP_LONG_LONG
+ _Self& operator>> (_STLP_LONG_LONG& __val);
+ _Self& operator>> (unsigned _STLP_LONG_LONG& __val);
+#endif
+ _Self& operator>> (float& __val);
+ _Self& operator>> (double& __val);
+# ifndef _STLP_NO_LONG_DOUBLE
+ _Self& operator>> (long double& __val);
+# endif
+# ifndef _STLP_NO_BOOL
+ _Self& operator>> (bool& __val);
+# endif
+ _Self& operator>> (void*& __val);
+
+public: // Copying characters into a streambuf.
+ _Self& operator>>(basic_streambuf<_CharT, _Traits>*);
+
+public: // Unformatted input.
+ streamsize gcount() const { return _M_gcount; }
+ int_type peek();
+
+public: // get() for single characters
+ int_type get();
+ _Self& get(char_type& __c);
+
+public: // get() for character arrays.
+ _Self& get(char_type* __s, streamsize __n, char_type __delim);
+ _Self& get(char_type* __s, streamsize __n)
+ { return get(__s, __n, this->widen('\n')); }
+
+public: // get() for streambufs
+ _Self& get(basic_streambuf<_CharT, _Traits>& __buf,
+ char_type __delim);
+ _Self& get(basic_streambuf<_CharT, _Traits>& __buf)
+ { return get(__buf, this->widen('\n')); }
+
+public: // getline()
+ _Self& getline(char_type* __s, streamsize __n, char_type delim);
+ _Self& getline(char_type* __s, streamsize __n)
+ { return getline(__s, __n, this->widen('\n')); }
+
+public: // read(), readsome(), ignore()
+ _Self& ignore();
+ _Self& ignore(streamsize __n);
+ _Self& ignore(streamsize __n, int_type __delim);
+
+ _Self& read(char_type* __s, streamsize __n);
+ streamsize readsome(char_type* __s, streamsize __n);
+
+public: // putback
+ _Self& putback(char_type __c);
+ _Self& unget();
+
+public: // Positioning and buffer control.
+ int sync();
+
+ pos_type tellg();
+ _Self& seekg(pos_type __pos);
+ _Self& seekg(off_type, ios_base::seekdir);
+
+public: // Helper functions for non-member extractors.
+ void _M_formatted_get(_CharT& __c);
+ void _M_formatted_get(_CharT* __s);
+ void _M_skip_whitespace(bool __set_failbit);
+
+private: // Number of characters extracted by the
+ streamsize _M_gcount; // most recent unformatted input function.
+
+public:
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+ // If we are using DLL specs, we have not to use inner classes
+ // end class declaration here
+ typedef _Isentry<_CharT, _Traits> sentry;
+};
+# define sentry _Isentry
+template <class _CharT, class _Traits>
+class _Isentry {
+ typedef _Isentry<_CharT, _Traits> _Self;
+# else
+ class sentry {
+ typedef sentry _Self;
+#endif
+
+ private:
+ const bool _M_ok;
+ // basic_streambuf<_CharT, _Traits>* _M_buf;
+
+ public:
+ typedef _Traits traits_type;
+
+ explicit sentry(basic_istream<_CharT, _Traits>& __istr,
+ bool __noskipws = false) :
+ _M_ok((__noskipws || !(__istr.flags() & ios_base::skipws)) ? _M_init_noskip(__istr) : _M_init_skip(__istr) )
+ /* , _M_buf(__istr.rdbuf()) */
+ {}
+
+ // Calling this constructor is the same as calling the previous one with
+ // __noskipws = true, except that it doesn't require a runtime test.
+ sentry(basic_istream<_CharT, _Traits>& __istr, _No_Skip_WS) : /* _M_buf(__istr.rdbuf()), */
+ _M_ok(_M_init_noskip(__istr)) {}
+
+ ~sentry() {}
+
+ operator bool() const { return _M_ok; }
+
+ private: // Disable assignment and copy constructor.
+ //Implementation is here only to avoid warning with some compilers.
+ sentry(const _Self&) : _M_ok(false) {}
+ _Self& operator=(const _Self&) { return *this; }
+ };
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+# undef sentry
+# else
+ // close basic_istream class definition here
+};
+# endif
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _Isentry<char, char_traits<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_istream<char, char_traits<char> >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS _Isentry<wchar_t, char_traits<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_istream<wchar_t, char_traits<wchar_t> >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+// Non-member character and string extractor functions.
+template <class _CharT, class _Traits>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __in_str, _CharT& __c) {
+ __in_str._M_formatted_get(__c);
+ return __in_str;
+}
+
+template <class _Traits>
+inline basic_istream<char, _Traits>& _STLP_CALL
+operator>>(basic_istream<char, _Traits>& __in_str, unsigned char& __c) {
+ __in_str._M_formatted_get(__REINTERPRET_CAST(char&,__c));
+ return __in_str;
+}
+
+template <class _Traits>
+inline basic_istream<char, _Traits>& _STLP_CALL
+operator>>(basic_istream<char, _Traits>& __in_str, signed char& __c) {
+ __in_str._M_formatted_get(__REINTERPRET_CAST(char&,__c));
+ return __in_str;
+}
+
+template <class _CharT, class _Traits>
+inline basic_istream<_CharT, _Traits>& _STLP_CALL
+operator>>(basic_istream<_CharT, _Traits>& __in_str, _CharT* __s) {
+ __in_str._M_formatted_get(__s);
+ return __in_str;
+}
+
+template <class _Traits>
+inline basic_istream<char, _Traits>& _STLP_CALL
+operator>>(basic_istream<char, _Traits>& __in_str, unsigned char* __s) {
+ __in_str._M_formatted_get(__REINTERPRET_CAST(char*,__s));
+ return __in_str;
+}
+
+template <class _Traits>
+inline basic_istream<char, _Traits>& _STLP_CALL
+operator>>(basic_istream<char, _Traits>& __in_str, signed char* __s) {
+ __in_str._M_formatted_get(__REINTERPRET_CAST(char*,__s));
+ return __in_str;
+}
+
+//----------------------------------------------------------------------
+// istream manipulator.
+template <class _CharT, class _Traits>
+basic_istream<_CharT, _Traits>& _STLP_CALL
+ws(basic_istream<_CharT, _Traits>& __istr) {
+ if (!__istr.eof()) {
+ typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry;
+ _Sentry __sentry(__istr, _No_Skip_WS()); // Don't skip whitespace.
+ if (__sentry)
+ __istr._M_skip_whitespace(false);
+ }
+ return __istr;
+}
+
+// Helper functions for istream<>::sentry constructor.
+template <class _CharT, class _Traits>
+inline bool _M_init_skip(basic_istream<_CharT, _Traits>& __istr) {
+ if (__istr.good()) {
+ if (__istr.tie())
+ __istr.tie()->flush();
+
+ __istr._M_skip_whitespace(true);
+ }
+
+ if (!__istr.good()) {
+ __istr.setstate(ios_base::failbit);
+ return false;
+ } else
+ return true;
+}
+
+template <class _CharT, class _Traits>
+inline bool _M_init_noskip(basic_istream<_CharT, _Traits>& __istr) {
+ if (__istr.good()) {
+ if (__istr.tie())
+ __istr.tie()->flush();
+
+ if (!__istr.rdbuf())
+ __istr.setstate(ios_base::badbit);
+ }
+ else
+ __istr.setstate(ios_base::failbit);
+ return __istr.good();
+}
+
+//----------------------------------------------------------------------
+// Class iostream.
+template <class _CharT, class _Traits>
+class basic_iostream
+ : public basic_istream<_CharT, _Traits>,
+ public basic_ostream<_CharT, _Traits>
+{
+public:
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+
+ explicit basic_iostream(basic_streambuf<_CharT, _Traits>* __buf);
+ virtual ~basic_iostream();
+};
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_iostream<char, char_traits<char> >;
+
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_iostream<wchar_t, char_traits<wchar_t> >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+template <class _CharT, class _Traits>
+basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& __istr)
+{ return __istr.rdbuf(); }
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_istream.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ISTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_istreambuf_iterator.h b/stlport/stl/_istreambuf_iterator.h
new file mode 100644
index 0000000..9f340cb
--- /dev/null
+++ b/stlport/stl/_istreambuf_iterator.h
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+#define _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// defined in _istream.h
+template <class _CharT, class _Traits>
+extern basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& ) ;
+
+// We do not read any characters until operator* is called. operator* calls sgetc
+// unless the iterator is unchanged from the last call in which case a cached value is
+// used. Calls to operator++ use sbumpc.
+
+template<class _CharT, class _Traits>
+class istreambuf_iterator :
+ public iterator<input_iterator_tag, _CharT, typename _Traits::off_type, _CharT*, _CharT&>
+{
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::int_type int_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
+ typedef input_iterator_tag iterator_category;
+ typedef _CharT value_type;
+ typedef typename _Traits::off_type difference_type;
+ typedef const _CharT* pointer;
+ typedef const _CharT& reference;
+
+public:
+ istreambuf_iterator(streambuf_type* __p = 0) { this->_M_init(__p); }
+ // istreambuf_iterator(basic_istream<_CharT, _Traits>& __is) { this->_M_init(_M_get_istreambuf(__is)); }
+ inline istreambuf_iterator(basic_istream<_CharT, _Traits>& __is);
+
+ char_type operator*() const { this->_M_getc(); return _M_c; }
+ istreambuf_iterator<_CharT, _Traits>& operator++() {
+ _M_buf->sbumpc();
+ _M_have_c = false;
+ return *this;
+ }
+ istreambuf_iterator<_CharT, _Traits> operator++(int);
+
+ bool equal(const istreambuf_iterator<_CharT, _Traits>& __i) const {
+ if (this->_M_buf)
+ this->_M_getc();
+ if (__i._M_buf)
+ __i._M_getc();
+ return this->_M_eof == __i._M_eof;
+ }
+
+private:
+ void _M_init(streambuf_type* __p) {
+ _M_buf = __p;
+ _M_eof = (__p == 0);
+ _M_have_c = false;
+ }
+
+ void _M_getc() const {
+ if (_M_have_c)
+ return;
+ int_type __c = _M_buf->sgetc();
+ _STLP_MUTABLE(_Self, _M_c) = traits_type::to_char_type(__c);
+ _STLP_MUTABLE(_Self, _M_eof) = traits_type::eq_int_type(__c, traits_type::eof());
+ _STLP_MUTABLE(_Self, _M_have_c) = true;
+ }
+
+private:
+ streambuf_type* _M_buf;
+ mutable _CharT _M_c;
+ mutable bool _M_eof;
+ mutable bool _M_have_c;
+};
+
+template<class _CharT, class _Traits>
+inline istreambuf_iterator<_CharT, _Traits>::istreambuf_iterator(basic_istream<_CharT, _Traits>& __is)
+{ this->_M_init(_M_get_istreambuf(__is)); }
+
+template<class _CharT, class _Traits>
+inline bool _STLP_CALL operator==(const istreambuf_iterator<_CharT, _Traits>& __x,
+ const istreambuf_iterator<_CharT, _Traits>& __y) {
+ return __x.equal(__y);
+}
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template<class _CharT, class _Traits>
+inline bool _STLP_CALL operator!=(const istreambuf_iterator<_CharT, _Traits>& __x,
+ const istreambuf_iterator<_CharT, _Traits>& __y) {
+ return !__x.equal(__y);
+}
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator<char, char_traits<char> >;
+# if defined (INSTANTIATE_WIDE_STREAMS)
+_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator<wchar_t, char_traits<wchar_t> >;
+# endif
+# endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _CharT, class _Traits>
+inline input_iterator_tag _STLP_CALL iterator_category(const istreambuf_iterator<_CharT, _Traits>&) { return input_iterator_tag(); }
+template <class _CharT, class _Traits>
+inline streamoff* _STLP_CALL
+distance_type(const istreambuf_iterator<_CharT, _Traits>&) { return (streamoff*)0; }
+template <class _CharT, class _Traits>
+inline _CharT* _STLP_CALL value_type(const istreambuf_iterator<_CharT, _Traits>&) { return (_CharT*)0; }
+# endif
+
+template <class _CharT, class _Traits>
+istreambuf_iterator<_CharT, _Traits>
+istreambuf_iterator<_CharT, _Traits>::operator++(int) {
+ _M_getc(); // __tmp should avoid any future actions under
+ // underlined buffer---during call of operator *()
+ // (due to buffer for *this and __tmp are the same).
+ istreambuf_iterator<_CharT, _Traits> __tmp = *this;
+ _M_buf->sbumpc();
+ _M_have_c = false;
+ return __tmp;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_iterator.h b/stlport/stl/_iterator.h
new file mode 100644
index 0000000..8e3b7b0
--- /dev/null
+++ b/stlport/stl/_iterator.h
@@ -0,0 +1,265 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+#define _STLP_INTERNAL_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+// This is the new version of reverse_iterator, as defined in the
+// draft C++ standard. It relies on the iterator_traits template,
+// which in turn relies on partial specialization. The class
+// reverse_bidirectional_iterator is no longer part of the draft
+// standard, but it is retained for backward compatibility.
+
+template <class _Iterator>
+class reverse_iterator :
+ public iterator<typename iterator_traits<_Iterator>::iterator_category,
+ typename iterator_traits<_Iterator>::value_type,
+ typename iterator_traits<_Iterator>::difference_type,
+ typename iterator_traits<_Iterator>::pointer,
+ typename iterator_traits<_Iterator>::reference> {
+protected:
+ _Iterator current;
+ typedef reverse_iterator<_Iterator> _Self;
+public:
+ typedef typename iterator_traits<_Iterator>::difference_type difference_type;
+ // pointer type required for arrow operator hidden behind _STLP_DEFINE_ARROW_OPERATOR:
+ typedef typename iterator_traits<_Iterator>::pointer pointer;
+ typedef typename iterator_traits<_Iterator>::reference reference;
+ typedef _Iterator iterator_type;
+public:
+ reverse_iterator() {}
+ explicit reverse_iterator(iterator_type __x) : current(__x) {}
+ reverse_iterator(const _Self& __x) : current(__x.current) {}
+ _Self& operator = (const _Self& __x) { current = __x.base(); return *this; }
+# if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Iter>
+ reverse_iterator(const reverse_iterator<_Iter>& __x) : current(__x.base()) {}
+ template <class _Iter>
+ _Self& operator = (const reverse_iterator<_Iter>& __x) { current = __x.base(); return *this; }
+# endif /* _STLP_MEMBER_TEMPLATES */
+
+ iterator_type base() const { return current; }
+ reference operator*() const {
+ _Iterator __tmp = current;
+ return *--__tmp;
+ }
+ _STLP_DEFINE_ARROW_OPERATOR
+ _Self& operator++() {
+ --current;
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ --current;
+ return __tmp;
+ }
+ _Self& operator--() {
+ ++current;
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ ++current;
+ return __tmp;
+ }
+
+ _Self operator+(difference_type __n) const { return _Self(current - __n); }
+ _Self& operator+=(difference_type __n) {
+ current -= __n;
+ return *this;
+ }
+ _Self operator-(difference_type __n) const { return _Self(current + __n); }
+ _Self& operator-=(difference_type __n) {
+ current += __n;
+ return *this;
+ }
+ reference operator[](difference_type __n) const { return *(*this + __n); }
+};
+
+template <class _Iterator>
+inline bool _STLP_CALL operator==(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return __x.base() == __y.base(); }
+
+template <class _Iterator>
+inline bool _STLP_CALL operator<(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return __y.base() < __x.base(); }
+
+# if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template <class _Iterator>
+inline bool _STLP_CALL operator!=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return !(__x == __y); }
+
+template <class _Iterator>
+inline bool _STLP_CALL operator>(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return __y < __x; }
+
+template <class _Iterator>
+inline bool _STLP_CALL operator<=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return !(__y < __x); }
+
+template <class _Iterator>
+inline bool _STLP_CALL operator>=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return !(__x < __y); }
+# endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _Iterator>
+# if defined (__SUNPRO_CC)
+inline ptrdiff_t _STLP_CALL
+# else
+inline typename reverse_iterator<_Iterator>::difference_type _STLP_CALL
+# endif
+operator-(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+{ return __y.base() - __x.base(); }
+
+template <class _Iterator, class _DifferenceType>
+inline reverse_iterator<_Iterator> _STLP_CALL
+operator+(_DifferenceType n,const reverse_iterator<_Iterator>& x)
+{ return x.operator+(n); }
+#endif
+
+template <class _Container>
+class back_insert_iterator
+ : public iterator<output_iterator_tag, void, void, void, void> {
+ typedef back_insert_iterator<_Container> _Self;
+protected:
+ //c is a Standard name (24.4.2.1), do no make it STLport naming convention compliant.
+ _Container *container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+
+ explicit back_insert_iterator(_Container& __x) : container(&__x) {}
+
+ _Self& operator=(const _Self& __other) {
+ container = __other.container;
+ return *this;
+ }
+ _Self& operator=(const typename _Container::value_type& __val) {
+ container->push_back(__val);
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self operator++(int) { return *this; }
+};
+
+template <class _Container>
+inline back_insert_iterator<_Container> _STLP_CALL back_inserter(_Container& __x)
+{ return back_insert_iterator<_Container>(__x); }
+
+template <class _Container>
+class front_insert_iterator
+ : public iterator<output_iterator_tag, void, void, void, void> {
+ typedef front_insert_iterator<_Container> _Self;
+protected:
+ //c is a Standard name (24.4.2.3), do no make it STLport naming convention compliant.
+ _Container *container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ explicit front_insert_iterator(_Container& __x) : container(&__x) {}
+
+ _Self& operator=(const _Self& __other) {
+ container = __other.container;
+ return *this;
+ }
+ _Self& operator=(const typename _Container::value_type& __val) {
+ container->push_front(__val);
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self operator++(int) { return *this; }
+};
+
+template <class _Container>
+inline front_insert_iterator<_Container> _STLP_CALL front_inserter(_Container& __x)
+{ return front_insert_iterator<_Container>(__x); }
+
+template <class _Container>
+class insert_iterator
+ : public iterator<output_iterator_tag, void, void, void, void> {
+ typedef insert_iterator<_Container> _Self;
+protected:
+ //container is a Standard name (24.4.2.5), do no make it STLport naming convention compliant.
+ _Container *container;
+ typename _Container::iterator _M_iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ insert_iterator(_Container& __x, typename _Container::iterator __i)
+ : container(&__x), _M_iter(__i) {}
+
+ _Self& operator=(_Self const& __other) {
+ container = __other.container;
+ _M_iter = __other._M_iter;
+ return *this;
+ }
+ _Self& operator=(const typename _Container::value_type& __val) {
+ _M_iter = container->insert(_M_iter, __val);
+ ++_M_iter;
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self& operator++(int) { return *this; }
+};
+
+template <class _Container, class _Iterator>
+inline insert_iterator<_Container> _STLP_CALL
+inserter(_Container& __x, _Iterator __i) {
+ typedef typename _Container::iterator __iter;
+ return insert_iterator<_Container>(__x, __iter(__i));
+}
+
+_STLP_END_NAMESPACE
+
+#if ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+# include <stl/_iterator_old.h>
+#endif
+
+#endif /* _STLP_INTERNAL_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_iterator_base.h b/stlport/stl/_iterator_base.h
new file mode 100644
index 0000000..ef59048
--- /dev/null
+++ b/stlport/stl/_iterator_base.h
@@ -0,0 +1,525 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+#define _STLP_INTERNAL_ITERATOR_BASE_H
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+//# if defined (_STLP_IMPORT_VENDOR_CSTD) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
+//_STLP_BEGIN_NAMESPACE
+//using namespace _STLP_VENDOR_CSTD;
+//_STLP_END_NAMESPACE
+//#endif /* _STLP_IMPORT_VENDOR_CSTD */
+
+#if !defined(_STLP_USE_OLD_HP_ITERATOR_QUERIES) && !defined(_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+struct input_iterator_tag {};
+struct output_iterator_tag {};
+struct forward_iterator_tag : public input_iterator_tag {};
+struct bidirectional_iterator_tag : public forward_iterator_tag {};
+struct random_access_iterator_tag : public bidirectional_iterator_tag {};
+
+template <class _Category, class _Tp, _STLP_DFL_TMPL_PARAM(_Distance,ptrdiff_t),
+ _STLP_DFL_TMPL_PARAM(_Pointer,_Tp*), _STLP_DFL_TMPL_PARAM(_Reference,_Tp&) >
+struct iterator {
+ typedef _Category iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+ typedef _Pointer pointer;
+ typedef _Reference reference;
+};
+_STLP_TEMPLATE_NULL
+struct iterator<output_iterator_tag, void, void, void, void> {
+ typedef output_iterator_tag iterator_category;
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+#endif
+};
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+# define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_STD::iterator_category(_It)
+# define _STLP_DISTANCE_TYPE(_It, _Tp) _STLP_STD::distance_type(_It)
+# define _STLP_VALUE_TYPE(_It, _Tp) _STLP_STD::value_type(_It)
+//Old HP iterator queries do not give information about the iterator
+//associated reference type so we consider that it is not a real reference.
+# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type()
+#else
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# define _STLP_VALUE_TYPE(_It, _Tp) (_STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::value_type*)0
+# define _STLP_DISTANCE_TYPE(_It, _Tp) (_STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::difference_type*)0
+# if defined (__BORLANDC__) || defined (__SUNPRO_CC) || ( defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || \
+ (defined (__sgi) && defined (_COMPILER_VERSION)) || defined (__DMC__)
+# define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_STD::iterator_traits< _Tp >::iterator_category()
+# else
+# define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::iterator_category()
+# endif
+# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) _STLP_STD::_IsRefType< _STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::reference >::_Ret()
+# else
+# define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_STD::__iterator_category(_It, _STLP_STD::_IsPtrType<_Tp>::_Ret())
+# define _STLP_DISTANCE_TYPE(_It, _Tp) _STLP_STD::__distance_type(_It, _STLP_STD::_IsPtrType<_Tp>::_Ret())
+# define _STLP_VALUE_TYPE(_It, _Tp) _STLP_STD::__value_type(_It, _STLP_STD::_IsPtrType<_Tp>::_Ret())
+# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type()
+# endif
+#endif
+
+#if defined (_STLP_DONT_REDEFINE_STD) && defined (_STLP_WHOLE_NATIVE_STD)
+/* In this mode we will see both STLport implementation and native
+ * one. To allow some interaction between both implementations through
+ * iterators we have to map std iterator categories to stlport ones. This
+ * way we will be able to initialize STLport containers with native
+ * iterators, the other side won't work except when STLport iterators are
+ * simple pointers. */
+
+_STLP_END_NAMESPACE
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <iterator>
+# else
+# include _STLP_NATIVE_HEADER(iterator)
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _IteCat>
+struct _CategoryMapping
+{ typedef _IteCat _Tag; };
+
+_STLP_TEMPLATE_NULL
+struct _CategoryMapping<::std::input_iterator_tag>
+{ typedef input_iterator_tag _Tag; };
+_STLP_TEMPLATE_NULL
+struct _CategoryMapping<::std::output_iterator_tag>
+{ typedef output_iterator_tag _Tag; };
+_STLP_TEMPLATE_NULL
+struct _CategoryMapping<::std::forward_iterator_tag>
+{ typedef forward_iterator_tag _Tag; };
+_STLP_TEMPLATE_NULL
+struct _CategoryMapping<::std::bidirectional_iterator_tag>
+{ typedef bidirectional_iterator_tag _Tag; };
+_STLP_TEMPLATE_NULL
+struct _CategoryMapping<::std::random_access_iterator_tag>
+{ typedef random_access_iterator_tag _Tag; };
+
+template <class _Iterator>
+struct iterator_traits {
+ typedef typename _Iterator::iterator_category _OriginalTag;
+ typedef typename _CategoryMapping<_OriginalTag>::_Tag iterator_category;
+#else
+template <class _Iterator>
+struct iterator_traits {
+ typedef typename _Iterator::iterator_category iterator_category;
+#endif
+ typedef typename _Iterator::value_type value_type;
+ typedef typename _Iterator::difference_type difference_type;
+ typedef typename _Iterator::pointer pointer;
+ typedef typename _Iterator::reference reference;
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (__SUNPRO_CC)
+# define _STLP_DIFFERENCE_TYPE(_Iterator) typename iterator_traits<_Iterator>::difference_type
+#else
+# define _STLP_DIFFERENCE_TYPE(_Iterator) ptrdiff_t
+#endif
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+
+// fbp : this order keeps gcc happy
+template <class _Tp>
+struct iterator_traits<const _Tp*> {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+};
+
+template <class _Tp>
+struct iterator_traits<_Tp*> {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef _Tp& reference;
+};
+
+# if defined (__BORLANDC__)
+template <class _Tp>
+struct iterator_traits<_Tp* const> {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+};
+# endif
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+#include <stl/_ptrs_specialize.h>
+_STLP_BEGIN_NAMESPACE
+
+#ifndef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+// The overloaded functions iterator_category, distance_type, and
+// value_type are not part of the C++ standard. (They have been
+// replaced by struct iterator_traits.) They are included for
+// backward compatibility with the HP STL.
+// We introduce internal names for these functions.
+
+# ifndef _STLP_CLASS_PARTIAL_SPECIALIZATION
+
+template <class _Tp>
+inline _STLP_STD::random_access_iterator_tag
+__iterator_category(const _Tp*, const __true_type&)
+{ return _STLP_STD::random_access_iterator_tag(); }
+
+template <class _Iter>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_STD::iterator_traits<_Iter>::iterator_category
+__iterator_category(const _Iter&, const __false_type&) {
+ typedef _STLP_TYPENAME _STLP_STD::iterator_traits<_Iter>::iterator_category _Category;
+ return _Category();
+}
+
+template <class _Tp>
+inline ptrdiff_t*
+__distance_type(const _Tp*, const __true_type&)
+{ return __STATIC_CAST(ptrdiff_t*, 0); }
+
+template <class _Iter>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_STD::iterator_traits<_Iter>::difference_type*
+__distance_type(const _Iter&, const __false_type&) {
+ typedef _STLP_TYPENAME _STLP_STD::iterator_traits<_Iter>::difference_type _diff_type;
+ return __STATIC_CAST(_diff_type*,0);
+}
+
+template <class _Tp>
+inline _Tp*
+__value_type(const _Tp*, const __true_type&)
+{ return __STATIC_CAST(_Tp*, 0); }
+
+template <class _Iter>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_STD::iterator_traits<_Iter>::value_type*
+__value_type(const _Iter&, const __false_type&) {
+ typedef _STLP_TYPENAME _STLP_STD::iterator_traits<_Iter>::value_type _value_type;
+ return __STATIC_CAST(_value_type*,0);
+}
+
+# endif
+
+#else /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
+template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
+inline _Category _STLP_CALL iterator_category(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return _Category(); }
+template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
+inline _Tp* _STLP_CALL value_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Category, class _Tp, class _Distance, class _Pointer, class _Reference>
+inline _Distance* _STLP_CALL distance_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Distance*, 0); }
+template <class _Tp>
+inline random_access_iterator_tag _STLP_CALL iterator_category(const _Tp*) { return random_access_iterator_tag(); }
+template <class _Tp>
+inline _Tp* _STLP_CALL value_type(const _Tp*) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp>
+inline ptrdiff_t* _STLP_CALL distance_type(const _Tp*) { return __STATIC_CAST(ptrdiff_t*, 0); }
+#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+// The base classes input_iterator, output_iterator, forward_iterator,
+// bidirectional_iterator, and random_access_iterator are not part of
+// the C++ standard. (They have been replaced by struct iterator.)
+// They are included for backward compatibility with the HP STL.
+template <class _Tp, class _Distance> struct input_iterator :
+ public iterator <input_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
+struct output_iterator : public iterator <output_iterator_tag, void, void, void, void> {};
+template <class _Tp, class _Distance> struct forward_iterator :
+ public iterator<forward_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
+template <class _Tp, class _Distance> struct bidirectional_iterator :
+ public iterator<bidirectional_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
+template <class _Tp, class _Distance> struct random_access_iterator :
+ public iterator<random_access_iterator_tag, _Tp, _Distance, _Tp*, _Tp&> {};
+
+# if defined (_STLP_BASE_MATCH_BUG) && defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+template <class _Tp, class _Distance>
+inline input_iterator_tag _STLP_CALL
+iterator_category(const input_iterator<_Tp, _Distance>&) { return input_iterator_tag(); }
+inline output_iterator_tag _STLP_CALL
+iterator_category(const output_iterator&) { return output_iterator_tag(); }
+template <class _Tp, class _Distance>
+inline forward_iterator_tag _STLP_CALL
+iterator_category(const forward_iterator<_Tp, _Distance>&) { return forward_iterator_tag(); }
+template <class _Tp, class _Distance>
+inline bidirectional_iterator_tag _STLP_CALL
+iterator_category(const bidirectional_iterator<_Tp, _Distance>&) { return bidirectional_iterator_tag(); }
+template <class _Tp, class _Distance>
+inline random_access_iterator_tag _STLP_CALL
+iterator_category(const random_access_iterator<_Tp, _Distance>&) { return random_access_iterator_tag(); }
+template <class _Tp, class _Distance>
+inline _Tp* _STLP_CALL value_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp, class _Distance>
+inline _Tp* _STLP_CALL value_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp, class _Distance>
+inline _Tp* _STLP_CALL value_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp, class _Distance>
+inline _Tp* _STLP_CALL value_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); }
+template <class _Tp, class _Distance>
+inline _Distance* _STLP_CALL distance_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
+template <class _Tp, class _Distance>
+inline _Distance* _STLP_CALL distance_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
+template <class _Tp, class _Distance>
+inline _Distance* _STLP_CALL distance_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0);}
+template <class _Tp, class _Distance>
+inline _Distance* _STLP_CALL distance_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); }
+# endif
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIterator>
+inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
+__distance(const _InputIterator& __first, const _InputIterator& __last,
+ const input_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_InputIterator) __n = 0;
+ _InputIterator __it(__first);
+ while (__it != __last) {
+ ++__it; ++__n;
+ }
+ return __n;
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIterator>
+inline _STLP_DIFFERENCE_TYPE(_ForwardIterator) _STLP_CALL
+__distance(const _ForwardIterator& __first, const _ForwardIterator& __last,
+ const forward_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_ForwardIterator) __n = 0;
+ _ForwardIterator __it(__first);
+ while (__it != __last) {
+ ++__it; ++__n;
+ }
+ return __n;
+}
+
+template <class _BidirectionalIterator>
+_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) _STLP_CALL
+__distance(const _BidirectionalIterator& __first, const _BidirectionalIterator& __last,
+ const bidirectional_iterator_tag &) {
+ _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) __n = 0;
+ _BidirectionalIterator __it(__first);
+ while (__it != __last) {
+ ++__it; ++__n;
+ }
+ return __n;
+}
+#endif
+
+template <class _RandomAccessIterator>
+inline _STLP_DIFFERENCE_TYPE(_RandomAccessIterator) _STLP_CALL
+__distance(const _RandomAccessIterator& __first, const _RandomAccessIterator& __last,
+ const random_access_iterator_tag &)
+{ return __last - __first; }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIterator>
+inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL
+distance(_InputIterator __first, _InputIterator __last)
+{ return _STLP_PRIV __distance(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); }
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+template <class _InputIterator, class _Distance>
+inline void _STLP_CALL distance(const _InputIterator& __first,
+ const _InputIterator& __last, _Distance& __n)
+{ __n += _STLP_STD::distance(__first, __last); }
+
+# if defined (_STLP_MSVC)
+// MSVC specific
+template <class _InputIterator, class _Dist>
+inline void _STLP_CALL _Distance(_InputIterator __first,
+ _InputIterator __last, _Dist& __n)
+{ __n += _STLP_STD::distance(__first, __last); }
+# endif
+#endif
+
+// fbp: those are being used for iterator/const_iterator definitions everywhere
+template <class _Tp>
+struct _Nonconst_traits;
+
+template <class _Tp>
+struct _Const_traits {
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+ typedef _Const_traits<_Tp> _ConstTraits;
+ typedef _Nonconst_traits<_Tp> _NonConstTraits;
+};
+
+template <class _Tp>
+struct _Nonconst_traits {
+ typedef _Tp value_type;
+ typedef _Tp& reference;
+ typedef _Tp* pointer;
+ typedef _Const_traits<_Tp> _ConstTraits;
+ typedef _Nonconst_traits<_Tp> _NonConstTraits;
+};
+
+/*
+ * dums: A special iterator/const_iterator traits for set and multiset for which even
+ * the iterator is not mutable
+ */
+template <class _Tp>
+struct _Nonconst_Const_traits;
+
+template <class _Tp>
+struct _Const_Const_traits {
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+ typedef _Const_Const_traits<_Tp> _ConstTraits;
+ typedef _Nonconst_Const_traits<_Tp> _NonConstTraits;
+};
+
+template <class _Tp>
+struct _Nonconst_Const_traits {
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+ typedef _Const_Const_traits<_Tp> _ConstTraits;
+ typedef _Nonconst_Const_traits<_Tp> _NonConstTraits;
+};
+
+/*
+ * A macro to generate a new iterator traits from one of the
+ * previous one. Changing the iterator traits type make iterators
+ * from different containers not comparable.
+ */
+#define _STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits) \
+template <class _Tp> \
+struct _##Motif; \
+template <class _Tp> \
+struct _Const##Motif : public _STLP_STD::_Const_##Traits<_Tp> { \
+ typedef _Const##Motif<_Tp> _ConstTraits; \
+ typedef _##Motif<_Tp> _NonConstTraits; \
+}; \
+template <class _Tp> \
+struct _##Motif : public _STLP_STD::_Nonconst_##Traits<_Tp> { \
+ typedef _Const##Motif<_Tp> _ConstTraits; \
+ typedef _##Motif<_Tp> _NonConstTraits; \
+};
+
+#define _STLP_CREATE_ITERATOR_TRAITS(Motif, Traits) \
+_STLP_MOVE_TO_PRIV_NAMESPACE \
+_STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits) \
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#define _STLP_CREATE_HASH_ITERATOR_TRAITS(Motif, Traits) \
+_STLP_MOVE_TO_PRIV_NAMESPACE \
+_STLP_CREATE_ITERATOR_TRAITS_BASE(NonLocal##Motif, Traits) \
+_STLP_CREATE_ITERATOR_TRAITS_BASE(Local##Motif, Traits) \
+template <class _Tp> \
+struct _##Motif { \
+ typedef _ConstNonLocal##Motif<_Tp> _ConstTraits; \
+ typedef _NonLocal##Motif<_Tp> _NonConstTraits; \
+ typedef _ConstLocal##Motif<_Tp> _ConstLocalTraits; \
+ typedef _Local##Motif<_Tp> _NonConstLocalTraits; \
+}; \
+_STLP_MOVE_TO_STD_NAMESPACE
+
+/*
+# if defined (_STLP_BASE_TYPEDEF_BUG)
+// this workaround is needed for SunPro 4.0.1
+template <class _Traits>
+struct __cnst_traits_aux : private _Traits {
+ typedef typename _Traits::value_type value_type;
+};
+# define __TRAITS_VALUE_TYPE(_Traits) __cnst_traits_aux<_Traits>::value_type
+# else
+# define __TRAITS_VALUE_TYPE(_Traits) _Traits::value_type
+# endif
+*/
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL
+__advance(_InputIter& __i, _Distance __n, const input_iterator_tag &)
+{ while (__n--) ++__i; }
+
+// fbp : added output iterator tag variant
+template <class _InputIter, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL
+__advance(_InputIter& __i, _Distance __n, const output_iterator_tag &)
+{ while (__n--) ++__i; }
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIterator, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL
+__advance(_ForwardIterator& i, _Distance n, const forward_iterator_tag &)
+{ while (n--) ++i; }
+#endif
+
+template <class _BidirectionalIterator, class _Distance>
+_STLP_INLINE_LOOP void _STLP_CALL
+__advance(_BidirectionalIterator& __i, _Distance __n,
+ const bidirectional_iterator_tag &) {
+ if (__n > 0)
+ while (__n--) ++__i;
+ else
+ while (__n++) --__i;
+}
+
+template <class _RandomAccessIterator, class _Distance>
+inline void _STLP_CALL
+__advance(_RandomAccessIterator& __i, _Distance __n,
+ const random_access_iterator_tag &)
+{ __i += __n; }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIterator, class _Distance>
+inline void _STLP_CALL advance(_InputIterator& __i, _Distance __n)
+{ _STLP_PRIV __advance(__i, __n, _STLP_ITERATOR_CATEGORY(__i, _InputIterator)); }
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_ITERATOR_BASE_H */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_iterator_old.h b/stlport/stl/_iterator_old.h
new file mode 100644
index 0000000..144b9ab
--- /dev/null
+++ b/stlport/stl/_iterator_old.h
@@ -0,0 +1,334 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_ITERATOR_OLD_H
+#define _STLP_INTERNAL_ITERATOR_OLD_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+
+template <class _Container>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const back_insert_iterator<_Container>&) { return output_iterator_tag(); }
+template <class _Container>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const front_insert_iterator<_Container>&) { return output_iterator_tag(); }
+template <class _Container>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const insert_iterator<_Container>&) { return output_iterator_tag(); }
+
+#endif
+
+template <class _BidirectionalIterator, class _Tp,
+ _STLP_DFL_TMPL_PARAM(_Reference, _Tp& ),
+#if defined (_STLP_MSVC50_COMPATIBILITY)
+# define __Reference _Reference, class _Pointer
+# define Reference__ _Reference, _Pointer
+ _STLP_DFL_TMPL_PARAM(_Pointer, _Tp*),
+#else
+# define __Reference _Reference
+# define Reference__ _Reference
+#endif
+ _STLP_DFL_TYPE_PARAM(_Distance, ptrdiff_t)>
+class reverse_bidirectional_iterator {
+ typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
+ Reference__, _Distance> _Self;
+ // friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& x, const _Self& y);
+protected:
+ _BidirectionalIterator current;
+public:
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+ typedef _Pointer pointer;
+# else
+ typedef _Tp* pointer;
+# endif
+ typedef _Reference reference;
+
+ reverse_bidirectional_iterator() {}
+ explicit reverse_bidirectional_iterator(_BidirectionalIterator __x)
+ : current(__x) {}
+ _BidirectionalIterator base() const { return current; }
+ _Reference operator*() const {
+ _BidirectionalIterator __tmp = current;
+ return *(--__tmp);
+ }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ --current;
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ --current;
+ return __tmp;
+ }
+ _Self& operator--() {
+ ++current;
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ ++current;
+ return __tmp;
+ }
+};
+
+#ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _BidirectionalIterator, class _Tp, class __Reference,
+ class _Distance>
+inline bidirectional_iterator_tag _STLP_CALL
+iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
+{ return bidirectional_iterator_tag(); }
+template <class _BidirectionalIterator, class _Tp, class __Reference,
+ class _Distance>
+inline _Tp* _STLP_CALL
+value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
+{ return (_Tp*) 0; }
+template <class _BidirectionalIterator, class _Tp, class __Reference,
+ class _Distance>
+inline _Distance* _STLP_CALL
+distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&)
+{ return (_Distance*) 0; }
+#endif
+
+template <class _BidirectionalIterator, class _Tp, class __Reference,
+ class _Distance>
+inline bool _STLP_CALL operator==(
+ const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
+ Reference__, _Distance>& __y)
+{ return __x.base() == __y.base(); }
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _BiIter, class _Tp, class __Reference, class _Distance>
+inline bool _STLP_CALL operator!=(
+ const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __x,
+ const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __y)
+{ return !(__x == __y); }
+
+#endif
+
+#if !defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION )
+
+// This is the old version of reverse_iterator, as found in the original
+// HP STL. It does not use partial specialization.
+
+template <class _RandomAccessIterator, class _Tp,
+ _STLP_DFL_TMPL_PARAM(_Reference,_Tp&),
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+ _STLP_DFL_TMPL_PARAM(_Pointer, _Tp*),
+# endif
+ _STLP_DFL_TYPE_PARAM(_Distance,ptrdiff_t)>
+class reverse_iterator {
+ typedef reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance> _Self;
+protected:
+ _RandomAccessIterator __current;
+public:
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+ typedef _Pointer pointer;
+# else
+ typedef _Tp* pointer;
+# endif
+ typedef _Reference reference;
+
+ reverse_iterator() {}
+ reverse_iterator(const _Self& __x) : __current(__x.base()) {}
+ explicit reverse_iterator(_RandomAccessIterator __x) : __current(__x) {}
+ _Self& operator=(const _Self& __x) {__current = __x.base(); return *this; }
+
+ _RandomAccessIterator base() const { return __current; }
+ _Reference operator*() const { return *(__current - (difference_type)1); }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ --__current;
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ --__current;
+ return __tmp;
+ }
+ _Self& operator--() {
+ ++__current;
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ ++__current;
+ return __tmp;
+ }
+ _Self operator+(_Distance __n) const {
+ return _Self(__current - __n);
+ }
+ _Self& operator+=(_Distance __n) {
+ __current -= __n;
+ return *this;
+ }
+ _Self operator-(_Distance __n) const {
+ return _Self(__current + __n);
+ }
+ _Self& operator-=(_Distance __n) {
+ __current += __n;
+ return *this;
+ }
+ _Reference operator[](_Distance __n) const { return *(*this + __n); }
+};
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline random_access_iterator_tag _STLP_CALL
+iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
+{ return random_access_iterator_tag(); }
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline _Tp* _STLP_CALL value_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
+{ return (_Tp*) 0; }
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline _Distance* _STLP_CALL
+distance_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&)
+{ return (_Distance*) 0; }
+# endif
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator==(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y)
+{
+ return __x.base() == __y.base();
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator<(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y)
+{
+ return __y.base() < __x.base();
+}
+
+# ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator!=(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y) {
+ return !(__x == __y);
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator>(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y) {
+ return __y < __x;
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator<=(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y) {
+ return !(__y < __x);
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline bool _STLP_CALL
+operator>=(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y) {
+ return !(__x < __y);
+}
+
+# endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline _Distance _STLP_CALL
+operator-(const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __y)
+{
+ return __y.base() - __x.base();
+}
+
+template <class _RandomAccessIterator, class _Tp,
+ class __Reference, class _Distance>
+inline reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance> _STLP_CALL
+operator+(_Distance __n,
+ const reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>& __x)
+{
+ return reverse_iterator<_RandomAccessIterator, _Tp,
+ Reference__, _Distance>(__x.base() - __n);
+}
+
+#endif /* ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_limits.c b/stlport/stl/_limits.c
new file mode 100644
index 0000000..3938024
--- /dev/null
+++ b/stlport/stl/_limits.c
@@ -0,0 +1,405 @@
+/*
+ * Copyright (c) 1998,1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_LIMITS_C
+#define _STLP_LIMITS_C
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+//==========================================================
+// numeric_limits static members
+//==========================================================
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+
+# define __declare_numeric_base_member(__type, __mem) \
+template <class __number> \
+ const __type _Numeric_limits_base<__number>:: __mem
+
+__declare_numeric_base_member(bool, is_specialized);
+__declare_numeric_base_member(int, digits);
+__declare_numeric_base_member(int, digits10);
+__declare_numeric_base_member(bool, is_signed);
+__declare_numeric_base_member(bool, is_integer);
+__declare_numeric_base_member(bool, is_exact);
+__declare_numeric_base_member(int, radix);
+__declare_numeric_base_member(int, min_exponent);
+__declare_numeric_base_member(int, max_exponent);
+__declare_numeric_base_member(int, min_exponent10);
+__declare_numeric_base_member(int, max_exponent10);
+__declare_numeric_base_member(bool, has_infinity);
+__declare_numeric_base_member(bool, has_quiet_NaN);
+__declare_numeric_base_member(bool, has_signaling_NaN);
+__declare_numeric_base_member(float_denorm_style, has_denorm);
+__declare_numeric_base_member(bool, has_denorm_loss);
+__declare_numeric_base_member(bool, is_iec559);
+__declare_numeric_base_member(bool, is_bounded);
+__declare_numeric_base_member(bool, is_modulo);
+__declare_numeric_base_member(bool, traps);
+__declare_numeric_base_member(bool, tinyness_before);
+__declare_numeric_base_member(float_round_style, round_style);
+
+# undef __declare_numeric_base_member
+
+# define __declare_integer_limits_member(__type, __mem) \
+template <class _Int, _STLP_LIMITS_MIN_TYPE __imin, _STLP_LIMITS_MAX_TYPE __imax, int __idigits, bool __ismod> \
+ const __type _Integer_limits<_Int, __imin, __imax, __idigits, __ismod>:: __mem
+
+__declare_integer_limits_member(bool, is_specialized);
+__declare_integer_limits_member(int, digits);
+__declare_integer_limits_member(int, digits10);
+__declare_integer_limits_member(bool, is_signed);
+__declare_integer_limits_member(bool, is_integer);
+__declare_integer_limits_member(bool, is_exact);
+__declare_integer_limits_member(int, radix);
+__declare_integer_limits_member(bool, is_bounded);
+__declare_integer_limits_member(bool, is_modulo);
+# undef __declare_integer_limits_member
+
+# if defined (__GNUC__) && (__GNUC__ != 2 || __GNUC_MINOR__ > 96) && (__GNUC__ != 3 || __GNUC_MINOR__ == 0) && (__GNUC__ <= 3)
+_STLP_MOVE_TO_STD_NAMESPACE
+
+# define __declare_numeric_limits_member(__integer) \
+ _STLP_TEMPLATE_NULL const int numeric_limits<__integer>::digits; \
+ _STLP_TEMPLATE_NULL const int numeric_limits<__integer>::digits10; \
+ _STLP_TEMPLATE_NULL const int numeric_limits<__integer>::radix; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_specialized; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_signed; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_integer; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_exact; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_bounded; \
+ _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_modulo
+
+__declare_numeric_limits_member(_STLP_LONG_LONG);
+__declare_numeric_limits_member(unsigned _STLP_LONG_LONG);
+
+# undef __declare_numeric_limits_member
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+# endif
+
+# define __declare_float_limits_member(__type, __mem) \
+template <class __number, \
+ int __Digits, int __Digits10, \
+ int __MinExp, int __MaxExp, \
+ int __MinExp10, int __MaxExp10, \
+ bool __IsIEC559, \
+ float_denorm_style __DenormStyle, \
+ float_round_style __RoundStyle> \
+const __type _Floating_limits< __number, __Digits, __Digits10, \
+ __MinExp, __MaxExp, __MinExp10, __MaxExp10, \
+ __IsIEC559, __DenormStyle, __RoundStyle>::\
+ __mem
+
+__declare_float_limits_member(bool, is_specialized);
+__declare_float_limits_member(int, digits);
+__declare_float_limits_member(int, digits10);
+__declare_float_limits_member(bool, is_signed);
+__declare_float_limits_member(int, radix);
+__declare_float_limits_member(int, min_exponent);
+__declare_float_limits_member(int, max_exponent);
+__declare_float_limits_member(int, min_exponent10);
+__declare_float_limits_member(int, max_exponent10);
+__declare_float_limits_member(bool, has_infinity);
+__declare_float_limits_member(bool, has_quiet_NaN);
+__declare_float_limits_member(bool, has_signaling_NaN);
+__declare_float_limits_member(float_denorm_style, has_denorm);
+__declare_float_limits_member(bool, has_denorm_loss);
+__declare_float_limits_member(bool, is_iec559);
+__declare_float_limits_member(bool, is_bounded);
+__declare_float_limits_member(bool, traps);
+__declare_float_limits_member(bool, tinyness_before);
+__declare_float_limits_member(float_round_style, round_style);
+# undef __declare_float_limits_member
+
+#endif
+
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+# if defined (__GNUC__) || defined (__BORLANDC__)
+# define _STLP_ADDITIONAL_OPEN_BRACKET {
+# define _STLP_ADDITIONAL_CLOSE_BRACKET }
+# else
+# define _STLP_ADDITIONAL_OPEN_BRACKET
+# define _STLP_ADDITIONAL_CLOSE_BRACKET
+# endif
+
+/* The following code has been extracted from the boost libraries (www.boost.org) and
+ * adapted with the STLport portability macros. Advantage on previous technique is that
+ * computation of infinity and NaN values is only based on big/little endianess, compiler
+ * float, double or long double representation is taken into account thanks to the sizeof
+ * operator. */
+template<class _Number, unsigned short _Word>
+struct float_helper {
+ union _WordsNumber {
+ unsigned short _Words[8];
+ _Number _num;
+ };
+ static _Number get_word_higher() _STLP_NOTHROW {
+ _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET _Word, 0, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET };
+ return __tmp._num;
+ }
+ static _Number get_word_lower() _STLP_NOTHROW {
+ _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET 0, 0, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET };
+ __tmp._Words[(sizeof(_Number) >= 12 ? 10 : sizeof(_Number)) / sizeof(unsigned short) - 1] = _Word;
+ return __tmp._num;
+ }
+ static _Number get_from_last_word() _STLP_NOTHROW {
+# if defined (_STLP_BIG_ENDIAN)
+ return get_word_higher();
+# else /* _STLP_LITTLE_ENDIAN */
+ return get_word_lower();
+# endif
+ }
+ static _Number get_from_first_word() _STLP_NOTHROW {
+# if defined (_STLP_BIG_ENDIAN)
+ return get_word_lower();
+# else /* _STLP_LITTLE_ENDIAN */
+ return get_word_higher();
+# endif
+ }
+};
+
+# if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_BIG_ENDIAN)
+template<class _Number, unsigned short _Word1, unsigned short _Word2>
+struct float_helper2 {
+ union _WordsNumber {
+ unsigned short _Words[8];
+ _Number _num;
+ };
+ //static _Number get_word_higher() _STLP_NOTHROW {
+ // _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET _Word1, _Word2, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET };
+ // return __tmp._num;
+ //}
+ static _Number get_word_lower() _STLP_NOTHROW {
+ _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET 0, 0, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET };
+ __tmp._Words[(sizeof(_Number) >= 12 ? 10 : sizeof(_Number)) / sizeof(unsigned short) - 2] = _Word1;
+ __tmp._Words[(sizeof(_Number) >= 12 ? 10 : sizeof(_Number)) / sizeof(unsigned short) - 1] = _Word2;
+ return __tmp._num;
+ }
+ static _Number get_from_last_word() _STLP_NOTHROW {
+//# if defined (_STLP_BIG_ENDIAN)
+// return get_word_higher();
+//# else /* _STLP_LITTLE_ENDIAN */
+ return get_word_lower();
+//# endif
+ }
+};
+# endif
+
+/* Former values kept in case moving to boost code has introduce a regression on
+ * some platform. */
+#if 0
+# if defined (_STLP_BIG_ENDIAN)
+# if defined (__OS400__)
+# define _STLP_FLOAT_INF_REP { 0x7f80, 0 }
+# define _STLP_FLOAT_QNAN_REP { 0xffc0, 0 }
+# define _STLP_FLOAT_SNAN_REP { 0xff80, 0 }
+# define _STLP_DOUBLE_INF_REP { 0x7ff0, 0, 0, 0 }
+# define _STLP_DOUBLE_QNAN_REP { 0xfff8, 0, 0, 0 }
+# define _STLP_DOUBLE_SNAN_REP { 0xfff0, 0, 0, 0 }
+# define _STLP_LDOUBLE_INF_REP { 0x7ff0, 0, 0, 0, 0, 0, 0, 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0xfff8, 0, 0, 0, 0, 0, 0, 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0xfff0, 0, 0, 0, 0, 0, 0, 0 }
+# else /* __OS400__ */
+# define _STLP_FLOAT_INF_REP { 0x7f80, 0 }
+# define _STLP_FLOAT_QNAN_REP { 0x7fc1, 0 }
+# define _STLP_FLOAT_SNAN_REP { 0x7f81, 0 }
+# define _STLP_DOUBLE_INF_REP { 0x7ff0, 0, 0, 0 }
+# define _STLP_DOUBLE_QNAN_REP { 0x7ff9, 0, 0, 0 }
+# define _STLP_DOUBLE_SNAN_REP { 0x7ff1, 0, 0, 0 }
+# define _STLP_LDOUBLE_INF_REP { 0x7ff0, 0, 0, 0, 0, 0, 0, 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0x7ff1, 0, 0, 0, 0, 0, 0, 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0x7ff9, 0, 0, 0, 0, 0, 0, 0 }
+# endif /* __OS400__ */
+# else /* _STLP_LITTLE_ENDIAN */
+# if defined(__DECCXX)
+# define _STLP_FLOAT_INF_REP { 0, 0x7f80 }
+# define _STLP_FLOAT_QNAN_REP { 0, 0xffc0 }
+# define _STLP_FLOAT_SNAN_REP { 0x5555, 0x7f85 }
+# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 }
+# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0xfff8 }
+# define _STLP_DOUBLE_SNAN_REP { 0x5555, 0x5555, 0x5555, 0x7ff5 }
+# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0, 0, 0, 0, 0x7fff }
+# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0, 0, 0, 0x8000, 0xffff }
+# define _STLP_LDOUBLE_SNAN_REP { 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x7fff}
+# else
+# define _STLP_FLOAT_INF_REP { 0, 0x7f80 }
+# define _STLP_FLOAT_QNAN_REP { 0, 0x7fc0 }
+# define _STLP_FLOAT_SNAN_REP { 0, 0x7fa0 }
+# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 }
+# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0x7ff8 }
+# define _STLP_DOUBLE_SNAN_REP { 0, 0, 0, 0x7ff4 }
+# if defined (_STLP_MSVC) || defined (__ICL)
+# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x7FF0, 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xFFF8, 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xFFF8, 0 }
+# elif defined (__BORLANDC__)
+# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff }
+# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xc000, 0x7fff }
+# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xa000, 0x7fff }
+# else
+# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff, 0 }
+# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xa000, 0x7fff, 0 }
+# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xc000, 0x7fff, 0 }
+# endif
+# endif
+# endif
+
+union _F_rep {
+ unsigned short rep[2];
+ float val;
+};
+union _D_rep {
+ unsigned short rep[4];
+ double val;
+};
+
+# ifndef _STLP_NO_LONG_DOUBLE
+union _LD_rep {
+ unsigned short rep[8];
+ long double val;
+};
+# endif
+#endif
+
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_inf() {
+ typedef float_helper<float, 0x7f80u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+}
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_qNaN() {
+ typedef float_helper<float, 0x7f81u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+}
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_sNaN() {
+ typedef float_helper<float, 0x7fc1u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+}
+template <class __dummy>
+float _STLP_CALL _LimG<__dummy>::get_F_denormMin() {
+ typedef float_helper<float, 0x0001u> _FloatHelper;
+ return _FloatHelper::get_from_first_word();
+}
+
+template <int __use_double_limits>
+class _NumericLimitsAccess;
+
+_STLP_TEMPLATE_NULL
+class _NumericLimitsAccess<1> {
+public:
+ static double get_inf() {
+ typedef float_helper<double, 0x7ff0u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+ }
+ static double get_qNaN() {
+ typedef float_helper<double, 0x7ff1u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+ }
+ static double get_sNaN() {
+ typedef float_helper<double, 0x7ff9u> _FloatHelper;
+ return _FloatHelper::get_from_last_word();
+ }
+};
+
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_inf()
+{ return _NumericLimitsAccess<1>::get_inf(); }
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_qNaN()
+{ return _NumericLimitsAccess<1>::get_qNaN(); }
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_sNaN()
+{ return _NumericLimitsAccess<1>::get_sNaN(); }
+template <class __dummy>
+double _STLP_CALL _LimG<__dummy>::get_D_denormMin() {
+ typedef float_helper<double, 0x0001u> _FloatHelper;
+ return _FloatHelper::get_from_first_word();
+}
+
+# if !defined (_STLP_NO_LONG_DOUBLE)
+_STLP_TEMPLATE_NULL
+class _NumericLimitsAccess<0> {
+public:
+ static long double get_inf() {
+# if defined (_STLP_BIG_ENDIAN)
+ typedef float_helper<long double, 0x7ff0u> _FloatHelper;
+# else
+ typedef float_helper2<long double, 0x8000u, 0x7fffu> _FloatHelper;
+# endif
+ return _FloatHelper::get_from_last_word();
+ }
+ static long double get_qNaN() {
+# if defined (_STLP_BIG_ENDIAN)
+ typedef float_helper<long double, 0x7ff1u> _FloatHelper;
+# else
+ typedef float_helper2<long double, 0xc000u, 0x7fffu> _FloatHelper;
+# endif
+ return _FloatHelper::get_from_last_word();
+ }
+ static long double get_sNaN() {
+# if defined (_STLP_BIG_ENDIAN)
+ typedef float_helper<long double, 0x7ff9u> _FloatHelper;
+# else
+ typedef float_helper2<long double, 0x9000u, 0x7fffu> _FloatHelper;
+# endif
+ return _FloatHelper::get_from_last_word();
+ }
+};
+
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_inf() {
+ const int __use_double_limits = sizeof(double) == sizeof(long double) ? 1 : 0;
+ return _NumericLimitsAccess<__use_double_limits>::get_inf();
+}
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_qNaN() {
+ const int __use_double_limits = sizeof(double) == sizeof(long double) ? 1 : 0;
+ return _NumericLimitsAccess<__use_double_limits>::get_qNaN();
+}
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_sNaN() {
+ const int __use_double_limits = sizeof(double) == sizeof(long double) ? 1 : 0;
+ return _NumericLimitsAccess<__use_double_limits>::get_sNaN();
+}
+template <class __dummy>
+long double _STLP_CALL _LimG<__dummy>::get_LD_denormMin() {
+ typedef float_helper<long double, 0x0001u> _FloatHelper;
+ return _FloatHelper::get_from_first_word();
+}
+# endif
+
+#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
+
+#undef _STLP_LIMITS_MIN_TYPE
+#undef _STLP_LIMITS_MAX_TYPE
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_LIMITS_C_INCLUDED */
diff --git a/stlport/stl/_limits.h b/stlport/stl/_limits.h
new file mode 100644
index 0000000..c0091f6
--- /dev/null
+++ b/stlport/stl/_limits.h
@@ -0,0 +1,519 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This may be not portable code. Parts of numeric_limits<> are
+ * inherently machine-dependent. At present this file is suitable
+ * for the MIPS, SPARC, Alpha and ia32 architectures.
+ */
+
+#ifndef _STLP_INTERNAL_LIMITS
+#define _STLP_INTERNAL_LIMITS
+
+#ifndef _STLP_CLIMITS
+# include <climits>
+#endif
+
+#ifndef _STLP_CFLOAT
+# include <cfloat>
+#endif
+
+#if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR)
+# include <stl/_cwchar.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+enum float_round_style {
+ round_indeterminate = -1,
+ round_toward_zero = 0,
+ round_to_nearest = 1,
+ round_toward_infinity = 2,
+ round_toward_neg_infinity = 3
+};
+
+enum float_denorm_style {
+ denorm_indeterminate = -1,
+ denorm_absent = 0,
+ denorm_present = 1
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Base class for all specializations of numeric_limits.
+template <class __number>
+class _Numeric_limits_base {
+public:
+
+ static __number (_STLP_CALL min)() _STLP_NOTHROW { return __number(); }
+ static __number (_STLP_CALL max)() _STLP_NOTHROW { return __number(); }
+
+ _STLP_STATIC_CONSTANT(int, digits = 0);
+ _STLP_STATIC_CONSTANT(int, digits10 = 0);
+ _STLP_STATIC_CONSTANT(int, radix = 0);
+ _STLP_STATIC_CONSTANT(int, min_exponent = 0);
+ _STLP_STATIC_CONSTANT(int, min_exponent10 = 0);
+ _STLP_STATIC_CONSTANT(int, max_exponent = 0);
+ _STLP_STATIC_CONSTANT(int, max_exponent10 = 0);
+
+ _STLP_STATIC_CONSTANT(float_denorm_style, has_denorm = denorm_absent);
+ _STLP_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
+
+ _STLP_STATIC_CONSTANT(bool, is_specialized = false);
+ _STLP_STATIC_CONSTANT(bool, is_signed = false);
+ _STLP_STATIC_CONSTANT(bool, is_integer = false);
+ _STLP_STATIC_CONSTANT(bool, is_exact = false);
+ _STLP_STATIC_CONSTANT(bool, has_infinity = false);
+ _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = false);
+ _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = false);
+ _STLP_STATIC_CONSTANT(bool, has_denorm_loss = false);
+ _STLP_STATIC_CONSTANT(bool, is_iec559 = false);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = false);
+ _STLP_STATIC_CONSTANT(bool, is_modulo = false);
+ _STLP_STATIC_CONSTANT(bool, traps = false);
+ _STLP_STATIC_CONSTANT(bool, tinyness_before = false);
+
+ static __number _STLP_CALL epsilon() _STLP_NOTHROW { return __number(); }
+ static __number _STLP_CALL round_error() _STLP_NOTHROW { return __number(); }
+
+ static __number _STLP_CALL infinity() _STLP_NOTHROW { return __number(); }
+ static __number _STLP_CALL quiet_NaN() _STLP_NOTHROW { return __number(); }
+ static __number _STLP_CALL signaling_NaN() _STLP_NOTHROW { return __number(); }
+ static __number _STLP_CALL denorm_min() _STLP_NOTHROW { return __number(); }
+};
+
+// Base class for integers.
+
+#ifdef _STLP_LIMITED_DEFAULT_TEMPLATES
+# ifdef _STLP_LONG_LONG
+# define _STLP_LIMITS_MIN_TYPE _STLP_LONG_LONG
+# define _STLP_LIMITS_MAX_TYPE unsigned _STLP_LONG_LONG
+# else
+# define _STLP_LIMITS_MIN_TYPE long
+# define _STLP_LIMITS_MAX_TYPE unsigned long
+# endif
+#else
+# define _STLP_LIMITS_MIN_TYPE _Int
+# define _STLP_LIMITS_MAX_TYPE _Int
+#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
+
+template <class _Int,
+ _STLP_LIMITS_MIN_TYPE __imin,
+ _STLP_LIMITS_MAX_TYPE __imax,
+ int __idigits, bool __ismod>
+class _Integer_limits : public _Numeric_limits_base<_Int> {
+public:
+
+ static _Int (_STLP_CALL min) () _STLP_NOTHROW { return (_Int)__imin; }
+ static _Int (_STLP_CALL max) () _STLP_NOTHROW { return (_Int)__imax; }
+
+ _STLP_STATIC_CONSTANT(int, digits = (__idigits < 0) ? ((int)((sizeof(_Int) * (CHAR_BIT))) - ((__imin == 0) ? 0 : 1)) : (__idigits));
+ _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000);
+ _STLP_STATIC_CONSTANT(int, radix = 2);
+ _STLP_STATIC_CONSTANT(bool, is_specialized = true);
+ _STLP_STATIC_CONSTANT(bool, is_signed = (__imin != 0));
+ _STLP_STATIC_CONSTANT(bool, is_integer = true);
+ _STLP_STATIC_CONSTANT(bool, is_exact = true);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = true);
+ _STLP_STATIC_CONSTANT(bool, is_modulo = __ismod);
+};
+
+// Base class for floating-point numbers.
+template <class __number,
+ int __Digits, int __Digits10,
+ int __MinExp, int __MaxExp,
+ int __MinExp10, int __MaxExp10,
+ bool __IsIEC559,
+ float_denorm_style __DenormStyle,
+ float_round_style __RoundStyle>
+class _Floating_limits : public _Numeric_limits_base<__number> {
+public:
+
+ _STLP_STATIC_CONSTANT(int, digits = __Digits);
+ _STLP_STATIC_CONSTANT(int, digits10 = __Digits10);
+ _STLP_STATIC_CONSTANT(int, radix = FLT_RADIX);
+ _STLP_STATIC_CONSTANT(int, min_exponent = __MinExp);
+ _STLP_STATIC_CONSTANT(int, max_exponent = __MaxExp);
+ _STLP_STATIC_CONSTANT(int, min_exponent10 = __MinExp10);
+ _STLP_STATIC_CONSTANT(int, max_exponent10 = __MaxExp10);
+
+ _STLP_STATIC_CONSTANT(float_denorm_style, has_denorm = __DenormStyle);
+ _STLP_STATIC_CONSTANT(float_round_style, round_style = __RoundStyle);
+
+ _STLP_STATIC_CONSTANT(bool, is_specialized = true);
+ _STLP_STATIC_CONSTANT(bool, is_signed = true);
+
+ _STLP_STATIC_CONSTANT(bool, has_infinity = true);
+#if (!defined (_STLP_MSVC) || (_STLP_MSVC > 1300)) && \
+ (!defined (__BORLANDC__) || (__BORLANDC__ >= 0x590)) && \
+ (!defined (_CRAY) || defined (_CRAYIEEE))
+ _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = true);
+ _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = true);
+#else
+ _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = false);
+ _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = false);
+#endif
+
+ _STLP_STATIC_CONSTANT(bool, is_iec559 = __IsIEC559 && has_infinity && has_quiet_NaN && has_signaling_NaN && (has_denorm == denorm_present));
+ _STLP_STATIC_CONSTANT(bool, has_denorm_loss = false);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = true);
+ _STLP_STATIC_CONSTANT(bool, traps = true);
+ _STLP_STATIC_CONSTANT(bool, tinyness_before = false);
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Class numeric_limits
+
+// The unspecialized class.
+
+template<class _Tp>
+class numeric_limits : public _STLP_PRIV _Numeric_limits_base<_Tp> {};
+
+// Specializations for all built-in integral types.
+
+#if !defined (_STLP_NO_BOOL)
+_STLP_TEMPLATE_NULL
+class numeric_limits<bool>
+ : public _STLP_PRIV _Integer_limits<bool, false, true, 1, false>
+{};
+#endif /* _STLP_NO_BOOL */
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<char>
+ : public _STLP_PRIV _Integer_limits<char, CHAR_MIN, CHAR_MAX, -1, true>
+{};
+
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+_STLP_TEMPLATE_NULL
+class numeric_limits<signed char>
+ : public _STLP_PRIV _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX, -1, true>
+{};
+#endif
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned char>
+ : public _STLP_PRIV _Integer_limits<unsigned char, 0, UCHAR_MAX, -1, true>
+{};
+
+#if !(defined (_STLP_NO_WCHAR_T) || defined (_STLP_WCHAR_T_IS_USHORT))
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<wchar_t>
+ : public _STLP_PRIV _Integer_limits<wchar_t, WCHAR_MIN, WCHAR_MAX, -1, true>
+{};
+
+#endif
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<short>
+ : public _STLP_PRIV _Integer_limits<short, SHRT_MIN, SHRT_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned short>
+ : public _STLP_PRIV _Integer_limits<unsigned short, 0, USHRT_MAX, -1, true>
+{};
+
+#if defined (__xlC__) && (__xlC__ == 0x500)
+# undef INT_MIN
+# define INT_MIN -2147483648
+#endif
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<int>
+ : public _STLP_PRIV _Integer_limits<int, INT_MIN, INT_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned int>
+ : public _STLP_PRIV _Integer_limits<unsigned int, 0, UINT_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<long>
+ : public _STLP_PRIV _Integer_limits<long, LONG_MIN, LONG_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned long>
+ : public _STLP_PRIV _Integer_limits<unsigned long, 0, ULONG_MAX, -1, true>
+{};
+
+#if defined (_STLP_LONG_LONG)
+
+# if defined (_STLP_MSVC) || defined (__BORLANDC__)
+# define LONGLONG_MAX 0x7fffffffffffffffi64
+# define LONGLONG_MIN (-LONGLONG_MAX-1i64)
+# define ULONGLONG_MAX 0xffffffffffffffffUi64
+# else
+# ifndef LONGLONG_MAX
+# define LONGLONG_MAX 0x7fffffffffffffffLL
+# endif
+# ifndef LONGLONG_MIN
+# define LONGLONG_MIN (-LONGLONG_MAX-1LL)
+# endif
+# ifndef ULONGLONG_MAX
+# define ULONGLONG_MAX 0xffffffffffffffffULL
+# endif
+# endif
+
+# if !defined (__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ <= 96) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 3)
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<_STLP_LONG_LONG>
+ : public _STLP_PRIV _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true>
+{};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned _STLP_LONG_LONG>
+ : public _STLP_PRIV _Integer_limits<unsigned _STLP_LONG_LONG, 0, ULONGLONG_MAX, -1, true>
+{};
+# else /* gcc 2.97 (after 2000-11-01), 2.98, 3.0 */
+/*
+ newest gcc has new mangling scheme, that has problem
+ with generating name [instantiated] of template specialization like
+ _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true>
+ ~~~~~~~~~~~~ ~~~~~~~~~~~~
+ Below is code that solve this problem.
+ - ptr
+ */
+_STLP_TEMPLATE_NULL
+class numeric_limits<_STLP_LONG_LONG>
+ : public _STLP_PRIV _Numeric_limits_base<_STLP_LONG_LONG> {
+public:
+
+ static _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return LONGLONG_MIN; }
+ static _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return LONGLONG_MAX; }
+
+ _STLP_STATIC_CONSTANT(int, digits = ((int)((sizeof(_STLP_LONG_LONG) * (CHAR_BIT))) - 1));
+ _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000);
+ _STLP_STATIC_CONSTANT(int, radix = 2);
+ _STLP_STATIC_CONSTANT(bool, is_specialized = true);
+ _STLP_STATIC_CONSTANT(bool, is_signed = true);
+ _STLP_STATIC_CONSTANT(bool, is_integer = true);
+ _STLP_STATIC_CONSTANT(bool, is_exact = true);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = true);
+ _STLP_STATIC_CONSTANT(bool, is_modulo = true);
+};
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<unsigned _STLP_LONG_LONG>
+ : public _STLP_PRIV _Numeric_limits_base<unsigned _STLP_LONG_LONG> {
+public:
+
+ static unsigned _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return 0ULL; }
+ static unsigned _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return ULONGLONG_MAX; }
+
+ _STLP_STATIC_CONSTANT(int, digits = ((int)((sizeof(unsigned _STLP_LONG_LONG) * (CHAR_BIT)))));
+ _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000);
+ _STLP_STATIC_CONSTANT(int, radix = 2);
+ _STLP_STATIC_CONSTANT(bool, is_specialized = true);
+ _STLP_STATIC_CONSTANT(bool, is_signed = false);
+ _STLP_STATIC_CONSTANT(bool, is_integer = true);
+ _STLP_STATIC_CONSTANT(bool, is_exact = true);
+ _STLP_STATIC_CONSTANT(bool, is_bounded = true);
+ _STLP_STATIC_CONSTANT(bool, is_modulo = true);
+};
+
+# endif /* __GNUC__ > 2000-11-01 */
+
+#endif /* _STLP_LONG_LONG */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Specializations for all built-in floating-point types.
+template <class __dummy>
+class _LimG {
+public:
+ static float _STLP_CALL get_F_inf();
+ static float _STLP_CALL get_F_qNaN();
+ static float _STLP_CALL get_F_sNaN();
+ static float _STLP_CALL get_F_denormMin();
+ static double _STLP_CALL get_D_inf();
+ static double _STLP_CALL get_D_qNaN();
+ static double _STLP_CALL get_D_sNaN();
+ static double _STLP_CALL get_D_denormMin();
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ static long double _STLP_CALL get_LD_inf();
+ static long double _STLP_CALL get_LD_qNaN();
+ static long double _STLP_CALL get_LD_sNaN();
+ static long double _STLP_CALL get_LD_denormMin();
+#endif
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _LimG<bool>;
+#endif
+
+#if defined (__GNUC__)
+# if defined (__FLT_DENORM_MIN__)
+# define _STLP_FLT_DENORM_MIN __FLT_DENORM_MIN__
+# else
+# define _STLP_FLT_DENORM_STYLE denorm_absent
+# endif
+# if defined (__DBL_DENORM_MIN__)
+# define _STLP_DBL_DENORM_MIN __DBL_DENORM_MIN__
+# else
+# define _STLP_DBL_DENORM_STYLE denorm_absent
+# endif
+# if defined (__LDBL_DENORM_MIN__)
+# define _STLP_LDBL_DENORM_MIN __LDBL_DENORM_MIN__
+# else
+# define _STLP_LDBL_DENORM_STYLE denorm_absent
+# endif
+#endif
+
+/* If compiler do not expose thanks to some macro its status regarding
+ * denormalized floating point numbers, we consider that denormalization
+ * is present. Unit tests will tell us if compiler do not support them. */
+#if !defined (_STLP_FLT_DENORM_STYLE)
+# define _STLP_FLT_DENORM_STYLE denorm_present
+#endif
+
+#if !defined (_STLP_DBL_DENORM_STYLE)
+# define _STLP_DBL_DENORM_STYLE denorm_present
+#endif
+
+#if !defined (_STLP_LDBL_DENORM_STYLE)
+# define _STLP_LDBL_DENORM_STYLE denorm_present
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<float>
+ : public _STLP_PRIV _Floating_limits<float,
+ FLT_MANT_DIG, // Binary digits of precision
+ FLT_DIG, // Decimal digits of precision
+ FLT_MIN_EXP, // Minimum exponent
+ FLT_MAX_EXP, // Maximum exponent
+ FLT_MIN_10_EXP, // Minimum base 10 exponent
+ FLT_MAX_10_EXP, // Maximum base 10 exponent
+ true,
+ _STLP_FLT_DENORM_STYLE,
+ round_to_nearest> {
+public:
+ static float (_STLP_CALL min) () _STLP_NOTHROW { return FLT_MIN; }
+ static float _STLP_CALL denorm_min() _STLP_NOTHROW
+#if defined (_STLP_FLT_DENORM_MIN)
+ { return _STLP_FLT_DENORM_MIN; }
+#else
+ { return _STLP_FLT_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_F_denormMin() : FLT_MIN; }
+#endif
+ static float (_STLP_CALL max) () _STLP_NOTHROW { return FLT_MAX; }
+ static float _STLP_CALL epsilon() _STLP_NOTHROW { return FLT_EPSILON; }
+ static float _STLP_CALL round_error() _STLP_NOTHROW { return 0.5f; } // Units: ulps.
+ static float _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_inf(); }
+ static float _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_qNaN(); }
+ static float _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_F_sNaN(); }
+};
+
+#undef _STLP_FLT_DENORM_MIN
+#undef _STLP_FLT_DNORM_STYLE
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<double>
+ : public _STLP_PRIV _Floating_limits<double,
+ DBL_MANT_DIG, // Binary digits of precision
+ DBL_DIG, // Decimal digits of precision
+ DBL_MIN_EXP, // Minimum exponent
+ DBL_MAX_EXP, // Maximum exponent
+ DBL_MIN_10_EXP, // Minimum base 10 exponent
+ DBL_MAX_10_EXP, // Maximum base 10 exponent
+ true,
+ _STLP_DBL_DENORM_STYLE,
+ round_to_nearest> {
+public:
+ static double (_STLP_CALL min)() _STLP_NOTHROW { return DBL_MIN; }
+ static double _STLP_CALL denorm_min() _STLP_NOTHROW
+#if defined (_STLP_DBL_DENORM_MIN)
+ { return _STLP_DBL_DENORM_MIN; }
+#else
+ { return _STLP_DBL_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_D_denormMin() : DBL_MIN; }
+#endif
+ static double (_STLP_CALL max)() _STLP_NOTHROW { return DBL_MAX; }
+ static double _STLP_CALL epsilon() _STLP_NOTHROW { return DBL_EPSILON; }
+ static double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5; } // Units: ulps.
+ static double _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_inf(); }
+ static double _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_qNaN(); }
+ static double _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG<bool>::get_D_sNaN(); }
+};
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+
+_STLP_TEMPLATE_NULL
+class numeric_limits<long double>
+ : public _STLP_PRIV _Floating_limits<long double,
+ LDBL_MANT_DIG, // Binary digits of precision
+ LDBL_DIG, // Decimal digits of precision
+ LDBL_MIN_EXP, // Minimum exponent
+ LDBL_MAX_EXP, // Maximum exponent
+ LDBL_MIN_10_EXP,// Minimum base 10 exponent
+ LDBL_MAX_10_EXP,// Maximum base 10 exponent
+ false, // do not conform to iec559
+ _STLP_LDBL_DENORM_STYLE,
+ round_to_nearest> {
+public:
+ static long double (_STLP_CALL min) () _STLP_NOTHROW { return LDBL_MIN; }
+ static long double _STLP_CALL denorm_min() _STLP_NOTHROW
+#if defined (_STLP_LDBL_DENORM_MIN)
+ { return _STLP_LDBL_DENORM_MIN; }
+#else
+ { return _STLP_LDBL_DENORM_STYLE ? _STLP_PRIV _LimG<bool>::get_LD_denormMin() : LDBL_MIN; }
+#endif
+ _STLP_STATIC_CONSTANT(bool, is_iec559 = false);
+ static long double (_STLP_CALL max) () _STLP_NOTHROW { return LDBL_MAX; }
+ static long double _STLP_CALL epsilon() _STLP_NOTHROW { return LDBL_EPSILON; }
+ static long double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5l; }
+ static long double _STLP_CALL infinity() _STLP_NOTHROW
+ //For MSVC, long double is nothing more than an alias for double.
+#if !defined (_STLP_MSVC)
+ { return _STLP_PRIV _LimG<bool>::get_LD_inf(); }
+#else
+ { return _STLP_PRIV _LimG<bool>::get_D_inf(); }
+#endif
+ static long double _STLP_CALL quiet_NaN() _STLP_NOTHROW
+#if !defined (_STLP_MSVC)
+ { return _STLP_PRIV _LimG<bool>::get_LD_qNaN(); }
+#else
+ { return _STLP_PRIV _LimG<bool>::get_D_qNaN(); }
+#endif
+ static long double _STLP_CALL signaling_NaN() _STLP_NOTHROW
+#if !defined (_STLP_MSVC)
+ { return _STLP_PRIV _LimG<bool>::get_LD_sNaN(); }
+#else
+ { return _STLP_PRIV _LimG<bool>::get_D_sNaN(); }
+#endif
+};
+
+#endif
+
+// We write special values (Inf and NaN) as bit patterns and
+// cast the the appropriate floating-point types.
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_limits.c>
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_list.c b/stlport/stl/_list.c
new file mode 100644
index 0000000..86e420b
--- /dev/null
+++ b/stlport/stl/_list.c
@@ -0,0 +1,250 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_LIST_C
+#define _STLP_LIST_C
+
+#ifndef _STLP_INTERNAL_LIST_H
+# include <stl/_list.h>
+#endif
+
+#ifndef _STLP_CARRAY_H
+# include <stl/_carray.h>
+#endif
+
+#ifndef _STLP_RANGE_ERRORS_H
+# include <stl/_range_errors.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+template <class _Dummy>
+void _STLP_CALL
+_List_global<_Dummy>::_Transfer(_List_node_base* __position,
+ _List_node_base* __first, _List_node_base* __last) {
+ if (__position != __last) {
+ // Remove [first, last) from its old position.
+ __last->_M_prev->_M_next = __position;
+ __first->_M_prev->_M_next = __last;
+ __position->_M_prev->_M_next = __first;
+
+ // Splice [first, last) into its new position.
+ _Node_base* __tmp = __position->_M_prev;
+ __position->_M_prev = __last->_M_prev;
+ __last->_M_prev = __first->_M_prev;
+ __first->_M_prev = __tmp;
+ }
+}
+#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
+
+template <class _Tp, class _Alloc>
+void _List_base<_Tp,_Alloc>::clear() {
+ _Node* __cur = __STATIC_CAST(_Node*, _M_node._M_data._M_next);
+ while (
+#if defined (__BORLANDC__) // runtime error
+ __cur &&
+#endif
+ __cur != &(_M_node._M_data)) {
+ _Node* __tmp = __cur;
+ __cur = __STATIC_CAST(_Node*, __cur->_M_next);
+ _STLP_STD::_Destroy(&__tmp->_M_data);
+ this->_M_node.deallocate(__tmp, 1);
+ }
+ _M_node._M_data._M_next = &_M_node._M_data;
+ _M_node._M_data._M_prev = &_M_node._M_data;
+}
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define size_type size_t
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define list _STLP_PTR_IMPL_NAME(list)
+#elif defined (_STLP_DEBUG)
+# define list _STLP_NON_DBG_NAME(list)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc>
+void list<_Tp, _Alloc>::resize(size_type __new_size, const _Tp& __x) {
+ iterator __i = begin();
+ size_type __len = 0;
+ for ( ; __i != end() && __len < __new_size; ++__i, ++__len);
+
+ if (__len == __new_size)
+ erase(__i, end());
+ else // __i == end()
+ insert(end(), __new_size - __len, __x);
+}
+
+template <class _Tp, class _Alloc>
+list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list<_Tp, _Alloc>& __x) {
+ if (this != &__x) {
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ const_iterator __first2 = __x.begin();
+ const_iterator __last2 = __x.end();
+ while (__first1 != __last1 && __first2 != __last2)
+ *__first1++ = *__first2++;
+ if (__first2 == __last2)
+ erase(__first1, __last1);
+ else
+ insert(__last1, __first2, __last2);
+ }
+ return *this;
+}
+
+template <class _Tp, class _Alloc>
+void list<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) {
+ iterator __i = begin();
+ for ( ; __i != end() && __n > 0; ++__i, --__n)
+ *__i = __val;
+ if (__n > 0)
+ insert(end(), __n, __val);
+ else
+ erase(__i, end());
+}
+
+#if !defined (list)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc, class _Predicate>
+void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred) {
+ typedef typename list<_Tp, _Alloc>::iterator _Literator;
+ _Literator __first = __that.begin();
+ _Literator __last = __that.end();
+ while (__first != __last) {
+ _Literator __next = __first;
+ ++__next;
+ if (__pred(*__first)) __that.erase(__first);
+ __first = __next;
+ }
+}
+
+template <class _Tp, class _Alloc, class _BinaryPredicate>
+void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred) {
+ typedef typename list<_Tp, _Alloc>::iterator _Literator;
+ _Literator __first = __that.begin();
+ _Literator __last = __that.end();
+ if (__first == __last) return;
+ _Literator __next = __first;
+ while (++__next != __last) {
+ if (__binary_pred(*__first, *__next))
+ __that.erase(__next);
+ else
+ __first = __next;
+ __next = __first;
+ }
+}
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x,
+ _StrictWeakOrdering __comp) {
+ typedef typename list<_Tp, _Alloc>::iterator _Literator;
+ _Literator __first1 = __that.begin();
+ _Literator __last1 = __that.end();
+ _Literator __first2 = __x.begin();
+ _Literator __last2 = __x.end();
+ if (__that.get_allocator() == __x.get_allocator()) {
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ _Literator __next = __first2;
+ _List_global_inst::_Transfer(__first1._M_node, __first2._M_node, (++__next)._M_node);
+ __first2 = __next;
+ }
+ else
+ ++__first1;
+ }
+ if (__first2 != __last2)
+ _List_global_inst::_Transfer(__last1._M_node, __first2._M_node, __last2._M_node);
+ }
+ else {
+ while (__first1 != __last1 && __first2 != __last2) {
+ if (__comp(*__first2, *__first1)) {
+ _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
+ __first1 = __that.insert(__first1, *__first2);
+ }
+ else
+ ++__first1;
+ }
+ if (__first2 != __last2) {
+ __that.insert(__first1, __first2, __last2);
+ }
+ __x.clear();
+ }
+}
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp) {
+ // Do nothing if the list has length 0 or 1.
+ if (__that._M_node._M_data._M_next == &__that._M_node._M_data ||
+ __that._M_node._M_data._M_next->_M_next == &__that._M_node._M_data)
+ return;
+
+ list<_Tp, _Alloc> __carry(__that.get_allocator());
+ const int NB = 64;
+ _STLP_PRIV _CArray<list<_Tp, _Alloc>, NB> __counter(__carry);
+ int __fill = 0;
+ while (!__that.empty()) {
+ __carry.splice(__carry.begin(), __that, __that.begin());
+ int __i = 0;
+ while (__i < __fill && !__counter[__i].empty()) {
+ _S_merge(__counter[__i], __carry, __comp);
+ __carry.swap(__counter[__i++]);
+ }
+ __carry.swap(__counter[__i]);
+ if (__i == __fill) {
+ ++__fill;
+ if (__fill >= NB) {
+ //Looks like the list has too many elements to be sorted with this algorithm:
+ __stl_throw_overflow_error("list::sort");
+ }
+ }
+ }
+
+ for (int __i = 1; __i < __fill; ++__i)
+ _S_merge(__counter[__i], __counter[__i - 1], __comp);
+ __that.swap(__counter[__fill - 1]);
+}
+
+#if defined (list)
+# undef list
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_LIST_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_list.h b/stlport/stl/_list.h
new file mode 100644
index 0000000..6cd3f2b
--- /dev/null
+++ b/stlport/stl/_list.h
@@ -0,0 +1,742 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_LIST_IMPL_H
+#define _STLP_INTERNAL_LIST_IMPL_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _List_node_base {
+ _List_node_base* _M_next;
+ _List_node_base* _M_prev;
+};
+
+template <class _Dummy>
+class _List_global {
+public:
+ typedef _List_node_base _Node_base;
+ static void _STLP_CALL _Transfer(_Node_base* __pos,
+ _Node_base* __first, _Node_base* __last);
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _List_global<bool>;
+#endif
+typedef _List_global<bool> _List_global_inst;
+
+template <class _Tp>
+class _List_node : public _List_node_base {
+public:
+ _Tp _M_data;
+ __TRIVIAL_STUFF(_List_node)
+};
+
+struct _List_iterator_base {
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef bidirectional_iterator_tag iterator_category;
+
+ _List_node_base* _M_node;
+
+ _List_iterator_base(_List_node_base* __x) : _M_node(__x) {}
+
+ void _M_incr() { _M_node = _M_node->_M_next; }
+ void _M_decr() { _M_node = _M_node->_M_prev; }
+};
+
+
+template<class _Tp, class _Traits>
+struct _List_iterator : public _List_iterator_base {
+ typedef _Tp value_type;
+ typedef typename _Traits::pointer pointer;
+ typedef typename _Traits::reference reference;
+
+ typedef _List_iterator<_Tp, _Traits> _Self;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef _List_iterator<_Tp, _NonConstTraits> iterator;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _List_iterator<_Tp, _ConstTraits> const_iterator;
+
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef _List_node<_Tp> _Node;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ explicit _List_iterator(_List_node_base* __x) : _List_iterator_base(__x) {}
+ _List_iterator() : _List_iterator_base(0) {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _List_iterator(const iterator& __x) : _List_iterator_base(__x._M_node) {}
+
+ reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ this->_M_incr();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ this->_M_incr();
+ return __tmp;
+ }
+ _Self& operator--() {
+ this->_M_decr();
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ this->_M_decr();
+ return __tmp;
+ }
+ bool operator==(const_iterator __y ) const {
+ return this->_M_node == __y._M_node;
+ }
+ bool operator!=(const_iterator __y ) const {
+ return this->_M_node != __y._M_node;
+ }
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+struct __type_traits<_STLP_PRIV _List_iterator<_Tp, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+inline _Tp* value_type(const _STLP_PRIV _List_iterator<_Tp, _Traits>&) { return 0; }
+inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _List_iterator_base&) { return bidirectional_iterator_tag();}
+inline ptrdiff_t* distance_type(const _STLP_PRIV _List_iterator_base&) { return 0; }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// Base class that encapsulates details of allocators and helps
+// to simplify EH
+
+template <class _Tp, class _Alloc>
+class _List_base {
+protected:
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _List_node_base _Node_base;
+ typedef _List_node<_Tp> _Node;
+ typedef _List_base<_Tp, _Alloc> _Self;
+ typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _Node_allocator_type;
+public:
+ typedef _STLP_alloc_proxy<_Node_base, _Node, _Node_allocator_type> _AllocProxy;
+ typedef _Alloc allocator_type;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR((const _Node_allocator_type&)_M_node, _Tp); }
+
+ _List_base(const allocator_type& __a) : _M_node(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base())
+ { _M_empty_initialize(); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _List_base(__move_source<_Self> src) :
+ _M_node(__move_source<_AllocProxy>(src.get()._M_node)) {
+ if (src.get().empty())
+ //We force this to empty.
+ _M_empty_initialize();
+ else {
+ src.get()._M_empty_initialize();
+ _M_node._M_data._M_prev->_M_next = _M_node._M_data._M_next->_M_prev = &_M_node._M_data;
+ }
+ }
+#endif
+
+ ~_List_base()
+ { clear(); }
+
+ void clear();
+ bool empty() const { return _M_node._M_data._M_next == &_M_node._M_data; }
+
+ void _M_empty_initialize() {
+ _M_node._M_data._M_next = &_M_node._M_data;
+ _M_node._M_data._M_prev = _M_node._M_data._M_next;
+ }
+
+public:
+ _AllocProxy _M_node;
+};
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define list _STLP_PTR_IMPL_NAME(list)
+#elif defined (_STLP_DEBUG)
+# define list _STLP_NON_DBG_NAME(list)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class list;
+
+#if !defined (list)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// helper functions to reduce code duplication
+template <class _Tp, class _Alloc, class _Predicate>
+void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred);
+
+template <class _Tp, class _Alloc, class _BinaryPredicate>
+void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred);
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x,
+ _StrictWeakOrdering __comp);
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp);
+
+#if !defined (list)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc>
+class list : public _STLP_PRIV _List_base<_Tp, _Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list)
+ , public __stlport_class<list<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_PRIV _List_base<_Tp, _Alloc> _Base;
+ typedef list<_Tp, _Alloc> _Self;
+ typedef _STLP_PRIV _List_node<_Tp> _Node;
+ typedef _STLP_PRIV _List_node_base _Node_base;
+public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Base::allocator_type allocator_type;
+ typedef bidirectional_iterator_tag _Iterator_category;
+
+public:
+ typedef _STLP_PRIV _List_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
+ typedef _STLP_PRIV _List_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+protected:
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ _Node_base* _M_create_node(const_reference __x = value_type()) {
+#else
+ _Node_base* _M_create_node(const_reference __x) {
+#endif
+ _Node* __p = this->_M_node.allocate(1);
+ _STLP_TRY {
+ _Copy_Construct(&__p->_M_data, __x);
+ }
+ _STLP_UNWIND(this->_M_node.deallocate(__p, 1))
+ return __p;
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ _Node_base* _M_create_node() {
+ _Node* __p = this->_M_node.allocate(1);
+ _STLP_TRY {
+ _STLP_STD::_Construct(&__p->_M_data);
+ }
+ _STLP_UNWIND(this->_M_node.deallocate(__p, 1))
+ return __p;
+ }
+#endif
+
+public:
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n, const_reference __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
+ const allocator_type& __a = allocator_type())
+#else
+ explicit list(size_type __n)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
+ { this->insert(begin(), __n, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+ list(size_type __n, const_reference __val)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
+ { this->insert(begin(), __n, __val); }
+ list(size_type __n, const_reference __val, const allocator_type& __a)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
+ { this->insert(begin(), __n, __val); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because insert does all of
+ // that anyway.
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
+ { _M_insert(begin(), __first, __last); }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type())
+ { _M_insert(begin(), __first, __last); }
+# endif
+#else /* _STLP_MEMBER_TEMPLATES */
+ list(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
+ { _M_insert(begin(), __first, __last); }
+ list(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a)
+ { _M_insert(begin(), __first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(const allocator_type& __a = allocator_type())
+#else
+ list()
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) {}
+ list(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) {}
+
+ list(const _Self& __x) : _STLP_PRIV _List_base<_Tp, _Alloc>(__x.get_allocator())
+ { _M_insert(begin(), __x.begin(), __x.end()); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ list(__move_source<_Self> src)
+ : _STLP_PRIV _List_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {}
+#endif
+
+ ~list() {}
+
+ _Self& operator = (const _Self& __x);
+
+ iterator begin() { return iterator(this->_M_node._M_data._M_next); }
+ const_iterator begin() const { return const_iterator(this->_M_node._M_data._M_next); }
+
+ iterator end() { return iterator(&this->_M_node._M_data); }
+ const_iterator end() const { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_node._M_data)); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const {
+ size_type __result = _STLP_STD::distance(begin(), end());
+ return __result;
+ }
+ size_type max_size() const { return size_type(-1); }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(--end()); }
+ const_reference back() const { return *(--end()); }
+
+private:
+ void _M_swap_aux(_Self& __x) {
+ __x._M_node._M_swap_alloc(this->_M_node);
+ __x._M_node._M_data._M_next = this->_M_node._M_data._M_next;
+ __x._M_node._M_data._M_next->_M_prev = &__x._M_node._M_data;
+ __x._M_node._M_data._M_prev = this->_M_node._M_data._M_prev;
+ __x._M_node._M_data._M_prev->_M_next = &__x._M_node._M_data;
+ this->_M_empty_initialize();
+ }
+
+public:
+ void swap(_Self& __x) {
+ if (__x.empty()) {
+ if (this->empty()) {
+ return;
+ }
+ this->_M_swap_aux(__x);
+ } else if (this->empty()) {
+ __x._M_swap_aux(*this);
+ } else {
+ this->_M_node.swap(__x._M_node);
+ _STLP_STD::swap(this->_M_node._M_data._M_prev->_M_next, __x._M_node._M_data._M_prev->_M_next);
+ _STLP_STD::swap(this->_M_node._M_data._M_next->_M_prev, __x._M_node._M_data._M_next->_M_prev);
+ }
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const_reference __x = value_type())
+#else
+ iterator insert(iterator __pos, const_reference __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ {
+ _Node_base* __tmp = _M_create_node(__x);
+ _Node_base* __n = __pos._M_node;
+ _Node_base* __p = __n->_M_prev;
+ __tmp->_M_next = __n;
+ __tmp->_M_prev = __p;
+ __p->_M_next = __tmp;
+ __n->_M_prev = __tmp;
+ return iterator(__tmp);
+ }
+
+private:
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void _M_insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+ }
+
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template<class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_insert(__pos, __n, __x);
+ }
+ template <class _InputIter>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_insert(iterator __pos, const value_type* __first, const value_type* __last) {
+ for (; __first != __last; ++__first)
+ insert(__pos, *__first);
+ }
+ void _M_insert(iterator __pos, const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ //We use a temporary list to avoid the auto reference troubles (infinite loop)
+ for (; __first != __last; ++__first)
+ insert(__pos, *__first);
+ }
+
+public:
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_splice_insert_dispatch(__pos, __first, __last, _Integral());
+ }
+
+private:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template<class _Integer>
+ void _M_splice_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_insert(__pos, __n, __x);
+ }
+ template <class _InputIter>
+ void _M_splice_insert_dispatch(iterator __pos,
+ _InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos, const value_type* __first, const value_type* __last) {
+ _Self __tmp(__first, __last, this->get_allocator());
+ _STLP_ASSERT(__tmp.get_allocator() == this->get_allocator())
+ splice(__pos, __tmp);
+ }
+ void insert(iterator __pos, const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ //We use a temporary list to avoid the auto reference troubles (infinite loop)
+ _Self __tmp(__first, __last, this->get_allocator());
+ splice(__pos, __tmp);
+ }
+
+public:
+ void insert(iterator __pos, size_type __n, const_reference __x)
+ { _M_fill_insert(__pos, __n, __x); }
+
+private:
+ void _M_fill_insert(iterator __pos, size_type __n, const_reference __x) {
+ for ( ; __n > 0; --__n)
+ insert(__pos, __x);
+ }
+
+public:
+ void push_front(const_reference __x) { insert(begin(), __x); }
+ void push_back (const_reference __x) { insert(end(), __x); }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos)
+ { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+ void push_front() {insert(begin());}
+ void push_back() {insert(end());}
+# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ iterator erase(iterator __pos) {
+ _Node_base* __next_node = __pos._M_node->_M_next;
+ _Node_base* __prev_node = __pos._M_node->_M_prev;
+ _Node* __n = __STATIC_CAST(_Node*, __pos._M_node);
+ __prev_node->_M_next = __next_node;
+ __next_node->_M_prev = __prev_node;
+ _STLP_STD::_Destroy(&__n->_M_data);
+ this->_M_node.deallocate(__n, 1);
+ return iterator(__next_node);
+ }
+
+ iterator erase(iterator __first, iterator __last) {
+ while (__first != __last)
+ erase(__first++);
+ return __last;
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const_reference __x = value_type());
+#else
+ void resize(size_type __new_size, const_reference __x);
+ void resize(size_type __new_size)
+ { this->resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void pop_front() { erase(begin()); }
+ void pop_back() {
+ iterator __tmp = end();
+ erase(--__tmp);
+ }
+
+public:
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void assign(size_type __n, const_reference __val) { _M_fill_assign(__n, __val); }
+
+ void _M_fill_assign(size_type __n, const_reference __val);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_assign(__n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,
+ const __false_type& /*_IsIntegral*/) {
+#else
+ void assign(const value_type *__first2, const value_type *__last2) {
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
+ *__first1 = *__first2;
+ if (__first2 == __last2)
+ erase(__first1, __last1);
+ else
+ insert(__last1, __first2, __last2);
+ }
+ void assign(const_iterator __first2, const_iterator __last2) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
+ *__first1 = *__first2;
+ if (__first2 == __last2)
+ erase(__first1, __last1);
+ else
+ insert(__last1, __first2, __last2);
+ }
+
+public:
+ void splice(iterator __pos, _Self& __x) {
+ if (!__x.empty()) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __x.begin()._M_node, __x.end()._M_node);
+ }
+ else {
+ insert(__pos, __x.begin(), __x.end());
+ __x.clear();
+ }
+ }
+ }
+ void splice(iterator __pos, _Self& __x, iterator __i) {
+ iterator __j = __i;
+ ++__j;
+ if (__pos == __i || __pos == __j) return;
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __i._M_node, __j._M_node);
+ }
+ else {
+ insert(__pos, *__i);
+ __x.erase(__i);
+ }
+ }
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
+ if (__first != __last) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __first._M_node, __last._M_node);
+ }
+ else {
+ insert(__pos, __first, __last);
+ __x.erase(__first, __last);
+ }
+ }
+ }
+
+ void remove(const_reference __val) {
+ iterator __first = begin();
+ iterator __last = end();
+ while (__first != __last) {
+ iterator __next = __first;
+ ++__next;
+ if (__val == *__first) erase(__first);
+ __first = __next;
+ }
+ }
+
+ void unique()
+ { _STLP_PRIV _S_unique(*this, equal_to<value_type>()); }
+
+ void merge(_Self& __x)
+ { _STLP_PRIV _S_merge(*this, __x, less<value_type>()); }
+
+ void reverse() {
+ _Node_base* __p = &this->_M_node._M_data;
+ _Node_base* __tmp = __p;
+ do {
+ _STLP_STD::swap(__tmp->_M_next, __tmp->_M_prev);
+ __tmp = __tmp->_M_prev; // Old next node is now prev.
+ } while (__tmp != __p);
+ }
+
+ void sort()
+ { _STLP_PRIV _S_sort(*this, less<value_type>()); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred)
+ { _STLP_PRIV _S_remove_if(*this, __pred); }
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __binary_pred)
+ { _STLP_PRIV _S_unique(*this, __binary_pred); }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x,
+ _StrictWeakOrdering __comp) {
+ _STLP_PRIV _S_merge(*this, __x, __comp);
+ }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _STLP_PRIV _S_sort(*this, __comp); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+};
+
+#if defined (list)
+# undef list
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_list.c>
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# include <stl/pointers/_list.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_list.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp, class _Alloc>
+_STLP_INLINE_LOOP bool _STLP_CALL
+operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) {
+ typedef typename list<_Tp,_Alloc>::const_iterator const_iterator;
+ const_iterator __end1 = __x.end();
+ const_iterator __end2 = __y.end();
+
+ const_iterator __i1 = __x.begin();
+ const_iterator __i2 = __y.begin();
+ while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
+ ++__i1;
+ ++__i2;
+ }
+ return __i1 == __end1 && __i2 == __end2;
+}
+
+#define _STLP_EQUAL_OPERATOR_SPECIALIZED
+#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER list<_Tp, _Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+#undef _STLP_EQUAL_OPERATOR_SPECIALIZED
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Alloc>
+struct __move_traits<list<_Tp, _Alloc> > {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_LIST_IMPL_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_locale.h b/stlport/stl/_locale.h
new file mode 100644
index 0000000..fd6d537
--- /dev/null
+++ b/stlport/stl/_locale.h
@@ -0,0 +1,364 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_LOCALE_H
+#define _STLP_INTERNAL_LOCALE_H
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CWCHAR
+# include <stl/_cwchar.h>
+#endif
+
+#ifndef _STLP_INTERNAL_THREADS_H
+# include <stl/_threads.h>
+#endif
+
+#ifndef _STLP_STRING_FWD_H
+# include <stl/_string_fwd.h>
+#endif
+
+#include <stl/_facets_fwd.h>
+
+_STLP_BEGIN_NAMESPACE
+
+class _Locale_impl; // Forward declaration of opaque type.
+class locale;
+
+template <class _CharT, class _Traits, class _Alloc>
+bool __locale_do_operator_call(const locale& __loc,
+ const basic_string<_CharT, _Traits, _Alloc>& __x,
+ const basic_string<_CharT, _Traits, _Alloc>& __y);
+
+_STLP_DECLSPEC _Locale_impl * _STLP_CALL _get_Locale_impl( _Locale_impl *locimpl );
+_STLP_DECLSPEC _Locale_impl * _STLP_CALL _copy_Nameless_Locale_impl( _Locale_impl *locimpl );
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Facet>
+bool _HasFacet(const locale& __loc, const _Facet* __facet) _STLP_NOTHROW;
+
+template <class _Facet>
+_Facet* _UseFacet(const locale& __loc, const _Facet* __facet);
+
+template <class _Facet>
+void _InsertFacet(locale& __loc, _Facet* __facet);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+# define locale _STLP_NO_MEM_T_NAME(loc)
+#endif
+
+class _STLP_CLASS_DECLSPEC locale {
+public:
+ // types:
+ class _STLP_CLASS_DECLSPEC facet : protected _Refcount_Base {
+ protected:
+ /* Here we filter __init_count user value to 0 or 1 because __init_count is a
+ * size_t instance and _Refcount_Base use __stl_atomic_t instances that might
+ * have lower sizeof and generate roll issues. 1 is enough to keep the facet
+ * alive when required. */
+ explicit facet(size_t __init_count = 0) : _Refcount_Base( __init_count == 0 ? 0 : 1 ) {}
+ virtual ~facet();
+ friend class locale;
+ friend class _Locale_impl;
+ friend facet * _STLP_CALL _get_facet( facet * );
+ friend void _STLP_CALL _release_facet( facet *& );
+
+ private: // Invalidate assignment and copying.
+ facet(const facet& ) /* : _Refcount_Base(1) {} */;
+ void operator=(const facet&);
+ };
+
+#if defined (__MVS__) || defined (__OS400__)
+ struct
+#else
+ class
+#endif
+ _STLP_CLASS_DECLSPEC id {
+ public:
+ size_t _M_index;
+ static size_t _S_max;
+ };
+
+ typedef int category;
+ _STLP_STATIC_CONSTANT(category, none = 0x000);
+ _STLP_STATIC_CONSTANT(category, collate = 0x010);
+ _STLP_STATIC_CONSTANT(category, ctype = 0x020);
+ _STLP_STATIC_CONSTANT(category, monetary = 0x040);
+ _STLP_STATIC_CONSTANT(category, numeric = 0x100);
+ _STLP_STATIC_CONSTANT(category, time = 0x200);
+ _STLP_STATIC_CONSTANT(category, messages = 0x400);
+ _STLP_STATIC_CONSTANT(category, all = collate | ctype | monetary | numeric | time | messages);
+
+ // construct/copy/destroy:
+ locale() _STLP_NOTHROW;
+ locale(const locale&) _STLP_NOTHROW;
+ explicit locale(const char *);
+ locale(const locale&, const char*, category);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _Facet>
+ locale(const locale& __loc, _Facet* __f) {
+ if ( __f != 0 ) {
+ this->_M_impl = _get_Locale_impl( _copy_Nameless_Locale_impl( __loc._M_impl ) );
+ _STLP_PRIV _InsertFacet(*this, __f);
+ } else {
+ this->_M_impl = _get_Locale_impl( __loc._M_impl );
+ }
+ }
+#endif
+
+protected:
+ // those are for internal use
+ locale(_Locale_impl*);
+
+public:
+ locale(const locale&, const locale&, category);
+ const locale& operator=(const locale&) _STLP_NOTHROW;
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+protected:
+#endif
+ ~locale() _STLP_NOTHROW;
+
+public:
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) && \
+ !defined(_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _Facet>
+ locale combine(const locale& __loc) const {
+ _Facet *__facet = 0;
+ if (!_STLP_PRIV _HasFacet(__loc, __facet))
+ _M_throw_on_combine_error(__loc.name());
+
+ return locale(*this, _STLP_PRIV _UseFacet(__loc, __facet));
+ }
+#endif
+
+ // locale operations:
+ string name() const;
+
+ bool operator==(const locale&) const;
+ bool operator!=(const locale&) const;
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || defined (_STLP_INLINE_MEMBER_TEMPLATES) || (defined(__MWERKS__) && __MWERKS__ <= 0x2301)
+ bool operator()(const string& __x, const string& __y) const;
+# ifndef _STLP_NO_WCHAR_T
+ bool operator()(const wstring& __x, const wstring& __y) const;
+# endif
+#elif !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _CharT, class _Traits, class _Alloc>
+ bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x,
+ const basic_string<_CharT, _Traits, _Alloc>& __y) const
+ { return __locale_do_operator_call(*this, __x, __y); }
+#endif
+
+ // global locale objects:
+#if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ static locale _STLP_CALL global(const locale&);
+#else
+ static _Locale_impl* _STLP_CALL global(const locale&);
+#endif
+ static const locale& _STLP_CALL classic();
+
+//protected: // Helper functions for locale globals.
+ facet* _M_get_facet(const id&) const;
+ // same, but throws
+ facet* _M_use_facet(const id&) const;
+ static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_on_combine_error(const string& name);
+ static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_on_null_name();
+ static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_on_creation_failure(int __err_code,
+ const char* name, const char* facet);
+
+//protected: // More helper functions.
+ void _M_insert(facet* __f, id& __id);
+
+ // friends:
+ friend class _Locale_impl;
+
+protected: // Data members
+ _Locale_impl* _M_impl;
+ _Locale_impl* _M_get_impl() const { return _M_impl; }
+};
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+# undef locale
+# define _Locale _STLP_NO_MEM_T_NAME(loc)
+
+class locale : public _Locale {
+public:
+
+ // construct/copy/destroy:
+ locale() _STLP_NOTHROW {
+#if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+ _STLP_CHECK_RUNTIME_COMPATIBILITY();
+#endif
+ }
+ locale(const locale& __loc) _STLP_NOTHROW : _Locale(__loc) {}
+ explicit locale(const char *__str) : _Locale(__str) {}
+ locale(const locale& __loc, const char* __str, category __cat)
+ : _Locale(__loc, __str, __cat) {}
+
+ template <class _Facet>
+ locale(const locale& __loc, _Facet* __f)
+ : _Locale(__f != 0 ? _copy_Nameless_Locale_impl(__loc._M_impl) : __loc._M_impl) {
+ if ( __f != 0 ) {
+ _STLP_PRIV _InsertFacet(*this, __f);
+ }
+ }
+
+private:
+ // those are for internal use
+ locale(_Locale_impl* __impl) : _Locale(__impl) {}
+ locale(const _Locale& __loc) : _Locale(__loc) {}
+
+public:
+
+ locale(const locale& __loc1, const locale& __loc2, category __cat)
+ : _Locale(__loc1, __loc2, __cat) {}
+
+ const locale& operator=(const locale& __loc) _STLP_NOTHROW {
+ _Locale::operator=(__loc);
+ return *this;
+ }
+
+ template <class _Facet>
+ locale combine(const locale& __loc) const {
+ _Facet *__facet = 0;
+ if (!_STLP_PRIV _HasFacet(__loc, __facet))
+ _M_throw_on_combine_error(__loc.name());
+
+ return locale(*this, _STLP_PRIV _UseFacet(__loc, __facet));
+ }
+
+ // locale operations:
+ bool operator==(const locale& __loc) const { return _Locale::operator==(__loc); }
+ bool operator!=(const locale& __loc) const { return _Locale::operator!=(__loc); }
+
+ template <class _CharT, class _Traits, class _Alloc>
+ bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x,
+ const basic_string<_CharT, _Traits, _Alloc>& __y) const
+ { return __locale_do_operator_call(*this, __x, __y); }
+
+ // global locale objects:
+ static locale _STLP_CALL global(const locale& __loc) {
+ return _Locale::global(__loc);
+ }
+ static const locale& _STLP_CALL classic() {
+ return __STATIC_CAST(const locale&, _Locale::classic());
+ }
+
+ // friends:
+ friend class _Locale_impl;
+};
+
+# undef _Locale
+#endif
+
+//----------------------------------------------------------------------
+// locale globals
+
+template <class _Facet>
+inline const _Facet&
+#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+_Use_facet<_Facet>::operator *() const
+#else
+use_facet(const locale& __loc)
+#endif
+{
+ _Facet *__facet = 0;
+ return *(_STLP_PRIV _UseFacet(__loc, __facet));
+}
+
+template <class _Facet>
+#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+struct has_facet {
+ const locale& __loc;
+ has_facet(const locale& __p_loc) : __loc(__p_loc) {}
+ operator bool() const _STLP_NOTHROW
+#else
+inline bool has_facet(const locale& __loc) _STLP_NOTHROW
+#endif
+{
+ _Facet *__facet = 0;
+ return _STLP_PRIV _HasFacet(__loc, __facet);
+}
+
+#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+}; // close class definition
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/* _GetFacetId is a helper function that allow delaying access to
+ * facet id static instance in the library source code to avoid
+ * the other static instances that many compilers are generating
+ * in all dynamic library or executable when instanciating facet
+ * template class.
+ */
+template <class _Facet>
+inline locale::id& _GetFacetId(const _Facet*)
+{ return _Facet::id; }
+
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_get<char, istreambuf_iterator<char, char_traits<char> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_put<char, ostreambuf_iterator<char, char_traits<char> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_get<char, istreambuf_iterator<char, char_traits<char> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_put<char, ostreambuf_iterator<char, char_traits<char> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_get<char, istreambuf_iterator<char, char_traits<char> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_put<char, ostreambuf_iterator<char, char_traits<char> > >*);
+
+#ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >*);
+_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >*);
+#endif
+
+template <class _Facet>
+inline bool _HasFacet(const locale& __loc, const _Facet* __facet) _STLP_NOTHROW
+{ return (__loc._M_get_facet(_GetFacetId(__facet)) != 0); }
+
+template <class _Facet>
+inline _Facet* _UseFacet(const locale& __loc, const _Facet* __facet)
+{ return __STATIC_CAST(_Facet*, __loc._M_use_facet(_GetFacetId(__facet))); }
+
+template <class _Facet>
+inline void _InsertFacet(locale& __loc, _Facet* __facet)
+{ __loc._M_insert(__facet, _GetFacetId(__facet)); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_LOCALE_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_map.h b/stlport/stl/_map.h
new file mode 100644
index 0000000..bf46a5d
--- /dev/null
+++ b/stlport/stl/_map.h
@@ -0,0 +1,435 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_MAP_H
+#define _STLP_INTERNAL_MAP_H
+
+#ifndef _STLP_INTERNAL_TREE_H
+# include <stl/_tree.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(MapTraitsT, traits)
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key> ),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class map
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<map<_Key, _Tp, _Compare, _Alloc> >
+#endif
+{
+ typedef map<_Key, _Tp, _Compare, _Alloc> _Self;
+public:
+
+// typedefs:
+
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+
+ class value_compare
+ : public binary_function<value_type, value_type, bool> {
+ friend class map<_Key,_Tp,_Compare,_Alloc>;
+ protected :
+ //c is a Standard name (23.3.1), do no make it STLport naming convention compliant.
+ _Compare comp;
+ value_compare(_Compare __c) : comp(__c) {}
+ public:
+ bool operator()(const value_type& __x, const value_type& __y) const
+ { return comp(__x.first, __y.first); }
+ };
+
+protected:
+ typedef _STLP_PRIV _MapTraitsT<value_type> _MapTraits;
+
+public:
+ //Following typedef have to be public for __move_traits specialization.
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_SELECT1ST(value_type, _Key),
+ _MapTraits, _Alloc> _Rep_type;
+
+ typedef typename _Rep_type::pointer pointer;
+ typedef typename _Rep_type::const_pointer const_pointer;
+ typedef typename _Rep_type::reference reference;
+ typedef typename _Rep_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing map
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ // allocation/deallocation
+ map() : _M_t(_Compare(), allocator_type()) {}
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit map(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+#else
+ explicit map(const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) {}
+ explicit map(const _Compare& __comp, const allocator_type& __a)
+#endif
+ : _M_t(__comp, __a) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ map(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ template <class _InputIterator>
+ map(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ map(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); }
+# endif
+
+#else
+ map(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ map(const value_type* __first,
+ const value_type* __last, const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+
+ map(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ map(const_iterator __first, const_iterator __last, const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ map(const _Self& __x) : _M_t(__x._M_t) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ map(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+#endif
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return value_compare(_M_t.key_comp()); }
+ allocator_type get_allocator() const { return _M_t.get_allocator(); }
+
+ iterator begin() { return _M_t.begin(); }
+ const_iterator begin() const { return _M_t.begin(); }
+ iterator end() { return _M_t.end(); }
+ const_iterator end() const { return _M_t.end(); }
+ reverse_iterator rbegin() { return _M_t.rbegin(); }
+ const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
+ reverse_iterator rend() { return _M_t.rend(); }
+ const_reverse_iterator rend() const { return _M_t.rend(); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Tp& operator[](const _KT& __k) {
+ iterator __i = lower_bound(__k);
+ // __i->first is greater than or equivalent to __k.
+ if (__i == end() || key_comp()(__k, (*__i).first))
+ __i = insert(__i, value_type(__k, _STLP_DEFAULT_CONSTRUCTED(_Tp)));
+ return (*__i).second;
+ }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ // insert/erase
+ pair<iterator,bool> insert(const value_type& __x)
+ { return _M_t.insert_unique(__x); }
+ iterator insert(iterator __pos, const value_type& __x)
+ { return _M_t.insert_unique(__pos, __x); }
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last)
+ { _M_t.insert_unique(__first, __last); }
+#else
+ void insert(const value_type* __first, const value_type* __last)
+ { _M_t.insert_unique(__first, __last); }
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_unique(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void erase(iterator __pos) { _M_t.erase(__pos); }
+ size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); }
+ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); }
+ void clear() { _M_t.clear(); }
+
+ // map operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x) { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const { return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range(const _KT& __x)
+ { return _M_t.equal_range_unique(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator,const_iterator> equal_range(const _KT& __x) const
+ { return _M_t.equal_range_unique(__x); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(MultimapTraitsT, traits)
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key> ),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class multimap
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<multimap<_Key, _Tp, _Compare, _Alloc> >
+#endif
+{
+ typedef multimap<_Key, _Tp, _Compare, _Alloc> _Self;
+public:
+
+// typedefs:
+
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+
+ class value_compare : public binary_function<value_type, value_type, bool> {
+ friend class multimap<_Key,_Tp,_Compare,_Alloc>;
+ protected:
+ //comp is a Standard name (23.3.2), do no make it STLport naming convention compliant.
+ _Compare comp;
+ value_compare(_Compare __c) : comp(__c) {}
+ public:
+ bool operator()(const value_type& __x, const value_type& __y) const
+ { return comp(__x.first, __y.first); }
+ };
+
+protected:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _MultimapTraitsT<value_type> _MultimapTraits;
+
+public:
+ //Following typedef have to be public for __move_traits specialization.
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_SELECT1ST(value_type, _Key),
+ _MultimapTraits, _Alloc> _Rep_type;
+
+ typedef typename _Rep_type::pointer pointer;
+ typedef typename _Rep_type::const_pointer const_pointer;
+ typedef typename _Rep_type::reference reference;
+ typedef typename _Rep_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing multimap
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ // allocation/deallocation
+ multimap() : _M_t(_Compare(), allocator_type()) { }
+ explicit multimap(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { }
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+ template <class _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); }
+# endif
+ template <class _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+#else
+ multimap(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+ multimap(const value_type* __first, const value_type* __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+
+ multimap(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+ multimap(const_iterator __first, const_iterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ multimap(const _Self& __x) : _M_t(__x._M_t) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ multimap(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+#endif
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ // accessors:
+
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return value_compare(_M_t.key_comp()); }
+ allocator_type get_allocator() const { return _M_t.get_allocator(); }
+
+ iterator begin() { return _M_t.begin(); }
+ const_iterator begin() const { return _M_t.begin(); }
+ iterator end() { return _M_t.end(); }
+ const_iterator end() const { return _M_t.end(); }
+ reverse_iterator rbegin() { return _M_t.rbegin(); }
+ const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
+ reverse_iterator rend() { return _M_t.rend(); }
+ const_reverse_iterator rend() const { return _M_t.rend(); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ // insert/erase
+ iterator insert(const value_type& __x) { return _M_t.insert_equal(__x); }
+ iterator insert(iterator __pos, const value_type& __x) { return _M_t.insert_equal(__pos, __x); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last)
+ { _M_t.insert_equal(__first, __last); }
+#else
+ void insert(const value_type* __first, const value_type* __last)
+ { _M_t.insert_equal(__first, __last); }
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_equal(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+ void erase(iterator __pos) { _M_t.erase(__pos); }
+ size_type erase(const key_type& __x) { return _M_t.erase(__x); }
+ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); }
+ void clear() { _M_t.clear(); }
+
+ // multimap operations:
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x) { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const { return _M_t.count(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range(const _KT& __x)
+ { return _M_t.equal_range(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator,const_iterator> equal_range(const _KT& __x) const
+ { return _M_t.equal_range(__x); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _Compare, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER map<_Key,_Tp,_Compare,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER multimap<_Key,_Tp,_Compare,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Key, class _Tp, class _Compare, class _Alloc>
+struct __move_traits<map<_Key,_Tp,_Compare,_Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename map<_Key,_Tp,_Compare,_Alloc>::_Rep_type>
+{};
+
+template <class _Key, class _Tp, class _Compare, class _Alloc>
+struct __move_traits<multimap<_Key,_Tp,_Compare,_Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename multimap<_Key,_Tp,_Compare,_Alloc>::_Rep_type>
+{};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_MAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_mbstate_t.h b/stlport/stl/_mbstate_t.h
new file mode 100644
index 0000000..53566a7
--- /dev/null
+++ b/stlport/stl/_mbstate_t.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_MBSTATE_T
+#define _STLP_INTERNAL_MBSTATE_T
+
+#if (defined (__OpenBSD__) || defined (__FreeBSD__) || defined (__hpux)) && defined (__GNUC__) && !defined (_GLIBCPP_HAVE_MBSTATE_T)
+# define _STLP_CPP_MBSTATE_T /* mbstate_t defined in native <cwchar>, so not defined in C! */
+#endif
+
+#if defined (_STLP_NO_NATIVE_MBSTATE_T) || defined (_STLP_CPP_MBSTATE_T) && !defined (_MBSTATE_T)
+# define _STLP_USE_OWN_MBSTATE_T
+# define _MBSTATE_T
+#endif
+
+#if defined (_STLP_USE_OWN_MBSTATE_T)
+# if !defined (_STLP_CPP_MBSTATE_T) || !defined (__cplusplus) || !defined (_STLP_USE_NEW_C_HEADERS)
+# if !defined (ANDROID) /* mbstate_t conflicts with Android's definition */
+typedef int mbstate_t;
+# endif
+# endif
+
+# if !defined (_STLP_CPP_MBSTATE_T) && defined (__cplusplus) && defined (_STLP_USE_NAMESPACES)
+_STLP_BEGIN_NAMESPACE
+using ::mbstate_t;
+_STLP_END_NAMESPACE
+# endif
+
+#endif /* _STLP_USE_OWN_MBSTATE_T */
+
+#endif /* _STLP_INTERNAL_MBSTATE_T */
diff --git a/stlport/stl/_messages_facets.h b/stlport/stl/_messages_facets.h
new file mode 100644
index 0000000..aca5596
--- /dev/null
+++ b/stlport/stl/_messages_facets.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_MESSAGES_H
+#define _STLP_INTERNAL_MESSAGES_H
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h>
+#endif
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// messages facets
+
+class messages_base {
+ public:
+ typedef int catalog;
+};
+
+template <class _CharT> class messages {};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+class _Messages;
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC messages<char> : public locale::facet, public messages_base {
+public:
+ typedef messages_base::catalog catalog;
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit messages(size_t __refs = 0);
+
+ catalog open(const string& __fn, const locale& __loc) const
+ { return do_open(__fn, __loc); }
+ string_type get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const
+ { return do_get(__c, __set, __msgid, __dfault); }
+ inline void close(catalog __c) const
+ { do_close(__c); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~messages() {}
+
+ virtual catalog do_open(const string& __fn, const locale& __loc) const
+ { return -1; }
+ virtual string_type do_get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const
+ { return __dfault; }
+ virtual void do_close(catalog __c) const
+ {}
+};
+
+#if !defined (_STLP_NO_WCHAR_T)
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC messages<wchar_t> : public locale::facet, public messages_base {
+public:
+ typedef messages_base::catalog catalog;
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit messages(size_t __refs = 0);
+
+ inline catalog open(const string& __fn, const locale& __loc) const
+ { return do_open(__fn, __loc); }
+ inline string_type get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const
+ { return do_get(__c, __set, __msgid, __dfault); }
+ inline void close(catalog __c) const
+ { do_close(__c); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~messages() {}
+
+ virtual catalog do_open(const string& __fn, const locale& __loc) const
+ { return -1; }
+ virtual string_type do_get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const
+ { return __dfault; }
+ virtual void do_close(catalog __c) const
+ {}
+};
+
+#endif
+
+template <class _CharT> class messages_byname {};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC messages_byname<char> : public messages<char> {
+ friend class _Locale_impl;
+public:
+ typedef messages_base::catalog catalog;
+ typedef string string_type;
+
+ explicit messages_byname(const char* __name, size_t __refs = 0);
+
+protected:
+ ~messages_byname();
+
+ virtual catalog do_open(const string& __fn, const locale& __loc) const;
+ virtual string_type do_get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const;
+ virtual void do_close(catalog __c) const;
+
+private:
+ messages_byname(_Locale_messages*);
+ typedef messages_byname<char> _Self;
+ //explicitely defined as private to avoid warnings:
+ messages_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _STLP_PRIV _Messages* _M_impl;
+};
+
+#if !defined (_STLP_NO_WCHAR_T)
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC messages_byname<wchar_t> : public messages<wchar_t> {
+ friend class _Locale_impl;
+public:
+ typedef messages_base::catalog catalog;
+ typedef wstring string_type;
+
+ explicit messages_byname(const char* __name, size_t __refs = 0);
+
+protected:
+ ~messages_byname();
+
+ virtual catalog do_open(const string& __fn, const locale& __loc) const;
+ virtual string_type do_get(catalog __c, int __set, int __msgid,
+ const string_type& __dfault) const;
+ virtual void do_close(catalog __c) const;
+
+private:
+ messages_byname(_Locale_messages*);
+ typedef messages_byname<wchar_t> _Self;
+ //explicitely defined as private to avoid warnings:
+ messages_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _STLP_PRIV _Messages* _M_impl;
+};
+#endif /* WCHAR_T */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_MESSAGES_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_monetary.c b/stlport/stl/_monetary.c
new file mode 100644
index 0000000..3de937c
--- /dev/null
+++ b/stlport/stl/_monetary.c
@@ -0,0 +1,527 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_MONETARY_C
+#define _STLP_MONETARY_C
+
+# ifndef _STLP_INTERNAL_MONETARY_H
+# include <stl/_monetary.h>
+# endif
+
+#ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_PUT_H
+# include <stl/_num_put.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _InputIterator>
+locale::id money_get<_CharT, _InputIterator>::id;
+
+template <class _CharT, class _OutputIterator>
+locale::id money_put<_CharT, _OutputIterator>::id;
+
+// money_get facets
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// helper functions for do_get
+template <class _InIt1, class _InIt2>
+pair<_InIt1, bool> __get_string( _InIt1 __first, _InIt1 __last,
+ _InIt2 __str_first, _InIt2 __str_last) {
+ while ( __first != __last && __str_first != __str_last && *__first == *__str_first ) {
+ ++__first;
+ ++__str_first;
+ }
+ return make_pair(__first, __str_first == __str_last);
+}
+
+template <class _InIt, class _OuIt, class _CharT>
+bool
+__get_monetary_value(_InIt& __first, _InIt __last, _OuIt __out_ite,
+ const ctype<_CharT>& _c_type,
+ _CharT __point, int __frac_digits, _CharT __sep,
+ const string& __grouping, bool &__syntax_ok) {
+ if (__first == __last || !_c_type.is(ctype_base::digit, *__first))
+ return false;
+
+ char __group_sizes[128];
+ char* __group_sizes_end = __grouping.empty()? 0 : __group_sizes;
+ char __current_group_size = 0;
+
+ while (__first != __last) {
+ if (_c_type.is(ctype_base::digit, *__first)) {
+ ++__current_group_size;
+ *__out_ite++ = *__first++;
+ }
+ else if (__group_sizes_end) {
+ if (*__first == __sep) {
+ *__group_sizes_end++ = __current_group_size;
+ __current_group_size = 0;
+ ++__first;
+ }
+ else break;
+ }
+ else
+ break;
+ }
+
+ if (__grouping.empty())
+ __syntax_ok = true;
+ else {
+ if (__group_sizes_end != __group_sizes)
+ *__group_sizes_end++ = __current_group_size;
+
+ __syntax_ok = __valid_grouping(__group_sizes, __group_sizes_end,
+ __grouping.data(), __grouping.data()+ __grouping.size());
+
+ if (__first == __last || *__first != __point) {
+ for (int __digits = 0; __digits != __frac_digits; ++__digits)
+ *__out_ite++ = _CharT('0');
+ return true; // OK not to have decimal point
+ }
+ }
+
+ ++__first;
+
+ int __digits = 0;
+
+ while (__first != __last && _c_type.is(ctype_base::digit, *__first)) {
+ *__out_ite++ = *__first++;
+ ++__digits;
+ }
+
+ __syntax_ok = __syntax_ok && (__digits == __frac_digits);
+
+ return true;
+}
+
+
+template <class _CharT, class _InputIter, class _StrType>
+_InputIter __money_do_get(_InputIter __s, _InputIter __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ _StrType& __digits, bool &__is_positive, _CharT* /*__dummy*/) {
+ if (__s == __end) {
+ __err |= ios_base::eofbit;
+ return __s;
+ }
+
+ typedef _CharT char_type;
+ typedef _StrType string_type;
+ typedef _InputIter iter_type;
+ typedef moneypunct<char_type, false> _Punct;
+ typedef moneypunct<char_type, true> _Punct_intl;
+ typedef ctype<char_type> _Ctype;
+
+ locale __loc = __str.getloc();
+ const _Punct& __punct = use_facet<_Punct>(__loc) ;
+ const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
+ const _Ctype& __c_type = use_facet<_Ctype>(__loc) ;
+
+ money_base::pattern __format = __intl ? __punct_intl.neg_format()
+ : __punct.neg_format();
+ string_type __ns = __intl ? __punct_intl.negative_sign()
+ : __punct.negative_sign();
+ string_type __ps = __intl ? __punct_intl.positive_sign()
+ : __punct.positive_sign();
+ int __i;
+ bool __symbol_required = (__str.flags() & ios_base::showbase) != 0;
+ string_type __buf;
+ back_insert_iterator<string_type> __out_ite(__buf);
+
+ for (__i = 0; __i < 4; ++__i) {
+ switch (__format.field[__i]) {
+ case money_base::space:
+ if (!__c_type.is(ctype_base::space, *__s)) {
+ __err = ios_base::failbit;
+ return __s;
+ }
+ ++__s;
+ case money_base::none:
+ while (__s != __end && __c_type.is(ctype_base::space, *__s))
+ ++__s;
+ break;
+ case money_base::symbol: {
+ string_type __curs = __intl ? __punct_intl.curr_symbol()
+ : __punct.curr_symbol();
+ pair<iter_type, bool>
+ __result = __get_string(__s, __end, __curs.begin(), __curs.end());
+ if (!__result.second && __symbol_required)
+ __err = ios_base::failbit;
+ __s = __result.first;
+ break;
+ }
+ case money_base::sign: {
+ if (__s == __end) {
+ if (__ps.empty())
+ break;
+ if (__ns.empty()) {
+ __is_positive = false;
+ break;
+ }
+ __err = ios_base::failbit;
+ return __s;
+ }
+ else {
+ if (__ps.empty()) {
+ if (__ns.empty())
+ break;
+ if (*__s == __ns[0]) {
+ ++__s;
+ __is_positive = false;
+ }
+ break;
+ }
+ else {
+ if (*__s == __ps[0]) {
+ ++__s;
+ break;
+ }
+ if (__ns.empty())
+ break;
+ if (*__s == __ns[0]) {
+ ++__s;
+ __is_positive = false;
+ break;
+ }
+ __err = ios_base::failbit;
+ }
+ }
+ return __s;
+ }
+ case money_base::value: {
+ char_type __point = __intl ? __punct_intl.decimal_point()
+ : __punct.decimal_point();
+ int __frac_digits = __intl ? __punct_intl.frac_digits()
+ : __punct.frac_digits();
+ string __grouping = __intl ? __punct_intl.grouping()
+ : __punct.grouping();
+ bool __syntax_ok = true;
+
+ bool __result;
+
+ char_type __sep = __grouping.empty() ? char_type() :
+ __intl ? __punct_intl.thousands_sep() : __punct.thousands_sep();
+
+ __result = __get_monetary_value(__s, __end, __out_ite, __c_type,
+ __point, __frac_digits,
+ __sep,
+ __grouping, __syntax_ok);
+
+ if (!__syntax_ok)
+ __err |= ios_base::failbit;
+ if (!__result) {
+ __err = ios_base::failbit;
+ return __s;
+ }
+ break;
+
+ } // Close money_base::value case
+ } // Close switch statement
+ } // Close for loop
+
+ if (__is_positive) {
+ if (__ps.size() > 1) {
+ pair<_InputIter, bool>
+ __result = __get_string(__s, __end, __ps.begin() + 1, __ps.end());
+ __s = __result.first;
+ if (!__result.second)
+ __err |= ios::failbit;
+ }
+ if (!(__err & ios_base::failbit))
+ __digits = __buf;
+ }
+ else {
+ if (__ns.size() > 1) {
+ pair<_InputIter, bool>
+ __result = __get_string(__s, __end, __ns.begin() + 1, __ns.end());
+ __s = __result.first;
+ if (!__result.second)
+ __err |= ios::failbit;
+ }
+ if (!(__err & ios::failbit)) {
+ __digits = __c_type.widen('-');
+ __digits += __buf;
+ }
+ }
+ if (__s == __end)
+ __err |= ios::eofbit;
+
+ return __s;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//===== methods ======
+template <class _CharT, class _InputIter>
+_InputIter
+money_get<_CharT, _InputIter>::do_get(_InputIter __s, _InputIter __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ _STLP_LONGEST_FLOAT_TYPE& __units) const {
+ string_type __buf;
+ bool __is_positive = true;
+ __s = _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __buf, __is_positive, (_CharT*)0);
+
+ if (__err == ios_base::goodbit || __err == ios_base::eofbit) {
+ typename string_type::iterator __b = __buf.begin(), __e = __buf.end();
+
+ if (!__is_positive) ++__b;
+ // Can't use atold, since it might be wchar_t. Don't get confused by name below :
+ // it's perfectly capable of reading long double.
+ _STLP_PRIV __get_decimal_integer(__b, __e, __units, (_CharT*)0);
+
+ if (!__is_positive) {
+ __units = -__units;
+ }
+ }
+
+ return __s;
+}
+
+template <class _CharT, class _InputIter>
+_InputIter
+money_get<_CharT, _InputIter>::do_get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ string_type& __digits) const {
+ bool __is_positive = true;
+ return _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __digits, __is_positive, (_CharT*)0);
+}
+
+// money_put facets
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT, class _OutputIter, class _Str_Type, class _Str>
+_OutputIter __money_do_put(_OutputIter __s, bool __intl, ios_base& __str,
+ _CharT __fill, const _Str& __digits, bool __check_digits,
+ _Str_Type * /*__dummy*/) {
+ typedef _CharT char_type;
+ typedef _Str_Type string_type;
+ typedef ctype<char_type> _Ctype;
+ typedef moneypunct<char_type, false> _Punct;
+ typedef moneypunct<char_type, true> _Punct_intl;
+
+ locale __loc = __str.getloc();
+ const _Ctype& __c_type = use_facet<_Ctype>(__loc) ;
+ const _Punct& __punct = use_facet<_Punct>(__loc) ;
+ const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
+
+ // some special characters
+ char_type __minus = __c_type.widen('-');
+ char_type __plus = __c_type.widen('+');
+ char_type __space = __c_type.widen(' ');
+ char_type __zero = __c_type.widen('0');
+ char_type __point = __intl ? __punct_intl.decimal_point()
+ : __punct.decimal_point();
+
+ char_type __sep = __intl ? __punct_intl.thousands_sep()
+ : __punct.thousands_sep();
+
+ string __grouping = __intl ? __punct_intl.grouping()
+ : __punct.grouping();
+
+ int __frac_digits = __intl ? __punct_intl.frac_digits()
+ : __punct.frac_digits();
+
+ string_type __curr_sym = __intl ? __punct_intl.curr_symbol()
+ : __punct.curr_symbol();
+
+ // if there are no digits we are going to return __s. If there
+ // are digits, but not enough to fill the frac_digits, we are
+ // going to add zeros. I don't know whether this is right or
+ // not.
+ if (__digits.empty())
+ return __s;
+
+ typename string_type::const_iterator __digits_first = __digits.begin();
+ typename string_type::const_iterator __digits_last = __digits.end();
+
+ bool __is_negative = *__digits_first == __minus;
+ if (__is_negative)
+ ++__digits_first;
+
+#if !defined (__BORLANDC__)
+ string_type __sign = __intl ? __is_negative ? __punct_intl.negative_sign()
+ : __punct_intl.positive_sign()
+ : __is_negative ? __punct.negative_sign()
+ : __punct.positive_sign();
+#else
+ string_type __sign;
+ if (__intl) {
+ if (__is_negative)
+ __sign = __punct_intl.negative_sign();
+ else
+ __sign = __punct_intl.positive_sign();
+ }
+ else {
+ if (__is_negative)
+ __sign = __punct.negative_sign();
+ else
+ __sign = __punct.positive_sign();
+ }
+#endif
+
+ if (__check_digits) {
+ typename string_type::const_iterator __cp = __digits_first;
+ while (__cp != __digits_last && __c_type.is(ctype_base::digit, *__cp))
+ ++__cp;
+ if (__cp == __digits_first)
+ return __s;
+ __digits_last = __cp;
+ }
+
+ // If grouping is required, we make a copy of __digits and
+ // insert the grouping.
+ _STLP_BASIC_IOSTRING(char_type) __new_digits;
+ if (!__grouping.empty()) {
+ __new_digits.assign(__digits_first, __digits_last);
+ __insert_grouping(__new_digits,
+ __new_digits.size() - __frac_digits,
+ __grouping,
+ __sep, __plus, __minus, 0);
+ __digits_first = __new_digits.begin(); // <<--
+ __digits_last = __new_digits.end(); // <<--
+ }
+
+ // Determine the amount of padding required, if any.
+ streamsize __width = __str.width();
+
+#if defined (_STLP_DEBUG) && (defined(__HP_aCC) && (__HP_aCC <= 1))
+ size_t __value_length = operator -(__digits_last, __digits_first);
+#else
+ size_t __value_length = __digits_last - __digits_first;
+#endif
+
+ size_t __length = __value_length + __sign.size();
+
+ if (__frac_digits != 0)
+ ++__length;
+
+ bool __generate_curr = (__str.flags() & ios_base::showbase) !=0;
+ if (__generate_curr)
+ __length += __curr_sym.size();
+ money_base::pattern __format = __intl ? (__is_negative ? __punct_intl.neg_format()
+ : __punct_intl.pos_format())
+ : (__is_negative ? __punct.neg_format()
+ : __punct.pos_format());
+ {
+ //For the moment the following is commented for decoding reason.
+ //No reason to add a space last if the money symbol do not have to be display
+ //if (__format.field[3] == (char) money_base::symbol && !__generate_curr) {
+ // if (__format.field[2] == (char) money_base::space) {
+ // __format.field[2] = (char) money_base::none;
+ // }
+ //}
+ //space can only be second or third and only once (22.2.6.3-1):
+ if ((__format.field[1] == (char) money_base::space) ||
+ (__format.field[2] == (char) money_base::space))
+ ++__length;
+ }
+
+ const bool __need_fill = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __length) < __width)) ||
+ ((sizeof(streamsize) <= sizeof(size_t)) && (__length < __STATIC_CAST(size_t, __width))));
+ streamsize __fill_amt = __need_fill ? __width - __length : 0;
+
+ ios_base::fmtflags __fill_pos = __str.flags() & ios_base::adjustfield;
+
+ if (__fill_amt != 0 &&
+ !(__fill_pos & (ios_base::left | ios_base::internal)))
+ __s = _STLP_PRIV __fill_n(__s, __fill_amt, __fill);
+
+ for (int __i = 0; __i < 4; ++__i) {
+ char __ffield = __format.field[__i];
+ switch (__ffield) {
+ case money_base::space:
+ *__s++ = __space;
+ case money_base::none:
+ if (__fill_amt != 0 && __fill_pos == ios_base::internal)
+ __s = _STLP_PRIV __fill_n(__s, __fill_amt, __fill);
+ break;
+ case money_base::symbol:
+ if (__generate_curr)
+ __s = _STLP_STD::copy(__curr_sym.begin(), __curr_sym.end(), __s);
+ break;
+ case money_base::sign:
+ if (!__sign.empty())
+ *__s++ = __sign[0];
+ break;
+ case money_base::value:
+ if (__frac_digits == 0) {
+ __s = _STLP_STD::copy(__digits_first, __digits_last, __s);
+ } else {
+ if ((int)__value_length <= __frac_digits) {
+ // if we see '9' here, we should out 0.09
+ *__s++ = __zero; // integer part is zero
+ *__s++ = __point; // decimal point
+ __s = _STLP_PRIV __fill_n(__s, __frac_digits - __value_length, __zero); // zeros
+ __s = _STLP_STD::copy(__digits_first, __digits_last, __s); // digits
+ } else {
+ __s = _STLP_STD::copy(__digits_first, __digits_last - __frac_digits, __s);
+ if (__frac_digits != 0) {
+ *__s++ = __point;
+ __s = _STLP_STD::copy(__digits_last - __frac_digits, __digits_last, __s);
+ }
+ }
+ }
+ break;
+ } //Close for switch
+ } // Close for loop
+
+ // Ouput rest of sign if necessary.
+ if (__sign.size() > 1)
+ __s = _STLP_STD::copy(__sign.begin() + 1, __sign.end(), __s);
+ if (__fill_amt != 0 &&
+ !(__fill_pos & (ios_base::right | ios_base::internal)))
+ __s = _STLP_PRIV __fill_n(__s, __fill_amt, __fill);
+
+ return __s;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+money_put<_CharT, _OutputIter>
+ ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
+ char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const {
+ _STLP_BASIC_IOSTRING(char_type) __digits;
+ _STLP_PRIV __get_money_digits(__digits, __str, __units);
+ return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, false, __STATIC_CAST(string_type*, 0));
+}
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+money_put<_CharT, _OutputIter>
+ ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
+ char_type __fill, const string_type& __digits) const {
+ return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, true, __STATIC_CAST(string_type*, 0));
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_MONETARY_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_monetary.h b/stlport/stl/_monetary.h
new file mode 100644
index 0000000..7b93010
--- /dev/null
+++ b/stlport/stl/_monetary.h
@@ -0,0 +1,435 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_MONETARY_H
+#define _STLP_INTERNAL_MONETARY_H
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+# include <stl/_ostreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+# include <stl/_istreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_FACETS_FWD_H
+# include <stl/_facets_fwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class money_base {
+public:
+ enum part {none, space, symbol, sign, value};
+ struct pattern {
+ char field[4];
+ };
+};
+
+// moneypunct facets: forward declaration
+template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool, _International, false) > class moneypunct {};
+
+// money_get facets
+
+template <class _CharT, class _InputIter>
+class money_get : public locale::facet {
+public:
+ typedef _CharT char_type;
+ typedef _InputIter iter_type;
+ typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
+
+ explicit money_get(size_t __refs = 0) : locale::facet(__refs) {}
+ iter_type get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ _STLP_LONGEST_FLOAT_TYPE& __units) const
+ { return do_get(__s, __end, __intl, __str, __err, __units); }
+ iter_type get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ string_type& __digits) const
+ { return do_get(__s, __end, __intl, __str, __err, __digits); }
+
+ static locale::id id;
+
+protected:
+ ~money_get() {}
+ virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ _STLP_LONGEST_FLOAT_TYPE& __units) const;
+ virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
+ ios_base& __str, ios_base::iostate& __err,
+ string_type& __digits) const;
+};
+
+
+// moneypunct facets: definition of specializations
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct<char, true> : public locale::facet, public money_base {
+public:
+ typedef char char_type;
+ typedef string string_type;
+ explicit moneypunct _STLP_PSPEC2(char, true) (size_t __refs = 0);
+
+ char decimal_point() const { return do_decimal_point(); }
+ char thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string_type curr_symbol() const { return do_curr_symbol(); }
+ string_type positive_sign() const { return do_positive_sign(); }
+ string_type negative_sign() const { return do_negative_sign(); }
+ int frac_digits() const { return do_frac_digits(); }
+ pattern pos_format() const { return do_pos_format(); }
+ pattern neg_format() const { return do_neg_format(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+ _STLP_STATIC_CONSTANT(bool, intl = true);
+
+protected:
+ pattern _M_pos_format;
+ pattern _M_neg_format;
+
+ ~moneypunct _STLP_PSPEC2(char, true) ();
+
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string do_curr_symbol() const;
+
+ virtual string do_positive_sign() const;
+ virtual string do_negative_sign() const;
+ virtual int do_frac_digits() const;
+ virtual pattern do_pos_format() const;
+ virtual pattern do_neg_format() const;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct<char, false> : public locale::facet, public money_base {
+public:
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit moneypunct _STLP_PSPEC2(char, false) (size_t __refs = 0);
+
+ char decimal_point() const { return do_decimal_point(); }
+ char thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string_type curr_symbol() const { return do_curr_symbol(); }
+ string_type positive_sign() const { return do_positive_sign(); }
+ string_type negative_sign() const { return do_negative_sign(); }
+ int frac_digits() const { return do_frac_digits(); }
+ pattern pos_format() const { return do_pos_format(); }
+ pattern neg_format() const { return do_neg_format(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+ _STLP_STATIC_CONSTANT(bool, intl = false);
+
+protected:
+ pattern _M_pos_format;
+ pattern _M_neg_format;
+
+ ~moneypunct _STLP_PSPEC2(char, false) ();
+
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string do_curr_symbol() const;
+
+ virtual string do_positive_sign() const;
+ virtual string do_negative_sign() const;
+ virtual int do_frac_digits() const;
+ virtual pattern do_pos_format() const;
+ virtual pattern do_neg_format() const;
+};
+
+
+#ifndef _STLP_NO_WCHAR_T
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, true> : public locale::facet, public money_base {
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+ explicit moneypunct _STLP_PSPEC2(wchar_t, true) (size_t __refs = 0);
+ wchar_t decimal_point() const { return do_decimal_point(); }
+ wchar_t thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string_type curr_symbol() const { return do_curr_symbol(); }
+ string_type positive_sign() const { return do_positive_sign(); }
+ string_type negative_sign() const { return do_negative_sign(); }
+ int frac_digits() const { return do_frac_digits(); }
+ pattern pos_format() const { return do_pos_format(); }
+ pattern neg_format() const { return do_neg_format(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+ _STLP_STATIC_CONSTANT(bool, intl = true);
+
+protected:
+ pattern _M_pos_format;
+ pattern _M_neg_format;
+
+ ~moneypunct _STLP_PSPEC2(wchar_t, true) ();
+
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+ virtual pattern do_pos_format() const;
+ virtual pattern do_neg_format() const;
+};
+
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, false> : public locale::facet, public money_base {
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+ explicit moneypunct _STLP_PSPEC2(wchar_t, false) (size_t __refs = 0);
+ wchar_t decimal_point() const { return do_decimal_point(); }
+ wchar_t thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string_type curr_symbol() const { return do_curr_symbol(); }
+ string_type positive_sign() const { return do_positive_sign(); }
+ string_type negative_sign() const { return do_negative_sign(); }
+ int frac_digits() const { return do_frac_digits(); }
+ pattern pos_format() const { return do_pos_format(); }
+ pattern neg_format() const { return do_neg_format(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+ _STLP_STATIC_CONSTANT(bool, intl = false);
+
+protected:
+ pattern _M_pos_format;
+ pattern _M_neg_format;
+
+ ~moneypunct _STLP_PSPEC2(wchar_t, false) ();
+
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+ virtual pattern do_pos_format() const;
+ virtual pattern do_neg_format() const;
+};
+
+# endif
+
+template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool , _International , false) > class moneypunct_byname {};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct_byname<char, true> : public moneypunct<char, true> {
+ friend class _Locale_impl;
+public:
+ typedef money_base::pattern pattern;
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit moneypunct_byname _STLP_PSPEC2(char, true) (const char * __name, size_t __refs = 0);
+
+protected:
+ ~moneypunct_byname _STLP_PSPEC2(char, true) ();
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+
+private:
+ moneypunct_byname _STLP_PSPEC2(char, true) (_Locale_monetary *__monetary);
+
+ typedef moneypunct_byname<char, true> _Self;
+ //explicitely defined as private to avoid warnings:
+ moneypunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_monetary* _M_monetary;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct_byname<char, false> : public moneypunct<char, false> {
+ friend class _Locale_impl;
+public:
+ typedef money_base::pattern pattern;
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit moneypunct_byname _STLP_PSPEC2(char, false) (const char * __name, size_t __refs = 0);
+
+protected:
+ ~moneypunct_byname _STLP_PSPEC2(char, false) ();
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+
+private:
+ moneypunct_byname _STLP_PSPEC2(char, false) (_Locale_monetary *__monetary);
+
+ typedef moneypunct_byname<char, false> _Self;
+ //explicitely defined as private to avoid warnings:
+ moneypunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_monetary* _M_monetary;
+};
+
+#if !defined (_STLP_NO_WCHAR_T)
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, true> : public moneypunct<wchar_t, true> {
+ friend class _Locale_impl;
+public:
+ typedef money_base::pattern pattern;
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit moneypunct_byname _STLP_PSPEC2(wchar_t, true) (const char * __name, size_t __refs = 0);
+
+protected:
+ ~moneypunct_byname _STLP_PSPEC2(wchar_t, true) ();
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+
+private:
+ moneypunct_byname _STLP_PSPEC2(wchar_t, true) (_Locale_monetary *__monetary);
+
+ typedef moneypunct_byname<wchar_t, true> _Self;
+ //explicitely defined as private to avoid warnings:
+ moneypunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_monetary* _M_monetary;
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, false> : public moneypunct<wchar_t, false> {
+ friend class _Locale_impl;
+public:
+ typedef money_base::pattern pattern;
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit moneypunct_byname _STLP_PSPEC2(wchar_t, false) (const char * __name, size_t __refs = 0);
+
+protected:
+ ~moneypunct_byname _STLP_PSPEC2(wchar_t, false) ();
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+
+ virtual string_type do_curr_symbol() const;
+
+ virtual string_type do_positive_sign() const;
+ virtual string_type do_negative_sign() const;
+ virtual int do_frac_digits() const;
+
+private:
+ moneypunct_byname _STLP_PSPEC2(wchar_t, false) (_Locale_monetary *__monetary);
+
+ typedef moneypunct_byname<wchar_t, false> _Self;
+ //explicitely defined as private to avoid warnings:
+ moneypunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_monetary* _M_monetary;
+};
+#endif
+
+//===== methods ======
+
+
+// money_put facets
+
+template <class _CharT, class _OutputIter>
+class money_put : public locale::facet {
+public:
+ typedef _CharT char_type;
+ typedef _OutputIter iter_type;
+ typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
+
+ explicit money_put(size_t __refs = 0) : locale::facet(__refs) {}
+ iter_type put(iter_type __s, bool __intl, ios_base& __str,
+ char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const
+ { return do_put(__s, __intl, __str, __fill, __units); }
+ iter_type put(iter_type __s, bool __intl, ios_base& __str,
+ char_type __fill,
+ const string_type& __digits) const
+ { return do_put(__s, __intl, __str, __fill, __digits); }
+
+ static locale::id id;
+
+protected:
+ ~money_put() {}
+ virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
+ char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const;
+ virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
+ char_type __fill,
+ const string_type& __digits) const;
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS money_get<char, istreambuf_iterator<char, char_traits<char> > >;
+_STLP_EXPORT_TEMPLATE_CLASS money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+# if ! defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+_STLP_EXPORT_TEMPLATE_CLASS money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+# endif
+#endif
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_monetary.c>
+#endif
+
+#endif /* _STLP_INTERNAL_MONETARY_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
+
diff --git a/stlport/stl/_move_construct_fwk.h b/stlport/stl/_move_construct_fwk.h
new file mode 100644
index 0000000..4a85fe3
--- /dev/null
+++ b/stlport/stl/_move_construct_fwk.h
@@ -0,0 +1,159 @@
+/*
+ *
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_MOVE_CONSTRUCT_FWK_H
+#define _STLP_MOVE_CONSTRUCT_FWK_H
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+/*************************************************************
+ * Move constructor framework
+ *************************************************************/
+
+/*************************************************************
+ *Partial move:
+ *The source HAS to be a valid instance after the move!
+ *************************************************************/
+template <class _Tp>
+class __move_source {
+public:
+ explicit __move_source (_Tp &_src) : _M_data(_src)
+ {}
+
+ _Tp& get() const
+ { return _M_data; }
+private:
+ _Tp &_M_data;
+
+ //We explicitely forbid assignment to avoid warning:
+ typedef __move_source<_Tp> _Self;
+ _Self& operator = (_Self const&);
+};
+
+//Class used to signal move constructor support, implementation and type.
+template <class _Tp>
+struct __move_traits {
+ /*
+ * implemented tells if a the special move constructor has to be called or the classic
+ * copy constructor is just fine. Most of the time the copy constructor is fine only
+ * if the following info is true.
+ */
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && \
+ !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && \
+ !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename _IsSTLportClass<_Tp>::_Ret implemented;
+#else
+ typedef __false_type implemented;
+#endif
+ /*
+ * complete tells if the move is complete or partial, that is to say, does the source
+ * needs to be destroyed once it has been moved.
+ */
+# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x564)
+ typedef __type_traits<_Tp>::has_trivial_destructor _TpMoveComplete;
+ typedef typename __bool2type<__type2bool<_TpMoveComplete>::_Ret>::_Ret complete;
+# else
+ typedef typename __type_traits<_Tp>::has_trivial_destructor complete;
+# endif
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*
+ * This struct should never be used if the user has not explicitely stipulated
+ * that its class support the full move concept. To check that the return type
+ * in such a case will be __invalid_source<_Tp> to generate a compile error
+ * revealing the configuration problem.
+ */
+template <class _Tp>
+struct _MoveSourceTraits {
+ typedef typename __move_traits<_Tp>::implemented _MvImpRet;
+#if defined (__BORLANDC__)
+ typedef typename __selectT<_MvImpRet,
+#else
+ enum {_MvImp = __type2bool<_MvImpRet>::_Ret};
+ typedef typename __select<_MvImp,
+#endif
+ __move_source<_Tp>,
+ _Tp const&>::_Ret _Type;
+};
+
+//The helper function
+template <class _Tp>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _MoveSourceTraits<_Tp>::_Type
+_AsMoveSource (_Tp &src) {
+ typedef typename _MoveSourceTraits<_Tp>::_Type _SrcType;
+ return _SrcType(src);
+}
+
+//Helper structs used for many class.
+template <class _Tp>
+struct __move_traits_aux {
+ typedef typename __move_traits<_Tp>::implemented implemented;
+ typedef typename __move_traits<_Tp>::complete complete;
+};
+
+template <class _Tp1, class _Tp2>
+struct __move_traits_aux2 {
+ typedef __move_traits<_Tp1> _MoveTraits1;
+ typedef __move_traits<_Tp2> _MoveTraits2;
+
+ typedef typename _Lor2<typename _MoveTraits1::implemented,
+ typename _MoveTraits2::implemented>::_Ret implemented;
+ typedef typename _Land2<typename _MoveTraits1::complete,
+ typename _MoveTraits2::complete>::_Ret complete;
+};
+
+/*
+ * Most of the time a class implement a move constructor but its use depends
+ * on a third party, this is what the following struct are for.
+ */
+template <class _Tp>
+struct __move_traits_help {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Tp>::complete complete;
+};
+
+template <class _Tp1, class _Tp2>
+struct __move_traits_help1 {
+ typedef __move_traits<_Tp1> _MoveTraits1;
+ typedef __move_traits<_Tp2> _MoveTraits2;
+
+ typedef typename _Lor2<typename _MoveTraits1::implemented,
+ typename _MoveTraits2::implemented>::_Ret implemented;
+ typedef typename _Land2<typename _MoveTraits1::complete,
+ typename _MoveTraits2::complete>::_Ret complete;
+};
+
+template <class _Tp1, class _Tp2>
+struct __move_traits_help2 {
+ typedef __move_traits<_Tp1> _MoveTraits1;
+ typedef __move_traits<_Tp2> _MoveTraits2;
+
+ typedef __true_type implemented;
+ typedef typename _Land2<typename _MoveTraits1::complete,
+ typename _MoveTraits2::complete>::_Ret complete;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_MOVE_CONSTRUCT_FWK_H */
diff --git a/stlport/stl/_new.h b/stlport/stl/_new.h
new file mode 100644
index 0000000..94094cf
--- /dev/null
+++ b/stlport/stl/_new.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_NEW
+#define _STLP_INTERNAL_NEW
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+// size_t
+# include <stl/_cstddef.h>
+#endif
+
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x570)
+// new.h uses ::malloc ;(
+# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
+using _STLP_VENDOR_CSTD::malloc;
+#endif
+
+#if !defined (_STLP_NO_NEW_NEW_HEADER)
+// eMbedded Visual C++ .NET unfortunately uses _INC_NEW for both <new.h> and <new>
+// we undefine the symbol to get the stuff in the SDK's <new>
+# if defined (_STLP_WCE_NET) && defined (_INC_NEW)
+# undef _INC_NEW
+# endif
+
+# if defined (new)
+/* STLport cannot replace native Std library new header if new is a macro,
+ * please define new macro after <new> header inclusion.
+ */
+# error Cannot include native new header as new is a macro.
+# endif
+
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <new>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new)
+# endif
+#else
+# include <new.h>
+#endif
+
+#if defined (_STLP_NO_BAD_ALLOC) && !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+#endif
+
+#if defined (_STLP_USE_EXCEPTIONS) && defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+
+# ifndef _STLP_INTERNAL_EXCEPTION
+# include <stl/_exception.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+# if defined (_STLP_NO_BAD_ALLOC)
+struct nothrow_t {};
+# define nothrow nothrow_t()
+# endif
+
+/*
+ * STLport own bad_alloc exception to be used if the native C++ library
+ * do not define it or when the new operator do not throw it to avoid
+ * a useless library dependency.
+ */
+class bad_alloc : public exception {
+public:
+ bad_alloc () _STLP_NOTHROW_INHERENTLY { }
+ bad_alloc(const bad_alloc&) _STLP_NOTHROW_INHERENTLY { }
+ bad_alloc& operator=(const bad_alloc&) _STLP_NOTHROW_INHERENTLY {return *this;}
+ ~bad_alloc () _STLP_NOTHROW_INHERENTLY { }
+ const char* what() const _STLP_NOTHROW_INHERENTLY { return "bad alloc"; }
+};
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_USE_EXCEPTIONS && (_STLP_NO_BAD_ALLOC || _STLP_NEW_DONT_THROW_BAD_ALLOC) */
+
+#if defined (_STLP_USE_OWN_NAMESPACE)
+
+_STLP_BEGIN_NAMESPACE
+
+# if !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+using _STLP_VENDOR_EXCEPT_STD::bad_alloc;
+# endif
+
+# if !defined (_STLP_NO_BAD_ALLOC)
+using _STLP_VENDOR_EXCEPT_STD::nothrow_t;
+using _STLP_VENDOR_EXCEPT_STD::nothrow;
+# if defined (_STLP_GLOBAL_NEW_HANDLER)
+using ::new_handler;
+using ::set_new_handler;
+# else
+using _STLP_VENDOR_EXCEPT_STD::new_handler;
+using _STLP_VENDOR_EXCEPT_STD::set_new_handler;
+# endif
+# endif /* !_STLP_NO_BAD_ALLOC */
+
+_STLP_END_NAMESPACE
+#endif /* _STLP_USE_OWN_NAMESPACE */
+
+#ifndef _STLP_THROW_BAD_ALLOC
+# if !defined (_STLP_USE_EXCEPTIONS)
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+# define _STLP_THROW_BAD_ALLOC puts("out of memory\n"); exit(1)
+# else
+# define _STLP_THROW_BAD_ALLOC _STLP_THROW(_STLP_STD::bad_alloc())
+# endif
+#endif
+
+#if defined (_STLP_NO_NEW_NEW_HEADER) || defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+# define _STLP_CHECK_NULL_ALLOC(__x) void* __y = __x; if (__y == 0) { _STLP_THROW_BAD_ALLOC; } return __y
+#else
+# define _STLP_CHECK_NULL_ALLOC(__x) return __x
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if ((defined (__IBMCPP__) || defined (__OS400__) || defined (__xlC__) || defined (qTidyHeap)) && defined (_STLP_DEBUG_ALLOC))
+inline void* _STLP_CALL __stl_new(size_t __n) { _STLP_CHECK_NULL_ALLOC(::operator new(__n, __FILE__, __LINE__)); }
+inline void _STLP_CALL __stl_delete(void* __p) { ::operator delete(__p, __FILE__, __LINE__); }
+#else
+inline void* _STLP_CALL __stl_new(size_t __n) { _STLP_CHECK_NULL_ALLOC(::operator new(__n)); }
+inline void _STLP_CALL __stl_delete(void* __p) { ::operator delete(__p); }
+#endif
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_NEW */
+
+/*
+ * Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/stlport/stl/_num_get.c b/stlport/stl/_num_get.c
new file mode 100644
index 0000000..1e7d234
--- /dev/null
+++ b/stlport/stl/_num_get.c
@@ -0,0 +1,623 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_NUM_GET_C
+#define _STLP_NUM_GET_C
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned);
+_STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms();
+
+// __do_get_integer, __do_get_float and its helper functions.
+
+inline bool _STLP_CALL __get_fdigit(char __c, const char*)
+{ return __c >= '0' && __c <= '9'; }
+
+inline bool _STLP_CALL __get_fdigit_or_sep(char& __c, char __sep, const char *__digits) {
+ if (__c == __sep) {
+ __c = ',' ;
+ return true ;
+ }
+ else
+ return __get_fdigit(__c, __digits);
+}
+
+inline int _STLP_CALL
+__get_digit_from_table(unsigned __index)
+{ return (__index > 127 ? 0xFF : __digit_val_table(__index)); }
+
+template <class _InputIter, class _CharT>
+int
+__get_base_or_zero(_InputIter& __in_ite, _InputIter& __end,
+ ios_base::fmtflags __flags, const ctype<_CharT>& __c_type) {
+ _CharT __atoms[5];
+ __c_type.widen(__narrow_atoms(), __narrow_atoms() + 5, __atoms);
+
+ bool __negative = false;
+ _CharT __c = *__in_ite;
+
+ if (__c == __atoms[1] /* __xminus_char */ ) {
+ __negative = true;
+ ++__in_ite;
+ }
+ else if (__c == __atoms[0] /* __xplus_char */ )
+ ++__in_ite;
+
+ int __base;
+ int __valid_zero = 0;
+
+ ios_base::fmtflags __basefield = __flags & ios_base::basefield;
+
+ switch (__basefield) {
+ case ios_base::oct:
+ __base = 8;
+ break;
+ case ios_base::dec:
+ __base = 10;
+ break;
+ case ios_base::hex:
+ __base = 16;
+ if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
+ ++__in_ite;
+ if (__in_ite != __end &&
+ (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ ))
+ ++__in_ite;
+ else
+ __valid_zero = 1; // That zero is valid by itself.
+ }
+ break;
+ default:
+ if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) {
+ ++__in_ite;
+ if (__in_ite != __end &&
+ (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) {
+ ++__in_ite;
+ __base = 16;
+ }
+ else
+ {
+ __base = 8;
+ __valid_zero = 1; // That zero is still valid by itself.
+ }
+ }
+ else
+ __base = 10;
+ break;
+ }
+ return (__base << 2) | ((int)__negative << 1) | __valid_zero;
+}
+
+
+template <class _InputIter, class _Integer, class _CharT>
+bool _STLP_CALL
+__get_integer(_InputIter& __first, _InputIter& __last,
+ int __base, _Integer& __val,
+ int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __true_type& /*_IsSigned*/) {
+ bool __ovflow = false;
+ _Integer __result = 0;
+ bool __is_group = !__grouping.empty();
+ char __group_sizes[64];
+ char __current_group_size = 0;
+ char* __group_sizes_end = __group_sizes;
+
+ _Integer __over_base = (numeric_limits<_Integer>::min)() / __STATIC_CAST(_Integer, __base);
+
+ for ( ; __first != __last ; ++__first) {
+
+ const _CharT __c = *__first;
+
+ if (__is_group && __c == __separator) {
+ *__group_sizes_end++ = __current_group_size;
+ __current_group_size = 0;
+ continue;
+ }
+
+ int __n = __get_digit_from_table(__c);
+
+ if (__n >= __base)
+ break;
+
+ ++__got;
+ ++__current_group_size;
+
+ if (__result < __over_base)
+ __ovflow = true; // don't need to keep accumulating
+ else {
+ _Integer __next = __STATIC_CAST(_Integer, __base * __result - __n);
+ if (__result != 0)
+ __ovflow = __ovflow || __next >= __result;
+ __result = __next;
+ }
+ }
+
+ if (__is_group && __group_sizes_end != __group_sizes) {
+ *__group_sizes_end++ = __current_group_size;
+ }
+
+ // fbp : added to not modify value if nothing was read
+ if (__got > 0) {
+ __val = __ovflow ? __is_negative ? (numeric_limits<_Integer>::min)()
+ : (numeric_limits<_Integer>::max)()
+ : __is_negative ? __result
+ : __STATIC_CAST(_Integer, -__result);
+ }
+ // overflow is being treated as failure
+ return ((__got > 0) && !__ovflow) &&
+ (__is_group == 0 ||
+ __valid_grouping(__group_sizes, __group_sizes_end,
+ __grouping.data(), __grouping.data()+ __grouping.size()));
+}
+
+template <class _InputIter, class _Integer, class _CharT>
+bool _STLP_CALL
+__get_integer(_InputIter& __first, _InputIter& __last,
+ int __base, _Integer& __val,
+ int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __false_type& /*_IsSigned*/) {
+ bool __ovflow = false;
+ _Integer __result = 0;
+ bool __is_group = !__grouping.empty();
+ char __group_sizes[64];
+ char __current_group_size = 0;
+ char* __group_sizes_end = __group_sizes;
+
+ _Integer __over_base = (numeric_limits<_Integer>::max)() / __STATIC_CAST(_Integer, __base);
+
+ for ( ; __first != __last ; ++__first) {
+
+ const _CharT __c = *__first;
+
+ if (__is_group && __c == __separator) {
+ *__group_sizes_end++ = __current_group_size;
+ __current_group_size = 0;
+ continue;
+ }
+
+ int __n = __get_digit_from_table(__c);
+
+ if (__n >= __base)
+ break;
+
+ ++__got;
+ ++__current_group_size;
+
+ if (__result > __over_base)
+ __ovflow = true; //don't need to keep accumulating
+ else {
+ _Integer __next = __STATIC_CAST(_Integer, __base * __result + __n);
+ if (__result != 0)
+ __ovflow = __ovflow || __next <= __result;
+ __result = __next;
+ }
+ }
+
+ if (__is_group && __group_sizes_end != __group_sizes) {
+ *__group_sizes_end++ = __current_group_size;
+ }
+
+ // fbp : added to not modify value if nothing was read
+ if (__got > 0) {
+ __val = __ovflow ? (numeric_limits<_Integer>::max)()
+ : (__is_negative ? __STATIC_CAST(_Integer, -__result)
+ : __result);
+ }
+
+ // overflow is being treated as failure
+ return ((__got > 0) && !__ovflow) &&
+ (__is_group == 0 ||
+ __valid_grouping(__group_sizes, __group_sizes_end,
+ __grouping.data(), __grouping.data()+ __grouping.size()));
+}
+
+
+template <class _InputIter, class _Integer, class _CharT>
+bool _STLP_CALL
+__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT* /*dummy*/) {
+ string __grp;
+ //Here there is no grouping so separator is not important, we just pass the default character.
+ return __get_integer(__first, __last, 10, __val, 0, false, _CharT() /*separator*/, __grp, __false_type());
+}
+
+template <class _InputIter, class _Integer, class _CharT>
+_InputIter _STLP_CALL
+__do_get_integer(_InputIter& __in_ite, _InputIter& __end, ios_base& __str,
+ ios_base::iostate& __err, _Integer& __val, _CharT* /*__pc*/) {
+ locale __loc = __str.getloc();
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+
+#if defined (__HP_aCC) && (__HP_aCC == 1)
+ bool _IsSigned = !((_Integer)(-1) > 0);
+#else
+ typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
+#endif
+
+ const int __base_or_zero = __get_base_or_zero(__in_ite, __end, __str.flags(), __ctype);
+ int __got = __base_or_zero & 1;
+
+ bool __result;
+
+ if (__in_ite == __end) { // We may have already read a 0. If so,
+
+ if (__got > 0) { // the result is 0 even if we're at eof.
+ __val = 0;
+ __result = true;
+ }
+ else
+ __result = false;
+ }
+ else {
+ const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
+ const bool __negative = (__base_or_zero & 2) != 0;
+ const int __base = __base_or_zero >> 2;
+
+#if defined (__HP_aCC) && (__HP_aCC == 1)
+ if (_IsSigned)
+ __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __np.thousands_sep(), __np.grouping(), __true_type() );
+ else
+ __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __np.thousands_sep(), __np.grouping(), __false_type() );
+#else
+ __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __np.thousands_sep(), __np.grouping(), _IsSigned());
+# endif
+ }
+
+ __err = __STATIC_CAST(ios_base::iostate, __result ? ios_base::goodbit : ios_base::failbit);
+
+ if (__in_ite == __end)
+ __err |= ios_base::eofbit;
+ return __in_ite;
+}
+
+// __read_float and its helper functions.
+template <class _InputIter, class _CharT>
+_InputIter _STLP_CALL
+__copy_sign(_InputIter __first, _InputIter __last, __iostring& __v,
+ _CharT __xplus, _CharT __xminus) {
+ if (__first != __last) {
+ _CharT __c = *__first;
+ if (__c == __xplus)
+ ++__first;
+ else if (__c == __xminus) {
+ __v.push_back('-');
+ ++__first;
+ }
+ }
+ return __first;
+}
+
+
+template <class _InputIter, class _CharT>
+bool _STLP_CALL
+__copy_digits(_InputIter& __first, _InputIter __last,
+ __iostring& __v, const _CharT* __digits) {
+ bool __ok = false;
+
+ for ( ; __first != __last; ++__first) {
+ _CharT __c = *__first;
+ if (__get_fdigit(__c, __digits)) {
+ __v.push_back((char)__c);
+ __ok = true;
+ }
+ else
+ break;
+ }
+ return __ok;
+}
+
+template <class _InputIter, class _CharT>
+bool _STLP_CALL
+__copy_grouped_digits(_InputIter& __first, _InputIter __last,
+ __iostring& __v, const _CharT * __digits,
+ _CharT __sep, const string& __grouping,
+ bool& __grouping_ok) {
+ bool __ok = false;
+ char __group_sizes[64];
+ char*__group_sizes_end = __group_sizes;
+ char __current_group_size = 0;
+
+ for ( ; __first != __last; ++__first) {
+ _CharT __c = *__first;
+ bool __tmp = __get_fdigit_or_sep(__c, __sep, __digits);
+ if (__tmp) {
+ if (__c == ',') {
+ *__group_sizes_end++ = __current_group_size;
+ __current_group_size = 0;
+ }
+ else {
+ __ok = true;
+ __v.push_back((char)__c);
+ ++__current_group_size;
+ }
+ }
+ else
+ break;
+ }
+
+ if (__group_sizes_end != __group_sizes)
+ *__group_sizes_end++ = __current_group_size;
+ __grouping_ok = __valid_grouping(__group_sizes, __group_sizes_end, __grouping.data(), __grouping.data() + __grouping.size());
+ return __ok;
+}
+
+
+template <class _InputIter, class _CharT>
+bool _STLP_CALL
+__read_float(__iostring& __buf, _InputIter& __in_ite, _InputIter& __end,
+ const ctype<_CharT> &__ct, const numpunct<_CharT> &__numpunct) {
+ // Create a string, copying characters of the form
+ // [+-]? [0-9]* .? [0-9]* ([eE] [+-]? [0-9]+)?
+
+ string __grouping = __numpunct.grouping();
+ bool __digits_before_dot /* = false */;
+ bool __digits_after_dot = false;
+ bool __ok;
+
+ bool __grouping_ok = true;
+
+ _CharT __dot = __numpunct.decimal_point();
+ _CharT __sep = __numpunct.thousands_sep();
+
+ _CharT __digits[10];
+ _CharT __xplus;
+ _CharT __xminus;
+
+ _CharT __pow_e;
+ _CharT __pow_E;
+
+ _Initialize_get_float(__ct, __xplus, __xminus, __pow_e, __pow_E, __digits);
+
+ // Get an optional sign
+ __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
+
+ // Get an optional string of digits.
+ if (!__grouping.empty())
+ __digits_before_dot = __copy_grouped_digits(__in_ite, __end, __buf, __digits,
+ __sep, __grouping, __grouping_ok);
+ else
+ __digits_before_dot = __copy_digits(__in_ite, __end, __buf, __digits);
+
+ // Get an optional decimal point, and an optional string of digits.
+ if (__in_ite != __end && *__in_ite == __dot) {
+ __buf.push_back('.');
+ ++__in_ite;
+ __digits_after_dot = __copy_digits(__in_ite, __end, __buf, __digits);
+ }
+
+ // There have to be some digits, somewhere.
+ __ok = __digits_before_dot || __digits_after_dot;
+
+ // Get an optional exponent.
+ if (__ok && __in_ite != __end && (*__in_ite == __pow_e || *__in_ite == __pow_E)) {
+ __buf.push_back('e');
+ ++__in_ite;
+ __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus);
+ __ok = __copy_digits(__in_ite, __end, __buf, __digits);
+ // If we have an exponent then the sign
+ // is optional but the digits aren't.
+ }
+
+ return __ok;
+}
+
+template <class _InputIter, class _Float, class _CharT>
+_InputIter _STLP_CALL
+__do_get_float(_InputIter& __in_ite, _InputIter& __end, ios_base& __str,
+ ios_base::iostate& __err, _Float& __val, _CharT* /*__pc*/) {
+ locale __loc = __str.getloc();
+ const ctype<_CharT> &__ctype = use_facet<ctype<_CharT> >(__loc);
+ const numpunct<_CharT> &__numpunct = use_facet<numpunct<_CharT> >(__loc);
+
+ __iostring __buf ;
+ bool __ok = __read_float(__buf, __in_ite, __end, __ctype, __numpunct);
+ if (__ok) {
+ __string_to_float(__buf, __val);
+ __err = ios_base::goodbit;
+ }
+ else {
+ __err = ios_base::failbit;
+ }
+ if (__in_ite == __end)
+ __err |= ios_base::eofbit;
+ return __in_ite;
+}
+
+template <class _InputIter, class _CharT>
+_InputIter _STLP_CALL
+__do_get_alphabool(_InputIter& __in_ite, _InputIter& __end, ios_base& __str,
+ ios_base::iostate& __err, bool& __x, _CharT* /*__pc*/) {
+ const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__str.getloc());
+ const basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __truename = __np.truename();
+ const basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __falsename = __np.falsename();
+ bool __true_ok = true;
+ bool __false_ok = true;
+
+ size_t __n = 0;
+ for ( ; __in_ite != __end; ++__in_ite) {
+ _CharT __c = *__in_ite;
+ __true_ok = __true_ok && (__c == __truename[__n]);
+ __false_ok = __false_ok && (__c == __falsename[__n]);
+ ++__n;
+
+ if ((!__true_ok && !__false_ok) ||
+ (__true_ok && __n >= __truename.size()) ||
+ (__false_ok && __n >= __falsename.size())) {
+ ++__in_ite;
+ break;
+ }
+ }
+ if (__true_ok && __n < __truename.size()) __true_ok = false;
+ if (__false_ok && __n < __falsename.size()) __false_ok = false;
+
+ if (__true_ok || __false_ok) {
+ __err = ios_base::goodbit;
+ __x = __true_ok;
+ }
+ else
+ __err = ios_base::failbit;
+
+ if (__in_ite == __end)
+ __err |= ios_base::eofbit;
+
+ return __in_ite;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//
+// num_get<>, num_put<>
+//
+
+template <class _CharT, class _InputIterator>
+locale::id num_get<_CharT, _InputIterator>::id;
+
+#if !defined (_STLP_NO_BOOL)
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end,
+ ios_base& __s, ios_base::iostate& __err, bool& __x) const {
+ if (__s.flags() & ios_base::boolalpha) {
+ return _STLP_PRIV __do_get_alphabool(__in_ite, __end, __s, __err, __x, (_CharT*)0);
+ }
+ else {
+ long __lx;
+ _InputIter __tmp = _STLP_PRIV __do_get_integer(__in_ite, __end, __s, __err, __lx, (_CharT*)0 );
+ if (!(__err & ios_base::failbit)) {
+ if (__lx == 0)
+ __x = false;
+ else if (__lx == 1)
+ __x = true;
+ else
+ __err |= ios_base::failbit;
+ }
+ return __tmp;
+ }
+}
+#endif
+
+#if defined (_STLP_FIX_LIBRARY_ISSUES)
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, short& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, int& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+#endif
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ unsigned short& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ unsigned int& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ unsigned long& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ float& __val) const
+{ return _STLP_PRIV __do_get_float(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ double& __val) const
+{ return _STLP_PRIV __do_get_float(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ long double& __val) const
+{ return _STLP_PRIV __do_get_float(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+#endif
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ void*& __p) const {
+#if defined (_STLP_LONG_LONG) && !defined (__MRC__) //*ty 12/07/2001 - MrCpp can not cast from long long to void*
+ unsigned _STLP_LONG_LONG __val;
+#else
+ unsigned long __val;
+#endif
+ iter_type __tmp = _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 );
+ if (!(__err & ios_base::failbit))
+ __p = __REINTERPRET_CAST(void*, __val);
+ return __tmp;
+}
+
+#if defined (_STLP_LONG_LONG)
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ _STLP_LONG_LONG& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+
+template <class _CharT, class _InputIter>
+_InputIter
+num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err,
+ unsigned _STLP_LONG_LONG& __val) const
+{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); }
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_NUMERIC_FACETS_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_num_get.h b/stlport/stl/_num_get.h
new file mode 100644
index 0000000..95f7935
--- /dev/null
+++ b/stlport/stl/_num_get.h
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+#define _STLP_INTERNAL_NUM_GET_H
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+# include <stl/_istreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+# include <stl/_numpunct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+
+#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
+# include <stl/_iostream_string.h>
+#endif
+
+#ifndef _STLP_FACETS_FWD_H
+# include <stl/_facets_fwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// num_get facets
+
+template <class _CharT, class _InputIter>
+class num_get: public locale::facet {
+public:
+ typedef _CharT char_type;
+ typedef _InputIter iter_type;
+
+ explicit num_get(size_t __refs = 0): locale::facet(__refs) {}
+
+#if !defined (_STLP_NO_BOOL)
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, bool& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+#endif
+
+#if defined (_STLP_FIX_LIBRARY_ISSUES)
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, short& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, int& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+#endif
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned short& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned int& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned long& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+#if defined (_STLP_LONG_LONG)
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, _STLP_LONG_LONG& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+#endif /* _STLP_LONG_LONG */
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, float& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, double& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long double& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+# endif
+
+ _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, void*& __val) const
+ { return do_get(__ii, __end, __str, __err, __val); }
+
+ static locale::id id;
+
+protected:
+ ~num_get() {}
+
+ typedef string string_type;
+ typedef ctype<_CharT> _Ctype;
+ typedef numpunct<_CharT> _Numpunct;
+
+#if !defined (_STLP_NO_BOOL)
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, bool& __val) const;
+#endif
+
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned short& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned int& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned long& __val) const;
+
+#if defined (_STLP_FIX_LIBRARY_ISSUES)
+ // issue 118 : those are actually not supposed to be here
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, short& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, int& __val) const;
+#endif
+
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, float& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, double& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, void*& __p) const;
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, long double& __val) const;
+#endif
+
+#if defined (_STLP_LONG_LONG)
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, _STLP_LONG_LONG& __val) const;
+ virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str,
+ ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const;
+#endif
+
+};
+
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS num_get<char, istreambuf_iterator<char, char_traits<char> > >;
+// _STLP_EXPORT_TEMPLATE_CLASS num_get<char, const char*>;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+// _STLP_EXPORT_TEMPLATE_CLASS num_get<wchar_t, const wchar_t*>;
+# endif
+#endif
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_DECLSPEC bool _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*);
+
+template <class _InputIter, class _Integer, class _CharT>
+bool _STLP_CALL
+__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT*);
+
+# if !defined (_STLP_NO_WCHAR_T)
+bool _STLP_DECLSPEC _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*);
+bool _STLP_DECLSPEC _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*);
+# endif
+
+inline void _STLP_CALL
+_Initialize_get_float(const ctype<char>&,
+ char& Plus, char& Minus,
+ char& pow_e, char& pow_E,
+ char*) {
+ Plus = '+';
+ Minus = '-';
+ pow_e = 'e';
+ pow_E = 'E';
+}
+
+# if !defined (_STLP_NO_WCHAR_T)
+void _STLP_DECLSPEC _STLP_CALL _Initialize_get_float(const ctype<wchar_t>&,
+ wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*);
+# endif
+void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, float&);
+void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, double&);
+# if !defined (_STLP_NO_LONG_DOUBLE)
+void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, long double&);
+# endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
+
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_num_get.c>
+#endif
+
+#endif /* _STLP_INTERNAL_NUM_GET_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_num_put.c b/stlport/stl/_num_put.c
new file mode 100644
index 0000000..0c07838
--- /dev/null
+++ b/stlport/stl/_num_put.c
@@ -0,0 +1,522 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_NUM_PUT_C
+#define _STLP_NUM_PUT_C
+
+#ifndef _STLP_INTERNAL_NUM_PUT_H
+# include <stl/_num_put.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// __do_put_float and its helper functions. Strategy: write the output
+// to a buffer of char, transform the buffer to _CharT, and then copy
+// it to the output.
+
+//----------------------------------------------------------------------
+// num_put facet
+
+template <class _CharT, class _OutputIter>
+_OutputIter _STLP_CALL
+__copy_float_and_fill(const _CharT* __first, const _CharT* __last,
+ _OutputIter __oi,
+ ios_base::fmtflags __flags,
+ streamsize __width, _CharT __fill,
+ _CharT __xplus, _CharT __xminus) {
+ if (__width <= __last - __first)
+ return _STLP_STD::copy(__first, __last, __oi);
+ else {
+ streamsize __pad = __width - (__last - __first);
+ ios_base::fmtflags __dir = __flags & ios_base::adjustfield;
+
+ if (__dir == ios_base::left) {
+ __oi = _STLP_STD::copy(__first, __last, __oi);
+ return _STLP_PRIV __fill_n(__oi, __pad, __fill);
+ }
+ else if (__dir == ios_base::internal && __first != __last &&
+ (*__first == __xplus || *__first == __xminus)) {
+ *__oi++ = *__first++;
+ __oi = _STLP_PRIV __fill_n(__oi, __pad, __fill);
+ return _STLP_STD::copy(__first, __last, __oi);
+ }
+ else {
+ __oi = _STLP_PRIV __fill_n(__oi, __pad, __fill);
+ return _STLP_STD::copy(__first, __last, __oi);
+ }
+ }
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+// Helper routine for wchar_t
+template <class _OutputIter>
+_OutputIter _STLP_CALL
+__put_float(__iostring &__str, _OutputIter __oi,
+ ios_base& __f, wchar_t __fill,
+ wchar_t __decimal_point, wchar_t __sep,
+ size_t __group_pos, const string& __grouping) {
+ const ctype<wchar_t>& __ct = use_facet<ctype<wchar_t> >(__f.getloc());
+
+ __iowstring __wbuf;
+ __convert_float_buffer(__str, __wbuf, __ct, __decimal_point);
+
+ if (!__grouping.empty()) {
+ __insert_grouping(__wbuf, __group_pos, __grouping,
+ __sep, __ct.widen('+'), __ct.widen('-'), 0);
+ }
+
+ return __copy_float_and_fill(__wbuf.data(), __wbuf.data() + __wbuf.size(), __oi,
+ __f.flags(), __f.width(0), __fill, __ct.widen('+'), __ct.widen('-'));
+}
+#endif /* WCHAR_T */
+
+// Helper routine for char
+template <class _OutputIter>
+_OutputIter _STLP_CALL
+__put_float(__iostring &__str, _OutputIter __oi,
+ ios_base& __f, char __fill,
+ char __decimal_point, char __sep,
+ size_t __group_pos, const string& __grouping) {
+ if ((__group_pos < __str.size()) && (__str[__group_pos] == '.')) {
+ __str[__group_pos] = __decimal_point;
+ }
+
+ if (!__grouping.empty()) {
+ __insert_grouping(__str, __group_pos,
+ __grouping, __sep, '+', '-', 0);
+ }
+
+ return __copy_float_and_fill(__str.data(), __str.data() + __str.size(), __oi,
+ __f.flags(), __f.width(0), __fill, '+', '-');
+}
+
+template <class _CharT, class _OutputIter, class _Float>
+_OutputIter _STLP_CALL
+__do_put_float(_OutputIter __s, ios_base& __f,
+ _CharT __fill, _Float __x) {
+ __iostring __buf;
+
+ size_t __group_pos = __write_float(__buf, __f.flags(), (int)__f.precision(), __x);
+
+ const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__f.getloc());
+ return __put_float(__buf, __s, __f, __fill,
+ __np.decimal_point(), __np.thousands_sep(),
+ __group_pos, __np.grouping());
+}
+
+inline void __get_money_digits_aux (__iostring &__buf, ios_base &, _STLP_LONGEST_FLOAT_TYPE __x)
+{ __get_floor_digits(__buf, __x); }
+
+#if !defined (_STLP_NO_WCHAR_T)
+inline void __get_money_digits_aux (__iowstring &__wbuf, ios_base &__f, _STLP_LONGEST_FLOAT_TYPE __x) {
+ __iostring __buf;
+ __get_floor_digits(__buf, __x);
+
+ const ctype<wchar_t>& __ct = use_facet<ctype<wchar_t> >(__f.getloc());
+ __convert_float_buffer(__buf, __wbuf, __ct, wchar_t(0), false);
+}
+#endif
+
+template <class _CharT>
+void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT) &__buf, ios_base& __f, _STLP_LONGEST_FLOAT_TYPE __x)
+{ __get_money_digits_aux(__buf, __f, __x); }
+
+// _M_do_put_integer and its helper functions.
+
+template <class _CharT, class _OutputIter>
+_OutputIter _STLP_CALL
+__copy_integer_and_fill(const _CharT* __buf, ptrdiff_t __len,
+ _OutputIter __oi,
+ ios_base::fmtflags __flg, streamsize __wid, _CharT __fill,
+ _CharT __xplus, _CharT __xminus) {
+ if (__len >= __wid)
+ return _STLP_STD::copy(__buf, __buf + __len, __oi);
+ else {
+ //casting numeric_limits<ptrdiff_t>::max to streamsize only works is ptrdiff_t is signed or streamsize representation
+ //is larger than ptrdiff_t one.
+ _STLP_STATIC_ASSERT((sizeof(streamsize) > sizeof(ptrdiff_t)) ||
+ ((sizeof(streamsize) == sizeof(ptrdiff_t)) && numeric_limits<ptrdiff_t>::is_signed))
+ ptrdiff_t __pad = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits<ptrdiff_t>::max)()),
+ __STATIC_CAST(streamsize, __wid - __len)));
+ ios_base::fmtflags __dir = __flg & ios_base::adjustfield;
+
+ if (__dir == ios_base::left) {
+ __oi = _STLP_STD::copy(__buf, __buf + __len, __oi);
+ return _STLP_PRIV __fill_n(__oi, __pad, __fill);
+ }
+ else if (__dir == ios_base::internal && __len != 0 &&
+ (__buf[0] == __xplus || __buf[0] == __xminus)) {
+ *__oi++ = __buf[0];
+ __oi = __fill_n(__oi, __pad, __fill);
+ return _STLP_STD::copy(__buf + 1, __buf + __len, __oi);
+ }
+ else if (__dir == ios_base::internal && __len >= 2 &&
+ (__flg & ios_base::showbase) &&
+ (__flg & ios_base::basefield) == ios_base::hex) {
+ *__oi++ = __buf[0];
+ *__oi++ = __buf[1];
+ __oi = __fill_n(__oi, __pad, __fill);
+ return _STLP_STD::copy(__buf + 2, __buf + __len, __oi);
+ }
+ else {
+ __oi = __fill_n(__oi, __pad, __fill);
+ return _STLP_STD::copy(__buf, __buf + __len, __oi);
+ }
+ }
+}
+
+#if !defined (_STLP_NO_WCHAR_T)
+// Helper function for wchar_t
+template <class _OutputIter>
+_OutputIter _STLP_CALL
+__put_integer(char* __buf, char* __iend, _OutputIter __s,
+ ios_base& __f,
+ ios_base::fmtflags __flags, wchar_t __fill) {
+ locale __loc = __f.getloc();
+ const ctype<wchar_t>& __ct = use_facet<ctype<wchar_t> >(__loc);
+
+ wchar_t __xplus = __ct.widen('+');
+ wchar_t __xminus = __ct.widen('-');
+
+ wchar_t __wbuf[64];
+ __ct.widen(__buf, __iend, __wbuf);
+ ptrdiff_t __len = __iend - __buf;
+ wchar_t* __eend = __wbuf + __len;
+
+ const numpunct<wchar_t>& __np = use_facet<numpunct<wchar_t> >(__loc);
+ const string& __grouping = __np.grouping();
+
+ if (!__grouping.empty()) {
+ int __basechars;
+ if (__flags & ios_base::showbase)
+ switch (__flags & ios_base::basefield) {
+ case ios_base::hex: __basechars = 2; break;
+ case ios_base::oct: __basechars = 1; break;
+ default: __basechars = 0;
+ }
+ else
+ __basechars = 0;
+
+ __len = __insert_grouping(__wbuf, __eend, __grouping, __np.thousands_sep(),
+ __xplus, __xminus, __basechars);
+ }
+
+ return __copy_integer_and_fill((wchar_t*)__wbuf, __len, __s,
+ __flags, __f.width(0), __fill, __xplus, __xminus);
+}
+#endif
+
+// Helper function for char
+template <class _OutputIter>
+_OutputIter _STLP_CALL
+__put_integer(char* __buf, char* __iend, _OutputIter __s,
+ ios_base& __f, ios_base::fmtflags __flags, char __fill) {
+ char __grpbuf[64];
+ ptrdiff_t __len = __iend - __buf;
+
+ const numpunct<char>& __np = use_facet<numpunct<char> >(__f.getloc());
+ const string& __grouping = __np.grouping();
+
+ if (!__grouping.empty()) {
+ int __basechars;
+ if (__flags & ios_base::showbase)
+ switch (__flags & ios_base::basefield) {
+ case ios_base::hex: __basechars = 2; break;
+ case ios_base::oct: __basechars = 1; break;
+ default: __basechars = 0;
+ }
+ else
+ __basechars = 0;
+
+ // make sure there is room at the end of the buffer
+ // we pass to __insert_grouping
+ _STLP_STD::copy(__buf, __iend, (char *) __grpbuf);
+ __buf = __grpbuf;
+ __iend = __grpbuf + __len;
+ __len = __insert_grouping(__buf, __iend, __grouping, __np.thousands_sep(),
+ '+', '-', __basechars);
+ }
+
+ return __copy_integer_and_fill(__buf, __len, __s, __flags, __f.width(0), __fill, '+', '-');
+}
+
+#if defined (_STLP_LONG_LONG)
+typedef _STLP_LONG_LONG __max_int_t;
+typedef unsigned _STLP_LONG_LONG __umax_int_t;
+#else
+typedef long __max_int_t;
+typedef unsigned long __umax_int_t;
+#endif
+
+_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_lo();
+_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_hi();
+
+template <class _Integer>
+inline char* _STLP_CALL
+__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __true_type& /* is_signed */) {
+ const bool __negative = __x < 0 ;
+ __max_int_t __temp = __x;
+ __umax_int_t __utemp = __negative?-__temp:__temp;
+
+ for (; __utemp != 0; __utemp /= 10)
+ *--__ptr = (char)((int)(__utemp % 10) + '0');
+ // put sign if needed or requested
+ if (__negative)
+ *--__ptr = '-';
+ else if (__flags & ios_base::showpos)
+ *--__ptr = '+';
+ return __ptr;
+}
+
+template <class _Integer>
+inline char* _STLP_CALL
+__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __false_type& /* is_signed */) {
+ for (; __x != 0; __x /= 10)
+ *--__ptr = (char)((int)(__x % 10) + '0');
+ // put sign if requested
+ if (__flags & ios_base::showpos)
+ *--__ptr = '+';
+ return __ptr;
+}
+
+template <class _Integer>
+char* _STLP_CALL
+__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x) {
+ char* __ptr = __buf;
+
+ if (__x == 0) {
+ *--__ptr = '0';
+ if ((__flags & ios_base::showpos) && ((__flags & (ios_base::oct | ios_base::hex)) == 0))
+ *--__ptr = '+';
+ // oct or hex base shall not be added to the 0 value (see '#' flag in C formating strings)
+ }
+ else {
+ switch (__flags & ios_base::basefield) {
+ case ios_base::oct:
+ {
+ __umax_int_t __temp = __x;
+ // if the size of integer is less than 8, clear upper part
+ if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 )
+ __temp &= 0xFFFFFFFF;
+
+ for (; __temp != 0; __temp >>=3)
+ *--__ptr = (char)((((unsigned)__temp)& 0x7) + '0');
+
+ // put leading '0' if showbase is set
+ if (__flags & ios_base::showbase)
+ *--__ptr = '0';
+ }
+ break;
+ case ios_base::hex:
+ {
+ const char* __table_ptr = (__flags & ios_base::uppercase) ?
+ __hex_char_table_hi() : __hex_char_table_lo();
+ __umax_int_t __temp = __x;
+ // if the size of integer is less than 8, clear upper part
+ if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 )
+ __temp &= 0xFFFFFFFF;
+
+ for (; __temp != 0; __temp >>=4)
+ *--__ptr = __table_ptr[((unsigned)__temp & 0xF)];
+
+ if (__flags & ios_base::showbase) {
+ *--__ptr = __table_ptr[16];
+ *--__ptr = '0';
+ }
+ }
+ break;
+ //case ios_base::dec:
+ default:
+ {
+#if defined(__HP_aCC) && (__HP_aCC == 1)
+ bool _IsSigned = !((_Integer)-1 > 0);
+ if (_IsSigned)
+ __ptr = __write_decimal_backward(__ptr, __x, __flags, __true_type() );
+ else
+ __ptr = __write_decimal_backward(__ptr, __x, __flags, __false_type() );
+#else
+ typedef typename __bool2type<numeric_limits<_Integer>::is_signed>::_Ret _IsSigned;
+ __ptr = __write_decimal_backward(__ptr, __x, __flags, _IsSigned());
+#endif
+ }
+ break;
+ }
+ }
+
+ // return pointer to beginning of the string
+ return __ptr;
+}
+
+template <class _CharT, class _OutputIter, class _Integer>
+_OutputIter _STLP_CALL
+__do_put_integer(_OutputIter __s, ios_base& __f, _CharT __fill, _Integer __x) {
+ // buffer size = number of bytes * number of digit necessary in the smallest Standard base (base 8, 3 digits/byte)
+ // plus the longest base representation '0x'
+ // Do not use __buf_size to define __buf static buffer, some compilers (HP aCC) do not accept const variable as
+ // the specification of a static buffer size.
+ char __buf[sizeof(_Integer) * 3 + 2];
+ const ptrdiff_t __buf_size = sizeof(__buf) / sizeof(char);
+ ios_base::fmtflags __flags = __f.flags();
+ char* __ibeg = __write_integer_backward((char*)__buf + __buf_size, __flags, __x);
+ return __put_integer(__ibeg, (char*)__buf + __buf_size, __s, __f, __flags, __fill);
+}
+
+template <class _CharT, class _OutputIter>
+_OutputIter _STLP_CALL
+__do_put_bool(_OutputIter __s, ios_base& __f, _CharT __fill, bool __x) {
+ const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__f.getloc());
+
+ basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __str = __x ? __np.truename() : __np.falsename();
+
+ streamsize __wid = __f.width(0);
+ if (__str.size() >= __STATIC_CAST(size_t, __wid))
+ return _STLP_STD::copy(__str.begin(), __str.end(), __s);
+ else {
+ streamsize __pad = __wid - __str.size();
+ ios_base::fmtflags __dir = __f.flags() & ios_base::adjustfield;
+
+ if (__dir == ios_base::left) {
+ __s = _STLP_STD::copy(__str.begin(), __str.end(), __s);
+ return __fill_n(__s, __pad, __fill);
+ }
+ else /* covers right and internal padding */ {
+ __s = __fill_n(__s, __pad, __fill);
+ return _STLP_STD::copy(__str.begin(), __str.end(), __s);
+ }
+ }
+}
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//
+// num_put<>
+//
+
+template <class _CharT, class _OutputIterator>
+locale::id num_put<_CharT, _OutputIterator>::id;
+
+#if !defined (_STLP_NO_BOOL)
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ bool __val) const {
+ if (!(__f.flags() & ios_base::boolalpha))
+ // 22.2.2.2.2.23: shall return do_put for int and not directly __do_put_integer.
+ return do_put(__s, __f, __fill, __STATIC_CAST(long, __val));
+
+ return _STLP_PRIV __do_put_bool(__s, __f, __fill, __val);
+}
+#endif
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ long __val) const
+{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ unsigned long __val) const
+{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ double __val) const
+{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ long double __val) const
+{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); }
+#endif
+
+#if defined (_STLP_LONG_LONG)
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ _STLP_LONG_LONG __val) const
+{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
+
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ unsigned _STLP_LONG_LONG __val) const
+{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); }
+#endif /* _STLP_LONG_LONG */
+
+
+// 22.2.2.2.2 Stage 1: "For conversion from void* the specifier is %p."
+// This is not clear and I'm really don't follow this (below).
+template <class _CharT, class _OutputIter>
+_OutputIter
+num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT /*__fill*/,
+ const void* __val) const {
+ const ctype<_CharT>& __c_type = use_facet<ctype<_CharT> >(__f.getloc());
+ ios_base::fmtflags __save_flags = __f.flags();
+
+ __f.setf(ios_base::hex, ios_base::basefield);
+ __f.setf(ios_base::showbase);
+ __f.setf(ios_base::internal, ios_base::adjustfield);
+ __f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix
+ if ( __val == 0 ) {
+ // base ('0x') not shown for null, but I really want to type it
+ // for pointer. Print it first in this case.
+ const char* __table_ptr = (__save_flags & ios_base::uppercase) ?
+ _STLP_PRIV __hex_char_table_hi() : _STLP_PRIV __hex_char_table_lo();
+ __s++ = __c_type.widen( '0' );
+ __s++ = __c_type.widen( __table_ptr[16] );
+ __f.width((sizeof(void*) * 2)); // digits in pointer type
+ } else {
+ __f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix
+ }
+#if defined (_STLP_MSVC)
+# pragma warning (push)
+# pragma warning (disable : 4311) //pointer truncation from 'const void*' to 'unsigned long'
+#endif
+ _OutputIter result =
+#ifdef _STLP_LONG_LONG
+ ( sizeof(void*) == sizeof(unsigned long) ) ?
+#endif
+ _STLP_PRIV __do_put_integer(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned long,__val))
+#ifdef _STLP_LONG_LONG
+ : /* ( sizeof(void*) == sizeof(unsigned _STLP_LONG_LONG) ) ? */
+ _STLP_PRIV __do_put_integer(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned _STLP_LONG_LONG,__val))
+#endif
+ ;
+#if defined (_STLP_MSVC)
+# pragma warning (pop)
+#endif
+ __f.flags(__save_flags);
+ return result;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_NUM_PUT_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_num_put.h b/stlport/stl/_num_put.h
new file mode 100644
index 0000000..29bfc01
--- /dev/null
+++ b/stlport/stl/_num_put.h
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_NUM_PUT_H
+#define _STLP_INTERNAL_NUM_PUT_H
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+# include <stl/_numpunct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTYPE_H
+# include <stl/_ctype.h>
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+# include <stl/_ostreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
+# include <stl/_iostream_string.h>
+#endif
+
+#ifndef _STLP_FACETS_FWD_H
+# include <stl/_facets_fwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// num_put facet
+
+template <class _CharT, class _OutputIter>
+class num_put: public locale::facet {
+public:
+ typedef _CharT char_type;
+ typedef _OutputIter iter_type;
+
+ explicit num_put(size_t __refs = 0) : locale::facet(__refs) {}
+
+#if !defined (_STLP_NO_BOOL)
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ bool __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+#endif
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ long __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ unsigned long __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+
+#if defined (_STLP_LONG_LONG)
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ _STLP_LONG_LONG __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ unsigned _STLP_LONG_LONG __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+#endif
+
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ double __val) const {
+ return do_put(__s, __f, __fill, (double)__val);
+ }
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ long double __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+#endif
+
+ iter_type put(iter_type __s, ios_base& __f, char_type __fill,
+ const void * __val) const {
+ return do_put(__s, __f, __fill, __val);
+ }
+
+ static locale::id id;
+
+protected:
+ ~num_put() {}
+#if !defined (_STLP_NO_BOOL)
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const;
+#endif
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long __val) const;
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, unsigned long __val) const;
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, double __val) const;
+#if !defined (_STLP_NO_LONG_DOUBLE)
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long double __val) const;
+#endif
+
+#if defined (_STLP_LONG_LONG)
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, _STLP_LONG_LONG __val) const;
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill,
+ unsigned _STLP_LONG_LONG __val) const ;
+#endif
+ virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, const void* __val) const;
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS num_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+# endif
+#endif
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Integer>
+char* _STLP_CALL
+__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x);
+
+/*
+ * Returns the position on the right of the digits that has to be considered
+ * for the application of the grouping policy.
+ */
+extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, double);
+# if !defined (_STLP_NO_LONG_DOUBLE)
+extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, long double);
+# endif
+
+/*
+ * Gets the digits of the integer part.
+ */
+void _STLP_CALL __get_floor_digits(__iostring&, _STLP_LONGEST_FLOAT_TYPE);
+
+template <class _CharT>
+void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT)&, ios_base&, _STLP_LONGEST_FLOAT_TYPE);
+
+# if !defined (_STLP_NO_WCHAR_T)
+extern void _STLP_CALL __convert_float_buffer(__iostring const&, __iowstring&, const ctype<wchar_t>&, wchar_t, bool = true);
+# endif
+extern void _STLP_CALL __adjust_float_buffer(__iostring&, char);
+
+extern char* _STLP_CALL
+__write_integer(char* buf, ios_base::fmtflags flags, long x);
+
+extern ptrdiff_t _STLP_CALL __insert_grouping(char* first, char* last, const string&, char, char, char, int);
+extern void _STLP_CALL __insert_grouping(__iostring&, size_t, const string&, char, char, char, int);
+# if !defined (_STLP_NO_WCHAR_T)
+extern ptrdiff_t _STLP_CALL __insert_grouping(wchar_t*, wchar_t*, const string&, wchar_t, wchar_t, wchar_t, int);
+extern void _STLP_CALL __insert_grouping(__iowstring&, size_t, const string&, wchar_t, wchar_t, wchar_t, int);
+# endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_num_put.c>
+#endif
+
+#endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_numeric.c b/stlport/stl/_numeric.c
similarity index 100%
rename from stl/_numeric.c
rename to stlport/stl/_numeric.c
diff --git a/stl/_numeric.h b/stlport/stl/_numeric.h
similarity index 100%
rename from stl/_numeric.h
rename to stlport/stl/_numeric.h
diff --git a/stlport/stl/_numpunct.h b/stlport/stl/_numpunct.h
new file mode 100644
index 0000000..c0d0ff4
--- /dev/null
+++ b/stlport/stl/_numpunct.h
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_NUMPUNCT_H
+#define _STLP_INTERNAL_NUMPUNCT_H
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h>
+#endif
+
+# ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+# endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// numpunct facets
+
+template <class _CharT> class numpunct {};
+template <class _CharT> class numpunct_byname {};
+template <class _Ch, class _InIt> class num_get;
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet {
+public:
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit numpunct(size_t __refs = 0)
+ : locale::facet(__refs) {}
+
+ char decimal_point() const { return do_decimal_point(); }
+ char thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ string truename() const { return do_truename(); }
+ string falsename() const { return do_falsename(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~numpunct();
+
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual string do_truename() const;
+ virtual string do_falsename() const;
+};
+
+# if ! defined (_STLP_NO_WCHAR_T)
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet {
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit numpunct(size_t __refs = 0)
+ : locale::facet(__refs) {}
+
+ wchar_t decimal_point() const { return do_decimal_point(); }
+ wchar_t thousands_sep() const { return do_thousands_sep(); }
+ string grouping() const { return do_grouping(); }
+ wstring truename() const { return do_truename(); }
+ wstring falsename() const { return do_falsename(); }
+
+ static _STLP_STATIC_DECLSPEC locale::id id;
+
+protected:
+ ~numpunct();
+
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual wstring do_truename() const;
+ virtual wstring do_falsename() const;
+};
+
+# endif /* WCHAR_T */
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
+ friend class _Locale_impl;
+public:
+ typedef char char_type;
+ typedef string string_type;
+
+ explicit numpunct_byname(const char* __name, size_t __refs = 0);
+
+protected:
+
+ ~numpunct_byname();
+
+ virtual char do_decimal_point() const;
+ virtual char do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual string do_truename() const;
+ virtual string do_falsename() const;
+
+private:
+ numpunct_byname(_Locale_numeric *__numeric)
+ : _M_numeric(__numeric) {}
+
+ //explicitely defined as private to avoid warnings:
+ typedef numpunct_byname<char> _Self;
+ numpunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_numeric* _M_numeric;
+};
+
+# ifndef _STLP_NO_WCHAR_T
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
+ friend class _Locale_impl;
+public:
+ typedef wchar_t char_type;
+ typedef wstring string_type;
+
+ explicit numpunct_byname(const char* __name, size_t __refs = 0);
+
+protected:
+ ~numpunct_byname();
+
+ virtual wchar_t do_decimal_point() const;
+ virtual wchar_t do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual wstring do_truename() const;
+ virtual wstring do_falsename() const;
+
+private:
+ numpunct_byname(_Locale_numeric *__numeric)
+ : _M_numeric(__numeric) {}
+
+ //explicitely defined as private to avoid warnings:
+ typedef numpunct_byname<wchar_t> _Self;
+ numpunct_byname(_Self const&);
+ _Self& operator = (_Self const&);
+
+ _Locale_numeric* _M_numeric;
+};
+
+# endif /* WCHAR_T */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_NUMPUNCT_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_ostream.c b/stlport/stl/_ostream.c
new file mode 100644
index 0000000..faba6c2
--- /dev/null
+++ b/stlport/stl/_ostream.c
@@ -0,0 +1,455 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_OSTREAM_C
+#define _STLP_OSTREAM_C
+
+#ifndef _STLP_INTERNAL_OSTREAM_H
+# include <stl/_ostream.h>
+#endif
+
+#if !defined (_STLP_INTERNAL_NUM_PUT_H)
+# include <stl/_num_put.h> // For basic_streambuf and iterators
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Definitions of non-inline member functions.
+
+// Constructor, destructor
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<_CharT, _Traits>* __buf)
+ : basic_ios<_CharT, _Traits>() {
+ this->init(__buf);
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::~basic_ostream()
+{}
+
+// Output directly from a streambuf.
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<_CharT, _Traits>* __from) {
+ sentry __sentry(*this);
+ if (__sentry) {
+ if (__from) {
+ bool __any_inserted = __from->gptr() != __from->egptr()
+ ? this->_M_copy_buffered(__from, this->rdbuf())
+ : this->_M_copy_unbuffered(__from, this->rdbuf());
+ if (!__any_inserted)
+ this->setstate(ios_base::failbit);
+ }
+ else
+ this->setstate(ios_base::badbit);
+ }
+
+ return *this;
+}
+
+// Helper functions for the streambuf version of operator<<. The
+// exception-handling code is complicated because exceptions thrown
+// while extracting characters are treated differently than exceptions
+// thrown while inserting characters.
+
+template <class _CharT, class _Traits>
+bool basic_ostream<_CharT, _Traits>
+ ::_M_copy_buffered(basic_streambuf<_CharT, _Traits>* __from,
+ basic_streambuf<_CharT, _Traits>* __to) {
+ bool __any_inserted = false;
+
+ while (__from->egptr() != __from->gptr()) {
+ const ptrdiff_t __avail = __from->egptr() - __from->gptr();
+
+ streamsize __nwritten;
+ _STLP_TRY {
+ __nwritten = __to->sputn(__from->gptr(), __avail);
+ __from->gbump((int)__nwritten);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ return __any_inserted;
+ }
+
+ if (__nwritten == __avail) {
+ _STLP_TRY {
+ if (this->_S_eof(__from->sgetc()))
+ return true;
+ else
+ __any_inserted = true;
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::failbit);
+ return false;
+ }
+ }
+ else if (__nwritten != 0)
+ return true;
+ else
+ return __any_inserted;
+ }
+
+ // No characters are in the buffer, but we aren't at EOF. Switch to
+ // unbuffered mode.
+ return __any_inserted || this->_M_copy_unbuffered(__from, __to);
+}
+
+/*
+ * Helper struct (guard) to put back a character in a streambuf
+ * whenever an exception or an eof occur.
+ */
+template <class _CharT, class _Traits>
+struct _SPutBackC {
+ typedef basic_streambuf<_CharT, _Traits> _StreamBuf;
+ typedef typename _StreamBuf::int_type int_type;
+ _SPutBackC(_StreamBuf *pfrom)
+ : __pfrom(pfrom), __c(0), __do_guard(false) {}
+ ~_SPutBackC() {
+ if (__do_guard) {
+ __pfrom->sputbackc(_Traits::to_char_type(__c));
+ }
+ }
+
+ void guard(int_type c) {
+ __c = c;
+ __do_guard = true;
+ }
+ void release() {
+ __do_guard = false;
+ }
+
+private:
+ _StreamBuf *__pfrom;
+ int_type __c;
+ bool __do_guard;
+};
+
+template <class _CharT, class _Traits>
+bool basic_ostream<_CharT, _Traits>
+ ::_M_copy_unbuffered(basic_streambuf<_CharT, _Traits>* __from,
+ basic_streambuf<_CharT, _Traits>* __to) {
+ typedef _SPutBackC<_CharT, _Traits> _SPutBackCGuard;
+ bool __any_inserted = false;
+ int_type __c;
+
+ _STLP_TRY {
+ _SPutBackCGuard __cguard(__from);
+ for (;;) {
+ _STLP_TRY {
+ __c = __from->sbumpc();
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::failbit);
+ break;
+ }
+
+ if (this->_S_eof(__c))
+ break;
+
+ __cguard.guard(__c);
+#if defined (__DMC__)
+ _STLP_TRY {
+#endif
+ if (this->_S_eof(__to->sputc(_Traits::to_char_type(__c))))
+ break;
+
+#if defined (__DMC__)
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ break;
+ }
+#endif
+ __cguard.release();
+ __any_inserted = true;
+ }
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ return __any_inserted;
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Helper function for numeric output.
+template <class _CharT, class _Traits, class _Number>
+basic_ostream<_CharT, _Traits>& _STLP_CALL
+__put_num(basic_ostream<_CharT, _Traits>& __os, _Number __x) {
+ typedef typename basic_ostream<_CharT, _Traits>::sentry _Sentry;
+ _Sentry __sentry(__os);
+ bool __failed = true;
+
+ if (__sentry) {
+ _STLP_TRY {
+ typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > _NumPut;
+ __failed = (use_facet<_NumPut>(__os.getloc())).put(ostreambuf_iterator<_CharT, _Traits>(__os.rdbuf()),
+ __os, __os.fill(),
+ __x).failed();
+ }
+ _STLP_CATCH_ALL {
+ __os._M_handle_exception(ios_base::badbit);
+ }
+ }
+ if (__failed)
+ __os.setstate(ios_base::badbit);
+ return __os;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+/*
+ * In the following operators we try to limit code bloat by limiting the
+ * number of __put_num instanciations.
+ */
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __x) {
+ _STLP_STATIC_ASSERT( sizeof(short) <= sizeof(long) )
+ long __tmp = ((this->flags() & _Basic_ios::basefield) != ios_base::dec) ?
+ __STATIC_CAST(long, __STATIC_CAST(unsigned short, __x)): __x;
+ return _STLP_PRIV __put_num(*this, __tmp);
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __x) {
+ _STLP_STATIC_ASSERT( sizeof(unsigned short) <= sizeof(unsigned long) )
+ return _STLP_PRIV __put_num(*this, __STATIC_CAST(unsigned long,__x));
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __x) {
+ _STLP_STATIC_ASSERT( sizeof(int) <= sizeof(long) )
+ long __tmp = ((this->flags() & _Basic_ios::basefield) != ios_base::dec) ?
+ __STATIC_CAST(long, __STATIC_CAST(unsigned int, __x)): __x;
+ return _STLP_PRIV __put_num(*this, __tmp);
+}
+
+template <class _CharT, class _Traits>
+#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300)
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __x) {
+ _STLP_STATIC_ASSERT( sizeof(unsigned int) <= sizeof(unsigned long) )
+#else
+/* We define this operator with size_t rather than unsigned int to avoid
+ * 64 bits warning.
+ */
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(size_t __x) {
+ _STLP_STATIC_ASSERT( sizeof(size_t) <= sizeof(unsigned long) )
+#endif
+ return _STLP_PRIV __put_num(*this, __STATIC_CAST(unsigned long,__x));
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+#ifdef _STLP_LONG_LONG
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<< (_STLP_LONG_LONG __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<< (unsigned _STLP_LONG_LONG __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+#endif
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __x)
+{ return _STLP_PRIV __put_num(*this, __STATIC_CAST(double,__x)); }
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+#ifndef _STLP_NO_LONG_DOUBLE
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+#endif
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+
+#ifndef _STLP_NO_BOOL
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __x)
+{ return _STLP_PRIV __put_num(*this, __x); }
+#endif
+
+template <class _CharT, class _Traits>
+void basic_ostream<_CharT, _Traits>::_M_put_char(_CharT __c) {
+ sentry __sentry(*this);
+ if (__sentry) {
+ bool __failed = true;
+ _STLP_TRY {
+ streamsize __npad = this->width() > 0 ? this->width() - 1 : 0;
+ // if (__npad <= 1)
+ if (__npad == 0)
+ __failed = this->_S_eof(this->rdbuf()->sputc(__c));
+ else if ((this->flags() & ios_base::adjustfield) == ios_base::left) {
+ __failed = this->_S_eof(this->rdbuf()->sputc(__c));
+ __failed = __failed ||
+ this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ }
+ else {
+ __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ __failed = __failed || this->_S_eof(this->rdbuf()->sputc(__c));
+ }
+
+ this->width(0);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (__failed)
+ this->setstate(ios_base::badbit);
+ }
+}
+
+template <class _CharT, class _Traits>
+void basic_ostream<_CharT, _Traits>::_M_put_nowiden(const _CharT* __s) {
+ sentry __sentry(*this);
+ if (__sentry) {
+ bool __failed = true;
+ streamsize __n = _Traits::length(__s);
+ streamsize __npad = this->width() > __n ? this->width() - __n : 0;
+
+ _STLP_TRY {
+ if (__npad == 0)
+ __failed = this->rdbuf()->sputn(__s, __n) != __n;
+ else if ((this->flags() & ios_base::adjustfield) == ios_base::left) {
+ __failed = this->rdbuf()->sputn(__s, __n) != __n;
+ __failed = __failed ||
+ this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ }
+ else {
+ __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ __failed = __failed || this->rdbuf()->sputn(__s, __n) != __n;
+ }
+
+ this->width(0);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (__failed)
+ this->setstate(ios_base::failbit);
+ }
+}
+
+template <class _CharT, class _Traits>
+void basic_ostream<_CharT, _Traits>::_M_put_widen(const char* __s) {
+ sentry __sentry(*this);
+ if (__sentry) {
+ bool __failed = true;
+ streamsize __n = char_traits<char>::length(__s);
+ streamsize __npad = this->width() > __n ? this->width() - __n : 0;
+
+ _STLP_TRY {
+ if (__npad == 0)
+ __failed = !this->_M_put_widen_aux(__s, __n);
+ else if ((this->flags() & ios_base::adjustfield) == ios_base::left) {
+ __failed = !this->_M_put_widen_aux(__s, __n);
+ __failed = __failed ||
+ this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ }
+ else {
+ __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad;
+ __failed = __failed || !this->_M_put_widen_aux(__s, __n);
+ }
+
+ this->width(0);
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+
+ if (__failed)
+ this->setstate(ios_base::failbit);
+ }
+}
+
+template <class _CharT, class _Traits>
+bool basic_ostream<_CharT, _Traits>::_M_put_widen_aux(const char* __s,
+ streamsize __n) {
+ basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
+
+ for ( ; __n > 0 ; --__n)
+ if (this->_S_eof(__buf->sputc(this->widen(*__s++))))
+ return false;
+ return true;
+}
+
+// Unformatted output of a single character.
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::put(char_type __c) {
+ sentry __sentry(*this);
+ bool __failed = true;
+
+ if (__sentry) {
+ _STLP_TRY {
+ __failed = this->_S_eof(this->rdbuf()->sputc(__c));
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ }
+
+ if (__failed)
+ this->setstate(ios_base::badbit);
+
+ return *this;
+}
+
+// Unformatted output of a single character.
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) {
+ sentry __sentry(*this);
+ bool __failed = true;
+
+ if (__sentry) {
+ _STLP_TRY {
+ __failed = this->rdbuf()->sputn(__s, __n) != __n;
+ }
+ _STLP_CATCH_ALL {
+ this->_M_handle_exception(ios_base::badbit);
+ }
+ }
+
+ if (__failed)
+ this->setstate(ios_base::badbit);
+
+ return *this;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_OSTREAM_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_ostream.h b/stlport/stl/_ostream.h
new file mode 100644
index 0000000..3335b66
--- /dev/null
+++ b/stlport/stl/_ostream.h
@@ -0,0 +1,387 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+
+#ifndef _STLP_INTERNAL_OSTREAM_H
+#define _STLP_INTERNAL_OSTREAM_H
+
+#ifndef _STLP_INTERNAL_IOS_H
+# include <stl/_ios.h> // For basic_ios<>. Includes <iosfwd>.
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+# include <stl/_ostreambuf_iterator.h>
+#endif
+
+#if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) && !defined (_STLP_INTERNAL_EXCEPTION)
+# include <stl/_exception.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+template <class _CharT, class _Traits>
+class _Osentry;
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT, class _Traits>
+bool __init_bostr(basic_ostream<_CharT, _Traits>& __str);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+//----------------------------------------------------------------------
+// class basic_ostream<>
+
+template <class _CharT, class _Traits>
+class basic_ostream : virtual public basic_ios<_CharT, _Traits> {
+ typedef basic_ostream<_CharT, _Traits> _Self;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ //explicitely defined as private to avoid warnings:
+ basic_ostream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+
+public: // Types
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+
+public: // Constructor and destructor.
+ explicit basic_ostream(basic_streambuf<_CharT, _Traits>* __buf);
+ ~basic_ostream();
+
+public: // Hooks for manipulators.
+ typedef basic_ios<_CharT, _Traits>& (_STLP_CALL *__ios_fn)(basic_ios<_CharT, _Traits>&);
+ typedef ios_base& (_STLP_CALL *__ios_base_fn)(ios_base&);
+ typedef _Self& (_STLP_CALL *__ostream_fn)(_Self&);
+ _Self& operator<< (__ostream_fn __f) { return __f(*this); }
+ _Self & operator<< (__ios_base_fn __f) { __f(*this); return *this; }
+ _Self& operator<< (__ios_fn __ff) { __ff(*this); return *this; }
+
+private:
+ bool _M_copy_buffered(basic_streambuf<_CharT, _Traits>* __from,
+ basic_streambuf<_CharT, _Traits>* __to);
+ bool _M_copy_unbuffered(basic_streambuf<_CharT, _Traits>* __from,
+ basic_streambuf<_CharT, _Traits>* __to);
+
+public:
+ void _M_put_char(_CharT __c);
+
+ void _M_put_nowiden(const _CharT* __s);
+ void _M_put_widen(const char* __s);
+ bool _M_put_widen_aux(const char* __s, streamsize __n);
+
+public: // Unformatted output.
+ _Self& put(char_type __c);
+ _Self& write(const char_type* __s, streamsize __n);
+
+public: // Formatted output.
+ // Formatted output from a streambuf.
+ _Self& operator<<(basic_streambuf<_CharT, _Traits>* __buf);
+# ifndef _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+ // this is needed for compiling with option char = unsigned
+ _Self& operator<<(unsigned char __x) { _M_put_char(__x); return *this; }
+# endif
+ _Self& operator<<(short __x);
+ _Self& operator<<(unsigned short __x);
+ _Self& operator<<(int __x);
+#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300)
+ _Self& operator<<(unsigned int __x);
+#else
+/* We define this operator with size_t rather than unsigned int to avoid
+ * 64 bits warning.
+ */
+ _Self& operator<<(size_t __x);
+#endif
+ _Self& operator<<(long __x);
+ _Self& operator<<(unsigned long __x);
+#ifdef _STLP_LONG_LONG
+ _Self& operator<< (_STLP_LONG_LONG __x);
+ _Self& operator<< (unsigned _STLP_LONG_LONG __x);
+#endif
+ _Self& operator<<(float __x);
+ _Self& operator<<(double __x);
+# ifndef _STLP_NO_LONG_DOUBLE
+ _Self& operator<<(long double __x);
+# endif
+ _Self& operator<<(const void* __x);
+# ifndef _STLP_NO_BOOL
+ _Self& operator<<(bool __x);
+# endif
+
+public: // Buffer positioning and manipulation.
+ _Self& flush() {
+ if (this->rdbuf())
+ if (this->rdbuf()->pubsync() == -1)
+ this->setstate(ios_base::badbit);
+ return *this;
+ }
+
+ pos_type tellp() {
+ return this->rdbuf() && !this->fail()
+ ? this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out)
+ : pos_type(-1);
+ }
+
+ _Self& seekp(pos_type __pos) {
+ if (this->rdbuf() && !this->fail()) {
+ if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1)) {
+ this->setstate(ios_base::failbit);
+ }
+ }
+ return *this;
+ }
+
+ _Self& seekp(off_type __off, ios_base::seekdir __dir) {
+ if (this->rdbuf() && !this->fail())
+ this->rdbuf()->pubseekoff(__off, __dir, ios_base::out);
+ return *this;
+ }
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+ // If we are using DLL specs, we have not to use inner classes
+ // end class declaration here
+ typedef _Osentry<_CharT, _Traits> sentry;
+};
+# define sentry _Osentry
+ template <class _CharT, class _Traits>
+ class _Osentry {
+ typedef _Osentry<_CharT, _Traits> _Self;
+#else
+ class sentry {
+ typedef sentry _Self;
+#endif
+ private:
+ basic_ostream<_CharT, _Traits>& _M_str;
+ // basic_streambuf<_CharT, _Traits>* _M_buf;
+ bool _M_ok;
+ public:
+ explicit sentry(basic_ostream<_CharT, _Traits>& __str)
+ : _M_str(__str), /* _M_buf(__str.rdbuf()), */ _M_ok(_STLP_PRIV __init_bostr(__str))
+ {}
+
+ ~sentry() {
+ if (_M_str.flags() & ios_base::unitbuf)
+#if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
+ if (!uncaught_exception())
+#endif
+ _M_str.flush();
+ }
+
+ operator bool() const { return _M_ok; }
+ private: // Disable assignment and copy constructor.
+ //Implementation is here only to avoid warning with some compilers.
+ sentry(const _Self& __s) : _M_str(__s._M_str) {}
+ _Self& operator=(const _Self&) { return *this; }
+ };
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+# undef sentry
+#else
+ // close basic_ostream class definition here
+};
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ostream<char, char_traits<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Osentry<char, char_traits<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_ostream<wchar_t, char_traits<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Osentry<wchar_t, char_traits<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Helper functions for istream<>::sentry constructor.
+template <class _CharT, class _Traits>
+bool __init_bostr(basic_ostream<_CharT, _Traits>& __str) {
+ if (__str.good()) {
+ // boris : check if this is needed !
+ if (!__str.rdbuf())
+ __str.setstate(ios_base::badbit);
+ if (__str.tie())
+ __str.tie()->flush();
+ return __str.good();
+ }
+ else
+ return false;
+}
+
+template <class _CharT, class _Traits>
+inline basic_streambuf<_CharT, _Traits>* _STLP_CALL
+__get_ostreambuf(basic_ostream<_CharT, _Traits>& __St)
+{ return __St.rdbuf(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Non-member functions.
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c){
+ __os._M_put_char(__c);
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __s) {
+ __os._M_put_nowiden(__s);
+ return __os;
+}
+
+#if defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER)
+// some specializations
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, signed char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, unsigned char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, const char* __s) {
+ __os._M_put_nowiden(__s);
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >& _STLP_CALL
+operator<<(basic_ostream<char, char_traits<char> >& __os, const signed char* __s) {
+ __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
+ return __os;
+}
+
+inline basic_ostream<char, char_traits<char> >&
+operator<<(basic_ostream<char, char_traits<char> >& __os, const unsigned char* __s) {
+ __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
+ return __os;
+}
+
+#else
+
+// also for compilers who might use that
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, char __c) {
+ __os._M_put_char(__os.widen(__c));
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, signed char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c) {
+ __os._M_put_char(__c);
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __s) {
+ __os._M_put_widen(__s);
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, const char* __s) {
+ __os._M_put_nowiden(__s);
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>& _STLP_CALL
+operator<<(basic_ostream<char, _Traits>& __os, const signed char* __s) {
+ __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
+ return __os;
+}
+
+template <class _Traits>
+inline basic_ostream<char, _Traits>&
+operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __s) {
+ __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s));
+ return __os;
+}
+#endif /* _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER */
+
+//----------------------------------------------------------------------
+// basic_ostream manipulators.
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+endl(basic_ostream<_CharT, _Traits>& __os) {
+ __os.put(__os.widen('\n'));
+ __os.flush();
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+ends(basic_ostream<_CharT, _Traits>& __os) {
+ __os.put(_STLP_DEFAULT_CONSTRUCTED(_CharT));
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+inline basic_ostream<_CharT, _Traits>& _STLP_CALL
+flush(basic_ostream<_CharT, _Traits>& __os) {
+ __os.flush();
+ return __os;
+}
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_ostream.c>
+#endif
+
+#endif /* _STLP_INTERNAL_OSTREAM_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_ostreambuf_iterator.h b/stlport/stl/_ostreambuf_iterator.h
similarity index 100%
rename from stl/_ostreambuf_iterator.h
rename to stlport/stl/_ostreambuf_iterator.h
diff --git a/stlport/stl/_pair.h b/stlport/stl/_pair.h
new file mode 100644
index 0000000..de0b08e
--- /dev/null
+++ b/stlport/stl/_pair.h
@@ -0,0 +1,186 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_PAIR_H
+#define _STLP_INTERNAL_PAIR_H
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+# endif
+
+# if !defined (_STLP_MOVE_CONSTRUCT_FWK_H) && !defined (_STLP_NO_MOVE_SEMANTIC)
+# include <stl/_move_construct_fwk.h>
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (ANDROID)
+/* Android has stl_pair.h, prevent using it by defining the header guard. */
+# define __SGI_STL_INTERNAL_PAIR_H
+#endif
+template <class _T1, class _T2>
+struct pair {
+ typedef _T1 first_type;
+ typedef _T2 second_type;
+
+ _T1 first;
+ _T2 second;
+#if defined (_STLP_CONST_CONSTRUCTOR_BUG)
+ pair() {}
+#else
+ pair() : first(_T1()), second(_T2()) {}
+#endif
+ pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _U1, class _U2>
+ pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
+
+ pair(const pair<_T1,_T2>& __o) : first(__o.first), second(__o.second) {}
+#endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ pair(__move_source<pair<_T1, _T2> > src) : first(_STLP_PRIV _AsMoveSource(src.get().first)),
+ second(_STLP_PRIV _AsMoveSource(src.get().second))
+ {}
+#endif
+
+ __TRIVIAL_DESTRUCTOR(pair)
+};
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return __x.first == __y.first && __x.second == __y.second; }
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
+ return __x.first < __y.first ||
+ (!(__y.first < __x.first) && __x.second < __y.second);
+}
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return !(__x == __y); }
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return __y < __x; }
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return !(__y < __x); }
+
+template <class _T1, class _T2>
+inline bool _STLP_CALL operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+{ return !(__x < __y); }
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_EXTENSIONS)
+template <class _T1, class _T2, int _Sz>
+inline pair<_T1, _T2 const*> make_pair(_T1 const& __x,
+ _T2 const (&__y)[_Sz])
+{ return pair<_T1, _T2 const*>(__x, static_cast<_T2 const*>(__y)); }
+
+template <class _T1, class _T2, int _Sz>
+inline pair<_T1 const*, _T2> make_pair(_T1 const (&__x)[_Sz],
+ _T2 const& __y)
+{ return pair<_T1 const*, _T2>(static_cast<_T1 const*>(__x), __y); }
+
+template <class _T1, class _T2, int _Sz1, int _Sz2>
+inline pair<_T1 const*, _T2 const*> make_pair(_T1 const (&__x)[_Sz1],
+ _T2 const (&__y)[_Sz2]) {
+ return pair<_T1 const*, _T2 const*>(static_cast<_T1 const*>(__x),
+ static_cast<_T2 const*>(__y));
+}
+#endif
+
+template <class _T1, class _T2>
+inline pair<_T1, _T2> _STLP_CALL make_pair(_T1 __x, _T2 __y)
+{ return pair<_T1, _T2>(__x, __y); }
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_USE_NAMESPACES) || !defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+_STLP_BEGIN_RELOPS_NAMESPACE
+
+template <class _Tp>
+inline bool _STLP_CALL operator!=(const _Tp& __x, const _Tp& __y)
+{ return !(__x == __y); }
+
+template <class _Tp>
+inline bool _STLP_CALL operator>(const _Tp& __x, const _Tp& __y)
+{ return __y < __x; }
+
+template <class _Tp>
+inline bool _STLP_CALL operator<=(const _Tp& __x, const _Tp& __y)
+{ return !(__y < __x); }
+
+template <class _Tp>
+inline bool _STLP_CALL operator>=(const _Tp& __x, const _Tp& __y)
+{ return !(__x < __y); }
+
+_STLP_END_RELOPS_NAMESPACE
+#endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_BEGIN_NAMESPACE
+
+template <class _T1, class _T2>
+struct __type_traits<pair<_T1, _T2> > {
+ typedef __type_traits<_T1> _T1Traits;
+ typedef __type_traits<_T2> _T2Traits;
+ typedef typename _Land2<typename _T1Traits::has_trivial_default_constructor,
+ typename _T2Traits::has_trivial_default_constructor>::_Ret has_trivial_default_constructor;
+ typedef typename _Land2<typename _T1Traits::has_trivial_copy_constructor,
+ typename _T2Traits::has_trivial_copy_constructor>::_Ret has_trivial_copy_constructor;
+ typedef typename _Land2<typename _T1Traits::has_trivial_assignment_operator,
+ typename _T2Traits::has_trivial_assignment_operator>::_Ret has_trivial_assignment_operator;
+ typedef typename _Land2<typename _T1Traits::has_trivial_destructor,
+ typename _T2Traits::has_trivial_destructor>::_Ret has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _T1, class _T2>
+struct __move_traits<pair<_T1, _T2> >
+ : _STLP_PRIV __move_traits_help1<_T1, _T2> {};
+# endif
+
+_STLP_END_NAMESPACE
+#endif
+
+#endif /* _STLP_INTERNAL_PAIR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_prolog.h b/stlport/stl/_prolog.h
new file mode 100644
index 0000000..9705c2c
--- /dev/null
+++ b/stlport/stl/_prolog.h
@@ -0,0 +1,18 @@
+/* NOTE : this header has no guards and is MEANT for multiple inclusion!
+ * If you are using "header protection" option with your compiler,
+ * please also find #pragma which disables it and put it here, to
+ * allow reentrancy of this header.
+ */
+
+#include <stl/_cprolog.h>
+
+/* Get all debug things, potentially only empty macros if none of
+ * the debug features available in user config file is activated. */
+ /* Thanks to _STLP_OUTERMOST_HEADER_ID we hide _debug.h when C standard
+ * headers are included as some platforms (Win32) include C standard headers
+ * in an 'extern "C"' scope which do not accept the templates exposed
+ * in _debug.h. */
+#if defined (__cplusplus) && !defined (_STLP_DEBUG_H) && \
+ !((_STLP_OUTERMOST_HEADER_ID >= 0x200) && (_STLP_OUTERMOST_HEADER_ID <= 0x300))
+# include <stl/debug/_debug.h>
+#endif
diff --git a/stlport/stl/_pthread_alloc.h b/stlport/stl/_pthread_alloc.h
new file mode 100644
index 0000000..f45d949
--- /dev/null
+++ b/stlport/stl/_pthread_alloc.h
@@ -0,0 +1,461 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_PTHREAD_ALLOC_H
+#define _STLP_PTHREAD_ALLOC_H
+
+/*
+ * Pthread-specific node allocator.
+ * This is similar to the default allocator, except that free-list
+ * information is kept separately for each thread, avoiding locking.
+ * This should be reasonably fast even in the presence of threads.
+ * The down side is that storage may not be well-utilized.
+ * It is not an error to allocate memory in thread A and deallocate
+ * it in thread B. But this effectively transfers ownership of the memory,
+ * so that it can only be reallocated by thread B. Thus this can effectively
+ * result in a storage leak if it's done on a regular basis.
+ * It can also result in frequent sharing of
+ * cache lines among processors, with potentially serious performance
+ * consequences.
+ */
+
+#if !defined (_STLP_PTHREADS)
+# error POSIX specific allocator implementation. Your system do not seems to \
+have this interface so please comment the _STLP_USE_PERTHREAD_ALLOC macro \
+or report to the STLport forum.
+#endif
+
+#if defined (_STLP_USE_NO_IOSTREAMS)
+# error You cannot use per thread allocator implementation without building \
+STLport libraries.
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+struct _Pthread_alloc_per_thread_state;
+
+// Pthread-specific allocator.
+class _STLP_CLASS_DECLSPEC _Pthread_alloc {
+public: // but only for internal use:
+ typedef _Pthread_alloc_per_thread_state __state_type;
+ typedef char value_type;
+
+public:
+ // Return a recycled or new per thread state.
+ static __state_type * _STLP_CALL _S_get_per_thread_state();
+
+ /* n must be > 0 */
+ static void * _STLP_CALL allocate(size_t& __n);
+
+ /* p may not be 0 */
+ static void _STLP_CALL deallocate(void *__p, size_t __n);
+
+ // boris : versions for per_thread_allocator
+ /* n must be > 0 */
+ static void * _STLP_CALL allocate(size_t& __n, __state_type* __a);
+
+ /* p may not be 0 */
+ static void _STLP_CALL deallocate(void *__p, size_t __n, __state_type* __a);
+
+ static void * _STLP_CALL reallocate(void *__p, size_t __old_sz, size_t& __new_sz);
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+typedef _STLP_PRIV _Pthread_alloc __pthread_alloc;
+typedef __pthread_alloc pthread_alloc;
+
+template <class _Tp>
+class pthread_allocator : public __stlport_class<pthread_allocator<_Tp> > {
+ typedef pthread_alloc _S_Alloc; // The underlying allocator.
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _NewType> struct rebind {
+ typedef pthread_allocator<_NewType> other;
+ };
+#endif
+
+ pthread_allocator() _STLP_NOTHROW {}
+ pthread_allocator(const pthread_allocator<_Tp>& a) _STLP_NOTHROW {}
+
+#if defined (_STLP_MEMBER_TEMPLATES) /* && defined (_STLP_FUNCTION_PARTIAL_ORDER) */
+ template <class _OtherType> pthread_allocator(const pthread_allocator<_OtherType>&)
+ _STLP_NOTHROW {}
+#endif
+
+ ~pthread_allocator() _STLP_NOTHROW {}
+
+ pointer address(reference __x) const { return &__x; }
+ const_pointer address(const_reference __x) const { return &__x; }
+
+ // __n is permitted to be 0. The C++ standard says nothing about what
+ // the return value is when __n == 0.
+ _Tp* allocate(size_type __n, const void* = 0) {
+ if (__n > max_size()) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+#endif
+ return __ret;
+ }
+ else
+ return 0;
+ }
+
+ void deallocate(pointer __p, size_type __n) {
+ _STLP_ASSERT( (__p == 0) == (__n == 0) )
+ if (__p != 0) {
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
+#endif
+ _S_Alloc::deallocate(__p, __n * sizeof(value_type));
+ }
+ }
+
+ size_type max_size() const _STLP_NOTHROW
+ { return size_t(-1) / sizeof(_Tp); }
+
+ void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
+ void destroy(pointer _p) { _p->~_Tp(); }
+
+#if defined (_STLP_NO_EXTENSIONS)
+ /* STLport extension giving rounded size of an allocated memory buffer
+ * This method do not have to be part of a user defined allocator implementation
+ * and won't even be called if such a function was granted.
+ */
+protected:
+#endif
+ _Tp* allocate(size_type __n, size_type& __allocated_n) {
+ if (__n > max_size()) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+#endif
+ __allocated_n = __buf_size / sizeof(value_type);
+ return __ret;
+ }
+ else
+ return 0;
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(pthread_allocator<_Tp>& __x) {}
+#endif
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC pthread_allocator<void> {
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+ typedef void value_type;
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _NewType> struct rebind {
+ typedef pthread_allocator<_NewType> other;
+ };
+#endif
+};
+
+template <class _T1, class _T2>
+inline bool operator==(const pthread_allocator<_T1>&,
+ const pthread_allocator<_T2>& a2)
+{ return true; }
+
+#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+template <class _T1, class _T2>
+inline bool operator!=(const pthread_allocator<_T1>&,
+ const pthread_allocator<_T2>&)
+{ return false; }
+#endif
+
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+
+template <class _Tp, class _Atype>
+struct _Alloc_traits<_Tp, pthread_allocator<_Atype> >
+{ typedef pthread_allocator<_Tp> allocator_type; };
+
+#endif
+
+#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+
+template <class _Tp1, class _Tp2>
+inline pthread_allocator<_Tp2>&
+__stl_alloc_rebind(pthread_allocator<_Tp1>& __x, const _Tp2*)
+{ return (pthread_allocator<_Tp2>&)__x; }
+
+template <class _Tp1, class _Tp2>
+inline pthread_allocator<_Tp2>
+__stl_alloc_create(pthread_allocator<_Tp1>&, const _Tp2*)
+{ return pthread_allocator<_Tp2>(); }
+
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+struct __pthread_alloc_type_traits {
+ typedef typename _IsSTLportClass<pthread_allocator<_Tp> >::_Ret _STLportAlloc;
+ //The default allocator implementation which is recognize thanks to the
+ //__stlport_class inheritance is a stateless object so:
+ typedef _STLportAlloc has_trivial_default_constructor;
+ typedef _STLportAlloc has_trivial_copy_constructor;
+ typedef _STLportAlloc has_trivial_assignment_operator;
+ typedef _STLportAlloc has_trivial_destructor;
+ typedef _STLportAlloc is_POD_type;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __type_traits<pthread_allocator<_Tp> > : _STLP_PRIV __pthread_alloc_type_traits<_Tp> {};
+#else
+_STLP_TEMPLATE_NULL
+struct __type_traits<pthread_allocator<char> > : _STLP_PRIV __pthread_alloc_type_traits<char> {};
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_TEMPLATE_NULL
+struct __type_traits<pthread_allocator<wchar_t> > : _STLP_PRIV __pthread_alloc_type_traits<wchar_t> {};
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_TEMPLATE_NULL
+struct __type_traits<pthread_allocator<void*> > : _STLP_PRIV __pthread_alloc_type_traits<void*> {};
+# endif
+#endif
+
+//
+// per_thread_allocator<> : this allocator always return memory to the same thread
+// it was allocated from.
+//
+
+template <class _Tp>
+class per_thread_allocator {
+ typedef pthread_alloc _S_Alloc; // The underlying allocator.
+ typedef pthread_alloc::__state_type __state_type;
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _NewType> struct rebind {
+ typedef per_thread_allocator<_NewType> other;
+ };
+#endif
+
+ per_thread_allocator() _STLP_NOTHROW {
+ _M_state = _S_Alloc::_S_get_per_thread_state();
+ }
+ per_thread_allocator(const per_thread_allocator<_Tp>& __a) _STLP_NOTHROW : _M_state(__a._M_state){}
+
+#if defined (_STLP_MEMBER_TEMPLATES) /* && defined (_STLP_FUNCTION_PARTIAL_ORDER) */
+ template <class _OtherType> per_thread_allocator(const per_thread_allocator<_OtherType>& __a)
+ _STLP_NOTHROW : _M_state(__a._M_state) {}
+#endif
+
+ ~per_thread_allocator() _STLP_NOTHROW {}
+
+ pointer address(reference __x) const { return &__x; }
+ const_pointer address(const_reference __x) const { return &__x; }
+
+ // __n is permitted to be 0. The C++ standard says nothing about what
+ // the return value is when __n == 0.
+ _Tp* allocate(size_type __n, const void* = 0) {
+ if (__n > max_size()) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(_Tp*, _S_Alloc::allocate(__buf_size, _M_state));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+#endif
+ return __ret;
+ }
+ else
+ return 0;
+ }
+
+ void deallocate(pointer __p, size_type __n) {
+ _STLP_ASSERT( (__p == 0) == (__n == 0) )
+ if (__p != 0) {
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
+#endif
+ _S_Alloc::deallocate(__p, __n * sizeof(value_type), _M_state);
+ }
+ }
+
+ size_type max_size() const _STLP_NOTHROW
+ { return size_t(-1) / sizeof(_Tp); }
+
+ void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
+ void destroy(pointer _p) { _p->~_Tp(); }
+
+ // state is being kept here
+ __state_type* _M_state;
+
+#if defined (_STLP_NO_EXTENSIONS)
+ /* STLport extension giving rounded size of an allocated memory buffer
+ * This method do not have to be part of a user defined allocator implementation
+ * and won't even be called if such a function was granted.
+ */
+protected:
+#endif
+ _Tp* allocate(size_type __n, size_type& __allocated_n) {
+ if (__n > max_size()) {
+ _STLP_THROW_BAD_ALLOC;
+ }
+ if (__n != 0) {
+ size_type __buf_size = __n * sizeof(value_type);
+ _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size, _M_state));
+#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
+ memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
+#endif
+ __allocated_n = __buf_size / sizeof(value_type);
+ return __ret;
+ }
+ else
+ return 0;
+ }
+};
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC per_thread_allocator<void> {
+public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+ typedef void value_type;
+#ifdef _STLP_MEMBER_TEMPLATE_CLASSES
+ template <class _NewType> struct rebind {
+ typedef per_thread_allocator<_NewType> other;
+ };
+#endif
+};
+
+template <class _T1, class _T2>
+inline bool operator==(const per_thread_allocator<_T1>& __a1,
+ const per_thread_allocator<_T2>& __a2)
+{ return __a1._M_state == __a2._M_state; }
+
+#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+template <class _T1, class _T2>
+inline bool operator!=(const per_thread_allocator<_T1>& __a1,
+ const per_thread_allocator<_T2>& __a2)
+{ return __a1._M_state != __a2._M_state; }
+#endif
+
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+
+template <class _Tp, class _Atype>
+struct _Alloc_traits<_Tp, per_thread_allocator<_Atype> >
+{ typedef per_thread_allocator<_Tp> allocator_type; };
+
+#endif
+
+#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+
+template <class _Tp1, class _Tp2>
+inline per_thread_allocator<_Tp2>&
+__stl_alloc_rebind(per_thread_allocator<_Tp1>& __x, const _Tp2*)
+{ return (per_thread_allocator<_Tp2>&)__x; }
+
+template <class _Tp1, class _Tp2>
+inline per_thread_allocator<_Tp2>
+__stl_alloc_create(per_thread_allocator<_Tp1>&, const _Tp2*)
+{ return per_thread_allocator<_Tp2>(); }
+
+#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+struct __perthread_alloc_type_traits {
+ typedef typename _IsSTLportClass<per_thread_allocator<_Tp> >::_Ret _STLportAlloc;
+ //The default allocator implementation which is recognize thanks to the
+ //__stlport_class inheritance is a stateless object so:
+ typedef __false_type has_trivial_default_constructor;
+ typedef _STLportAlloc has_trivial_copy_constructor;
+ typedef _STLportAlloc has_trivial_assignment_operator;
+ typedef _STLportAlloc has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __type_traits<per_thread_allocator<_Tp> > : _STLP_PRIV __perthread_alloc_type_traits<_Tp> {};
+#else
+_STLP_TEMPLATE_NULL
+struct __type_traits<per_thread_allocator<char> > : _STLP_PRIV __perthread_alloc_type_traits<char> {};
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_TEMPLATE_NULL
+struct __type_traits<per_thread_allocator<wchar_t> > : _STLP_PRIV __perthread_alloc_type_traits<wchar_t> {};
+# endif
+# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+_STLP_TEMPLATE_NULL
+struct __type_traits<per_thread_allocator<void*> > : _STLP_PRIV __perthread_alloc_type_traits<void*> {};
+# endif
+#endif
+
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_PTHREAD_ALLOC */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_ptrs_specialize.h b/stlport/stl/_ptrs_specialize.h
new file mode 100644
index 0000000..b9cb5d8
--- /dev/null
+++ b/stlport/stl/_ptrs_specialize.h
@@ -0,0 +1,83 @@
+#ifndef _STLP_PTRS_SPECIALIZE_H
+#define _STLP_PTRS_SPECIALIZE_H
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || \
+ (defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && !defined (_STLP_NO_ARROW_OPERATOR))
+# define _STLP_POINTERS_SPECIALIZE( _TpP )
+# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); }
+#else
+# ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+# endif
+
+// the following is a workaround for arrow operator problems
+# if defined ( _STLP_NO_ARROW_OPERATOR )
+// User wants to disable proxy -> operators
+# define _STLP_DEFINE_ARROW_OPERATOR
+# else
+// Compiler can handle generic -> operator.
+# if defined (__BORLANDC__)
+# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(*(*this)); }
+# elif defined(__WATCOMC__)
+# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { reference x = operator*(); return &x; }
+# else
+# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); }
+# endif
+# endif /* _STLP_NO_ARROW_OPERATOR */
+
+// Important pointers specializations
+
+# ifdef _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+# define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type)
+# define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type)
+# else
+# define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type) _STLP_TEMPLATE_NULL struct __type_traits<_Type> : __type_traits_aux<__true_type> {};
+# define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type*) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type*) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type**) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type* const *) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type**) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type***) \
+_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type***)
+# endif
+
+# define _STLP_POINTERS_SPECIALIZE(_Type) _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type)
+
+_STLP_BEGIN_NAMESPACE
+
+# if !defined ( _STLP_NO_BOOL )
+_STLP_POINTERS_SPECIALIZE( bool )
+# endif
+_STLP_TYPE_TRAITS_POD_SPECIALIZE_V(void)
+# ifndef _STLP_NO_SIGNED_BUILTINS
+ _STLP_POINTERS_SPECIALIZE( signed char )
+# endif
+ _STLP_POINTERS_SPECIALIZE( char )
+ _STLP_POINTERS_SPECIALIZE( unsigned char )
+ _STLP_POINTERS_SPECIALIZE( short )
+ _STLP_POINTERS_SPECIALIZE( unsigned short )
+ _STLP_POINTERS_SPECIALIZE( int )
+ _STLP_POINTERS_SPECIALIZE( unsigned int )
+ _STLP_POINTERS_SPECIALIZE( long )
+ _STLP_POINTERS_SPECIALIZE( unsigned long )
+ _STLP_POINTERS_SPECIALIZE( float )
+ _STLP_POINTERS_SPECIALIZE( double )
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+ _STLP_POINTERS_SPECIALIZE( long double )
+# endif
+# if defined ( _STLP_LONG_LONG)
+ _STLP_POINTERS_SPECIALIZE( _STLP_LONG_LONG )
+ _STLP_POINTERS_SPECIALIZE( unsigned _STLP_LONG_LONG )
+# endif
+# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
+ _STLP_POINTERS_SPECIALIZE( wchar_t )
+# endif
+
+_STLP_END_NAMESPACE
+
+# undef _STLP_ARROW_SPECIALIZE
+# undef _STLP_TYPE_TRAITS_POD_SPECIALIZE_V
+
+#endif
+#endif
diff --git a/stlport/stl/_queue.h b/stlport/stl/_queue.h
new file mode 100644
index 0000000..5f3763c
--- /dev/null
+++ b/stlport/stl/_queue.h
@@ -0,0 +1,268 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_QUEUE_H
+#define _STLP_INTERNAL_QUEUE_H
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+#endif
+
+#ifndef _STLP_INTERNAL_VECTOR_H
+# include <stl/_vector.h>
+#endif
+
+#ifndef _STLP_INTERNAL_HEAP_H
+# include <stl/_heap.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+# if ! defined ( _STLP_LIMITED_DEFAULT_TEMPLATES )
+template <class _Tp, class _Sequence = deque<_Tp> >
+# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
+# define _STLP_QUEUE_ARGS _Tp
+template <class _Tp>
+# else
+template <class _Tp, class _Sequence>
+# endif
+class queue
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+# if defined (_STLP_QUEUE_ARGS)
+ : public __stlport_class<queue<_Tp> >
+# else
+ : public __stlport_class<queue<_Tp, _Sequence> >
+# endif
+#endif
+{
+# if defined ( _STLP_QUEUE_ARGS )
+ typedef deque<_Tp> _Sequence;
+ typedef queue<_Tp> _Self;
+# else
+ typedef queue<_Tp, _Sequence> _Self;
+# endif
+public:
+ typedef typename _Sequence::value_type value_type;
+ typedef typename _Sequence::size_type size_type;
+ typedef _Sequence container_type;
+
+ typedef typename _Sequence::reference reference;
+ typedef typename _Sequence::const_reference const_reference;
+
+protected:
+ //c is a Standard name (23.2.3.1), do no make it STLport naming convention compliant.
+ _Sequence c;
+public:
+ queue() : c() {}
+ explicit queue(const _Sequence& __c) : c(__c) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ queue(__move_source<_Self> src)
+ : c(_STLP_PRIV _AsMoveSource(src.get().c)) {}
+#endif
+
+ bool empty() const { return c.empty(); }
+ size_type size() const { return c.size(); }
+ reference front() { return c.front(); }
+ const_reference front() const { return c.front(); }
+ reference back() { return c.back(); }
+ const_reference back() const { return c.back(); }
+ void push(const value_type& __x) { c.push_back(__x); }
+ void pop() { c.pop_front(); }
+ const _Sequence& _Get_s() const { return c; }
+
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) {
+ _Sequence __tmp = c;
+ c = __x.c;
+ __x.c = __tmp;
+ }
+#endif
+};
+
+#ifndef _STLP_QUEUE_ARGS
+# define _STLP_QUEUE_ARGS _Tp, _Sequence
+# define _STLP_QUEUE_HEADER_ARGS class _Tp, class _Sequence
+#else
+# define _STLP_QUEUE_HEADER_ARGS class _Tp
+#endif
+
+template < _STLP_QUEUE_HEADER_ARGS >
+inline bool _STLP_CALL
+operator==(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) {
+ return __x._Get_s() == __y._Get_s();
+}
+
+template < _STLP_QUEUE_HEADER_ARGS >
+inline bool _STLP_CALL
+operator<(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) {
+ return __x._Get_s() < __y._Get_s();
+}
+
+_STLP_RELOPS_OPERATORS( template < _STLP_QUEUE_HEADER_ARGS >, queue<_STLP_QUEUE_ARGS > )
+
+# if !(defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) || defined ( _STLP_TEMPLATE_PARAM_SUBTYPE_BUG ))
+template <class _Tp, class _Sequence = vector<_Tp>,
+ class _Compare = less<_STLP_HEADER_TYPENAME _Sequence::value_type> >
+# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
+template <class _Tp>
+# else
+template <class _Tp, class _Sequence, class _Compare>
+# endif
+class priority_queue
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
+ : public __stlport_class<priority_queue<_Tp> >
+# else
+ : public __stlport_class<priority_queue<_Tp, _Sequence> >
+# endif
+#endif
+{
+# ifdef _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS
+ typedef vector<_Tp> _Sequence;
+ typedef less< typename vector<_Tp>::value_type> _Compare;
+ typedef priority_queue<_Tp> _Self;
+# else
+ typedef priority_queue<_Tp, _Sequence, _Compare> _Self;
+# endif
+public:
+ typedef typename _Sequence::value_type value_type;
+ typedef typename _Sequence::size_type size_type;
+ typedef _Sequence container_type;
+
+ typedef typename _Sequence::reference reference;
+ typedef typename _Sequence::const_reference const_reference;
+protected:
+ //c is a Standard name (23.2.3.2), do no make it STLport naming convention compliant.
+ _Sequence c;
+ _Compare comp;
+public:
+ priority_queue() : c() {}
+ explicit priority_queue(const _Compare& __x) : c(), comp(__x) {}
+ priority_queue(const _Compare& __x, const _Sequence& __s)
+ : c(__s), comp(__x)
+ { make_heap(c.begin(), c.end(), comp); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ priority_queue(__move_source<_Self> src)
+ : c(_STLP_PRIV _AsMoveSource(src.get().c)),
+ comp(_STLP_PRIV _AsMoveSource(src.get().comp)) {}
+#endif
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _InputIterator>
+ priority_queue(_InputIterator __first, _InputIterator __last)
+ : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
+
+ template <class _InputIterator>
+ priority_queue(_InputIterator __first,
+ _InputIterator __last, const _Compare& __x)
+ : c(__first, __last), comp(__x)
+ { make_heap(c.begin(), c.end(), comp); }
+
+ template <class _InputIterator>
+ priority_queue(_InputIterator __first, _InputIterator __last,
+ const _Compare& __x, const _Sequence& __s)
+ : c(__s), comp(__x)
+ {
+ c.insert(c.end(), __first, __last);
+ make_heap(c.begin(), c.end(), comp);
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ priority_queue(const value_type* __first, const value_type* __last)
+ : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
+
+ priority_queue(const value_type* __first, const value_type* __last,
+ const _Compare& __x)
+ : c(__first, __last), comp(__x)
+ { make_heap(c.begin(), c.end(), comp); }
+
+ priority_queue(const value_type* __first, const value_type* __last,
+ const _Compare& __x, const _Sequence& __c)
+ : c(__c), comp(__x)
+ {
+ c.insert(c.end(), __first, __last);
+ make_heap(c.begin(), c.end(), comp);
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ bool empty() const { return c.empty(); }
+ size_type size() const { return c.size(); }
+ const_reference top() const { return c.front(); }
+ void push(const value_type& __x) {
+ _STLP_TRY {
+ c.push_back(__x);
+ push_heap(c.begin(), c.end(), comp);
+ }
+ _STLP_UNWIND(c.clear())
+ }
+ void pop() {
+ _STLP_TRY {
+ pop_heap(c.begin(), c.end(), comp);
+ c.pop_back();
+ }
+ _STLP_UNWIND(c.clear())
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) {
+ _Sequence __tmp = c;
+ c = __x.c;
+ __x.c = __tmp;
+ }
+#endif
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Sequence>
+struct __move_traits<queue<_Tp, _Sequence> > :
+ _STLP_PRIV __move_traits_aux<_Sequence>
+{};
+
+template <class _Tp, class _Sequence, class _Compare>
+struct __move_traits<priority_queue<_Tp, _Sequence, _Compare> > :
+ _STLP_PRIV __move_traits_aux2<_Sequence, _Compare>
+{};
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_QUEUE_ARGS
+#undef _STLP_QUEUE_HEADER_ARGS
+#undef comp
+
+#endif /* _STLP_INTERNAL_QUEUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_range_errors.c b/stlport/stl/_range_errors.c
new file mode 100644
index 0000000..87293be
--- /dev/null
+++ b/stlport/stl/_range_errors.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics
+ *
+ * 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.
+ *
+ */
+
+#if defined(_STLP_THROW_RANGE_ERRORS)
+# if defined (_STLP_WHOLE_NATIVE_STD) && defined (_STLP_DONT_REDEFINE_STD)
+// In this mode we are going to throw native exception so that catch of
+// exception like std::runtime_error for instance will also catch exception
+// thrown by STLport containers like stlport::vector or stlport::string.
+# include <stdexcept>
+# include <string>
+# define _STLP_THROW_MSG(ex,msg) throw std::ex(msg)
+# else
+# if defined (__BUILDING_STLPORT)
+# include <stdexcept>
+# include <string>
+# else
+# ifndef _STLP_INTERNAL_STDEXCEPT
+# include <stl/_stdexcept.h>
+# endif
+# ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+# endif
+# endif
+# define _STLP_THROW_MSG(ex,msg) throw ex(msg)
+# endif
+#else
+# if defined (__BUILDING_STLPORT)
+# include <cstdlib>
+# include <cstdio>
+# else
+# ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+# endif
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+# endif
+# define _STLP_THROW_MSG(ex,msg) puts(msg),_STLP_ABORT()
+#endif
+
+// For mode without library and throwing range errors, include the
+// stdexcept header and throw the appropriate exceptions directly.
+
+#if defined (_STLP_EXTERN_RANGE_ERRORS)
+# define _STLP_THROW_FUNCT_SPEC void _STLP_DECLSPEC
+#else
+# define _STLP_THROW_FUNCT_SPEC inline void
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg)
+{ _STLP_THROW_MSG(runtime_error, __msg); }
+
+_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_range_error(const char* __msg)
+{ _STLP_THROW_MSG(range_error, __msg); }
+
+_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg)
+{ _STLP_THROW_MSG(out_of_range, __msg); }
+
+_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_length_error(const char* __msg)
+{ _STLP_THROW_MSG(length_error, __msg); }
+
+_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg)
+{ _STLP_THROW_MSG(invalid_argument, __msg); }
+
+_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg)
+{ _STLP_THROW_MSG(overflow_error, __msg); }
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_THROW_FUNCT_SPEC
+#undef _STLP_THROW_MSG
diff --git a/stlport/stl/_range_errors.h b/stlport/stl/_range_errors.h
new file mode 100644
index 0000000..80df26a
--- /dev/null
+++ b/stlport/stl/_range_errors.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics
+ *
+ * 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.
+ *
+ */
+
+#ifndef _STLP_RANGE_ERRORS_H
+#define _STLP_RANGE_ERRORS_H
+
+// A few places in the STL throw range errors, using standard exception
+// classes defined in <stdexcept>. This header file provides functions
+// to throw those exception objects.
+
+// _STLP_DONT_THROW_RANGE_ERRORS is a hook so that users can disable
+// this exception throwing.
+#if defined (_STLP_CAN_THROW_RANGE_ERRORS) && defined (_STLP_USE_EXCEPTIONS) && \
+ !defined (_STLP_DONT_THROW_RANGE_ERRORS)
+# define _STLP_THROW_RANGE_ERRORS
+#endif
+
+// For the STLport iostreams, only declaration here, definition is in the lib
+#if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_EXTERN_RANGE_ERRORS)
+# define _STLP_EXTERN_RANGE_ERRORS
+#endif
+
+_STLP_BEGIN_NAMESPACE
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg);
+void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg);
+
+#if defined (__DMC__) && !defined (_STLP_NO_EXCEPTIONS)
+# pragma noreturn(__stl_throw_runtime_error)
+# pragma noreturn(__stl_throw_range_error)
+# pragma noreturn(__stl_throw_out_of_range)
+# pragma noreturn(__stl_throw_length_error)
+# pragma noreturn(__stl_throw_invalid_argument)
+# pragma noreturn(__stl_throw_overflow_error)
+#endif
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_EXTERN_RANGE_ERRORS)
+# include <stl/_range_errors.c>
+#endif
+
+#endif /* _STLP_RANGE_ERRORS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_raw_storage_iter.h b/stlport/stl/_raw_storage_iter.h
similarity index 100%
rename from stl/_raw_storage_iter.h
rename to stlport/stl/_raw_storage_iter.h
diff --git a/stl/_relops_cont.h b/stlport/stl/_relops_cont.h
similarity index 100%
rename from stl/_relops_cont.h
rename to stlport/stl/_relops_cont.h
diff --git a/stl/_relops_hash_cont.h b/stlport/stl/_relops_hash_cont.h
similarity index 100%
rename from stl/_relops_hash_cont.h
rename to stlport/stl/_relops_hash_cont.h
diff --git a/stlport/stl/_rope.c b/stlport/stl/_rope.c
new file mode 100644
index 0000000..196ee22
--- /dev/null
+++ b/stlport/stl/_rope.c
@@ -0,0 +1,1407 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
+// if necessary. Assumes path_end[leaf_index] and leaf_pos are correct.
+// Results in a valid buf_ptr if the iterator can be legitimately
+// dereferenced.
+#ifndef _STLP_ROPEIMPL_H
+#define _STLP_ROPEIMPL_H
+
+#ifndef _STLP_INTERNAL_ROPE_H
+# include <stl/_rope.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+#endif
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+# ifndef _STLP_INTERNAL_OSTREAM_H
+# include <stl/_ostream.h>
+# endif
+
+# ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+# endif
+#endif
+
+#include <stl/_range_errors.h>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+# define __allocator__ _Alloc
+#else
+# define __allocator__ allocator_type
+#endif
+
+template<class _CharT, class _Alloc>
+_Rope_iterator<_CharT, _Alloc>::_Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos)
+ : _Rope_iterator_base<_CharT,_Alloc>(__r->_M_tree_ptr._M_data, __pos),
+ _M_root_rope(__r) { _RopeRep::_S_ref(this->_M_root); }
+
+template<class _CharT, class _Alloc>
+_Rope_iterator<_CharT, _Alloc>::_Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos):
+ _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr._M_data, __pos),
+ _M_root_rope(&__r) {
+#if !defined (__DMC__)
+ _RopeRep::_S_ref(this->_M_root); if (!(__r.empty()))_S_setcache(*this);
+#else
+ _Rope_iterator_base<_CharT, _Alloc>* __x = this;
+ _RopeRep::_S_ref(this->_M_root); if (!(__r.empty()))_S_setcache(*__x);
+#endif
+}
+
+template<class _CharT, class _Alloc>
+void _Rope_RopeRep<_CharT, _Alloc>::_M_free_c_string() {
+ _CharT* __cstr = _M_c_string;
+ if (0 != __cstr) {
+ size_t _p_size = _M_size._M_data + 1;
+ _STLP_STD::_Destroy_Range(__cstr, __cstr + _p_size);
+ _M_size.deallocate(__cstr, _p_size);
+ }
+}
+
+// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
+// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct.
+// Results in a valid buf_ptr if the iterator can be legitimately
+// dereferenced.
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf(
+ _Rope_iterator_base<_CharT,_Alloc>& __x) {
+ const _RopeRep* __leaf = __x._M_path_end._M_data[__x._M_leaf_index];
+ size_t __leaf_pos = __x._M_leaf_pos;
+ size_t __pos = __x._M_current_pos;
+
+ switch(__leaf->_M_tag) {
+ case _RopeRep::_S_leaf:
+ typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf;
+ __x._M_buf_start = __STATIC_CAST(const _RopeLeaf*, __leaf)->_M_data;
+ __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos);
+ __x._M_buf_end = __x._M_buf_start + __leaf->_M_size._M_data;
+ break;
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ {
+ size_t __len = _S_iterator_buf_len;
+ size_t __buf_start_pos = __leaf_pos;
+ size_t __leaf_end = __leaf_pos + __leaf->_M_size._M_data;
+ typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction;
+ char_producer<_CharT>* __fn = __STATIC_CAST(const _RopeFunction*, __leaf)->_M_fn;
+
+ if (__buf_start_pos + __len <= __pos) {
+ __buf_start_pos = __pos - __len/4;
+ if (__buf_start_pos + __len > __leaf_end) {
+ __buf_start_pos = __leaf_end - __len;
+ }
+ }
+ if (__buf_start_pos + __len > __leaf_end) {
+ __len = __leaf_end - __buf_start_pos;
+ }
+ (*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf._M_data);
+ __x._M_buf_ptr = __x._M_tmp_buf._M_data + (__pos - __buf_start_pos);
+ __x._M_buf_start = __x._M_tmp_buf._M_data;
+ __x._M_buf_end = __x._M_tmp_buf._M_data + __len;
+ }
+ break;
+ default:
+ _STLP_ASSERT(0)
+ ;
+ }
+}
+
+// Set path and buffer inside a rope iterator. We assume that
+// pos and root are already set.
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache(
+ _Rope_iterator_base<_CharT,_Alloc>& __x) {
+ const _RopeRep* __path[_RopeRep::_S_max_rope_depth+1];
+ const _RopeRep* __curr_rope;
+ int __curr_depth = -1; /* index into path */
+ size_t __curr_start_pos = 0;
+ size_t __pos = __x._M_current_pos;
+ unsigned char __dirns = 0; // Bit vector marking right turns in the path
+
+ _STLP_ASSERT(__pos <= __x._M_root->_M_size._M_data)
+ if (__pos >= __x._M_root->_M_size._M_data) {
+ __x._M_buf_ptr = 0;
+ return;
+ }
+ __curr_rope = __x._M_root;
+ if (0 != __curr_rope->_M_c_string) {
+ /* Treat the root as a leaf. */
+ __x._M_buf_start = __curr_rope->_M_c_string;
+ __x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size._M_data;
+ __x._M_buf_ptr = __curr_rope->_M_c_string + __pos;
+ __x._M_path_end._M_data[0] = __curr_rope;
+ __x._M_leaf_index = 0;
+ __x._M_leaf_pos = 0;
+ return;
+ }
+ for(;;) {
+ ++__curr_depth;
+ _STLP_ASSERT(__curr_depth <= _RopeRep::_S_max_rope_depth)
+ __path[__curr_depth] = __curr_rope;
+ switch(__curr_rope->_M_tag) {
+ case _RopeRep::_S_leaf:
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ __x._M_leaf_pos = __curr_start_pos;
+ goto done;
+ case _RopeRep::_S_concat:
+ {
+ const _RopeConcat* __c = __STATIC_CAST(const _RopeConcat*, __curr_rope);
+ _RopeRep* __left = __c->_M_left;
+ size_t __left_len = __left->_M_size._M_data;
+
+ __dirns <<= 1;
+ if (__pos >= __curr_start_pos + __left_len) {
+ __dirns |= 1;
+ __curr_rope = __c->_M_right;
+ __curr_start_pos += __left_len;
+ } else {
+ __curr_rope = __left;
+ }
+ }
+ break;
+ }
+ }
+done:
+ // Copy last section of path into _M_path_end.
+ {
+ int __i = -1;
+ int __j = __curr_depth + 1 - _S_path_cache_len;
+
+ if (__j < 0) __j = 0;
+ while (__j <= __curr_depth) {
+ __x._M_path_end._M_data[++__i] = __path[__j++];
+ }
+ __x._M_leaf_index = __i;
+ }
+ __x._M_path_directions = __dirns;
+ _S_setbuf(__x);
+}
+
+// Specialized version of the above. Assumes that
+// the path cache is valid for the previous position.
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache_for_incr(
+_Rope_iterator_base<_CharT,_Alloc>& __x) {
+ int __current_index = __x._M_leaf_index;
+ const _RopeRep* __current_node = __x._M_path_end._M_data[__current_index];
+ size_t __len = __current_node->_M_size._M_data;
+ size_t __node_start_pos = __x._M_leaf_pos;
+ unsigned char __dirns = __x._M_path_directions;
+ const _RopeConcat* __c;
+
+ _STLP_ASSERT(__x._M_current_pos <= __x._M_root->_M_size._M_data)
+ if (__x._M_current_pos - __node_start_pos < __len) {
+ /* More stuff in this leaf, we just didn't cache it. */
+ _S_setbuf(__x);
+ return;
+ }
+ _STLP_ASSERT(__node_start_pos + __len == __x._M_current_pos)
+ // node_start_pos is starting position of last_node.
+ while (--__current_index >= 0) {
+ if (!(__dirns & 1) /* Path turned left */)
+ break;
+ __current_node = __x._M_path_end._M_data[__current_index];
+ __c = __STATIC_CAST(const _RopeConcat*, __current_node);
+ // Otherwise we were in the right child. Thus we should pop
+ // the concatenation node.
+ __node_start_pos -= __c->_M_left->_M_size._M_data;
+ __dirns >>= 1;
+ }
+ if (__current_index < 0) {
+ // We underflowed the cache. Punt.
+ _S_setcache(__x);
+ return;
+ }
+ __current_node = __x._M_path_end._M_data[__current_index];
+ __c = __STATIC_CAST(const _RopeConcat*, __current_node);
+ // current_node is a concatenation node. We are positioned on the first
+ // character in its right child.
+ // node_start_pos is starting position of current_node.
+ __node_start_pos += __c->_M_left->_M_size._M_data;
+ __current_node = __c->_M_right;
+ __x._M_path_end._M_data[++__current_index] = __current_node;
+ __dirns |= 1;
+ while (_RopeRep::_S_concat == __current_node->_M_tag) {
+ ++__current_index;
+ if (_S_path_cache_len == __current_index) {
+ int __i;
+ for (__i = 0; __i < _S_path_cache_len-1; ++__i) {
+ __x._M_path_end._M_data[__i] = __x._M_path_end._M_data[__i+1];
+ }
+ --__current_index;
+ }
+ __current_node = __STATIC_CAST(const _RopeConcat*, __current_node)->_M_left;
+ __x._M_path_end._M_data[__current_index] = __current_node;
+ __dirns <<= 1;
+ // node_start_pos is unchanged.
+ }
+ __x._M_leaf_index = __current_index;
+ __x._M_leaf_pos = __node_start_pos;
+ __x._M_path_directions = __dirns;
+ _S_setbuf(__x);
+}
+
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_M_incr(size_t __n) {
+ _M_current_pos += __n;
+ if (0 != _M_buf_ptr) {
+ size_t __chars_left = _M_buf_end - _M_buf_ptr;
+ if (__chars_left > __n) {
+ _M_buf_ptr += __n;
+ } else if (__chars_left == __n) {
+ _M_buf_ptr += __n;
+ _S_setcache_for_incr(*this);
+ } else {
+ _M_buf_ptr = 0;
+ }
+ }
+}
+
+template <class _CharT, class _Alloc>
+void _Rope_iterator_base<_CharT,_Alloc>::_M_decr(size_t __n) {
+ if (0 != _M_buf_ptr) {
+ size_t __chars_left = _M_buf_ptr - _M_buf_start;
+ if (__chars_left >= __n) {
+ _M_buf_ptr -= __n;
+ } else {
+ _M_buf_ptr = 0;
+ }
+ }
+ _M_current_pos -= __n;
+}
+
+template <class _CharT, class _Alloc>
+void _Rope_iterator<_CharT,_Alloc>::_M_check() {
+ if (_M_root_rope->_M_tree_ptr._M_data != this->_M_root) {
+ // _Rope was modified. Get things fixed up.
+ _RopeRep::_S_unref(this->_M_root);
+ this->_M_root = _M_root_rope->_M_tree_ptr._M_data;
+ _RopeRep::_S_ref(this->_M_root);
+ this->_M_buf_ptr = 0;
+ }
+}
+
+// There are several reasons for not doing this with virtual destructors
+// and a class specific delete operator:
+// - A class specific delete operator can't easily get access to
+// allocator instances if we need them.
+// - Any virtual function would need a 4 or byte vtable pointer;
+// this only requires a one byte tag per object.
+template <class _CharT, class _Alloc>
+void _Rope_RopeRep<_CharT,_Alloc>::_M_free_tree() {
+ switch (_M_tag) {
+ case _S_leaf:
+ {
+ typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf;
+ _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, this);
+ _STLP_STD::_Destroy(__l); // ->_Rope_RopeLeaf<_CharT,_Alloc>::~_Rope_RopeLeaf();
+ _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size,
+ _RopeLeaf).deallocate(__l, 1);
+ break;
+ }
+ case _S_concat:
+ {
+ typedef _Rope_RopeConcatenation<_CharT, _Alloc> _RopeConcatenation;
+ _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, this);
+ _STLP_STD::_Destroy(__c);
+ _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size,
+ _RopeConcatenation).deallocate(__c, 1);
+ break;
+ }
+ case _S_function:
+ {
+ typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction;
+ _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, this);
+ _STLP_STD::_Destroy(__f);
+ _STLP_CREATE_ALLOCATOR(allocator_type, (const allocator_type&)_M_size,
+ _RopeFunction).deallocate(__f, 1);
+ break;
+ }
+ case _S_substringfn:
+ {
+ typedef _Rope_RopeSubstring<_CharT, _Alloc> _RopeSubstring;
+ _RopeSubstring* __rss = __STATIC_CAST(_RopeSubstring*, this);
+ _STLP_STD::_Destroy(__rss);
+ _STLP_CREATE_ALLOCATOR(allocator_type, (const allocator_type&)_M_size,
+ _RopeSubstring).deallocate(__rss, 1);
+ break;
+ }
+ }
+}
+
+# if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+# define __RopeLeaf__ _Rope_RopeLeaf<_CharT,_Alloc>
+# define __RopeRep__ _Rope_RopeRep<_CharT,_Alloc>
+# define _RopeLeaf _Rope_RopeLeaf<_CharT,_Alloc>
+# define _RopeRep _Rope_RopeRep<_CharT,_Alloc>
+# define size_type size_t
+# else
+# define __RopeLeaf__ _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeLeaf
+# define __RopeRep__ _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeRep
+# endif
+
+template <class _CharT, class _Alloc>
+void rope<_CharT, _Alloc>::_M_throw_out_of_range() const {
+ __stl_throw_out_of_range("rope");
+}
+
+// Concatenate a C string onto a leaf rope by copying the rope data.
+// Used for short ropes.
+template <class _CharT, class _Alloc>
+__RopeLeaf__*
+rope<_CharT,_Alloc>::_S_leaf_concat_char_iter (
+ _RopeLeaf* __r, const _CharT* __iter, size_t __len) {
+ size_t __old_len = __r->_M_size._M_data;
+ _CharT* __new_data = __r->_M_size.allocate(_S_rounded_up_size(__old_len + __len));
+ _RopeLeaf* __result;
+
+ _STLP_PRIV __ucopy_n(__r->_M_data, __old_len, __new_data);
+ _STLP_PRIV __ucopy_n(__iter, __len, __new_data + __old_len);
+ _S_construct_null(__new_data + __old_len + __len);
+ _STLP_TRY {
+ __result = _S_new_RopeLeaf(__new_data, __old_len + __len, __r->get_allocator());
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__new_data, __old_len + __len,
+ __r->get_allocator()))
+ return __result;
+}
+
+template <class _CharT, class _Alloc>
+void _Terminate_RopeLeaf(_Rope_RopeLeaf<_CharT,_Alloc> *__r,
+ size_t __size, const __true_type& /*basic char type*/) {
+ _S_construct_null(__r->_M_data + __size);
+ _STLP_ASSERT(__r->_M_c_string == __r->_M_data)
+}
+
+template <class _CharT, class _Alloc>
+void _Terminate_RopeLeaf(_Rope_RopeLeaf<_CharT,_Alloc> *__r,
+ size_t, const __false_type& /*basic char type*/) {
+ if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string) {
+ __r->_M_free_c_string();
+ __r->_M_c_string = 0;
+ }
+}
+
+// As above, but it's OK to clobber original if refcount is 1
+template <class _CharT, class _Alloc>
+__RopeLeaf__*
+rope<_CharT,_Alloc>::_S_destr_leaf_concat_char_iter (_RopeLeaf* __r, const _CharT* __iter, size_t __len) {
+ //_STLP_ASSERT(__r->_M_ref_count >= 1)
+ if ( /* __r->_M_ref_count > 1 */ __r->_M_incr() > 2 ) { // - ptr
+ __r->_M_decr(); // - ptr
+ return _S_leaf_concat_char_iter(__r, __iter, __len);
+ }
+ __r->_M_decr(); // - ptr, __r->_M_ref_count == 1 or 0
+ size_t __old_len = __r->_M_size._M_data;
+ if (_S_rounded_up_size(__old_len) == _S_rounded_up_size(__old_len + __len)) {
+ // The space has been partially initialized for the standard
+ // character types. But that doesn't matter for those types.
+ _STLP_PRIV __ucopy_n(__iter, __len, __r->_M_data + __old_len);
+ _Terminate_RopeLeaf(__r, __old_len + __len, _IsBasicCharType());
+ __r->_M_size._M_data = __old_len + __len;
+ // _STLP_ASSERT(__r->_M_ref_count == 1)
+ // __r->_M_ref_count = 2;
+ __r->_M_incr(); // i.e. __r->_M_ref_count = 2
+ return __r;
+ } else {
+ _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len);
+ //_STLP_ASSERT(__result->_M_ref_count == 1)
+ return __result;
+ }
+}
+
+// Assumes left and right are not 0.
+// Does not increment (nor decrement on exception) child reference counts.
+// Result has ref count 1.
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right) {
+ _RopeConcatenation* __result =
+ _S_new_RopeConcatenation(__left, __right, __left->get_allocator());
+ size_t __depth = __result->_M_depth;
+
+ _STLP_ASSERT(__left->get_allocator() == __right->get_allocator())
+ if (__depth > 20 && (__result->_M_size._M_data < 1000 ||
+ __depth > _RopeRep::_S_max_rope_depth)) {
+ _RopeRep* __balanced;
+
+ _STLP_TRY {
+ __balanced = _S_balance(__result);
+ // _STLP_ASSERT(__result == __balanced ||
+ // 1 == __result->_M_ref_count &&
+ // 1 == __balanced->_M_ref_count)
+ __result->_M_unref_nonnil();
+ }
+ _STLP_UNWIND((_STLP_CREATE_ALLOCATOR(allocator_type,(allocator_type&)__left->_M_size,
+ _RopeConcatenation).deallocate(__result,1)))
+ // In case of exception, we need to deallocate
+ // otherwise dangling result node. But caller
+ // still owns its children. Thus unref is
+ // inappropriate.
+ return __balanced;
+ } else {
+ return __result;
+ }
+}
+
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_concat_char_iter (_RopeRep* __r,
+ const _CharT*__s, size_t __slen) {
+ _RopeRep* __result;
+ if (0 == __slen) {
+ _S_ref(__r);
+ return __r;
+ }
+ if (0 == __r)
+ return _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator());
+ if (_RopeRep::_S_leaf == __r->_M_tag &&
+ __r->_M_size._M_data + __slen <= _S_copy_max) {
+ __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+ }
+ if (_RopeRep::_S_concat == __r->_M_tag &&
+ _RopeRep::_S_leaf == ((_RopeConcatenation*)__r)->_M_right->_M_tag) {
+ _RopeLeaf* __right = (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right);
+ if (__right->_M_size._M_data + __slen <= _S_copy_max) {
+ _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left;
+ _RopeRep* __nright = _S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen);
+ __left->_M_ref_nonnil();
+ _STLP_TRY {
+ __result = _S_tree_concat(__left, __nright);
+ }
+ _STLP_UNWIND(_S_unref(__left); _S_unref(__nright))
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+ }
+ }
+ _RopeRep* __nright =
+ _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator());
+ _STLP_TRY {
+ __r->_M_ref_nonnil();
+ __result = _S_tree_concat(__r, __nright);
+ }
+ _STLP_UNWIND(_S_unref(__r); _S_unref(__nright))
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+}
+
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_destr_concat_char_iter(
+ _RopeRep* __r, const _CharT* __s, size_t __slen) {
+ _RopeRep* __result;
+ if (0 == __r)
+ return _S_RopeLeaf_from_unowned_char_ptr(__s, __slen,
+ __r->get_allocator());
+ // size_t __count = __r->_M_ref_count;
+ size_t __orig_size = __r->_M_size._M_data;
+ // _STLP_ASSERT(__count >= 1)
+ if ( /* __count > 1 */ __r->_M_incr() > 2 ) {
+ __r->_M_decr();
+ return _S_concat_char_iter(__r, __s, __slen);
+ }
+ if (0 == __slen) {
+ return __r;
+ }
+ __r->_M_decr();
+ if (__orig_size + __slen <= _S_copy_max && _RopeRep::_S_leaf == __r->_M_tag) {
+ return _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
+ }
+ if (_RopeRep::_S_concat == __r->_M_tag) {
+ _RopeLeaf* __right = __STATIC_CAST(_RopeLeaf*, __STATIC_CAST(_RopeConcatenation*, __r)->_M_right);
+ if (_RopeRep::_S_leaf == __right->_M_tag &&
+ __right->_M_size._M_data + __slen <= _S_copy_max) {
+ _RopeRep* __new_right = _S_destr_leaf_concat_char_iter(__right, __s, __slen);
+ if (__right == __new_right) {
+ // _STLP_ASSERT(__new_right->_M_ref_count == 2)
+ // __new_right->_M_ref_count = 1;
+ __new_right->_M_decr();
+ } else {
+ // _STLP_ASSERT(__new_right->_M_ref_count >= 1)
+ __right->_M_unref_nonnil();
+ }
+ // _STLP_ASSERT(__r->_M_ref_count == 1)
+ // __r->_M_ref_count = 2; // One more than before.
+ __r->_M_incr();
+ __STATIC_CAST(_RopeConcatenation*, __r)->_M_right = __new_right;
+ // E.Musser : moved below
+ // __r->_M_size._M_data = __orig_size + __slen;
+ if (0 != __r->_M_c_string) {
+ __r->_M_free_c_string();
+ __r->_M_c_string = 0;
+ }
+ __r->_M_size._M_data = __orig_size + __slen;
+ return __r;
+ }
+ }
+ _RopeRep* __right =
+ _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator());
+ __r->_M_ref_nonnil();
+ _STLP_TRY {
+ __result = _S_tree_concat(__r, __right);
+ }
+ _STLP_UNWIND(_S_unref(__r); _S_unref(__right))
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+}
+
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_concat_rep(_RopeRep* __left, _RopeRep* __right) {
+ if (0 == __left) {
+ _S_ref(__right);
+ return __right;
+ }
+ if (0 == __right) {
+ __left->_M_ref_nonnil();
+ return __left;
+ }
+ if (_RopeRep::_S_leaf == __right->_M_tag) {
+ if (_RopeRep::_S_leaf == __left->_M_tag) {
+ if (__right->_M_size._M_data + __left->_M_size._M_data <= _S_copy_max) {
+ return _S_leaf_concat_char_iter(__STATIC_CAST(_RopeLeaf*, __left),
+ __STATIC_CAST(_RopeLeaf*, __right)->_M_data,
+ __right->_M_size._M_data);
+ }
+ } else if (_RopeRep::_S_concat == __left->_M_tag &&
+ _RopeRep::_S_leaf == __STATIC_CAST(_RopeConcatenation*, __left)->_M_right->_M_tag) {
+ _RopeLeaf* __leftright =
+ __STATIC_CAST(_RopeLeaf*, __STATIC_CAST(_RopeConcatenation*, __left)->_M_right);
+ if (__leftright->_M_size._M_data + __right->_M_size._M_data <= _S_copy_max) {
+ _RopeRep* __leftleft = __STATIC_CAST(_RopeConcatenation*, __left)->_M_left;
+ _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright,
+ __STATIC_CAST(_RopeLeaf*, __right)->_M_data,
+ __right->_M_size._M_data);
+ __leftleft->_M_ref_nonnil();
+ _STLP_TRY {
+ return _S_tree_concat(__leftleft, __rest);
+ }
+ _STLP_UNWIND(_S_unref(__leftleft); _S_unref(__rest))
+ }
+ }
+ }
+ __left->_M_ref_nonnil();
+ __right->_M_ref_nonnil();
+ _STLP_TRY {
+ return _S_tree_concat(__left, __right);
+ }
+ _STLP_UNWIND(_S_unref(__left); _S_unref(__right))
+ _STLP_RET_AFTER_THROW(0)
+}
+
+template <class _CharT, class _Alloc>
+__RopeRep__*
+rope<_CharT,_Alloc>::_S_substring(_RopeRep* __base,
+ size_t __start, size_t __endp1) {
+ if (0 == __base) return 0;
+ size_t __len = __base->_M_size._M_data;
+ size_t __adj_endp1;
+ const size_t __lazy_threshold = 128;
+
+ if (__endp1 >= __len) {
+ if (0 == __start) {
+ __base->_M_ref_nonnil();
+ return __base;
+ } else {
+ __adj_endp1 = __len;
+ }
+ } else {
+ __adj_endp1 = __endp1;
+ }
+ switch(__base->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __base);
+ _RopeRep* __left = __c->_M_left;
+ _RopeRep* __right = __c->_M_right;
+ size_t __left_len = __left->_M_size._M_data;
+ _RopeRep* __result;
+
+ if (__adj_endp1 <= __left_len) {
+ return _S_substring(__left, __start, __endp1);
+ } else if (__start >= __left_len) {
+ return _S_substring(__right, __start - __left_len,
+ __adj_endp1 - __left_len);
+ }
+ _Self_destruct_ptr __left_result(_S_substring(__left, __start, __left_len));
+ _Self_destruct_ptr __right_result(_S_substring(__right, 0, __endp1 - __left_len));
+ _STLP_MPWFIX_TRY //*TY 06/01/2000 - mpw forgets to call dtor on __left_result and __right_result without this try block
+ __result = _S_concat_rep(__left_result, __right_result);
+ // _STLP_ASSERT(1 == __result->_M_ref_count)
+ return __result;
+ _STLP_MPWFIX_CATCH //*TY 06/01/2000 -
+ }
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __base);
+ _RopeLeaf* __result;
+ size_t __result_len;
+ if (__start >= __adj_endp1) return 0;
+ __result_len = __adj_endp1 - __start;
+ if (__result_len > __lazy_threshold) goto lazy;
+ const _CharT* __section = __l->_M_data + __start;
+ // We should sometimes create substring node instead.
+ __result = _S_RopeLeaf_from_unowned_char_ptr(__section, __result_len,
+ __base->get_allocator());
+ return __result;
+ }
+ case _RopeRep::_S_substringfn:
+ // Avoid introducing multiple layers of substring nodes.
+ {
+ _RopeSubstring* __old = __STATIC_CAST(_RopeSubstring*, __base);
+ size_t __result_len;
+ if (__start >= __adj_endp1) return 0;
+ __result_len = __adj_endp1 - __start;
+ if (__result_len > __lazy_threshold) {
+ _RopeSubstring* __result = _S_new_RopeSubstring(__old->_M_base,
+ __start + __old->_M_start,
+ __adj_endp1 - __start,
+ __base->get_allocator());
+ return __result;
+ } // *** else fall through: ***
+ }
+ case _RopeRep::_S_function:
+ {
+ _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __base);
+ if (__start >= __adj_endp1) return 0;
+ size_t __result_len = __adj_endp1 - __start;
+
+ if (__result_len > __lazy_threshold) goto lazy;
+ _CharT* __section = __base->_M_size.allocate(_S_rounded_up_size(__result_len));
+ _STLP_TRY {
+ (*(__f->_M_fn))(__start, __result_len, __section);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__section,
+ __result_len, __base->get_allocator()))
+ _S_construct_null(__section + __result_len);
+ return _S_new_RopeLeaf(__section, __result_len,
+ __base->get_allocator());
+ }
+ }
+ /*NOTREACHED*/
+ _STLP_ASSERT(false)
+ lazy:
+ {
+ // Create substring node.
+ return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start,
+ __base->get_allocator());
+ }
+}
+
+template<class _CharT>
+class _Rope_flatten_char_consumer : public _Rope_char_consumer<_CharT> {
+private:
+ _CharT* _M_buf_ptr;
+public:
+ _Rope_flatten_char_consumer(_CharT* __buffer) {
+ _M_buf_ptr = __buffer;
+ }
+ ~_Rope_flatten_char_consumer() {}
+ bool operator() (const _CharT* __leaf, size_t __n) {
+ _STLP_PRIV __ucopy_n(__leaf, __n, _M_buf_ptr);
+ _M_buf_ptr += __n;
+ return true;
+ }
+};
+
+template<class _CharT>
+class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> {
+private:
+ _CharT _M_pattern;
+public:
+ size_t _M_count; // Number of nonmatching characters
+ _Rope_find_char_char_consumer(_CharT __p)
+ : _M_pattern(__p), _M_count(0) {}
+ ~_Rope_find_char_char_consumer() {}
+ bool operator() (const _CharT* __leaf, size_t __n) {
+ size_t __i;
+ for (__i = 0; __i < __n; ++__i) {
+ if (__leaf[__i] == _M_pattern) {
+ _M_count += __i; return false;
+ }
+ }
+ _M_count += __n; return true;
+ }
+};
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+template<class _CharT, class _Traits>
+// Here _CharT is both the stream and rope character type.
+class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> {
+private:
+ typedef basic_ostream<_CharT,_Traits> _Insert_ostream;
+ typedef _Rope_insert_char_consumer<_CharT,_Traits> _Self;
+ _Insert_ostream& _M_o;
+
+ //explicitely defined as private to avoid warnings:
+ _Self& operator = (_Self const&);
+public:
+ _Rope_insert_char_consumer(_Insert_ostream& __writer)
+ : _M_o(__writer) {}
+ ~_Rope_insert_char_consumer() {}
+ // Caller is presumed to own the ostream
+ bool operator() (const _CharT* __leaf, size_t __n);
+ // Returns true to continue traversal.
+};
+
+template<class _CharT, class _Traits>
+bool _Rope_insert_char_consumer<_CharT, _Traits>::operator()
+ (const _CharT* __leaf, size_t __n) {
+ size_t __i;
+ // We assume that formatting is set up correctly for each element.
+ for (__i = 0; __i < __n; ++__i) _M_o.put(__leaf[__i]);
+ return true;
+}
+#endif /* !_STLP_USE_NO_IOSTREAMS */
+
+template <class _CharT, class _Alloc, class _CharConsumer>
+bool _S_apply_to_pieces(_CharConsumer& __c,
+ _Rope_RopeRep<_CharT, _Alloc> * __r,
+ size_t __begin, size_t __end) {
+ typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
+ typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation;
+ typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
+ typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
+
+ if (0 == __r) return true;
+ switch(__r->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __conc = __STATIC_CAST(_RopeConcatenation*, __r);
+ _RopeRep* __left = __conc->_M_left;
+ size_t __left_len = __left->_M_size._M_data;
+ if (__begin < __left_len) {
+ size_t __left_end = (min) (__left_len, __end);
+ if (!_S_apply_to_pieces(__c, __left, __begin, __left_end))
+ return false;
+ }
+ if (__end > __left_len) {
+ _RopeRep* __right = __conc->_M_right;
+ size_t __right_start = (max)(__left_len, __begin);
+ if (!_S_apply_to_pieces(__c, __right,
+ __right_start - __left_len,
+ __end - __left_len)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r);
+ return __c(__l->_M_data + __begin, __end - __begin);
+ }
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ {
+ _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r);
+ size_t __len = __end - __begin;
+ bool __result;
+ _CharT* __buffer = __r->get_allocator().allocate(__len);
+ _STLP_TRY {
+ (*(__f->_M_fn))(__begin, __len, __buffer);
+ __result = __c(__buffer, __len);
+ __r->get_allocator().deallocate(__buffer, __len);
+ }
+ _STLP_UNWIND((__r->get_allocator().deallocate(__buffer, __len)))
+ return __result;
+ }
+ default:
+ _STLP_ASSERT(false)
+ /*NOTREACHED*/
+ return false;
+ }
+}
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+template<class _CharT, class _Traits>
+inline void _Rope_fill(basic_ostream<_CharT, _Traits>& __o, streamsize __n) {
+ char __f = __o.fill();
+ for (streamsize __i = 0; __i < __n; ++__i) __o.put(__f);
+}
+
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& _S_io_get(basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r, const __true_type& /*_IsBasicCharType*/) {
+ streamsize __w = __o.width();
+ const bool __left = (__o.flags() & ios::left) != 0;
+ size_t __rope_len = __r.size();
+ _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
+
+ const bool __need_pad = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __rope_len) < __w)) ||
+ ((sizeof(streamsize) <= sizeof(size_t)) && (__rope_len < __STATIC_CAST(size_t, __w))));
+ streamsize __pad_len = __need_pad ? __w - __rope_len : 0;
+
+ if (!__left && __pad_len > 0) {
+ _Rope_fill(__o, __pad_len);
+ }
+ __r.apply_to_pieces(0, __rope_len, __c);
+ if (__left && __pad_len > 0) {
+ _Rope_fill(__o, __pad_len);
+ }
+ return __o;
+}
+
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& _S_io_get(basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r, const __false_type& /*_IsBasicCharType*/) {
+ streamsize __w = __o.width();
+ size_t __rope_len = __r.size();
+ _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
+
+ __o.width(__w /__rope_len);
+ _STLP_TRY {
+ __r.apply_to_pieces(0, __rope_len, __c);
+ __o.width(__w);
+ }
+ _STLP_UNWIND(__o.width(__w))
+ return __o;
+}
+
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r) {
+ typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral;
+ return _S_io_get(__o, __r, _Char_Is_Integral());
+}
+#endif /* NO_IOSTREAMS */
+
+template <class _CharT, class _Alloc>
+_CharT* rope<_CharT,_Alloc>::_S_flatten(_RopeRep* __r,
+ size_t __start, size_t __len,
+ _CharT* __buffer) {
+ _Rope_flatten_char_consumer<_CharT> __c(__buffer);
+ _S_apply_to_pieces(__c, __r, __start, __start + __len);
+ return(__buffer + __len);
+}
+
+template <class _CharT, class _Alloc>
+size_t rope<_CharT,_Alloc>::find(_CharT __pattern, size_t __start) const {
+ _Rope_find_char_char_consumer<_CharT> __c(__pattern);
+ _S_apply_to_pieces(__c, _M_tree_ptr._M_data, __start, size());
+ size_type __result_pos = __start + __c._M_count;
+#ifndef _STLP_OLD_ROPE_SEMANTICS
+ if (__result_pos == size()) __result_pos = npos;
+#endif
+ return __result_pos;
+}
+
+template <class _CharT, class _Alloc>
+_CharT*
+rope<_CharT,_Alloc>::_S_flatten(_Rope_RopeRep<_CharT, _Alloc>* __r, _CharT* __buffer) {
+ if (0 == __r) return __buffer;
+ switch(__r->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __r);
+ _RopeRep* __left = __c->_M_left;
+ _RopeRep* __right = __c->_M_right;
+ _CharT* __rest = _S_flatten(__left, __buffer);
+ return _S_flatten(__right, __rest);
+ }
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r);
+ return _STLP_PRIV __ucopy_n(__l->_M_data, __l->_M_size._M_data, __buffer).second;
+ }
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ // We dont yet do anything with substring nodes.
+ // This needs to be fixed before ropefiles will work well.
+ {
+ _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r);
+ (*(__f->_M_fn))(0, __f->_M_size._M_data, __buffer);
+ return __buffer + __f->_M_size._M_data;
+ }
+ default:
+ _STLP_ASSERT(false)
+ /*NOTREACHED*/
+ return 0;
+ }
+}
+
+#ifdef _STLP_DEBUG
+// This needs work for _CharT != char
+template <class _CharT, class _Alloc>
+void rope<_CharT,_Alloc>::_S_dump(_RopeRep* __r, int __indent) {
+ for (int __i = 0; __i < __indent; ++__i) putchar(' ');
+ if (0 == __r) {
+ printf("NULL\n"); return;
+ }
+ if (_RopeRep::_S_concat == __r->_M_tag) {
+ _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __r);
+ _RopeRep* __left = __c->_M_left;
+ _RopeRep* __right = __c->_M_right;
+ printf("Concatenation %p (rc = %ld, depth = %d, len = %ld, %s balanced)\n",
+ __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size._M_data,
+ __r->_M_is_balanced? "" : "not");
+ _S_dump(__left, __indent + 2);
+ _S_dump(__right, __indent + 2);
+ return;
+ }
+ else {
+ const char* __kind;
+
+ switch (__r->_M_tag) {
+ case _RopeRep::_S_leaf:
+ __kind = "Leaf";
+ break;
+ case _RopeRep::_S_function:
+ __kind = "Function";
+ break;
+ case _RopeRep::_S_substringfn:
+ __kind = "Function representing substring";
+ break;
+ default:
+ __kind = "(corrupted kind field!)";
+ }
+ printf("%s %p (rc = %ld, depth = %d, len = %ld) ",
+ __kind, __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size._M_data);
+ if (sizeof(_CharT) == 1) {
+ const int __max_len = 40;
+ _Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len));
+ _CharT __buffer[__max_len + 1];
+ bool __too_big = __r->_M_size._M_data > __prefix->_M_size._M_data;
+
+ _S_flatten(__prefix, __buffer);
+ __buffer[__prefix->_M_size._M_data] = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ printf("%s%s\n", (char*)__buffer, __too_big? "...\n" : "\n");
+ } else {
+ printf("\n");
+ }
+ }
+}
+#endif /* _STLP_DEBUG */
+
+# define __ROPE_TABLE_BODY = { \
+/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21, \
+/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377, \
+/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181, \
+/* 18 */6765ul, /* 19 */10946ul, /* 20 */17711ul, /* 21 */28657ul, /* 22 */46368ul, \
+/* 23 */75025ul, /* 24 */121393ul, /* 25 */196418ul, /* 26 */317811ul, \
+/* 27 */514229ul, /* 28 */832040ul, /* 29 */1346269ul, /* 30 */2178309ul, \
+/* 31 */3524578ul, /* 32 */5702887ul, /* 33 */9227465ul, /* 34 */14930352ul, \
+/* 35 */24157817ul, /* 36 */39088169ul, /* 37 */63245986ul, /* 38 */102334155ul, \
+/* 39 */165580141ul, /* 40 */267914296ul, /* 41 */433494437ul, \
+/* 42 */701408733ul, /* 43 */1134903170ul, /* 44 */1836311903ul, \
+/* 45 */2971215073ul }
+
+template <class _CharT, class _Alloc>
+const unsigned long
+rope<_CharT,_Alloc>::_S_min_len[__ROPE_DEPTH_SIZE] __ROPE_TABLE_BODY;
+# undef __ROPE_DEPTH_SIZE
+# undef __ROPE_MAX_DEPTH
+# undef __ROPE_TABLE_BODY
+
+// These are Fibonacci numbers < 2**32.
+
+template <class _CharT, class _Alloc>
+__RopeRep__* rope<_CharT,_Alloc>::_S_balance(_RopeRep* __r) {
+ _RopeRep* __forest[_RopeRep::_S_max_rope_depth + 1] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0};
+ _RopeRep* __result = 0;
+ int __i;
+ // Invariant:
+ // The concatenation of forest in descending order is equal to __r.
+ // __forest[__i]._M_size._M_data >= _S_min_len[__i]
+ // __forest[__i]._M_depth = __i
+ // References from forest are included in refcount.
+
+ _STLP_TRY {
+ _S_add_to_forest(__r, __forest);
+ for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
+ if (0 != __forest[__i]) {
+ _Self_destruct_ptr __old(__result);
+ __result = _S_concat_rep(__forest[__i], __result);
+ __forest[__i]->_M_unref_nonnil();
+# ifdef _STLP_USE_EXCEPTIONS
+ __forest[__i] = 0;
+# endif
+ }
+ }
+ _STLP_UNWIND(for(__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
+ _S_unref(__forest[__i]))
+ if (__result->_M_depth > _RopeRep::_S_max_rope_depth) {
+ __stl_throw_range_error("rope too long");
+ }
+ return(__result);
+}
+
+
+template <class _CharT, class _Alloc>
+void
+rope<_CharT,_Alloc>::_S_add_to_forest(_RopeRep* __r, _RopeRep** __forest)
+{
+ if (__r -> _M_is_balanced) {
+ _S_add_leaf_to_forest(__r, __forest);
+ return;
+ }
+ _STLP_ASSERT(__r->_M_tag == _RopeRep::_S_concat)
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+
+ _S_add_to_forest(__c->_M_left, __forest);
+ _S_add_to_forest(__c->_M_right, __forest);
+ }
+}
+
+
+template <class _CharT, class _Alloc>
+void
+rope<_CharT,_Alloc>::_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest)
+{
+ _RopeRep* __insertee; // included in refcount
+ _RopeRep* __too_tiny = 0; // included in refcount
+ int __i; // forest[0..__i-1] is empty
+ size_t __s = __r->_M_size._M_data;
+
+ for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i) {
+ if (0 != __forest[__i]) {
+ _Self_destruct_ptr __old(__too_tiny);
+ __too_tiny = _S_concat_and_set_balanced(__forest[__i], __too_tiny);
+ __forest[__i]->_M_unref_nonnil();
+ __forest[__i] = 0;
+ }
+ }
+ {
+ _Self_destruct_ptr __old(__too_tiny);
+ __insertee = _S_concat_and_set_balanced(__too_tiny, __r);
+ }
+ // Too_tiny dead, and no longer included in refcount.
+ // Insertee is live and included.
+ _STLP_ASSERT(_S_is_almost_balanced(__insertee))
+ _STLP_ASSERT(__insertee->_M_depth <= __r->_M_depth + 1)
+ for (;; ++__i) {
+ if (0 != __forest[__i]) {
+ _Self_destruct_ptr __old(__insertee);
+ __insertee = _S_concat_and_set_balanced(__forest[__i], __insertee);
+ __forest[__i]->_M_unref_nonnil();
+ __forest[__i] = 0;
+ _STLP_ASSERT(_S_is_almost_balanced(__insertee))
+ }
+ _STLP_ASSERT(_S_min_len[__i] <= __insertee->_M_size._M_data)
+ _STLP_ASSERT(__forest[__i] == 0)
+ if (__i == _RopeRep::_S_max_rope_depth ||
+ __insertee->_M_size._M_data < _S_min_len[__i+1]) {
+ __forest[__i] = __insertee;
+ // refcount is OK since __insertee is now dead.
+ return;
+ }
+ }
+}
+
+template <class _CharT, class _Alloc>
+_CharT
+rope<_CharT,_Alloc>::_S_fetch(_RopeRep* __r, size_type __i)
+{
+ _CharT* __cstr = __r->_M_c_string;
+
+ _STLP_ASSERT(__i < __r->_M_size._M_data)
+ if (0 != __cstr) return __cstr[__i];
+ for(;;) {
+ switch(__r->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+ _RopeRep* __left = __c->_M_left;
+ size_t __left_len = __left->_M_size._M_data;
+
+ if (__i >= __left_len) {
+ __i -= __left_len;
+ __r = __c->_M_right;
+ } else {
+ __r = __left;
+ }
+ }
+ break;
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = (_RopeLeaf*)__r;
+ return __l->_M_data[__i];
+ }
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ {
+ _RopeFunction* __f = (_RopeFunction*)__r;
+ _CharT __result;
+
+ (*(__f->_M_fn))(__i, 1, &__result);
+ return __result;
+ }
+ }
+ }
+#if defined(_STLP_NEED_UNREACHABLE_RETURN)
+ return 0;
+#endif
+}
+
+// Return a uniquely referenced character slot for the given
+// position, or 0 if that's not possible.
+template <class _CharT, class _Alloc>
+_CharT*
+rope<_CharT,_Alloc>::_S_fetch_ptr(_RopeRep* __r, size_type __i)
+{
+ _RopeRep* __clrstack[_RopeRep::_S_max_rope_depth];
+ size_t __csptr = 0;
+
+ for(;;) {
+ // if (__r->_M_ref_count > 1) return 0;
+ if ( __r->_M_incr() > 2 ) {
+ __r->_M_decr();
+ return 0;
+ }
+ switch(__r->_M_tag) {
+ case _RopeRep::_S_concat:
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+ _RopeRep* __left = __c->_M_left;
+ size_t __left_len = __left->_M_size._M_data;
+
+ if (__c->_M_c_string != 0) __clrstack[__csptr++] = __c;
+ if (__i >= __left_len) {
+ __i -= __left_len;
+ __r = __c->_M_right;
+ } else {
+ __r = __left;
+ }
+ }
+ break;
+ case _RopeRep::_S_leaf:
+ {
+ _RopeLeaf* __l = (_RopeLeaf*)__r;
+ if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0)
+ __clrstack[__csptr++] = __l;
+ while (__csptr > 0) {
+ -- __csptr;
+ _RopeRep* __d = __clrstack[__csptr];
+ __d->_M_free_c_string();
+ __d->_M_c_string = 0;
+ }
+ return __l->_M_data + __i;
+ }
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ return 0;
+ }
+ }
+#if defined(_STLP_NEED_UNREACHABLE_RETURN)
+ return 0;
+#endif
+
+}
+
+// The following could be implemented trivially using
+// lexicographical_compare_3way.
+// We do a little more work to avoid dealing with rope iterators for
+// flat strings.
+template <class _CharT, class _Alloc>
+int
+rope<_CharT,_Alloc>::_S_compare (const _RopeRep* __left,
+ const _RopeRep* __right) {
+ size_t __left_len;
+ size_t __right_len;
+
+ if (0 == __right) return 0 != __left;
+ if (0 == __left) return -1;
+ __left_len = __left->_M_size._M_data;
+ __right_len = __right->_M_size._M_data;
+ if (_RopeRep::_S_leaf == __left->_M_tag) {
+ const _RopeLeaf* __l = __STATIC_CAST(const _RopeLeaf*, __left);
+ if (_RopeRep::_S_leaf == __right->_M_tag) {
+ const _RopeLeaf* __r = __STATIC_CAST(const _RopeLeaf*, __right);
+ return _STLP_PRIV __lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len,
+ __r->_M_data, __r->_M_data + __right_len);
+ }
+ else {
+ const_iterator __rstart(__right, 0);
+ const_iterator __rend(__right, __right_len);
+ return _STLP_PRIV __lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len,
+ __rstart, __rend);
+ }
+ }
+ else {
+ const_iterator __lstart(__left, 0);
+ const_iterator __lend(__left, __left_len);
+ if (_RopeRep::_S_leaf == __right->_M_tag) {
+ const _RopeLeaf* __r = __STATIC_CAST(const _RopeLeaf*, __right);
+ return _STLP_PRIV __lexicographical_compare_3way(__lstart, __lend,
+ __r->_M_data, __r->_M_data + __right_len);
+ }
+ else {
+ const_iterator __rstart(__right, 0);
+ const_iterator __rend(__right, __right_len);
+ return _STLP_PRIV __lexicographical_compare_3way(__lstart, __lend, __rstart, __rend);
+ }
+ }
+}
+
+// Assignment to reference proxies.
+template <class _CharT, class _Alloc>
+_Rope_char_ref_proxy<_CharT, _Alloc>&
+_Rope_char_ref_proxy<_CharT, _Alloc>::operator= (_CharT __c) {
+ _RopeRep* __old = _M_root->_M_tree_ptr._M_data;
+ // First check for the case in which everything is uniquely
+ // referenced. In that case we can do this destructively.
+ _CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos);
+ if (0 != __ptr) {
+ *__ptr = __c;
+ return *this;
+ }
+ _Self_destruct_ptr __left(
+ _My_rope::_S_substring(__old, 0, _M_pos));
+ _Self_destruct_ptr __right(
+ _My_rope::_S_substring(__old, _M_pos+1, __old->_M_size._M_data));
+ _Self_destruct_ptr __result_left(
+ _My_rope::_S_destr_concat_char_iter(__left, &__c, 1));
+
+ // _STLP_ASSERT(__left == __result_left || 1 == __result_left->_M_ref_count)
+ _RopeRep* __result =
+ _My_rope::_S_concat_rep(__result_left, __right);
+ // _STLP_ASSERT(1 <= __result->_M_ref_count)
+ _RopeRep::_S_unref(__old);
+ _M_root->_M_tree_ptr._M_data = __result;
+ return *this;
+}
+
+template <class _CharT, class _Alloc>
+_Rope_char_ptr_proxy<_CharT, _Alloc>
+_Rope_char_ref_proxy<_CharT, _Alloc>::operator& () const {
+ return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this);
+}
+
+template<class _CharT, class _Alloc>
+_CharT rope<_CharT,_Alloc>::_S_empty_c_str[1] = { _CharT() };
+// # endif
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+template <class _CharT, class _Alloc>
+const size_t rope<_CharT, _Alloc>::npos;
+#endif
+
+template<class _CharT, class _Alloc>
+const _CharT* rope<_CharT,_Alloc>::c_str() const {
+ if (0 == _M_tree_ptr._M_data) {
+ // Possibly redundant, but probably fast.
+ _S_empty_c_str[0] = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ return _S_empty_c_str;
+ }
+ _CharT* __old_c_string = _M_tree_ptr._M_data->_M_c_string;
+ if (0 != __old_c_string) return __old_c_string;
+ size_t __s = size();
+ _CharT* __result = _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_tree_ptr, _CharT).allocate(__s + 1);
+ _S_flatten(_M_tree_ptr._M_data, __result);
+ _S_construct_null(__result + __s);
+ __old_c_string = __STATIC_CAST(_CharT*, _Atomic_swap_ptr(__REINTERPRET_CAST(void* _STLP_VOLATILE*, &(_M_tree_ptr._M_data->_M_c_string)),
+ __result));
+ if (0 != __old_c_string) {
+ // It must have been added in the interim. Hence it had to have been
+ // separately allocated. Deallocate the old copy, since we just
+ // replaced it.
+ _STLP_STD::_Destroy_Range(__old_c_string, __old_c_string + __s + 1);
+ _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_tree_ptr, _CharT).deallocate(__old_c_string, __s + 1);
+ }
+ return __result;
+}
+
+template<class _CharT, class _Alloc>
+const _CharT* rope<_CharT,_Alloc>::replace_with_c_str() {
+ if (0 == _M_tree_ptr._M_data) {
+ _S_empty_c_str[0] = _STLP_DEFAULT_CONSTRUCTED(_CharT);
+ return _S_empty_c_str;
+ }
+ _CharT* __old_c_string = _M_tree_ptr._M_data->_M_c_string;
+ if (_RopeRep::_S_leaf == _M_tree_ptr._M_data->_M_tag && 0 != __old_c_string) {
+ return __old_c_string;
+ }
+ size_t __s = size();
+ _CharT* __result = _M_tree_ptr.allocate(_S_rounded_up_size(__s));
+ _S_flatten(_M_tree_ptr._M_data, __result);
+ _S_construct_null(__result + __s);
+ _M_tree_ptr._M_data->_M_unref_nonnil();
+ _M_tree_ptr._M_data = _S_new_RopeLeaf(__result, __s, _M_tree_ptr);
+ return __result;
+}
+
+// Algorithm specializations. More should be added.
+
+#if (!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310)) && !defined (__DMC__)
+// I couldn't get this to work with VC++
+template<class _CharT,class _Alloc>
+void _Rope_rotate(_Rope_iterator<_CharT,_Alloc> __first,
+ _Rope_iterator<_CharT,_Alloc> __middle,
+ _Rope_iterator<_CharT,_Alloc> __last) {
+ _STLP_ASSERT(__first.container() == __middle.container() &&
+ __middle.container() == __last.container())
+ rope<_CharT,_Alloc>& __r(__first.container());
+ rope<_CharT,_Alloc> __prefix = __r.substr(0, __first.index());
+ rope<_CharT,_Alloc> __suffix =
+ __r.substr(__last.index(), __r.size() - __last.index());
+ rope<_CharT,_Alloc> __part1 =
+ __r.substr(__middle.index(), __last.index() - __middle.index());
+ rope<_CharT,_Alloc> __part2 =
+ __r.substr(__first.index(), __middle.index() - __first.index());
+ __r = __prefix;
+ __r += __part1;
+ __r += __part2;
+ __r += __suffix;
+}
+
+
+# if 0
+// Probably not useful for several reasons:
+// - for SGIs 7.1 compiler and probably some others,
+// this forces lots of rope<wchar_t, ...> instantiations, creating a
+// code bloat and compile time problem. (Fixed in 7.2.)
+// - wchar_t is 4 bytes wide on most UNIX platforms, making it unattractive
+// for unicode strings. Unsigned short may be a better character
+// type.
+inline void rotate(
+ _Rope_iterator<wchar_t, allocator<char> > __first,
+ _Rope_iterator<wchar_t, allocator<char> > __middle,
+ _Rope_iterator<wchar_t, allocator<char> > __last) {
+ _Rope_rotate(__first, __middle, __last);
+}
+# endif
+#endif /* _STLP_MSVC */
+
+# undef __RopeLeaf__
+# undef __RopeRep__
+# undef __RopeLeaf
+# undef __RopeRep
+# undef size_type
+
+_STLP_END_NAMESPACE
+
+# endif /* ROPEIMPL_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_rope.h b/stlport/stl/_rope.h
new file mode 100644
index 0000000..f100f67
--- /dev/null
+++ b/stlport/stl/_rope.h
@@ -0,0 +1,2389 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+// rope<_CharT,_Alloc> is a sequence of _CharT.
+// Ropes appear to be mutable, but update operations
+// really copy enough of the data structure to leave the original
+// valid. Thus ropes can be logically copied by just copying
+// a pointer value.
+
+#ifndef _STLP_INTERNAL_ROPE_H
+#define _STLP_INTERNAL_ROPE_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_INTERNAL_IOSFWD)
+# include <stl/_iosfwd.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGO_H
+# include <stl/_algo.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMERIC_H
+# include <stl/_numeric.h>
+#endif
+
+#ifndef _STLP_INTERNAL_HASH_FUN_H
+# include <stl/_hash_fun.h>
+#endif
+
+#ifndef _STLP_CHAR_TRAITS_H
+# include <stl/char_traits.h>
+#endif
+
+#ifndef _STLP_INTERNAL_THREADS_H
+# include <stl/_threads.h>
+#endif
+
+#ifdef _STLP_SGI_THREADS
+# include <mutex.h>
+#endif
+
+#ifndef _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE
+# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) (_Alloc_traits<_Tp,__atype>::create_allocator(__a))
+#else
+# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// First a lot of forward declarations. The standard seems to require
+// much stricter "declaration before use" than many of the implementations
+// that preceded it.
+template<class _CharT, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_CharT>) > class rope;
+template<class _CharT, class _Alloc> struct _Rope_RopeConcatenation;
+template<class _CharT, class _Alloc> struct _Rope_RopeRep;
+template<class _CharT, class _Alloc> struct _Rope_RopeLeaf;
+template<class _CharT, class _Alloc> struct _Rope_RopeFunction;
+template<class _CharT, class _Alloc> struct _Rope_RopeSubstring;
+template<class _CharT, class _Alloc> class _Rope_iterator;
+template<class _CharT, class _Alloc> class _Rope_const_iterator;
+template<class _CharT, class _Alloc> class _Rope_char_ref_proxy;
+template<class _CharT, class _Alloc> class _Rope_char_ptr_proxy;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT>
+struct _BasicCharType { typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _BasicCharType<char> { typedef __true_type _Ret; };
+
+#ifdef _STLP_HAS_WCHAR_T
+_STLP_TEMPLATE_NULL
+struct _BasicCharType<wchar_t> { typedef __true_type _Ret; };
+#endif
+
+// Some helpers, so we can use the power algorithm on ropes.
+// See below for why this isn't local to the implementation.
+
+// This uses a nonstandard refcount convention.
+// The result has refcount 0.
+template<class _CharT, class _Alloc>
+struct _Rope_Concat_fn
+ : public binary_function<rope<_CharT,_Alloc>, rope<_CharT,_Alloc>,
+ rope<_CharT,_Alloc> > {
+ rope<_CharT,_Alloc> operator() (const rope<_CharT,_Alloc>& __x,
+ const rope<_CharT,_Alloc>& __y) {
+ return __x + __y;
+ }
+};
+
+template <class _CharT, class _Alloc>
+inline
+rope<_CharT,_Alloc>
+__identity_element(_Rope_Concat_fn<_CharT, _Alloc>)
+{ return rope<_CharT,_Alloc>(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+// Store an eos
+template <class _CharT>
+inline void _S_construct_null_aux(_CharT *__p, const __true_type&)
+{ *__p = 0; }
+
+template <class _CharT>
+inline void _S_construct_null_aux(_CharT *__p, const __false_type&)
+{ _STLP_STD::_Construct(__p); }
+
+template <class _CharT>
+inline void _S_construct_null(_CharT *__p) {
+ typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral;
+ _S_construct_null_aux(__p, _Char_Is_Integral());
+}
+
+// char_producers are logically functions that generate a section of
+// a string. These can be converted to ropes. The resulting rope
+// invokes the char_producer on demand. This allows, for example,
+// files to be viewed as ropes without reading the entire file.
+template <class _CharT>
+class char_producer {
+public:
+ virtual ~char_producer() {}
+ virtual void operator()(size_t __start_pos, size_t __len,
+ _CharT* __buffer) = 0;
+ // Buffer should really be an arbitrary output iterator.
+ // That way we could flatten directly into an ostream, etc.
+ // This is thoroughly impossible, since iterator types don't
+ // have runtime descriptions.
+};
+
+// Sequence buffers:
+//
+// Sequence must provide an append operation that appends an
+// array to the sequence. Sequence buffers are useful only if
+// appending an entire array is cheaper than appending element by element.
+// This is true for many string representations.
+// This should perhaps inherit from ostream<sequence::value_type>
+// and be implemented correspondingly, so that they can be used
+// for formatted. For the sake of portability, we don't do this yet.
+//
+// For now, sequence buffers behave as output iterators. But they also
+// behave a little like basic_ostringstream<sequence::value_type> and a
+// little like containers.
+
+template<class _Sequence
+# if !(defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) || \
+ defined ( _STLP_NO_DEFAULT_NON_TYPE_PARAM ))
+ , size_t _Buf_sz = 100
+# if defined(__sgi) && !defined(__GNUC__)
+# define __TYPEDEF_WORKAROUND
+ ,class _V = typename _Sequence::value_type
+# endif /* __sgi */
+# endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+ >
+// The 3rd parameter works around a common compiler bug.
+class sequence_buffer : public iterator <output_iterator_tag, void, void, void, void> {
+public:
+# ifndef __TYPEDEF_WORKAROUND
+ typedef typename _Sequence::value_type value_type;
+ typedef sequence_buffer<_Sequence
+# if !(defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) || \
+ defined ( _STLP_NO_DEFAULT_NON_TYPE_PARAM ))
+ , _Buf_sz
+ > _Self;
+# else /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+ > _Self;
+ enum { _Buf_sz = 100};
+# endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
+ // # endif
+# else /* __TYPEDEF_WORKAROUND */
+ typedef _V value_type;
+ typedef sequence_buffer<_Sequence, _Buf_sz, _V> _Self;
+# endif /* __TYPEDEF_WORKAROUND */
+protected:
+ _Sequence* _M_prefix;
+ value_type _M_buffer[_Buf_sz];
+ size_t _M_buf_count;
+public:
+ void flush() {
+ _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count);
+ _M_buf_count = 0;
+ }
+ ~sequence_buffer() { flush(); }
+ sequence_buffer() : _M_prefix(0), _M_buf_count(0) {}
+ sequence_buffer(const _Self& __x) {
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = __x._M_buf_count;
+ _STLP_STD::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
+ }
+ sequence_buffer(_Self& __x) {
+ __x.flush();
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = 0;
+ }
+ sequence_buffer(_Sequence& __s) : _M_prefix(&__s), _M_buf_count(0) {}
+ _Self& operator= (_Self& __x) {
+ __x.flush();
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = 0;
+ return *this;
+ }
+ _Self& operator= (const _Self& __x) {
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = __x._M_buf_count;
+ _STLP_STD::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
+ return *this;
+ }
+ void push_back(value_type __x) {
+ if (_M_buf_count < _Buf_sz) {
+ _M_buffer[_M_buf_count] = __x;
+ ++_M_buf_count;
+ } else {
+ flush();
+ _M_buffer[0] = __x;
+ _M_buf_count = 1;
+ }
+ }
+ void append(const value_type *__s, size_t __len) {
+ if (__len + _M_buf_count <= _Buf_sz) {
+ size_t __i = _M_buf_count;
+ size_t __j = 0;
+ for (; __j < __len; __i++, __j++) {
+ _M_buffer[__i] = __s[__j];
+ }
+ _M_buf_count += __len;
+ } else if (0 == _M_buf_count) {
+ _M_prefix->append(__s, __s + __len);
+ } else {
+ flush();
+ append(__s, __len);
+ }
+ }
+ _Self& write(const value_type *__s, size_t __len) {
+ append(__s, __len);
+ return *this;
+ }
+ _Self& put(value_type __x) {
+ push_back(__x);
+ return *this;
+ }
+ _Self& operator=(const value_type& __rhs) {
+ push_back(__rhs);
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self& operator++(int) { return *this; }
+};
+
+// The following should be treated as private, at least for now.
+template<class _CharT>
+class _Rope_char_consumer {
+#if !defined (_STLP_MEMBER_TEMPLATES)
+public:
+ //Without member templates we have to use run-time parameterization.
+ // The symmetry with char_producer is accidental and temporary.
+ virtual ~_Rope_char_consumer() {}
+ virtual bool operator()(const _CharT* __buffer, size_t __len) = 0;
+#endif
+};
+
+//
+// What follows should really be local to rope. Unfortunately,
+// that doesn't work, since it makes it impossible to define generic
+// equality on rope iterators. According to the draft standard, the
+// template parameters for such an equality operator cannot be inferred
+// from the occurence of a member class as a parameter.
+// (SGI compilers in fact allow this, but the __result wouldn't be
+// portable.)
+// Similarly, some of the static member functions are member functions
+// only to avoid polluting the global namespace, and to circumvent
+// restrictions on type inference for template functions.
+//
+
+//
+// The internal data structure for representing a rope. This is
+// private to the implementation. A rope is really just a pointer
+// to one of these.
+//
+// A few basic functions for manipulating this data structure
+// are members of _RopeRep. Most of the more complex algorithms
+// are implemented as rope members.
+//
+// Some of the static member functions of _RopeRep have identically
+// named functions in rope that simply invoke the _RopeRep versions.
+//
+
+template<class _CharT, class _Alloc>
+struct _Rope_RopeRep
+ : public _Refcount_Base
+{
+ typedef _Rope_RopeRep<_CharT, _Alloc> _Self;
+public:
+ //
+ // GAB: 11/09/05
+ //
+ // "__ROPE_DEPTH_SIZE" is set to one more then the "__ROPE_MAX_DEPTH".
+ // This was originally just an addition of "__ROPE_MAX_DEPTH + 1"
+ // but this addition causes the sunpro compiler to complain about
+ // multiple declarations during the initialization of "_S_min_len".
+ // Changed to be a fixed value and the sunpro compiler appears to
+ // be happy???
+ //
+# define __ROPE_MAX_DEPTH 45
+# define __ROPE_DEPTH_SIZE 46 // __ROPE_MAX_DEPTH + 1
+ enum { _S_max_rope_depth = __ROPE_MAX_DEPTH };
+ enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
+ // Apparently needed by VC++
+ // The data fields of leaves are allocated with some
+ // extra space, to accomodate future growth and for basic
+ // character types, to hold a trailing eos character.
+ enum { _S_alloc_granularity = 8 };
+
+ _Tag _M_tag:8;
+ bool _M_is_balanced:8;
+
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef _Alloc allocator_type;
+
+ allocator_type get_allocator() const { return allocator_type(_M_size); }
+
+ unsigned char _M_depth;
+ _CharT* _STLP_VOLATILE _M_c_string;
+ _STLP_PRIV _STLP_alloc_proxy<size_t, _CharT, allocator_type> _M_size;
+
+#ifdef _STLP_NO_ARROW_OPERATOR
+ _Rope_RopeRep() : _Refcount_Base(1), _M_size(allocator_type(), 0) {
+# if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+ _STLP_CHECK_RUNTIME_COMPATIBILITY();
+# endif
+ }
+#endif
+
+ /* Flattened version of string, if needed. */
+ /* typically 0. */
+ /* If it's not 0, then the memory is owned */
+ /* by this node. */
+ /* In the case of a leaf, this may point to */
+ /* the same memory as the data field. */
+ _Rope_RopeRep(_Tag __t, unsigned char __d, bool __b, size_t _p_size,
+ allocator_type __a) :
+ _Refcount_Base(1),
+ _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0), _M_size(__a, _p_size) {
+#if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+ _STLP_CHECK_RUNTIME_COMPATIBILITY();
+#endif
+ }
+
+ typedef _STLP_TYPENAME _STLP_PRIV _BasicCharType<_CharT>::_Ret _IsBasicCharType;
+
+#if 0
+ /* Please tell why this code is necessary if you uncomment it.
+ * Problem with it is that rope implementation expect that _S_rounded_up_size(n)
+ * returns a size > n in order to store the terminating null charater. When
+ * instanciation type is not a char or wchar_t this is not guaranty resulting in
+ * memory overrun.
+ */
+ static size_t _S_rounded_up_size_aux(size_t __n, __true_type const& /*_IsBasicCharType*/) {
+ // Allow slop for in-place expansion.
+ return (__n + _S_alloc_granularity) & ~(_S_alloc_granularity - 1);
+ }
+
+ static size_t _S_rounded_up_size_aux(size_t __n, __false_type const& /*_IsBasicCharType*/) {
+ // Allow slop for in-place expansion.
+ return (__n + _S_alloc_granularity - 1) & ~(_S_alloc_granularity - 1);
+ }
+#endif
+ // fbp : moved from RopeLeaf
+ static size_t _S_rounded_up_size(size_t __n)
+ //{ return _S_rounded_up_size_aux(__n, _IsBasicCharType()); }
+ { return (__n + _S_alloc_granularity) & ~(_S_alloc_granularity - 1); }
+
+ static void _S_free_string( _CharT* __s, size_t __len,
+ allocator_type __a) {
+ _STLP_STD::_Destroy_Range(__s, __s + __len);
+ // This has to be a static member, so this gets a bit messy
+# ifndef _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE
+ __a.deallocate(__s, _S_rounded_up_size(__len)); //*ty 03/24/2001 - restored not to use __stl_alloc_rebind() since it is not defined under _STLP_MEMBER_TEMPLATE_CLASSES
+# else
+ __stl_alloc_rebind (__a, (_CharT*)0).deallocate(__s, _S_rounded_up_size(__len));
+# endif
+ }
+
+ // Deallocate data section of a leaf.
+ // This shouldn't be a member function.
+ // But its hard to do anything else at the
+ // moment, because it's templatized w.r.t.
+ // an allocator.
+ // Does nothing if __GC is defined.
+ void _M_free_c_string();
+ void _M_free_tree();
+ // Deallocate t. Assumes t is not 0.
+ void _M_unref_nonnil() {
+ if (_M_decr() == 0) _M_free_tree();
+ }
+ void _M_ref_nonnil() {
+ _M_incr();
+ }
+ static void _S_unref(_Self* __t) {
+ if (0 != __t) {
+ __t->_M_unref_nonnil();
+ }
+ }
+ static void _S_ref(_Self* __t) {
+ if (0 != __t) __t->_M_incr();
+ }
+ //static void _S_free_if_unref(_Self* __t) {
+ // if (0 != __t && 0 == __t->_M_ref_count) __t->_M_free_tree();
+ //}
+};
+
+template<class _CharT, class _Alloc>
+struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> {
+public:
+ _CharT* _M_data; /* Not necessarily 0 terminated. */
+ /* The allocated size is */
+ /* _S_rounded_up_size(size), except */
+ /* in the GC case, in which it */
+ /* doesn't matter. */
+private:
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ typedef typename _RopeRep::_IsBasicCharType _IsBasicCharType;
+ void _M_init(__true_type const& /*_IsBasicCharType*/) {
+ this->_M_c_string = _M_data;
+ }
+ void _M_init(__false_type const& /*_IsBasicCharType*/) {}
+
+public:
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _RopeRep::allocator_type allocator_type;
+
+ _Rope_RopeLeaf( _CharT* __d, size_t _p_size, allocator_type __a)
+ : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_leaf, 0, true, _p_size, __a),
+ _M_data(__d) {
+ _STLP_ASSERT(_p_size > 0)
+ _M_init(_IsBasicCharType());
+ }
+
+# ifdef _STLP_NO_ARROW_OPERATOR
+ _Rope_RopeLeaf() {}
+ _Rope_RopeLeaf(const _Rope_RopeLeaf<_CharT, _Alloc>& ) {}
+# endif
+
+// The constructor assumes that d has been allocated with
+ // the proper allocator and the properly padded size.
+ // In contrast, the destructor deallocates the data:
+ ~_Rope_RopeLeaf() {
+ if (_M_data != this->_M_c_string) {
+ this->_M_free_c_string();
+ }
+ _RopeRep::_S_free_string(_M_data, this->_M_size._M_data, this->get_allocator());
+ }
+};
+
+template<class _CharT, class _Alloc>
+struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT, _Alloc> {
+private:
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+
+public:
+ _RopeRep* _M_left;
+ _RopeRep* _M_right;
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _RopeRep::allocator_type allocator_type;
+ _Rope_RopeConcatenation(_RopeRep* __l, _RopeRep* __r, allocator_type __a)
+ : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_concat,
+ (max)(__l->_M_depth, __r->_M_depth) + 1, false,
+ __l->_M_size._M_data + __r->_M_size._M_data, __a), _M_left(__l), _M_right(__r)
+ {}
+# ifdef _STLP_NO_ARROW_OPERATOR
+ _Rope_RopeConcatenation() {}
+ _Rope_RopeConcatenation(const _Rope_RopeConcatenation<_CharT, _Alloc>&) {}
+# endif
+
+ ~_Rope_RopeConcatenation() {
+ this->_M_free_c_string();
+ _M_left->_M_unref_nonnil();
+ _M_right->_M_unref_nonnil();
+ }
+};
+
+template <class _CharT, class _Alloc>
+struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT, _Alloc> {
+private:
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+public:
+ char_producer<_CharT>* _M_fn;
+ /*
+ * Char_producer is owned by the
+ * rope and should be explicitly
+ * deleted when the rope becomes
+ * inaccessible.
+ */
+ bool _M_delete_when_done;
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _Rope_RopeRep<_CharT,_Alloc>::allocator_type allocator_type;
+# ifdef _STLP_NO_ARROW_OPERATOR
+ _Rope_RopeFunction() {}
+ _Rope_RopeFunction(const _Rope_RopeFunction<_CharT, _Alloc>& ) {}
+# endif
+
+ _Rope_RopeFunction(char_producer<_CharT>* __f, size_t _p_size,
+ bool __d, allocator_type __a)
+ : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_function, 0, true, _p_size, __a), _M_fn(__f)
+ , _M_delete_when_done(__d)
+ { _STLP_ASSERT(_p_size > 0) }
+
+ ~_Rope_RopeFunction() {
+ this->_M_free_c_string();
+ if (_M_delete_when_done) {
+ delete _M_fn;
+ }
+ }
+};
+
+/*
+ * Substring results are usually represented using just
+ * concatenation nodes. But in the case of very long flat ropes
+ * or ropes with a functional representation that isn't practical.
+ * In that case, we represent the __result as a special case of
+ * RopeFunction, whose char_producer points back to the rope itself.
+ * In all cases except repeated substring operations and
+ * deallocation, we treat the __result as a RopeFunction.
+ */
+template<class _CharT, class _Alloc>
+struct _Rope_RopeSubstring : public char_producer<_CharT>, public _Rope_RopeFunction<_CharT,_Alloc> {
+public:
+ // XXX this whole class should be rewritten.
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ _RopeRep *_M_base; // not 0
+ size_t _M_start;
+ /* virtual */ void operator()(size_t __start_pos, size_t __req_len,
+ _CharT* __buffer) {
+ typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
+ typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
+ switch (_M_base->_M_tag) {
+ case _RopeRep::_S_function:
+ case _RopeRep::_S_substringfn:
+ {
+ char_producer<_CharT>* __fn =
+ __STATIC_CAST(_RopeFunction*, _M_base)->_M_fn;
+ _STLP_ASSERT(__start_pos + __req_len <= this->_M_size._M_data)
+ _STLP_ASSERT(_M_start + this->_M_size._M_data <= _M_base->_M_size._M_data)
+ (*__fn)(__start_pos + _M_start, __req_len, __buffer);
+ }
+ break;
+ case _RopeRep::_S_leaf:
+ {
+ _CharT* __s =
+ __STATIC_CAST(_RopeLeaf*, _M_base)->_M_data;
+ _STLP_PRIV __ucopy_n(__s + __start_pos + _M_start, __req_len, __buffer);
+ }
+ break;
+ default:
+ _STLP_ASSERT(false)
+ ;
+ }
+ }
+
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef typename _RopeRep::allocator_type allocator_type;
+
+ _Rope_RopeSubstring(_RopeRep* __b, size_t __s, size_t __l, allocator_type __a)
+ : _Rope_RopeFunction<_CharT,_Alloc>(this, __l, false, __a),
+ _M_base(__b), _M_start(__s) {
+ _STLP_ASSERT(__l > 0)
+ _STLP_ASSERT(__s + __l <= __b->_M_size._M_data)
+ _M_base->_M_ref_nonnil();
+ this->_M_tag = _RopeRep::_S_substringfn;
+ }
+ virtual ~_Rope_RopeSubstring()
+ { _M_base->_M_unref_nonnil(); }
+};
+
+/*
+ * Self-destructing pointers to Rope_rep.
+ * These are not conventional smart pointers. Their
+ * only purpose in life is to ensure that unref is called
+ * on the pointer either at normal exit or if an exception
+ * is raised. It is the caller's responsibility to
+ * adjust reference counts when these pointers are initialized
+ * or assigned to. (This convention significantly reduces
+ * the number of potentially expensive reference count
+ * updates.)
+ */
+template<class _CharT, class _Alloc>
+struct _Rope_self_destruct_ptr {
+ _Rope_RopeRep<_CharT,_Alloc>* _M_ptr;
+ ~_Rope_self_destruct_ptr()
+ { _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); }
+# ifdef _STLP_USE_EXCEPTIONS
+ _Rope_self_destruct_ptr() : _M_ptr(0) {}
+# else
+ _Rope_self_destruct_ptr() {}
+# endif
+ _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT,_Alloc>* __p) : _M_ptr(__p) {}
+ _Rope_RopeRep<_CharT,_Alloc>& operator*() { return *_M_ptr; }
+ _Rope_RopeRep<_CharT,_Alloc>* operator->() { return _M_ptr; }
+ operator _Rope_RopeRep<_CharT,_Alloc>*() { return _M_ptr; }
+ _Rope_self_destruct_ptr<_CharT, _Alloc>&
+ operator= (_Rope_RopeRep<_CharT,_Alloc>* __x)
+ { _M_ptr = __x; return *this; }
+};
+
+/*
+ * Dereferencing a nonconst iterator has to return something
+ * that behaves almost like a reference. It's not possible to
+ * return an actual reference since assignment requires extra
+ * work. And we would get into the same problems as with the
+ * CD2 version of basic_string.
+ */
+template<class _CharT, class _Alloc>
+class _Rope_char_ref_proxy {
+ typedef _Rope_char_ref_proxy<_CharT, _Alloc> _Self;
+ friend class rope<_CharT,_Alloc>;
+ friend class _Rope_iterator<_CharT,_Alloc>;
+ friend class _Rope_char_ptr_proxy<_CharT,_Alloc>;
+ typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr;
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ typedef rope<_CharT,_Alloc> _My_rope;
+ size_t _M_pos;
+ _CharT _M_current;
+ bool _M_current_valid;
+ _My_rope* _M_root; // The whole rope.
+public:
+ _Rope_char_ref_proxy(_My_rope* __r, size_t __p) :
+ _M_pos(__p), _M_current_valid(false), _M_root(__r) {}
+ _Rope_char_ref_proxy(const _Self& __x) :
+ _M_pos(__x._M_pos), _M_current_valid(false), _M_root(__x._M_root) {}
+ // Don't preserve cache if the reference can outlive the
+ // expression. We claim that's not possible without calling
+ // a copy constructor or generating reference to a proxy
+ // reference. We declare the latter to have undefined semantics.
+ _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c)
+ : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {}
+ inline operator _CharT () const;
+ _Self& operator= (_CharT __c);
+ _Rope_char_ptr_proxy<_CharT, _Alloc> operator& () const;
+ _Self& operator= (const _Self& __c) {
+ return operator=((_CharT)__c);
+ }
+};
+
+#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+template<class _CharT, class __Alloc>
+inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a,
+ _Rope_char_ref_proxy <_CharT, __Alloc > __b) {
+ _CharT __tmp = __a;
+ __a = __b;
+ __b = __tmp;
+}
+#else
+// There is no really acceptable way to handle this. The default
+// definition of swap doesn't work for proxy references.
+// It can't really be made to work, even with ugly hacks, since
+// the only unusual operation it uses is the copy constructor, which
+// is needed for other purposes. We provide a macro for
+// full specializations, and instantiate the most common case.
+# define _ROPE_SWAP_SPECIALIZATION(_CharT, __Alloc) \
+ inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, \
+ _Rope_char_ref_proxy <_CharT, __Alloc > __b) { \
+ _CharT __tmp = __a; \
+ __a = __b; \
+ __b = __tmp; \
+ }
+
+_ROPE_SWAP_SPECIALIZATION(char, allocator<char>)
+
+# ifndef _STLP_NO_WCHAR_T
+_ROPE_SWAP_SPECIALIZATION(wchar_t, allocator<wchar_t>)
+# endif
+
+#endif /* !_STLP_FUNCTION_TMPL_PARTIAL_ORDER */
+
+template<class _CharT, class _Alloc>
+class _Rope_char_ptr_proxy {
+ // XXX this class should be rewritten.
+public:
+ typedef _Rope_char_ptr_proxy<_CharT, _Alloc> _Self;
+ friend class _Rope_char_ref_proxy<_CharT,_Alloc>;
+ size_t _M_pos;
+ rope<_CharT,_Alloc>* _M_root; // The whole rope.
+
+ _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)
+ : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
+ _Rope_char_ptr_proxy(const _Self& __x)
+ : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
+ _Rope_char_ptr_proxy() {}
+ _Rope_char_ptr_proxy(_CharT* __x) : _M_pos(0), _M_root(0) {
+ _STLP_ASSERT(0 == __x)
+ }
+ _Self& operator= (const _Self& __x) {
+ _M_pos = __x._M_pos;
+ _M_root = __x._M_root;
+ return *this;
+ }
+
+ _Rope_char_ref_proxy<_CharT,_Alloc> operator*() const {
+ return _Rope_char_ref_proxy<_CharT,_Alloc>(_M_root, _M_pos);
+ }
+};
+
+
+/*
+ * Rope iterators:
+ * Unlike in the C version, we cache only part of the stack
+ * for rope iterators, since they must be efficiently copyable.
+ * When we run out of cache, we have to reconstruct the iterator
+ * value.
+ * Pointers from iterators are not included in reference counts.
+ * Iterators are assumed to be thread private. Ropes can
+ * be shared.
+ */
+template<class _CharT, class _Alloc>
+class _Rope_iterator_base
+/* : public random_access_iterator<_CharT, ptrdiff_t> */
+{
+ friend class rope<_CharT,_Alloc>;
+ typedef _Rope_iterator_base<_CharT, _Alloc> _Self;
+ typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcat;
+public:
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+
+ enum { _S_path_cache_len = 4 }; // Must be <= 9 because of _M_path_direction.
+ enum { _S_iterator_buf_len = 15 };
+ size_t _M_current_pos;
+ // The whole rope.
+ _RopeRep* _M_root;
+ // Starting position for current leaf
+ size_t _M_leaf_pos;
+ // Buffer possibly containing current char.
+ _CharT* _M_buf_start;
+ // Pointer to current char in buffer, != 0 ==> buffer valid.
+ _CharT* _M_buf_ptr;
+ // One past __last valid char in buffer.
+ _CharT* _M_buf_end;
+
+ // What follows is the path cache. We go out of our
+ // way to make this compact.
+ // Path_end contains the bottom section of the path from
+ // the root to the current leaf.
+ struct {
+# if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
+ _RopeRep const*_M_data[4];
+# else
+ _RopeRep const*_M_data[_S_path_cache_len];
+# endif
+ } _M_path_end;
+ // Last valid __pos in path_end;
+ // _M_path_end[0] ... _M_path_end[_M_leaf_index-1]
+ // point to concatenation nodes.
+ int _M_leaf_index;
+ // (_M_path_directions >> __i) & 1 is 1
+ // if we got from _M_path_end[leaf_index - __i - 1]
+ // to _M_path_end[leaf_index - __i] by going to the
+ // __right. Assumes path_cache_len <= 9.
+ unsigned char _M_path_directions;
+ // Short buffer for surrounding chars.
+ // This is useful primarily for
+ // RopeFunctions. We put the buffer
+ // here to avoid locking in the
+ // multithreaded case.
+ // The cached path is generally assumed to be valid
+ // only if the buffer is valid.
+ struct {
+# if defined (__BORLANDC__) && (__BORLANDC__ < 0x560)
+ _CharT _M_data[15];
+# else
+ _CharT _M_data[_S_iterator_buf_len];
+# endif
+ } _M_tmp_buf;
+
+ // Set buffer contents given path cache.
+ static void _S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x);
+ // Set buffer contents and path cache.
+ static void _S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x);
+ // As above, but assumes path cache is valid for previous posn.
+ static void _S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x);
+ _Rope_iterator_base() {}
+ _Rope_iterator_base(_RopeRep* __root, size_t __pos)
+ : _M_current_pos(__pos),_M_root(__root), _M_buf_ptr(0) {}
+ void _M_incr(size_t __n);
+ void _M_decr(size_t __n);
+public:
+ size_t index() const { return _M_current_pos; }
+private:
+ void _M_copy_buf(const _Self& __x) {
+ _M_tmp_buf = __x._M_tmp_buf;
+ if (__x._M_buf_start == __x._M_tmp_buf._M_data) {
+ _M_buf_start = _M_tmp_buf._M_data;
+ _M_buf_end = _M_buf_start + (__x._M_buf_end - __x._M_buf_start);
+ _M_buf_ptr = _M_buf_start + (__x._M_buf_ptr - __x._M_buf_start);
+ } else {
+ _M_buf_end = __x._M_buf_end;
+ }
+ }
+
+public:
+ _Rope_iterator_base(const _Self& __x) :
+ _M_current_pos(__x._M_current_pos),
+ _M_root(__x._M_root),
+ _M_leaf_pos( __x._M_leaf_pos ),
+ _M_buf_start(__x._M_buf_start),
+ _M_buf_ptr(__x._M_buf_ptr),
+ _M_path_end(__x._M_path_end),
+ _M_leaf_index(__x._M_leaf_index),
+ _M_path_directions(__x._M_path_directions)
+ {
+ if (0 != __x._M_buf_ptr) {
+ _M_copy_buf(__x);
+ }
+ }
+ _Self& operator = (const _Self& __x)
+ {
+ _M_current_pos = __x._M_current_pos;
+ _M_root = __x._M_root;
+ _M_buf_start = __x._M_buf_start;
+ _M_buf_ptr = __x._M_buf_ptr;
+ _M_path_end = __x._M_path_end;
+ _M_leaf_index = __x._M_leaf_index;
+ _M_path_directions = __x._M_path_directions;
+ _M_leaf_pos = __x._M_leaf_pos;
+ if (0 != __x._M_buf_ptr) {
+ _M_copy_buf(__x);
+ }
+ return *this;
+ }
+};
+
+template<class _CharT, class _Alloc> class _Rope_iterator;
+
+template<class _CharT, class _Alloc>
+class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
+ friend class rope<_CharT,_Alloc>;
+ typedef _Rope_const_iterator<_CharT, _Alloc> _Self;
+ typedef _Rope_iterator_base<_CharT,_Alloc> _Base;
+ // protected:
+public:
+# ifndef _STLP_HAS_NO_NAMESPACES
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+ // The one from the base class may not be directly visible.
+# endif
+ _Rope_const_iterator(const _RopeRep* __root, size_t __pos):
+ _Rope_iterator_base<_CharT,_Alloc>(__CONST_CAST(_RopeRep*,__root), __pos)
+ // Only nonconst iterators modify root ref count
+ {}
+public:
+ typedef _CharT reference; // Really a value. Returning a reference
+ // Would be a mess, since it would have
+ // to be included in refcount.
+ typedef const _CharT* pointer;
+ typedef _CharT value_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag iterator_category;
+
+public:
+ _Rope_const_iterator() {}
+ _Rope_const_iterator(const _Self& __x) :
+ _Rope_iterator_base<_CharT,_Alloc>(__x) { }
+ _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x):
+ _Rope_iterator_base<_CharT,_Alloc>(__x) {}
+ _Rope_const_iterator(const rope<_CharT,_Alloc>& __r, size_t __pos) :
+ _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr._M_data, __pos) {}
+ _Self& operator= (const _Self& __x) {
+ _Base::operator=(__x);
+ return *this;
+ }
+ reference operator*() {
+ if (0 == this->_M_buf_ptr)
+#if !defined (__DMC__)
+ _S_setcache(*this);
+#else
+ { _Rope_iterator_base<_CharT, _Alloc>* __x = this; _S_setcache(*__x); }
+#endif
+ return *(this->_M_buf_ptr);
+ }
+ _Self& operator++()
+ {
+ if ( this->_M_buf_ptr != 0 ) {
+ _CharT *__next = this->_M_buf_ptr + 1;
+ if ( __next < this->_M_buf_end ) {
+ this->_M_buf_ptr = __next;
+ ++this->_M_current_pos;
+ return *this;
+ }
+ }
+ this->_M_incr(1);
+ return *this;
+ }
+ _Self& operator+=(ptrdiff_t __n) {
+ if (__n >= 0) {
+ this->_M_incr(__n);
+ } else {
+ this->_M_decr(-__n);
+ }
+ return *this;
+ }
+ _Self& operator--() {
+ this->_M_decr(1);
+ return *this;
+ }
+ _Self& operator-=(ptrdiff_t __n) {
+ if (__n >= 0) {
+ this->_M_decr(__n);
+ } else {
+ this->_M_incr(-__n);
+ }
+ return *this;
+ }
+ _Self operator++(int) {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_incr(1);
+ return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
+ // This makes a subsequent dereference expensive.
+ // Perhaps we should instead copy the iterator
+ // if it has a valid cache?
+ }
+ _Self operator--(int) {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_decr(1);
+ return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
+ }
+ inline reference operator[](size_t __n);
+};
+
+template<class _CharT, class _Alloc>
+class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
+ friend class rope<_CharT,_Alloc>;
+ typedef _Rope_iterator<_CharT, _Alloc> _Self;
+ typedef _Rope_iterator_base<_CharT,_Alloc> _Base;
+ typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
+
+public:
+ rope<_CharT,_Alloc>* _M_root_rope;
+ // root is treated as a cached version of this,
+ // and is used to detect changes to the underlying
+ // rope.
+ // Root is included in the reference count.
+ // This is necessary so that we can detect changes reliably.
+ // Unfortunately, it requires careful bookkeeping for the
+ // nonGC case.
+ _Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos);
+
+ void _M_check();
+public:
+ typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference;
+ typedef _Rope_char_ref_proxy<_CharT,_Alloc>* pointer;
+ typedef _CharT value_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag iterator_category;
+public:
+ ~_Rope_iterator() { //*TY 5/6/00 - added dtor to balance reference count
+ _RopeRep::_S_unref(this->_M_root);
+ }
+
+ rope<_CharT,_Alloc>& container() { return *_M_root_rope; }
+ _Rope_iterator() {
+ this->_M_root = 0; // Needed for reference counting.
+ }
+ _Rope_iterator(const _Self& __x) :
+ _Rope_iterator_base<_CharT,_Alloc>(__x) {
+ _M_root_rope = __x._M_root_rope;
+ _RopeRep::_S_ref(this->_M_root);
+ }
+ _Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos);
+ _Self& operator= (const _Self& __x) {
+ _RopeRep* __old = this->_M_root;
+ _RopeRep::_S_ref(__x._M_root);
+ _Base::operator=(__x);
+ _M_root_rope = __x._M_root_rope;
+ _RopeRep::_S_unref(__old);
+ return *this;
+ }
+ reference operator*() {
+ _M_check();
+ if (0 == this->_M_buf_ptr) {
+ return reference(_M_root_rope, this->_M_current_pos);
+ } else {
+ return reference(_M_root_rope, this->_M_current_pos, *(this->_M_buf_ptr));
+ }
+ }
+ _Self& operator++() {
+ this->_M_incr(1);
+ return *this;
+ }
+ _Self& operator+=(ptrdiff_t __n) {
+ if (__n >= 0) {
+ this->_M_incr(__n);
+ } else {
+ this->_M_decr(-__n);
+ }
+ return *this;
+ }
+ _Self& operator--() {
+ this->_M_decr(1);
+ return *this;
+ }
+ _Self& operator-=(ptrdiff_t __n) {
+ if (__n >= 0) {
+ this->_M_decr(__n);
+ } else {
+ this->_M_incr(-__n);
+ }
+ return *this;
+ }
+ _Self operator++(int) {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_incr(1);
+ return _Self(_M_root_rope, __old_pos);
+ }
+ _Self operator--(int) {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_decr(1);
+ return _Self(_M_root_rope, __old_pos);
+ }
+ reference operator[](ptrdiff_t __n) {
+ return reference(_M_root_rope, this->_M_current_pos + __n);
+ }
+};
+
+# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+template <class _CharT, class _Alloc>
+inline random_access_iterator_tag
+iterator_category(const _Rope_iterator<_CharT,_Alloc>&) { return random_access_iterator_tag();}
+template <class _CharT, class _Alloc>
+inline _CharT* value_type(const _Rope_iterator<_CharT,_Alloc>&) { return 0; }
+template <class _CharT, class _Alloc>
+inline ptrdiff_t* distance_type(const _Rope_iterator<_CharT,_Alloc>&) { return 0; }
+template <class _CharT, class _Alloc>
+inline random_access_iterator_tag
+iterator_category(const _Rope_const_iterator<_CharT,_Alloc>&) { return random_access_iterator_tag(); }
+template <class _CharT, class _Alloc>
+inline _CharT* value_type(const _Rope_const_iterator<_CharT,_Alloc>&) { return 0; }
+template <class _CharT, class _Alloc>
+inline ptrdiff_t* distance_type(const _Rope_const_iterator<_CharT,_Alloc>&) { return 0; }
+#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
+
+template <class _CharT, class _Alloc, class _CharConsumer>
+bool _S_apply_to_pieces(_CharConsumer& __c,
+ _Rope_RopeRep<_CharT, _Alloc> *__r,
+ size_t __begin, size_t __end);
+ // begin and end are assumed to be in range.
+
+template <class _CharT, class _Alloc>
+class rope
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<rope<_CharT, _Alloc> >
+#endif
+{
+ typedef rope<_CharT,_Alloc> _Self;
+public:
+ typedef _CharT value_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef _CharT const_reference;
+ typedef const _CharT* const_pointer;
+ typedef _Rope_iterator<_CharT,_Alloc> iterator;
+ typedef _Rope_const_iterator<_CharT,_Alloc> const_iterator;
+ typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference;
+ typedef _Rope_char_ptr_proxy<_CharT,_Alloc> pointer;
+
+ friend class _Rope_iterator<_CharT,_Alloc>;
+ friend class _Rope_const_iterator<_CharT,_Alloc>;
+ friend struct _Rope_RopeRep<_CharT,_Alloc>;
+ friend class _Rope_iterator_base<_CharT,_Alloc>;
+ friend class _Rope_char_ptr_proxy<_CharT,_Alloc>;
+ friend class _Rope_char_ref_proxy<_CharT,_Alloc>;
+ friend struct _Rope_RopeSubstring<_CharT,_Alloc>;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+protected:
+ typedef _CharT* _Cstrptr;
+
+ static _CharT _S_empty_c_str[1];
+
+ enum { _S_copy_max = 23 };
+ // For strings shorter than _S_copy_max, we copy to
+ // concatenate.
+
+ typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
+ typedef typename _RopeRep::_IsBasicCharType _IsBasicCharType;
+
+public:
+ _STLP_FORCE_ALLOCATORS(_CharT, _Alloc)
+ typedef _Alloc allocator_type;
+
+public:
+ // The only data member of a rope:
+ _STLP_PRIV _STLP_alloc_proxy<_RopeRep*, _CharT, allocator_type> _M_tree_ptr;
+
+public:
+ allocator_type get_allocator() const { return allocator_type(_M_tree_ptr); }
+
+public:
+ typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation;
+ typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
+ typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
+ typedef _Rope_RopeSubstring<_CharT,_Alloc> _RopeSubstring;
+
+ // Retrieve a character at the indicated position.
+ static _CharT _S_fetch(_RopeRep* __r, size_type __pos);
+
+ // Obtain a pointer to the character at the indicated position.
+ // The pointer can be used to change the character.
+ // If such a pointer cannot be produced, as is frequently the
+ // case, 0 is returned instead.
+ // (Returns nonzero only if all nodes in the path have a refcount
+ // of 1.)
+ static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos);
+
+ static void _S_unref(_RopeRep* __t) {
+ _RopeRep::_S_unref(__t);
+ }
+ static void _S_ref(_RopeRep* __t) {
+ _RopeRep::_S_ref(__t);
+ }
+
+ typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr;
+
+ // _Result is counted in refcount.
+ static _RopeRep* _S_substring(_RopeRep* __base,
+ size_t __start, size_t __endp1);
+
+ static _RopeRep* _S_concat_char_iter(_RopeRep* __r,
+ const _CharT* __iter, size_t __slen);
+ // Concatenate rope and char ptr, copying __s.
+ // Should really take an arbitrary iterator.
+ // Result is counted in refcount.
+ static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r,
+ const _CharT* __iter, size_t __slen);
+ // As above, but one reference to __r is about to be
+ // destroyed. Thus the pieces may be recycled if all
+ // relevent reference counts are 1.
+
+ // General concatenation on _RopeRep. _Result
+ // has refcount of 1. Adjusts argument refcounts.
+ static _RopeRep* _S_concat_rep(_RopeRep* __left, _RopeRep* __right);
+
+public:
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _CharConsumer>
+#else
+ typedef _Rope_char_consumer<_CharT> _CharConsumer;
+#endif
+ void apply_to_pieces(size_t __begin, size_t __end,
+ _CharConsumer& __c) const
+ { _S_apply_to_pieces(__c, _M_tree_ptr._M_data, __begin, __end); }
+
+protected:
+
+ static size_t _S_rounded_up_size(size_t __n)
+ { return _RopeRep::_S_rounded_up_size(__n); }
+
+ // Allocate and construct a RopeLeaf using the supplied allocator
+ // Takes ownership of s instead of copying.
+ static _RopeLeaf* _S_new_RopeLeaf(_CharT *__s,
+ size_t _p_size, allocator_type __a) {
+ _RopeLeaf* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
+ _RopeLeaf).allocate(1);
+ _STLP_TRY {
+ new(__space) _RopeLeaf(__s, _p_size, __a);
+ }
+ _STLP_UNWIND(_STLP_CREATE_ALLOCATOR(allocator_type,__a,
+ _RopeLeaf).deallocate(__space, 1))
+ return __space;
+ }
+
+ static _RopeConcatenation* _S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right,
+ allocator_type __a) {
+ _RopeConcatenation* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
+ _RopeConcatenation).allocate(1);
+ return new(__space) _RopeConcatenation(__left, __right, __a);
+ }
+
+ static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f,
+ size_t _p_size, bool __d, allocator_type __a) {
+ _RopeFunction* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
+ _RopeFunction).allocate(1);
+ return new(__space) _RopeFunction(__f, _p_size, __d, __a);
+ }
+
+ static _RopeSubstring* _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
+ size_t __l, allocator_type __a) {
+ _RopeSubstring* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a,
+ _RopeSubstring).allocate(1);
+ return new(__space) _RopeSubstring(__b, __s, __l, __a);
+ }
+
+ static
+ _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
+ size_t _p_size, allocator_type __a) {
+ if (0 == _p_size) return 0;
+
+ _CharT* __buf = _STLP_CREATE_ALLOCATOR(allocator_type,__a, _CharT).allocate(_S_rounded_up_size(_p_size));
+
+ _STLP_PRIV __ucopy_n(__s, _p_size, __buf);
+ _S_construct_null(__buf + _p_size);
+
+ _STLP_TRY {
+ return _S_new_RopeLeaf(__buf, _p_size, __a);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__buf, _p_size, __a))
+ _STLP_RET_AFTER_THROW(0)
+ }
+
+
+ // Concatenation of nonempty strings.
+ // Always builds a concatenation node.
+ // Rebalances if the result is too deep.
+ // Result has refcount 1.
+ // Does not increment left and right ref counts even though
+ // they are referenced.
+ static _RopeRep*
+ _S_tree_concat(_RopeRep* __left, _RopeRep* __right);
+
+ // Concatenation helper functions
+ static _RopeLeaf*
+ _S_leaf_concat_char_iter(_RopeLeaf* __r,
+ const _CharT* __iter, size_t __slen);
+ // Concatenate by copying leaf.
+ // should take an arbitrary iterator
+ // result has refcount 1.
+ static _RopeLeaf* _S_destr_leaf_concat_char_iter
+ (_RopeLeaf* __r, const _CharT* __iter, size_t __slen);
+ // A version that potentially clobbers __r if __r->_M_ref_count == 1.
+
+
+ // A helper function for exponentiating strings.
+ // This uses a nonstandard refcount convention.
+ // The result has refcount 0.
+ typedef _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc> _Concat_fn;
+#if !defined (__GNUC__) || (__GNUC__ < 3)
+ friend _Concat_fn;
+#else
+ friend struct _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc>;
+#endif
+
+public:
+ static size_t _S_char_ptr_len(const _CharT* __s) {
+ return char_traits<_CharT>::length(__s);
+ }
+
+public: /* for operators */
+ rope(_RopeRep* __t, const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, __t) { }
+private:
+ // Copy __r to the _CharT buffer.
+ // Returns __buffer + __r->_M_size._M_data.
+ // Assumes that buffer is uninitialized.
+ static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer);
+
+ // Again, with explicit starting position and length.
+ // Assumes that buffer is uninitialized.
+ static _CharT* _S_flatten(_RopeRep* __r,
+ size_t __start, size_t __len,
+ _CharT* __buffer);
+
+ // fbp : HP aCC prohibits access to protected min_len from within static methods ( ?? )
+public:
+ static const unsigned long _S_min_len[__ROPE_DEPTH_SIZE];
+protected:
+ static bool _S_is_balanced(_RopeRep* __r)
+ { return (__r->_M_size._M_data >= _S_min_len[__r->_M_depth]); }
+
+ static bool _S_is_almost_balanced(_RopeRep* __r) {
+ return (__r->_M_depth == 0 ||
+ __r->_M_size._M_data >= _S_min_len[__r->_M_depth - 1]);
+ }
+
+ static bool _S_is_roughly_balanced(_RopeRep* __r) {
+ return (__r->_M_depth <= 1 ||
+ __r->_M_size._M_data >= _S_min_len[__r->_M_depth - 2]);
+ }
+
+ // Assumes the result is not empty.
+ static _RopeRep* _S_concat_and_set_balanced(_RopeRep* __left,
+ _RopeRep* __right) {
+ _RopeRep* __result = _S_concat_rep(__left, __right);
+ if (_S_is_balanced(__result)) __result->_M_is_balanced = true;
+ return __result;
+ }
+
+ // The basic rebalancing operation. Logically copies the
+ // rope. The result has refcount of 1. The client will
+ // usually decrement the reference count of __r.
+ // The result is within height 2 of balanced by the above
+ // definition.
+ static _RopeRep* _S_balance(_RopeRep* __r);
+
+ // Add all unbalanced subtrees to the forest of balanceed trees.
+ // Used only by balance.
+ static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest);
+
+ // Add __r to forest, assuming __r is already balanced.
+ static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest);
+
+#ifdef _STLP_DEBUG
+ // Print to stdout, exposing structure
+ static void _S_dump(_RopeRep* __r, int __indent = 0);
+#endif
+
+ // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp.
+ static int _S_compare(const _RopeRep* __x, const _RopeRep* __y);
+
+ void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
+
+ void _M_reset(_RopeRep* __r) {
+ //if (__r != _M_tree_ptr._M_data) {
+ _S_unref(_M_tree_ptr._M_data);
+ _M_tree_ptr._M_data = __r;
+ //}
+ }
+
+public:
+ bool empty() const { return 0 == _M_tree_ptr._M_data; }
+
+ // Comparison member function. This is public only for those
+ // clients that need a ternary comparison. Others
+ // should use the comparison operators below.
+ int compare(const _Self& __y) const {
+ return _S_compare(_M_tree_ptr._M_data, __y._M_tree_ptr._M_data);
+ }
+
+ rope(const _CharT* __s, const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, _S_RopeLeaf_from_unowned_char_ptr(__s, _S_char_ptr_len(__s),__a))
+ {}
+
+ rope(const _CharT* __s, size_t __len,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, (_S_RopeLeaf_from_unowned_char_ptr(__s, __len, __a)))
+ {}
+
+ // Should perhaps be templatized with respect to the iterator type
+ // and use Sequence_buffer. (It should perhaps use sequence_buffer
+ // even now.)
+ rope(const _CharT *__s, const _CharT *__e,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, _S_RopeLeaf_from_unowned_char_ptr(__s, __e - __s, __a))
+ {}
+
+ rope(const const_iterator& __s, const const_iterator& __e,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, _S_substring(__s._M_root, __s._M_current_pos,
+ __e._M_current_pos))
+ {}
+
+ rope(const iterator& __s, const iterator& __e,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, _S_substring(__s._M_root, __s._M_current_pos,
+ __e._M_current_pos))
+ {}
+
+ rope(_CharT __c, const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, (_RopeRep*)0) {
+ _CharT* __buf = _M_tree_ptr.allocate(_S_rounded_up_size(1));
+
+ _Copy_Construct(__buf, __c);
+ _S_construct_null(__buf + 1);
+
+ _STLP_TRY {
+ _M_tree_ptr._M_data = _S_new_RopeLeaf(__buf, 1, __a);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__buf, 1, __a))
+ }
+
+ rope(size_t __n, _CharT __c,
+ const allocator_type& __a = allocator_type()):
+ _M_tree_ptr(__a, (_RopeRep*)0) {
+ if (0 == __n)
+ return;
+
+ rope<_CharT,_Alloc> __result;
+# define __exponentiate_threshold size_t(32)
+ _RopeRep* __remainder;
+ rope<_CharT,_Alloc> __remainder_rope;
+
+ // gcc-2.7.2 bugs
+ typedef _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc> _Concat_fn;
+
+ size_t __exponent = __n / __exponentiate_threshold;
+ size_t __rest = __n % __exponentiate_threshold;
+ if (0 == __rest) {
+ __remainder = 0;
+ } else {
+ _CharT* __rest_buffer = _M_tree_ptr.allocate(_S_rounded_up_size(__rest));
+ uninitialized_fill_n(__rest_buffer, __rest, __c);
+ _S_construct_null(__rest_buffer + __rest);
+ _STLP_TRY {
+ __remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__rest_buffer, __rest, __a))
+ }
+ __remainder_rope._M_tree_ptr._M_data = __remainder;
+ if (__exponent != 0) {
+ _CharT* __base_buffer = _M_tree_ptr.allocate(_S_rounded_up_size(__exponentiate_threshold));
+ _RopeLeaf* __base_leaf;
+ rope<_CharT,_Alloc> __base_rope;
+ uninitialized_fill_n(__base_buffer, __exponentiate_threshold, __c);
+ _S_construct_null(__base_buffer + __exponentiate_threshold);
+ _STLP_TRY {
+ __base_leaf = _S_new_RopeLeaf(__base_buffer,
+ __exponentiate_threshold, __a);
+ }
+ _STLP_UNWIND(_RopeRep::_S_free_string(__base_buffer,
+ __exponentiate_threshold, __a))
+ __base_rope._M_tree_ptr._M_data = __base_leaf;
+ if (1 == __exponent) {
+ __result = __base_rope;
+ // One each for base_rope and __result
+ //_STLP_ASSERT(2 == __result._M_tree_ptr._M_data->_M_ref_count)
+ } else {
+ __result = _STLP_PRIV __power(__base_rope, __exponent, _Concat_fn());
+ }
+ if (0 != __remainder) {
+ __result += __remainder_rope;
+ }
+ } else {
+ __result = __remainder_rope;
+ }
+ _M_tree_ptr._M_data = __result._M_tree_ptr._M_data;
+ _M_tree_ptr._M_data->_M_ref_nonnil();
+# undef __exponentiate_threshold
+ }
+
+ rope(const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, (_RopeRep*)0) {}
+
+ // Construct a rope from a function that can compute its members
+ rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn,
+ const allocator_type& __a = allocator_type())
+ : _M_tree_ptr(__a, (_RopeRep*)0) {
+ _M_tree_ptr._M_data = (0 == __len) ?
+ 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
+ }
+
+ rope(const _Self& __x)
+ : _M_tree_ptr(__x._M_tree_ptr, __x._M_tree_ptr._M_data) {
+ _S_ref(_M_tree_ptr._M_data);
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ rope(__move_source<_Self> __src)
+ : _M_tree_ptr(__src.get()._M_tree_ptr, __src.get()._M_tree_ptr._M_data) {
+ __src.get()._M_tree_ptr._M_data = 0;
+ }
+#endif
+
+ ~rope() {
+ _S_unref(_M_tree_ptr._M_data);
+ }
+
+ _Self& operator=(const _Self& __x) {
+ _STLP_ASSERT(get_allocator() == __x.get_allocator())
+ _S_ref(__x._M_tree_ptr._M_data);
+ _M_reset(__x._M_tree_ptr._M_data);
+ return *this;
+ }
+
+ void clear() {
+ _S_unref(_M_tree_ptr._M_data);
+ _M_tree_ptr._M_data = 0;
+ }
+ void push_back(_CharT __x) {
+ _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, &__x, 1));
+ }
+
+ void pop_back() {
+ _RopeRep* __old = _M_tree_ptr._M_data;
+ _M_tree_ptr._M_data =
+ _S_substring(_M_tree_ptr._M_data, 0, _M_tree_ptr._M_data->_M_size._M_data - 1);
+ _S_unref(__old);
+ }
+
+ _CharT back() const {
+ return _S_fetch(_M_tree_ptr._M_data, _M_tree_ptr._M_data->_M_size._M_data - 1);
+ }
+
+ void push_front(_CharT __x) {
+ _RopeRep* __old = _M_tree_ptr._M_data;
+ _RopeRep* __left =
+ _S_RopeLeaf_from_unowned_char_ptr(&__x, 1, _M_tree_ptr);
+ _STLP_TRY {
+ _M_tree_ptr._M_data = _S_concat_rep(__left, _M_tree_ptr._M_data);
+ _S_unref(__old);
+ _S_unref(__left);
+ }
+ _STLP_UNWIND(_S_unref(__left))
+ }
+
+ void pop_front() {
+ _RopeRep* __old = _M_tree_ptr._M_data;
+ _M_tree_ptr._M_data = _S_substring(_M_tree_ptr._M_data, 1, _M_tree_ptr._M_data->_M_size._M_data);
+ _S_unref(__old);
+ }
+
+ _CharT front() const {
+ return _S_fetch(_M_tree_ptr._M_data, 0);
+ }
+
+ void balance() {
+ _RopeRep* __old = _M_tree_ptr._M_data;
+ _M_tree_ptr._M_data = _S_balance(_M_tree_ptr._M_data);
+ _S_unref(__old);
+ }
+
+ void copy(_CharT* __buffer) const {
+ _STLP_STD::_Destroy_Range(__buffer, __buffer + size());
+ _S_flatten(_M_tree_ptr._M_data, __buffer);
+ }
+
+ /*
+ * This is the copy function from the standard, but
+ * with the arguments reordered to make it consistent with the
+ * rest of the interface.
+ * Note that this guaranteed not to compile if the draft standard
+ * order is assumed.
+ */
+ size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const {
+ size_t _p_size = size();
+ size_t __len = (__pos + __n > _p_size? _p_size - __pos : __n);
+
+ _STLP_STD::_Destroy_Range(__buffer, __buffer + __len);
+ _S_flatten(_M_tree_ptr._M_data, __pos, __len, __buffer);
+ return __len;
+ }
+
+# ifdef _STLP_DEBUG
+ // Print to stdout, exposing structure. May be useful for
+ // performance debugging.
+ void dump() {
+ _S_dump(_M_tree_ptr._M_data);
+ }
+# endif
+
+ // Convert to 0 terminated string in new allocated memory.
+ // Embedded 0s in the input do not terminate the copy.
+ const _CharT* c_str() const;
+
+ // As above, but also use the flattened representation as the
+ // the new rope representation.
+ const _CharT* replace_with_c_str();
+
+ // Reclaim memory for the c_str generated flattened string.
+ // Intentionally undocumented, since it's hard to say when this
+ // is safe for multiple threads.
+ void delete_c_str () {
+ if (0 == _M_tree_ptr._M_data) return;
+ if (_RopeRep::_S_leaf == _M_tree_ptr._M_data->_M_tag &&
+ ((_RopeLeaf*)_M_tree_ptr._M_data)->_M_data ==
+ _M_tree_ptr._M_data->_M_c_string) {
+ // Representation shared
+ return;
+ }
+ _M_tree_ptr._M_data->_M_free_c_string();
+ _M_tree_ptr._M_data->_M_c_string = 0;
+ }
+
+ _CharT operator[] (size_type __pos) const {
+ return _S_fetch(_M_tree_ptr._M_data, __pos);
+ }
+
+ _CharT at(size_type __pos) const {
+ if (__pos >= size()) _M_throw_out_of_range();
+ return (*this)[__pos];
+ }
+
+ const_iterator begin() const {
+ return(const_iterator(_M_tree_ptr._M_data, 0));
+ }
+
+ // An easy way to get a const iterator from a non-const container.
+ const_iterator const_begin() const {
+ return(const_iterator(_M_tree_ptr._M_data, 0));
+ }
+
+ const_iterator end() const {
+ return(const_iterator(_M_tree_ptr._M_data, size()));
+ }
+
+ const_iterator const_end() const {
+ return(const_iterator(_M_tree_ptr._M_data, size()));
+ }
+
+ size_type size() const {
+ return(0 == _M_tree_ptr._M_data? 0 : _M_tree_ptr._M_data->_M_size._M_data);
+ }
+
+ size_type length() const {
+ return size();
+ }
+
+ size_type max_size() const {
+ return _S_min_len[__ROPE_MAX_DEPTH-1] - 1;
+ // Guarantees that the result can be sufficiently
+ // balanced. Longer ropes will probably still work,
+ // but it's harder to make guarantees.
+ }
+
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
+
+ const_reverse_iterator const_rbegin() const {
+ return const_reverse_iterator(end());
+ }
+
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(begin());
+ }
+
+ const_reverse_iterator const_rend() const {
+ return const_reverse_iterator(begin());
+ }
+ // The symmetric cases are intentionally omitted, since they're presumed
+ // to be less common, and we don't handle them as well.
+
+ // The following should really be templatized.
+ // The first argument should be an input iterator or
+ // forward iterator with value_type _CharT.
+ _Self& append(const _CharT* __iter, size_t __n) {
+ _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, __iter, __n));
+ return *this;
+ }
+
+ _Self& append(const _CharT* __c_string) {
+ size_t __len = _S_char_ptr_len(__c_string);
+ append(__c_string, __len);
+ return *this;
+ }
+
+ _Self& append(const _CharT* __s, const _CharT* __e) {
+ _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, __s, __e - __s));
+ return *this;
+ }
+
+ _Self& append(const_iterator __s, const_iterator __e) {
+ _STLP_ASSERT(__s._M_root == __e._M_root)
+ _STLP_ASSERT(get_allocator() == __s._M_root->get_allocator())
+ _Self_destruct_ptr __appendee(_S_substring(__s._M_root, __s._M_current_pos, __e._M_current_pos));
+ _M_reset(_S_concat_rep(_M_tree_ptr._M_data, (_RopeRep*)__appendee));
+ return *this;
+ }
+
+ _Self& append(_CharT __c) {
+ _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, &__c, 1));
+ return *this;
+ }
+
+ _Self& append() { return append(_CharT()); } // XXX why?
+
+ _Self& append(const _Self& __y) {
+ _STLP_ASSERT(__y.get_allocator() == get_allocator())
+ _M_reset(_S_concat_rep(_M_tree_ptr._M_data, __y._M_tree_ptr._M_data));
+ return *this;
+ }
+
+ _Self& append(size_t __n, _CharT __c) {
+ rope<_CharT,_Alloc> __last(__n, __c);
+ return append(__last);
+ }
+
+ void swap(_Self& __b) {
+ _M_tree_ptr.swap(__b._M_tree_ptr);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+protected:
+ // Result is included in refcount.
+ static _RopeRep* replace(_RopeRep* __old, size_t __pos1,
+ size_t __pos2, _RopeRep* __r) {
+ if (0 == __old) { _S_ref(__r); return __r; }
+ _Self_destruct_ptr __left(_S_substring(__old, 0, __pos1));
+ _Self_destruct_ptr __right(_S_substring(__old, __pos2, __old->_M_size._M_data));
+ _STLP_MPWFIX_TRY //*TY 06/01/2000 -
+ _RopeRep* __result;
+
+ if (0 == __r) {
+ __result = _S_concat_rep(__left, __right);
+ } else {
+ _STLP_ASSERT(__old->get_allocator() == __r->get_allocator())
+ _Self_destruct_ptr __left_result(_S_concat_rep(__left, __r));
+ __result = _S_concat_rep(__left_result, __right);
+ }
+ return __result;
+ _STLP_MPWFIX_CATCH //*TY 06/01/2000 -
+ }
+
+public:
+ void insert(size_t __p, const _Self& __r) {
+ if (__p > size()) _M_throw_out_of_range();
+ _STLP_ASSERT(get_allocator() == __r.get_allocator())
+ _M_reset(replace(_M_tree_ptr._M_data, __p, __p, __r._M_tree_ptr._M_data));
+ }
+
+ void insert(size_t __p, size_t __n, _CharT __c) {
+ rope<_CharT,_Alloc> __r(__n,__c);
+ insert(__p, __r);
+ }
+
+ void insert(size_t __p, const _CharT* __i, size_t __n) {
+ if (__p > size()) _M_throw_out_of_range();
+ _Self_destruct_ptr __left(_S_substring(_M_tree_ptr._M_data, 0, __p));
+ _Self_destruct_ptr __right(_S_substring(_M_tree_ptr._M_data, __p, size()));
+ _Self_destruct_ptr __left_result(
+ _S_concat_char_iter(__left, __i, __n));
+ // _S_ destr_concat_char_iter should be safe here.
+ // But as it stands it's probably not a win, since __left
+ // is likely to have additional references.
+ _M_reset(_S_concat_rep(__left_result, __right));
+ }
+
+ void insert(size_t __p, const _CharT* __c_string) {
+ insert(__p, __c_string, _S_char_ptr_len(__c_string));
+ }
+
+ void insert(size_t __p, _CharT __c) {
+ insert(__p, &__c, 1);
+ }
+
+ void insert(size_t __p) {
+ _CharT __c = _CharT();
+ insert(__p, &__c, 1);
+ }
+
+ void insert(size_t __p, const _CharT* __i, const _CharT* __j) {
+ _Self __r(__i, __j);
+ insert(__p, __r);
+ }
+
+ void insert(size_t __p, const const_iterator& __i,
+ const const_iterator& __j) {
+ _Self __r(__i, __j);
+ insert(__p, __r);
+ }
+
+ void insert(size_t __p, const iterator& __i,
+ const iterator& __j) {
+ _Self __r(__i, __j);
+ insert(__p, __r);
+ }
+
+ // (position, length) versions of replace operations:
+ void replace(size_t __p, size_t __n, const _Self& __r) {
+ if (__p > size()) _M_throw_out_of_range();
+ _M_reset(replace(_M_tree_ptr._M_data, __p, __p + __n, __r._M_tree_ptr._M_data));
+ }
+
+ void replace(size_t __p, size_t __n,
+ const _CharT* __i, size_t __i_len) {
+ _Self __r(__i, __i_len);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n, _CharT __c) {
+ _Self __r(__c);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n, const _CharT* __c_string) {
+ _Self __r(__c_string);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n,
+ const _CharT* __i, const _CharT* __j) {
+ _Self __r(__i, __j);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n,
+ const const_iterator& __i, const const_iterator& __j) {
+ _Self __r(__i, __j);
+ replace(__p, __n, __r);
+ }
+
+ void replace(size_t __p, size_t __n,
+ const iterator& __i, const iterator& __j) {
+ _Self __r(__i, __j);
+ replace(__p, __n, __r);
+ }
+
+ // Single character variants:
+ void replace(size_t __p, _CharT __c) {
+ if (__p > size()) _M_throw_out_of_range();
+ iterator __i(this, __p);
+ *__i = __c;
+ }
+
+ void replace(size_t __p, const _Self& __r) {
+ replace(__p, 1, __r);
+ }
+
+ void replace(size_t __p, const _CharT* __i, size_t __i_len) {
+ replace(__p, 1, __i, __i_len);
+ }
+
+ void replace(size_t __p, const _CharT* __c_string) {
+ replace(__p, 1, __c_string);
+ }
+
+ void replace(size_t __p, const _CharT* __i, const _CharT* __j) {
+ replace(__p, 1, __i, __j);
+ }
+
+ void replace(size_t __p, const const_iterator& __i,
+ const const_iterator& __j) {
+ replace(__p, 1, __i, __j);
+ }
+
+ void replace(size_t __p, const iterator& __i,
+ const iterator& __j) {
+ replace(__p, 1, __i, __j);
+ }
+
+ // Erase, (position, size) variant.
+ void erase(size_t __p, size_t __n) {
+ if (__p > size()) _M_throw_out_of_range();
+ _M_reset(replace(_M_tree_ptr._M_data, __p, __p + __n, 0));
+ }
+
+ // Erase, single character
+ void erase(size_t __p) {
+ erase(__p, __p + 1);
+ }
+
+ // Insert, iterator variants.
+ iterator insert(const iterator& __p, const _Self& __r)
+ { insert(__p.index(), __r); return __p; }
+ iterator insert(const iterator& __p, size_t __n, _CharT __c)
+ { insert(__p.index(), __n, __c); return __p; }
+ iterator insert(const iterator& __p, _CharT __c)
+ { insert(__p.index(), __c); return __p; }
+ iterator insert(const iterator& __p )
+ { insert(__p.index()); return __p; }
+ iterator insert(const iterator& __p, const _CharT* c_string)
+ { insert(__p.index(), c_string); return __p; }
+ iterator insert(const iterator& __p, const _CharT* __i, size_t __n)
+ { insert(__p.index(), __i, __n); return __p; }
+ iterator insert(const iterator& __p, const _CharT* __i,
+ const _CharT* __j)
+ { insert(__p.index(), __i, __j); return __p; }
+ iterator insert(const iterator& __p,
+ const const_iterator& __i, const const_iterator& __j)
+ { insert(__p.index(), __i, __j); return __p; }
+ iterator insert(const iterator& __p,
+ const iterator& __i, const iterator& __j)
+ { insert(__p.index(), __i, __j); return __p; }
+
+ // Replace, range variants.
+ void replace(const iterator& __p, const iterator& __q,
+ const _Self& __r)
+ { replace(__p.index(), __q.index() - __p.index(), __r); }
+ void replace(const iterator& __p, const iterator& __q, _CharT __c)
+ { replace(__p.index(), __q.index() - __p.index(), __c); }
+ void replace(const iterator& __p, const iterator& __q,
+ const _CharT* __c_string)
+ { replace(__p.index(), __q.index() - __p.index(), __c_string); }
+ void replace(const iterator& __p, const iterator& __q,
+ const _CharT* __i, size_t __n)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __n); }
+ void replace(const iterator& __p, const iterator& __q,
+ const _CharT* __i, const _CharT* __j)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
+ void replace(const iterator& __p, const iterator& __q,
+ const const_iterator& __i, const const_iterator& __j)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
+ void replace(const iterator& __p, const iterator& __q,
+ const iterator& __i, const iterator& __j)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
+
+ // Replace, iterator variants.
+ void replace(const iterator& __p, const _Self& __r)
+ { replace(__p.index(), __r); }
+ void replace(const iterator& __p, _CharT __c)
+ { replace(__p.index(), __c); }
+ void replace(const iterator& __p, const _CharT* __c_string)
+ { replace(__p.index(), __c_string); }
+ void replace(const iterator& __p, const _CharT* __i, size_t __n)
+ { replace(__p.index(), __i, __n); }
+ void replace(const iterator& __p, const _CharT* __i, const _CharT* __j)
+ { replace(__p.index(), __i, __j); }
+ void replace(const iterator& __p, const_iterator __i,
+ const_iterator __j)
+ { replace(__p.index(), __i, __j); }
+ void replace(const iterator& __p, iterator __i, iterator __j)
+ { replace(__p.index(), __i, __j); }
+
+ // Iterator and range variants of erase
+ iterator erase(const iterator& __p, const iterator& __q) {
+ size_t __p_index = __p.index();
+ erase(__p_index, __q.index() - __p_index);
+ return iterator(this, __p_index);
+ }
+ iterator erase(const iterator& __p) {
+ size_t __p_index = __p.index();
+ erase(__p_index, 1);
+ return iterator(this, __p_index);
+ }
+
+ _Self substr(size_t __start, size_t __len = 1) const {
+ if (__start > size()) _M_throw_out_of_range();
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start, __start + __len));
+ }
+
+ _Self substr(iterator __start, iterator __end) const {
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start.index(), __end.index()));
+ }
+
+ _Self substr(iterator __start) const {
+ size_t __pos = __start.index();
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __pos, __pos + 1));
+ }
+
+ _Self substr(const_iterator __start, const_iterator __end) const {
+ // This might eventually take advantage of the cache in the
+ // iterator.
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start.index(), __end.index()));
+ }
+
+ rope<_CharT,_Alloc> substr(const_iterator __start) {
+ size_t __pos = __start.index();
+ return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __pos, __pos + 1));
+ }
+
+#include <stl/_string_npos.h>
+
+ size_type find(const _Self& __s, size_type __pos = 0) const {
+ if (__pos >= size())
+# ifndef _STLP_OLD_ROPE_SEMANTICS
+ return npos;
+# else
+ return size();
+# endif
+
+ size_type __result_pos;
+ const_iterator __result = _STLP_STD::search(const_begin() + (ptrdiff_t)__pos, const_end(), __s.begin(), __s.end() );
+ __result_pos = __result.index();
+# ifndef _STLP_OLD_ROPE_SEMANTICS
+ if (__result_pos == size()) __result_pos = npos;
+# endif
+ return __result_pos;
+ }
+ size_type find(_CharT __c, size_type __pos = 0) const;
+ size_type find(const _CharT* __s, size_type __pos = 0) const {
+ size_type __result_pos;
+ const_iterator __result = _STLP_STD::search(const_begin() + (ptrdiff_t)__pos, const_end(),
+ __s, __s + _S_char_ptr_len(__s));
+ __result_pos = __result.index();
+# ifndef _STLP_OLD_ROPE_SEMANTICS
+ if (__result_pos == size()) __result_pos = npos;
+# endif
+ return __result_pos;
+ }
+
+ iterator mutable_begin() {
+ return(iterator(this, 0));
+ }
+
+ iterator mutable_end() {
+ return(iterator(this, size()));
+ }
+
+ reverse_iterator mutable_rbegin() {
+ return reverse_iterator(mutable_end());
+ }
+
+ reverse_iterator mutable_rend() {
+ return reverse_iterator(mutable_begin());
+ }
+
+ reference mutable_reference_at(size_type __pos) {
+ return reference(this, __pos);
+ }
+
+# ifdef __STD_STUFF
+ reference operator[] (size_type __pos) {
+ return reference(this, __pos);
+ }
+
+ reference at(size_type __pos) {
+ if (__pos >= size()) _M_throw_out_of_range();
+ return (*this)[__pos];
+ }
+
+ void resize(size_type, _CharT) {}
+ void resize(size_type) {}
+ void reserve(size_type = 0) {}
+ size_type capacity() const {
+ return max_size();
+ }
+
+ // Stuff below this line is dangerous because it's error prone.
+ // I would really like to get rid of it.
+ // copy function with funny arg ordering.
+ size_type copy(_CharT* __buffer, size_type __n,
+ size_type __pos = 0) const {
+ return copy(__pos, __n, __buffer);
+ }
+
+ iterator end() { return mutable_end(); }
+
+ iterator begin() { return mutable_begin(); }
+
+ reverse_iterator rend() { return mutable_rend(); }
+
+ reverse_iterator rbegin() { return mutable_rbegin(); }
+
+# else
+
+ const_iterator end() { return const_end(); }
+
+ const_iterator begin() { return const_begin(); }
+
+ const_reverse_iterator rend() { return const_rend(); }
+
+ const_reverse_iterator rbegin() { return const_rbegin(); }
+
+# endif
+}; //class rope
+
+#if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
+template <class _CharT, class _Alloc>
+const size_t rope<_CharT, _Alloc>::npos = ~(size_t) 0;
+#endif
+
+template <class _CharT, class _Alloc>
+inline _CharT
+_Rope_const_iterator< _CharT, _Alloc>::operator[](size_t __n)
+{ return rope<_CharT,_Alloc>::_S_fetch(this->_M_root, this->_M_current_pos + __n); }
+
+template <class _CharT, class _Alloc>
+inline bool operator== (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y) {
+ return (__x._M_current_pos == __y._M_current_pos &&
+ __x._M_root == __y._M_root);
+}
+
+template <class _CharT, class _Alloc>
+inline bool operator< (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return (__x._M_current_pos < __y._M_current_pos); }
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _CharT, class _Alloc>
+inline bool operator!= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return !(__x == __y); }
+
+template <class _CharT, class _Alloc>
+inline bool operator> (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return __y < __x; }
+
+template <class _CharT, class _Alloc>
+inline bool operator<= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return !(__y < __x); }
+
+template <class _CharT, class _Alloc>
+inline bool operator>= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return !(__x < __y); }
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _CharT, class _Alloc>
+inline ptrdiff_t operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x,
+ const _Rope_const_iterator<_CharT,_Alloc>& __y)
+{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }
+
+#if !defined( __MWERKS__ ) || __MWERKS__ >= 0x2000 // dwa 8/21/97 - "ambiguous access to overloaded function" bug.
+template <class _CharT, class _Alloc>
+inline _Rope_const_iterator<_CharT,_Alloc>
+operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n)
+{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos - __n); }
+# endif
+
+template <class _CharT, class _Alloc>
+inline _Rope_const_iterator<_CharT,_Alloc>
+operator+(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n)
+{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos + __n); }
+
+template <class _CharT, class _Alloc>
+inline _Rope_const_iterator<_CharT,_Alloc>
+operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT,_Alloc>& __x)
+{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos + __n); }
+
+template <class _CharT, class _Alloc>
+inline bool operator== (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y) {
+ return (__x._M_current_pos == __y._M_current_pos &&
+ __x._M_root_rope == __y._M_root_rope);
+}
+
+template <class _CharT, class _Alloc>
+inline bool operator< (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return (__x._M_current_pos < __y._M_current_pos); }
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template <class _CharT, class _Alloc>
+inline bool operator!= (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return !(__x == __y); }
+
+template <class _CharT, class _Alloc>
+inline bool operator> (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return __y < __x; }
+
+template <class _CharT, class _Alloc>
+inline bool operator<= (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return !(__y < __x); }
+
+template <class _CharT, class _Alloc>
+inline bool operator>= (const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return !(__x < __y); }
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _CharT, class _Alloc>
+inline ptrdiff_t operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
+ const _Rope_iterator<_CharT,_Alloc>& __y)
+{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }
+
+#if !defined( __MWERKS__ ) || __MWERKS__ >= 0x2000 // dwa 8/21/97 - "ambiguous access to overloaded function" bug.
+template <class _CharT, class _Alloc>
+inline _Rope_iterator<_CharT,_Alloc>
+operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
+ ptrdiff_t __n) {
+ return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos - __n);
+}
+# endif
+
+template <class _CharT, class _Alloc>
+inline _Rope_iterator<_CharT,_Alloc>
+operator+(const _Rope_iterator<_CharT,_Alloc>& __x,
+ ptrdiff_t __n) {
+ return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos + __n);
+}
+
+template <class _CharT, class _Alloc>
+inline _Rope_iterator<_CharT,_Alloc>
+operator+(ptrdiff_t __n, const _Rope_iterator<_CharT,_Alloc>& __x) {
+ return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos + __n);
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>
+operator+ (const rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right) {
+ _STLP_ASSERT(__left.get_allocator() == __right.get_allocator())
+ return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_rep(__left._M_tree_ptr._M_data, __right._M_tree_ptr._M_data));
+ // Inlining this should make it possible to keep __left and __right in registers.
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>&
+operator+= (rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right) {
+ __left.append(__right);
+ return __left;
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>
+operator+ (const rope<_CharT,_Alloc>& __left,
+ const _CharT* __right) {
+ size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right);
+ return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_char_iter(__left._M_tree_ptr._M_data, __right, __rlen));
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>&
+operator+= (rope<_CharT,_Alloc>& __left,
+ const _CharT* __right) {
+ __left.append(__right);
+ return __left;
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>
+operator+ (const rope<_CharT,_Alloc>& __left, _CharT __right) {
+ return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_char_iter(__left._M_tree_ptr._M_data, &__right, 1));
+}
+
+template <class _CharT, class _Alloc>
+inline rope<_CharT,_Alloc>&
+operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) {
+ __left.append(__right);
+ return __left;
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator< (const rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right) {
+ return __left.compare(__right) < 0;
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator== (const rope<_CharT,_Alloc>& __left,
+ const rope<_CharT,_Alloc>& __right) {
+ return __left.compare(__right) == 0;
+}
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _CharT, class _Alloc>
+inline bool
+operator!= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
+ return !(__x == __y);
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator> (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
+ return __y < __x;
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator<= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
+ return !(__y < __x);
+}
+
+template <class _CharT, class _Alloc>
+inline bool
+operator>= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
+ return !(__x < __y);
+}
+
+template <class _CharT, class _Alloc>
+inline bool operator!= (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
+ const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) {
+ return !(__x == __y);
+}
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+template <class _CharT, class _Alloc>
+inline bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
+ const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) {
+ return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root);
+}
+
+#if !defined (_STLP_USE_NO_IOSTREAMS)
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& operator<< (basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r);
+#endif
+
+typedef rope<char, allocator<char> > crope;
+#if defined (_STLP_HAS_WCHAR_T)
+typedef rope<wchar_t, allocator<wchar_t> > wrope;
+#endif
+
+inline crope::reference __mutable_reference_at(crope& __c, size_t __i)
+{ return __c.mutable_reference_at(__i); }
+
+#if defined (_STLP_HAS_WCHAR_T)
+inline wrope::reference __mutable_reference_at(wrope& __c, size_t __i)
+{ return __c.mutable_reference_at(__i); }
+#endif
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _CharT, class _Alloc>
+inline void swap(rope<_CharT,_Alloc>& __x, rope<_CharT,_Alloc>& __y)
+{ __x.swap(__y); }
+#else
+
+inline void swap(crope& __x, crope& __y) { __x.swap(__y); }
+# ifdef _STLP_HAS_WCHAR_T // dwa 8/21/97
+inline void swap(wrope& __x, wrope& __y) { __x.swap(__y); }
+# endif
+
+#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
+
+
+// Hash functions should probably be revisited later:
+_STLP_TEMPLATE_NULL struct hash<crope> {
+ size_t operator()(const crope& __str) const {
+ size_t _p_size = __str.size();
+
+ if (0 == _p_size) return 0;
+ return 13*__str[0] + 5*__str[_p_size - 1] + _p_size;
+ }
+};
+
+#if defined (_STLP_HAS_WCHAR_T) // dwa 8/21/97
+_STLP_TEMPLATE_NULL struct hash<wrope> {
+ size_t operator()(const wrope& __str) const {
+ size_t _p_size = __str.size();
+
+ if (0 == _p_size) return 0;
+ return 13*__str[0] + 5*__str[_p_size - 1] + _p_size;
+ }
+};
+#endif
+
+#if (!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310))
+// I couldn't get this to work with VC++
+template<class _CharT,class _Alloc>
+# if defined (__DMC__)
+extern
+# endif
+void _Rope_rotate(_Rope_iterator<_CharT, _Alloc> __first,
+ _Rope_iterator<_CharT, _Alloc> __middle,
+ _Rope_iterator<_CharT, _Alloc> __last);
+
+inline void rotate(_Rope_iterator<char, allocator<char> > __first,
+ _Rope_iterator<char, allocator<char> > __middle,
+ _Rope_iterator<char, allocator<char> > __last)
+{ _Rope_rotate(__first, __middle, __last); }
+#endif
+
+template <class _CharT, class _Alloc>
+inline _Rope_char_ref_proxy<_CharT, _Alloc>::operator _CharT () const {
+ if (_M_current_valid) {
+ return _M_current;
+ } else {
+ return _My_rope::_S_fetch(_M_root->_M_tree_ptr._M_data, _M_pos);
+ }
+}
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _CharT, class _Alloc>
+struct __move_traits<rope<_CharT, _Alloc> > {
+ typedef __true_type implemented;
+ //Completness depends on the allocator:
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_rope.c>
+#endif
+
+#endif /* _STLP_INTERNAL_ROPE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_set.h b/stlport/stl/_set.h
new file mode 100644
index 0000000..a8f6862
--- /dev/null
+++ b/stlport/stl/_set.h
@@ -0,0 +1,412 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_SET_H
+#define _STLP_INTERNAL_SET_H
+
+#ifndef _STLP_INTERNAL_TREE_H
+# include <stl/_tree.h>
+#endif
+
+#if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, Const_traits)
+
+template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Key>) >
+class set
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<set<_Key, _Compare, _Alloc> >
+#endif
+{
+ typedef set<_Key, _Compare, _Alloc> _Self;
+public:
+// typedefs:
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _SetTraitsT<value_type> _SetTraits;
+
+public:
+ //Following typedef have to be public for __move_traits specialization.
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_PRIV _Identity<value_type>,
+ _SetTraits, _Alloc> _Rep_type;
+
+ typedef typename _Rep_type::pointer pointer;
+ typedef typename _Rep_type::const_pointer const_pointer;
+ typedef typename _Rep_type::reference reference;
+ typedef typename _Rep_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing set
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+
+ // allocation/deallocation
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit set(const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+#else
+ set()
+ : _M_t(_Compare(), allocator_type()) {}
+ explicit set(const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) {}
+ set(const _Compare& __comp, const allocator_type& __a)
+#endif
+ : _M_t(__comp, __a) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); }
+# endif
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+#else
+ set(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ set(const value_type* __first,
+ const value_type* __last, const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+
+ set(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_unique(__first, __last); }
+
+ set(const_iterator __first, const_iterator __last, const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ set(const _Self& __x) : _M_t(__x._M_t) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ set(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+#endif
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return _M_t.key_comp(); }
+ allocator_type get_allocator() const { return _M_t.get_allocator(); }
+
+ iterator begin() { return _M_t.begin(); }
+ iterator end() { return _M_t.end(); }
+ const_iterator begin() const { return _M_t.begin(); }
+ const_iterator end() const { return _M_t.end(); }
+ reverse_iterator rbegin() { return _M_t.rbegin(); }
+ reverse_iterator rend() { return _M_t.rend(); }
+ const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
+ const_reverse_iterator rend() const { return _M_t.rend(); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ // insert/erase
+ pair<iterator,bool> insert(const value_type& __x)
+ { return _M_t.insert_unique(__x); }
+ iterator insert(iterator __pos, const value_type& __x)
+ { return _M_t.insert_unique( __pos , __x); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last)
+ { _M_t.insert_unique(__first, __last); }
+#else
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_unique(__first, __last); }
+ void insert(const value_type* __first, const value_type* __last)
+ { _M_t.insert_unique(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+ void erase(iterator __pos) { _M_t.erase( __pos ); }
+ size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); }
+ void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last ); }
+ void clear() { _M_t.clear(); }
+
+ // set operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x) { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const
+ { return _M_t.find(__x) == _M_t.end() ? 0 : 1 ; }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __x)
+ { return _M_t.equal_range_unique(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const
+ { return _M_t.equal_range_unique(__x); }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, Const_traits)
+
+template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Key>) >
+class multiset
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<multiset<_Key, _Compare, _Alloc> >
+#endif
+{
+ typedef multiset<_Key, _Compare, _Alloc> _Self;
+public:
+ // typedefs:
+
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _MultisetTraitsT<value_type> _MultisetTraits;
+
+public:
+ //Following typedef have to be public for __move_traits specialization.
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_PRIV _Identity<value_type>,
+ _MultisetTraits, _Alloc> _Rep_type;
+
+ typedef typename _Rep_type::pointer pointer;
+ typedef typename _Rep_type::const_pointer const_pointer;
+ typedef typename _Rep_type::reference reference;
+ typedef typename _Rep_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing multiset
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit multiset(const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+#else
+ multiset()
+ : _M_t(_Compare(), allocator_type()) {}
+ explicit multiset(const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) {}
+ multiset(const _Compare& __comp, const allocator_type& __a)
+#endif
+ : _M_t(__comp, __a) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp)
+ : _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); }
+# endif
+#else
+ multiset(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+
+ multiset(const value_type* __first, const value_type* __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+
+ multiset(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), allocator_type())
+ { _M_t.insert_equal(__first, __last); }
+
+ multiset(const_iterator __first, const_iterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ multiset(const _Self& __x) : _M_t(__x._M_t) {}
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ multiset(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+#endif
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return _M_t.key_comp(); }
+ allocator_type get_allocator() const { return _M_t.get_allocator(); }
+
+ iterator begin() { return _M_t.begin(); }
+ iterator end() { return _M_t.end(); }
+ const_iterator begin() const { return _M_t.begin(); }
+ const_iterator end() const { return _M_t.end(); }
+ reverse_iterator rbegin() { return _M_t.rbegin(); }
+ reverse_iterator rend() { return _M_t.rend(); }
+ const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
+ const_reverse_iterator rend() const { return _M_t.rend(); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ // insert/erase
+ iterator insert(const value_type& __x)
+ { return _M_t.insert_equal(__x); }
+ iterator insert(iterator __pos, const value_type& __x)
+ { return _M_t.insert_equal(__pos, __x); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last)
+ { _M_t.insert_equal(__first, __last); }
+#else
+ void insert(const value_type* __first, const value_type* __last)
+ { _M_t.insert_equal(__first, __last); }
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_equal(__first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+ void erase(iterator __pos) { _M_t.erase( __pos ); }
+ size_type erase(const key_type& __x) { return _M_t.erase(__x); }
+ void erase(iterator __first, iterator __last) { _M_t.erase( __first, __last ); }
+ void clear() { _M_t.clear(); }
+
+ // multiset operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x) { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const { return _M_t.find(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const { return _M_t.count(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __x) { return _M_t.equal_range(__x); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const { return _M_t.equal_range(__x); }
+};
+
+#else
+# include <stl/pointers/_set.h>
+_STLP_BEGIN_NAMESPACE
+#endif /* _STLP_USE_PTR_SPECIALIZATIONS */
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Compare, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER set<_Key,_Compare,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER multiset<_Key,_Compare,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Key, class _Compare, class _Alloc>
+struct __move_traits<set<_Key,_Compare,_Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename set<_Key,_Compare,_Alloc>::_Rep_type>
+{};
+
+template <class _Key, class _Compare, class _Alloc>
+struct __move_traits<multiset<_Key,_Compare,_Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename multiset<_Key,_Compare,_Alloc>::_Rep_type>
+{};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_slist.c b/stlport/stl/_slist.c
similarity index 100%
rename from stl/_slist.c
rename to stlport/stl/_slist.c
diff --git a/stlport/stl/_slist.h b/stlport/stl/_slist.h
new file mode 100644
index 0000000..924daa4
--- /dev/null
+++ b/stlport/stl/_slist.h
@@ -0,0 +1,914 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_SLIST_H
+#define _STLP_INTERNAL_SLIST_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_SLIST_BASE_H
+# include <stl/_slist_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp>
+class _Slist_node : public _Slist_node_base {
+public:
+ _Tp _M_data;
+ __TRIVIAL_STUFF(_Slist_node)
+};
+
+struct _Slist_iterator_base {
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef forward_iterator_tag iterator_category;
+
+ _Slist_node_base *_M_node;
+
+ _Slist_iterator_base(_Slist_node_base *__x) : _M_node(__x) {}
+
+ void _M_incr() {
+ _M_node = _M_node->_M_next;
+ }
+};
+
+template <class _Tp, class _Traits>
+class _Slist_iterator : public _Slist_iterator_base {
+public:
+ typedef typename _Traits::value_type value_type;
+ typedef typename _Traits::pointer pointer;
+ typedef typename _Traits::reference reference;
+ typedef forward_iterator_tag iterator_category;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ typedef _Slist_iterator<_Tp, _Traits> _Self;
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef _Slist_iterator<_Tp, _NonConstTraits> iterator;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _Slist_iterator<_Tp, _ConstTraits> const_iterator;
+
+ typedef _Slist_node<value_type> _Node;
+
+ explicit _Slist_iterator(_Slist_node_base *__x) : _Slist_iterator_base(__x) {}
+ _Slist_iterator() : _Slist_iterator_base(0) {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _Slist_iterator(const iterator& __x) : _Slist_iterator_base(__x._M_node) {}
+
+ reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ _M_incr();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ _M_incr();
+ return __tmp;
+ }
+
+ bool operator==(const_iterator __y ) const {
+ return this->_M_node == __y._M_node;
+ }
+ bool operator!=(const_iterator __y ) const {
+ return this->_M_node != __y._M_node;
+ }
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+struct __type_traits<_STLP_PRIV _Slist_iterator<_Tp, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Tp, class _Traits>
+inline _Tp* _STLP_CALL value_type(const _STLP_PRIV _Slist_iterator<_Tp, _Traits>&) { return __STATIC_CAST(_Tp*, 0); }
+inline ptrdiff_t* _STLP_CALL distance_type(const _STLP_PRIV _Slist_iterator_base&) { return 0; }
+inline forward_iterator_tag _STLP_CALL iterator_category(const _STLP_PRIV _Slist_iterator_base&) { return forward_iterator_tag(); }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* OLD_QUERIES */
+
+// Base class that encapsulates details of allocators and simplifies EH
+template <class _Tp, class _Alloc>
+class _Slist_base {
+protected:
+ typedef _Slist_node<_Tp> _Node;
+ typedef typename _Alloc_traits<_Node,_Alloc>::allocator_type _M_node_allocator_type;
+ typedef _Slist_base<_Tp, _Alloc> _Self;
+
+public:
+ typedef _STLP_alloc_proxy<_Slist_node_base, _Node, _M_node_allocator_type> _AllocProxy;
+
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _Alloc allocator_type;
+
+ _Slist_base(const allocator_type& __a) :
+ _M_head(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Slist_node_base() )
+ { _M_head._M_data._M_next = 0; }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Slist_base(__move_source<_Self> src) :
+ _M_head(__move_source<_AllocProxy>(src.get()._M_head))
+ { src.get()._M_head._M_data._M_next = 0; }
+#endif
+
+ ~_Slist_base() { _M_erase_after(&_M_head._M_data, 0); }
+
+protected:
+ _Slist_node_base* _M_erase_after(_Slist_node_base* __pos) {
+ _Node* __next = __STATIC_CAST(_Node*, __pos->_M_next);
+ _Slist_node_base* __next_next = __next->_M_next;
+ __pos->_M_next = __next_next;
+ _STLP_STD::_Destroy(&__next->_M_data);
+ _M_head.deallocate(__next,1);
+ return __next_next;
+ }
+ _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);
+
+public:
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR((const _M_node_allocator_type&)_M_head, _Tp); }
+ _AllocProxy _M_head;
+};
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define slist _STLP_PTR_IMPL_NAME(slist)
+#elif defined (_STLP_DEBUG)
+# define slist _STLP_NON_DBG_NAME(slist)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class slist;
+
+#if !defined (slist)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+// helper functions to reduce code duplication
+template <class _Tp, class _Alloc, class _BinaryPredicate>
+void _Slist_unique(slist<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred);
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _Slist_merge(slist<_Tp, _Alloc>& __that, slist<_Tp, _Alloc>& __x,
+ _StrictWeakOrdering __comp);
+
+template <class _Tp, class _Alloc, class _StrictWeakOrdering>
+void _Slist_sort(slist<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp);
+
+#if !defined (slist)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, class _Alloc>
+class slist : protected _STLP_PRIV _Slist_base<_Tp,_Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (slist)
+ , public __stlport_class<slist<_Tp, _Alloc> >
+#endif
+{
+private:
+ typedef _STLP_PRIV _Slist_base<_Tp,_Alloc> _Base;
+ typedef slist<_Tp,_Alloc> _Self;
+public:
+ typedef _Tp value_type;
+
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef forward_iterator_tag _Iterator_category;
+
+ typedef _STLP_PRIV _Slist_iterator<_Tp, _Nonconst_traits<_Tp> > iterator;
+ typedef _STLP_PRIV _Slist_iterator<_Tp, _Const_traits<_Tp> > const_iterator;
+
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Base::allocator_type allocator_type;
+
+private:
+ typedef _STLP_PRIV _Slist_node<_Tp> _Node;
+ typedef _STLP_PRIV _Slist_node_base _Node_base;
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ _Node* _M_create_node(const value_type& __x = _Tp()) {
+#else
+ _Node* _M_create_node(const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _Node* __node = this->_M_head.allocate(1);
+ _STLP_TRY {
+ _Copy_Construct(&__node->_M_data, __x);
+ __node->_M_next = 0;
+ }
+ _STLP_UNWIND(this->_M_head.deallocate(__node, 1))
+ return __node;
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ _Node* _M_create_node() {
+ _Node* __node = this->_M_head.allocate(1);
+ _STLP_TRY {
+ _STLP_STD::_Construct(&__node->_M_data);
+ __node->_M_next = 0;
+ }
+ _STLP_UNWIND(this->_M_head.deallocate(__node, 1))
+ return __node;
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+public:
+
+ allocator_type get_allocator() const { return _Base::get_allocator(); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(const allocator_type& __a = allocator_type())
+#else
+ slist()
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type()) {}
+ slist(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) {}
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp),
+ const allocator_type& __a = allocator_type())
+#else
+ explicit slist(size_type __n)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type())
+ { _M_insert_after_fill(&this->_M_head._M_data, __n, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+ slist(size_type __n, const value_type& __x)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type())
+ { _M_insert_after_fill(&this->_M_head._M_data, __n, __x); }
+ slist(size_type __n, const value_type& __x, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
+ { _M_insert_after_fill(&this->_M_head._M_data, __n, __x); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
+ { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ // VC++ needs this crazyness
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type())
+ { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
+# endif
+#else /* _STLP_MEMBER_TEMPLATES */
+ slist(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
+ { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
+ slist(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a)
+ { _M_insert_after_range(&this->_M_head._M_data, __first, __last); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ slist(const _Self& __x)
+ : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__x.get_allocator())
+ { _M_insert_after_range(&this->_M_head._M_data, __x.begin(), __x.end()); }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ slist(__move_source<_Self> src)
+ : _STLP_PRIV _Slist_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {}
+#endif
+
+ _Self& operator= (const _Self& __x);
+
+ ~slist() {}
+
+public:
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); }
+
+private:
+ void _M_fill_assign(size_type __n, const _Tp& __val);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+public:
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/) {
+ _M_fill_assign((size_type) __n, (_Tp) __val);
+ }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/) {
+#else
+public:
+ void assign(const_pointer __first, const_pointer __last) {
+ _Node_base* __prev = &this->_M_head._M_data;
+ _Node_base* __node = this->_M_head._M_data._M_next;
+ while (__node != 0 && __first != __last) {
+ __STATIC_CAST(_Node*, __node)->_M_data = *__first;
+ __prev = __node;
+ __node = __node->_M_next;
+ ++__first;
+ }
+ if (__first != __last)
+ _M_insert_after_range(__prev, __first, __last);
+ else
+ this->_M_erase_after(__prev, 0);
+ }
+ void assign(const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ _Node_base* __prev = &this->_M_head._M_data;
+ _Node_base* __node = this->_M_head._M_data._M_next;
+ while (__node != 0 && __first != __last) {
+ __STATIC_CAST(_Node*, __node)->_M_data = *__first;
+ __prev = __node;
+ __node = __node->_M_next;
+ ++__first;
+ }
+ if (__first != __last)
+ _M_insert_after_range(__prev, __first, __last);
+ else
+ this->_M_erase_after(__prev, 0);
+ }
+
+public:
+
+ // Experimental new feature: before_begin() returns a
+ // non-dereferenceable iterator that, when incremented, yields
+ // begin(). This iterator may be used as the argument to
+ // insert_after, erase_after, etc. Note that even for an empty
+ // slist, before_begin() is not the same iterator as end(). It
+ // is always necessary to increment before_begin() at least once to
+ // obtain end().
+ iterator before_begin() { return iterator(&this->_M_head._M_data); }
+ const_iterator before_begin() const
+ { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_head._M_data)); }
+
+ iterator begin() { return iterator(this->_M_head._M_data._M_next); }
+ const_iterator begin() const
+ { return const_iterator(this->_M_head._M_data._M_next);}
+
+ iterator end() { return iterator(); }
+ const_iterator end() const { return const_iterator(); }
+
+ size_type size() const
+ { return _STLP_PRIV _Sl_global_inst::size(this->_M_head._M_data._M_next); }
+
+ size_type max_size() const { return size_type(-1); }
+
+ bool empty() const { return this->_M_head._M_data._M_next == 0; }
+
+ void swap(_Self& __x)
+ { this->_M_head.swap(__x._M_head); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public:
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __x = _Tp()) {
+#else
+ void push_front(const value_type& __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ _STLP_PRIV __slist_make_link(&this->_M_head._M_data, _M_create_node(__x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front() { _STLP_PRIV __slist_make_link(&this->_M_head._M_data, _M_create_node());}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_front() {
+ _Node* __node = __STATIC_CAST(_Node*, this->_M_head._M_data._M_next);
+ this->_M_head._M_data._M_next = __node->_M_next;
+ _STLP_STD::_Destroy(&__node->_M_data);
+ this->_M_head.deallocate(__node, 1);
+ }
+
+ iterator previous(const_iterator __pos) {
+ return iterator(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node));
+ }
+ const_iterator previous(const_iterator __pos) const {
+ return const_iterator(__CONST_CAST(_Node_base*,
+ _STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data,
+ __pos._M_node)));
+ }
+
+private:
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ _Node* _M_insert_after(_Node_base* __pos, const value_type& __x = _Tp()) {
+#else
+ _Node* _M_insert_after(_Node_base* __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ return __STATIC_CAST(_Node*, _STLP_PRIV __slist_make_link(__pos, _M_create_node(__x)));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ _Node* _M_insert_after(_Node_base* __pos) {
+ return __STATIC_CAST(_Node*, _STLP_PRIV __slist_make_link(__pos, _M_create_node()));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void _M_insert_after_fill(_Node_base* __pos,
+ size_type __n, const value_type& __x) {
+ for (size_type __i = 0; __i < __n; ++__i)
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(__x));
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InIter>
+ void _M_insert_after_range(_Node_base* __pos,
+ _InIter __first, _InIter __last) {
+ typedef typename _IsIntegral<_InIter>::_Ret _Integral;
+ _M_insert_after_range(__pos, __first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
+ const __true_type&) {
+ _M_insert_after_fill(__pos, __n, __x);
+ }
+
+ template <class _InIter>
+ void _M_insert_after_range(_Node_base* __pos,
+ _InIter __first, _InIter __last,
+ const __false_type&) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_insert_after_range(_Node_base* __pos,
+ const value_type* __first,
+ const value_type* __last) {
+ while (__first != __last) {
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+ void _M_insert_after_range(_Node_base* __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ while (__first != __last) {
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InIter>
+ void _M_splice_after_range(_Node_base* __pos,
+ _InIter __first, _InIter __last) {
+ typedef typename _IsIntegral<_InIter>::_Ret _Integral;
+ _M_splice_after_range(__pos, __first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_splice_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
+ const __true_type&) {
+ _M_insert_after_fill(__pos, __n, __x);
+ }
+
+ template <class _InIter>
+ void _M_splice_after_range(_Node_base* __pos,
+ _InIter __first, _InIter __last,
+ const __false_type&) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_splice_after_range(_Node_base* __pos,
+ const value_type* __first,
+ const value_type* __last) {
+ while (__first != __last) {
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+ void _M_splice_after_range(_Node_base* __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ //We use a temporary slist to avoid the auto reference troubles (infinite loop)
+ _Self __tmp(__first, __last, this->get_allocator());
+ splice_after(iterator(__pos), __tmp);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InIter>
+ void _M_splice_range(_Node_base* __pos,
+ _InIter __first, _InIter __last) {
+ typedef typename _IsIntegral<_InIter>::_Ret _Integral;
+ _M_splice_range(__pos, __first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_splice_range(_Node_base* __pos, _Integer __n, _Integer __x,
+ const __true_type&) {
+ _M_insert_after_fill(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos),
+ __n, __x);
+ }
+
+ template <class _InIter>
+ void _M_splice_range(_Node_base* __pos,
+ _InIter __first, _InIter __last,
+ const __false_type&) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void _M_splice_range(_Node_base* __pos,
+ const value_type* __first,
+ const value_type* __last) {
+ while (__first != __last) {
+ __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+ void _M_splice_range(_Node_base* __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ //We use a temporary slist to avoid the auto reference troubles (infinite loop)
+ _Self __tmp(__first, __last, this->get_allocator());
+ splice(iterator(__pos), __tmp);
+ }
+
+public:
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert_after(iterator __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ return iterator(_M_insert_after(__pos._M_node, __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos) {
+ return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert_after(iterator __pos, size_type __n, const value_type& __x) {
+ _M_insert_after_fill(__pos._M_node, __n, __x);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InIter>
+ void insert_after(iterator __pos, _InIter __first, _InIter __last) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert_after(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+ _M_insert_after_range(__pos._M_node, __first, __last);
+ }
+ void insert_after(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ _M_splice_after_range(__pos._M_node, __first, __last);
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ return iterator(_M_insert_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos) {
+ return iterator(_M_insert_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ _STLP_DEFAULT_CONSTRUCTED(_Tp)));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x) {
+ _M_insert_after_fill(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), __n, __x);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InIter>
+ void insert(iterator __pos, _InIter __first, _InIter __last) {
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos, const value_type* __first,
+ const value_type* __last) {
+ _M_insert_after_range(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ __first, __last);
+ }
+ void insert(iterator __pos, const_iterator __first, const_iterator __last) {
+#endif /* _STLP_MEMBER_TEMPLATES */
+ _M_splice_range(__pos._M_node, __first, __last);
+ }
+
+public:
+ iterator erase_after(iterator __pos)
+ { return iterator(this->_M_erase_after(__pos._M_node)); }
+ iterator erase_after(iterator __before_first, iterator __last)
+ { return iterator(this->_M_erase_after(__before_first._M_node, __last._M_node)); }
+
+ iterator erase(iterator __pos)
+ { return iterator(this->_M_erase_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node))); }
+ iterator erase(iterator __first, iterator __last)
+ { return iterator(this->_M_erase_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __first._M_node), __last._M_node)); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type new_size, const value_type& __x = _Tp());
+#else
+ void resize(size_type new_size, const value_type& __x);
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type new_size) { resize(new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear()
+ { this->_M_erase_after(&this->_M_head._M_data, 0); }
+
+public:
+ // Moves the range [__before_first + 1, __before_last + 1) to *this,
+ // inserting it immediately after __pos. This is constant time.
+ void splice_after(iterator __pos, _Self& __x,
+ iterator __before_first, iterator __before_last) {
+ if (__before_first != __before_last) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node,
+ __before_first._M_node, __before_last._M_node);
+ }
+ else {
+ this->insert_after(__pos, iterator(__before_first._M_node->_M_next), iterator(__before_last._M_node->_M_next));
+ __x.erase_after(__before_first, ++__before_last);
+ }
+ }
+ }
+
+ // Moves the element that follows __prev to *this, inserting it immediately
+ // after __pos. This is constant time.
+ void splice_after(iterator __pos, _Self& __x, iterator __prev) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node,
+ __prev._M_node, __prev._M_node->_M_next);
+ }
+ else {
+ this->insert_after(__pos, __STATIC_CAST(_Node*, __prev._M_node->_M_next)->_M_data);
+ __x.erase_after(__prev);
+ }
+ }
+
+ // Removes all of the elements from the list __x to *this, inserting
+ // them immediately after __pos. __x must not be *this. Complexity:
+ // linear in __x.size().
+ void splice_after(iterator __pos, _Self& __x) {
+ if (this->get_allocator() == __x.get_allocator())
+ _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node, &__x._M_head._M_data);
+ else {
+ this->insert_after(__pos, __x.begin(), __x.end());
+ __x.clear();
+ }
+ }
+
+ // Linear in distance(begin(), __pos), and linear in __x.size().
+ void splice(iterator __pos, _Self& __x) {
+ if (__x._M_head._M_data._M_next) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ &__x._M_head._M_data,
+ _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, 0));
+ }
+ else {
+ insert(__pos, __x.begin(), __x.end());
+ __x.clear();
+ }
+ }
+ }
+
+ // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i).
+ void splice(iterator __pos, _Self& __x, iterator __i) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, __i._M_node),
+ __i._M_node);
+ }
+ else {
+ insert(__pos, *__i);
+ __x.erase(__i);
+ }
+ }
+
+ // Linear in distance(begin(), __pos), in distance(__x.begin(), __first),
+ // and in distance(__first, __last).
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
+ if (__first != __last) {
+ if (this->get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node),
+ _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, __first._M_node),
+ _STLP_PRIV _Sl_global_inst::__previous(__first._M_node, __last._M_node));
+ }
+ else {
+ insert(__pos, __first, __last);
+ __x.erase(__first, __last);
+ }
+ }
+ }
+
+public:
+ void reverse() {
+ if (this->_M_head._M_data._M_next)
+ this->_M_head._M_data._M_next = _STLP_PRIV _Sl_global_inst::__reverse(this->_M_head._M_data._M_next);
+ }
+
+ void remove(const _Tp& __val);
+
+ void unique() { _STLP_PRIV _Slist_unique(*this, equal_to<value_type>()); }
+ void merge(_Self& __x) { _STLP_PRIV _Slist_merge(*this, __x, less<value_type>()); }
+ void sort() { _STLP_PRIV _Slist_sort(*this, less<value_type>()); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred) {
+ _Node_base* __cur = &this->_M_head._M_data;
+ while (__cur->_M_next) {
+ if (__pred(__STATIC_CAST(_Node*, __cur->_M_next)->_M_data))
+ this->_M_erase_after(__cur);
+ else
+ __cur = __cur->_M_next;
+ }
+ }
+
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __pred)
+ { _STLP_PRIV _Slist_unique(*this, __pred); }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x, _StrictWeakOrdering __comp)
+ { _STLP_PRIV _Slist_merge(*this, __x, __comp); }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _STLP_PRIV _Slist_sort(*this, __comp); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+};
+
+#if defined (slist)
+# undef slist
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_slist.c>
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# include <stl/pointers/_slist.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_slist.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp, class _Alloc>
+inline bool _STLP_CALL
+operator == (const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) {
+ typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator;
+ const_iterator __end1 = _SL1.end();
+ const_iterator __end2 = _SL2.end();
+
+ const_iterator __i1 = _SL1.begin();
+ const_iterator __i2 = _SL2.begin();
+ while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) {
+ ++__i1;
+ ++__i2;
+ }
+ return __i1 == __end1 && __i2 == __end2;
+}
+
+#define _STLP_EQUAL_OPERATOR_SPECIALIZED
+#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER slist<_Tp, _Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+#undef _STLP_EQUAL_OPERATOR_SPECIALIZED
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Alloc>
+struct __move_traits<slist<_Tp, _Alloc> > {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+# endif
+
+// Specialization of insert_iterator so that insertions will be constant
+// time rather than linear time.
+template <class _Tp, class _Alloc>
+class insert_iterator<slist<_Tp, _Alloc> > {
+protected:
+ typedef slist<_Tp, _Alloc> _Container;
+ _Container* _M_container;
+ typename _Container::iterator _M_iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x, typename _Container::iterator __i)
+ : _M_container(&__x) {
+ if (__i == __x.begin())
+ _M_iter = __x.before_begin();
+ else
+ _M_iter = __x.previous(__i);
+ }
+
+ insert_iterator<_Container>&
+ operator = (const typename _Container::value_type& __val) {
+ _M_iter = _M_container->insert_after(_M_iter, __val);
+ return *this;
+ }
+
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_SLIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_slist_base.c b/stlport/stl/_slist_base.c
similarity index 100%
rename from stl/_slist_base.c
rename to stlport/stl/_slist_base.c
diff --git a/stl/_slist_base.h b/stlport/stl/_slist_base.h
similarity index 100%
rename from stl/_slist_base.h
rename to stlport/stl/_slist_base.h
diff --git a/stlport/stl/_sparc_atomic.h b/stlport/stl/_sparc_atomic.h
new file mode 100644
index 0000000..21cc0ad
--- /dev/null
+++ b/stlport/stl/_sparc_atomic.h
@@ -0,0 +1,61 @@
+
+// Currently, SUN CC requires object file
+
+#if defined (__GNUC__)
+
+/*
+** int _STLP_atomic_exchange (__stl_atomic_t *pvalue, __stl_atomic_t value)
+*/
+
+# if defined(__sparc_v9__) || defined (__sparcv9)
+
+# ifdef __arch64__
+
+# define _STLP_EXCH_ASM asm volatile ("casx [%3], %4, %0 ; membar #LoadLoad | #LoadStore " : \
+ "=r" (_L_value2), "=m" (*_L_pvalue1) : \
+ "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) )
+
+# else /* __arch64__ */
+
+# define _STLP_EXCH_ASM asm volatile ("cas [%3], %4, %0" : \
+ "=r" (_L_value2), "=m" (*_L_pvalue1) : \
+ "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) )
+# endif
+
+# else /* __sparc_v9__ */
+
+# define _STLP_EXCH_ASM asm volatile ("swap [%3], %0 " : \
+ "=r" (_L_value2), "=m" (*_L_pvalue1) : \
+ "m" (*_L_pvalue1), "r" (_L_pvalue1), "0" (_L_value2) )
+# endif
+
+
+# define _STLP_ATOMIC_EXCHANGE(__pvalue1, __value2) \
+ ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
+ register __stl_atomic_t _L_value1, _L_value2 = __value2 ; \
+ do { _L_value1 = *_L_pvalue1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
+ _L_value1; })
+
+# define _STLP_ATOMIC_INCREMENT(__pvalue1) \
+ ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
+ register __stl_atomic_t _L_value1, _L_value2; \
+ do { _L_value1 = *_L_pvalue1; _L_value2 = _L_value1+1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
+ (_L_value2 + 1); })
+
+# define _STLP_ATOMIC_DECREMENT(__pvalue1) \
+ ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \
+ register __stl_atomic_t _L_value1, _L_value2; \
+ do { _L_value1 = *_L_pvalue1; _L_value2 = _L_value1-1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \
+ (_L_value2 - 1); })
+
+# elif ! defined (_STLP_NO_EXTERN_INLINE)
+
+extern "C" __stl_atomic_t _STLP_atomic_exchange(__stl_atomic_t * __x, __stl_atomic_t __v);
+extern "C" void _STLP_atomic_decrement(__stl_atomic_t* i);
+extern "C" void _STLP_atomic_increment(__stl_atomic_t* i);
+
+# define _STLP_ATOMIC_INCREMENT(__x) _STLP_atomic_increment((__stl_atomic_t*)__x)
+# define _STLP_ATOMIC_DECREMENT(__x) _STLP_atomic_decrement((__stl_atomic_t*)__x)
+# define _STLP_ATOMIC_EXCHANGE(__x, __y) _STLP_atomic_exchange((__stl_atomic_t*)__x, (__stl_atomic_t)__y)
+
+#endif
diff --git a/stlport/stl/_sstream.c b/stlport/stl/_sstream.c
new file mode 100644
index 0000000..9f58535
--- /dev/null
+++ b/stlport/stl/_sstream.c
@@ -0,0 +1,465 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_SSTREAM_C
+#define _STLP_SSTREAM_C
+
+#ifndef _STLP_INTERNAL_SSTREAM
+# include <stl/_sstream.h>
+#endif
+
+#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
+// no wint_t is supported for this mode
+# define __BSB_int_type__ int
+# define __BSB_pos_type__ streampos
+#else
+# define __BSB_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
+# define __BSB_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Non-inline stringbuf member functions.
+
+// Constructors. Note that the base class constructor sets all of the
+// get and area pointers to null.
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringbuf<_CharT, _Traits, _Alloc>
+ ::basic_stringbuf(ios_base::openmode __mode)
+ : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str()
+{}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringbuf<_CharT, _Traits, _Alloc>
+ ::basic_stringbuf(const basic_string<_CharT, _Traits, _Alloc>& __s, ios_base::openmode __mode)
+ : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str(__s)
+{
+ _M_set_ptrs();
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringbuf<_CharT, _Traits, _Alloc>::~basic_stringbuf()
+{}
+
+// Set the underlying string to a new value.
+template <class _CharT, class _Traits, class _Alloc>
+void
+basic_stringbuf<_CharT, _Traits, _Alloc>::str(const basic_string<_CharT, _Traits, _Alloc>& __s)
+{
+ _M_str = __s;
+ _M_set_ptrs();
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+void
+basic_stringbuf<_CharT, _Traits, _Alloc>::_M_set_ptrs()
+{
+ _CharT* __data_ptr = _S_start(_M_str);
+ _CharT* __data_end = _S_finish(_M_str);
+ // The initial read position is the beginning of the string.
+ if (_M_mode & ios_base::in) {
+ this->setg(__data_ptr, (_M_mode & ios_base::ate) ? __data_end : __data_ptr, __data_end);
+ }
+
+ // The initial write position is the beginning of the string.
+ if (_M_mode & ios_base::out) {
+ if ( _M_mode & (ios_base::app | ios_base::ate) ) {
+ this->setp( __data_end, __data_end );
+ } else {
+ this->setp( __data_ptr, __data_end );
+ this->pbump((int)_M_str.size()); // initial write position, if we initialized with string
+ }
+ // this->setp((_M_mode & (ios_base::app | ios_base::ate))? __data_end : __data_ptr, __data_end);
+ }
+}
+
+// Precondition: gptr() >= egptr(). Returns a character, if one is available.
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_int_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>::underflow() {
+ return this->gptr() != this->egptr()
+ ? _Traits::to_int_type(*this->gptr())
+ : _Traits::eof();
+}
+
+// Precondition: gptr() >= egptr().
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_int_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>::uflow() {
+ if (this->gptr() != this->egptr()) {
+ int_type __c = _Traits::to_int_type(*this->gptr());
+ this->gbump(1);
+ return __c;
+ }
+ else
+ return _Traits::eof();
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_int_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>::pbackfail(int_type __c) {
+ if (this->gptr() != this->eback()) {
+ if (!_Traits::eq_int_type(__c, _Traits::eof())) {
+ if (_Traits::eq(_Traits::to_char_type(__c), this->gptr()[-1])) {
+ this->gbump(-1);
+ return __c;
+ }
+ else if (_M_mode & ios_base::out) {
+ this->gbump(-1);
+ *this->gptr() = _Traits::to_char_type(__c);
+ return __c;
+ }
+ else
+ return _Traits::eof();
+ }
+ else {
+ this->gbump(-1);
+ return _Traits::not_eof(__c);
+ }
+ }
+ else
+ return _Traits::eof();
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_int_type__ basic_stringbuf<_CharT, _Traits, _Alloc>::overflow(int_type __c)
+{
+ if (!_Traits::eq_int_type(__c, _Traits::eof())) {
+ if (_M_mode & ios_base::out) {
+ if ( this->pptr() < this->epptr() ) { // just put back in any case
+ _M_str.push_back( _Traits::to_char_type(__c) );
+ this->pbump(1);
+ } else if ( _M_mode & ios_base::in ) {
+ ptrdiff_t __offset = this->gptr() - this->eback();
+ _M_str.push_back(_Traits::to_char_type(__c));
+ _CharT* __data_ptr = _S_start(_M_str);
+ this->setg(__data_ptr, __data_ptr + __offset, _S_finish(_M_str));
+ this->setp(__data_ptr, _S_finish(_M_str));
+ this->pbump((int)_M_str.size());
+ } else {
+ _M_str.push_back( _Traits::to_char_type(__c) );
+ this->setp(_S_start(_M_str), _S_finish(_M_str));
+ this->pbump((int)_M_str.size());
+ }
+ return __c;
+ }
+ return _Traits::eof(); // Overflow always fails if it's read-only
+ }
+ return _Traits::not_eof(__c); // __c is EOF, so we don't have to do anything
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+streamsize
+basic_stringbuf<_CharT, _Traits, _Alloc>::xsputn(const char_type* __s,
+ streamsize __n) {
+ streamsize __nwritten = 0;
+
+ if ((_M_mode & ios_base::out) && __n > 0) {
+ // If the put pointer is somewhere in the middle of the string,
+ // then overwrite instead of append.
+ if ( !_M_str.empty() && this->pbase() == _S_start(_M_str)) {
+ ptrdiff_t __avail = _S_finish(_M_str) - this->pptr();
+ if (__avail > __n) {
+ _Traits::copy(this->pptr(), __s, __STATIC_CAST(size_t, __n));
+ this->pbump((int)__n);
+ return __n;
+ } else {
+ _Traits::copy(this->pptr(), __s, __avail);
+ __nwritten += __avail;
+ __n -= __avail;
+ __s += __avail;
+ }
+ }
+
+ // At this point we know we're appending.
+ _CharT* __data_ptr;
+ if (_M_mode & ios_base::in) {
+ ptrdiff_t __get_offset = this->gptr() - this->eback();
+ _M_str.append(__s, __s + __STATIC_CAST(ptrdiff_t, __n));
+ __data_ptr = _S_start(_M_str);
+ this->setg(__data_ptr, __data_ptr + __get_offset, _S_finish(_M_str));
+ } else {
+ _M_str.append(__s, __s + __STATIC_CAST(ptrdiff_t, __n));
+ __data_ptr = _S_start(_M_str);
+ }
+
+ this->setp(__data_ptr, _S_finish(_M_str));
+ this->pbump((int)_M_str.size());
+ __nwritten += __n;
+ }
+
+ return __nwritten;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+streamsize
+basic_stringbuf<_CharT, _Traits, _Alloc>::_M_xsputnc(char_type __c,
+ streamsize __n) {
+ streamsize __nwritten = 0;
+
+ if ((_M_mode & ios_base::out) && __n > 0) {
+ // If the put pointer is somewhere in the middle of the string,
+ // then overwrite instead of append.
+ if (this->pbase() == _S_start(_M_str)) {
+ ptrdiff_t __avail = _S_finish(_M_str) - this->pptr();
+ if (__avail > __n) {
+ _Traits::assign(this->pptr(), __STATIC_CAST(size_t, __n), __c);
+ this->pbump(__STATIC_CAST(int, __n));
+ return __n;
+ }
+ else {
+ _Traits::assign(this->pptr(), __avail, __c);
+ __nwritten += __avail;
+ __n -= __avail;
+ }
+ }
+
+ // At this point we know we're appending.
+ size_t __app_size = sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))
+ : __STATIC_CAST(size_t, __n);
+ _CharT* __data_ptr;
+ if (this->_M_mode & ios_base::in) {
+ ptrdiff_t __get_offset = this->gptr() - this->eback();
+ _M_str.append(__app_size, __c);
+ __data_ptr = _S_start(_M_str);
+ this->setg(__data_ptr, __data_ptr + __get_offset, _S_finish(_M_str));
+ } else {
+ _M_str.append(__app_size, __c);
+ __data_ptr = _S_start(_M_str);
+ }
+
+ this->setp(__data_ptr, _S_finish(_M_str));
+ this->pbump((int)_M_str.size());
+ __nwritten += __app_size;
+ }
+
+ return __nwritten;
+}
+
+// According to the C++ standard the effects of setbuf are implementation
+// defined, except that setbuf(0, 0) has no effect. In this implementation,
+// setbuf(<anything>, n), for n > 0, calls reserve(n) on the underlying
+// string.
+template <class _CharT, class _Traits, class _Alloc>
+basic_streambuf<_CharT, _Traits>*
+basic_stringbuf<_CharT, _Traits, _Alloc>::setbuf(_CharT*, streamsize __n) {
+ if (__n > 0) {
+ bool __do_get_area = false;
+ bool __do_put_area = false;
+ ptrdiff_t __offg = 0;
+ ptrdiff_t __offp = 0;
+
+ if (this->pbase() == _S_start(_M_str)) {
+ __do_put_area = true;
+ __offp = this->pptr() - this->pbase();
+ }
+
+ if (this->eback() == _S_start(_M_str)) {
+ __do_get_area = true;
+ __offg = this->gptr() - this->eback();
+ }
+
+ _M_str.reserve(sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size())))
+ : __STATIC_CAST(size_t, __n));
+
+ _CharT* __data_ptr = _S_start(_M_str);
+
+ if (__do_get_area) {
+ this->setg(__data_ptr, __data_ptr + __offg, _S_finish(_M_str));
+ }
+
+ if (__do_put_area) {
+ this->setp(__data_ptr, _S_finish(_M_str));
+ this->pbump((int)__offp);
+ }
+ }
+
+ return this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_pos_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>
+ ::seekoff(off_type __off,
+ ios_base::seekdir __dir,
+ ios_base::openmode __mode) {
+ __mode &= _M_mode;
+
+ bool __imode = (__mode & ios_base::in) != 0;
+ bool __omode = (__mode & ios_base::out) != 0;
+
+ if ( !(__imode || __omode) )
+ return pos_type(off_type(-1));
+
+ if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) )
+ return pos_type(off_type(-1));
+
+ streamoff __newoff;
+ switch(__dir) {
+ case ios_base::beg:
+ __newoff = 0;
+ break;
+ case ios_base::end:
+ __newoff = _M_str.size();
+ break;
+ case ios_base::cur:
+ __newoff = __imode ? this->gptr() - this->eback() : this->pptr() - this->pbase();
+ if ( __off == 0 ) {
+ return pos_type(__newoff);
+ }
+ break;
+ default:
+ return pos_type(off_type(-1));
+ }
+
+ __off += __newoff;
+
+ if (__imode) {
+ ptrdiff_t __n = this->egptr() - this->eback();
+
+ if (__off < 0 || __off > __n)
+ return pos_type(off_type(-1));
+ this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __off),
+ this->eback() + __STATIC_CAST(ptrdiff_t, __n));
+ }
+
+ if (__omode) {
+ ptrdiff_t __n = this->epptr() - this->pbase();
+
+ if (__off < 0 || __off > __n)
+ return pos_type(off_type(-1));
+ this->setp(this->pbase(), this->pbase() + __n);
+ this->pbump((int)__off);
+ }
+
+ return pos_type(__off);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__BSB_pos_type__
+basic_stringbuf<_CharT, _Traits, _Alloc>
+ ::seekpos(pos_type __pos, ios_base::openmode __mode) {
+ __mode &= _M_mode;
+
+ bool __imode = (__mode & ios_base::in) != 0;
+ bool __omode = (__mode & ios_base::out) != 0;
+
+ if ( !(__imode || __omode) )
+ return pos_type(off_type(-1));
+
+ if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) )
+ return pos_type(off_type(-1));
+
+ const off_type __n = __pos - pos_type(off_type(0));
+
+ if (__imode) {
+ if (__n < 0 || __n > this->egptr() - this->eback())
+ return pos_type(off_type(-1));
+ this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __n), this->egptr());
+ }
+
+ if (__omode) {
+ if (__n < 0 || size_t(__n) > _M_str.size())
+ return pos_type(off_type(-1));
+
+ this->setp(_S_start(_M_str), _S_finish(_M_str));
+ this->pbump((int)__n);
+ }
+
+ return __pos;
+}
+
+//----------------------------------------------------------------------
+// Non-inline istringstream member functions.
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istringstream<_CharT, _Traits, _Alloc>
+ ::basic_istringstream(ios_base::openmode __mode)
+ : basic_istream<_CharT, _Traits>(0),
+ _M_buf(__mode | ios_base::in) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istringstream<_CharT, _Traits, _Alloc>
+ ::basic_istringstream(const _String& __str,ios_base::openmode __mode)
+ : basic_istream<_CharT, _Traits>(0),
+ _M_buf(__str, __mode | ios_base::in) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_istringstream<_CharT, _Traits, _Alloc>::~basic_istringstream()
+{}
+
+//----------------------------------------------------------------------
+// Non-inline ostringstream member functions.
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostringstream<_CharT, _Traits, _Alloc>
+ ::basic_ostringstream(ios_base::openmode __mode)
+ : basic_ostream<_CharT, _Traits>(0),
+ _M_buf(__mode | ios_base::out) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostringstream<_CharT, _Traits, _Alloc>
+ ::basic_ostringstream(const _String& __str, ios_base::openmode __mode)
+ : basic_ostream<_CharT, _Traits>(0),
+ _M_buf(__str, __mode | ios_base::out) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_ostringstream<_CharT, _Traits, _Alloc>::~basic_ostringstream()
+{}
+
+//----------------------------------------------------------------------
+// Non-inline stringstream member functions.
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringstream<_CharT, _Traits, _Alloc>
+ ::basic_stringstream(ios_base::openmode __mode)
+ : basic_iostream<_CharT, _Traits>(0), _M_buf(__mode) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringstream<_CharT, _Traits, _Alloc>
+ ::basic_stringstream(const _String& __str, ios_base::openmode __mode)
+ : basic_iostream<_CharT, _Traits>(0), _M_buf(__str, __mode) {
+ this->init(&_M_buf);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_stringstream<_CharT, _Traits, _Alloc>::~basic_stringstream()
+{}
+
+_STLP_END_NAMESPACE
+
+# undef __BSB_int_type__
+# undef __BSB_pos_type__
+
+#endif /* _STLP_SSTREAM_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_sstream.h b/stlport/stl/_sstream.h
new file mode 100644
index 0000000..9e8d02a
--- /dev/null
+++ b/stlport/stl/_sstream.h
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+
+// This header defines classes basic_stringbuf, basic_istringstream,
+// basic_ostringstream, and basic_stringstream. These classes
+// represent streamsbufs and streams whose sources or destinations are
+// C++ strings.
+
+#ifndef _STLP_INTERNAL_SSTREAM
+#define _STLP_INTERNAL_SSTREAM
+
+#ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h> // Includes <ostream>, <ios>, <iosfwd>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// This version of basic_stringbuf relies on the internal details of
+// basic_string. It relies on the fact that, in this implementation,
+// basic_string's iterators are pointers. It also assumes (as allowed
+// by the standard) that _CharT is a POD type.
+
+// We have a very small buffer for the put area, just so that we don't
+// have to use append() for every sputc. Conceptually, the buffer
+// immediately follows the end of the underlying string. We use this
+// buffer when appending to write-only streambufs, but we don't use it
+// for read-write streambufs.
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_stringbuf : public basic_streambuf<_CharT, _Traits> {
+public: // Typedefs.
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_streambuf<_CharT, _Traits> _Base;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Self;
+ typedef basic_string<_CharT, _Traits, _Alloc> _String;
+
+public: // Constructors, destructor.
+ explicit basic_stringbuf(ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ explicit basic_stringbuf(const _String& __s, ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ virtual ~basic_stringbuf();
+
+public: // Get or set the string.
+ _String str() const { return _M_str; }
+ void str(const _String& __s);
+
+protected: // Overridden virtual member functions.
+ virtual int_type underflow();
+ virtual int_type uflow();
+ virtual int_type pbackfail(int_type __c);
+ virtual int_type overflow(int_type __c);
+ int_type pbackfail() {return pbackfail(_Traits::eof());}
+ int_type overflow() {return overflow(_Traits::eof());}
+
+ virtual streamsize xsputn(const char_type* __s, streamsize __n);
+ virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
+
+ virtual _Base* setbuf(_CharT* __buf, streamsize __n);
+ virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
+ ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+
+private: // Helper functions.
+ void _M_set_ptrs();
+ static _CharT* _S_start(const _String& __str) { return __CONST_CAST(_CharT*, __str.data()); }
+ static _CharT* _S_finish(const _String& __str) { return __CONST_CAST(_CharT*, __str.data()) + __str.size(); }
+
+private:
+ ios_base::openmode _M_mode;
+ _String _M_str;
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf<char, char_traits<char>, allocator<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+//----------------------------------------------------------------------
+// Class basic_istringstream, an input stream that uses a stringbuf.
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_istringstream : public basic_istream<_CharT, _Traits> {
+public: // Typedefs
+ typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_istream<_CharT, _Traits> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _String;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf;
+
+public: // Constructors, destructor.
+ basic_istringstream(ios_base::openmode __mode = ios_base::in);
+ basic_istringstream(const _String& __str,
+ ios_base::openmode __mode = ios_base::in);
+ ~basic_istringstream();
+
+public: // Member functions
+
+ basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ _String str() const { return _M_buf.str(); }
+ void str(const _String& __s) { _M_buf.str(__s); }
+
+private:
+ basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ typedef basic_istringstream<_CharT, _Traits> _Self;
+ //explicitely defined as private to avoid warnings:
+ basic_istringstream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+};
+
+
+//----------------------------------------------------------------------
+// Class basic_ostringstream, an output stream that uses a stringbuf.
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_ostringstream : public basic_ostream<_CharT, _Traits> {
+public: // Typedefs
+ typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_ostream<_CharT, _Traits> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _String;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf;
+
+public: // Constructors, destructor.
+ basic_ostringstream(ios_base::openmode __mode = ios_base::out);
+ basic_ostringstream(const _String& __str,
+ ios_base::openmode __mode = ios_base::out);
+ ~basic_ostringstream();
+
+public: // Member functions.
+
+ basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ _String str() const { return _M_buf.str(); }
+ void str(const _String& __s) { _M_buf.str(__s); } // dwa 02/07/00 - BUG STOMPER DAVE
+
+
+private:
+ basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ typedef basic_ostringstream<_CharT, _Traits> _Self;
+ //explicitely defined as private to avoid warnings:
+ basic_ostringstream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+};
+
+
+//----------------------------------------------------------------------
+// Class basic_stringstream, a bidirectional stream that uses a stringbuf.
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_stringstream : public basic_iostream<_CharT, _Traits> {
+public: // Typedefs
+ typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ typedef basic_ios<_CharT, _Traits> _Basic_ios;
+ typedef basic_iostream<_CharT, _Traits> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _String;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf;
+
+ typedef ios_base::openmode openmode;
+
+public: // Constructors, destructor.
+ basic_stringstream(openmode __mod = ios_base::in | ios_base::out);
+ basic_stringstream(const _String& __str,
+ openmode __mod = ios_base::in | ios_base::out);
+ ~basic_stringstream();
+
+public: // Member functions.
+
+ basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
+ { return __CONST_CAST(_Buf*,&_M_buf); }
+
+ _String str() const { return _M_buf.str(); }
+ void str(const _String& __s) { _M_buf.str(__s); }
+
+private:
+ basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
+ typedef basic_stringstream<_CharT, _Traits> _Self;
+ //explicitely defined as private to avoid warnings:
+ basic_stringstream(_Self const&);
+ _Self& operator = (_Self const&);
+#endif
+};
+
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream<char, char_traits<char>, allocator<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream<char, char_traits<char>, allocator<char> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream<char, char_traits<char>, allocator<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_sstream.c>
+#endif
+
+#endif /* _STLP_INTERNAL_SSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_stack.h b/stlport/stl/_stack.h
new file mode 100644
index 0000000..7ea9d59
--- /dev/null
+++ b/stlport/stl/_stack.h
@@ -0,0 +1,133 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_STACK_H
+#define _STLP_INTERNAL_STACK_H
+
+#ifndef _STLP_INTERNAL_DEQUE_H
+# include <stl/_deque.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined ( _STLP_LIMITED_DEFAULT_TEMPLATES )
+template <class _Tp, class _Sequence = deque<_Tp> >
+#elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
+# define _STLP_STACK_ARGS _Tp
+template <class _Tp>
+#else
+template <class _Tp, class _Sequence>
+#endif
+class stack
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+# if defined (_STLP_STACK_ARGS)
+ : public __stlport_class<stack<_Tp> >
+# else
+ : public __stlport_class<stack<_Tp, _Sequence> >
+# endif
+#endif
+{
+#ifdef _STLP_STACK_ARGS
+ typedef deque<_Tp> _Sequence;
+ typedef stack<_Tp> _Self;
+#else
+ typedef stack<_Tp, _Sequence> _Self;
+#endif
+
+public:
+ typedef typename _Sequence::value_type value_type;
+ typedef typename _Sequence::size_type size_type;
+ typedef _Sequence container_type;
+
+ typedef typename _Sequence::reference reference;
+ typedef typename _Sequence::const_reference const_reference;
+protected:
+ //c is a Standard name (23.2.3.3), do no make it STLport naming convention compliant.
+ _Sequence c;
+public:
+ stack() : c() {}
+ explicit stack(const _Sequence& __s) : c(__s) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ stack(__move_source<_Self> src)
+ : c(_STLP_PRIV _AsMoveSource(src.get().c)) {}
+#endif
+
+ bool empty() const { return c.empty(); }
+ size_type size() const { return c.size(); }
+ reference top() { return c.back(); }
+ const_reference top() const { return c.back(); }
+ void push(const value_type& __x) { c.push_back(__x); }
+ void pop() { c.pop_back(); }
+ const _Sequence& _Get_s() const { return c; }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) {
+ _Sequence __tmp = c;
+ c = __x.c;
+ __x.c = __tmp;
+ }
+#endif
+};
+
+#ifndef _STLP_STACK_ARGS
+# define _STLP_STACK_ARGS _Tp, _Sequence
+# define _STLP_STACK_HEADER_ARGS class _Tp, class _Sequence
+#else
+# define _STLP_STACK_HEADER_ARGS class _Tp
+#endif
+
+template < _STLP_STACK_HEADER_ARGS >
+inline bool _STLP_CALL operator==(const stack< _STLP_STACK_ARGS >& __x,
+ const stack< _STLP_STACK_ARGS >& __y)
+{ return __x._Get_s() == __y._Get_s(); }
+
+template < _STLP_STACK_HEADER_ARGS >
+inline bool _STLP_CALL operator<(const stack< _STLP_STACK_ARGS >& __x,
+ const stack< _STLP_STACK_ARGS >& __y)
+{ return __x._Get_s() < __y._Get_s(); }
+
+_STLP_RELOPS_OPERATORS(template < _STLP_STACK_HEADER_ARGS >, stack< _STLP_STACK_ARGS >)
+
+#undef _STLP_STACK_ARGS
+#undef _STLP_STACK_HEADER_ARGS
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Sequence>
+struct __move_traits<stack<_Tp, _Sequence> > :
+ _STLP_PRIV __move_traits_aux<_Sequence>
+{};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_STACK_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_stdexcept.h b/stlport/stl/_stdexcept.h
similarity index 100%
rename from stl/_stdexcept.h
rename to stlport/stl/_stdexcept.h
diff --git a/stlport/stl/_stdexcept_base.c b/stlport/stl/_stdexcept_base.c
new file mode 100644
index 0000000..deb7056
--- /dev/null
+++ b/stlport/stl/_stdexcept_base.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+__Named_exception::__Named_exception(const string& __str) {
+ size_t __size = strlen(_STLP_PRIV __get_c_string(__str)) + 1;
+ if (__size > _S_bufsize) {
+ _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char)));
+ if (!_M_name) {
+ __size = _S_bufsize;
+ _M_name = _M_static_name;
+ }
+ else {
+ *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) = __size * sizeof(char);
+ }
+ }
+ else {
+ _M_name = _M_static_name;
+ }
+#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ strncpy(_M_name, _STLP_PRIV __get_c_string(__str), __size - 1);
+ _M_name[__size - 1] = '\0';
+#else
+ strncpy_s(_M_name, __size, _STLP_PRIV __get_c_string(__str), __size - 1);
+#endif
+}
+
+__Named_exception::__Named_exception(const __Named_exception& __x) {
+ size_t __size = strlen(__x._M_name) + 1;
+ if (__size > _S_bufsize) {
+ _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char)));
+ if (!_M_name) {
+ __size = _S_bufsize;
+ _M_name = _M_static_name;
+ }
+ else {
+ *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) = __size * sizeof(char);
+ }
+ }
+ else {
+ _M_name = _M_static_name;
+ }
+#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ strncpy(_M_name, __x._M_name, __size - 1);
+ _M_name[__size - 1] = '\0';
+#else
+ strncpy_s(_M_name, __size, __x._M_name, __size - 1);
+#endif
+}
+
+__Named_exception& __Named_exception::operator = (const __Named_exception& __x) {
+ size_t __size = strlen(__x._M_name) + 1;
+ size_t __buf_size = _M_name != _M_static_name ? *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) : _S_bufsize;
+ if (__size > __buf_size) {
+ // Being here necessarily mean that we need to allocate a buffer:
+ if (_M_name != _M_static_name) free(_M_name);
+ _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char)));
+ if (!_M_name) {
+ __size = _S_bufsize;
+ _M_name = _M_static_name;
+ }
+ else {
+ *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) = __size * sizeof(char);
+ }
+ }
+#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ strncpy(_M_name, __x._M_name, __size - 1);
+ _M_name[__size - 1] = '\0';
+#else
+ strncpy_s(_M_name, __size, __x._M_name, __size - 1);
+#endif
+ return *this;
+}
+
+__Named_exception::~__Named_exception() _STLP_NOTHROW_INHERENTLY {
+ if (_M_name != _M_static_name)
+ free(_M_name);
+}
+
+const char* __Named_exception::what() const _STLP_NOTHROW_INHERENTLY
+{ return _M_name; }
diff --git a/stlport/stl/_stdexcept_base.h b/stlport/stl/_stdexcept_base.h
new file mode 100644
index 0000000..69dc077
--- /dev/null
+++ b/stlport/stl/_stdexcept_base.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_STDEXCEPT_BASE
+#define _STLP_INTERNAL_STDEXCEPT_BASE
+
+#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE)
+
+# ifndef _STLP_INTERNAL_EXCEPTION
+# include <stl/_exception.h>
+# endif
+
+# if defined(_STLP_USE_EXCEPTIONS) || \
+ !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32))
+
+# ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+# endif
+
+# ifndef _STLP_STRING_FWD_H
+# include <stl/_string_fwd.h>
+# endif
+
+# ifndef _STLP_USE_NO_IOSTREAMS
+# define _STLP_OWN_STDEXCEPT 1
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+/* We disable the 4275 warning for
+ * - WinCE where there are only static version of the native C++ runtime.
+ * - The MSVC compilers when the STLport user wants to make an STLport dll linked to
+ * the static C++ native runtime. In this case the std::exception base class is no more
+ * exported from native dll but is used as a base class for the exported __Named_exception
+ * class.
+ */
+# if defined (_STLP_WCE_NET) || \
+ defined (_STLP_USE_DYNAMIC_LIB) && defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# define _STLP_DO_WARNING_POP
+# pragma warning (push)
+# pragma warning (disable: 4275) // Non dll interface class 'exception' used as base
+ // for dll-interface class '__Named_exception'
+# endif
+
+# if !defined (_STLP_NO_EXCEPTION_HEADER)
+# if !defined (_STLP_EXCEPTION_BASE) && !defined (_STLP_BROKEN_EXCEPTION_CLASS) && \
+ defined (_STLP_USE_NAMESPACES) && defined (_STLP_USE_OWN_NAMESPACE)
+using _STLP_VENDOR_EXCEPT_STD::exception;
+# endif
+# endif
+# define _STLP_EXCEPTION_BASE exception
+
+class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE {
+public:
+ __Named_exception(const string& __str);
+ __Named_exception(const __Named_exception&);
+ __Named_exception& operator = (const __Named_exception&);
+
+ const char* what() const _STLP_NOTHROW_INHERENTLY;
+ ~__Named_exception() _STLP_NOTHROW_INHERENTLY;
+
+private:
+ enum { _S_bufsize = 256 };
+ char _M_static_name[_S_bufsize];
+ char *_M_name;
+};
+
+# if defined (_STLP_USE_NO_IOSTREAMS) && !defined (__BUILDING_STLPORT)
+ // if not linking to the lib, expose implementation of members here
+# include <stl/_stdexcept_base.c>
+# endif
+
+# if defined (_STLP_DO_WARNING_POP)
+# pragma warning (pop)
+# undef _STLP_DO_WARNING_POP
+# endif
+
+_STLP_END_NAMESPACE
+
+# endif /* Not o32, and no exceptions */
+#endif /* _STLP_STDEXCEPT_SEEN */
+
+#endif /* _STLP_INTERNAL_STDEXCEPT_BASE */
diff --git a/stlport/stl/_stlport_version.h b/stlport/stl/_stlport_version.h
new file mode 100644
index 0000000..587651d
--- /dev/null
+++ b/stlport/stl/_stlport_version.h
@@ -0,0 +1,30 @@
+ /*
+ *
+ * Copyright (c) 2005
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STLPORT_VERSION_H
+#define _STLP_STLPORT_VERSION_H
+
+/* The last SGI STL release we merged with */
+#define __SGI_STL 0x330
+
+/* STLport version */
+#define _STLPORT_MAJOR 5
+#define _STLPORT_MINOR 2
+#define _STLPORT_PATCHLEVEL 1
+
+#define _STLPORT_VERSION 0x521
+
+#endif /* _STLP_STLPORT_VERSION_H */
diff --git a/stlport/stl/_stream_iterator.h b/stlport/stl/_stream_iterator.h
new file mode 100644
index 0000000..aa26ae3
--- /dev/null
+++ b/stlport/stl/_stream_iterator.h
@@ -0,0 +1,253 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#if !defined (_STLP_INTERNAL_STREAM_ITERATOR_H) && !defined (_STLP_USE_NO_IOSTREAMS)
+#define _STLP_INTERNAL_STREAM_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+#endif
+
+// streambuf_iterators predeclarations must appear first
+#ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
+# include <stl/_ostreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
+# include <stl/_istreambuf_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ISTREAM
+# include <stl/_istream.h>
+#endif
+
+// istream_iterator and ostream_iterator look very different if we're
+// using new, templatized iostreams than if we're using the old cfront
+// version.
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp, class _CharT, class _Traits, class _Dist
+# define __ISI_TMPL_ARGUMENTS _Tp, _CharT, _Traits, _Dist
+template <class _Tp,
+ class _CharT = char, class _Traits = char_traits<_CharT>,
+ class _Dist = ptrdiff_t>
+class istream_iterator : public iterator<input_iterator_tag, _Tp , _Dist,
+ const _Tp*, const _Tp& > {
+#else
+# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM)
+# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp
+# define __ISI_TMPL_ARGUMENTS _Tp
+template <class _Tp>
+class istream_iterator : public iterator<input_iterator_tag, _Tp , ptrdiff_t,
+ const _Tp*, const _Tp& > {
+# else
+# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp, class _Dist
+# define __ISI_TMPL_ARGUMENTS _Tp, _Dist
+template <class _Tp, _STLP_DFL_TYPE_PARAM(_Dist, ptrdiff_t)>
+class istream_iterator : public iterator<input_iterator_tag, _Tp, _Dist ,
+ const _Tp*, const _Tp& > {
+# endif /* _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS */
+#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+ typedef char _CharT;
+ typedef char_traits<char> _Traits;
+# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM)
+ typedef ptrdiff_t _Dist;
+# endif
+#endif
+
+ typedef istream_iterator< __ISI_TMPL_ARGUMENTS > _Self;
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
+ typedef input_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Dist difference_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+
+ istream_iterator() : _M_stream(0), _M_ok(false), _M_read_done(true) {}
+ istream_iterator(istream_type& __s) : _M_stream(&__s), _M_ok(false), _M_read_done(false) {}
+
+ reference operator*() const {
+ if (!_M_read_done) {
+ _M_read();
+ }
+ return _M_value;
+ }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ _M_read();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ _M_read();
+ return __tmp;
+ }
+
+ bool _M_equal(const _Self& __x) const {
+ if (!_M_read_done) {
+ _M_read();
+ }
+ if (!__x._M_read_done) {
+ __x._M_read();
+ }
+ return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream);
+ }
+
+private:
+ istream_type* _M_stream;
+ mutable _Tp _M_value;
+ mutable bool _M_ok;
+ mutable bool _M_read_done;
+
+ void _M_read() const {
+ _STLP_MUTABLE(_Self, _M_ok) = ((_M_stream != 0) && !_M_stream->fail());
+ if (_M_ok) {
+ *_M_stream >> _STLP_MUTABLE(_Self, _M_value);
+ _STLP_MUTABLE(_Self, _M_ok) = !_M_stream->fail();
+ }
+ _STLP_MUTABLE(_Self, _M_read_done) = true;
+ }
+};
+
+#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _TpP,
+ class _CharT = char, class _Traits = char_traits<_CharT> >
+#else
+template <class _TpP>
+#endif
+class ostream_iterator: public iterator<output_iterator_tag, void, void, void, void> {
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+ typedef char _CharT;
+ typedef char_traits<char> _Traits;
+ typedef ostream_iterator<_TpP> _Self;
+#else
+ typedef ostream_iterator<_TpP, _CharT, _Traits> _Self;
+#endif
+public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
+
+ typedef output_iterator_tag iterator_category;
+
+ ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {}
+ ostream_iterator(ostream_type& __s, const _CharT* __c)
+ : _M_stream(&__s), _M_string(__c) {}
+ _Self& operator=(const _TpP& __val) {
+ *_M_stream << __val;
+ if (_M_string) *_M_stream << _M_string;
+ return *this;
+ }
+ _Self& operator*() { return *this; }
+ _Self& operator++() { return *this; }
+ _Self& operator++(int) { return *this; }
+private:
+ ostream_type* _M_stream;
+ const _CharT* _M_string;
+};
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+# if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _TpP>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const ostream_iterator<_TpP>&) { return output_iterator_tag(); }
+# else
+template <class _TpP, class _CharT, class _Traits>
+inline output_iterator_tag _STLP_CALL
+iterator_category(const ostream_iterator<_TpP, _CharT, _Traits>&) { return output_iterator_tag(); }
+# endif
+#endif
+
+_STLP_END_NAMESPACE
+
+// form-independent definiotion of stream iterators
+_STLP_BEGIN_NAMESPACE
+
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline bool _STLP_CALL
+operator==(const istream_iterator< __ISI_TMPL_ARGUMENTS >& __x,
+ const istream_iterator< __ISI_TMPL_ARGUMENTS >& __y)
+{ return __x._M_equal(__y); }
+
+#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline bool _STLP_CALL
+operator!=(const istream_iterator< __ISI_TMPL_ARGUMENTS >& __x,
+ const istream_iterator< __ISI_TMPL_ARGUMENTS >& __y)
+{ return !__x._M_equal(__y); }
+#endif
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline input_iterator_tag _STLP_CALL
+iterator_category(const istream_iterator< __ISI_TMPL_ARGUMENTS >&)
+{ return input_iterator_tag(); }
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline _Tp* _STLP_CALL
+value_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (_Tp*) 0; }
+
+# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM)
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline ptrdiff_t* _STLP_CALL
+distance_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (ptrdiff_t*)0; }
+# else
+template < __ISI_TMPL_HEADER_ARGUMENTS >
+inline _Dist* _STLP_CALL
+distance_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (_Dist*)0; }
+# endif /* _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS */
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef __ISI_TMPL_HEADER_ARGUMENTS
+#undef __ISI_TMPL_ARGUMENTS
+
+#endif /* _STLP_INTERNAL_STREAM_ITERATOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_streambuf.c b/stlport/stl/_streambuf.c
similarity index 100%
rename from stl/_streambuf.c
rename to stlport/stl/_streambuf.c
diff --git a/stlport/stl/_streambuf.h b/stlport/stl/_streambuf.h
new file mode 100644
index 0000000..e336b0f
--- /dev/null
+++ b/stlport/stl/_streambuf.h
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_INTERNAL_STREAMBUF
+#define _STLP_INTERNAL_STREAMBUF
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h> // Needed for ios_base bitfield members.
+#endif // <ios_base> includes <iosfwd>.
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Class basic_streambuf<>, the base class of the streambuf hierarchy.
+
+// A basic_streambuf<> manages an input (get) area and an output (put)
+// area. Each is described by three pointers: a beginning, an end, and a
+// current position. basic_streambuf<> contains some very simple member
+// functions that manipulate those six pointers, but almost all of the real
+// functionality gets delegated to protected virtual member functions.
+// All of the public member functions are inline, and most of the protected
+// member functions are virtual.
+
+// Although basic_streambuf<> is not abstract, it is useful only as a base
+// class. Its virtual member functions have default definitions such that
+// reading from a basic_streambuf<> will always yield EOF, and writing to a
+// basic_streambuf<> will always fail.
+
+// The second template parameter, _Traits, defaults to char_traits<_CharT>.
+// The default is declared in header <iosfwd>, and it isn't declared here
+// because C++ language rules do not allow it to be declared twice.
+
+template <class _CharT, class _Traits>
+class basic_streambuf {
+ friend class basic_istream<_CharT, _Traits>;
+ friend class basic_ostream<_CharT, _Traits>;
+
+public: // Typedefs.
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+private: // Data members.
+
+ char_type* _M_gbegin; // Beginning of get area
+ char_type* _M_gnext; // Current position within the get area
+ char_type* _M_gend; // End of get area
+
+ char_type* _M_pbegin; // Beginning of put area
+ char_type* _M_pnext; // Current position within the put area
+ char_type* _M_pend; // End of put area
+
+ locale _M_locale; // The streambuf's locale object
+
+public: // Destructor.
+ virtual ~basic_streambuf();
+
+protected: // The default constructor.
+ basic_streambuf()
+#if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && defined (_STLP_USE_STATIC_LIB)
+ //We make it inline to avoid unresolved symbol.
+ : _M_gbegin(0), _M_gnext(0), _M_gend(0),
+ _M_pbegin(0), _M_pnext(0), _M_pend(0),
+ _M_locale()
+ {}
+#else
+ ;
+#endif
+
+protected: // Protected interface to the get area.
+ char_type* eback() const { return _M_gbegin; } // Beginning
+ char_type* gptr() const { return _M_gnext; } // Current position
+ char_type* egptr() const { return _M_gend; } // End
+
+ void gbump(int __n) { _M_gnext += __n; }
+ void setg(char_type* __gbegin, char_type* __gnext, char_type* __gend) {
+ _M_gbegin = __gbegin;
+ _M_gnext = __gnext;
+ _M_gend = __gend;
+ }
+
+public:
+ // An alternate public interface to the above functions
+ // which allows us to avoid using templated friends which
+ // are not supported on some compilers.
+ char_type* _M_eback() const { return eback(); }
+ char_type* _M_gptr() const { return gptr(); }
+ char_type* _M_egptr() const { return egptr(); }
+ void _M_gbump(int __n) { gbump(__n); }
+ void _M_setg(char_type* __gbegin, char_type* __gnext, char_type* __gend)
+ { this->setg(__gbegin, __gnext, __gend); }
+
+protected: // Protected interface to the put area
+
+ char_type* pbase() const { return _M_pbegin; } // Beginning
+ char_type* pptr() const { return _M_pnext; } // Current position
+ char_type* epptr() const { return _M_pend; } // End
+
+ void pbump(int __n) { _M_pnext += __n; }
+ void setp(char_type* __pbegin, char_type* __pend) {
+ _M_pbegin = __pbegin;
+ _M_pnext = __pbegin;
+ _M_pend = __pend;
+ }
+
+protected: // Virtual buffer management functions.
+
+ virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize);
+
+ // Alters the stream position, using an integer offset. In this
+ // class seekoff does nothing; subclasses are expected to override it.
+ virtual pos_type seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode = ios_base::in | ios_base::out);
+
+ // Alters the stream position, using a previously obtained streampos. In
+ // this class seekpos does nothing; subclasses are expected to override it.
+ virtual pos_type
+ seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
+
+ // Synchronizes (i.e. flushes) the buffer. All subclasses are expected to
+ // override this virtual member function.
+ virtual int sync();
+
+
+public: // Buffer management.
+ basic_streambuf<_CharT, _Traits>* pubsetbuf(char_type* __s, streamsize __n)
+ { return this->setbuf(__s, __n); }
+
+ pos_type pubseekoff(off_type __offset, ios_base::seekdir __way,
+ ios_base::openmode __mod = ios_base::in | ios_base::out)
+ { return this->seekoff(__offset, __way, __mod); }
+
+ pos_type pubseekpos(pos_type __sp,
+ ios_base::openmode __mod = ios_base::in | ios_base::out)
+ { return this->seekpos(__sp, __mod); }
+
+ int pubsync() { return this->sync(); }
+
+protected: // Virtual get area functions, as defined in
+ // 17.5.2.4.3 and 17.5.2.4.4 of the standard.
+ // Returns a lower bound on the number of characters that we can read,
+ // with underflow, before reaching end of file. (-1 is a special value:
+ // it means that underflow will fail.) Most subclasses should probably
+ // override this virtual member function.
+ virtual streamsize showmanyc();
+
+ // Reads up to __n characters. Return value is the number of
+ // characters read.
+ virtual streamsize xsgetn(char_type* __s, streamsize __n);
+
+ // Called when there is no read position, i.e. when gptr() is null
+ // or when gptr() >= egptr(). Subclasses are expected to override
+ // this virtual member function.
+ virtual int_type underflow();
+
+ // Similar to underflow(), but used for unbuffered input. Most
+ // subclasses should probably override this virtual member function.
+ virtual int_type uflow();
+
+ // Called when there is no putback position, i.e. when gptr() is null
+ // or when gptr() == eback(). All subclasses are expected to override
+ // this virtual member function.
+ virtual int_type pbackfail(int_type = traits_type::eof());
+
+protected: // Virtual put area functions, as defined in
+ // 27.5.2.4.5 of the standard.
+
+ // Writes up to __n characters. Return value is the number of characters
+ // written.
+ virtual streamsize xsputn(const char_type* __s, streamsize __n);
+
+ // Extension: writes up to __n copies of __c. Return value is the number
+ // of characters written.
+ virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
+
+ // Called when there is no write position. All subclasses are expected to
+ // override this virtual member function.
+ virtual int_type overflow(int_type = traits_type::eof());
+
+public: // Public members for writing characters.
+ // Write a single character.
+ int_type sputc(char_type __c) {
+ return ((_M_pnext < _M_pend) ? _Traits::to_int_type(*_M_pnext++ = __c)
+ : this->overflow(_Traits::to_int_type(__c)));
+ }
+
+ // Write __n characters.
+ streamsize sputn(const char_type* __s, streamsize __n)
+ { return this->xsputn(__s, __n); }
+
+ // Extension: write __n copies of __c.
+ streamsize _M_sputnc(char_type __c, streamsize __n)
+ { return this->_M_xsputnc(__c, __n); }
+
+private: // Helper functions.
+ int_type _M_snextc_aux();
+
+public: // Public members for reading characters.
+ streamsize in_avail() {
+ return (_M_gnext < _M_gend) ? (_M_gend - _M_gnext) : this->showmanyc();
+ }
+
+ // Advance to the next character and return it.
+ int_type snextc() {
+ return ( _M_gend - _M_gnext > 1 ?
+ _Traits::to_int_type(*++_M_gnext) :
+ this->_M_snextc_aux());
+ }
+
+ // Return the current character and advance to the next.
+ int_type sbumpc() {
+ return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext++)
+ : this->uflow();
+ }
+
+ // Return the current character without advancing to the next.
+ int_type sgetc() {
+ return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext)
+ : this->underflow();
+ }
+
+ streamsize sgetn(char_type* __s, streamsize __n)
+ { return this->xsgetn(__s, __n); }
+
+ int_type sputbackc(char_type __c) {
+ return ((_M_gbegin < _M_gnext) && _Traits::eq(__c, *(_M_gnext - 1)))
+ ? _Traits::to_int_type(*--_M_gnext)
+ : this->pbackfail(_Traits::to_int_type(__c));
+ }
+
+ int_type sungetc() {
+ return (_M_gbegin < _M_gnext)
+ ? _Traits::to_int_type(*--_M_gnext)
+ : this->pbackfail();
+ }
+
+protected: // Virtual locale functions.
+
+ // This is a hook, called by pubimbue() just before pubimbue()
+ // sets the streambuf's locale to __loc. Note that imbue should
+ // not (and cannot, since it has no access to streambuf's private
+ // members) set the streambuf's locale itself.
+ virtual void imbue(const locale&);
+
+public: // Locale-related functions.
+ locale pubimbue(const locale&);
+ locale getloc() const { return _M_locale; }
+
+#if !defined (_STLP_NO_ANACHRONISMS)
+ void stossc() { this->sbumpc(); }
+#endif
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_streambuf<char, char_traits<char> >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_streambuf<wchar_t, char_traits<wchar_t> >;
+# endif // _STLP_NO_WCHAR_T
+#endif // _STLP_USE_TEMPLATE_EXPORT
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_streambuf.c>
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_string.c b/stlport/stl/_string.c
new file mode 100644
index 0000000..4fa5ece
--- /dev/null
+++ b/stlport/stl/_string.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#ifndef _STLP_STRING_C
+#define _STLP_STRING_C
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
+# include <stl/_ctraits_fns.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_H
+# include <stl/_function.h>
+#endif
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NO_MEM_T_NAME(str)
+#elif defined (_STLP_DEBUG)
+# define basic_string _STLP_NON_DBG_NAME(str)
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define __size_type__ size_t
+# define size_type size_t
+# define iterator _CharT*
+#else
+# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_string<_CharT,_Traits,_Alloc>::size_type
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// A helper class to use a char_traits as a function object.
+template <class _Traits>
+struct _Not_within_traits : public unary_function<typename _Traits::char_type, bool> {
+ typedef typename _Traits::char_type _CharT;
+ const _CharT* _M_first;
+ const _CharT* _M_last;
+
+ _Not_within_traits(const _CharT* __f, const _CharT* __l)
+ : _M_first(__f), _M_last(__l) {}
+
+ bool operator()(const _CharT& __x) const {
+ return find_if(_M_first, _M_last,
+ _STLP_PRIV _Eq_char_bound<_Traits>(__x)) == _M_last;
+ }
+};
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_of_aux(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits*, const __true_type& /* _STLportTraits */)
+{ return __find_first_of(__first1, __last1, __first2, __last2); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_of_aux(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits*, const __false_type& /* _STLportTraits */)
+{ return __find_first_of(__first1, __last1, __first2, __last2, _STLP_PRIV _Eq_traits<_Traits>()); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_of(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* __traits) {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<_Traits>::_Ret _STLportTraits;
+#else
+ enum { _Is = _IsSTLportClass<_Traits>::_Is };
+ typedef typename __bool2type<_Is>::_Ret _STLportTraits;
+#endif
+ return __str_find_first_of_aux(__first1, __last1, __first2, __last2, __traits, _STLportTraits());
+}
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of_aux3(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* /* __traits */, const __true_type& __useStrcspnLikeAlgo)
+{ return __find_first_of_aux2(__first1, __last1, __first2, __last2, __first2, not1(_Identity<bool>()), __useStrcspnLikeAlgo); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of_aux3(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* /* __traits */, const __false_type& /* _UseStrcspnLikeAlgo */)
+{ return _STLP_STD::find_if(__first1, __last1, _STLP_PRIV _Not_within_traits<_Traits>(__first2, __last2)); }
+
+template <class _InputIter, class _CharT, class _Tp, class _Traits>
+inline _InputIter __str_find_first_not_of_aux2(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Tp* __pt, _Traits* __traits) {
+ typedef typename _IsIntegral<_Tp>::_Ret _IsIntegral;
+ typedef typename _IsCharLikeType<_CharT>::_Ret _IsCharLike;
+ typedef typename _Land2<_IsIntegral, _IsCharLike>::_Ret _UseStrcspnLikeAlgo;
+ return __str_find_first_not_of_aux3(__first1, __last1, __first2, __last2, __traits, _UseStrcspnLikeAlgo());
+}
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of_aux1(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* __traits, const __true_type& /* _STLportTraits */)
+{ return __str_find_first_not_of_aux2(__first1, __last1, __first2, __last2,
+ _STLP_VALUE_TYPE(__first1, _InputIter), __traits); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of_aux1(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits*, const __false_type& /* _STLportTraits */)
+{ return _STLP_STD::find_if(__first1, __last1, _STLP_PRIV _Not_within_traits<_Traits>(__first2, __last2)); }
+
+template <class _InputIter, class _CharT, class _Traits>
+inline _InputIter __str_find_first_not_of(_InputIter __first1, _InputIter __last1,
+ const _CharT* __first2, const _CharT* __last2,
+ _Traits* __traits) {
+#if !defined (__BORLANDC__)
+ typedef typename _IsSTLportClass<_Traits>::_Ret _STLportTraits;
+#else
+ enum { _Is = _IsSTLportClass<_Traits>::_Is };
+ typedef typename __bool2type<_Is>::_Ret _STLportTraits;
+#endif
+ return __str_find_first_not_of_aux1(__first1, __last1, __first2, __last2, __traits, _STLportTraits());
+}
+
+// ------------------------------------------------------------
+// Non-inline declarations.
+
+#if !defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+// Change the string's capacity so that it is large enough to hold
+// at least __res_arg elements, plus the terminating _CharT(). Note that,
+// if __res_arg < capacity(), this member function may actually decrease
+// the string's capacity.
+template <class _CharT, class _Traits, class _Alloc>
+void basic_string<_CharT,_Traits,_Alloc>::reserve(size_type __res_arg) {
+ if (__res_arg > max_size())
+ this->_M_throw_length_error();
+
+ size_type __n = (max)(__res_arg, size()) + 1;
+ if (__n < this->_M_capacity())
+ return;
+
+ _M_reserve(__n);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+void basic_string<_CharT,_Traits,_Alloc>::_M_reserve(size_type __n) {
+ pointer __new_start = this->_M_start_of_storage.allocate(__n, __n);
+ pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __n);
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc>::append(size_type __n, _CharT __c) {
+ if (__n > 0) {
+ if (__n > max_size() - size())
+ this->_M_throw_length_error();
+ if (__n >= this->_M_rest())
+ _M_reserve(_M_compute_next_size(__n));
+ _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - 1, __c);
+ _M_construct_null(this->_M_finish + __n);
+ _Traits::assign(*end(), __c);
+ this->_M_finish += __n;
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT, _Traits, _Alloc>&
+basic_string<_CharT, _Traits, _Alloc>::_M_append(const _CharT* __first, const _CharT* __last) {
+ if (__first != __last) {
+ size_type __n = __STATIC_CAST(size_type, __last - __first);
+ if (__n >= this->_M_rest()) {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ const _CharT* __f1 = __first;
+ ++__f1;
+ _STLP_PRIV __ucopy(__f1, __last, this->_M_finish + 1);
+ _M_construct_null(this->_M_finish + __n);
+ _Traits::assign(*end(), *__first);
+ this->_M_finish += __n;
+ }
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc>::assign(size_type __n, _CharT __c) {
+ if (__n <= size()) {
+ _Traits::assign(this->_M_Start(), __n, __c);
+ erase(begin() + __n, end());
+ }
+ else {
+ if (__n < capacity()) {
+ _Traits::assign(this->_M_Start(), size(), __c);
+ append(__n - size(), __c);
+ }
+ else {
+ _Self __str(__n, __c);
+ this->swap(__str);
+ }
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc>::_M_assign(const _CharT* __f, const _CharT* __l) {
+ ptrdiff_t __n = __l - __f;
+ if (__STATIC_CAST(size_type, __n) <= size()) {
+ _Traits::copy(this->_M_Start(), __f, __n);
+ erase(begin() + __n, end());
+ }
+ else {
+ _Traits::copy(this->_M_Start(), __f, size());
+ _M_append(__f + size(), __l);
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+_CharT* basic_string<_CharT,_Traits,_Alloc> ::_M_insert_aux(_CharT* __p,
+ _CharT __c) {
+ pointer __new_pos = __p;
+ if (this->_M_rest() > 1 ) {
+ _M_construct_null(this->_M_finish + 1);
+ _Traits::move(__p + 1, __p, this->_M_finish - __p);
+ _Traits::assign(*__p, __c);
+ ++this->_M_finish;
+ }
+ else {
+ size_type __len = _M_compute_next_size(1);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ __new_pos = _STLP_PRIV __ucopy(this->_M_Start(), __p, __new_start);
+ _Traits::assign(*__new_pos, __c);
+ pointer __new_finish = __new_pos + 1;
+ __new_finish = _STLP_PRIV __ucopy(__p, this->_M_finish, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ return __new_pos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+void basic_string<_CharT,_Traits,_Alloc>::insert(iterator __pos,
+ size_t __n, _CharT __c) {
+ if (__n != 0) {
+ if (this->_M_rest() > __n) {
+ const size_type __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after >= __n) {
+ _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
+ this->_M_finish += __n;
+ _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
+ _Traits::assign(__pos, __n, __c);
+ }
+ else {
+ _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - __elems_after - 1, __c);
+ this->_M_finish += __n - __elems_after;
+ _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish);
+ this->_M_finish += __elems_after;
+ _Traits::assign(__pos, __elems_after + 1, __c);
+ }
+ }
+ else {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start);
+ __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __n, __c);
+ __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+void basic_string<_CharT,_Traits,_Alloc>::_M_insert(iterator __pos,
+ const _CharT* __first, const _CharT* __last,
+ bool __self_ref) {
+ //this version has to take care about the auto referencing
+ if (__first != __last) {
+ const size_t __n = __last - __first;
+ if (this->_M_rest() > __n) {
+ const size_t __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after >= __n) {
+ _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
+ this->_M_finish += __n;
+ _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
+ if (!__self_ref || __last < __pos) {
+ _M_copy(__first, __last, __pos);
+ }
+ else {
+ //We have to check that the source buffer hasn't move
+ if (__first >= __pos) {
+ //The source buffer has move
+ __first += __n;
+ __last += __n;
+ _M_copy(__first, __last, __pos);
+ }
+ else {
+ //The source buffer hasn't move, it has been duplicated
+ _M_move(__first, __last, __pos);
+ }
+ }
+ }
+ else {
+ const_iterator __mid = __first;
+ __mid += __elems_after + 1;
+ _STLP_PRIV __ucopy(__mid, __last, this->_M_finish + 1);
+ this->_M_finish += __n - __elems_after;
+ _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish);
+ this->_M_finish += __elems_after;
+ if (!__self_ref)
+ _M_copy(__first, __mid, __pos);
+ else
+ _M_move(__first, __mid, __pos);
+ }
+ }
+ else {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start);
+ __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish);
+ __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc> ::replace(iterator __first, iterator __last,
+ size_type __n, _CharT __c) {
+ size_type __len = (size_type)(__last - __first);
+
+ if (__len >= __n) {
+ _Traits::assign(__first, __n, __c);
+ erase(__first + __n, __last);
+ }
+ else {
+ _Traits::assign(__first, __len, __c);
+ insert(__last, __n - __len, __c);
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT,_Traits,_Alloc>&
+basic_string<_CharT,_Traits,_Alloc> ::_M_replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l,
+ bool __self_ref) {
+ const ptrdiff_t __n = __l - __f;
+ const difference_type __len = __last - __first;
+ if (__len >= __n) {
+ if (!__self_ref || __l < __first || __f >= __last)
+ _M_copy(__f, __l, __first);
+ else
+ _M_move(__f, __l, __first);
+ erase(__first + __n, __last);
+ } else if (!__self_ref || (__f >= __last) || (__l <= __first)) { // no overlap
+ const_iterator __m = __f + __len;
+ _M_copy(__f, __m, __first);
+ _M_insert(__last, __m, __l, __self_ref );
+ } else if (__f < __first) { // we have to take care of overlaping
+ const_iterator __m = __f + __len;
+ // We have to deal with possible reallocation because we do insert first.
+ const difference_type __off_dest = __first - this->begin();
+ const difference_type __off_src = __f - this->begin();
+ _M_insert(__last, __m, __l, true);
+ _Traits::move(begin() + __off_dest, begin() + __off_src, __len);
+ } else {
+ const_iterator __m = __f + __len;
+ _Traits::move(__first, __f, __len);
+ _M_insert(__last, __m, __l, true);
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__ basic_string<_CharT,_Traits,_Alloc>::find( const _CharT* __s, size_type __pos,
+ size_type __n) const
+{
+ const size_t __len = size();
+ if (__pos >= __len || __pos + __n > __len) {
+ if ( __n == 0 && __pos <= __len ) { // marginal case
+ return __pos;
+ }
+ return npos;
+ }
+
+ const_pointer __result =
+ _STLP_STD::search(this->_M_Start() + __pos, this->_M_Finish(),
+ __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>());
+ return __result != this->_M_Finish() ? __result - this->_M_Start() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__ basic_string<_CharT,_Traits,_Alloc>::find(_CharT __c, size_type __pos) const
+{
+ if (__pos >= size()) { /*__pos + 1 > size()*/
+ return npos;
+ }
+
+ const_pointer __result =
+ _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(),
+ _STLP_PRIV _Eq_char_bound<_Traits>(__c));
+ return __result != this->_M_Finish() ? __result - this->_M_Start() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__ basic_string<_CharT,_Traits,_Alloc>::rfind(const _CharT* __s, size_type __pos,
+ size_type __n) const
+{
+ const size_type __len = size();
+ if ( __len < __n ) {
+ return npos;
+ }
+ const_pointer __last = this->_M_Start() + (min)( __len - __n, __pos) + __n;
+ if ( __n == 0 ) { // marginal case
+ return __last - this->_M_Start();
+ }
+ const_pointer __result = _STLP_STD::find_end(this->_M_Start(), __last,
+ __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>());
+ return __result != __last ? __result - this->_M_Start() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__ basic_string<_CharT,_Traits,_Alloc>::rfind(_CharT __c, size_type __pos) const
+{
+ const size_type __len = size();
+ if ( __len < 1 ) {
+ return npos;
+ }
+ const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
+ const_reverse_iterator __rresult =
+ _STLP_STD::find_if(const_reverse_iterator(__last), rend(),
+ _STLP_PRIV _Eq_char_bound<_Traits>(__c));
+ return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc> __size_type__
+basic_string<_CharT,_Traits,_Alloc> ::find_first_of(const _CharT* __s, size_type __pos,
+ size_type __n) const {
+ if (__pos >= size()) /*__pos + 1 > size()*/
+ return npos;
+ else {
+ const_iterator __result = _STLP_PRIV __str_find_first_of(begin() + __pos, end(),
+ __s, __s + __n,
+ __STATIC_CAST(_Traits*, 0));
+ return __result != end() ? __result - begin() : npos;
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+ __size_type__
+basic_string<_CharT,_Traits,_Alloc> ::find_last_of(const _CharT* __s, size_type __pos,
+ size_type __n) const
+{
+ const size_type __len = size();
+ if ( __len < 1 ) {
+ return npos;
+ }
+ const const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
+ const const_reverse_iterator __rresult =
+ _STLP_PRIV __str_find_first_of(const_reverse_iterator(__last), rend(),
+ __s, __s + __n,
+ __STATIC_CAST(_Traits*, 0));
+ return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
+}
+
+
+template <class _CharT, class _Traits, class _Alloc> __size_type__
+basic_string<_CharT,_Traits,_Alloc> ::find_first_not_of(const _CharT* __s, size_type __pos,
+ size_type __n) const {
+ typedef typename _Traits::char_type _CharType;
+ if (__pos >= size()) /*__pos + 1 >= size()*/
+ return npos;
+ else {
+ const_pointer __result = _STLP_PRIV __str_find_first_not_of(this->_M_Start() + __pos, this->_M_Finish(),
+ __STATIC_CAST(const _CharType*, __s),
+ __STATIC_CAST(const _CharType*, __s) + __n,
+ __STATIC_CAST(_Traits*, 0));
+ return __result != this->_M_finish ? __result - this->_M_Start() : npos;
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc> __size_type__
+basic_string<_CharT,_Traits,_Alloc> ::find_first_not_of(_CharT __c, size_type __pos) const {
+ if (1 > size())
+ return npos;
+ else {
+ const_pointer __result = _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(),
+ _STLP_PRIV _Neq_char_bound<_Traits>(__c));
+ return __result != this->_M_finish ? __result - this->_M_Start() : npos;
+ }
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__
+basic_string<_CharT,_Traits,_Alloc>::find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+{
+ typedef typename _Traits::char_type _CharType;
+ const size_type __len = size();
+ if ( __len < 1 ) {
+ return npos;
+ }
+ const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
+ const_reverse_iterator __rlast = const_reverse_iterator(__last);
+ const_reverse_iterator __rresult =
+ _STLP_PRIV __str_find_first_not_of(__rlast, rend(),
+ __STATIC_CAST(const _CharType*, __s),
+ __STATIC_CAST(const _CharType*, __s) + __n,
+ __STATIC_CAST(_Traits*, 0));
+ return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+__size_type__
+basic_string<_CharT, _Traits, _Alloc>::find_last_not_of(_CharT __c, size_type __pos) const
+{
+ const size_type __len = size();
+ if ( __len < 1 ) {
+ return npos;
+ }
+ const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
+ const_reverse_iterator __rlast = const_reverse_iterator(__last);
+ const_reverse_iterator __rresult =
+ _STLP_STD::find_if(__rlast, rend(),
+ _STLP_PRIV _Neq_char_bound<_Traits>(__c));
+ return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
+}
+
+#if !defined (basic_string)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _CharT, class _Traits, class _Alloc>
+void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ _CharT* __buf, size_t __n) {
+ if (__n > 0) {
+ __n = (min) (__n - 1, __s.size());
+ _STLP_STD::copy(__s.begin(), __s.begin() + __n, __buf);
+ __buf[__n] = _CharT();
+ }
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#include <stl/_range_errors.h>
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// _String_base methods
+template <class _Tp, class _Alloc>
+void _String_base<_Tp,_Alloc>::_M_throw_length_error() const
+{ __stl_throw_length_error("basic_string"); }
+
+template <class _Tp, class _Alloc>
+void _String_base<_Tp, _Alloc>::_M_throw_out_of_range() const
+{ __stl_throw_out_of_range("basic_string"); }
+
+template <class _Tp, class _Alloc>
+void _String_base<_Tp, _Alloc>::_M_allocate_block(size_t __n) {
+ if ((__n <= (max_size() + 1)) && (__n > 0)) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (__n > _DEFAULT_SIZE) {
+ this->_M_start_of_storage._M_data = _M_start_of_storage.allocate(__n, __n);
+ this->_M_finish = this->_M_start_of_storage._M_data;
+ this->_M_buffers._M_end_of_storage = this->_M_start_of_storage._M_data + __n;
+ }
+#else
+ this->_M_start_of_storage._M_data = _M_start_of_storage.allocate(__n, __n);
+ this->_M_finish = this->_M_start_of_storage._M_data;
+ this->_M_end_of_storage = this->_M_start_of_storage._M_data + __n;
+#endif
+ } else {
+ this->_M_throw_length_error();
+ }
+}
+
+#if !defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT* __s)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _M_range_initialize(__s, __s + traits_type::length(__s));
+}
+#endif
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT* __s,
+ const allocator_type& __a)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _M_range_initialize(__s, __s + traits_type::length(__s));
+}
+
+template <class _CharT, class _Traits, class _Alloc>
+basic_string<_CharT, _Traits, _Alloc>::basic_string(const basic_string<_CharT, _Traits, _Alloc> & __s)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__s.get_allocator())
+{ _M_range_initialize(__s._M_Start(), __s._M_Finish()); }
+
+#if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+#endif
+
+#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
+template <class _CharT, class _Traits, class _Alloc>
+const size_t basic_string<_CharT, _Traits, _Alloc>::npos;
+#endif
+
+_STLP_END_NAMESPACE
+
+#undef __size_type__
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# undef size_type
+# undef iterator
+#endif
+
+#endif /* _STLP_STRING_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_string.h b/stlport/stl/_string.h
new file mode 100644
index 0000000..540822b
--- /dev/null
+++ b/stlport/stl/_string.h
@@ -0,0 +1,1182 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_STRING_H
+#define _STLP_INTERNAL_STRING_H
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_STRING_FWD_H
+# include <stl/_string_fwd.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+# include <stl/_string_sum.h>
+#endif /* _STLP_USE_TEMPLATE_EXPRESSION */
+
+#if defined (__MWERKS__) && ! defined (_STLP_USE_OWN_NAMESPACE)
+
+// MSL implementation classes expect to see the definition of streampos
+// when this header is included. We expect this to be fixed in later MSL
+// implementations
+# if !defined( __MSL_CPP__ ) || __MSL_CPP__ < 0x4105
+# include <stl/msl_string.h>
+# endif
+#endif // __MWERKS__
+
+/*
+ * Standard C++ string class. This class has performance
+ * characteristics very much like vector<>, meaning, for example, that
+ * it does not perform reference-count or copy-on-write, and that
+ * concatenation of two strings is an O(N) operation.
+
+ * There are three reasons why basic_string is not identical to
+ * vector.
+ * First, basic_string always stores a null character at the end;
+ * this makes it possible for c_str to be a fast operation.
+ * Second, the C++ standard requires basic_string to copy elements
+ * using char_traits<>::assign, char_traits<>::copy, and
+ * char_traits<>::move. This means that all of vector<>'s low-level
+ * operations must be rewritten. Third, basic_string<> has a lot of
+ * extra functions in its interface that are convenient but, strictly
+ * speaking, redundant.
+ */
+
+#include <stl/_string_base.h>
+
+_STLP_BEGIN_NAMESPACE
+
+// ------------------------------------------------------------
+// Class basic_string.
+
+// Class invariants:
+// (1) [start, finish) is a valid range.
+// (2) Each iterator in [start, finish) points to a valid object
+// of type value_type.
+// (3) *finish is a valid object of type value_type; when
+// value_type is not a POD it is value_type().
+// (4) [finish + 1, end_of_storage) is a valid range.
+// (5) Each iterator in [finish + 1, end_of_storage) points to
+// unininitialized memory.
+
+// Note one important consequence: a string of length n must manage
+// a block of memory whose size is at least n + 1.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+struct _String_reserve_t {};
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define basic_string _STLP_NO_MEM_T_NAME(str)
+#elif defined (_STLP_DEBUG)
+# define basic_string _STLP_NON_DBG_NAME(str)
+#endif
+
+#if defined (basic_string)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+#if defined (__DMC__)
+# define _STLP_PRIVATE public
+#elif defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define _STLP_PRIVATE protected
+#else
+# define _STLP_PRIVATE private
+#endif
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_string : _STLP_PRIVATE _STLP_PRIV _String_base<_CharT,_Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string)
+ , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
+#endif
+{
+_STLP_PRIVATE: // Private members inherited from base.
+ typedef _STLP_PRIV _String_base<_CharT,_Alloc> _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _Self;
+
+public:
+ typedef _CharT value_type;
+ typedef _Traits traits_type;
+
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef typename _Base::size_type size_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag _Iterator_category;
+
+ typedef const value_type* const_iterator;
+ typedef value_type* iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+#include <stl/_string_npos.h>
+
+ typedef _STLP_PRIV _String_reserve_t _Reserve_t;
+
+public: // Constructor, destructor, assignment.
+ typedef typename _Base::allocator_type allocator_type;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR((const allocator_type&)this->_M_start_of_storage, _CharT); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit basic_string(const allocator_type& __a = allocator_type())
+#else
+ basic_string()
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), _Base::_DEFAULT_SIZE)
+ { _M_terminate_string(); }
+ explicit basic_string(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, _Base::_DEFAULT_SIZE)
+ { _M_terminate_string(); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(_Reserve_t, size_t __n,
+ const allocator_type& __a = allocator_type())
+#else
+ basic_string(_Reserve_t, size_t __n)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), __n + 1)
+ { _M_terminate_string(); }
+ basic_string(_Reserve_t, size_t __n, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, __n + 1)
+ { _M_terminate_string(); }
+
+ basic_string(const _Self&);
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+#else
+ basic_string(const _Self& __s, size_type __pos)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ else
+ _M_range_initialize(__s._M_Start() + __pos, __s._M_Finish());
+ }
+ basic_string(const _Self& __s, size_type __pos, size_type __n)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ else
+ _M_range_initialize(__s._M_Start() + __pos,
+ __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
+ }
+ basic_string(const _Self& __s, size_type __pos, size_type __n,
+ const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ else
+ _M_range_initialize(__s._M_Start() + __pos,
+ __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(const _CharT* __s, size_type __n,
+ const allocator_type& __a = allocator_type())
+#else
+ basic_string(const _CharT* __s, size_type __n)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _M_range_initialize(__s, __s + __n);
+ }
+ basic_string(const _CharT* __s, size_type __n, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _M_range_initialize(__s, __s + __n);
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(const _CharT* __s,
+ const allocator_type& __a = allocator_type());
+#else
+ basic_string(const _CharT* __s);
+ basic_string(const _CharT* __s, const allocator_type& __a);
+#endif
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ basic_string(size_type __n, _CharT __c,
+ const allocator_type& __a = allocator_type())
+#else
+ basic_string(size_type __n, _CharT __c)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), __n + 1) {
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c);
+ _M_terminate_string();
+ }
+ basic_string(size_type __n, _CharT __c, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, __n + 1) {
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c);
+ _M_terminate_string();
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ basic_string(__move_source<_Self> src)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__move_source<_Base>(src.get())) {}
+#endif
+
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l,
+ const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__f, __l, _Integral());
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__f, __l, _Integral());
+ }
+# endif
+#else
+# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ basic_string(const _CharT* __f, const _CharT* __l,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _M_range_initialize(__f, __l);
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ basic_string(const _CharT* __f, const _CharT* __l)
+ : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _M_range_initialize(__f, __l);
+ }
+# endif
+# endif
+# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ /* We need an additionnal constructor to build an empty string without
+ * any allocation or termination char*/
+protected:
+ struct _CalledFromWorkaround_t {};
+ basic_string(_CalledFromWorkaround_t, const allocator_type &__a)
+ : _String_base<_CharT,_Alloc>(__a) {}
+# endif
+#endif
+
+_STLP_PRIVATE:
+ size_type _M_compute_next_size(size_type __n) {
+ const size_type __size = size();
+ if (__n > max_size() - __size)
+ this->_M_throw_length_error();
+ size_type __len = __size + (max)(__n, __size) + 1;
+ if (__len > max_size() || __len < __size)
+ __len = max_size(); // overflow
+ return __len;
+ }
+
+ template <class _InputIter>
+ void _M_range_initialize(_InputIter __f, _InputIter __l,
+ const input_iterator_tag &__tag) {
+ this->_M_allocate_block();
+ _M_construct_null(this->_M_Finish());
+ _M_appendT(__f, __l, __tag);
+ }
+
+ template <class _ForwardIter>
+ void _M_range_initialize(_ForwardIter __f, _ForwardIter __l,
+ const forward_iterator_tag &) {
+ difference_type __n = _STLP_STD::distance(__f, __l);
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start());
+ this->_M_terminate_string();
+ }
+
+ template <class _InputIter>
+ void _M_range_initializeT(_InputIter __f, _InputIter __l) {
+ _M_range_initialize(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
+ }
+
+ template <class _Integer>
+ void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) {
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __x);
+ this->_M_terminate_string();
+ }
+
+ template <class _InputIter>
+ void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
+ _M_range_initializeT(__f, __l);
+ }
+
+public:
+ _Self& operator=(const _Self& __s) {
+ if (&__s != this)
+ _M_assign(__s._M_Start(), __s._M_Finish());
+ return *this;
+ }
+
+ _Self& operator=(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_assign(__s, __s + traits_type::length(__s));
+ }
+
+ _Self& operator=(_CharT __c)
+ { return assign(__STATIC_CAST(size_type,1), __c); }
+
+private:
+ static _CharT _STLP_CALL _M_null()
+ { return _STLP_DEFAULT_CONSTRUCTED(_CharT); }
+
+_STLP_PRIVATE: // Helper functions used by constructors
+ // and elsewhere.
+ void _M_construct_null(_CharT* __p) const
+ { _STLP_STD::_Construct(__p); }
+ void _M_terminate_string()
+ { _M_construct_null(this->_M_Finish()); }
+ bool _M_inside(const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return (__s >= this->_M_Start()) && (__s < this->_M_Finish());
+ }
+
+ void _M_range_initialize(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ ptrdiff_t __n = __l - __f;
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start());
+ _M_terminate_string();
+ }
+
+public: // Iterators.
+ iterator begin() { return this->_M_Start(); }
+ iterator end() { return this->_M_Finish(); }
+ const_iterator begin() const { return this->_M_Start(); }
+ const_iterator end() const { return this->_M_Finish(); }
+
+ reverse_iterator rbegin()
+ { return reverse_iterator(this->_M_Finish()); }
+ reverse_iterator rend()
+ { return reverse_iterator(this->_M_Start()); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(this->_M_Finish()); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(this->_M_Start()); }
+
+public: // Size, capacity, etc.
+ size_type size() const { return this->_M_Finish() - this->_M_Start(); }
+ size_type length() const { return size(); }
+ size_type max_size() const { return _Base::max_size(); }
+
+ void resize(size_type __n, _CharT __c) {
+ if (__n <= size())
+ erase(begin() + __n, end());
+ else
+ append(__n - size(), __c);
+ }
+
+ void resize(size_type __n) { resize(__n, _M_null()); }
+
+private:
+ void _M_reserve(size_type);
+public:
+ void reserve(size_type = 0);
+
+ size_type capacity() const
+ { return this->_M_capacity() - 1; }
+
+ void clear() {
+ if (!empty()) {
+ _Traits::assign(*(this->_M_Start()), _M_null());
+ this->_M_finish = this->_M_Start();
+ }
+ }
+
+ bool empty() const { return this->_M_Start() == this->_M_Finish(); }
+
+public: // Element access.
+
+ const_reference operator[](size_type __n) const
+ { return *(this->_M_Start() + __n); }
+ reference operator[](size_type __n)
+ { return *(this->_M_Start() + __n); }
+
+ const_reference at(size_type __n) const {
+ if (__n >= size())
+ this->_M_throw_out_of_range();
+ return *(this->_M_Start() + __n);
+ }
+
+ reference at(size_type __n) {
+ if (__n >= size())
+ this->_M_throw_out_of_range();
+ return *(this->_M_Start() + __n);
+ }
+
+public: // Append, operator+=, push_back.
+
+ _Self& operator+=(const _Self& __s) { return append(__s); }
+ _Self& operator+=(const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return append(__s); }
+ _Self& operator+=(_CharT __c) { push_back(__c); return *this; }
+
+private:
+ _Self& _M_append(const _CharT* __first, const _CharT* __last);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _InputIter>
+ _Self& _M_appendT(_InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last ; ++__first)
+ push_back(*__first);
+ return *this;
+ }
+
+ template <class _ForwardIter>
+ _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ size_type __n = __STATIC_CAST(size_type, _STLP_STD::distance(__first, __last));
+ if (__n >= this->_M_rest()) {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _Traits::assign(*this->_M_finish, *__first++);
+ uninitialized_copy(__first, __last, this->_M_Finish() + 1);
+ _M_construct_null(this->_M_Finish() + __n);
+ this->_M_finish += __n;
+ }
+ }
+ return *this;
+ }
+
+ template <class _Integer>
+ _Self& _M_append_dispatch(_Integer __n, _Integer __x, const __true_type& /*Integral*/)
+ { return append((size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ _Self& _M_append_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*Integral*/)
+ { return _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); }
+
+public:
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& append(_InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_append_dispatch(__first, __last, _Integral());
+ }
+#else
+public:
+ _Self& append(const _CharT* __first, const _CharT* __last) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ return _M_append(__first, __last);
+ }
+#endif
+
+public:
+ _Self& append(const _Self& __s)
+ { return _M_append(__s._M_Start(), __s._M_Finish()); }
+
+ _Self& append(const _Self& __s,
+ size_type __pos, size_type __n) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ return _M_append(__s._M_Start() + __pos,
+ __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
+ }
+
+ _Self& append(const _CharT* __s, size_type __n)
+ { _STLP_FIX_LITERAL_BUG(__s) return _M_append(__s, __s+__n); }
+ _Self& append(const _CharT* __s)
+ { _STLP_FIX_LITERAL_BUG(__s) return _M_append(__s, __s + traits_type::length(__s)); }
+ _Self& append(size_type __n, _CharT __c);
+
+public:
+ void push_back(_CharT __c) {
+ if (this->_M_rest() == 1 )
+ _M_reserve(_M_compute_next_size(1));
+ _M_construct_null(this->_M_Finish() + 1);
+ _Traits::assign(*(this->_M_Finish()), __c);
+ ++this->_M_finish;
+ }
+
+ void pop_back() {
+ _Traits::assign(*(this->_M_Finish() - 1), _M_null());
+ --this->_M_finish;
+ }
+
+public: // Assign
+ _Self& assign(const _Self& __s)
+ { return _M_assign(__s._M_Start(), __s._M_Finish()); }
+
+ _Self& assign(const _Self& __s,
+ size_type __pos, size_type __n) {
+ if (__pos > __s.size())
+ this->_M_throw_out_of_range();
+ return _M_assign(__s._M_Start() + __pos,
+ __s._M_Start() + __pos + (min) (__n, __s.size() - __pos));
+ }
+
+ _Self& assign(const _CharT* __s, size_type __n)
+ { _STLP_FIX_LITERAL_BUG(__s) return _M_assign(__s, __s + __n); }
+
+ _Self& assign(const _CharT* __s)
+ { _STLP_FIX_LITERAL_BUG(__s) return _M_assign(__s, __s + _Traits::length(__s)); }
+
+ _Self& assign(size_type __n, _CharT __c);
+
+private:
+ _Self& _M_assign(const _CharT* __f, const _CharT* __l);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ // Helper functions for assign.
+ template <class _Integer>
+ _Self& _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/)
+ { return assign((size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ _Self& _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
+ pointer __cur = this->_M_Start();
+ while (__f != __l && __cur != this->_M_Finish()) {
+ _Traits::assign(*__cur, *__f);
+ ++__f;
+ ++__cur;
+ }
+ if (__f == __l)
+ erase(__cur, this->end());
+ else
+ _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
+ return *this;
+ }
+
+public:
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& assign(_InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_assign_dispatch(__first, __last, _Integral());
+ }
+#else
+public:
+ _Self& assign(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ return _M_assign(__f, __l);
+ }
+#endif
+
+public: // Insert
+ _Self& insert(size_type __pos, const _Self& __s) {
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ if (__s.size() > max_size() - size())
+ this->_M_throw_length_error();
+ _M_insert(begin() + __pos, __s._M_Start(), __s._M_Finish(), &__s == this);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _Self& __s,
+ size_type __beg, size_type __n) {
+ if (__pos > size() || __beg > __s.size())
+ this->_M_throw_out_of_range();
+ size_type __len = (min) (__n, __s.size() - __beg);
+ if (__len > max_size() - size())
+ this->_M_throw_length_error();
+ _M_insert(begin() + __pos,
+ __s._M_Start() + __beg, __s._M_Start() + __beg + __len, &__s == this);
+ return *this;
+ }
+ _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ if (__n > max_size() - size())
+ this->_M_throw_length_error();
+ _M_insert(begin() + __pos, __s, __s + __n, _M_inside(__s));
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ size_type __len = _Traits::length(__s);
+ if (__len > max_size() - size())
+ this->_M_throw_length_error();
+ _M_insert(this->_M_Start() + __pos, __s, __s + __len, _M_inside(__s));
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, size_type __n, _CharT __c) {
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ if (__n > max_size() - size())
+ this->_M_throw_length_error();
+ insert(begin() + __pos, __n, __c);
+ return *this;
+ }
+
+ iterator insert(iterator __p, _CharT __c) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ if (__p == end()) {
+ push_back(__c);
+ return this->_M_Finish() - 1;
+ }
+ else
+ return _M_insert_aux(__p, __c);
+ }
+
+ void insert(iterator __p, size_t __n, _CharT __c);
+
+_STLP_PRIVATE: // Helper functions for insert.
+ void _M_insert(iterator __p, const _CharT* __first, const _CharT* __last, bool __self_ref);
+
+ pointer _M_insert_aux(pointer, _CharT);
+
+ void _M_copy(const _CharT* __f, const _CharT* __l, _CharT* __res) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _STLP_FIX_LITERAL_BUG(__res)
+ _Traits::copy(__res, __f, __l - __f);
+ }
+
+ void _M_move(const _CharT* __f, const _CharT* __l, _CharT* __res) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _Traits::move(__res, __f, __l - __f);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _ForwardIter>
+ void _M_insert_overflow(iterator __pos, _ForwardIter __first, _ForwardIter __last,
+ size_type __n) {
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), __pos, __new_start);
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ __new_finish = uninitialized_copy(__pos, this->_M_Finish(), __new_finish);
+ _M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+
+ template <class _InputIter>
+ void _M_insertT(iterator __p, _InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first) {
+ __p = insert(__p, *__first);
+ ++__p;
+ }
+ }
+
+ template <class _ForwardIter>
+ void _M_insertT(iterator __pos, _ForwardIter __first, _ForwardIter __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ if (__n < this->_M_rest()) {
+ const size_type __elems_after = this->_M_finish - __pos;
+ if (__elems_after >= __n) {
+ uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
+ this->_M_finish += __n;
+ _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
+ _M_copyT(__first, __last, __pos);
+ }
+ else {
+ pointer __old_finish = this->_M_Finish();
+ _ForwardIter __mid = __first;
+ _STLP_STD::advance(__mid, __elems_after + 1);
+ _STLP_STD::uninitialized_copy(__mid, __last, this->_M_Finish() + 1);
+ this->_M_finish += __n - __elems_after;
+ uninitialized_copy(__pos, __old_finish + 1, this->_M_Finish());
+ this->_M_finish += __elems_after;
+ _M_copyT(__first, __mid, __pos);
+ }
+ }
+ else {
+ _M_insert_overflow(__pos, __first, __last, __n);
+ }
+ }
+ }
+
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x,
+ const __true_type& /*Integral*/)
+ { insert(__p, (size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last,
+ const __false_type& /*Integral*/) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ /* We are forced to do a temporary string to avoid the self referencing issue. */
+ const _Self __self(__first, __last, get_allocator());
+ _M_insertT(__p, __self.begin(), __self.end(), forward_iterator_tag());
+ }
+
+ template <class _InputIterator>
+ void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) {
+ _STLP_FIX_LITERAL_BUG(__result)
+ for ( ; __first != __last; ++__first, ++__result)
+ _Traits::assign(*__result, *__first);
+ }
+
+# if !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ void _M_copyT(const _CharT* __f, const _CharT* __l, _CharT* __res) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _STLP_FIX_LITERAL_BUG(__res)
+ _Traits::copy(__res, __f, __l - __f);
+ }
+# endif
+public:
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ void insert(iterator __p, _InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ _M_insert_dispatch(__p, __first, __last, _Integral());
+ }
+# endif
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+public:
+ void insert(iterator __p, const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _M_insert(__p, __f, __l, _M_inside(__f));
+ }
+#endif
+
+public: // Erase.
+ _Self& erase(size_type __pos = 0, size_type __n = npos) {
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ erase(begin() + __pos, begin() + __pos + (min) (__n, size() - __pos));
+ return *this;
+ }
+
+ iterator erase(iterator __pos) {
+ // The move includes the terminating _CharT().
+ _Traits::move(__pos, __pos + 1, this->_M_Finish() - __pos);
+ --this->_M_finish;
+ return __pos;
+ }
+
+ iterator erase(iterator __first, iterator __last) {
+ if (__first != __last) {
+ // The move includes the terminating _CharT().
+ traits_type::move(__first, __last, (this->_M_Finish() - __last) + 1);
+ this->_M_finish = this->_M_Finish() - (__last - __first);
+ }
+ return __first;
+ }
+
+public: // Replace. (Conceptually equivalent
+ // to erase followed by insert.)
+ _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
+ const size_type __size = size();
+ if (__pos > __size)
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n, __size - __pos);
+ if (__s.size() > max_size() - (__size - __len))
+ this->_M_throw_length_error();
+ return _M_replace(begin() + __pos, begin() + __pos + __len,
+ __s._M_Start(), __s._M_Finish(), &__s == this);
+ }
+
+ _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) {
+ const size_type __size1 = size();
+ const size_type __size2 = __s.size();
+ if (__pos1 > __size1 || __pos2 > __size2)
+ this->_M_throw_out_of_range();
+ const size_type __len1 = (min) (__n1, __size1 - __pos1);
+ const size_type __len2 = (min) (__n2, __size2 - __pos2);
+ if (__len2 > max_size() - (__size1 - __len1))
+ this->_M_throw_length_error();
+ return _M_replace(begin() + __pos1, begin() + __pos1 + __len1,
+ __s._M_Start() + __pos2, __s._M_Start() + __pos2 + __len2, &__s == this);
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ const _CharT* __s, size_type __n2) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ const size_type __size = size();
+ if (__pos > __size)
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n1, __size - __pos);
+ if (__n2 > max_size() - (__size - __len))
+ this->_M_throw_length_error();
+ return _M_replace(begin() + __pos, begin() + __pos + __len,
+ __s, __s + __n2, _M_inside(__s));
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return replace(__pos, __n1, __s, _Traits::length(__s));
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ size_type __n2, _CharT __c) {
+ const size_type __size = size();
+ if (__pos > __size)
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n1, __size - __pos);
+ if (__n2 > max_size() - (__size - __len))
+ this->_M_throw_length_error();
+ return replace(begin() + __pos, begin() + __pos + __len, __n2, __c);
+ }
+
+ _Self& replace(iterator __first, iterator __last, const _Self& __s) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ return _M_replace(__first, __last, __s._M_Start(), __s._M_Finish(), &__s == this);
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_replace(__first, __last, __s, __s + __n, _M_inside(__s));
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_replace(__first, __last, __s, __s + _Traits::length(__s), _M_inside(__s));
+ }
+
+ _Self& replace(iterator __first, iterator __last, size_type __n, _CharT __c);
+
+_STLP_PRIVATE: // Helper functions for replace.
+ _Self& _M_replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l, bool __self_ref);
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+ template <class _Integer>
+ _Self& _M_replace_dispatch(iterator __first, iterator __last,
+ _Integer __n, _Integer __x, const __true_type& /*IsIntegral*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ return replace(__first, __last, (size_type) __n, (_CharT) __x);
+ }
+
+ template <class _InputIter>
+ _Self& _M_replace_dispatch(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l, const __false_type& /*IsIntegral*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ /* We are forced to do a temporary string to avoid the self referencing issue. */
+ const _Self __self(__f, __l, get_allocator());
+ return _M_replace(__first, __last, __self._M_Start(), __self._M_Finish(), false);
+ }
+
+public:
+ // Check to see if _InputIter is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& replace(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_replace_dispatch(__first, __last, __f, __l, _Integral());
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+public:
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ return _M_replace(__first, __last, __f, __l, _M_inside(__f));
+ }
+#endif
+
+public: // Other modifier member functions.
+
+ size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos > size())
+ this->_M_throw_out_of_range();
+ const size_type __len = (min) (__n, size() - __pos);
+ _Traits::copy(__s, this->_M_Start() + __pos, __len);
+ return __len;
+ }
+
+ void swap(_Self& __s) { this->_M_swap(__s); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public: // Conversion to C string.
+
+ const _CharT* c_str() const { return this->_M_Start(); }
+ const _CharT* data() const { return this->_M_Start(); }
+
+public: // find.
+ size_type find(const _Self& __s, size_type __pos = 0) const
+ { return find(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find(const _CharT* __s, size_type __pos = 0) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find(__s, __pos, _Traits::length(__s)); }
+
+ size_type find(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ // WIE: Versant schema compiler 5.2.2 ICE workaround
+ size_type find(_CharT __c) const { return find(__c, 0); }
+ size_type find(_CharT __c, size_type __pos /* = 0 */) const;
+
+public: // rfind.
+ size_type rfind(const _Self& __s, size_type __pos = npos) const
+ { return rfind(__s._M_Start(), __pos, __s.size()); }
+
+ size_type rfind(const _CharT* __s, size_type __pos = npos) const
+ { _STLP_FIX_LITERAL_BUG(__s) return rfind(__s, __pos, _Traits::length(__s)); }
+
+ size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const;
+ size_type rfind(_CharT __c, size_type __pos = npos) const;
+
+public: // find_first_of
+ size_type find_first_of(const _Self& __s, size_type __pos = 0) const
+ { return find_first_of(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find_first_of(const _CharT* __s, size_type __pos = 0) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find_first_of(__s, __pos, _Traits::length(__s)); }
+
+ size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type find_first_of(_CharT __c, size_type __pos = 0) const
+ { return find(__c, __pos); }
+
+public: // find_last_of
+ size_type find_last_of(const _Self& __s, size_type __pos = npos) const
+ { return find_last_of(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find_last_of(const _CharT* __s, size_type __pos = npos) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find_last_of(__s, __pos, _Traits::length(__s)); }
+
+ size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type find_last_of(_CharT __c, size_type __pos = npos) const
+ { return rfind(__c, __pos); }
+
+public: // find_first_not_of
+ size_type find_first_not_of(const _Self& __s, size_type __pos = 0) const
+ { return find_first_not_of(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find_first_not_of(__s, __pos, _Traits::length(__s)); }
+
+ size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type find_first_not_of(_CharT __c, size_type __pos = 0) const;
+
+public: // find_last_not_of
+ size_type find_last_not_of(const _Self& __s, size_type __pos = npos) const
+ { return find_last_not_of(__s._M_Start(), __pos, __s.size()); }
+
+ size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const
+ { _STLP_FIX_LITERAL_BUG(__s) return find_last_not_of(__s, __pos, _Traits::length(__s)); }
+
+ size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ size_type find_last_not_of(_CharT __c, size_type __pos = npos) const;
+
+public: // Substring.
+ _Self substr(size_type __pos = 0, size_type __n = npos) const
+ { return _Self(*this, __pos, __n, get_allocator()); }
+
+public: // Compare
+ int compare(const _Self& __s) const
+ { return _M_compare(this->_M_Start(), this->_M_Finish(), __s._M_Start(), __s._M_Finish()); }
+
+ int compare(size_type __pos1, size_type __n1, const _Self& __s) const {
+ if (__pos1 > size())
+ this->_M_throw_out_of_range();
+ return _M_compare(this->_M_Start() + __pos1,
+ this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
+ __s._M_Start(), __s._M_Finish());
+ }
+
+ int compare(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) const {
+ if (__pos1 > size() || __pos2 > __s.size())
+ this->_M_throw_out_of_range();
+ return _M_compare(this->_M_Start() + __pos1,
+ this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
+ __s._M_Start() + __pos2,
+ __s._M_Start() + __pos2 + (min) (__n2, __s.size() - __pos2));
+ }
+
+ int compare(const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_compare(this->_M_Start(), this->_M_Finish(), __s, __s + _Traits::length(__s));
+ }
+
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos1 > size())
+ this->_M_throw_out_of_range();
+ return _M_compare(this->_M_Start() + __pos1,
+ this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
+ __s, __s + _Traits::length(__s));
+ }
+
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ if (__pos1 > size())
+ this->_M_throw_out_of_range();
+ return _M_compare(this->_M_Start() + __pos1,
+ this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1),
+ __s, __s + __n2);
+ }
+
+public: // Helper functions for compare.
+ static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
+ const _CharT* __f2, const _CharT* __l2) {
+ const ptrdiff_t __n1 = __l1 - __f1;
+ const ptrdiff_t __n2 = __l2 - __f2;
+ const int cmp = _Traits::compare(__f1, __f2, (min) (__n1, __n2));
+ return cmp != 0 ? cmp : (__n1 < __n2 ? -1 : (__n1 > __n2 ? 1 : 0));
+ }
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# define _STLP_STRING_SUM_BASE(__reserve, __size, __alloc) _STLP_PRIV _String_base<_CharT,_Alloc>(__alloc, __size + 1)
+# include <stl/_string_sum_methods.h>
+# undef _STLP_STRING_SUM_BASE
+#endif
+};
+
+#undef _STLP_PRIVATE
+
+#if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
+template <class _CharT, class _Traits, class _Alloc>
+const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0;
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS basic_string<char, char_traits<char>, allocator<char> >;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+#if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+#endif
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+# include <stl/_string_workaround.h>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// ------------------------------------------------------------
+// Non-member functions.
+// Swap.
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _CharT, class _Traits, class _Alloc>
+inline void _STLP_CALL
+swap(basic_string<_CharT,_Traits,_Alloc>& __x,
+ basic_string<_CharT,_Traits,_Alloc>& __y)
+{ __x.swap(__y); }
+#else
+inline void _STLP_CALL swap(string& __x, string& __y)
+{ __x.swap(__y); }
+# if defined (_STLP_HAS_WCHAR_T)
+inline void _STLP_CALL swap(wstring& __x, wstring& __y)
+{ __x.swap(__y); }
+# endif
+#endif
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _CharT, class _Traits, class _Alloc>
+struct __move_traits<basic_string<_CharT, _Traits, _Alloc> > {
+ typedef __true_type implemented;
+ //Completness depends on the allocator:
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+/*#else
+ * There is no need to specialize for string and wstring in this case
+ * as the default __move_traits will already tell that string is movable
+ * but not complete. We cannot define it as complete as nothing guaranty
+ * that the STLport user hasn't specialized std::allocator for char or
+ * wchar_t.
+ */
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _CharT, class _Traits, class _Alloc>
+void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s,
+ _CharT* __buf, size_t __n);
+
+#if defined(_STLP_USE_WIDE_INTERFACE)
+// A couple of functions to transfer between ASCII/Unicode
+wstring __ASCIIToWide(const char *ascii);
+string __WideToASCII(const wchar_t *wide);
+#endif
+
+inline const char* _STLP_CALL
+__get_c_string(const string& __str) { return __str.c_str(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#include <stl/_string_operators.h>
+
+#if defined(_STLP_USE_NO_IOSTREAMS) || \
+ (defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION))
+# include <stl/_string.c>
+#endif
+
+#endif /* _STLP_INTERNAL_STRING_H */
+
+/*
+ * Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/stlport/stl/_string_base.h b/stlport/stl/_string_base.h
new file mode 100644
index 0000000..7c6d7fe
--- /dev/null
+++ b/stlport/stl/_string_base.h
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_BASE_H
+#define _STLP_STRING_BASE_H
+
+// ------------------------------------------------------------
+// Class _String_base.
+
+// _String_base is a helper class that makes it it easier to write an
+// exception-safe version of basic_string. The constructor allocates,
+// but does not initialize, a block of memory. The destructor
+// deallocates, but does not destroy elements within, a block of
+// memory. The destructor assumes that _M_start either is null, or else
+// points to a block of memory that was allocated using _String_base's
+// allocator and whose size is _M_end_of_storage - _M_start_of_storage._M_data.
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Alloc>
+class _String_base {
+ typedef _String_base<_Tp, _Alloc> _Self;
+protected:
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+public:
+ //dums: Some compiler(MSVC6) require it to be public not simply protected!
+ enum {_DEFAULT_SIZE = 4 * sizeof( void * )};
+ //This is needed by the full move framework
+ typedef _Alloc allocator_type;
+ typedef _STLP_alloc_proxy<_Tp*, _Tp, allocator_type> _AllocProxy;
+ typedef size_t size_type;
+private:
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ union _Buffers {
+ _Tp* _M_end_of_storage;
+ _Tp _M_static_buf[_DEFAULT_SIZE];
+ } _M_buffers;
+#else
+ _Tp* _M_end_of_storage;
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+protected:
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ bool _M_using_static_buf() const
+ { return (_M_start_of_storage._M_data == _M_buffers._M_static_buf); }
+ _Tp const* _M_Start() const { return _M_start_of_storage._M_data; }
+ _Tp* _M_Start() { return _M_start_of_storage._M_data; }
+ _Tp const* _M_End() const
+ { return _M_using_static_buf() ? _M_buffers._M_static_buf + _DEFAULT_SIZE : _M_buffers._M_end_of_storage; }
+ _Tp* _M_End()
+ { return _M_using_static_buf() ? _M_buffers._M_static_buf + _DEFAULT_SIZE : _M_buffers._M_end_of_storage; }
+ size_type _M_capacity() const
+ { return _M_using_static_buf() ? _DEFAULT_SIZE : _M_buffers._M_end_of_storage - _M_start_of_storage._M_data; }
+ size_type _M_rest() const
+ { return _M_using_static_buf() ? _DEFAULT_SIZE - (_M_finish - _M_buffers._M_static_buf) : _M_buffers._M_end_of_storage - _M_finish; }
+#else
+ _Tp const* _M_Start() const { return _M_start_of_storage._M_data; }
+ _Tp* _M_Start() { return _M_start_of_storage._M_data; }
+ _Tp const* _M_End() const { return _M_end_of_storage; }
+ _Tp* _M_End() { return _M_end_of_storage; }
+ size_type _M_capacity() const
+ { return _M_end_of_storage - _M_start_of_storage._M_data; }
+ size_type _M_rest() const
+ { return _M_end_of_storage - _M_finish; }
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+
+ _Tp* _M_finish;
+ _AllocProxy _M_start_of_storage;
+
+ _Tp const* _M_Finish() const {return _M_finish;}
+ _Tp* _M_Finish() {return _M_finish;}
+
+ // Precondition: 0 < __n <= max_size().
+ void _M_allocate_block(size_t __n = _DEFAULT_SIZE);
+ void _M_deallocate_block() {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (!_M_using_static_buf() && (_M_start_of_storage._M_data != 0))
+ _M_start_of_storage.deallocate(_M_start_of_storage._M_data, _M_buffers._M_end_of_storage - _M_start_of_storage._M_data);
+#else
+ if (_M_start_of_storage._M_data != 0)
+ _M_start_of_storage.deallocate(_M_start_of_storage._M_data, _M_end_of_storage - _M_start_of_storage._M_data);
+#endif /* _STLP_USE_SHORT_STRING_OPTIM */
+ }
+
+ size_t max_size() const {
+ const size_type __string_max_size = size_type(-1) / sizeof(_Tp);
+ typename allocator_type::size_type __alloc_max_size = _M_start_of_storage.max_size();
+ return (min)(__alloc_max_size, __string_max_size) - 1;
+ }
+
+ _String_base(const allocator_type& __a)
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ : _M_finish(_M_buffers._M_static_buf), _M_start_of_storage(__a, _M_buffers._M_static_buf)
+#else
+ : _M_end_of_storage(0), _M_finish(0), _M_start_of_storage(__a, (_Tp*)0)
+#endif
+ {}
+
+ _String_base(const allocator_type& __a, size_t __n)
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ : _M_finish(_M_buffers._M_static_buf), _M_start_of_storage(__a, _M_buffers._M_static_buf) {
+#else
+ : _M_end_of_storage(0), _M_finish(0), _M_start_of_storage(__a, (_Tp*)0) {
+#endif
+ _M_allocate_block(__n);
+ }
+
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ void _M_move_src (_Self &src) {
+ if (src._M_using_static_buf()) {
+ _M_buffers = src._M_buffers;
+ _M_finish = _M_buffers._M_static_buf + (src._M_finish - src._M_start_of_storage._M_data);
+ _M_start_of_storage._M_data = _M_buffers._M_static_buf;
+ }
+ else {
+ _M_start_of_storage._M_data = src._M_start_of_storage._M_data;
+ _M_finish = src._M_finish;
+ _M_buffers._M_end_of_storage = src._M_buffers._M_end_of_storage;
+ src._M_start_of_storage._M_data = 0;
+ }
+ }
+#endif
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _String_base(__move_source<_Self> src)
+# if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ : _M_start_of_storage(__move_source<_AllocProxy>(src.get()._M_start_of_storage)) {
+ _M_move_src(src.get());
+# else
+ : _M_end_of_storage(src.get()._M_end_of_storage), _M_finish(src.get()._M_finish),
+ _M_start_of_storage(__move_source<_AllocProxy>(src.get()._M_start_of_storage)) {
+ src.get()._M_start_of_storage._M_data = 0;
+# endif
+ }
+#endif
+
+ ~_String_base() { _M_deallocate_block(); }
+
+ void _M_reset(_Tp *__start, _Tp *__finish, _Tp *__end_of_storage) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ _M_buffers._M_end_of_storage = __end_of_storage;
+#else
+ _M_end_of_storage = __end_of_storage;
+#endif
+ _M_finish = __finish;
+ _M_start_of_storage._M_data = __start;
+ }
+
+ void _M_swap(_Self &__s) {
+#if defined (_STLP_USE_SHORT_STRING_OPTIM)
+ if (_M_using_static_buf()) {
+ if (__s._M_using_static_buf()) {
+ _STLP_STD::swap(_M_buffers, __s._M_buffers);
+ _Tp *__tmp = _M_finish;
+ _M_finish = _M_start_of_storage._M_data + (__s._M_finish - __s._M_start_of_storage._M_data);
+ __s._M_finish = __s._M_buffers._M_static_buf + (__tmp - _M_start_of_storage._M_data);
+ //We need to swap _M_start_of_storage for allocators with state:
+ _M_start_of_storage.swap(__s._M_start_of_storage);
+ _M_start_of_storage._M_data = _M_buffers._M_static_buf;
+ __s._M_start_of_storage._M_data = __s._M_buffers._M_static_buf;
+ } else {
+ __s._M_swap(*this);
+ return;
+ }
+ }
+ else if (__s._M_using_static_buf()) {
+ _Tp *__tmp = _M_start_of_storage._M_data;
+ _Tp *__tmp_finish = _M_finish;
+ _Tp *__tmp_end_data = _M_buffers._M_end_of_storage;
+ _M_buffers = __s._M_buffers;
+ //We need to swap _M_start_of_storage for allocators with state:
+ _M_start_of_storage.swap(__s._M_start_of_storage);
+ _M_start_of_storage._M_data = _M_buffers._M_static_buf;
+ _M_finish = _M_buffers._M_static_buf + (__s._M_finish - __s._M_buffers._M_static_buf);
+ __s._M_buffers._M_end_of_storage = __tmp_end_data;
+ __s._M_start_of_storage._M_data = __tmp;
+ __s._M_finish = __tmp_finish;
+ }
+ else {
+ _STLP_STD::swap(_M_buffers._M_end_of_storage, __s._M_buffers._M_end_of_storage);
+ _M_start_of_storage.swap(__s._M_start_of_storage);
+ _STLP_STD::swap(_M_finish, __s._M_finish);
+ }
+#else
+ _STLP_STD::swap(_M_end_of_storage, __s._M_end_of_storage);
+ _M_start_of_storage.swap(__s._M_start_of_storage);
+ _STLP_STD::swap(_M_finish, __s._M_finish);
+#endif
+ }
+
+ void _STLP_FUNCTION_THROWS _M_throw_length_error() const;
+ void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _String_base<char, allocator<char> >;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS _String_base<wchar_t, allocator<wchar_t> >;
+# endif
+#endif /* _STLP_USE_TEMPLATE_EXPORT */
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_STRING_BASE_H */
+
+/*
+ * Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/stlport/stl/_string_fwd.h b/stlport/stl/_string_fwd.h
new file mode 100644
index 0000000..fe65385
--- /dev/null
+++ b/stlport/stl/_string_fwd.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_FWD_H
+#define _STLP_STRING_FWD_H
+
+#ifndef _STLP_INTERNAL_IOSFWD
+# include <stl/_iosfwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _CharT,
+ class _Traits = char_traits<_CharT>,
+ class _Alloc = allocator<_CharT> >
+class basic_string;
+#else
+template <class _CharT,
+ class _Traits,
+ class _Alloc>
+class basic_string;
+#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
+
+typedef basic_string<char, char_traits<char>, allocator<char> > string;
+
+#if defined (_STLP_HAS_WCHAR_T)
+typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//This function limits header dependency between exception and string
+//implementation. It is implemented in _string.h
+const char* _STLP_CALL __get_c_string(const string& __str);
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_STRING_FWD_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_string_hash.h b/stlport/stl/_string_hash.h
new file mode 100644
index 0000000..87f2d9f
--- /dev/null
+++ b/stlport/stl/_string_hash.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_HASH_H
+#define _STLP_STRING_HASH_H
+
+#ifndef _STLP_HASH_FUN_H
+# include <stl/_hash_fun.h>
+#endif
+
+#ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _CharT, class _Traits, class _Alloc>
+_STLP_INLINE_LOOP size_t
+__stl_string_hash(const basic_string<_CharT,_Traits,_Alloc>& __s) {
+ unsigned long __h = 0;
+ size_t __len = __s.size();
+ const _CharT* __data = __s.data();
+ for ( size_t __i = 0; __i < __len; ++__i)
+ __h = /* 5 *__h */(__h << 2) + __h + __data[__i];
+ return size_t(__h);
+}
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && \
+ (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x560))
+template <class _CharT, class _Traits, class _Alloc>
+struct hash<basic_string<_CharT,_Traits,_Alloc> > {
+ size_t operator()(const basic_string<_CharT,_Traits,_Alloc>& __s) const
+ { return __stl_string_hash(__s); }
+};
+
+#else
+
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC hash<string> {
+ size_t operator()(const string& __s) const
+ { return __stl_string_hash(__s); }
+};
+
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_TEMPLATE_NULL
+struct _STLP_CLASS_DECLSPEC hash<wstring> {
+ size_t operator()(const wstring& __s) const
+ { return __stl_string_hash(__s); }
+};
+# endif
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif
diff --git a/stl/_string_io.c b/stlport/stl/_string_io.c
similarity index 100%
rename from stl/_string_io.c
rename to stlport/stl/_string_io.c
diff --git a/stl/_string_io.h b/stlport/stl/_string_io.h
similarity index 100%
rename from stl/_string_io.h
rename to stlport/stl/_string_io.h
diff --git a/stl/_string_npos.h b/stlport/stl/_string_npos.h
similarity index 100%
rename from stl/_string_npos.h
rename to stlport/stl/_string_npos.h
diff --git a/stl/_string_operators.h b/stlport/stl/_string_operators.h
similarity index 100%
rename from stl/_string_operators.h
rename to stlport/stl/_string_operators.h
diff --git a/stlport/stl/_string_sum.h b/stlport/stl/_string_sum.h
new file mode 100644
index 0000000..739d288
--- /dev/null
+++ b/stlport/stl/_string_sum.h
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING_SUM_H
+#define _STLP_STRING_SUM_H
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*char wrapper to simulate basic_string*/
+template <class _CharT>
+struct __char_wrapper {
+ typedef const _CharT& const_reference;
+
+ __char_wrapper(_CharT __val) : _Val(__val) {}
+
+ _CharT getValue() const { return _Val; }
+ size_t size() const { return 1; }
+
+ const_reference operator[] (size_t __n) const {
+ //To avoid a check on __n we use this strange implementation
+ return (&_Val)[__n];
+ }
+
+private:
+ _CharT _Val;
+};
+
+/*C string wrapper to simulate basic_string*/
+template <class _CharT>
+struct __cstr_wrapper {
+ typedef const _CharT& const_reference;
+
+ __cstr_wrapper(const _CharT *__cstr, size_t __size) :
+ _CStr(__cstr), _Size(__size) {}
+
+ const _CharT* c_str() const { return _CStr; }
+
+ size_t size() const { return _Size; }
+
+ const_reference operator[] (size_t __n) const { return _CStr[__n]; }
+
+private:
+ const _CharT *_CStr;
+ size_t _Size;
+};
+
+/*basic_string wrapper to ensure that we only store a reference to the original string and not copy it*/
+template <class _CharT, class _Traits, class _Alloc>
+struct __bstr_wrapper {
+ typedef const _CharT& const_reference;
+ typedef basic_string<_CharT, _Traits, _Alloc> _BString;
+
+ __bstr_wrapper (_BString const& __s) :
+ _BStr(__s) {}
+
+ size_t size() const { return _BStr.size(); }
+
+ const_reference operator[] (size_t __n) const { return _BStr[__n]; }
+
+ _BString const& b_str() const { return _BStr; }
+
+private:
+ _BString const& _BStr;
+};
+
+struct __on_left {};
+struct __on_right {};
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Left, class _Right,
+ class _StorageDirection>
+class __bstr_sum {
+public:
+ typedef basic_string<_CharT, _Traits, _Alloc> _BString;
+ typedef typename _BString::const_reference const_reference;
+ typedef typename _BString::const_iterator const_iterator;
+ typedef typename _BString::const_reverse_iterator const_reverse_iterator;
+ typedef typename _BString::size_type size_type;
+ typedef typename _BString::allocator_type allocator_type;
+ typedef __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDirection> _Self;
+
+ __bstr_sum (_Left const& lhs, _Right const& rhs) :
+ _lhs(lhs), _rhs(rhs) {}
+
+ _Left const& getLhs() const { return _lhs; }
+ _Right const& getRhs() const { return _rhs; }
+
+ allocator_type get_allocator() const { return _M_get_storage(false).get_allocator(); }
+
+ const_iterator begin() const { return _M_get_storage().begin(); }
+ const_iterator end() const { return _M_get_storage().end(); }
+ const_reverse_iterator rbegin() const { return _M_get_storage().rbegin(); }
+ const_reverse_iterator rend() const { return _M_get_storage().rend(); }
+
+ size_type size() const { return _lhs.size() + _rhs.size(); }
+ size_type length() const { return size(); }
+
+ size_t max_size() const { return _M_get_storage().max_size(); }
+ size_type capacity() const { return size(); }
+ bool empty() const { return size() == 0; }
+
+ const_reference operator[](size_t __n) const
+ { return (__n < _lhs.size())?_lhs[__n]:_rhs[__n - _lhs.size()]; }
+
+ const_reference at(size_type __n) const
+ { return _M_get_storage().at(__n); }
+
+ //operator +=
+ typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __bstr_wrapper<_CharT, _Traits, _Alloc>, __on_left> _BStrOnLeft;
+ _BStrOnLeft operator += (const _BString& __s) { return append(__s); }
+
+ typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __cstr_wrapper<_CharT>, __on_left> _CStrOnLeft;
+ _CStrOnLeft operator += (const _CharT* __s) { return append(__s); }
+
+ typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __char_wrapper<_CharT>, __on_left> _CharOnLeft;
+ _CharOnLeft operator += (_CharT __c) { return _CharOnLeft(*this, __c); }
+
+ //append
+ _BStrOnLeft append (const _BString& __s)
+ { return _BStrOnLeft(*this, __s); }
+ _BString& append(const _BString& __s, size_type __pos, size_type __n)
+ { return _M_get_storage().append(__s, __pos, __n); }
+ _CStrOnLeft append(const _CharT* __s) {
+ const size_type __n = _Traits::length(__s);
+ return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n));
+ }
+ _CStrOnLeft append(const _CharT* __s, size_type __n)
+ { return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n)); }
+ _BString& append(size_type __n, _CharT __c)
+ {return _M_get_storage().append(__n, __c);}
+ template <class _InputIter>
+ _BString& append(_InputIter __first, _InputIter __last)
+ {return _M_get_storage().append(__first, __last);}
+
+ //assign
+ _BString& assign(const _BString& __s) {return _M_get_storage().assign(__s);}
+ _BString& assign(const _BString& __s, size_type __pos, size_type __n) {return _M_get_storage().assign(__s, __pos, __n);}
+ _BString& assign(const _CharT* __s, size_type __n) {return _M_get_storage().assign(__s, __n);}
+ _BString& assign(const _CharT* __s) {return _M_get_storage().assign(__s); }
+ _BString& assign(size_type __n, _CharT __c) {return _M_get_storage().assign(__n, __c);}
+
+ //insert
+ _BString& insert(size_type __pos, const _BString& __s) {return _M_get_storage().insert(__pos, __s);}
+ _BString& insert(size_type __pos, const _BString& __s, size_type __beg, size_type __n)
+ {return _M_get_storage().insert(__pos, __s, __beg, __n);}
+ _BString& insert(size_type __pos, const _CharT* __s, size_type __n) {return _M_get_storage().insert(__pos, __s, __n);}
+ _BString& insert(size_type __pos, const _CharT* __s) {return _M_get_storage().insert(__pos, __s);}
+ _BString& insert(size_type __pos, size_type __n, _CharT __c) {return _M_get_storage().insert(__pos, __n, __c);}
+
+ //erase
+ _BString& erase(size_type __pos = 0, size_type __n =_BString::npos) {return _M_get_storage().erase(__pos, __n);}
+
+ //replace
+ _BString& replace(size_type __pos, size_type __n, const _BString& __s)
+ {return _M_get_storage().replace(__pos, __n, __s);}
+ _BString& replace(size_type __pos1, size_type __n1, const _BString& __s, size_type __pos2, size_type __n2)
+ {return _M_get_storage().replace(__pos1, __n1, __s, __pos2, __n2);}
+ _BString& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2)
+ {return _M_get_storage().replace(__pos, __n1, __s, __n2);}
+ _BString& replace(size_type __pos, size_type __n1, const _CharT* __s)
+ {return _M_get_storage().replace(__pos, __n1, __s);}
+ _BString& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
+ {return _M_get_storage().replace(__pos, __n1, __n2, __c);}
+
+ size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
+ {return _M_get_storage().copy(__s, __n, __pos);}
+
+ void swap(_BString& __s)
+ {_M_get_storage().swap(__s);}
+
+ const _CharT* c_str() const { return _M_get_storage().c_str(); }
+ const _CharT* data() const { return _M_get_storage().data(); }
+
+ //find family
+ size_type find(const _BString& __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); }
+ size_type find(const _CharT* __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); }
+ size_type find(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().find(__s, __pos, __n); }
+ size_type find(_CharT __c, size_type __pos = 0) const { return _M_get_storage().find(__c, __pos); }
+
+ size_type rfind(const _BString& __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); }
+ size_type rfind(const _CharT* __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); }
+ size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().rfind(__s, __pos, __n); }
+ size_type rfind(_CharT __c, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__c, __pos); }
+
+ size_type find_first_of(const _BString& __s, size_type __pos = 0) const
+ { return _M_get_storage().find_first_of(__s, __pos); }
+ size_type find_first_of(const _CharT* __s, size_type __pos = 0) const
+ { return _M_get_storage().find_first_of(__s, __pos); }
+ size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
+ { return _M_get_storage().find_first_of(__s, __pos, __n); }
+ size_type find_first_of(_CharT __c, size_type __pos = 0) const
+ { return _M_get_storage().find(__c, __pos); }
+
+ size_type find_last_of(const _BString& __s, size_type __pos = _BString::npos) const
+ { return _M_get_storage().find_last_of(__s, __pos); }
+ size_type find_last_of(const _CharT* __s, size_type __pos = _BString::npos) const
+ { return _M_get_storage().find_last_of(__s, __pos); }
+ size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
+ { return _M_get_storage().find_last_of(__s, __pos, __n); }
+ size_type find_last_of(_CharT __c, size_type __pos = _BString::npos) const
+ { return _M_get_storage().rfind(__c, __pos); }
+
+ size_type find_first_not_of(const _BString& __s, size_type __pos = 0) const
+ { return _M_get_storage().find_first_not_of(__s, __pos); }
+ size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const
+ { return _M_get_storage().find_first_not_of(__s, __pos); }
+ size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ { return _M_get_storage().find_first_not_of(__s, __pos, __n); }
+ size_type find_first_not_of(_CharT __c, size_type __pos = 0) const
+ { return _M_get_storage().find_first_not_of(__c, __pos); }
+
+ size_type find_last_not_of(const _BString& __s, size_type __pos = _BString::npos) const
+ { return _M_get_storage().find_last_not_of(__s, __pos); }
+ size_type find_last_not_of(const _CharT* __s, size_type __pos =_BString:: npos) const
+ { return _M_get_storage().find_last_not_of(__s, __pos); }
+ size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ { return _M_get_storage().find_last_not_of(__s, __pos, __n); }
+ size_type find_last_not_of(_CharT __c, size_type __pos = _BString::npos) const
+ { return _M_get_storage().find_last_not_of(__c, __pos); }
+
+ _BString substr(size_type __pos = 0, size_type __n = _BString::npos) const
+ { return _M_get_storage().substr(__pos, __n); }
+
+ //compare
+ int compare(const _BString& __s) const
+ { return _M_get_storage().compare(__s); }
+ int compare(size_type __pos1, size_type __n1, const _Self& __s) const
+ { return _M_get_storage().compare(__pos1, __n1, __s); }
+ int compare(size_type __pos1, size_type __n1, const _Self& __s, size_type __pos2, size_type __n2) const
+ { return _M_get_storage().compare(__pos1, __n1, __s, __pos2, __n2); }
+ int compare(const _CharT* __s) const
+ { return _M_get_storage().compare(__s); }
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
+ { return _M_get_storage().compare(__pos1, __n1, __s); }
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
+ { return _M_get_storage().compare(__pos1, __n1, __s, __n2); }
+
+ //Returns the underlying basic_string representation of the template expression
+ //The non const method will always initialise it.
+ _BString& _M_get_storage()
+ { return _rhs._M_get_storage(*this, _StorageDirection()); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ __on_left const& /*StorageDir*/)
+ { return _lhs._M_get_storage(__ref); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ __on_right const& /*StorageDir*/)
+ { return _rhs._M_get_storage(__ref); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref)
+ { return _M_get_storage(__ref, _StorageDirection()); }
+
+ //The const method can be invoked without initialising the basic_string so avoiding dynamic allocation.
+ _BString const& _M_get_storage(bool __do_init = true) const
+ { return _M_get_storage(*this, __do_init, _StorageDirection()); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ bool __do_init, __on_left const& /*StorageDir*/) const
+ { return _lhs._M_get_storage(__ref, __do_init); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ bool __do_init, __on_right const& /*StorageDir*/) const
+ { return _rhs._M_get_storage(__ref, __do_init); }
+
+ template <class _Lhs, class _Rhs, class _StorageDir>
+ _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref,
+ bool __do_init) const
+ { return _M_get_storage(__ref, __do_init, _StorageDirection()); }
+
+private:
+ _Left _lhs;
+ _Right _rhs;
+};
+
+/*
+ * For this operator we choose to use the right part as the storage part
+ */
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline __bstr_sum<_CharT, _Traits, _Alloc,
+ __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>,
+ __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>,
+ __on_right> _STLP_CALL
+operator + (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) {
+ return __bstr_sum<_CharT, _Traits, _Alloc,
+ __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>,
+ __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>,
+ __on_right>(__lhs, __rhs);
+}
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator == (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return (__lhs.size() == __rhs.size()) && (__lhs._M_get_storage() == __rhs._M_get_storage()); }
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator < (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return __lhs._M_get_storage() < __rhs._M_get_storage(); }
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator != (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return !(__lhs == __rhs); }
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator > (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return __rhs < __lhs; }
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator <= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return !(__rhs < __lhs); }
+
+template <class _CharT, class _Traits, class _Alloc,
+ class _Lh1, class _Rh1, class _StoreDir1,
+ class _Lh2, class _Rh2, class _StoreDir2>
+inline bool _STLP_CALL
+operator >= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs,
+ const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs)
+{ return !(__lhs < __rhs); }
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+
+
+/*
+ * This class will be used to simulate a temporary string that is required for
+ * a call to the c_str method on the __bstr_sum class.
+ */
+
+template <class _CharT, class _Traits, class _Alloc>
+struct __sum_storage_elem {
+ typedef __sum_storage_elem<_CharT, _Traits, _Alloc> _Self;
+ typedef basic_string<_CharT, _Traits, _Alloc> _BString;
+
+ __sum_storage_elem(_Alloc __alloc) : _M_init(false), _M_storage(__alloc)
+ {}
+
+ template <class _Left, class _Right, class _StorageDir>
+ void _M_Init(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref) const {
+ if (!_M_init) {
+ _STLP_MUTABLE(_Self, _M_storage) = __ref;
+ _STLP_MUTABLE(_Self, _M_init) = true;
+ }
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref,
+ bool __do_init) const {
+ if (__do_init) {
+ _M_Init(__ref);
+ }
+ return _M_storage;
+ }
+ template <class _Left, class _Right, class _StorageDir>
+ _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref) {
+ _M_Init(__ref);
+ return _M_storage;
+ }
+
+ size_t size() const { return 0; }
+ _CharT const& operator[](size_t __n) const
+ { return __STATIC_CAST(_CharT*, 0)[__n]; }
+
+private:
+ mutable bool _M_init;
+ mutable basic_string<_CharT, _Traits, _Alloc> _M_storage;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /*_STLP_STRING_SUM_H*/
diff --git a/stlport/stl/_string_sum_methods.h b/stlport/stl/_string_sum_methods.h
new file mode 100644
index 0000000..305608e
--- /dev/null
+++ b/stlport/stl/_string_sum_methods.h
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * All the necessary methods used for template expressions with basic_string
+ * This file do not have to be macro guarded as it is only used in the _string.h
+ * file and it is a part of the basic_string definition.
+ */
+
+public:
+ template <class _Left, class _Right, class _StorageDir>
+ basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s)
+ : _STLP_STRING_SUM_BASE(_Reserve_t(), __s.size(), __s.get_allocator())
+ { _M_append_sum(__s); }
+
+ template <class _Left, class _Right, class _StorageDir>
+ basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+ : _STLP_STRING_SUM_BASE(_Reserve_t(), (__pos <= __s.size()) ? ((min) (__n, __s.size() - __pos)) : 0, __a) {
+ size_type __size = __s.size();
+ if (__pos > __size)
+ this->_M_throw_out_of_range();
+ else
+ _M_append_sum_pos(__s, __pos, (min) (__n, __size - __pos));
+ }
+
+private:
+ _CharT* _M_append_fast(_STLP_PRIV __char_wrapper<_CharT> __c, _CharT *__buf) {
+ _STLP_STD::_Copy_Construct(__buf, __c.getValue());
+ return __buf + 1;
+ }
+ _CharT* _M_append_fast(_CharT const* __s, size_type __s_size, _CharT *__buf)
+ { return uninitialized_copy(__s, __s + __s_size, __buf); }
+ _CharT* _M_append_fast(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf)
+ { return _M_append_fast(__s.c_str(), __s.size(), __buf); }
+ _CharT* _M_append_fast(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _CharT *__buf)
+ { return _M_append_fast(__s.b_str(), __buf); }
+ _CharT* _M_append_fast(_Self const& __s, _CharT *__buf)
+ { return _M_append_fast(__s.data(), __s.size(), __buf); }
+ _CharT* _M_append_fast(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _CharT *__buf)
+ { return __buf; }
+ template <class _Left, class _Right, class _StorageDir>
+ _CharT* _M_append_fast(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, _CharT *__buf)
+ { return _M_append_fast(__s.getRhs(), _M_append_fast(__s.getLhs(), __buf)); }
+
+ _CharT* _M_append_fast_pos(_STLP_PRIV __char_wrapper<_CharT> __c, _CharT *__buf, size_type /*__pos*/, size_type __n) {
+ if (__n == 0)
+ return __buf;
+ _STLP_STD::_Copy_Construct(__buf, __c.getValue());
+ return __buf + 1;
+ }
+ _CharT* _M_append_fast_pos(_CharT const* __s, size_type __s_size, _CharT *__buf,
+ size_type __pos, size_type __n)
+ { return uninitialized_copy(__s + __pos, __s + __pos + (min)(__n, __s_size - __pos), __buf); }
+ _CharT* _M_append_fast_pos(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.c_str(), __s.size(), __buf, __pos, __n); }
+ _CharT* _M_append_fast_pos(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _CharT *__buf,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.b_str(), __buf, __pos, __n); }
+ _CharT* _M_append_fast_pos(_Self const& __s, _CharT *__buf,
+ size_type __pos, size_type __n)
+ { return _M_append_fast_pos(__s.data(), __s.size(), __buf, __pos, __n); }
+ _CharT* _M_append_fast_pos(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _CharT *__buf,
+ size_type, size_type)
+ { return __buf; }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _CharT* _M_append_fast_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ _CharT *__buf, size_type __pos, size_type __n) {
+ if (__n == 0) {
+ return __buf;
+ }
+ size_type __lhs_size = __s.getLhs().size();
+ if (__pos < __lhs_size) {
+ if (__n < (__lhs_size - __pos)) {
+ return _M_append_fast_pos(__s.getLhs(), __buf, __pos, __n);
+ } else {
+ return _M_append_fast_pos(__s.getRhs(), _M_append_fast_pos(__s.getLhs(), __buf, __pos, __n),
+ 0, __n - (__lhs_size - __pos));
+ }
+ } else {
+ return _M_append_fast_pos(__s.getRhs(), __buf, __pos - __lhs_size, __n);
+ }
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _Self& _M_append_sum (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s) {
+ size_type __s_size = __s.size();
+ if (__s_size == 0)
+ return *this;
+ const size_type __old_size = this->size();
+ if (__s_size > this->max_size() || __old_size > (this->max_size() - __s_size))
+ this->_M_throw_length_error();
+ if (__old_size + __s_size > this->capacity()) {
+ const size_type __len = __old_size + (max)(__old_size, __s_size) + 1;
+ pointer __new_start = this->_M_start_of_storage.allocate(__len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = this->_M_append_fast(__s, __new_finish);
+ this->_M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _M_append_sum_no_overflow(__s, 0, __s_size);
+ }
+ return *this;
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ _Self& _M_append_sum_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n) {
+ size_type __s_size = (min)(__s.size() - __pos, __n);
+ if (__s_size == 0)
+ return *this;
+ const size_type __old_size = this->size();
+ if (__s_size > this->max_size() || __old_size > (this->max_size() - __s_size))
+ this->_M_throw_length_error();
+ if (__old_size + __s_size > this->capacity()) {
+ const size_type __len = __old_size + (max)(__old_size, __s_size) + 1;
+ pointer __new_start = this->_M_start_of_storage.allocate(__len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = _M_append_fast_pos(__s, __new_finish, __pos, __s_size);
+ this->_M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _M_append_sum_no_overflow(__s, __pos, __s_size);
+ }
+ return *this;
+ }
+
+ template <class _Left, class _Right, class _StorageDir>
+ void _M_append_sum_no_overflow(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s,
+ size_type __pos, size_type __n) {
+ pointer __finish = this->_M_Finish();
+ _M_append_fast_pos(__s, __finish + 1, __pos + 1, __n - 1);
+ this->_M_construct_null(__finish + __n);
+ _Traits::assign(*this->_M_finish, __s[__pos]);
+ this->_M_finish += __n;
+ }
diff --git a/stlport/stl/_string_workaround.h b/stlport/stl/_string_workaround.h
new file mode 100644
index 0000000..d77e320
--- /dev/null
+++ b/stlport/stl/_string_workaround.h
@@ -0,0 +1,599 @@
+/*
+ * Copyright (c) 2004
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+//Included from _string.h, no need for macro guarding.
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG)
+# define basic_string _STLP_NON_DBG_NAME(str)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+#define _STLP_NO_MEM_T_STRING_BASE _STLP_PRIV _STLP_NO_MEM_T_NAME(str)<_CharT, _Traits, _Alloc>
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_string : public _STLP_NO_MEM_T_STRING_BASE
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string)
+ , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
+#endif
+{
+private: // Protected members inherited from base.
+ typedef basic_string<_CharT, _Traits, _Alloc> _Self;
+ typedef _STLP_NO_MEM_T_STRING_BASE _Base;
+ typedef typename _Base::_CalledFromWorkaround_t _CalledFromWorkaround_t;
+public:
+
+ __IMPORT_WITH_REVERSE_ITERATORS(_Base)
+
+ typedef typename _Base::_Iterator_category _Iterator_category;
+ typedef typename _Base::traits_type traits_type;
+ typedef typename _Base::_Reserve_t _Reserve_t;
+
+#include <stl/_string_npos.h>
+
+public: // Constructor, destructor, assignment.
+ explicit basic_string(const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__a) {}
+
+ basic_string(_Reserve_t __r, size_t __n,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__r, __n, __a) {}
+
+ basic_string(const _Self& __s)
+ : _STLP_NO_MEM_T_STRING_BASE(__s) {}
+
+ basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__s, __pos, __n, __a) {}
+
+ basic_string(const _CharT* __s, size_type __n,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__s, __n, __a) {}
+
+ basic_string(const _CharT* __s,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__s, __a) {}
+
+ basic_string(size_type __n, _CharT __c,
+ const allocator_type& __a = allocator_type())
+ : _STLP_NO_MEM_T_STRING_BASE(__n, __c, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ basic_string(__move_source<_Self> src)
+ : _STLP_NO_MEM_T_STRING_BASE(__move_source<_Base>(src.get())) {}
+#endif
+
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l,
+ const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _STLP_NO_MEM_T_STRING_BASE(_CalledFromWorkaround_t(), __a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__f, __l, _Integral());
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l)
+ : _STLP_NO_MEM_T_STRING_BASE(_CalledFromWorkaround_t(), allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_dispatch(__f, __l, _Integral());
+ }
+# endif
+
+ _Self& operator=(const _Self& __s) {
+ _Base::operator=(__s);
+ return *this;
+ }
+
+ _Self& operator=(const _CharT* __s) {
+ _Base::operator=(__s);
+ return *this;
+ }
+
+ _Self& operator=(_CharT __c) {
+ _Base::operator=(__c);
+ return *this;
+ }
+
+private:
+ template <class _InputIter>
+ void _M_range_initialize(_InputIter __f, _InputIter __l,
+ const input_iterator_tag &__tag) {
+ this->_M_allocate_block();
+ this->_M_construct_null(this->_M_Finish());
+ _M_appendT(__f, __l, __tag);
+ }
+
+ template <class _ForwardIter>
+ void _M_range_initialize(_ForwardIter __f, _ForwardIter __l,
+ const forward_iterator_tag &) {
+ difference_type __n = _STLP_STD::distance(__f, __l);
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start());
+ this->_M_terminate_string();
+ }
+
+ template <class _InputIter>
+ void _M_range_initializeT(_InputIter __f, _InputIter __l) {
+ _M_range_initialize(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
+ }
+
+ template <class _Integer>
+ void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) {
+ this->_M_allocate_block(__n + 1);
+ this->_M_finish = uninitialized_fill_n(this->_M_Start(), __n, __x);
+ this->_M_terminate_string();
+ }
+
+ template <class _InputIter>
+ void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
+ _M_range_initializeT(__f, __l);
+ }
+
+public: // Append, operator+=, push_back.
+ _Self& operator+=(const _Self& __s) {
+ _Base::operator+=(__s);
+ return *this;
+ }
+ _Self& operator+=(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::operator+=(__s);
+ return *this;
+ }
+ _Self& operator+=(_CharT __c) {
+ _Base::operator+=(__c);
+ return *this;
+ }
+
+ _Self& append(const _Self& __s) {
+ _Base::append(__s);
+ return *this;
+ }
+
+ _Self& append(const _Self& __s,
+ size_type __pos, size_type __n) {
+ _Base::append(__s, __pos, __n);
+ return *this;
+ }
+
+ _Self& append(const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::append(__s, __n);
+ return *this;
+ }
+ _Self& append(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::append(__s);
+ return *this;
+ }
+ _Self& append(size_type __n, _CharT __c) {
+ _Base::append(__n, __c);
+ return *this;
+ }
+
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& append(_InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_append_dispatch(__first, __last, _Integral());
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ //See equivalent assign method remark.
+ _Self& append(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _Base::append(__f, __l);
+ return *this;
+ }
+#endif
+
+private: // Helper functions for append.
+
+ template <class _InputIter>
+ _Self& _M_appendT(_InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last ; ++__first)
+ _Base::push_back(*__first);
+ return *this;
+ }
+
+ template <class _ForwardIter>
+ _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ const size_type __n = __STATIC_CAST(size_type, _STLP_STD::distance(__first, __last));
+ if (__n >= this->_M_rest()) {
+ size_type __len = this->_M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ this->_M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+ else {
+ _Traits::assign(*this->_M_finish, *__first++);
+ uninitialized_copy(__first, __last, this->_M_Finish() + 1);
+ this->_M_construct_null(this->_M_Finish() + __n);
+ this->_M_finish += __n;
+ }
+ }
+ return *this;
+ }
+
+ template <class _Integer>
+ _Self& _M_append_dispatch(_Integer __n, _Integer __x, const __true_type& /*Integral*/)
+ { return append((size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ _Self& _M_append_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*Integral*/)
+ { return _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); }
+
+public: // Assign
+ _Self& assign(const _Self& __s) {
+ _Base::assign(__s);
+ return *this;
+ }
+
+ _Self& assign(const _Self& __s,
+ size_type __pos, size_type __n) {
+ _Base::assign(__s, __pos, __n);
+ return *this;
+ }
+
+ _Self& assign(const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::assign(__s, __n);
+ return *this;
+ }
+
+ _Self& assign(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::assign(__s);
+ return *this;
+ }
+
+ _Self& assign(size_type __n, _CharT __c) {
+ _Base::assign(__n, __c);
+ return *this;
+ }
+
+private: // Helper functions for assign.
+
+ template <class _Integer>
+ _Self& _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/)
+ { return assign((size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ _Self& _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
+ pointer __cur = this->_M_Start();
+ while (__f != __l && __cur != this->_M_Finish()) {
+ _Traits::assign(*__cur, *__f);
+ ++__f;
+ ++__cur;
+ }
+ if (__f == __l)
+ _Base::erase(__cur, this->_M_Finish());
+ else
+ _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
+ return *this;
+ }
+
+public:
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& assign(_InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ /* This method is not part of the standard and is a specialization of the
+ * template method assign. It is only granted for convenience to call assign
+ * with mixed parameters iterator and const_iterator.
+ */
+ _Self& assign(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _Base::assign(__f, __l);
+ return *this;
+ }
+#endif
+
+public: // Insert
+ _Self& insert(size_type __pos, const _Self& __s) {
+ _Base::insert(__pos, __s);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _Self& __s,
+ size_type __beg, size_type __n) {
+ _Base::insert(__pos, __s, __beg, __n);
+ return *this;
+ }
+ _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::insert(__pos, __s, __n);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::insert(__pos, __s);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, size_type __n, _CharT __c) {
+ _Base::insert(__pos, __n, __c);
+ return *this;
+ }
+
+ iterator insert(iterator __p, _CharT __c)
+ { return _Base::insert(__p, __c); }
+
+ void insert(iterator __p, size_t __n, _CharT __c)
+ { _Base::insert(__p, __n, __c); }
+
+ // Check to see if _InputIterator is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ void insert(iterator __p, _InputIter __first, _InputIter __last) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ _M_insert_dispatch(__p, __first, __last, _Integral());
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION)
+public:
+ void insert(iterator __p, const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _M_insert(__p, __f, __l, this->_M_inside(__f));
+ }
+#endif
+
+private: // Helper functions for insert.
+ void _M_insert(iterator __p, const _CharT* __f, const _CharT* __l, bool __self_ref) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _Base::_M_insert(__p, __f, __l, __self_ref);
+ }
+
+ template <class _ForwardIter>
+ void _M_insert_overflow(iterator __pos, _ForwardIter __first, _ForwardIter __last,
+ size_type __n) {
+ size_type __len = this->_M_compute_next_size(__n);
+ pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
+ pointer __new_finish = uninitialized_copy(this->_M_Start(), __pos, __new_start);
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ __new_finish = uninitialized_copy(__pos, this->_M_Finish(), __new_finish);
+ this->_M_construct_null(__new_finish);
+ this->_M_deallocate_block();
+ this->_M_reset(__new_start, __new_finish, __new_start + __len);
+ }
+
+ template <class _InputIter>
+ void _M_insertT(iterator __p, _InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first) {
+ __p = insert(__p, *__first);
+ ++__p;
+ }
+ }
+
+ template <class _ForwardIter>
+ void _M_insertT(iterator __pos, _ForwardIter __first, _ForwardIter __last,
+ const forward_iterator_tag &) {
+ if (__first != __last) {
+ size_type __n = __STATIC_CAST(size_type, _STLP_STD::distance(__first, __last));
+ if (__n < this->_M_rest()) {
+ const size_type __elems_after = this->_M_finish - __pos;
+ if (__elems_after >= __n) {
+ uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
+ this->_M_finish += __n;
+ _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
+ _M_copyT(__first, __last, __pos);
+ }
+ else {
+ pointer __old_finish = this->_M_Finish();
+ _ForwardIter __mid = __first;
+ _STLP_STD::advance(__mid, __elems_after + 1);
+ _STLP_STD::uninitialized_copy(__mid, __last, this->_M_Finish() + 1);
+ this->_M_finish += __n - __elems_after;
+ uninitialized_copy(__pos, __old_finish + 1, this->_M_Finish());
+ this->_M_finish += __elems_after;
+ _M_copyT(__first, __mid, __pos);
+ }
+ }
+ else {
+ _M_insert_overflow(__pos, __first, __last, __n);
+ }
+ }
+ }
+
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x,
+ const __true_type& /*Integral*/)
+ { insert(__p, (size_type) __n, (_CharT) __x); }
+
+ template <class _InputIter>
+ void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last,
+ const __false_type& /*Integral*/) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ /* We are forced to do a temporary string to avoid the self referencing issue. */
+ const _Self __self(__first, __last, this->get_allocator());
+ _M_insertT(__p, __self.begin(), __self.end(), _STLP_ITERATOR_CATEGORY(__first, _InputIter));
+ }
+
+ template <class _InputIterator>
+ void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) {
+ _STLP_FIX_LITERAL_BUG(__p)
+ for ( ; __first != __last; ++__first, ++__result)
+ _Traits::assign(*__result, *__first);
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ void _M_copyT(const _CharT* __f, const _CharT* __l, _CharT* __res) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) _STLP_FIX_LITERAL_BUG(__res)
+ _Base::_M_copy(__f, __l, __res);
+ }
+#endif
+
+public: // Erase.
+ _Self& erase(size_type __pos = 0, size_type __n = npos) {
+ _Base::erase(__pos, __n);
+ return *this;
+ }
+
+ iterator erase(iterator __pos) {
+ _STLP_FIX_LITERAL_BUG(__pos)
+ return _Base::erase(__pos);
+ }
+
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ return _Base::erase(__first, __last);
+ }
+
+public: // Replace. (Conceptually equivalent
+ // to erase followed by insert.)
+ _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
+ _Base::replace(__pos, __n, __s);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) {
+ _Base::replace(__pos1, __n1, __s, __pos2, __n2);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ const _CharT* __s, size_type __n2) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::replace(__pos, __n1, __s, __n2);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::replace(__pos, __n1, __s);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1,
+ size_type __n2, _CharT __c) {
+ _Base::replace(__pos, __n1, __n2, __c);
+ return *this;
+ }
+
+ _Self& replace(iterator __first, iterator __last, const _Self& __s) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _Base::replace(__first, __last, __s);
+ return *this;
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::replace(__first, __last, __s, __n);
+ return *this;
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__s)
+ _Base::replace(__first, __last, __s);
+ return *this;
+ }
+
+ _Self& replace(iterator __first, iterator __last,
+ size_type __n, _CharT __c) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _Base::replace(__first, __last, __n, __c);
+ return *this;
+ }
+
+ // Check to see if _InputIter is an integer type. If so, then
+ // it can't be an iterator.
+ template <class _InputIter>
+ _Self& replace(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l) {
+ _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ return _M_replace_dispatch(__first, __last, __f, __l, _Integral());
+ }
+
+#if !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ return _M_replace(__first, __last, __f, __l, this->_M_inside(__f));
+ }
+#endif
+
+private: // Helper functions for replace.
+ _Self& _M_replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l, bool __self_ref) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _Base::_M_replace(__first, __last, __f, __l, __self_ref);
+ return *this;
+ }
+
+ template <class _Integer>
+ _Self& _M_replace_dispatch(iterator __first, iterator __last,
+ _Integer __n, _Integer __x, const __true_type& /*IsIntegral*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ return replace(__first, __last, (size_type) __n, (_CharT) __x);
+ }
+
+ template <class _InputIter>
+ _Self& _M_replace_dispatch(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l, const __false_type& /*IsIntegral*/) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ /* We are forced to do a temporary string to avoid the self referencing issue. */
+ const _Self __self(__f, __l, this->get_allocator());
+ return _M_replace(__first, __last, __self._M_Start(), __self._M_Finish(), false);
+ }
+
+public: // Other modifier member functions.
+ void swap(_Self& __s) { _Base::swap(__s); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public: // Substring.
+ _Self substr(size_type __pos = 0, size_type __n = npos) const
+ { return _Self(*this, __pos, __n, this->get_allocator()); }
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG)
+# define _STLP_STRING_SUM_BASE _STLP_NO_MEM_T_STRING_BASE
+# include <stl/_string_sum_methods.h>
+# undef _STLP_STRING_SUM_BASE
+#endif
+};
+
+#undef _STLP_NO_MEM_T_STRING_BASE
+
+#if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+# undef basic_string
+#endif
+
+_STLP_END_NAMESPACE
diff --git a/stl/_strstream.h b/stlport/stl/_strstream.h
similarity index 100%
rename from stl/_strstream.h
rename to stlport/stl/_strstream.h
diff --git a/stl/_tempbuf.c b/stlport/stl/_tempbuf.c
similarity index 100%
rename from stl/_tempbuf.c
rename to stlport/stl/_tempbuf.c
diff --git a/stlport/stl/_tempbuf.h b/stlport/stl/_tempbuf.h
new file mode 100644
index 0000000..0e0a747
--- /dev/null
+++ b/stlport/stl/_tempbuf.h
@@ -0,0 +1,167 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_TEMPBUF_H
+#define _STLP_INTERNAL_TEMPBUF_H
+
+#ifndef _STLP_CLIMITS
+# include <climits>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+pair<_Tp*, ptrdiff_t> _STLP_CALL
+__get_temporary_buffer(ptrdiff_t __len, _Tp*);
+
+#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+
+template <class _Tp>
+inline pair<_Tp*, ptrdiff_t> _STLP_CALL get_temporary_buffer(ptrdiff_t __len) {
+ return __get_temporary_buffer(__len, (_Tp*) 0);
+}
+
+# if ! defined(_STLP_NO_EXTENSIONS)
+// This overload is not required by the standard; it is an extension.
+// It is supported for backward compatibility with the HP STL, and
+// because not all compilers support the language feature (explicit
+// function template arguments) that is required for the standard
+// version of get_temporary_buffer.
+template <class _Tp>
+inline pair<_Tp*, ptrdiff_t> _STLP_CALL
+get_temporary_buffer(ptrdiff_t __len, _Tp*) {
+ return __get_temporary_buffer(__len, (_Tp*) 0);
+}
+# endif
+#endif
+
+template <class _Tp>
+inline void _STLP_CALL return_temporary_buffer(_Tp* __p) {
+// SunPro brain damage
+ free((char*)__p);
+}
+
+template <class _ForwardIterator, class _Tp>
+class _Temporary_buffer {
+private:
+ ptrdiff_t _M_original_len;
+ ptrdiff_t _M_len;
+ _Tp* _M_buffer;
+
+ void _M_allocate_buffer() {
+ _M_original_len = _M_len;
+ _M_buffer = 0;
+
+ if (_M_len > (ptrdiff_t)(INT_MAX / sizeof(_Tp)))
+ _M_len = INT_MAX / sizeof(_Tp);
+
+ while (_M_len > 0) {
+ _M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp));
+ if (_M_buffer)
+ break;
+ _M_len /= 2;
+ }
+ }
+
+ void _M_initialize_buffer(const _Tp&, const __true_type&) {}
+ void _M_initialize_buffer(const _Tp& val, const __false_type&) {
+ uninitialized_fill_n(_M_buffer, _M_len, val);
+ }
+
+public:
+ ptrdiff_t size() const { return _M_len; }
+ ptrdiff_t requested_size() const { return _M_original_len; }
+ _Tp* begin() { return _M_buffer; }
+ _Tp* end() { return _M_buffer + _M_len; }
+
+ _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) {
+ // Workaround for a __type_traits bug in the pre-7.3 compiler.
+# if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION < 730
+ typedef typename __type_traits<_Tp>::is_POD_type _Trivial;
+# else
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Trivial;
+# endif
+ _STLP_TRY {
+ _M_len = _STLP_STD::distance(__first, __last);
+ _M_allocate_buffer();
+ if (_M_len > 0)
+ _M_initialize_buffer(*__first, _Trivial());
+ }
+ _STLP_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0)
+ }
+
+ ~_Temporary_buffer() {
+ _STLP_STD::_Destroy_Range(_M_buffer, _M_buffer + _M_len);
+ free(_M_buffer);
+ }
+
+private:
+ // Disable copy constructor and assignment operator.
+ _Temporary_buffer(const _Temporary_buffer<_ForwardIterator, _Tp>&) {}
+ void operator=(const _Temporary_buffer<_ForwardIterator, _Tp>&) {}
+};
+
+# ifndef _STLP_NO_EXTENSIONS
+
+// Class temporary_buffer is not part of the standard. It is an extension.
+
+template <class _ForwardIterator,
+ class _Tp
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ = typename iterator_traits<_ForwardIterator>::value_type
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+ >
+struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp>
+{
+ temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
+ : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) {}
+ ~temporary_buffer() {}
+};
+
+# endif /* _STLP_NO_EXTENSIONS */
+
+_STLP_END_NAMESPACE
+
+# ifndef _STLP_LINK_TIME_INSTANTIATION
+# include <stl/_tempbuf.c>
+# endif
+
+#endif /* _STLP_INTERNAL_TEMPBUF_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_threads.c b/stlport/stl/_threads.c
new file mode 100644
index 0000000..ea3c0b9
--- /dev/null
+++ b/stlport/stl/_threads.c
@@ -0,0 +1,167 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_THREADS_C
+#define _STLP_THREADS_C
+
+#ifndef _STLP_INTERNAL_THREADS_H
+# include <stl/_threads.h>
+#endif
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+#if defined (_STLP_SGI_THREADS)
+# include <time.h>
+#elif defined (_STLP_UNIX)
+# ifndef _STLP_INTERNAL_CTIME
+# include <stl/_ctime.h>
+# endif
+# if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_VENDOR_GLOBAL_CSTD)
+using _STLP_VENDOR_CSTD::time_t;
+# endif
+# include <sys/time.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+template<int __32bits>
+_STLP_STATIC_MUTEX
+_Atomic_swap_struct<__32bits>::_S_swap_lock _STLP_MUTEX_INITIALIZER;
+# undef _STLP_USE_ATOMIC_SWAP_MUTEX
+#endif
+
+#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
+template <int __inst>
+unsigned _STLP_mutex_spin<__inst>::__max = _STLP_mutex_spin<__inst>::__low_max;
+
+template <int __inst>
+unsigned _STLP_mutex_spin<__inst>::__last = 0;
+#endif // _STLP_USE_PTHREAD_SPINLOCK
+
+#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
+
+# if defined (_STLP_SPARC_SOLARIS_THREADS)
+// underground function in libc.so; we do not want dependance on librt
+extern "C" int __nanosleep(const struct timespec*, struct timespec*);
+# define _STLP_NANOSLEEP __nanosleep
+# else
+# define _STLP_NANOSLEEP nanosleep
+# endif
+
+template <int __inst>
+void _STLP_CALL
+_STLP_mutex_spin<__inst>::_S_nsec_sleep(int __log_nsec, unsigned int& __iteration) {
+# if defined (_STLP_WIN32THREADS)
+# if defined (_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
+ if (__iteration <= 4000) {
+ // Use SwitchToThread because
+ // 1) Sleep(1) often takes ~15 ms
+ // 2) SwitchToThread yields to lower-priority threads
+ // 4000 is enough to avoid Sleep and is used just to prevent infinite looping
+ // This number is advised spin count for Heap management by Microsoft
+ SwitchToThread();
+ } else {
+# endif
+ if (__log_nsec <= 21) {
+ /* Note from boost (www.boost.org):
+ * Changed from Sleep(0) to Sleep(1).
+ * According to MSDN, Sleep(0) will never yield to a lower-priority thread,
+ * whereas Sleep(1) will. Performance seems not to be affected. */
+ Sleep(1);
+ } else {
+ Sleep(1 << (__log_nsec - 20));
+ }
+# if defined (_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
+ __iteration = 0; //reset to avoid sleeps sequence
+ }
+# endif
+# elif defined(_STLP_OS2THREADS)
+ if (__log_nsec <= 20) {
+ DosSleep(0);
+ } else {
+ DosSleep(1 << (__log_nsec - 20));
+ }
+# elif defined (_STLP_UNIX)
+ timespec __ts;
+ /* Max sleep is 2**27nsec ~ 60msec */
+ __ts.tv_sec = 0;
+ __ts.tv_nsec = 1 << __log_nsec;
+ _STLP_NANOSLEEP(&__ts, 0);
+# endif
+}
+
+template <int __inst>
+void _STLP_CALL
+_STLP_mutex_spin<__inst>::_M_do_lock(volatile __stl_atomic_t* __lock) {
+# if defined(_STLP_ATOMIC_EXCHANGE)
+ if (_Atomic_swap(__lock, 1)) {
+ unsigned __my_spin_max = _STLP_mutex_spin<0>::__max;
+ unsigned __my_last_spins = _STLP_mutex_spin<0>::__last;
+ volatile unsigned __junk = 17; // Value doesn't matter.
+ unsigned __i;
+
+ for (__i = 0; __i < __my_spin_max; ++__i) {
+ if (__i < __my_last_spins/2 || *__lock) {
+ __junk *= __junk; __junk *= __junk;
+ __junk *= __junk; __junk *= __junk;
+ } else {
+ if (!_Atomic_swap(__lock, 1)) {
+ // got it!
+ // Spinning worked. Thus we're probably not being scheduled
+ // against the other process with which we were contending.
+ // Thus it makes sense to spin longer the next time.
+ _STLP_mutex_spin<0>::__last = __i;
+ _STLP_mutex_spin<0>::__max = _STLP_mutex_spin<0>::__high_max;
+ return;
+ }
+ }
+ }
+
+ // We are probably being scheduled against the other process. Sleep.
+ _STLP_mutex_spin<0>::__max = _STLP_mutex_spin<0>::__low_max;
+
+ for (__i = 0 ;; ++__i) {
+ int __log_nsec = __i + 6;
+
+ if (__log_nsec > 27) __log_nsec = 27;
+ if (!_Atomic_swap(__lock, 1)) {
+ break;
+ }
+ _S_nsec_sleep(__log_nsec, __i);
+ }
+ } /* first _Atomic_swap */
+# endif
+}
+#endif // _STLP_USE_PTHREAD_SPINLOCK
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */
+#endif /* _STLP_THREADS_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_threads.h b/stlport/stl/_threads.h
new file mode 100644
index 0000000..fe381d8
--- /dev/null
+++ b/stlport/stl/_threads.h
@@ -0,0 +1,687 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_THREADS_H
+#define _STLP_INTERNAL_THREADS_H
+
+// Supported threading models are native SGI, pthreads, uithreads
+// (similar to pthreads, but based on an earlier draft of the Posix
+// threads standard), and Win32 threads. Uithread support by Jochen
+// Schlick, 1999, and Solaris threads generalized to them.
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+#endif
+
+// On SUN and Mac OS X gcc, zero-initialization works just fine...
+#if defined (__sun) || (defined (__GNUC__) && defined(__APPLE__))
+# define _STLP_MUTEX_INITIALIZER
+#endif
+
+/* This header defines the following atomic operation that platform should
+ * try to support as much as possible. Atomic operation are exposed as macro
+ * in order to easily test for their existance. They are:
+ * __stl_atomic_t _STLP_ATOMIC_INCREMENT(volatile __stl_atomic_t* __ptr) :
+ * increment *__ptr by 1 and returns the new value
+ * __stl_atomic_t _STLP_ATOMIC_DECREMENT(volatile __stl_atomic_t* __ptr) :
+ * decrement *__ptr by 1 and returns the new value
+ * __stl_atomic_t _STLP_ATOMIC_EXCHANGE(volatile __stl_atomic_t* __target, __stl_atomic_t __val) :
+ * assign __val to *__target and returns former *__target value
+ * void* _STLP_ATOMIC_EXCHANGE_PTR(void* volatile* __target, void* __ptr) :
+ * assign __ptr to *__target and returns former *__target value
+ */
+
+#if defined (_STLP_THREADS)
+
+# if defined (_STLP_SGI_THREADS)
+
+# include <mutex.h>
+// Hack for SGI o32 compilers.
+# if !defined(__add_and_fetch) && \
+ (__mips < 3 || !(defined (_ABIN32) || defined(_ABI64)))
+# define __add_and_fetch(__l,__v) add_then_test((unsigned long*)__l,__v)
+# define __test_and_set(__l,__v) test_and_set(__l,__v)
+# endif /* o32 */
+
+# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64))
+# define _STLP_ATOMIC_EXCHANGE(__p, __q) test_and_set(__p, __q)
+# else
+# define _STLP_ATOMIC_EXCHANGE(__p, __q) __test_and_set((unsigned long*)__p, (unsigned long)__q)
+# endif
+
+# define _STLP_ATOMIC_INCREMENT(__x) __add_and_fetch(__x, 1)
+# define _STLP_ATOMIC_DECREMENT(__x) __add_and_fetch(__x, (size_t) -1)
+typedef long __stl_atomic_t;
+
+# elif defined (_STLP_PTHREADS)
+
+# include <pthread.h>
+# if !defined (_STLP_USE_PTHREAD_SPINLOCK)
+# if defined (PTHREAD_MUTEX_INITIALIZER) && !defined (_STLP_MUTEX_INITIALIZER) && defined (_REENTRANT)
+# define _STLP_MUTEX_INITIALIZER = { PTHREAD_MUTEX_INITIALIZER }
+# endif
+//HPUX variants have (on some platforms optional) non-standard "DCE" pthreads impl
+# if defined (_DECTHREADS_) && (defined (_PTHREAD_USE_D4) || defined (__hpux)) && !defined (_CMA_SUPPRESS_EXTERNALS_)
+# define _STLP_PTHREAD_ATTR_DEFAULT pthread_mutexattr_default
+# else
+# define _STLP_PTHREAD_ATTR_DEFAULT 0
+# endif
+# else
+# if defined (__OpenBSD__)
+# include <spinlock.h>
+# endif
+# endif
+
+# if defined (__GNUC__) && defined (__i386__)
+# if !defined (_STLP_ATOMIC_INCREMENT)
+inline long _STLP_atomic_increment_gcc_x86(long volatile* p) {
+ long result;
+ __asm__ __volatile__
+ ("lock; xaddl %1, %0;"
+ :"=m" (*p), "=r" (result)
+ :"m" (*p), "1" (1)
+ :"cc");
+ return result + 1;
+}
+# define _STLP_ATOMIC_INCREMENT(__x) (_STLP_atomic_increment_gcc_x86((long volatile*)__x))
+# endif
+
+# if !defined (_STLP_ATOMIC_DECREMENT)
+inline long _STLP_atomic_decrement_gcc_x86(long volatile* p) {
+ long result;
+ __asm__ __volatile__
+ ("lock; xaddl %1, %0;"
+ :"=m" (*p), "=r" (result)
+ :"m" (*p), "1" (-1)
+ :"cc");
+ return result - 1;
+}
+# define _STLP_ATOMIC_DECREMENT(__x) (_STLP_atomic_decrement_gcc_x86((long volatile*)__x))
+# endif
+typedef long __stl_atomic_t;
+# else
+typedef size_t __stl_atomic_t;
+# endif /* if defined(__GNUC__) && defined(__i386__) */
+
+# elif defined (_STLP_WIN32THREADS)
+
+# if !defined (_STLP_ATOMIC_INCREMENT)
+# if !defined (_STLP_NEW_PLATFORM_SDK)
+# define _STLP_ATOMIC_INCREMENT(__x) InterlockedIncrement(__CONST_CAST(long*, __x))
+# define _STLP_ATOMIC_DECREMENT(__x) InterlockedDecrement(__CONST_CAST(long*, __x))
+# define _STLP_ATOMIC_EXCHANGE(__x, __y) InterlockedExchange(__CONST_CAST(long*, __x), __y)
+# else
+# define _STLP_ATOMIC_INCREMENT(__x) InterlockedIncrement(__x)
+# define _STLP_ATOMIC_DECREMENT(__x) InterlockedDecrement(__x)
+# define _STLP_ATOMIC_EXCHANGE(__x, __y) InterlockedExchange(__x, __y)
+# endif
+# define _STLP_ATOMIC_EXCHANGE_PTR(__x, __y) STLPInterlockedExchangePointer(__x, __y)
+# endif
+typedef long __stl_atomic_t;
+
+# elif defined (__DECC) || defined (__DECCXX)
+
+# include <machine/builtins.h>
+# define _STLP_ATOMIC_EXCHANGE __ATOMIC_EXCH_LONG
+# define _STLP_ATOMIC_INCREMENT(__x) __ATOMIC_ADD_LONG(__x, 1)
+# define _STLP_ATOMIC_DECREMENT(__x) __ATOMIC_ADD_LONG(__x, -1)
+typedef long __stl_atomic_t;
+
+# elif defined (_STLP_SPARC_SOLARIS_THREADS)
+
+typedef long __stl_atomic_t;
+# include <stl/_sparc_atomic.h>
+
+# elif defined (_STLP_UITHREADS)
+
+// this inclusion is potential hazard to bring up all sorts
+// of old-style headers. Let's assume vendor already know how
+// to deal with that.
+# ifndef _STLP_INTERNAL_CTIME
+# include <stl/_ctime.h>
+# endif
+# if defined (_STLP_USE_NAMESPACES) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
+using _STLP_VENDOR_CSTD::time_t;
+# endif
+# include <synch.h>
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+# ifndef _STLP_INTERNAL_CWCHAR
+# include <stl/_cwchar.h>
+# endif
+typedef size_t __stl_atomic_t;
+
+# elif defined (_STLP_BETHREADS)
+
+# include <OS.h>
+# include <cassert>
+# include <stdio.h>
+# define _STLP_MUTEX_INITIALIZER = { 0 }
+typedef size_t __stl_atomic_t;
+
+# elif defined (_STLP_NWTHREADS)
+
+# include <nwthread.h>
+# include <nwsemaph.h>
+typedef size_t __stl_atomic_t;
+
+# elif defined(_STLP_OS2THREADS)
+
+# if defined (__GNUC__)
+# define INCL_DOSSEMAPHORES
+# include <os2.h>
+# else
+// This section serves to replace os2.h for VisualAge C++
+ typedef unsigned long ULONG;
+# if !defined (__HEV__) /* INCL_SEMAPHORE may also define HEV */
+# define __HEV__
+ typedef ULONG HEV;
+ typedef HEV* PHEV;
+# endif
+ typedef ULONG APIRET;
+ typedef ULONG HMTX;
+ typedef HMTX* PHMTX;
+ typedef const char* PCSZ;
+ typedef ULONG BOOL32;
+ APIRET _System DosCreateMutexSem(PCSZ pszName, PHEV phev, ULONG flAttr, BOOL32 fState);
+ APIRET _System DosRequestMutexSem(HMTX hmtx, ULONG ulTimeout);
+ APIRET _System DosReleaseMutexSem(HMTX hmtx);
+ APIRET _System DosCloseMutexSem(HMTX hmtx);
+# define _STLP_MUTEX_INITIALIZER = { 0 }
+# endif /* GNUC */
+typedef size_t __stl_atomic_t;
+
+# else
+
+typedef size_t __stl_atomic_t;
+
+# endif
+
+#else
+/* no threads */
+# define _STLP_ATOMIC_INCREMENT(__x) ++(*__x)
+# define _STLP_ATOMIC_DECREMENT(__x) --(*__x)
+/* We do not grant other atomic operations as they are useless if STLport do not have
+ * to be thread safe
+ */
+typedef size_t __stl_atomic_t;
+#endif
+
+#if !defined (_STLP_MUTEX_INITIALIZER)
+# if defined(_STLP_ATOMIC_EXCHANGE)
+# define _STLP_MUTEX_INITIALIZER = { 0 }
+# elif defined(_STLP_UITHREADS)
+# define _STLP_MUTEX_INITIALIZER = { DEFAULTMUTEX }
+# else
+# define _STLP_MUTEX_INITIALIZER
+# endif
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK)
+// Helper struct. This is a workaround for various compilers that don't
+// handle static variables in inline functions properly.
+template <int __inst>
+struct _STLP_mutex_spin {
+ enum { __low_max = 30, __high_max = 1000 };
+ // Low if we suspect uniprocessor, high for multiprocessor.
+ static unsigned __max;
+ static unsigned __last;
+ static void _STLP_CALL _M_do_lock(volatile __stl_atomic_t* __lock);
+ static void _STLP_CALL _S_nsec_sleep(int __log_nsec, unsigned int& __iteration);
+};
+#endif // !_STLP_USE_PTHREAD_SPINLOCK
+
+// Locking class. Note that this class *does not have a constructor*.
+// It must be initialized either statically, with _STLP_MUTEX_INITIALIZER,
+// or dynamically, by explicitly calling the _M_initialize member function.
+// (This is similar to the ways that a pthreads mutex can be initialized.)
+// There are explicit member functions for acquiring and releasing the lock.
+
+// There is no constructor because static initialization is essential for
+// some uses, and only a class aggregate (see section 8.5.1 of the C++
+// standard) can be initialized that way. That means we must have no
+// constructors, no base classes, no virtual functions, and no private or
+// protected members.
+
+// For non-static cases, clients should use _STLP_mutex.
+
+struct _STLP_CLASS_DECLSPEC _STLP_mutex_base {
+#if defined (_STLP_ATOMIC_EXCHANGE) || defined (_STLP_SGI_THREADS)
+ // It should be relatively easy to get this to work on any modern Unix.
+ volatile __stl_atomic_t _M_lock;
+#endif
+
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE)
+ inline void _M_initialize() { _M_lock = 0; }
+ inline void _M_destroy() {}
+
+ void _M_acquire_lock() {
+ _STLP_mutex_spin<0>::_M_do_lock(&_M_lock);
+ }
+
+ inline void _M_release_lock() {
+ volatile __stl_atomic_t* __lock = &_M_lock;
+# if defined(_STLP_SGI_THREADS) && defined(__GNUC__) && __mips >= 3
+ asm("sync");
+ *__lock = 0;
+# elif defined(_STLP_SGI_THREADS) && __mips >= 3 && \
+ (defined (_ABIN32) || defined(_ABI64))
+ __lock_release(__lock);
+# elif defined (_STLP_SPARC_SOLARIS_THREADS)
+# if defined (__WORD64) || defined (__arch64__) || defined (__sparcv9) || defined (__sparcv8plus)
+ asm("membar #StoreStore ; membar #LoadStore");
+# else
+ asm(" stbar ");
+# endif
+ *__lock = 0;
+# else
+ *__lock = 0;
+ // This is not sufficient on many multiprocessors, since
+ // writes to protected variables and the lock may be reordered.
+# endif
+ }
+# elif defined (_STLP_PTHREADS)
+# if defined (_STLP_USE_PTHREAD_SPINLOCK)
+# if !defined (__OpenBSD__)
+ pthread_spinlock_t _M_lock;
+ inline void _M_initialize() { pthread_spin_init( &_M_lock, 0 ); }
+ inline void _M_destroy() { pthread_spin_destroy( &_M_lock ); }
+
+ // sorry, but no static initializer for pthread_spinlock_t;
+ // this will not work for compilers that has problems with call
+ // constructor of static object...
+
+ // _STLP_mutex_base()
+ // { pthread_spin_init( &_M_lock, 0 ); }
+
+ // ~_STLP_mutex_base()
+ // { pthread_spin_destroy( &_M_lock ); }
+
+ inline void _M_acquire_lock() { pthread_spin_lock( &_M_lock ); }
+ inline void _M_release_lock() { pthread_spin_unlock( &_M_lock ); }
+# else // __OpenBSD__
+ spinlock_t _M_lock;
+ inline void _M_initialize() { _SPINLOCK_INIT( &_M_lock ); }
+ inline void _M_destroy() { }
+ inline void _M_acquire_lock() { _SPINLOCK( &_M_lock ); }
+ inline void _M_release_lock() { _SPINUNLOCK( &_M_lock ); }
+# endif // __OpenBSD__
+# else // !_STLP_USE_PTHREAD_SPINLOCK
+ pthread_mutex_t _M_lock;
+ inline void _M_initialize()
+ { pthread_mutex_init(&_M_lock,_STLP_PTHREAD_ATTR_DEFAULT); }
+ inline void _M_destroy()
+ { pthread_mutex_destroy(&_M_lock); }
+ inline void _M_acquire_lock() {
+# if defined ( __hpux ) && ! defined (PTHREAD_MUTEX_INITIALIZER)
+ if (!_M_lock.field1) _M_initialize();
+# endif
+ pthread_mutex_lock(&_M_lock);
+ }
+ inline void _M_release_lock() { pthread_mutex_unlock(&_M_lock); }
+# endif // !_STLP_USE_PTHREAD_SPINLOCK
+
+# elif defined (_STLP_UITHREADS)
+ mutex_t _M_lock;
+ inline void _M_initialize()
+ { mutex_init(&_M_lock, 0, NULL); }
+ inline void _M_destroy()
+ { mutex_destroy(&_M_lock); }
+ inline void _M_acquire_lock() { mutex_lock(&_M_lock); }
+ inline void _M_release_lock() { mutex_unlock(&_M_lock); }
+
+# elif defined (_STLP_OS2THREADS)
+ HMTX _M_lock;
+ inline void _M_initialize() { DosCreateMutexSem(NULL, &_M_lock, 0, false); }
+ inline void _M_destroy() { DosCloseMutexSem(_M_lock); }
+ inline void _M_acquire_lock() {
+ if (!_M_lock) _M_initialize();
+ DosRequestMutexSem(_M_lock, SEM_INDEFINITE_WAIT);
+ }
+ inline void _M_release_lock() { DosReleaseMutexSem(_M_lock); }
+# elif defined (_STLP_BETHREADS)
+ sem_id sem;
+ inline void _M_initialize() {
+ sem = create_sem(1, "STLPort");
+ assert(sem > 0);
+ }
+ inline void _M_destroy() {
+ int t = delete_sem(sem);
+ assert(t == B_NO_ERROR);
+ }
+ inline void _M_acquire_lock();
+ inline void _M_release_lock() {
+ status_t t = release_sem(sem);
+ assert(t == B_NO_ERROR);
+ }
+# elif defined (_STLP_NWTHREADS)
+ LONG _M_lock;
+ inline void _M_initialize()
+ { _M_lock = OpenLocalSemaphore(1); }
+ inline void _M_destroy()
+ { CloseLocalSemaphore(_M_lock); }
+ inline void _M_acquire_lock()
+ { WaitOnLocalSemaphore(_M_lock); }
+ inline void _M_release_lock() { SignalLocalSemaphore(_M_lock); }
+# else //*ty 11/24/2001 - added configuration check
+# error "Unknown thread facility configuration"
+# endif
+#else /* No threads */
+ inline void _M_initialize() {}
+ inline void _M_destroy() {}
+ inline void _M_acquire_lock() {}
+ inline void _M_release_lock() {}
+#endif // _STLP_PTHREADS
+};
+
+// Locking class. The constructor initializes the lock, the destructor destroys it.
+// Well - behaving class, does not need static initializer
+
+class _STLP_CLASS_DECLSPEC _STLP_mutex : public _STLP_mutex_base {
+ public:
+ inline _STLP_mutex () { _M_initialize(); }
+ inline ~_STLP_mutex () { _M_destroy(); }
+ private:
+ _STLP_mutex(const _STLP_mutex&);
+ void operator=(const _STLP_mutex&);
+};
+
+// A locking class that uses _STLP_STATIC_MUTEX. The constructor takes
+// a reference to an _STLP_STATIC_MUTEX, and acquires a lock. The destructor
+// releases the lock.
+// It's not clear that this is exactly the right functionality.
+// It will probably change in the future.
+
+struct _STLP_CLASS_DECLSPEC _STLP_auto_lock {
+ _STLP_auto_lock(_STLP_STATIC_MUTEX& __lock) : _M_lock(__lock)
+ { _M_lock._M_acquire_lock(); }
+ ~_STLP_auto_lock()
+ { _M_lock._M_release_lock(); }
+
+private:
+ _STLP_STATIC_MUTEX& _M_lock;
+ void operator=(const _STLP_auto_lock&);
+ _STLP_auto_lock(const _STLP_auto_lock&);
+};
+
+/*
+ * Class _Refcount_Base provides a type, __stl_atomic_t, a data member,
+ * _M_ref_count, and member functions _M_incr and _M_decr, which perform
+ * atomic preincrement/predecrement. The constructor initializes
+ * _M_ref_count.
+ */
+class _STLP_CLASS_DECLSPEC _Refcount_Base {
+ // The data member _M_ref_count
+#if defined (__DMC__)
+public:
+#endif
+ _STLP_VOLATILE __stl_atomic_t _M_ref_count;
+
+#if defined (_STLP_THREADS) && \
+ (!defined (_STLP_ATOMIC_INCREMENT) || !defined (_STLP_ATOMIC_DECREMENT) || \
+ defined (_STLP_WIN95_LIKE))
+# define _STLP_USE_MUTEX
+ _STLP_mutex _M_mutex;
+#endif
+
+ public:
+ // Constructor
+ _Refcount_Base(__stl_atomic_t __n) : _M_ref_count(__n) {}
+#if defined (__BORLANDC__)
+ ~_Refcount_Base(){};
+#endif
+
+ // _M_incr and _M_decr
+#if defined (_STLP_THREADS)
+# if !defined (_STLP_USE_MUTEX)
+ __stl_atomic_t _M_incr() { return _STLP_ATOMIC_INCREMENT(&_M_ref_count); }
+ __stl_atomic_t _M_decr() { return _STLP_ATOMIC_DECREMENT(&_M_ref_count); }
+# else
+# undef _STLP_USE_MUTEX
+ __stl_atomic_t _M_incr() {
+ _STLP_auto_lock l(_M_mutex);
+ return ++_M_ref_count;
+ }
+ __stl_atomic_t _M_decr() {
+ _STLP_auto_lock l(_M_mutex);
+ return --_M_ref_count;
+ }
+# endif
+#else /* No threads */
+ __stl_atomic_t _M_incr() { return ++_M_ref_count; }
+ __stl_atomic_t _M_decr() { return --_M_ref_count; }
+#endif
+};
+
+/* Atomic swap on __stl_atomic_t
+ * This is guaranteed to behave as though it were atomic only if all
+ * possibly concurrent updates use _Atomic_swap.
+ * In some cases the operation is emulated with a lock.
+ * Idem for _Atomic_swap_ptr
+ */
+/* Helper struct to handle following cases:
+ * - on platforms where sizeof(__stl_atomic_t) == sizeof(void*) atomic
+ * exchange can be done on pointers
+ * - on platform without atomic operation swap is done in a critical section,
+ * portable but inefficient.
+ */
+template <int __use_ptr_atomic_swap>
+class _Atomic_swap_struct {
+public:
+#if defined (_STLP_THREADS) && \
+ !defined (_STLP_ATOMIC_EXCHANGE) && \
+ (defined (_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS) || \
+ defined (_STLP_USE_PTHREAD_SPINLOCK) || defined (_STLP_NWTHREADS))
+# define _STLP_USE_ATOMIC_SWAP_MUTEX
+ static _STLP_STATIC_MUTEX _S_swap_lock;
+#endif
+
+ static __stl_atomic_t _S_swap(_STLP_VOLATILE __stl_atomic_t* __p, __stl_atomic_t __q) {
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE)
+ return _STLP_ATOMIC_EXCHANGE(__p, __q);
+# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+ _S_swap_lock._M_acquire_lock();
+ __stl_atomic_t __result = *__p;
+ *__p = __q;
+ _S_swap_lock._M_release_lock();
+ return __result;
+# else
+# error Missing atomic swap implementation
+# endif
+#else
+ /* no threads */
+ __stl_atomic_t __result = *__p;
+ *__p = __q;
+ return __result;
+#endif // _STLP_THREADS
+ }
+
+ static void* _S_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) {
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE_PTR)
+ return _STLP_ATOMIC_EXCHANGE_PTR(__p, __q);
+# elif defined (_STLP_ATOMIC_EXCHANGE)
+ _STLP_STATIC_ASSERT(sizeof(__stl_atomic_t) == sizeof(void*))
+ return __REINTERPRET_CAST(void*, _STLP_ATOMIC_EXCHANGE(__REINTERPRET_CAST(volatile __stl_atomic_t*, __p),
+ __REINTERPRET_CAST(__stl_atomic_t, __q))
+ );
+# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+ _S_swap_lock._M_acquire_lock();
+ void *__result = *__p;
+ *__p = __q;
+ _S_swap_lock._M_release_lock();
+ return __result;
+# else
+# error Missing pointer atomic swap implementation
+# endif
+#else
+ /* no thread */
+ void *__result = *__p;
+ *__p = __q;
+ return __result;
+#endif
+ }
+};
+
+_STLP_TEMPLATE_NULL
+class _Atomic_swap_struct<0> {
+public:
+#if defined (_STLP_THREADS) && \
+ (!defined (_STLP_ATOMIC_EXCHANGE) || !defined (_STLP_ATOMIC_EXCHANGE_PTR)) && \
+ (defined (_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS) || \
+ defined (_STLP_USE_PTHREAD_SPINLOCK) || defined (_STLP_NWTHREADS))
+# define _STLP_USE_ATOMIC_SWAP_MUTEX
+ static _STLP_STATIC_MUTEX _S_swap_lock;
+#endif
+
+ static __stl_atomic_t _S_swap(_STLP_VOLATILE __stl_atomic_t* __p, __stl_atomic_t __q) {
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE)
+ return _STLP_ATOMIC_EXCHANGE(__p, __q);
+# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+ /* This should be portable, but performance is expected
+ * to be quite awful. This really needs platform specific
+ * code.
+ */
+ _S_swap_lock._M_acquire_lock();
+ __stl_atomic_t __result = *__p;
+ *__p = __q;
+ _S_swap_lock._M_release_lock();
+ return __result;
+# else
+# error Missing atomic swap implementation
+# endif
+#else
+ /* no threads */
+ __stl_atomic_t __result = *__p;
+ *__p = __q;
+ return __result;
+#endif // _STLP_THREADS
+ }
+
+ static void* _S_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) {
+#if defined (_STLP_THREADS)
+# if defined (_STLP_ATOMIC_EXCHANGE_PTR)
+ return _STLP_ATOMIC_EXCHANGE_PTR(__p, __q);
+# elif defined (_STLP_ATOMIC_EXCHANGE)
+ _STLP_STATIC_ASSERT(sizeof(__stl_atomic_t) == sizeof(void*))
+ return __REINTERPRET_CAST(void*, _STLP_ATOMIC_EXCHANGE(__REINTERPRET_CAST(volatile __stl_atomic_t*, __p),
+ __REINTERPRET_CAST(__stl_atomic_t, __q))
+ );
+# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX)
+ _S_swap_lock._M_acquire_lock();
+ void *__result = *__p;
+ *__p = __q;
+ _S_swap_lock._M_release_lock();
+ return __result;
+# else
+# error Missing pointer atomic swap implementation
+# endif
+#else
+ /* no thread */
+ void *__result = *__p;
+ *__p = __q;
+ return __result;
+#endif
+ }
+};
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC == 1300)
+# pragma warning (push)
+# pragma warning (disable : 4189) //__use_ptr_atomic_swap initialized but not used
+#endif
+
+inline __stl_atomic_t _STLP_CALL _Atomic_swap(_STLP_VOLATILE __stl_atomic_t * __p, __stl_atomic_t __q) {
+ const int __use_ptr_atomic_swap = sizeof(__stl_atomic_t) == sizeof(void*);
+ return _Atomic_swap_struct<__use_ptr_atomic_swap>::_S_swap(__p, __q);
+}
+
+inline void* _STLP_CALL _Atomic_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) {
+ const int __use_ptr_atomic_swap = sizeof(__stl_atomic_t) == sizeof(void*);
+ return _Atomic_swap_struct<__use_ptr_atomic_swap>::_S_swap_ptr(__p, __q);
+}
+
+#if defined (_STLP_MSVC) && (_STLP_MSVC == 1300)
+# pragma warning (pop)
+#endif
+
+#if defined (_STLP_BETHREADS)
+template <int __inst>
+struct _STLP_beos_static_lock_data {
+ static bool is_init;
+ struct mutex_t : public _STLP_mutex {
+ mutex_t()
+ { _STLP_beos_static_lock_data<0>::is_init = true; }
+ ~mutex_t()
+ { _STLP_beos_static_lock_data<0>::is_init = false; }
+ };
+ static mutex_t mut;
+};
+
+template <int __inst>
+bool _STLP_beos_static_lock_data<__inst>::is_init = false;
+template <int __inst>
+typename _STLP_beos_static_lock_data<__inst>::mutex_t _STLP_beos_static_lock_data<__inst>::mut;
+
+inline void _STLP_mutex_base::_M_acquire_lock() {
+ if (sem == 0) {
+ // we need to initialise on demand here
+ // to prevent race conditions use our global
+ // mutex if it's available:
+ if (_STLP_beos_static_lock_data<0>::is_init) {
+ _STLP_auto_lock al(_STLP_beos_static_lock_data<0>::mut);
+ if (sem == 0) _M_initialize();
+ }
+ else {
+ // no lock available, we must still be
+ // in startup code, THERE MUST BE ONE THREAD
+ // ONLY active at this point.
+ _M_initialize();
+ }
+ }
+ status_t t;
+ t = acquire_sem(sem);
+ assert(t == B_NO_ERROR);
+}
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_threads.c>
+#endif
+
+#endif /* _STLP_INTERNAL_THREADS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_time_facets.c b/stlport/stl/_time_facets.c
new file mode 100644
index 0000000..f403817
--- /dev/null
+++ b/stlport/stl/_time_facets.c
@@ -0,0 +1,441 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_TIME_FACETS_C
+#define _STLP_TIME_FACETS_C
+
+#ifndef _STLP_INTERNAL_TIME_FACETS_H
+# include <stl/_time_facets.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_PUT_H
+# include <stl/_num_put.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUM_GET_H
+# include <stl/_num_get.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//----------------------------------------------------------------------
+// Declarations of static template members.
+
+template <class _CharT, class _InputIterator>
+locale::id time_get<_CharT, _InputIterator>::id;
+
+template <class _CharT, class _OutputIterator>
+locale::id time_put<_CharT, _OutputIterator>::id;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/* Matching input against a list of names
+
+ * Alphabetic input of the names of months and the names
+ * of weekdays requires matching input against a list of names.
+ * We use a simple generic algorithm to accomplish this. This
+ * algorithm is not very efficient, especially for longer lists
+ * of names, but it probably does not matter for the initial
+ * implementation and it may never matter, since we do not expect
+ * this kind of input to be used very often. The algorithm
+ * could be improved fairly simply by creating a new list of
+ * names still in the running at each iteration. A more sophisticated
+ * approach would be to build a tree to do the matching.
+ *
+ * We compare each character of the input to the corresponding
+ * character of each name on the list that has not been eliminated,
+ * either because every character in the name has already been
+ * matched, or because some character has not been matched. We
+ * continue only as long as there are some names that have not been
+ * eliminated.
+
+ * We do not really need a random access iterator (a forward iterator
+ * would do), but the extra generality makes the notation clumsier,
+ * and we don't really need it.
+
+ * We can recognize a failed match by the fact that the return value
+ * will be __name_end.
+ */
+
+#define _MAXNAMES 24
+
+template <class _InIt, class _NameIt>
+size_t _STLP_CALL
+__match(_InIt& __first, _InIt& __last, _NameIt __name, _NameIt __name_end) {
+ typedef ptrdiff_t difference_type;
+ difference_type __n = __name_end - __name;
+ difference_type __i, __start = 0;
+ size_t __pos = 0;
+ difference_type __check_count = __n;
+ bool __do_not_check[_MAXNAMES];
+ size_t __matching_name_index = __n;
+
+ memset(__do_not_check, 0, sizeof(__do_not_check));
+
+ while (__first != __last) {
+ difference_type __new_n = __n;
+ for (__i = __start; __i < __n; ++__i) {
+ if (!__do_not_check[__i]) {
+ if (*__first == __name[__i][__pos]) {
+ if (__pos == (__name[__i].size() - 1)) {
+ __matching_name_index = __i;
+ __do_not_check[__i] = true;
+ if (__i == __start) ++__start;
+ --__check_count;
+ if (__check_count == 0) {
+ ++__first;
+ return __matching_name_index;
+ }
+ }
+ __new_n = __i + 1;
+ }
+ else {
+ __do_not_check[__i] = true;
+ if (__i == __start) ++__start;
+ --__check_count;
+ if (__check_count == 0)
+ return __matching_name_index;
+ }
+ }
+ else {
+ if (__i == __start) ++ __start;
+ }
+ }
+
+ __n = __new_n;
+ ++__first; ++__pos;
+ }
+
+ return __matching_name_index;
+}
+
+// __get_formatted_time reads input that is assumed to be formatted
+// according to the rules for the C strftime function (C standard,
+// 7.12.3.5). This function is used to implement the do_get_time
+// and do_get_date virtual functions, which depend on the locale
+// specifications for the time and day formats respectively.
+// Note the catchall default case, intended mainly for the '%Z'
+// format designator, which does not make sense here since the
+// representation of timezones is not part of the locale.
+//
+// The case branches are implemented either by doing a match using
+// the appopriate name table or by doing a __get_integer_nogroup.
+//
+// 'y' format is assumed to mean that the input represents years
+// since 1900. That is, 2002 should be represented as 102. There
+// is no century-guessing.
+//
+// The match is successful if and only if the second component of the
+// return value is format_end.
+
+// Note that the antepenultimate parameter is being used only to determine
+// the correct overloading for the calls to __get_integer_nogroup.
+template <class _InIt1, class _Ch, class _TimeInfo>
+string::const_iterator _STLP_CALL
+__get_formatted_time _STLP_WEAK (_InIt1 __first, _InIt1 __last,
+ string::const_iterator __format, string::const_iterator __format_end,
+ _Ch*, const _TimeInfo& __table,
+ const ios_base& __s, ios_base::iostate& __err, tm* __t) {
+ const ctype<_Ch>& __ct = use_facet<ctype<_Ch> >(__s.getloc());
+ typedef basic_string<_Ch, char_traits<_Ch>, allocator<_Ch> > string_type;
+ size_t offset;
+
+ while (__first != __last && __format != __format_end) {
+ offset = 0;
+ if (*__format == '%') {
+ ++__format;
+ char __c = *__format;
+ if (__c == '#') { //MS extension
+ ++__format;
+ __c = *__format;
+ }
+
+ switch (__c) {
+ case 'A':
+ offset = 7;
+ case 'a': {
+ size_t __index = __match(__first, __last,
+ __table._M_dayname + offset, __table._M_dayname + offset + 7);
+ if (__index == 7)
+ return __format;
+ __t->tm_wday = __STATIC_CAST(int, __index);
+ break;
+ }
+
+ case 'B':
+ offset = 12;
+ case 'b': {
+ size_t __index = __match(__first, __last,
+ __table._M_monthname + offset, __table._M_monthname + offset + 12);
+ if (__index == 12)
+ return __format;
+ __t->tm_mon = __STATIC_CAST(int, __index);
+ break;
+ }
+
+ case 'd': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_mday, __STATIC_CAST(_Ch*, 0));
+ if (!__pr || __t->tm_mday < 1 || __t->tm_mday > 31) {
+ __err |= ios_base::failbit;
+ return __format;
+ }
+ break;
+ }
+
+ case 'H': case 'I': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_hour, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'j': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_yday, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'm': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_mon, __STATIC_CAST(_Ch*, 0));
+ --__t->tm_mon;
+ if (!__pr || __t->tm_mon < 0 || __t->tm_mon > 11) {
+ __err |= ios_base::failbit;
+ return __format;
+ }
+ break;
+ }
+
+ case 'M': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_min, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'p': {
+ size_t __index = __match(__first, __last,
+ __table._M_am_pm + 0, __table._M_am_pm + 2);
+ if (__index == 2)
+ return __format;
+ // 12:00 PM <=> 12:00, 12:00 AM <=> 00:00
+ if (__index == 1 && __t->tm_hour != 12 )
+ __t->tm_hour += 12;
+ if (__index == 0 && __t->tm_hour == 12 )
+ __t->tm_hour = 0;
+ break;
+ }
+
+ case 'S': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_sec, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'y': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0));
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ case 'Y': {
+ bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0));
+ __t->tm_year -= 1900;
+ if (!__pr)
+ return __format;
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+ else {
+ if (*__first++ != __ct.widen(*__format)) break;
+ }
+
+ ++__format;
+ }
+
+ return __format;
+}
+
+template <class _InIt, class _TimeInfo>
+bool _STLP_CALL
+__get_short_or_long_dayname(_InIt& __first, _InIt& __last, const _TimeInfo& __table, tm* __t) {
+ size_t __index = __match(__first, __last, __table._M_dayname + 0, __table._M_dayname + 14);
+ if (__index != 14) {
+ __t->tm_wday = __STATIC_CAST(int, __index % 7);
+ return true;
+ }
+ return false;
+}
+
+template <class _InIt, class _TimeInfo>
+bool _STLP_CALL
+__get_short_or_long_monthname(_InIt& __first, _InIt& __last, const _TimeInfo& __table, tm* __t) {
+ size_t __index = __match(__first, __last, __table._M_monthname + 0, __table._M_monthname + 24);
+ if (__index != 24) {
+ __t->tm_mon = __STATIC_CAST(int, __index % 12);
+ return true;
+ }
+ return false;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_date(_InIt __s, _InIt __end,
+ ios_base& __str, ios_base::iostate& __err,
+ tm* __t) const {
+ typedef string::const_iterator string_iterator;
+
+ string_iterator __format = this->_M_timeinfo._M_date_format.begin();
+ string_iterator __format_end = this->_M_timeinfo._M_date_format.end();
+
+ string_iterator __result
+ = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end,
+ __STATIC_CAST(_Ch*, 0), this->_M_timeinfo,
+ __str, __err, __t);
+ if (__result == __format_end)
+ __err = ios_base::goodbit;
+ else {
+ __err = ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+ }
+ return __s;
+}
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_time(_InIt __s, _InIt __end,
+ ios_base& __str, ios_base::iostate& __err,
+ tm* __t) const {
+ typedef string::const_iterator string_iterator;
+ string_iterator __format = this->_M_timeinfo._M_time_format.begin();
+ string_iterator __format_end = this->_M_timeinfo._M_time_format.end();
+
+ string_iterator __result
+ = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end,
+ __STATIC_CAST(_Ch*, 0), this->_M_timeinfo,
+ __str, __err, __t);
+ __err = __result == __format_end ? ios_base::goodbit
+ : ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+ return __s;
+}
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_year(_InIt __s, _InIt __end,
+ ios_base&, ios_base::iostate& __err,
+ tm* __t) const {
+ if (__s == __end) {
+ __err = ios_base::failbit | ios_base::eofbit;
+ return __s;
+ }
+
+ bool __pr = _STLP_PRIV __get_decimal_integer(__s, __end, __t->tm_year, __STATIC_CAST(_Ch*, 0));
+ __t->tm_year -= 1900;
+ __err = __pr ? ios_base::goodbit : ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+
+ return __s;
+}
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_weekday(_InIt __s, _InIt __end,
+ ios_base &__str, ios_base::iostate &__err,
+ tm *__t) const {
+ bool __result =
+ _STLP_PRIV __get_short_or_long_dayname(__s, __end, this->_M_timeinfo, __t);
+ if (__result)
+ __err = ios_base::goodbit;
+ else {
+ __err = ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+ }
+ return __s;
+}
+
+template <class _Ch, class _InIt>
+_InIt
+time_get<_Ch, _InIt>::do_get_monthname(_InIt __s, _InIt __end,
+ ios_base &__str, ios_base::iostate &__err,
+ tm *__t) const {
+ bool __result =
+ _STLP_PRIV __get_short_or_long_monthname(__s, __end, this->_M_timeinfo, __t);
+ if (__result)
+ __err = ios_base::goodbit;
+ else {
+ __err = ios_base::failbit;
+ if (__s == __end)
+ __err |= ios_base::eofbit;
+ }
+ return __s;
+}
+
+template<class _Ch, class _OutputIter>
+_OutputIter
+time_put<_Ch,_OutputIter>::put(_OutputIter __s, ios_base& __f, _Ch __fill,
+ const tm* __tmb, const _Ch* __pat,
+ const _Ch* __pat_end) const {
+ const ctype<_Ch>& _Ct = use_facet<ctype<_Ch> >(__f.getloc());
+ while (__pat != __pat_end) {
+ char __c = _Ct.narrow(*__pat, 0);
+ if (__c == '%') {
+ char __mod = 0;
+ ++__pat;
+ __c = _Ct.narrow(*__pat++, 0);
+ if (__c == '#') { // MS extension
+ __mod = __c;
+ __c = _Ct.narrow(*__pat++, 0);
+ }
+ __s = do_put(__s, __f, __fill, __tmb, __c, __mod);
+ }
+ else
+ *__s++ = *__pat++;
+ }
+ return __s;
+}
+
+template<class _Ch, class _OutputIter>
+_OutputIter
+time_put<_Ch,_OutputIter>::do_put(_OutputIter __s, ios_base& __f, _Ch /* __fill */,
+ const tm* __tmb, char __format,
+ char __modifier ) const {
+ const ctype<_Ch>& __ct = use_facet<ctype<_Ch> >(__f.getloc());
+ _STLP_BASIC_IOSTRING(_Ch) __buf;
+ _STLP_PRIV __write_formatted_time(__buf, __ct, __format, __modifier, this->_M_timeinfo, __tmb);
+ return copy(__buf.begin(), __buf.end(), __s);
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_TIME_FACETS_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_time_facets.h b/stlport/stl/_time_facets.h
new file mode 100644
index 0000000..e67c2f4
--- /dev/null
+++ b/stlport/stl/_time_facets.h
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: This is an internal header file, included by other C++
+// standard library headers. You should not attempt to use this header
+// file directly.
+
+
+#ifndef _STLP_INTERNAL_TIME_FACETS_H
+#define _STLP_INTERNAL_TIME_FACETS_H
+
+#ifndef _STLP_INTERNAL_CTIME
+# include <stl/_ctime.h> // Needed (for struct tm) by time facets
+#endif
+
+#ifndef _STLP_C_LOCALE_H
+# include <stl/c_locale.h>
+#endif
+
+#ifndef _STLP_IOS_BASE_H
+# include <stl/_ios_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H
+# include <stl/_iostream_string.h>
+#endif
+
+#ifndef _STLP_FACETS_FWD_H
+# include <stl/_facets_fwd.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// Template functions used by time_get
+
+/* Both time_get and time_put need a structure of type _Time_Info
+ * to provide names and abbreviated names for months and days,
+ * as well as the am/pm designator. The month and weekday tables
+ * have the all the abbreviated names before all the full names.
+ * The _Time_Info tables are initialized using the non-template
+ * time_base class, which has a default constructor and two protected.
+ * The default one initialize _Time_Info with "C" time info. The
+ * protected initialize _time_Info using a _Locale_time instance
+ * or using a name( in fact the name is used to build a _Locale_time
+ * instance that is then used for initialization). */
+
+class _STLP_CLASS_DECLSPEC _Time_Info_Base {
+public:
+ string _M_time_format;
+ string _M_date_format;
+ string _M_date_time_format;
+ string _M_long_date_format;
+ string _M_long_date_time_format;
+};
+
+class _STLP_CLASS_DECLSPEC _Time_Info : public _Time_Info_Base {
+public:
+ string _M_dayname[14];
+ string _M_monthname[24];
+ string _M_am_pm[2];
+};
+
+#ifndef _STLP_NO_WCHAR_T
+class _STLP_CLASS_DECLSPEC _WTime_Info : public _Time_Info_Base {
+public:
+ wstring _M_dayname[14];
+ wstring _M_monthname[24];
+ wstring _M_am_pm[2];
+};
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+class _STLP_CLASS_DECLSPEC time_base {
+public:
+ enum dateorder {no_order, dmy, mdy, ymd, ydm};
+};
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Ch>
+class time_init;
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC time_init<char> {
+protected:
+ time_init();
+ time_init(const char *name);
+ time_init(_Locale_time*);
+#if defined (__BORLANDC__)
+ static
+#endif
+ _Time_Info _M_timeinfo;
+ time_base::dateorder _M_dateorder;
+};
+
+#ifndef _STLP_NO_WCHAR_T
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC time_init<wchar_t> {
+protected:
+ time_init();
+ time_init(const char *name);
+ time_init(_Locale_time*);
+#if defined (__BORLANDC__)
+ static
+#endif
+ _WTime_Info _M_timeinfo;
+ time_base::dateorder _M_dateorder;
+};
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Ch, class _InIt>
+class time_get : public locale::facet, public time_base, public _STLP_PRIV time_init<_Ch> {
+public:
+ typedef _Ch char_type;
+ typedef _InIt iter_type;
+
+ explicit time_get(size_t __refs = 0) : locale::facet(__refs)
+ {}
+
+ dateorder date_order() const { return do_date_order(); }
+ iter_type get_time(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_time(__s, __end, __str, __err, __t); }
+ iter_type get_date(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_date(__s, __end, __str, __err, __t); }
+ iter_type get_weekday(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_weekday(__s, __end, __str, __err, __t); }
+ iter_type get_monthname(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_monthname(__s, __end, __str, __err, __t); }
+ iter_type get_year(iter_type __s, iter_type __end, ios_base& __str,
+ ios_base::iostate& __err, tm* __t) const
+ { return do_get_year(__s, __end, __str, __err, __t); }
+
+ static locale::id id;
+
+protected:
+ time_get(const char* __name, size_t __refs)
+ : locale::facet(__refs), _STLP_PRIV time_init<_Ch>(__name)
+ {}
+ time_get(_Locale_time *__time)
+ : _STLP_PRIV time_init<_Ch>(__time)
+ {}
+
+ ~time_get() {}
+
+ virtual dateorder do_date_order() const { return this->_M_dateorder; }
+
+ virtual iter_type do_get_time(iter_type __s, iter_type __end,
+ ios_base&, ios_base::iostate& __err,
+ tm* __t) const;
+
+ virtual iter_type do_get_date(iter_type __s, iter_type __end,
+ ios_base&, ios_base::iostate& __err,
+ tm* __t) const;
+
+ virtual iter_type do_get_weekday(iter_type __s, iter_type __end,
+ ios_base&,
+ ios_base::iostate& __err,
+ tm* __t) const;
+ virtual iter_type do_get_monthname(iter_type __s, iter_type __end,
+ ios_base&,
+ ios_base::iostate& __err,
+ tm* __t) const;
+
+ virtual iter_type do_get_year(iter_type __s, iter_type __end,
+ ios_base&, ios_base::iostate& __err,
+ tm* __t) const;
+};
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _Ch, class _InIt>
+#else
+template <class _Ch, class _InIt = istreambuf_iterator<_Ch, char_traits<_Ch> > >
+#endif
+class time_get_byname : public time_get<_Ch, _InIt> {
+ friend class _Locale_impl;
+public:
+ typedef time_base::dateorder dateorder;
+ typedef _InIt iter_type;
+
+ explicit time_get_byname(const char* __name, size_t __refs = 0)
+ : time_get<_Ch, _InIt>(__name, __refs) {}
+
+protected:
+ ~time_get_byname() {}
+ dateorder do_date_order() const { return this->_M_dateorder; }
+
+private:
+ time_get_byname(_Locale_time *__time)
+ : time_get<_Ch, _InIt>(__time)
+ {}
+
+ typedef time_get_byname<_Ch, _InIt> _Self;
+ //explicitely defined as private to avoid warnings:
+ time_get_byname(_Self const&);
+ _Self& operator = (_Self const&);
+};
+
+// time_put facet
+
+// For the formats 'x, 'X', and 'c', do_put calls the first form of
+// put with the pattern obtained from _M_timeinfo._M_date_format or
+// _M_timeinfo._M_time_format.
+
+// Helper function: __ takes a single-character
+// format. As indicated by the foregoing remark, this will never be
+// 'x', 'X', or 'c'.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_DECLSPEC void _STLP_CALL
+__write_formatted_time(__iostring&, const ctype<char>& __ct,
+ char __format, char __modifier,
+ const _Time_Info& __table, const tm* __t);
+
+#ifndef _STLP_NO_WCHAR_T
+_STLP_DECLSPEC void _STLP_CALL
+__write_formatted_time(__iowstring&, const ctype<wchar_t>& __ct,
+ char __format, char __modifier,
+ const _WTime_Info& __table, const tm* __t);
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Ch, class _OutIt>
+class time_put : public locale::facet, public time_base, public _STLP_PRIV time_init<_Ch> {
+public:
+ typedef _Ch char_type;
+ typedef _OutIt iter_type;
+
+ explicit time_put(size_t __refs = 0) : locale::facet(__refs)
+ {}
+
+ _OutIt put(iter_type __s, ios_base& __f, _Ch __fill,
+ const tm* __tmb,
+ const _Ch* __pat, const _Ch* __pat_end) const;
+
+ _OutIt put(iter_type __s, ios_base& __f, _Ch __fill,
+ const tm* __tmb, char __format, char __modifier = 0) const
+ { return do_put(__s, __f, __fill, __tmb, __format, __modifier); }
+
+ static locale::id id;
+
+protected:
+ time_put(const char* __name, size_t __refs)
+ : locale::facet(__refs), _STLP_PRIV time_init<_Ch>(__name)
+ {}
+ time_put(_Locale_time *__time)
+ : _STLP_PRIV time_init<_Ch>(__time)
+ {}
+ ~time_put() {}
+ virtual iter_type do_put(iter_type __s, ios_base& __f,
+ char_type /* __fill */, const tm* __tmb,
+ char __format, char /* __modifier */) const;
+};
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+template <class _Ch, class _OutIt>
+#else
+template <class _Ch, class _OutIt = ostreambuf_iterator<_Ch, char_traits<_Ch> > >
+#endif
+class time_put_byname : public time_put<_Ch, _OutIt> {
+ friend class _Locale_impl;
+public:
+ typedef time_base::dateorder dateorder;
+ typedef _OutIt iter_type;
+ typedef _Ch char_type;
+
+ explicit time_put_byname(const char * __name, size_t __refs = 0)
+ : time_put<_Ch, _OutIt>(__name, __refs)
+ {}
+
+protected:
+ ~time_put_byname() {}
+
+private:
+ time_put_byname(_Locale_time *__time)
+ : time_put<_Ch, _OutIt>(__time)
+ {}
+
+ typedef time_put_byname<_Ch, _OutIt> _Self;
+ //explicitely defined as private to avoid warnings:
+ time_put_byname(_Self const&);
+ _Self& operator = (_Self const&);
+};
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS time_get<char, istreambuf_iterator<char, char_traits<char> > >;
+_STLP_EXPORT_TEMPLATE_CLASS time_put<char, ostreambuf_iterator<char, char_traits<char> > >;
+# if !defined (_STLP_NO_WCHAR_T)
+_STLP_EXPORT_TEMPLATE_CLASS time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+_STLP_EXPORT_TEMPLATE_CLASS time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
+# endif
+
+#endif
+
+_STLP_END_NAMESPACE
+
+#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_time_facets.c>
+#endif
+
+#endif /* _STLP_INTERNAL_TIME_FACETS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/_tree.c b/stlport/stl/_tree.c
similarity index 100%
rename from stl/_tree.c
rename to stlport/stl/_tree.c
diff --git a/stlport/stl/_tree.h b/stlport/stl/_tree.h
new file mode 100644
index 0000000..bf05901
--- /dev/null
+++ b/stlport/stl/_tree.h
@@ -0,0 +1,684 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_TREE_H
+#define _STLP_INTERNAL_TREE_H
+
+/*
+
+Red-black tree class, designed for use in implementing STL
+associative containers (set, multiset, map, and multimap). The
+insertion and deletion algorithms are based on those in Cormen,
+Leiserson, and Rivest, Introduction to Algorithms (MIT Press, 1990),
+except that
+
+(1) the header cell is maintained with links not only to the root
+but also to the leftmost node of the tree, to enable constant time
+begin(), and to the rightmost node of the tree, to enable linear time
+performance when used with the generic set algorithms (set_union,
+etc.);
+
+(2) when a node being deleted has two children its successor node is
+relinked into its place, rather than copied, so that the only
+iterators invalidated are those referring to the deleted node.
+
+*/
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+typedef bool _Rb_tree_Color_type;
+//const _Rb_tree_Color_type _S_rb_tree_red = false;
+//const _Rb_tree_Color_type _S_rb_tree_black = true;
+
+#define _S_rb_tree_red false
+#define _S_rb_tree_black true
+
+struct _Rb_tree_node_base {
+ typedef _Rb_tree_Color_type _Color_type;
+ typedef _Rb_tree_node_base* _Base_ptr;
+
+ _Color_type _M_color;
+ _Base_ptr _M_parent;
+ _Base_ptr _M_left;
+ _Base_ptr _M_right;
+
+ static _Base_ptr _STLP_CALL _S_minimum(_Base_ptr __x) {
+ while (__x->_M_left != 0) __x = __x->_M_left;
+ return __x;
+ }
+
+ static _Base_ptr _STLP_CALL _S_maximum(_Base_ptr __x) {
+ while (__x->_M_right != 0) __x = __x->_M_right;
+ return __x;
+ }
+};
+
+template <class _Value>
+struct _Rb_tree_node : public _Rb_tree_node_base {
+ _Value _M_value_field;
+ __TRIVIAL_STUFF(_Rb_tree_node)
+};
+
+struct _Rb_tree_base_iterator;
+
+template <class _Dummy>
+class _Rb_global {
+public:
+ typedef _Rb_tree_node_base* _Base_ptr;
+ // those used to be global functions
+ static void _STLP_CALL _Rebalance(_Base_ptr __x, _Base_ptr& __root);
+ static _Base_ptr _STLP_CALL _Rebalance_for_erase(_Base_ptr __z,
+ _Base_ptr& __root,
+ _Base_ptr& __leftmost,
+ _Base_ptr& __rightmost);
+ // those are from _Rb_tree_base_iterator - moved here to reduce code bloat
+ // moved here to reduce code bloat without templatizing _Rb_tree_base_iterator
+ static _Base_ptr _STLP_CALL _M_increment (_Base_ptr);
+ static _Base_ptr _STLP_CALL _M_decrement (_Base_ptr);
+ static void _STLP_CALL _Rotate_left (_Base_ptr __x, _Base_ptr& __root);
+ static void _STLP_CALL _Rotate_right(_Base_ptr __x, _Base_ptr& __root);
+};
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS _Rb_global<bool>;
+# endif
+
+typedef _Rb_global<bool> _Rb_global_inst;
+
+struct _Rb_tree_base_iterator {
+ typedef _Rb_tree_node_base* _Base_ptr;
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+ _Base_ptr _M_node;
+ _Rb_tree_base_iterator() : _M_node(0) {}
+ _Rb_tree_base_iterator(_Base_ptr __x) : _M_node(__x) {}
+};
+
+template <class _Value, class _Traits>
+struct _Rb_tree_iterator : public _Rb_tree_base_iterator {
+ typedef _Value value_type;
+ typedef typename _Traits::reference reference;
+ typedef typename _Traits::pointer pointer;
+ typedef _Rb_tree_iterator<_Value, _Traits> _Self;
+ typedef _Rb_tree_node_base* _Base_ptr;
+ typedef _Rb_tree_node<_Value>* _Link_type;
+
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef _Rb_tree_iterator<_Value, _NonConstTraits> iterator;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _Rb_tree_iterator<_Value, _ConstTraits> const_iterator;
+
+ _Rb_tree_iterator() {}
+#if !defined (_STLP_DEBUG)
+ /* In STL debug mode we need this constructor implicit for the pointer
+ * specialization implementation.
+ */
+ explicit
+#endif
+ _Rb_tree_iterator(_Base_ptr __x) : _Rb_tree_base_iterator(__x) {}
+ //copy constructor for iterator and constructor from iterator for const_iterator
+ _Rb_tree_iterator(const iterator& __it) : _Rb_tree_base_iterator(__it._M_node) {}
+
+ reference operator*() const {
+ return __STATIC_CAST(_Link_type, _M_node)->_M_value_field;
+ }
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ _M_node = _Rb_global_inst::_M_increment(_M_node);
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ ++(*this);
+ return __tmp;
+ }
+
+ _Self& operator--() {
+ _M_node = _Rb_global_inst::_M_decrement(_M_node);
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ --(*this);
+ return __tmp;
+ }
+
+ bool operator == (const_iterator __rhs) const {
+ return _M_node == __rhs._M_node;
+ }
+ bool operator != (const_iterator __rhs) const {
+ return _M_node != __rhs._M_node;
+ }
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Value, class _Traits>
+struct __type_traits<_STLP_PRIV _Rb_tree_iterator<_Value, _Traits> > {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Value, class _Traits>
+inline _Value* value_type(const _STLP_PRIV _Rb_tree_iterator<_Value, _Traits>&)
+{ return (_Value*)0; }
+inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _Rb_tree_base_iterator&)
+{ return bidirectional_iterator_tag(); }
+inline ptrdiff_t* distance_type(const _STLP_PRIV _Rb_tree_base_iterator&)
+{ return (ptrdiff_t*) 0; }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+// Base class to help EH
+
+template <class _Tp, class _Alloc>
+class _Rb_tree_base {
+public:
+ typedef _Rb_tree_node_base _Node_base;
+ typedef _Rb_tree_node<_Tp> _Node;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _Alloc allocator_type;
+private:
+ typedef _Rb_tree_base<_Tp, _Alloc> _Self;
+ typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator_type;
+ typedef _STLP_alloc_proxy<_Node_base, _Node, _M_node_allocator_type> _AllocProxy;
+
+public:
+ allocator_type get_allocator() const {
+ return _STLP_CONVERT_ALLOCATOR(_M_header, _Tp);
+ }
+
+protected:
+ _Rb_tree_base(const allocator_type& __a) :
+ _M_header(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base() ) {
+ _M_empty_initialize();
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Rb_tree_base(__move_source<_Self> src) :
+ _M_header(__move_source<_AllocProxy>(src.get()._M_header)) {
+ _M_rebind(&src.get()._M_header._M_data);
+ src.get()._M_empty_initialize();
+ }
+#endif
+
+ void _M_empty_initialize() {
+ _M_header._M_data._M_color = _S_rb_tree_red; // used to distinguish header from
+ // __root, in iterator.operator++
+ _M_header._M_data._M_parent = 0;
+ _M_header._M_data._M_left = &_M_header._M_data;
+ _M_header._M_data._M_right = &_M_header._M_data;
+ }
+
+ void _M_rebind(_Node_base *__static_node) {
+ if (_M_header._M_data._M_parent != 0) {
+ _M_header._M_data._M_parent->_M_parent = &_M_header._M_data;
+ }
+ if (_M_header._M_data._M_right == __static_node) {
+ _M_header._M_data._M_right = &_M_header._M_data;
+ }
+ if (_M_header._M_data._M_left == __static_node) {
+ _M_header._M_data._M_left = &_M_header._M_data;
+ }
+ }
+
+ _AllocProxy _M_header;
+};
+
+#if defined (_STLP_DEBUG)
+# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree)
+#endif
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits,
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class _Rb_tree : public _Rb_tree_base<_Value, _Alloc> {
+ typedef _Rb_tree_base<_Value, _Alloc> _Base;
+ typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self;
+protected:
+ typedef _Rb_tree_node_base * _Base_ptr;
+ typedef _Rb_tree_node<_Value> _Node;
+ typedef _Node* _Link_type;
+ typedef _Rb_tree_Color_type _Color_type;
+public:
+ typedef _Key key_type;
+ typedef _Value value_type;
+ typedef typename _Traits::pointer pointer;
+ typedef const value_type* const_pointer;
+ typedef typename _Traits::reference reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef bidirectional_iterator_tag _Iterator_category;
+ typedef typename _Base::allocator_type allocator_type;
+
+protected:
+
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+ _Base_ptr _M_create_node(const value_type& __x) {
+ _Link_type __tmp = this->_M_header.allocate(1);
+ _STLP_TRY {
+ _Copy_Construct(&__tmp->_M_value_field, __x);
+ }
+ _STLP_UNWIND(this->_M_header.deallocate(__tmp,1))
+ _S_left(__tmp) = 0;
+ _S_right(__tmp) = 0;
+ return __tmp;
+ }
+
+ _Base_ptr _M_clone_node(_Base_ptr __x) {
+ _Base_ptr __tmp = _M_create_node(_S_value(__x));
+ _S_color(__tmp) = _S_color(__x);
+ return __tmp;
+ }
+
+ size_type _M_node_count; // keeps track of size of tree
+ _Compare _M_key_compare;
+
+ _Base_ptr _M_root() const
+ { return this->_M_header._M_data._M_parent; }
+ _Base_ptr _M_leftmost() const
+ { return this->_M_header._M_data._M_left; }
+ _Base_ptr _M_rightmost() const
+ { return this->_M_header._M_data._M_right; }
+
+ _Base_ptr& _M_root()
+ { return this->_M_header._M_data._M_parent; }
+ _Base_ptr& _M_leftmost()
+ { return this->_M_header._M_data._M_left; }
+ _Base_ptr& _M_rightmost()
+ { return this->_M_header._M_data._M_right; }
+
+ static _Base_ptr& _STLP_CALL _S_left(_Base_ptr __x)
+ { return __x->_M_left; }
+ static _Base_ptr& _STLP_CALL _S_right(_Base_ptr __x)
+ { return __x->_M_right; }
+ static _Base_ptr& _STLP_CALL _S_parent(_Base_ptr __x)
+ { return __x->_M_parent; }
+ static value_type& _STLP_CALL _S_value(_Base_ptr __x)
+ { return __STATIC_CAST(_Link_type, __x)->_M_value_field; }
+ static const _Key& _STLP_CALL _S_key(_Base_ptr __x)
+ { return _KeyOfValue()(_S_value(__x));}
+ static _Color_type& _STLP_CALL _S_color(_Base_ptr __x)
+ { return (_Color_type&)(__x->_M_color); }
+
+ static _Base_ptr _STLP_CALL _S_minimum(_Base_ptr __x)
+ { return _Rb_tree_node_base::_S_minimum(__x); }
+
+ static _Base_ptr _STLP_CALL _S_maximum(_Base_ptr __x)
+ { return _Rb_tree_node_base::_S_maximum(__x); }
+
+public:
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef _Rb_tree_iterator<value_type, _NonConstTraits> iterator;
+ typedef _Rb_tree_iterator<value_type, _ConstTraits> const_iterator;
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+private:
+ iterator _M_insert(_Base_ptr __parent, const value_type& __val, _Base_ptr __on_left = 0, _Base_ptr __on_right = 0);
+ _Base_ptr _M_copy(_Base_ptr __x, _Base_ptr __p);
+ void _M_erase(_Base_ptr __x);
+
+public:
+ // allocation/deallocation
+ _Rb_tree()
+ : _Rb_tree_base<_Value, _Alloc>(allocator_type()), _M_node_count(0), _M_key_compare(_Compare())
+ {}
+
+ _Rb_tree(const _Compare& __comp)
+ : _Rb_tree_base<_Value, _Alloc>(allocator_type()), _M_node_count(0), _M_key_compare(__comp)
+ {}
+
+ _Rb_tree(const _Compare& __comp, const allocator_type& __a)
+ : _Rb_tree_base<_Value, _Alloc>(__a), _M_node_count(0), _M_key_compare(__comp)
+ {}
+
+ _Rb_tree(const _Self& __x)
+ : _Rb_tree_base<_Value, _Alloc>(__x.get_allocator()),
+ _M_node_count(0), _M_key_compare(__x._M_key_compare) {
+ if (__x._M_root() != 0) {
+ _S_color(&this->_M_header._M_data) = _S_rb_tree_red;
+ _M_root() = _M_copy(__x._M_root(), &this->_M_header._M_data);
+ _M_leftmost() = _S_minimum(_M_root());
+ _M_rightmost() = _S_maximum(_M_root());
+ }
+ _M_node_count = __x._M_node_count;
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Rb_tree(__move_source<_Self> src)
+ : _Rb_tree_base<_Value, _Alloc>(__move_source<_Base>(src.get())),
+ _M_node_count(src.get()._M_node_count),
+ _M_key_compare(_AsMoveSource(src.get()._M_key_compare))
+ { src.get()._M_node_count = 0; }
+#endif
+
+ ~_Rb_tree() { clear(); }
+ _Self& operator=(const _Self& __x);
+
+public:
+ // accessors:
+ _Compare key_comp() const { return _M_key_compare; }
+
+ iterator begin() { return iterator(_M_leftmost()); }
+ const_iterator begin() const { return const_iterator(_M_leftmost()); }
+ iterator end() { return iterator(&this->_M_header._M_data); }
+ const_iterator end() const { return const_iterator(__CONST_CAST(_Base_ptr, &this->_M_header._M_data)); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(begin()); }
+ bool empty() const { return _M_node_count == 0; }
+ size_type size() const { return _M_node_count; }
+ size_type max_size() const { return size_type(-1); }
+
+ void swap(_Self& __t) {
+ if (__t.empty()) {
+ if (this->empty()) return;
+ __t._M_header.swap(this->_M_header);
+ __t._M_rebind(&this->_M_header._M_data);
+ this->_M_empty_initialize();
+ }
+ else if (this->empty()) {
+ __t.swap(*this);
+ return;
+ }
+ else {
+ this->_M_header.swap(__t._M_header);
+ this->_M_rebind(&__t._M_header._M_data);
+ __t._M_rebind(&this->_M_header._M_data);
+ }
+ _STLP_STD::swap(_M_node_count, __t._M_node_count);
+ _STLP_STD::swap(_M_key_compare, __t._M_key_compare);
+ }
+
+public:
+ // insert/erase
+ pair<iterator,bool> insert_unique(const value_type& __x);
+ iterator insert_equal(const value_type& __x);
+
+ iterator insert_unique(iterator __pos, const value_type& __x);
+ iterator insert_equal(iterator __pos, const value_type& __x);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template<class _II> void insert_equal(_II __first, _II __last) {
+ for ( ; __first != __last; ++__first)
+ insert_equal(*__first);
+ }
+ template<class _II> void insert_unique(_II __first, _II __last) {
+ for ( ; __first != __last; ++__first)
+ insert_unique(*__first);
+ }
+#else
+ void insert_unique(const_iterator __first, const_iterator __last) {
+ for ( ; __first != __last; ++__first)
+ insert_unique(*__first);
+ }
+ void insert_unique(const value_type* __first, const value_type* __last) {
+ for ( ; __first != __last; ++__first)
+ insert_unique(*__first);
+ }
+ void insert_equal(const_iterator __first, const_iterator __last) {
+ for ( ; __first != __last; ++__first)
+ insert_equal(*__first);
+ }
+ void insert_equal(const value_type* __first, const value_type* __last) {
+ for ( ; __first != __last; ++__first)
+ insert_equal(*__first);
+ }
+#endif
+
+ void erase(iterator __pos) {
+ _Base_ptr __x = _Rb_global_inst::_Rebalance_for_erase(__pos._M_node,
+ this->_M_header._M_data._M_parent,
+ this->_M_header._M_data._M_left,
+ this->_M_header._M_data._M_right);
+ _STLP_STD::_Destroy(&_S_value(__x));
+ this->_M_header.deallocate(__STATIC_CAST(_Link_type, __x), 1);
+ --_M_node_count;
+ }
+
+ size_type erase(const key_type& __x) {
+ pair<iterator,iterator> __p = equal_range(__x);
+ size_type __n = _STLP_STD::distance(__p.first, __p.second);
+ erase(__p.first, __p.second);
+ return __n;
+ }
+
+ size_type erase_unique(const key_type& __x) {
+ iterator __i = find(__x);
+ if (__i._M_node != &this->_M_header._M_data) {
+ erase(__i);
+ return 1;
+ }
+ return 0;
+ }
+
+ void erase(iterator __first, iterator __last) {
+ if (__first._M_node == this->_M_header._M_data._M_left && // begin()
+ __last._M_node == &this->_M_header._M_data) // end()
+ clear();
+ else
+ while (__first != __last) erase(__first++);
+ }
+
+ void erase(const key_type* __first, const key_type* __last) {
+ while (__first != __last) erase(*__first++);
+ }
+
+ void clear() {
+ if (_M_node_count != 0) {
+ _M_erase(_M_root());
+ _M_leftmost() = &this->_M_header._M_data;
+ _M_root() = 0;
+ _M_rightmost() = &this->_M_header._M_data;
+ _M_node_count = 0;
+ }
+ }
+
+public:
+ // set operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __k) { return iterator(_M_find(__k)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __k) const { return const_iterator(_M_find(__k)); }
+private:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Base_ptr _M_find(const _KT& __k) const {
+ _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); // Last node which is not less than __k.
+ _Base_ptr __x = _M_root(); // Current node.
+
+ while (__x != 0)
+ if (!_M_key_compare(_S_key(__x), __k))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+
+ if (__y != &this->_M_header._M_data) {
+ if (_M_key_compare(__k, _S_key(__y))) {
+ __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data);
+ }
+ }
+ return __y;
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Base_ptr _M_lower_bound(const _KT& __k) const {
+ _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); /* Last node which is not less than __k. */
+ _Base_ptr __x = _M_root(); /* Current node. */
+
+ while (__x != 0)
+ if (!_M_key_compare(_S_key(__x), __k))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+
+ return __y;
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Base_ptr _M_upper_bound(const _KT& __k) const {
+ _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); /* Last node which is greater than __k. */
+ _Base_ptr __x = _M_root(); /* Current node. */
+
+ while (__x != 0)
+ if (_M_key_compare(__k, _S_key(__x)))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+
+ return __y;
+ }
+
+public:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const {
+ pair<const_iterator, const_iterator> __p = equal_range(__x);
+ return _STLP_STD::distance(__p.first, __p.second);
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x) { return iterator(_M_lower_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const { return const_iterator(_M_lower_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x) { return iterator(_M_upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const { return const_iterator(_M_upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range(const _KT& __x)
+ { return pair<iterator, iterator>(lower_bound(__x), upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const
+ { return pair<const_iterator, const_iterator>(lower_bound(__x), upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range_unique(const _KT& __x) {
+ pair<iterator, iterator> __p;
+ __p.second = lower_bound(__x);
+ if (__p.second._M_node != &this->_M_header._M_data &&
+ !_M_key_compare(__x, _S_key(__p.second._M_node))) {
+ __p.first = __p.second++;
+ }
+ else {
+ __p.first = __p.second;
+ }
+ return __p;
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range_unique(const _KT& __x) const {
+ pair<const_iterator, const_iterator> __p;
+ __p.second = lower_bound(__x);
+ if (__p.second._M_node != &this->_M_header._M_data &&
+ !_M_key_compare(__x, _S_key(__p.second._M_node))) {
+ __p.first = __p.second++;
+ }
+ else {
+ __p.first = __p.second;
+ }
+ return __p;
+ }
+
+#if defined (_STLP_DEBUG)
+public:
+ // Debugging.
+ bool __rb_verify() const;
+#endif //_STLP_DEBUG
+};
+
+#if defined (_STLP_DEBUG)
+# undef _Rb_tree
+#endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_tree.c>
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_tree.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Compare, class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER _STLP_PRIV _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Key, class _Compare, class _Value, class _KeyOfValue, class _Traits, class _Alloc>
+struct __move_traits<_STLP_PRIV _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> >
+ : _STLP_PRIV __move_traits_help2<_Compare, _Alloc> {};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_TREE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_typeinfo.h b/stlport/stl/_typeinfo.h
new file mode 100644
index 0000000..843ba56
--- /dev/null
+++ b/stlport/stl/_typeinfo.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_INTERNAL_TYPEINFO
+#define _STLP_INTERNAL_TYPEINFO
+
+#if !defined (_STLP_NO_TYPEINFO)
+
+# if defined (_STLP_NO_NEW_NEW_HEADER)
+# include <typeinfo.h>
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <typeinfo>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo)
+# endif
+# endif
+
+# if (defined(_STLP_MSVC) && (_STLP_MSVC >= 1300)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800))
+// In .NET, <typeinfo> actually includes <typeinfo.h>
+# undef _STLP_OLDSTD_typeinfo
+# endif
+
+// if <typeinfo.h> already included, do not import anything
+# if defined(_STLP_USE_NAMESPACES) && !defined(_STLP_OLDSTD_typeinfo) && \
+ (defined(_STLP_VENDOR_GLOBAL_EXCEPT_STD) || \
+ defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_DEBUG))
+# if defined(_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined(_STLP_WCE_NET)
+class bad_cast : public exception {};
+# endif
+
+_STLP_BEGIN_NAMESPACE
+// VC 6 and eVC 4 have type_info in the global namespace
+# if (defined(_STLP_MSVC) && (_STLP_MSVC < 1300)) || defined(_STLP_WCE_NET)
+using ::type_info;
+# else
+using _STLP_VENDOR_EXCEPT_STD::type_info;
+# endif
+
+# if !defined (__DMC__)
+using _STLP_VENDOR_EXCEPT_STD::bad_typeid;
+# endif
+
+# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined (_STLP_WCE_NET)
+using ::bad_cast;
+# else
+using _STLP_VENDOR_EXCEPT_STD::bad_cast;
+# endif
+
+_STLP_END_NAMESPACE
+
+# endif
+
+#else
+
+# ifndef _STLP_INTERNAL_EXCEPTION
+# include <stl/_exception.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+# if !defined (__DMC__)
+struct bad_cast : exception {};
+# endif
+_STLP_END_NAMESPACE
+#endif
+
+#endif
diff --git a/stlport/stl/_uninitialized.h b/stlport/stl/_uninitialized.h
new file mode 100644
index 0000000..5489a94
--- /dev/null
+++ b/stlport/stl/_uninitialized.h
@@ -0,0 +1,443 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+#define _STLP_INTERNAL_UNINITIALIZED_H
+
+#ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+// uninitialized_copy
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, _Distance*) {
+ _OutputIter __cur = __result;
+ _STLP_TRY {
+ for ( ; __first != __last; ++__first, ++__cur)
+ _Param_Construct(&*__cur, *__first);
+ return __cur;
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur))
+ _STLP_RET_AFTER_THROW(__cur)
+}
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const input_iterator_tag &, _Distance* __d)
+{ return __ucopy(__first, __last, __result, __d); }
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const forward_iterator_tag &, _Distance* __d)
+{ return __ucopy(__first, __last, __result, __d); }
+
+template <class _InputIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_InputIter __first, _InputIter __last,
+ _OutputIter __result, const bidirectional_iterator_tag &, _Distance* __d)
+{ return __ucopy(__first, __last, __result, __d); }
+#endif
+
+template <class _RandomAccessIter, class _OutputIter, class _Distance>
+inline _OutputIter __ucopy(_RandomAccessIter __first, _RandomAccessIter __last,
+ _OutputIter __result, const random_access_iterator_tag &, _Distance*) {
+ _OutputIter __cur = __result;
+ _STLP_TRY {
+ for (_Distance __n = __last - __first; __n > 0; --__n) {
+ _Param_Construct(&*__cur, *__first);
+ ++__first;
+ ++__cur;
+ }
+ return __cur;
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur))
+ _STLP_RET_AFTER_THROW(__cur)
+}
+
+//Used internaly
+template <class _RandomAccessIter, class _OutputIter>
+inline _OutputIter __ucopy(_RandomAccessIter __first, _RandomAccessIter __last, _OutputIter __result)
+{ return __ucopy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); }
+
+inline void*
+__ucopy_trivial(const void* __first, const void* __last, void* __result) {
+ //dums: this version can use memcpy (__copy_trivial can't)
+ return (__last == __first) ? __result :
+ ((char*)memcpy(__result, __first, ((const char*)__last - (const char*)__first))) +
+ ((const char*)__last - (const char*)__first);
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __ucopy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __false_type& /*TrivialUCopy*/)
+{ return __ucopy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); }
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __ucopy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __true_type& /*TrivialUCopy*/) {
+ // we know they all pointers, so this cast is OK
+ // return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result));
+ return (_OutputIter)__ucopy_trivial(__first, __last, __result);
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __ucopy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __true_type& /*BothPtrType*/) {
+ return __ucopy_ptrs(__first, __last, __result,
+ _UseTrivialUCopy(_STLP_VALUE_TYPE(__first, _InputIter),
+ _STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
+}
+
+template <class _InputIter, class _OutputIter>
+inline _OutputIter __ucopy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
+ const __false_type& /*BothPtrType*/) {
+ return __ucopy(__first, __last, __result,
+ _STLP_ITERATOR_CATEGORY(__first, _InputIter),
+ _STLP_DISTANCE_TYPE(__first, _InputIter));
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _ForwardIter>
+inline _ForwardIter
+uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result)
+{ return _STLP_PRIV __ucopy_aux(__first, __last, __result, _BothPtrType< _InputIter, _ForwardIter>::_Answer()); }
+
+inline char*
+uninitialized_copy(const char* __first, const char* __last, char* __result)
+{ return (char*)_STLP_PRIV __ucopy_trivial(__first, __last, __result); }
+
+# if defined (_STLP_HAS_WCHAR_T) // dwa 8/15/97
+inline wchar_t*
+uninitialized_copy(const wchar_t* __first, const wchar_t* __last, wchar_t* __result)
+{ return (wchar_t*)_STLP_PRIV __ucopy_trivial (__first, __last, __result); }
+# endif
+
+// uninitialized_copy_n (not part of the C++ standard)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter, class _Size, class _ForwardIter>
+_STLP_INLINE_LOOP
+pair<_InputIter, _ForwardIter>
+__ucopy_n(_InputIter __first, _Size __count, _ForwardIter __result,
+ const input_iterator_tag &) {
+ _ForwardIter __cur = __result;
+ _STLP_TRY {
+ for ( ; __count > 0 ; --__count, ++__first, ++__cur)
+ _Param_Construct(&*__cur, *__first);
+ return pair<_InputIter, _ForwardIter>(__first, __cur);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur))
+ _STLP_RET_AFTER_THROW((pair<_InputIter, _ForwardIter>(__first, __cur)))
+}
+
+# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _InputIter, class _Size, class _ForwardIterator>
+inline pair<_InputIter, _ForwardIterator>
+__ucopy_n(_InputIter __first, _Size __count,
+ _ForwardIterator __result,
+ const forward_iterator_tag &)
+{ return __ucopy_n(__first, __count, __result, input_iterator_tag()); }
+
+template <class _InputIter, class _Size, class _ForwardIterator>
+inline pair<_InputIter, _ForwardIterator>
+__ucopy_n(_InputIter __first, _Size __count,
+ _ForwardIterator __result,
+ const bidirectional_iterator_tag &)
+{ return __ucopy_n(__first, __count, __result, input_iterator_tag()); }
+# endif
+
+template <class _RandomAccessIter, class _Size, class _ForwardIter>
+inline pair<_RandomAccessIter, _ForwardIter>
+__ucopy_n(_RandomAccessIter __first, _Size __count, _ForwardIter __result,
+ const random_access_iterator_tag &) {
+ _RandomAccessIter __last = __first + __count;
+ return pair<_RandomAccessIter, _ForwardIter>(__last, uninitialized_copy(__first, __last, __result));
+}
+
+// This is used internally in <rope> , which is extension itself.
+template <class _InputIter, class _Size, class _ForwardIter>
+inline pair<_InputIter, _ForwardIter>
+__ucopy_n(_InputIter __first, _Size __count, _ForwardIter __result)
+{ return _STLP_PRIV __ucopy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
+
+#if !defined (_STLP_NO_EXTENSIONS)
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _InputIter, class _Size, class _ForwardIter>
+inline pair<_InputIter, _ForwardIter>
+uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result)
+{ return _STLP_PRIV __ucopy_n(__first, __count, __result); }
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#endif
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x, _Distance*) {
+ _ForwardIter __cur = __first;
+ _STLP_TRY {
+ for ( ; __cur != __last; ++__cur)
+ _Param_Construct(&*__cur, __x);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur))
+}
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __x, const input_iterator_tag &, _Distance* __d)
+{ __ufill(__first, __last, __x, __d); }
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __x, const forward_iterator_tag &, _Distance* __d)
+{ __ufill(__first, __last, __x, __d); }
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __x, const bidirectional_iterator_tag &, _Distance* __d)
+{ __ufill(__first, __last, __x, __d); }
+#endif
+
+template <class _ForwardIter, class _Tp, class _Distance>
+inline void __ufill(_ForwardIter __first, _ForwardIter __last,
+ const _Tp& __x, const random_access_iterator_tag &, _Distance*) {
+ _ForwardIter __cur = __first;
+ _STLP_TRY {
+ for (_Distance __n = __last - __first; __n > 0; --__n, ++__cur)
+ _Param_Construct(&*__cur, __x);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur))
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Tp>
+inline void uninitialized_fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x) {
+ _STLP_PRIV __ufill(__first, __last, __x,
+ _STLP_ITERATOR_CATEGORY(__first, _ForwardIter),
+ _STLP_DISTANCE_TYPE(__first, _ForwardIter));
+}
+
+// Specialization: for one-byte types we can use memset.
+inline void uninitialized_fill(unsigned char* __first, unsigned char* __last,
+ const unsigned char& __val) {
+ unsigned char __tmp = __val;
+ memset(__first, __tmp, __last - __first);
+}
+#if !defined (_STLP_NO_SIGNED_BUILTINS)
+inline void uninitialized_fill(signed char* __first, signed char* __last,
+ const signed char& __val) {
+ signed char __tmp = __val;
+ memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
+}
+#endif
+inline void uninitialized_fill(char* __first, char* __last, const char& __val) {
+ char __tmp = __val;
+ memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
+}
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x) {
+ _ForwardIter __cur = __first;
+ _STLP_TRY {
+ for ( ; __n > 0; --__n, ++__cur)
+ _Param_Construct(&*__cur, __x);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur))
+ return __cur;
+}
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
+ const input_iterator_tag &)
+{ return __ufill_n(__first, __n, __x); }
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
+ const forward_iterator_tag &)
+{ return __ufill_n(__first, __n, __x); }
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
+ const bidirectional_iterator_tag &)
+{ return __ufill_n(__first, __n, __x); }
+#endif
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x) {
+ _ForwardIter __last = __first + __n;
+ __ufill(__first, __last, __x, random_access_iterator_tag(), (ptrdiff_t*)0);
+ return __last;
+}
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x,
+ const random_access_iterator_tag &)
+{ return __uninitialized_fill_n(__first, __n, __x); }
+
+/* __uninitialized_init is an internal algo to init a range with a value
+ * built using default constructor. It is only called with pointer as
+ * iterator.
+ */
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uinit_aux_aux(_ForwardIter __first, _Size __n, const _Tp& __val,
+ const __false_type& /*_HasDefaultZero*/)
+{ return __uninitialized_fill_n(__first, __n, __val); }
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uinit_aux_aux(_ForwardIter __first, _Size __n, const _Tp& /* __val */,
+ const __true_type& /*_HasDefaultZero*/) {
+ memset((unsigned char*)__first, 0, __n * sizeof(_Tp));
+ return __first + __n;
+}
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uinit_aux(_ForwardIter __first, _Size __n, const _Tp&,
+ const __true_type& /*_TrivialInit*/)
+{ return __first + __n; }
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uinit_aux(_ForwardIter __first, _Size __n, const _Tp& __val,
+ const __false_type& /*_TrivialInit*/)
+{ return __uinit_aux_aux(__first, __n, __val, _HasDefaultZeroValue(__first)._Answer()); }
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline _ForwardIter __uninitialized_init(_ForwardIter __first, _Size __n, const _Tp& __val)
+{ return __uinit_aux(__first, __n, __val, _UseTrivialInit(__first)._Answer()); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _ForwardIter, class _Size, class _Tp>
+inline void
+uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x)
+{ _STLP_PRIV __ufill_n(__first, __n, __x, _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); }
+
+// Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill,
+// __uninitialized_fill_copy.
+
+// __uninitialized_copy_copy
+// Copies [first1, last1) into [result, result + (last1 - first1)), and
+// copies [first2, last2) into
+// [result + (last1 - first1), result + (last1 - first1) + (last2 - first2)).
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _InputIter1, class _InputIter2, class _ForwardIter>
+inline _ForwardIter
+__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1,
+ _InputIter2 __first2, _InputIter2 __last2,
+ _ForwardIter __result) {
+ _ForwardIter __new_result = uninitialized_copy(__first1, __last1, __result);
+ _STLP_TRY {
+ return uninitialized_copy(__first2, __last2, __new_result);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __new_result))
+ _STLP_RET_AFTER_THROW(__result)
+}
+
+// __uninitialized_fill_copy
+// Fills [result, mid) with x, and copies [first, last) into
+// [mid, mid + (last - first)).
+template <class _ForwardIter, class _Tp, class _InputIter>
+inline _ForwardIter
+__uninitialized_fill_copy(_ForwardIter __result, _ForwardIter __mid, const _Tp& __x,
+ _InputIter __first, _InputIter __last) {
+ uninitialized_fill(__result, __mid, __x);
+ _STLP_TRY {
+ return uninitialized_copy(__first, __last, __mid);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __mid))
+ _STLP_RET_AFTER_THROW(__result)
+}
+
+// __uninitialized_copy_fill
+// Copies [first1, last1) into [first2, first2 + (last1 - first1)), and
+// fills [first2 + (last1 - first1), last2) with x.
+template <class _Iter, class _Tp>
+inline void
+__uninitialized_copy_fill(_Iter __first1, _Iter __last1, _Iter __first2, _Iter __last2,
+ const _Tp& __x) {
+ _Iter __mid2 = uninitialized_copy(__first1, __last1, __first2);
+ _STLP_TRY {
+ uninitialized_fill(__mid2, __last2, __x);
+ }
+ _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first2, __mid2))
+}
+
+/* __uninitialized_move:
+ * This function is used internaly and only with pointers as iterators.
+ */
+template <class _InputIter, class _ForwardIter, class _TrivialUCpy>
+inline _ForwardIter
+__uninitialized_move(_InputIter __first, _InputIter __last, _ForwardIter __result,
+ _TrivialUCpy __trivial_ucpy, const __false_type& /*_Movable*/)
+{ return __ucopy_ptrs(__first, __last, __result, __trivial_ucpy); }
+
+template <class _InputIter, class _ForwardIter, class _TrivialUCpy>
+_STLP_INLINE_LOOP
+_ForwardIter
+__uninitialized_move(_InputIter __first, _InputIter __last, _ForwardIter __result,
+ _TrivialUCpy , const __true_type& /*_Movable*/) {
+ //Move constructor should not throw so we do not need to take care of exceptions here.
+ for (ptrdiff_t __n = __last - __first ; __n > 0; --__n) {
+ _Move_Construct(&*__result, *__first);
+ ++__first; ++__result;
+ }
+ return __result;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_UNINITIALIZED_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_unordered_map.h b/stlport/stl/_unordered_map.h
new file mode 100644
index 0000000..f2b017d
--- /dev/null
+++ b/stlport/stl/_unordered_map.h
@@ -0,0 +1,443 @@
+/*
+ * Copyright (c) 2004
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_UNORDERED_MAP_H
+#define _STLP_INTERNAL_UNORDERED_MAP_H
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMapTraitsT, traits)
+
+_STLP_BEGIN_TR1_NAMESPACE
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Key>),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class unordered_map
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+private:
+ typedef unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST key_type, data_type> value_type;
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _UnorderedMapTraitsT<value_type> _UnorderedMapTraits;
+
+public:
+ typedef hashtable<value_type, key_type, _HashFcn, _UnorderedMapTraits,
+ _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
+
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+ typedef typename _Ht::local_iterator local_iterator;
+ typedef typename _Ht::const_local_iterator const_local_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_function() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ explicit unordered_map(size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ unordered_map(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ unordered_map(_InputIterator __f, _InputIterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#else
+ unordered_map(const value_type* __f, const value_type* __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ unordered_map(const_iterator __f, const_iterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ _Self& operator = (const _Self& __other)
+ { _M_ht = __other._M_ht; return *this; }
+
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+ pair<iterator,bool> insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+ iterator insert(const_iterator /*__hint*/, const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+#else
+ void insert(const value_type* __f, const value_type* __l)
+ { _M_ht.insert_unique(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+#endif /*_STLP_MEMBER_TEMPLATES */
+ { _M_ht.insert_unique(__f, __l); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ _Tp& operator[](const _KT& __key) {
+ iterator __it = _M_ht.find(__key);
+ return (__it == _M_ht.end() ?
+ _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second :
+ (*__it).second );
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
+ void erase(const_iterator __it) { _M_ht.erase(__it); }
+ void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
+ local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
+ local_iterator end(size_type __n) { return _M_ht.end(__n); }
+ const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
+ const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
+
+ float load_factor() const { return _M_ht.load_factor(); }
+ float max_load_factor() const { return _M_ht.max_load_factor(); }
+ void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
+ void rehash(size_type __hint) { _M_ht.rehash(__hint); }
+
+#if defined (__DMC__) // disable operator==(pair<x,unordered_map>, pair<x,unordered_map>)
+ bool operator==(const _Self&) const;
+#endif
+};
+
+_STLP_END_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultimapTraitsT, traits)
+
+_STLP_BEGIN_TR1_NAMESPACE
+
+template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Key>),
+ _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
+class unordered_multimap
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<unordered_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+private:
+ typedef unordered_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef pair<_STLP_CONST key_type, data_type> value_type;
+private:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _UnorderedMultimapTraitsT<value_type> _UnorderedMultimapTraits;
+
+public:
+ typedef hashtable<value_type, key_type, _HashFcn, _UnorderedMultimapTraits,
+ _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht;
+
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+ typedef typename _Ht::local_iterator local_iterator;
+ typedef typename _Ht::const_local_iterator const_local_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_function() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ explicit unordered_multimap(size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ unordered_multimap(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ unordered_multimap(_InputIterator __f, _InputIterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#else
+ unordered_multimap(const value_type* __f, const value_type* __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ unordered_multimap(const_iterator __f, const_iterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ _Self& operator = (const _Self& __other)
+ { _M_ht = __other._M_ht; return *this; }
+
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+ iterator insert(const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+ iterator insert(const_iterator /*__hint*/, const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+#else
+ void insert(const value_type* __f, const value_type* __l)
+ { _M_ht.insert_equal(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+#endif /*_STLP_MEMBER_TEMPLATES */
+ { _M_ht.insert_equal(__f, __l); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
+ void erase(const_iterator __it) { _M_ht.erase(__it); }
+ void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
+ local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
+ local_iterator end(size_type __n) { return _M_ht.end(__n); }
+ const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
+ const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
+
+ float load_factor() const { return _M_ht.load_factor(); }
+ float max_load_factor() const { return _M_ht.max_load_factor(); }
+ void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
+ void rehash(size_type __hint) { _M_ht.rehash(__hint); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER unordered_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
+
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER unordered_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
+
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+_STLP_END_NAMESPACE
+
+// Specialization of insert_iterator so that it will work for unordered_map
+// and unordered_multimap.
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+struct __move_traits<_STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
+ _STLP_PRIV __move_traits_help<typename _STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
+{};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+struct __move_traits<_STLP_TR1 unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
+ _STLP_PRIV __move_traits_help<typename _STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
+{};
+# endif
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<_STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef _STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
+ _Container* container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+class insert_iterator<_STLP_TR1 unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
+protected:
+ typedef _STLP_TR1 unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_UNORDERED_MAP_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_unordered_set.h b/stlport/stl/_unordered_set.h
new file mode 100644
index 0000000..ef5f5fe
--- /dev/null
+++ b/stlport/stl/_unordered_set.h
@@ -0,0 +1,418 @@
+/*
+ * Copyright (c) 2004
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_UNORDERED_SET_H
+#define _STLP_INTERNAL_UNORDERED_SET_H
+
+#ifndef _STLP_INTERNAL_HASHTABLE_H
+# include <stl/_hashtable.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedSetTraitsT, Const_traits)
+
+_STLP_BEGIN_TR1_NAMESPACE
+
+template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class unordered_set
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+ typedef unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _UnorderedSetTraitsT<_Value> _UnorderedSetTraits;
+public:
+ typedef hashtable<_Value, _Value, _HashFcn,
+ _UnorderedSetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
+public:
+ typedef typename _Ht::key_type key_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+ typedef typename _Ht::local_iterator local_iterator;
+ typedef typename _Ht::const_local_iterator const_local_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_function() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ explicit unordered_set(size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ unordered_set(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ unordered_set(_InputIterator __f, _InputIterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#else
+ unordered_set(const value_type* __f, const value_type* __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ unordered_set(const_iterator __f, const_iterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ _Self& operator = (const _Self& __other)
+ { _M_ht = __other._M_ht; return *this; }
+
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+ pair<iterator, bool> insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+ iterator insert(const_iterator /*__hint*/, const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+#else
+ void insert(const_iterator __f, const_iterator __l)
+ {_M_ht.insert_unique(__f, __l); }
+ void insert(const value_type* __f, const value_type* __l)
+#endif
+ { _M_ht.insert_unique(__f,__l); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
+ void erase(const_iterator __it) { _M_ht.erase(__it); }
+ void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
+ local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
+ local_iterator end(size_type __n) { return _M_ht.end(__n); }
+ const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
+ const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
+
+ float load_factor() const { return _M_ht.load_factor(); }
+ float max_load_factor() const { return _M_ht.max_load_factor(); }
+ void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
+ void rehash(size_type __hint) { _M_ht.rehash(__hint); }
+};
+
+_STLP_END_NAMESPACE
+
+//Specific iterator traits creation
+_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultisetTraitsT, Const_traits)
+
+_STLP_BEGIN_TR1_NAMESPACE
+
+template <class _Value, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
+ _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class unordered_multiset
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> >
+#endif
+{
+ typedef unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _UnorderedMultisetTraitsT<_Value> _UnorderedMultisetTraits;
+public:
+ typedef hashtable<_Value, _Value, _HashFcn,
+ _UnorderedMultisetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht;
+
+ typedef typename _Ht::key_type key_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+ typedef typename _Ht::local_iterator local_iterator;
+ typedef typename _Ht::const_local_iterator const_local_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher hash_function() const { return _M_ht.hash_funct(); }
+ key_equal key_eq() const { return _M_ht.key_eq(); }
+ allocator_type get_allocator() const { return _M_ht.get_allocator(); }
+
+private:
+ _Ht _M_ht;
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ explicit unordered_multiset(size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ unordered_multiset(__move_source<_Self> src)
+ : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ unordered_multiset(_InputIterator __f, _InputIterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#else
+ unordered_multiset(const value_type* __f, const value_type* __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ unordered_multiset(const_iterator __f, const_iterator __l,
+ size_type __n = 0, const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+#endif /*_STLP_MEMBER_TEMPLATES */
+
+ _Self& operator = (const _Self& __other)
+ { _M_ht = __other._M_ht; return *this; }
+
+ size_type size() const { return _M_ht.size(); }
+ size_type max_size() const { return _M_ht.max_size(); }
+ bool empty() const { return _M_ht.empty(); }
+ void swap(_Self& hs) { _M_ht.swap(hs._M_ht); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ iterator begin() { return _M_ht.begin(); }
+ iterator end() { return _M_ht.end(); }
+ const_iterator begin() const { return _M_ht.begin(); }
+ const_iterator end() const { return _M_ht.end(); }
+
+ iterator insert(const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+ iterator insert(const_iterator /*__hint*/, const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __f, _InputIterator __l)
+#else
+ void insert(const value_type* __f, const value_type* __l)
+ { _M_ht.insert_equal(__f,__l); }
+ void insert(const_iterator __f, const_iterator __l)
+#endif /*_STLP_MEMBER_TEMPLATES */
+ { _M_ht.insert_equal(__f, __l); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key) { return _M_ht.find(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_ht.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key)
+ { return _M_ht.equal_range(__key); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
+ void erase(const_iterator __it) { _M_ht.erase(__it); }
+ void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
+ void clear() { _M_ht.clear(); }
+
+ size_type bucket_count() const { return _M_ht.bucket_count(); }
+ size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
+ size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
+ local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
+ local_iterator end(size_type __n) { return _M_ht.end(__n); }
+ const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
+ const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
+
+ float load_factor() const { return _M_ht.load_factor(); }
+ float max_load_factor() const { return _M_ht.max_load_factor(); }
+ void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
+ void rehash(size_type __hint) { _M_ht.rehash(__hint); }
+};
+
+#define _STLP_TEMPLATE_HEADER template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER unordered_set<_Value,_HashFcn,_EqualKey,_Alloc>
+
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#define _STLP_TEMPLATE_CONTAINER unordered_multiset<_Value,_HashFcn,_EqualKey,_Alloc>
+#include <stl/_relops_hash_cont.h>
+
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+_STLP_END_NAMESPACE
+
+// Specialization of insert_iterator so that it will work for unordered_set
+// and unordered_multiset.
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+struct __move_traits<_STLP_TR1 unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename _STLP_TR1 unordered_set<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
+{};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+struct __move_traits<_STLP_TR1 unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > :
+ _STLP_PRIV __move_traits_aux<typename _STLP_TR1 unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc>::_Ht>
+{};
+# endif
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<_STLP_TR1 unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef _STLP_TR1 unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
+ _Container* container;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+
+template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+class insert_iterator<_STLP_TR1 unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > {
+protected:
+ typedef _STLP_TR1 unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x) : container(&__x) {}
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __val) {
+ container->insert(__val);
+ return *this;
+ }
+ insert_iterator<_Container>& operator*() { return *this; }
+ insert_iterator<_Container>& operator++() { return *this; }
+ insert_iterator<_Container>& operator++(int) { return *this; }
+};
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_INTERNAL_UNORDERED_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/stl/_valarray.c b/stlport/stl/_valarray.c
new file mode 100644
index 0000000..ee534a9
--- /dev/null
+++ b/stlport/stl/_valarray.c
@@ -0,0 +1,191 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_VALARRAY_C
+#define _STLP_VALARRAY_C
+
+#ifndef _STLP_VALARRAY_H
+# include <stl/_valarray.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp>
+_Valarray_bool valarray<_Tp>:: operator!() const {
+ _Valarray_bool __tmp(this->size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ __tmp[__i] = !(*this)[__i];
+ return __tmp;
+}
+
+// Behavior is undefined if __x and *this have different sizes
+template <class _Tp>
+valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<_Tp>& __x) {
+ _STLP_ASSERT(__x._M_slice.size() == this->size())
+ size_t __index = __x._M_slice.start();
+ for (size_t __i = 0;
+ __i < __x._M_slice.size();
+ ++__i, __index += __x._M_slice.stride())
+ (*this)[__i] = __x._M_array[__index];
+ return *this;
+}
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::operator[](slice __slice) const {
+ valarray<_Tp> __tmp(__slice.size(), _NoInit());
+ size_t __index = __slice.start();
+ for (size_t __i = 0;
+ __i < __slice.size();
+ ++__i, __index += __slice.stride())
+ __tmp[__i] = (*this)[__index];
+ return __tmp;
+}
+
+template <class _Size>
+bool _Gslice_Iter_tmpl<_Size>::_M_incr() {
+ size_t __dim = _M_indices.size() - 1;
+ ++_M_step;
+ for (;;) {
+ _M_1d_idx += _M_gslice._M_strides[__dim];
+ if (++_M_indices[__dim] != _M_gslice._M_lengths[__dim])
+ return true;
+ else if (__dim != 0) {
+ _M_1d_idx -= _M_gslice._M_strides[__dim] * _M_gslice._M_lengths[__dim];
+ _M_indices[__dim] = 0;
+ --__dim;
+ }
+ else
+ return false;
+ }
+}
+
+// Behavior is undefined if __x and *this have different sizes, or if
+// __x was constructed from a degenerate gslice.
+template <class _Tp>
+valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<_Tp>& __x) {
+ if (this->size() != 0) {
+ _Gslice_Iter __i(__x._M_gslice);
+ do
+ (*this)[__i._M_step] = __x._M_array[__i._M_1d_idx];
+ while(__i._M_incr());
+ }
+ return *this;
+}
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::operator[](const gslice& __slice) const {
+ valarray<_Tp> __tmp(__slice._M_size(), _NoInit());
+ if (__tmp.size() != 0) {
+ _Gslice_Iter __i(__slice);
+ do __tmp[__i._M_step] = (*this)[__i._M_1d_idx]; while(__i._M_incr());
+ }
+ return __tmp;
+}
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask) const {
+ size_t _p_size = 0;
+ {
+ for (size_t __i = 0; __i < __mask.size(); ++__i)
+ if (__mask[__i]) ++_p_size;
+ }
+
+ valarray<_Tp> __tmp(_p_size, _NoInit());
+ size_t __idx = 0;
+ {
+ for (size_t __i = 0; __i < __mask.size(); ++__i)
+ if (__mask[__i]) __tmp[__idx++] = (*this)[__i];
+ }
+
+ return __tmp;
+}
+
+template <class _Tp>
+valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<_Tp>& __x) {
+ _STLP_ASSERT(__x._M_addr.size() == this->size())
+ for (size_t __i = 0; __i < __x._M_addr.size(); ++__i)
+ (*this)[__i] = __x._M_array[__x._M_addr[__i]];
+ return *this;
+}
+
+template <class _Tp>
+valarray<_Tp>
+valarray<_Tp>::operator[](const _Valarray_size_t& __addr) const {
+ valarray<_Tp> __tmp(__addr.size(), _NoInit());
+ for (size_t __i = 0; __i < __addr.size(); ++__i)
+ __tmp[__i] = (*this)[__addr[__i]];
+ return __tmp;
+}
+
+//----------------------------------------------------------------------
+// Other valarray noninline member functions
+
+// Shift and cshift
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::shift(int __n) const {
+ valarray<_Tp> __tmp(this->size());
+
+ if (__n >= 0) {
+ if (__n < this->size())
+ copy(this->_M_first + __n, this->_M_first + this->size(),
+ __tmp._M_first);
+ }
+ else {
+ if (-__n < this->size())
+ copy(this->_M_first, this->_M_first + this->size() + __n,
+ __tmp._M_first - __n);
+ }
+ return __tmp;
+}
+
+template <class _Tp>
+valarray<_Tp> valarray<_Tp>::cshift(int __m) const {
+ valarray<_Tp> __tmp(this->size());
+
+ // Reduce __m to an equivalent number in the range [0, size()). We
+ // have to be careful with negative numbers, since the sign of a % b
+ // is unspecified when a < 0.
+ long __n = __m;
+ if (this->size() < (numeric_limits<long>::max)())
+ __n %= long(this->size());
+ if (__n < 0)
+ __n += this->size();
+
+ copy(this->_M_first, this->_M_first + __n,
+ __tmp._M_first + (this->size() - __n));
+ copy(this->_M_first + __n, this->_M_first + this->size(),
+ __tmp._M_first);
+
+ return __tmp;
+}
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_VALARRAY_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_valarray.h b/stlport/stl/_valarray.h
new file mode 100644
index 0000000..cd9641a
--- /dev/null
+++ b/stlport/stl/_valarray.h
@@ -0,0 +1,1684 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_VALARRAY_H
+#define _STLP_VALARRAY_H
+
+#ifndef _STLP_INTERNAL_CMATH
+# include <stl/_cmath.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NEW
+# include <stl/_new.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALGO_H
+# include <stl/_algo.h>
+#endif
+
+#ifndef _STLP_INTERNAL_NUMERIC_H
+# include <stl/_numeric.h>
+#endif
+
+#ifndef _STLP_INTERNAL_LIMITS
+# include <stl/_limits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+class slice;
+class gslice;
+
+template <class _Tp> class valarray;
+typedef valarray<bool> _Valarray_bool;
+typedef valarray<size_t> _Valarray_size_t;
+
+template <class _Tp> class slice_array;
+template <class _Tp> class gslice_array;
+template <class _Tp> class mask_array;
+template <class _Tp> class indirect_array;
+
+//----------------------------------------------------------------------
+// class valarray
+
+// Base class to handle memory allocation and deallocation. We can't just
+// use vector<>, because vector<bool> would be unsuitable as an internal
+// representation for valarray<bool>.
+
+template <class _Tp>
+struct _Valarray_base {
+ _Tp* _M_first;
+ size_t _M_size;
+
+ _Valarray_base() : _M_first(0), _M_size(0) {}
+ _Valarray_base(size_t __n) : _M_first(0), _M_size(0) { _M_allocate(__n); }
+ ~_Valarray_base() { _M_deallocate(); }
+
+ void _M_allocate(size_t __n) {
+ if (__n != 0) {
+ _M_first = __STATIC_CAST(_Tp*, __stl_new(__n * sizeof(_Tp)));
+ _M_size = __n;
+ }
+ else {
+ _M_first = 0;
+ _M_size = 0;
+ }
+ }
+
+ void _M_deallocate() {
+ __stl_delete(_M_first);
+ _M_first = 0;
+ _M_size = 0;
+ }
+};
+
+template <class _Tp>
+class valarray : private _Valarray_base<_Tp>
+{
+ friend class gslice;
+
+public:
+ typedef _Tp value_type;
+
+ // Basic constructors
+ valarray() : _Valarray_base<_Tp>() {}
+ explicit valarray(size_t __n) : _Valarray_base<_Tp>(__n)
+ { uninitialized_fill_n(this->_M_first, this->_M_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+ valarray(const value_type& __x, size_t __n) : _Valarray_base<_Tp>(__n)
+ { uninitialized_fill_n(this->_M_first, this->_M_size, __x); }
+ valarray(const value_type* __p, size_t __n) : _Valarray_base<_Tp>(__n)
+ { uninitialized_copy(__p, __p + __n, this->_M_first); }
+ valarray(const valarray<_Tp>& __x) : _Valarray_base<_Tp>(__x._M_size) {
+ uninitialized_copy(__x._M_first, __x._M_first + __x._M_size,
+ this->_M_first);
+ }
+
+ // Constructors from auxiliary array types
+ valarray(const slice_array<_Tp>&);
+ valarray(const gslice_array<_Tp>&);
+ valarray(const mask_array<_Tp>&);
+ valarray(const indirect_array<_Tp>&);
+
+ // Destructor
+ ~valarray() { _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size); }
+
+ // Extension: constructor that doesn't initialize valarray elements to a
+ // specific value. This is faster for types such as int and double.
+private:
+ void _M_initialize(const __true_type&) {}
+ void _M_initialize(const __false_type&)
+ { uninitialized_fill_n(this->_M_first, this->_M_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+
+public:
+ struct _NoInit {};
+ valarray(size_t __n, _NoInit) : _Valarray_base<_Tp>(__n) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ }
+
+public: // Assignment
+ // Basic assignment. Note that 'x = y' is undefined if x.size() != y.size()
+ valarray<_Tp>& operator=(const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ if (this != &__x)
+ copy(__x._M_first, __x._M_first + __x._M_size, this->_M_first);
+ return *this;
+ }
+
+ // Scalar assignment
+ valarray<_Tp>& operator=(const value_type& __x) {
+ fill_n(this->_M_first, this->_M_size, __x);
+ return *this;
+ }
+
+ // Assignment of auxiliary array types
+ valarray<_Tp>& operator=(const slice_array<_Tp>&);
+ valarray<_Tp>& operator=(const gslice_array<_Tp>&);
+ valarray<_Tp>& operator=(const mask_array<_Tp>&);
+ valarray<_Tp>& operator=(const indirect_array<_Tp>&);
+
+public: // Element access
+ value_type operator[](size_t __n) const {
+ _STLP_ASSERT(__n < this->size())
+ return this->_M_first[__n];
+ }
+ value_type& operator[](size_t __n) {
+ _STLP_ASSERT(__n < this->size())
+ return this->_M_first[__n];
+ }
+ size_t size() const { return this->_M_size; }
+
+public: // Subsetting operations with auxiliary type
+ valarray<_Tp> operator[](slice) const;
+ slice_array<_Tp> operator[](slice);
+ valarray<_Tp> operator[](const gslice&) const;
+ gslice_array<_Tp> operator[](const gslice&);
+ valarray<_Tp> operator[](const _Valarray_bool&) const;
+ mask_array<_Tp> operator[](const _Valarray_bool&);
+ valarray<_Tp> operator[](const _Valarray_size_t&) const;
+ indirect_array<_Tp> operator[](const _Valarray_size_t&);
+
+public: // Unary operators.
+ valarray<_Tp> operator+() const { return *this; }
+
+ valarray<_Tp> operator-() const {
+ valarray<_Tp> __tmp(this->size(), _NoInit());
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ __tmp[__i] = -(*this)[__i];
+ return __tmp;
+ }
+
+ valarray<_Tp> operator~() const {
+ valarray<_Tp> __tmp(this->size(), _NoInit());
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ __tmp[__i] = ~(*this)[__i];
+ return __tmp;
+ }
+
+ _Valarray_bool operator!() const;
+
+public: // Scalar computed assignment.
+ valarray<_Tp>& operator*= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] *= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator/= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] /= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator%= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] %= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator+= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] += __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator-= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] -= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator^= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] ^= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator&= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] &= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator|= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] |= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator<<= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] <<= __x;
+ return *this;
+ }
+
+ valarray<_Tp>& operator>>= (const value_type& __x) {
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] >>= __x;
+ return *this;
+ }
+
+public: // Array computed assignment.
+ valarray<_Tp>& operator*= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] *= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator/= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] /= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator%= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] %= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator+= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] += __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator-= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] -= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator^= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] ^= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator&= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] &= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator|= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] |= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator<<= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] <<= __x[__i];
+ return *this;
+ }
+
+ valarray<_Tp>& operator>>= (const valarray<_Tp>& __x) {
+ _STLP_ASSERT(__x.size() == this->size())
+ for (size_t __i = 0; __i < this->size(); ++__i)
+ (*this)[__i] >>= __x[__i];
+ return *this;
+ }
+
+public: // Other member functions.
+
+ // The result is undefined for zero-length arrays
+ value_type sum() const {
+ _STLP_ASSERT(this->size() != 0)
+ return accumulate(this->_M_first + 1, this->_M_first + this->_M_size,
+ (*this)[0]);
+ }
+
+ // The result is undefined for zero-length arrays
+ value_type (min) () const {
+ _STLP_ASSERT(this->size() != 0)
+ return *min_element(this->_M_first + 0, this->_M_first + this->_M_size);
+ }
+
+ value_type (max) () const {
+ _STLP_ASSERT(this->size() != 0)
+ return *max_element(this->_M_first + 0, this->_M_first + this->_M_size);
+ }
+
+ valarray<_Tp> shift(int __n) const;
+ valarray<_Tp> cshift(int __n) const;
+
+ valarray<_Tp> apply(value_type __f(value_type)) const {
+ valarray<_Tp> __tmp(this->size());
+ transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first,
+ __f);
+ return __tmp;
+ }
+ valarray<_Tp> apply(value_type __f(const value_type&)) const {
+ valarray<_Tp> __tmp(this->size());
+ transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first,
+ __f);
+ return __tmp;
+ }
+
+ void resize(size_t __n, value_type __x = value_type()) {
+ _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size);
+ _Valarray_base<_Tp>::_M_deallocate();
+ _Valarray_base<_Tp>::_M_allocate(__n);
+ uninitialized_fill_n(this->_M_first, this->_M_size, __x);
+ }
+};
+
+//----------------------------------------------------------------------
+// valarray non-member functions.
+
+// Binary arithmetic operations between two arrays. Behavior is
+// undefined if the two arrays do not have the same length.
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator*(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] * __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator/(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] / __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator%(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] % __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator+(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] + __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator-(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] - __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator^(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] ^ __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator&(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] & __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator|(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] | __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator<<(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] << __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator>>(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] >> __y[__i];
+ return __tmp;
+}
+
+// Binary arithmetic operations between an array and a scalar.
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator*(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] * __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator*(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c * __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator/(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] / __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator/(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c / __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator%(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] % __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator%(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c % __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator+(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] + __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator+(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c + __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator-(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] - __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator-(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c - __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator^(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] ^ __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator^(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c ^ __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator&(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] & __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator&(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c & __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator|(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] | __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator|(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c | __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator<<(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] << __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator<<(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c << __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator>>(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] >> __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> _STLP_CALL operator>>(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c >> __x[__i];
+ return __tmp;
+}
+
+// Binary logical operations between two arrays. Behavior is undefined
+// if the two arrays have different lengths. Note that operator== does
+// not do what you might at first expect.
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator==(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] == __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] < __y[__i];
+ return __tmp;
+}
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator!=(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] != __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] > __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<=(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] <= __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>=(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] >= __y[__i];
+ return __tmp;
+}
+
+#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
+// fbp : swap ?
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator&&(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] && __y[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator||(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ _STLP_ASSERT(__x.size() == __y.size())
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] || __y[__i];
+ return __tmp;
+}
+
+// Logical operations between an array and a scalar.
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator==(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] == __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator==(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c == __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator!=(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] != __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator!=(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c != __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] < __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c < __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] > __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c > __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<=(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] <= __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator<=(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c <= __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>=(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] >= __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator>=(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c >= __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator&&(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] && __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator&&(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c && __x[__i];
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator||(const valarray<_Tp>& __x, const _Tp& __c) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __x[__i] || __c;
+ return __tmp;
+}
+
+template <class _Tp>
+inline _Valarray_bool _STLP_CALL operator||(const _Tp& __c, const valarray<_Tp>& __x) {
+ _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = __c || __x[__i];
+ return __tmp;
+}
+
+// valarray "transcendentals" (the list includes abs and sqrt, which,
+// of course, are not transcendental).
+
+template <class _Tp>
+inline valarray<_Tp> abs(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::abs(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> acos(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::acos(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> asin(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::asin(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> atan(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::atan(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> atan2(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::atan2(__x[__i], __y[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> atan2(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::atan2(__x[__i], __c);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> atan2(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::atan2(__c, __x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> cos(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::cos(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> cosh(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::cosh(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> exp(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::exp(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> log(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::log(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> log10(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::log10(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> pow(const valarray<_Tp>& __x,
+ const valarray<_Tp>& __y) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::pow(__x[__i], __y[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> pow(const valarray<_Tp>& __x, const _Tp& __c) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::pow(__x[__i], __c);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> pow(const _Tp& __c, const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::pow(__c, __x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> sin(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::sin(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> sinh(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::sinh(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> sqrt(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::sqrt(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> tan(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::tan(__x[__i]);
+ return __tmp;
+}
+
+template <class _Tp>
+inline valarray<_Tp> tanh(const valarray<_Tp>& __x) {
+ typedef typename valarray<_Tp>::_NoInit _NoInit;
+ valarray<_Tp> __tmp(__x.size(), _NoInit());
+ for (size_t __i = 0; __i < __x.size(); ++__i)
+ __tmp[__i] = ::tanh(__x[__i]);
+ return __tmp;
+}
+
+//----------------------------------------------------------------------
+// slice and slice_array
+
+class slice {
+public:
+ slice() : _M_start(0), _M_length(0), _M_stride(0) {}
+ slice(size_t __start, size_t __length, size_t __stride)
+ : _M_start(__start), _M_length(__length), _M_stride(__stride)
+ {}
+ __TRIVIAL_DESTRUCTOR(slice)
+
+ size_t start() const { return _M_start; }
+ size_t size() const { return _M_length; }
+ size_t stride() const { return _M_stride; }
+
+private:
+ size_t _M_start;
+ size_t _M_length;
+ size_t _M_stride;
+};
+
+template <class _Tp>
+class slice_array {
+ friend class valarray<_Tp>;
+public:
+ typedef _Tp value_type;
+
+ void operator=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] = __x[__i];
+ }
+
+ void operator*=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] *= __x[__i];
+ }
+
+ void operator/=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] /= __x[__i];
+ }
+
+ void operator%=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] %= __x[__i];
+ }
+
+ void operator+=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] += __x[__i];
+ }
+
+ void operator-=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] -= __x[__i];
+ }
+
+ void operator^=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] ^= __x[__i];
+ }
+
+ void operator&=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] &= __x[__i];
+ }
+
+ void operator|=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] |= __x[__i];
+ }
+
+ void operator<<=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] <<= __x[__i];
+ }
+
+ void operator>>=(const valarray<value_type>& __x) const {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] >>= __x[__i];
+ }
+
+ void operator=(const value_type& __c) /*const could be const but standard says NO (26.3.5.4-1)*/ {
+ size_t __index = _M_slice.start();
+ for (size_t __i = 0;
+ __i < _M_slice.size();
+ ++__i, __index += _M_slice.stride())
+ _M_array[__index] = __c;
+ }
+
+ // C++ Standard defect 253, copy constructor must be public.
+ slice_array(const slice_array &__x)
+ : _M_slice(__x._M_slice), _M_array(__x._M_array)
+ {}
+
+ ~slice_array() {}
+
+private:
+ slice_array(const slice& __slice, valarray<_Tp> &__array)
+ : _M_slice(__slice), _M_array(__array)
+ {}
+
+ slice _M_slice;
+ valarray<_Tp>& _M_array;
+
+private:
+ // Disable default constructor and assignment
+ slice_array();
+ slice_array& operator=(const slice_array&);
+};
+
+// valarray member functions dealing with slice and slice_array
+
+template <class _Tp>
+inline valarray<_Tp>::valarray(const slice_array<_Tp>& __x)
+ : _Valarray_base<_Tp>(__x._M_slice.size()) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ *this = __x;
+}
+
+
+template <class _Tp>
+inline slice_array<_Tp> valarray<_Tp>::operator[](slice __slice)
+{ return slice_array<_Tp>(__slice, *this); }
+
+//----------------------------------------------------------------------
+// gslice and gslice_array
+
+template <class _Size>
+struct _Gslice_Iter_tmpl;
+
+class gslice {
+ friend struct _Gslice_Iter_tmpl<size_t>;
+public:
+ gslice() : _M_start(0), _M_lengths(), _M_strides() {}
+ gslice(size_t __start,
+ const _Valarray_size_t& __lengths, const _Valarray_size_t& __strides)
+ : _M_start(__start), _M_lengths(__lengths), _M_strides(__strides)
+ {}
+ __TRIVIAL_DESTRUCTOR(gslice)
+
+ size_t start() const { return _M_start; }
+ _Valarray_size_t size() const { return _M_lengths; }
+ _Valarray_size_t stride() const { return _M_strides; }
+
+ // Extension: check for an empty gslice.
+ bool _M_empty() const { return _M_lengths.size() == 0; }
+
+ // Extension: number of indices this gslice represents. (For a degenerate
+ // gslice, they're not necessarily all distinct.)
+ size_t _M_size() const {
+ return !this->_M_empty()
+ ? accumulate(_M_lengths._M_first + 1,
+ _M_lengths._M_first + _M_lengths._M_size,
+ _M_lengths[0],
+ multiplies<size_t>())
+ : 0;
+ }
+
+# ifndef __HP_aCC
+private:
+# endif
+
+ size_t _M_start;
+ _Valarray_size_t _M_lengths;
+ _Valarray_size_t _M_strides;
+};
+
+// This is not an STL iterator. It is constructed from a gslice, and it
+// steps through the gslice indices in sequence. See 23.3.6 of the C++
+// standard, paragraphs 2-3, for an explanation of the sequence. At
+// each step we get two things: the ordinal (i.e. number of steps taken),
+// and the one-dimensional index.
+
+template <class _Size>
+struct _Gslice_Iter_tmpl {
+ _Gslice_Iter_tmpl(const gslice& __gslice)
+ : _M_step(0), _M_1d_idx(__gslice.start()),
+ _M_indices(size_t(0), __gslice._M_lengths.size()),
+ _M_gslice(__gslice)
+ {}
+
+ bool _M_done() const { return _M_indices[0] == _M_gslice._M_lengths[0]; }
+
+ bool _M_incr();
+
+ _Size _M_step;
+ _Size _M_1d_idx;
+
+ valarray<_Size> _M_indices;
+ const gslice& _M_gslice;
+};
+
+typedef _Gslice_Iter_tmpl<size_t> _Gslice_Iter;
+
+template <class _Tp>
+class gslice_array {
+ friend class valarray<_Tp>;
+public:
+ typedef _Tp value_type;
+
+ void operator= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] = __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator*= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] *= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator/= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] /= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator%= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] %= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator+= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] += __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator-= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] -= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator^= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] ^= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator&= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] &= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator|= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] |= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator<<= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] <<= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator>>= (const valarray<value_type>& __x) const {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] >>= __x[__i._M_step]; while(__i._M_incr());
+ }
+ }
+
+ void operator= (const value_type& __c) /*const could be const but standard says NO (26.3.7.4-1)*/ {
+ if (!_M_gslice._M_empty()) {
+ _Gslice_Iter __i(_M_gslice);
+ do _M_array[__i._M_1d_idx] = __c; while(__i._M_incr());
+ }
+ }
+
+ // C++ Standard defect 253, copy constructor must be public.
+ gslice_array(const gslice_array& __x)
+ : _M_gslice(__x._M_gslice), _M_array(__x._M_array)
+ {}
+
+ ~gslice_array() {}
+
+private:
+ gslice_array(const gslice &__gslice, valarray<_Tp> &__array)
+ : _M_gslice(__gslice), _M_array(__array)
+ {}
+
+ gslice _M_gslice;
+ valarray<value_type>& _M_array;
+
+private:
+ // Disable default constructor and assignment
+ gslice_array();
+ void operator=(const gslice_array<_Tp>&);
+};
+
+// valarray member functions dealing with gslice and gslice_array. Note
+// that it is illegal (behavior is undefined) to construct a gslice_array
+// from a degenerate gslice.
+
+template <class _Tp>
+inline valarray<_Tp>::valarray(const gslice_array<_Tp>& __x)
+ : _Valarray_base<_Tp>(__x._M_gslice._M_size()) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ *this = __x;
+}
+
+template <class _Tp>
+inline gslice_array<_Tp> valarray<_Tp>::operator[](const gslice& __slice)
+{ return gslice_array<_Tp>(__slice, *this); }
+
+
+//----------------------------------------------------------------------
+// mask_array
+
+template <class _Tp>
+class mask_array {
+ friend class valarray<_Tp>;
+public:
+ typedef _Tp value_type;
+
+ void operator=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] = __x[__idx++];
+ }
+
+ void operator*=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] *= __x[__idx++];
+ }
+
+ void operator/=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] /= __x[__idx++];
+ }
+
+ void operator%=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] %= __x[__idx++];
+ }
+
+ void operator+=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] += __x[__idx++];
+ }
+
+ void operator-=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] -= __x[__idx++];
+ }
+
+ void operator^=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] ^= __x[__idx++];
+ }
+
+ void operator&=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] &= __x[__idx++];
+ }
+
+ void operator|=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] |= __x[__idx++];
+ }
+
+ void operator<<=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] <<= __x[__idx++];
+ }
+
+ void operator>>=(const valarray<value_type>& __x) const {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] >>= __x[__idx++];
+ }
+
+ void operator=(const value_type& __c) const {
+ for (size_t __i = 0; __i < _M_array.size(); ++__i)
+ if (_M_mask[__i]) _M_array[__i] = __c;
+ }
+
+ // Extension: number of true values in the mask
+ size_t _M_num_true() const {
+ size_t __result = 0;
+ for (size_t __i = 0; __i < _M_mask.size(); ++__i)
+ if (_M_mask[__i]) ++__result;
+ return __result;
+ }
+
+ // C++ Standard defect 253, copy constructor must be public.
+ mask_array(const mask_array& __x)
+ : _M_mask(__x._M_mask), _M_array(__x._M_array)
+ {}
+
+ ~mask_array() {}
+
+private:
+ mask_array(const _Valarray_bool& __mask, valarray<_Tp>& __array)
+ : _M_mask(__mask), _M_array(__array)
+ {}
+ _Valarray_bool _M_mask;
+ valarray<_Tp>& _M_array;
+
+private:
+ // Disable default constructor and assignment
+ mask_array();
+ void operator=(const mask_array<_Tp>&);
+};
+
+// valarray member functions dealing with mask_array
+
+template <class _Tp>
+inline valarray<_Tp>::valarray(const mask_array<_Tp>& __x)
+ : _Valarray_base<_Tp>(__x._M_num_true()) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ *this = __x;
+}
+
+// Behavior is undefined if __x._M_num_true() != this->size()
+template <class _Tp>
+inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<_Tp>& __x) {
+ size_t __idx = 0;
+ for (size_t __i = 0; __i < __x._M_array.size(); ++__i)
+ if (__x._M_mask[__i]) (*this)[__idx++] = __x._M_array[__i];
+ return *this;
+}
+
+template <class _Tp>
+inline mask_array<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask) {
+ _STLP_ASSERT(__mask.size() == this->size())
+ return mask_array<_Tp>(__mask, *this);
+}
+
+//----------------------------------------------------------------------
+// indirect_array
+
+template <class _Tp>
+class indirect_array {
+ friend class valarray<_Tp>;
+public:
+ typedef _Tp value_type;
+
+ void operator=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] = __x[__i];
+ }
+
+ void operator*=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] *= __x[__i];
+ }
+
+ void operator/=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] /= __x[__i];
+ }
+
+ void operator%=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] %= __x[__i];
+ }
+
+ void operator+=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] += __x[__i];
+ }
+
+ void operator-=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] -= __x[__i];
+ }
+
+ void operator^=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] ^= __x[__i];
+ }
+
+ void operator&=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] &= __x[__i];
+ }
+
+ void operator|=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] |= __x[__i];
+ }
+
+ void operator<<=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] <<= __x[__i];
+ }
+
+ void operator>>=(const valarray<value_type>& __x) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] >>= __x[__i];
+ }
+
+ void operator=(const value_type& __c) const {
+ for (size_t __i = 0; __i < _M_addr.size(); ++__i)
+ _M_array[_M_addr[__i]] = __c;
+ }
+
+ // C++ Standard defect 253, copy constructor must be public.
+ indirect_array(const indirect_array& __x)
+ : _M_addr(__x._M_addr), _M_array(__x._M_array)
+ {}
+
+ ~indirect_array() {}
+
+private:
+ indirect_array(const _Valarray_size_t& __addr, valarray<_Tp>& __array)
+ : _M_addr(__addr), _M_array(__array)
+ {}
+
+ _Valarray_size_t _M_addr;
+ valarray<_Tp>& _M_array;
+
+private:
+ // Disable default constructor and assignment
+ indirect_array();
+ void operator=(const indirect_array<_Tp>&);
+};
+
+// valarray member functions dealing with indirect_array
+
+template <class _Tp>
+inline valarray<_Tp>::valarray(const indirect_array<_Tp>& __x)
+ : _Valarray_base<_Tp>(__x._M_addr.size()) {
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor
+ _Is_Trivial;
+ _M_initialize(_Is_Trivial());
+ *this = __x;
+}
+
+
+template <class _Tp>
+inline indirect_array<_Tp>
+valarray<_Tp>::operator[](const _Valarray_size_t& __addr)
+{ return indirect_array<_Tp>(__addr, *this); }
+
+_STLP_END_NAMESPACE
+
+# if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_valarray.c>
+# endif
+
+#endif /* _STLP_VALARRAY */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_vector.c b/stlport/stl/_vector.c
new file mode 100644
index 0000000..705f786
--- /dev/null
+++ b/stlport/stl/_vector.c
@@ -0,0 +1,242 @@
+/*
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_VECTOR_C
+#define _STLP_VECTOR_C
+
+#if !defined (_STLP_INTERNAL_VECTOR_H)
+# include <stl/_vector.h>
+#endif
+
+#include <stl/_range_errors.h>
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Alloc>
+void _Vector_base<_Tp,_Alloc>::_M_throw_length_error() const
+{ __stl_throw_length_error("vector"); }
+
+template <class _Tp, class _Alloc>
+void _Vector_base<_Tp, _Alloc>::_M_throw_out_of_range() const
+{ __stl_throw_out_of_range("vector"); }
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define vector _STLP_PTR_IMPL_NAME(vector)
+#elif defined (_STLP_DEBUG)
+# define vector _STLP_NON_DBG_NAME(vector)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define __iterator__ _Tp*
+#else
+# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE vector<_Tp, _Alloc>::iterator
+#endif
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::reserve(size_type __n) {
+ if (capacity() < __n) {
+ if (max_size() < __n) {
+ this->_M_throw_length_error();
+ }
+
+ const size_type __old_size = size();
+ pointer __tmp;
+ if (this->_M_start) {
+ __tmp = _M_allocate_and_copy(__n, this->_M_start, this->_M_finish);
+ _M_clear();
+ } else {
+ __tmp = this->_M_end_of_storage.allocate(__n, __n);
+ }
+ _M_set(__tmp, __tmp + __old_size, __tmp + __n);
+ }
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*DO NOT USE!!*/,
+ size_type __fill_len, bool __atend ) {
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __len = _M_compute_next_size(__fill_len);
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __new_finish = _STLP_PRIV __uninitialized_move(this->_M_start, __pos, __new_start, _TrivialUCopy(), _Movable());
+ // handle insertion
+ if (__fill_len == 1) {
+ _Copy_Construct(__new_finish, __x);
+ ++__new_finish;
+ } else
+ __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __fill_len, __x);
+ if (!__atend)
+ __new_finish = _STLP_PRIV __uninitialized_move(__pos, this->_M_finish, __new_finish, _TrivialUCopy(), _Movable()); // copy remainder
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ _M_clear_after_move();
+ _M_set(__new_start, __new_finish, __new_start + __len);
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/,
+ size_type __fill_len, bool __atend ) {
+ size_type __len = _M_compute_next_size(__fill_len);
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(this->_M_start, __pos, __new_start));
+ // handle insertion
+ __new_finish = _STLP_PRIV __fill_n(__new_finish, __fill_len, __x);
+ if (!__atend)
+ __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(__pos, this->_M_finish, __new_finish)); // copy remainder
+ _M_clear();
+ _M_set(__new_start, __new_finish, __new_start + __len);
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n,
+ const _Tp& __x, const __true_type& /*_Movable*/) {
+ if (_M_is_inside(__x)) {
+ _Tp __x_copy = __x;
+ _M_fill_insert_aux(__pos, __n, __x_copy, __true_type());
+ return;
+ }
+ iterator __src = this->_M_finish - 1;
+ iterator __dst = __src + __n;
+ for (; __src >= __pos; --__dst, --__src) {
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ _STLP_STD::_Destroy_Moved(__src);
+ }
+ _STLP_PRIV __uninitialized_fill_n(__pos, __n, __x);
+ this->_M_finish += __n;
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_fill_insert_aux (iterator __pos, size_type __n,
+ const _Tp& __x, const __false_type& /*_Movable*/) {
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ //Here self referencing needs to be checked even for non movable types.
+ if (_M_is_inside(__x)) {
+ _Tp __x_copy = __x;
+ _M_fill_insert_aux(__pos, __n, __x_copy, __false_type());
+ return;
+ }
+ const size_type __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after > __n) {
+ _STLP_PRIV __ucopy_ptrs(this->_M_finish - __n, this->_M_finish, this->_M_finish, _TrivialUCopy());
+ this->_M_finish += __n;
+ _STLP_PRIV __copy_backward_ptrs(__pos, __old_finish - __n, __old_finish, _TrivialCopy());
+ _STLP_STD::fill(__pos, __pos + __n, __x);
+ } else {
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_finish, __n - __elems_after, __x);
+ _STLP_PRIV __ucopy_ptrs(__pos, __old_finish, this->_M_finish, _TrivialUCopy());
+ this->_M_finish += __elems_after;
+ _STLP_STD::fill(__pos, __old_finish, __x);
+ }
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_fill_insert(iterator __pos,
+ size_type __n, const _Tp& __x) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__n != 0) {
+ if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) {
+ _M_fill_insert_aux(__pos, __n, __x, _Movable());
+ } else {
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ _M_insert_overflow(__pos, __x, _TrivialCopy(), __n);
+ }
+ }
+}
+
+template <class _Tp, class _Alloc>
+vector<_Tp, _Alloc>& vector<_Tp, _Alloc>::operator = (const vector<_Tp, _Alloc>& __x) {
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+ if (&__x != this) {
+ const size_type __xlen = __x.size();
+ if (__xlen > capacity()) {
+ size_type __len = __xlen;
+ pointer __tmp = _M_allocate_and_copy(__len, __CONST_CAST(const_pointer, __x._M_start) + 0,
+ __CONST_CAST(const_pointer, __x._M_finish) + 0);
+ _M_clear();
+ this->_M_start = __tmp;
+ this->_M_end_of_storage._M_data = this->_M_start + __len;
+ } else if (size() >= __xlen) {
+ pointer __i = _STLP_PRIV __copy_ptrs(__CONST_CAST(const_pointer, __x._M_start) + 0,
+ __CONST_CAST(const_pointer, __x._M_finish) + 0, this->_M_start, _TrivialCopy());
+ _STLP_STD::_Destroy_Range(__i, this->_M_finish);
+ } else {
+ _STLP_PRIV __copy_ptrs(__CONST_CAST(const_pointer, __x._M_start),
+ __CONST_CAST(const_pointer, __x._M_start) + size(), this->_M_start, _TrivialCopy());
+ _STLP_PRIV __ucopy_ptrs(__CONST_CAST(const_pointer, __x._M_start) + size(),
+ __CONST_CAST(const_pointer, __x._M_finish) + 0, this->_M_finish, _TrivialUCopy());
+ }
+ this->_M_finish = this->_M_start + __xlen;
+ }
+ return *this;
+}
+
+template <class _Tp, class _Alloc>
+void vector<_Tp, _Alloc>::_M_fill_assign(size_t __n, const _Tp& __val) {
+ if (__n > capacity()) {
+ vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator());
+ __tmp.swap(*this);
+ } else if (__n > size()) {
+ fill(begin(), end(), __val);
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_finish, __n - size(), __val);
+ } else
+ erase(_STLP_PRIV __fill_n(begin(), __n, __val), end());
+}
+
+template <class _Tp, class _Alloc>
+__iterator__
+vector<_Tp, _Alloc>::insert(iterator __pos, const _Tp& __x) {
+ size_type __n = __pos - begin();
+ _M_fill_insert(__pos, 1, __x);
+ return begin() + __n;
+}
+
+#undef __iterator__
+
+#if defined (vector)
+# undef vector
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_VECTOR_C */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/_vector.h b/stlport/stl/_vector.h
new file mode 100644
index 0000000..ed243ef
--- /dev/null
+++ b/stlport/stl/_vector.h
@@ -0,0 +1,773 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_VECTOR_H
+#define _STLP_INTERNAL_VECTOR_H
+
+#ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ITERATOR_H
+# include <stl/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_UNINITIALIZED_H
+# include <stl/_uninitialized.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+// The vector base class serves one purpose, its constructor and
+// destructor allocate (but don't initialize) storage. This makes
+// exception safety easier.
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _Alloc>
+class _Vector_base {
+public:
+ typedef _Vector_base<_Tp, _Alloc> _Self;
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef _Alloc allocator_type;
+ typedef _Tp* pointer;
+ typedef _STLP_alloc_proxy<pointer, _Tp, allocator_type> _AllocProxy;
+
+ _Vector_base(const _Alloc& __a)
+ : _M_start(0), _M_finish(0), _M_end_of_storage(__a, 0) {}
+
+ _Vector_base(size_t __n, const _Alloc& __a)
+ : _M_start(0), _M_finish(0), _M_end_of_storage(__a, 0) {
+ _M_start = _M_end_of_storage.allocate(__n, __n);
+ _M_finish = _M_start;
+ _M_end_of_storage._M_data = _M_start + __n;
+ _STLP_MPWFIX_TRY _STLP_MPWFIX_CATCH
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Vector_base(__move_source<_Self> src)
+ : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
+ _M_end_of_storage(__move_source<_AllocProxy>(src.get()._M_end_of_storage)) {
+ //Set the source as empty:
+ src.get()._M_finish = src.get()._M_end_of_storage._M_data = src.get()._M_start = 0;
+ }
+#endif
+
+ ~_Vector_base() {
+ if (_M_start != _STLP_DEFAULT_CONSTRUCTED(pointer))
+ _M_end_of_storage.deallocate(_M_start, _M_end_of_storage._M_data - _M_start);
+ }
+
+protected:
+ void _STLP_FUNCTION_THROWS _M_throw_length_error() const;
+ void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const;
+
+ pointer _M_start;
+ pointer _M_finish;
+ _AllocProxy _M_end_of_storage;
+};
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define vector _STLP_PTR_IMPL_NAME(vector)
+#elif defined (_STLP_DEBUG)
+# define vector _STLP_NON_DBG_NAME(vector)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class vector : protected _STLP_PRIV _Vector_base<_Tp, _Alloc>
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (vector)
+ , public __stlport_class<vector<_Tp, _Alloc> >
+#endif
+{
+private:
+ typedef _STLP_PRIV _Vector_base<_Tp, _Alloc> _Base;
+ typedef vector<_Tp, _Alloc> _Self;
+public:
+ _STLP_FORCE_ALLOCATORS(_Tp, _Alloc)
+ typedef typename _Base::allocator_type allocator_type;
+
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag _Iterator_category;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR((const allocator_type&)this->_M_end_of_storage, _Tp); }
+
+private:
+#if defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef __false_type _Movable;
+#endif
+
+ // handles insertions on overflow
+ void _M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*_Movable*/,
+ size_type __fill_len, bool __atend);
+ void _M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __true_type& /*_Movable*/,
+ size_type __fill_len, bool __atend) {
+ //We need to take care of self referencing here:
+ if (_M_is_inside(__x)) {
+ value_type __x_copy = __x;
+ _M_insert_overflow_aux(__pos, __x_copy, __false_type(), __fill_len, __atend);
+ return;
+ }
+ _M_insert_overflow_aux(__pos, __x, __false_type(), __fill_len, __atend);
+ }
+
+ void _M_insert_overflow(pointer __pos, const _Tp& __x, const __false_type& /*_TrivialCopy*/,
+ size_type __fill_len, bool __atend = false) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ _M_insert_overflow_aux(__pos, __x, _Movable(), __fill_len, __atend);
+ }
+ void _M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/,
+ size_type __fill_len, bool __atend = false);
+ void _M_range_check(size_type __n) const {
+ if (__n >= size_type(this->_M_finish - this->_M_start))
+ this->_M_throw_out_of_range();
+ }
+
+ size_type _M_compute_next_size(size_type __n) {
+ const size_type __size = size();
+ if (__n > max_size() - __size)
+ this->_M_throw_length_error();
+ size_type __len = __size + (max)(__n, __size);
+ if (__len > max_size() || __len < __size)
+ __len = max_size(); // overflow
+ return __len;
+ }
+
+public:
+ iterator begin() { return this->_M_start; }
+ const_iterator begin() const { return this->_M_start; }
+ iterator end() { return this->_M_finish; }
+ const_iterator end() const { return this->_M_finish; }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const { return size_type(this->_M_finish - this->_M_start); }
+ size_type max_size() const {
+ size_type __vector_max_size = size_type(-1) / sizeof(_Tp);
+ typename allocator_type::size_type __alloc_max_size = this->_M_end_of_storage.max_size();
+ return (__alloc_max_size < __vector_max_size)?__alloc_max_size:__vector_max_size;
+ }
+
+ size_type capacity() const { return size_type(this->_M_end_of_storage._M_data - this->_M_start); }
+ bool empty() const { return this->_M_start == this->_M_finish; }
+
+ reference operator[](size_type __n) { return *(begin() + __n); }
+ const_reference operator[](size_type __n) const { return *(begin() + __n); }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(end() - 1); }
+ const_reference back() const { return *(end() - 1); }
+
+ reference at(size_type __n) { _M_range_check(__n); return (*this)[__n]; }
+ const_reference at(size_type __n) const { _M_range_check(__n); return (*this)[__n]; }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(const allocator_type& __a = allocator_type())
+#else
+ vector()
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(allocator_type()) {}
+ vector(const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__a) {}
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+private:
+ //We always call _M_initialize with only 1 parameter. Default parameter
+ //is used to allow explicit instanciation of vector with types with no
+ //default constructor.
+ void _M_initialize(size_type __n, const _Tp& __val = _STLP_DEFAULT_CONSTRUCTED(_Tp))
+ { this->_M_finish = _STLP_PRIV __uninitialized_init(this->_M_start, __n, __val); }
+public:
+ explicit vector(size_type __n)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type())
+ { _M_initialize(__n); }
+ vector(size_type __n, const _Tp& __val, const allocator_type& __a = allocator_type())
+#else
+ explicit vector(size_type __n)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type())
+ { this->_M_finish = _STLP_PRIV __uninitialized_init(this->_M_start, __n, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+ vector(size_type __n, const _Tp& __val)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type())
+ { this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); }
+ vector(size_type __n, const _Tp& __val, const allocator_type& __a)
+#endif
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, __a)
+ { this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); }
+
+ vector(const _Self& __x)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__x.size(), __x.get_allocator()) {
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+ this->_M_finish = _STLP_PRIV __ucopy_ptrs(__x.begin(), __x.end(), this->_M_start, _TrivialUCopy());
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ vector(__move_source<_Self> src)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__move_source<_Base>(src.get()))
+ {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+private:
+ template <class _Integer>
+ void _M_initialize_aux(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/) {
+ size_type __real_n = __n;
+ this->_M_start = this->_M_end_of_storage.allocate(__n, __real_n);
+ this->_M_end_of_storage._M_data = this->_M_start + __real_n;
+ this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_initialize_aux(_InputIterator __first, _InputIterator __last,
+ const __false_type& /*_IsIntegral*/)
+ { _M_range_initialize(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); }
+
+public:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL )
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__a) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_aux(__first, __last, _Integral());
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last)
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(allocator_type()) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_initialize_aux(__first, __last, _Integral());
+ }
+# endif /* _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS */
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ vector(const _Tp* __first, const _Tp* __last,
+ const allocator_type& __a = allocator_type())
+ : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__last - __first, __a) {
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+ this->_M_finish = _STLP_PRIV __ucopy_ptrs(__first, __last, this->_M_start, _TrivialUCopy());
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ //As the vector container is a back insert oriented container it
+ //seems rather logical to destroy elements in reverse order.
+ ~vector() { _STLP_STD::_Destroy_Range(rbegin(), rend()); }
+
+ _Self& operator=(const _Self& __x);
+
+ void reserve(size_type __n);
+
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); }
+ void _M_fill_assign(size_type __n, const _Tp& __val);
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIter>
+ void _M_assign_aux(_ForwardIter __first, _ForwardIter __last, const forward_iterator_tag &) {
+#else
+ void assign(const_iterator __first, const_iterator __last) {
+ typedef const_iterator _ForwardIter;
+#endif
+ const size_type __len = _STLP_STD::distance(__first, __last);
+ if (__len > capacity()) {
+ size_type __n = __len;
+ iterator __tmp = _M_allocate_and_copy(__n, __first, __last);
+ _M_clear();
+ _M_set(__tmp, __tmp + __len, __tmp + __n);
+ }
+ else if (size() >= __len) {
+ iterator __new_finish = copy(__first, __last, this->_M_start);
+ _STLP_STD::_Destroy_Range(__new_finish, this->_M_finish);
+ this->_M_finish = __new_finish;
+ }
+ else {
+ _ForwardIter __mid = __first;
+ _STLP_STD::advance(__mid, size());
+ _STLP_STD::copy(__first, __mid, this->_M_start);
+ this->_M_finish = _STLP_STD::uninitialized_copy(__mid, __last, this->_M_finish);
+ }
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ void _M_assign_aux(_InputIter __first, _InputIter __last,
+ const input_iterator_tag &) {
+ iterator __cur = begin();
+ for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
+ *__cur = *__first;
+ if (__first == __last)
+ erase(__cur, end());
+ else
+ insert(end(), __first, __last);
+ }
+
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type& /*_IsIntegral*/)
+ { _M_fill_assign(__n, __val); }
+
+ template <class _InputIter>
+ void _M_assign_dispatch(_InputIter __first, _InputIter __last,
+ const __false_type& /*_IsIntegral*/)
+ { _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
+
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+#endif
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back(const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void push_back(const _Tp& __x) {
+#endif
+ if (this->_M_finish != this->_M_end_of_storage._M_data) {
+ _Copy_Construct(this->_M_finish, __x);
+ ++this->_M_finish;
+ }
+ else {
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ _M_insert_overflow(this->_M_finish, __x, _TrivialCopy(), 1, true);
+ }
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp));
+#else
+ iterator insert(iterator __pos, const _Tp& __x);
+#endif
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_back() { push_back(_STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+ iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif
+
+ void swap(_Self& __x) {
+ _STLP_STD::swap(this->_M_start, __x._M_start);
+ _STLP_STD::swap(this->_M_finish, __x._M_finish);
+ this->_M_end_of_storage.swap(__x._M_end_of_storage);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+private:
+ void _M_fill_insert_aux (iterator __pos, size_type __n, const _Tp& __x, const __true_type& /*_Movable*/);
+ void _M_fill_insert_aux (iterator __pos, size_type __n, const _Tp& __x, const __false_type& /*_Movable*/);
+ void _M_fill_insert (iterator __pos, size_type __n, const _Tp& __x);
+
+ bool _M_is_inside(const value_type& __x) const {
+ return (&__x >= this->_M_start && &__x < this->_M_finish);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIterator>
+ void _M_range_insert_realloc(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+#else
+ void _M_range_insert_realloc(iterator __pos,
+ const_iterator __first, const_iterator __last,
+#endif
+ size_type __n) {
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ size_type __len = _M_compute_next_size(__n);
+ pointer __new_start = this->_M_end_of_storage.allocate(__len, __len);
+ pointer __new_finish = __new_start;
+ _STLP_TRY {
+ __new_finish = _STLP_PRIV __uninitialized_move(this->_M_start, __pos, __new_start, _TrivialUCopy(), _Movable());
+ __new_finish = uninitialized_copy(__first, __last, __new_finish);
+ __new_finish = _STLP_PRIV __uninitialized_move(__pos, this->_M_finish, __new_finish, _TrivialUCopy(), _Movable());
+ }
+ _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish),
+ this->_M_end_of_storage.deallocate(__new_start,__len)))
+ _M_clear_after_move();
+ _M_set(__new_start, __new_finish, __new_start + __len);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIterator>
+ void _M_range_insert_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+#else
+ void _M_range_insert_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+#endif
+ size_type __n, const __true_type& /*_Movable*/) {
+ iterator __src = this->_M_finish - 1;
+ iterator __dst = __src + __n;
+ for (; __src >= __pos; --__dst, --__src) {
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ _STLP_STD::_Destroy_Moved(__src);
+ }
+ uninitialized_copy(__first, __last, __pos);
+ this->_M_finish += __n;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIterator>
+ void _M_range_insert_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+#else
+ void _M_range_insert_aux(iterator __pos,
+ const_iterator __first, const_iterator __last,
+#endif
+ size_type __n, const __false_type& /*_Movable*/) {
+ typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy;
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ const size_type __elems_after = this->_M_finish - __pos;
+ pointer __old_finish = this->_M_finish;
+ if (__elems_after > __n) {
+ _STLP_PRIV __ucopy_ptrs(this->_M_finish - __n, this->_M_finish, this->_M_finish, _TrivialUCopy());
+ this->_M_finish += __n;
+ _STLP_PRIV __copy_backward_ptrs(__pos, __old_finish - __n, __old_finish, _TrivialCopy());
+ copy(__first, __last, __pos);
+ }
+ else {
+#if defined ( _STLP_MEMBER_TEMPLATES )
+ _ForwardIterator __mid = __first;
+ _STLP_STD::advance(__mid, __elems_after);
+#else
+ const_pointer __mid = __first + __elems_after;
+#endif
+ uninitialized_copy(__mid, __last, this->_M_finish);
+ this->_M_finish += __n - __elems_after;
+ _STLP_PRIV __ucopy_ptrs(__pos, __old_finish, this->_M_finish, _TrivialUCopy());
+ this->_M_finish += __elems_after;
+ copy(__first, __mid, __pos);
+ } /* elems_after */
+ }
+
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&)
+ { _M_fill_insert(__pos, (size_type) __n, (_Tp) __val); }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&)
+ { _M_range_insert(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); }
+
+public:
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+ }
+
+private:
+ template <class _InputIterator>
+ void _M_range_insert(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first) {
+ __pos = insert(__pos, *__first);
+ ++__pos;
+ }
+ }
+
+ template <class _ForwardIterator>
+ void _M_range_insert(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+#else
+public:
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+#endif
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ /* This method do not check self referencing.
+ * Standard forbids it, checked by the debug mode.
+ */
+ if (__first != __last) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+
+ if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) {
+ _M_range_insert_aux(__pos, __first, __last, __n, _Movable());
+ }
+ else {
+ _M_range_insert_realloc(__pos, __first, __last, __n);
+ }
+ }
+ }
+
+public:
+ void insert (iterator __pos, size_type __n, const _Tp& __x)
+ { _M_fill_insert(__pos, __n, __x); }
+
+ void pop_back() {
+ --this->_M_finish;
+ _STLP_STD::_Destroy(this->_M_finish);
+ }
+
+private:
+ iterator _M_erase(iterator __pos, const __true_type& /*_Movable*/) {
+ _STLP_STD::_Destroy(__pos);
+ iterator __dst = __pos, __src = __dst + 1;
+ iterator __end = end();
+ for (; __src != __end; ++__dst, ++__src) {
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ _STLP_STD::_Destroy_Moved(__src);
+ }
+ this->_M_finish = __dst;
+ return __pos;
+ }
+ iterator _M_erase(iterator __pos, const __false_type& /*_Movable*/) {
+ if (__pos + 1 != end()) {
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ _STLP_PRIV __copy_ptrs(__pos + 1, this->_M_finish, __pos, _TrivialCopy());
+ }
+ --this->_M_finish;
+ _STLP_STD::_Destroy(this->_M_finish);
+ return __pos;
+ }
+ iterator _M_erase(iterator __first, iterator __last, const __true_type& /*_Movable*/) {
+ iterator __dst = __first, __src = __last;
+ iterator __end = end();
+ for (; __dst != __last && __src != __end; ++__dst, ++__src) {
+ _STLP_STD::_Destroy(__dst);
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ }
+ if (__dst != __last) {
+ //There is more elements to erase than element to move:
+ _STLP_STD::_Destroy_Range(__dst, __last);
+ _STLP_STD::_Destroy_Moved_Range(__last, __end);
+ }
+ else {
+ //There is more element to move than element to erase:
+ for (; __src != __end; ++__dst, ++__src) {
+ _STLP_STD::_Destroy_Moved(__dst);
+ _STLP_STD::_Move_Construct(__dst, *__src);
+ }
+ _STLP_STD::_Destroy_Moved_Range(__dst, __end);
+ }
+ this->_M_finish = __dst;
+ return __first;
+ }
+ iterator _M_erase(iterator __first, iterator __last, const __false_type& /*_Movable*/) {
+ typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy;
+ pointer __i = _STLP_PRIV __copy_ptrs(__last, this->_M_finish, __first, _TrivialCopy());
+ _STLP_STD::_Destroy_Range(__i, this->_M_finish);
+ this->_M_finish = __i;
+ return __first;
+ }
+
+public:
+ iterator erase(iterator __pos) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ return _M_erase(__pos, _Movable());
+ }
+ iterator erase(iterator __first, iterator __last) {
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ typedef typename __move_traits<_Tp>::implemented _Movable;
+#endif
+ if (__first == __last)
+ return __first;
+ return _M_erase(__first, __last, _Movable());
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void resize(size_type __new_size, const _Tp& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ if (__new_size < size())
+ erase(begin() + __new_size, end());
+ else
+ insert(end(), __new_size - size(), __x);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear() {
+ erase(begin(), end());
+ }
+
+private:
+ void _M_clear() {
+ _STLP_STD::_Destroy_Range(rbegin(), rend());
+ this->_M_end_of_storage.deallocate(this->_M_start, this->_M_end_of_storage._M_data - this->_M_start);
+ }
+
+ void _M_clear_after_move() {
+ _STLP_STD::_Destroy_Moved_Range(rbegin(), rend());
+ this->_M_end_of_storage.deallocate(this->_M_start, this->_M_end_of_storage._M_data - this->_M_start);
+ }
+
+ void _M_set(pointer __s, pointer __f, pointer __e) {
+ this->_M_start = __s;
+ this->_M_finish = __f;
+ this->_M_end_of_storage._M_data = __e;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _ForwardIterator>
+ pointer _M_allocate_and_copy(size_type& __n,
+ _ForwardIterator __first, _ForwardIterator __last)
+#else /* _STLP_MEMBER_TEMPLATES */
+ pointer _M_allocate_and_copy(size_type& __n,
+ const_pointer __first, const_pointer __last)
+#endif /* _STLP_MEMBER_TEMPLATES */
+ {
+ pointer __result = this->_M_end_of_storage.allocate(__n, __n);
+ _STLP_TRY {
+ uninitialized_copy(__first, __last, __result);
+ return __result;
+ }
+ _STLP_UNWIND(this->_M_end_of_storage.deallocate(__result, __n))
+ _STLP_RET_AFTER_THROW(__result)
+ }
+
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void _M_range_initialize(_InputIterator __first, _InputIterator __last,
+ const input_iterator_tag &) {
+ for ( ; __first != __last; ++__first)
+ push_back(*__first);
+ }
+ // This function is only called by the constructor.
+ template <class _ForwardIterator>
+ void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
+ const forward_iterator_tag &) {
+ size_type __n = _STLP_STD::distance(__first, __last);
+ this->_M_start = this->_M_end_of_storage.allocate(__n, __n);
+ this->_M_end_of_storage._M_data = this->_M_start + __n;
+ this->_M_finish = uninitialized_copy(__first, __last, this->_M_start);
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+};
+
+#if defined (vector)
+# undef vector
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+_STLP_END_NAMESPACE
+
+#if !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/_vector.c>
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# include <stl/pointers/_vector.h>
+#endif
+
+//We define the bool specialization before the debug interfave
+//to benefit of the debug version of vector even for the bool
+//specialization.
+#if !defined (_STLP_NO_BOOL) || !defined (_STLP_NO_EXTENSIONS)
+# if !defined (_STLP_INTERNAL_BVECTOR_H)
+# include <stl/_bvector.h>
+# endif
+#endif
+
+#if defined (_STLP_DEBUG)
+# include <stl/debug/_vector.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_NO_BOOL) && !defined (_STLP_NO_EXTENSIONS)
+// This typedef is non-standard. It is provided for backward compatibility.
+typedef vector<bool, allocator<bool> > bit_vector;
+#endif
+
+#define _STLP_TEMPLATE_HEADER template <class _Tp, class _Alloc>
+#define _STLP_TEMPLATE_CONTAINER vector<_Tp, _Alloc>
+#include <stl/_relops_cont.h>
+#undef _STLP_TEMPLATE_CONTAINER
+#undef _STLP_TEMPLATE_HEADER
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+template <class _Tp, class _Alloc>
+struct __move_traits<vector<_Tp, _Alloc> > {
+ typedef __true_type implemented;
+ typedef typename __move_traits<_Alloc>::complete complete;
+};
+# endif
+
+# if !defined (_STLP_DEBUG)
+template <class _Tp, class _Alloc>
+struct _DefaultZeroValue<vector<_Tp, _Alloc> >
+{ typedef typename __type_traits<_Alloc>::has_trivial_default_constructor _Ret; };
+# endif
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_VECTOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/boost_type_traits.h b/stlport/stl/boost_type_traits.h
new file mode 100644
index 0000000..ae3a3f6
--- /dev/null
+++ b/stlport/stl/boost_type_traits.h
@@ -0,0 +1,150 @@
+/*
+ *
+ * Copyright (c) 2004
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_BOOST_TYPE_TRAITS_H
+#define _STLP_BOOST_TYPE_TRAITS_H
+
+#ifndef BOOST_CONFIG_SUFFIX_HPP
+# ifdef BOOST_CONFIG_HPP
+# undef BOOST_CONFIG_HPP
+# endif
+# include <boost/config.hpp>
+#endif
+
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/type_traits/is_float.hpp>
+#include <boost/type_traits/has_trivial_constructor.hpp>
+#include <boost/type_traits/has_trivial_copy.hpp>
+#include <boost/type_traits/has_trivial_assign.hpp>
+#include <boost/type_traits/has_trivial_destructor.hpp>
+#include <boost/type_traits/is_pod.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/is_reference.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+/*
+ * This file mostly wraps boost type_traits in the STLport type_traits.
+ * When checking a type traits like trivial assign operator for instance
+ * both the boost value and STLport values has to be taken into account
+ * as we don't know what the user might have prefer, specializing the boost
+ * type traits or the STLport one.
+ */
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp> struct _IsRef {
+ enum { _Is = ::boost::is_reference<_Tp>::value };
+ typedef typename __bool2type<_Is>::_Ret _Ret;
+};
+
+template <class _Tp> struct _IsPtr {
+ enum { is_pointer = ::boost::is_pointer<_Tp>::value };
+ typedef typename __bool2type<is_pointer>::_Ret _Ret;
+};
+
+template <class _Tp> struct _IsIntegral {
+ enum { is_integral = ::boost::is_integral<_Tp>::value };
+ typedef typename __bool2type<is_integral>::_Ret _Ret;
+};
+
+template <class _Tp> struct _IsRational {
+ enum { is_float = ::boost::is_float<_Tp>::value };
+ typedef typename __bool2type<is_float>::_Ret _Ret;
+};
+
+template <class _Tp>
+struct __type_traits {
+ enum { trivial_constructor = ::boost::has_trivial_constructor<_Tp>::value };
+ typedef typename __bool2type<trivial_constructor>::_Ret has_trivial_default_constructor;
+
+ enum { trivial_copy = ::boost::has_trivial_copy<_Tp>::value };
+ typedef typename __bool2type<trivial_copy>::_Ret has_trivial_copy_constructor;
+
+ enum { trivial_assign = ::boost::has_trivial_assign<_Tp>::value };
+ typedef typename __bool2type<trivial_assign>::_Ret has_trivial_assignment_operator;
+
+ enum { trivial_destructor = ::boost::has_trivial_destructor<_Tp>::value };
+ typedef typename __bool2type<trivial_destructor>::_Ret has_trivial_destructor;
+
+ enum { pod = ::boost::is_pod<_Tp>::value };
+ typedef typename __bool2type<pod>::_Ret is_POD_type;
+};
+
+template <class _Tp1, class _Tp2>
+struct _TrivialCopy {
+ typedef typename ::boost::remove_cv<_Tp1>::type uncv1;
+ typedef typename ::boost::remove_cv<_Tp2>::type uncv2;
+
+ enum { same = ::boost::is_same<uncv1, uncv2>::value };
+ typedef typename __bool2type<same>::_Ret _Same;
+
+ enum { boost_trivial_assign = ::boost::has_trivial_assign<uncv1>::value };
+ typedef typename __bool2type<boost_trivial_assign>::_Ret _BoostTrivialAssign;
+ typedef typename __type_traits<uncv1>::has_trivial_assignment_operator _STLPTrivialAssign;
+ typedef typename _Lor2<_BoostTrivialAssign, _STLPTrivialAssign>::_Ret _TrivialAssign;
+
+ typedef typename _Land2<_Same, _TrivialAssign>::_Ret _Type;
+ static _Type _Answer() { return _Type(); }
+};
+
+template <class _Tp1, class _Tp2>
+struct _TrivialUCopy {
+ typedef typename ::boost::remove_cv<_Tp1>::type uncv1;
+ typedef typename ::boost::remove_cv<_Tp2>::type uncv2;
+
+ enum { same = ::boost::is_same<uncv1, uncv2>::value };
+ typedef typename __bool2type<same>::_Ret _Same;
+
+ enum { boost_trivial_copy = ::boost::has_trivial_copy<uncv1>::value };
+ typedef typename __bool2type<boost_trivial_copy>::_Ret _BoostTrivialCopy;
+ typedef typename __type_traits<uncv1>::has_trivial_copy_constructor _STLPTrivialCopy;
+ typedef typename _Lor2<_BoostTrivialCopy, _STLPTrivialCopy>::_Ret _TrivialCopy;
+
+ typedef typename _Land2<_Same, _TrivialCopy>::_Ret _Type;
+ static _Type _Answer() { return _Type(); }
+};
+
+template <class _Tp>
+struct _DefaultZeroValue {
+ enum { is_integral = ::boost::is_integral<_Tp>::value };
+ typedef typename __bool2type<is_integral>::_Ret _IsIntegral;
+ enum { is_float = ::boost::is_float<_Tp>::value };
+ typedef typename __bool2type<is_float>::_Ret _IsFloat;
+ enum { is_pointer = ::boost::is_pointer<_Tp>::value };
+ typedef typename __bool2type<is_pointer>::_Ret _IsPointer;
+
+ typedef typename _Lor3<_IsIntegral, _IsFloat, _IsPointer>::_Ret _Ret;
+};
+
+template <class _Tp>
+struct _TrivialInit {
+ typedef typename ::boost::remove_cv<_Tp>::type uncv;
+
+ enum { boost_trivial_constructor = ::boost::has_trivial_constructor<uncv>::value };
+ typedef typename __bool2type<boost_trivial_constructor>::_Ret _BoostTrivialInit;
+ typedef typename __type_traits<uncv>::has_trivial_default_constructor _STLPTrivialInit;
+ typedef typename _Lor2<_BoostTrivialInit, _STLPTrivialInit>::_Ret _Tr1;
+
+ typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2;
+ typedef typename _Not<_Tr2>::_Ret _Tr3;
+
+ typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_BOOST_TYPE_TRAITS_H */
diff --git a/stlport/stl/c_locale.h b/stlport/stl/c_locale.h
new file mode 100644
index 0000000..cadd2bc
--- /dev/null
+++ b/stlport/stl/c_locale.h
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_C_LOCALE_H
+#define _STLP_C_LOCALE_H
+
+/*
+ * Implementation dependent definitions.
+ * Beware: This header is not a purely internal header, it is also included
+ * from the outside world when building the STLport library. So this header
+ * should not reference internal headers (stlport/stl/_*.h) directly.
+ */
+#if defined (__sgi)
+# if defined (ROOT_65) /* IRIX 6.5.x */
+# include <sgidefs.h>
+# include <standards.h>
+# include <wchar.h>
+# include <ctype.h>
+# else /* IRIX pre-6.5 */
+# include <sgidefs.h>
+# include <standards.h>
+# if !defined(_SIZE_T) && !defined(_SIZE_T_)
+# define _SIZE_T
+# if (_MIPS_SZLONG == 32)
+typedef unsigned int size_t;
+# endif
+# if (_MIPS_SZLONG == 64)
+typedef unsigned long size_t;
+# endif
+# endif
+# if !defined (_WCHAR_T)
+# define _WCHAR_T
+# if (_MIPS_SZLONG == 32)
+typedef long wchar_t;
+# endif
+# if (_MIPS_SZLONG == 64)
+typedef __int32_t wchar_t;
+# endif
+# endif /* _WCHAR_T */
+# if !defined (_WINT_T)
+# define _WINT_T
+# if (_MIPS_SZLONG == 32)
+typedef long wint_t;
+# endif
+# if (_MIPS_SZLONG == 64)
+typedef __int32_t wint_t;
+# endif
+# endif /* _WINT_T */
+# if !defined (_MBSTATE_T)
+# define _MBSTATE_T
+/* _MSC_VER check is here for historical reason and seems wrong as it is the macro defined
+ * by Microsoft compilers to give their version. But we are in a SGI platform section so it
+ * is weird. However _MSC_VER might also be a SGI compiler macro so we keep it this way.*/
+# if defined (_MSC_VER)
+typedef int mbstate_t;
+# else
+typedef char mbstate_t;
+# endif
+# endif /* _MBSTATE_T */
+# endif /* ROOT65 */
+#elif defined (_STLP_USE_GLIBC)
+# include <ctype.h>
+#endif
+
+/*
+ * GENERAL FRAMEWORK
+ */
+
+/*
+ * Opaque types, implementation (if there is one) depends
+ * on platform localisation API.
+ */
+struct _Locale_ctype;
+struct _Locale_codecvt;
+struct _Locale_numeric;
+struct _Locale_time;
+struct _Locale_collate;
+struct _Locale_monetary;
+struct _Locale_messages;
+
+/*
+ Bitmask macros.
+*/
+
+/*
+ * For narrow characters, we expose the lookup table interface.
+ */
+
+#if defined (_STLP_USE_GLIBC)
+/* This section uses macros defined in the gnu libc ctype.h header */
+# define _Locale_CNTRL _IScntrl
+# define _Locale_UPPER _ISupper
+# define _Locale_LOWER _ISlower
+# define _Locale_DIGIT _ISdigit
+# define _Locale_XDIGIT _ISxdigit
+# define _Locale_PUNCT _ISpunct
+# define _Locale_SPACE _ISspace
+# define _Locale_PRINT _ISprint
+# define _Locale_ALPHA _ISalpha
+#else
+/* Default values based on C++ Standard 22.2.1.
+ * Under Windows the localisation implementation take care of mapping its
+ * mask values to those internal values. For other platforms without real
+ * localization support we are free to use the most suitable values.*/
+# define _Locale_SPACE 0x0001
+# define _Locale_PRINT 0x0002
+# define _Locale_CNTRL 0x0004
+# define _Locale_UPPER 0x0008
+# define _Locale_LOWER 0x0010
+# define _Locale_ALPHA 0x0020
+# define _Locale_DIGIT 0x0040
+# define _Locale_PUNCT 0x0080
+# define _Locale_XDIGIT 0x0100
+#endif
+
+#endif /* _STLP_C_LOCALE_H */
diff --git a/stlport/stl/char_traits.h b/stlport/stl/char_traits.h
new file mode 100644
index 0000000..f004a70
--- /dev/null
+++ b/stlport/stl/char_traits.h
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_CHAR_TRAITS_H
+#define _STLP_CHAR_TRAITS_H
+
+// Define char_traits
+
+#ifndef _STLP_INTERNAL_CSTDDEF
+# include <stl/_cstddef.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CSTRING
+# include <stl/_cstring.h>
+#endif
+
+#if defined (__unix)
+# include <sys/types.h> // For off_t
+#endif /* __unix */
+
+#if defined (__BORLANDC__)
+# include <mem.h>
+# include <string.h>
+# include <_stddef.h>
+# include <sys/types.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CONSTRUCT_H
+# include <stl/_construct.h>
+#endif
+
+#ifndef _STLP_INTERNAL_CWCHAR
+# include <stl/_cwchar.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+template <class _Tp> class allocator;
+
+#define _STLP_NULL_CHAR_INIT(_ChT) _STLP_DEFAULT_CONSTRUCTED(_ChT)
+
+#if defined(_STLP_WCE)
+typedef long streamoff;
+#elif defined (_STLP_WIN32)
+# if defined (_STLP_LONG_LONG) && !defined (__CYGWIN__)
+//The Win32 file io API support 64 bits access so streamoff and streamsize
+//has to reflect that. Do not change the stringbuf behavior.
+typedef _STLP_LONG_LONG streamoff;
+# else
+typedef ptrdiff_t streamoff;
+# endif
+#else // __unix
+# ifdef _STLP_USE_DEFAULT_FILE_OFFSET
+typedef off_t streamoff;
+# elif defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE) /* || defined(__USE_FILE_OFFSET64) */ \
+ /* || (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */ /* || defined (__sgi) && defined (_STLP_HAS_NO_NEW_C_HEADERS) */
+typedef off64_t streamoff;
+# else
+typedef off_t streamoff;
+# endif
+#endif /* __unix */
+
+#if defined (_STLP_WIN32)
+typedef streamoff streamsize;
+#else
+typedef ptrdiff_t streamsize;
+#endif
+
+// Class fpos, which represents a position within a file. (The C++
+// standard calls for it to be defined in <ios>. This implementation
+// moves it to <iosfwd>, which is included by <ios>.)
+template <class _StateT> class fpos {
+public: // From table 88 of the C++ standard.
+ fpos(streamoff __pos) : _M_pos(__pos), _M_st(_STLP_NULL_CHAR_INIT(_StateT)) {}
+ fpos() : _M_pos(0), _M_st(_STLP_NULL_CHAR_INIT(_StateT)) {}
+
+ operator streamoff() const { return _M_pos; }
+
+ bool operator==(const fpos& __y) const
+ { return _M_pos == __y._M_pos; }
+ bool operator!=(const fpos& __y) const
+ { return _M_pos != __y._M_pos; }
+
+ fpos& operator+=(streamoff __off) {
+ _M_pos += __off;
+ return *this;
+ }
+ fpos& operator-=(streamoff __off) {
+ _M_pos -= __off;
+ return *this;
+ }
+
+ fpos operator+(streamoff __off) {
+ fpos __tmp(*this);
+ __tmp += __off;
+ return __tmp;
+ }
+ fpos operator-(streamoff __off) {
+ fpos __tmp(*this);
+ __tmp -= __off;
+ return __tmp;
+ }
+
+public: // Manipulation of the state member.
+ _StateT state() const { return _M_st; }
+ void state(_StateT __st) { _M_st = __st; }
+private:
+ streamoff _M_pos;
+ _StateT _M_st;
+};
+
+typedef fpos<mbstate_t> streampos;
+typedef fpos<mbstate_t> wstreampos;
+
+// Class __char_traits_base.
+template <class _CharT, class _IntT>
+class __char_traits_base {
+public:
+ typedef _CharT char_type;
+ typedef _IntT int_type;
+ typedef streamoff off_type;
+ typedef streampos pos_type;
+ typedef mbstate_t state_type;
+
+ static void _STLP_CALL assign(char_type& __c1, const char_type& __c2) { __c1 = __c2; }
+ static bool _STLP_CALL eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+ static bool _STLP_CALL lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int _STLP_CALL compare(const char_type* __s1, const char_type* __s2, size_t __n) {
+ for (size_t __i = 0; __i < __n; ++__i)
+ if (!eq(__s1[__i], __s2[__i]))
+ return __s1[__i] < __s2[__i] ? -1 : 1;
+ return 0;
+ }
+
+ static size_t _STLP_CALL length(const char_type* __s) {
+ const char_type _NullChar = _STLP_DEFAULT_CONSTRUCTED(char_type);
+ size_t __i(0);
+ for (; !eq(__s[__i], _NullChar); ++__i) {}
+ return __i;
+ }
+
+ static const char_type* _STLP_CALL find(const char_type* __s, size_t __n, const char_type& __c) {
+ for ( ; __n > 0 ; ++__s, --__n)
+ if (eq(*__s, __c))
+ return __s;
+ return 0;
+ }
+
+ static char_type* _STLP_CALL move(char_type* __s1, const char_type* __s2, size_t _Sz)
+ { return (_Sz == 0 ? __s1 : (char_type*)memmove(__s1, __s2, _Sz * sizeof(char_type))); }
+
+ static char_type* _STLP_CALL copy(char_type* __s1, const char_type* __s2, size_t __n) {
+ return (__n == 0 ? __s1 :
+ (char_type*)memcpy(__s1, __s2, __n * sizeof(char_type)));
+ }
+
+ static char_type* _STLP_CALL assign(char_type* __s, size_t __n, char_type __c) {
+ for (size_t __i = 0; __i < __n; ++__i)
+ __s[__i] = __c;
+ return __s;
+ }
+
+ static int_type _STLP_CALL not_eof(const int_type& __c)
+ { return !eq_int_type(__c, eof()) ? __c : __STATIC_CAST(int_type, 0); }
+
+ static char_type _STLP_CALL to_char_type(const int_type& __c)
+ { return (char_type)__c; }
+
+ static int_type _STLP_CALL to_int_type(const char_type& __c)
+ { return (int_type)__c; }
+
+ static bool _STLP_CALL eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static int_type _STLP_CALL eof()
+ { return (int_type)-1; }
+};
+
+// Generic char_traits class. Note that this class is provided only
+// as a base for explicit specialization; it is unlikely to be useful
+// as is for any particular user-defined type. In particular, it
+// *will not work* for a non-POD type.
+
+template <class _CharT>
+class char_traits
+ : public __char_traits_base<_CharT, _CharT> {};
+
+// Specialization for char.
+
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC char_traits<char>
+ : public __char_traits_base<char, int>,
+ public __stlport_class<char_traits<char> > {
+public:
+ typedef char char_type;
+ typedef int int_type;
+ typedef streamoff off_type;
+ typedef streampos pos_type;
+ typedef mbstate_t state_type;
+
+ static char _STLP_CALL to_char_type(const int& __c)
+ { return (char)(unsigned char)__c; }
+
+ static int _STLP_CALL to_int_type(const char& __c)
+ { return (unsigned char)__c; }
+
+ static int _STLP_CALL compare(const char* __s1, const char* __s2, size_t __n)
+ { return memcmp(__s1, __s2, __n); }
+
+ static size_t _STLP_CALL length(const char* __s)
+ { return strlen(__s); }
+
+ static void _STLP_CALL assign(char& __c1, const char& __c2)
+ { __c1 = __c2; }
+
+ static char* _STLP_CALL assign(char* __s, size_t __n, char __c) {
+ memset(__s, __c, __n);
+ return __s;
+ }
+};
+
+#if defined (_STLP_HAS_WCHAR_T)
+// Specialization for wchar_t.
+_STLP_TEMPLATE_NULL
+class _STLP_CLASS_DECLSPEC char_traits<wchar_t>
+ : public __char_traits_base<wchar_t, wint_t> {
+# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && !defined (_STLP_WCHAR_HPACC_EXCLUDE)
+public:
+# if !defined (__BORLANDC__)
+ static wchar_t* _STLP_CALL move(wchar_t* __dest, const wchar_t* __src, size_t __n)
+ { return wmemmove(__dest, __src, __n); }
+# endif
+
+ static wchar_t* _STLP_CALL copy(wchar_t* __dest, const wchar_t* __src, size_t __n)
+ { return wmemcpy(__dest, __src, __n); }
+
+# if !defined (__DMC__) && !defined (__BORLANDC__)
+ static int _STLP_CALL compare(const wchar_t* __s1, const wchar_t* __s2, size_t __n)
+ { return wmemcmp(__s1, __s2, __n); }
+# endif
+
+ static wchar_t* _STLP_CALL assign(wchar_t* __s, size_t __n, wchar_t __c)
+ { return wmemset(__s, __c, __n); }
+
+ static size_t _STLP_CALL length(const wchar_t* __s)
+ { return wcslen(__s); }
+
+ static void _STLP_CALL assign(wchar_t& __c1, const wchar_t& __c2)
+ { __c1 = __c2; }
+# endif
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_CHAR_TRAITS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/concept_checks.h b/stlport/stl/concept_checks.h
similarity index 100%
rename from stl/concept_checks.h
rename to stlport/stl/concept_checks.h
diff --git a/stlport/stl/config/_aix.h b/stlport/stl/config/_aix.h
new file mode 100644
index 0000000..45ea8b6
--- /dev/null
+++ b/stlport/stl/config/_aix.h
@@ -0,0 +1,3 @@
+#define _STLP_PLATFORM "AIX"
+
+#define _STLP_USE_UNIX_IO
diff --git a/stlport/stl/config/_android.h b/stlport/stl/config/_android.h
new file mode 100644
index 0000000..6ad94ba
--- /dev/null
+++ b/stlport/stl/config/_android.h
@@ -0,0 +1,77 @@
+#ifndef __stl_config__android_h
+#define __stl_config__android_h
+
+#define _STLP_PLATFORM "Android"
+
+// Mostly Unix-like.
+#define _STLP_UNIX 1
+
+// Have pthreads support.
+#define _PTHREADS
+
+// Don't have native <cplusplus> headers
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+// Use unix for streams
+#define _STLP_USE_UNIX_IO 1
+
+// No rtti support
+#define _STLP_NO_RTTI 1
+
+// C library is in the global namespace.
+#define _STLP_VENDOR_GLOBAL_CSTD 1
+
+// Don't have underlying local support.
+#undef _STLP_REAL_LOCALE_IMPLEMENTED
+
+// No pthread_spinlock_t in Android
+#define _STLP_DONT_USE_PTHREAD_SPINLOCK 1
+
+// Do not enable thread support
+#define _NOTHREADS 1
+
+// Little endian platform.
+#define _STLP_LITTLE_ENDIAN 1
+
+// No <exception> headers
+#define _STLP_NO_EXCEPTION_HEADER 1
+
+// No throwing exceptions
+#define _STLP_NO_EXCEPTIONS 1
+
+// No need to define our own namespace
+#define _STLP_NO_OWN_NAMESPACE 1
+
+// Use __new_alloc instead of __node_alloc, so we don't need static functions.
+#define _STLP_USE_SIMPLE_NODE_ALLOC 1
+
+// Don't use extern versions of range errors, so we don't need to
+// compile as a library.
+#define _STLP_USE_NO_EXTERN_RANGE_ERRORS 1
+
+// The system math library doesn't have long double variants, e.g
+// sinl, cosl, etc
+#define _STLP_NO_VENDOR_MATH_L 1
+
+// Define how to include our native headers.
+#define _STLP_NATIVE_HEADER(header) <libstdc++/include/header>
+#define _STLP_NATIVE_C_HEADER(header) <../include/header>
+#define _STLP_NATIVE_CPP_C_HEADER(header) <libstdc++/include/header>
+#define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <libstdc++/include/header>
+#define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <libstdc++/include/header>
+#define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <libstdc++/include/header>
+
+// Include most of the gcc settings.
+#include <stl/config/_gcc.h>
+
+// Do not use glibc, Android is missing some things.
+#undef _STLP_USE_GLIBC
+
+// No exceptions.
+#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT 1
+#define _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT 1
+
+// Android does have include_next but it doesn't work well in our build system.
+#undef _STLP_HAS_INCLUDE_NEXT
+
+#endif /* __stl_config__android_h */
diff --git a/stlport/stl/config/_apcc.h b/stlport/stl/config/_apcc.h
new file mode 100644
index 0000000..7b4e139
--- /dev/null
+++ b/stlport/stl/config/_apcc.h
@@ -0,0 +1,30 @@
+// STLport config file for Apogee 4.x
+
+#define _STLP_COMPILER "Apogee"
+
+#define _STLP_NO_NEW_NEW_HEADER 1
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+// # define _STLP_RAND48 1
+#define _STLP_LONG_LONG long long
+#define _STLP_NO_BAD_ALLOC 1
+#define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+#define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+// # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+#define _STLP_NO_EXCEPTION_HEADER 1
+
+#undef _STLP_LINK_TIME_INSTANTIATION
+#define _STLP_LINK_TIME_INSTANTIATION 1
+
+#ifdef __STDLIB
+# undef _STLP_NO_NEW_C_HEADERS
+# undef _STLP_NO_NEW_NEW_HEADER
+# undef _STLP_NO_BAD_ALLOC
+# undef _STLP_LONG_LONG
+#else
+# undef _STLP_NO_EXCEPTION_SPEC
+# define _STLP_NO_EXCEPTION_SPEC 1
+#endif
diff --git a/stlport/stl/config/_apple.h b/stlport/stl/config/_apple.h
new file mode 100644
index 0000000..899ed14
--- /dev/null
+++ b/stlport/stl/config/_apple.h
@@ -0,0 +1,118 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ */
+
+/* common configuration settings for Apple MPW MrCpp / SCpp */
+
+#define _STLP_COMPILER "spec me!"
+
+#if defined(__MRC__) && __MRC__ < 0x500
+# error Apple's MPW MrCpp v.5.0.0 or better compiler required
+#endif
+#if defined(__SC__) && __SC__ < 0x890
+# error Apple's MPW SCpp v.8.9.0 or better compiler required
+#endif
+
+/* TODO: Check that this config is necessary for all compiler versions.
+ * It is here for historical reasons for the moment.
+ */
+#define _STLP_NO_CONTAINERS_EXTENSION
+
+#ifdef qMacApp
+# ifndef __CONDITIONALMACROS__ /* skip including ConditionalMacros_AC.h if ConditionalMacros.h is already included */
+# include <CoreSwitches_AC.h>
+# include <ConditionalMacros_AC.h>
+# include <Types_AC.h>
+# define _STLP_FILE__ _FILE_AC
+# define _STLP_DEBUG_MESSAGE
+# define __stl_debug_message ProgramBreak_AC
+# include <ConditionalMacros.h>
+# endif
+# include <Types.h>
+#else
+# include <ConditionalMacros.h>
+# include <Types.h>
+#endif
+
+#define _STLP_UINT32_T UInt32
+typedef int wint_t;
+
+#ifndef TYPE_BOOL
+# error <ConditionalMacros.h> must be included. (TYPE_BOOL)
+#endif
+#if !TYPE_BOOL
+# define _STLP_NO_BOOL
+# define _STLP_DONT_USE_BOOL_TYPEDEF
+#endif
+
+#ifndef TYPE_LONGLONG
+# error <ConditionalMacros.h> must be included. (TYPE_LONGLONG)
+#endif
+#if TYPE_LONGLONG
+# define _STLP_LONG_LONG long long
+#endif
+
+#if !__option(exceptions)
+# define _STLP_HAS_NO_EXCEPTIONS
+#endif
+
+#define _STLP_DEBUG_MESSAGE_POST DebugStr("\pSTL diagnosis issued. See 'stderr' for detail.");
+#define _STLP_ASSERT_MSG_TRAILER " "
+
+#ifdef _STLP_DEBUG
+# define _STLP_THROW(x) (DebugStr("\pSTL is about to throw exception: "#x),throw x)
+#endif
+
+#if defined(__MRC__)
+# ifndef __spillargs
+# define __spillargs 1 // MrCpp requires this symbol to be defined as 1 to properly handle va_start; ref.[ file stdarg.h; line 26 ]
+# endif
+#endif
+
+#if defined(__SC__)
+#define _STLP_VENDOR_LONG_DOUBLE_MATH //*TY 12/03/2000 - SCpp's native math type is long double
+#endif
+
+#ifndef _STLP_NATIVE_INCLUDE_PATH
+# if __option(unix_includes)
+# define _STLP_NATIVE_INCLUDE_PATH ../CIncludes // expects the alias to {CIncludes} under the same folder as {STL}
+# else
+# define _STLP_NATIVE_INCLUDE_PATH ::CIncludes // expects the alias to {CIncludes} under the same folder as {STL}
+# endif
+#endif
+#if !defined(_STLP_MAKE_HEADER)
+# if !__option(unix_includes)
+# define _STLP_MAKE_HEADER(path, header) <path:header> // Mac uses ":" for directory delimiter
+# endif
+#endif
+
+# define _STLD _DBG // to keep the length of generated symbols within the compiler limitation
+
+#define _STLP_USE_STDIO_IO 1 //*TY 02/24/2000 - see also ; ref.[ file _fstream.h; line 36 ]
+#define _STLP_NO_THREADS //*TY 12/17/2000 - multi-thread capability not explored, yet.
+#undef _REENTRANT //*ty 11/24/2001 - to make sure no thread facility is activated
+#define _NOTHREADS //*ty 12/07/2001 -
+
+// native library limitations
+#define _STLP_VENDOR_GLOBAL_STD // mpw's c++ libs do not utilize namespace std yet
+#define _STLP_NO_BAD_ALLOC // known limitation
+#define _STLP_HAS_NO_NEW_C_HEADERS // known limitation
+#define _STLP_NO_NEW_NEW_HEADER // known limitation
+#define _STLP_NO_NATIVE_MBSTATE_T // known limitation
+#define _STLP_NO_NATIVE_WIDE_FUNCTIONS // known limitation
+#define _STLP_NO_NATIVE_WIDE_STREAMS // known limitation
+#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT // known limitation
+#define _STLP_BROKEN_EXCEPTION_CLASS // known limitation
+
+// compiler limitations
+# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+
+# define _STLP_MPWFIX_TRY try{ //*TY 06/01/2000 - exception handling bug workaround
+# define _STLP_MPWFIX_CATCH }catch(...){throw;} //*TY 06/01/2000 - exception handling bug workaround
+# define _STLP_MPWFIX_CATCH_ACTION(action) }catch(...){action;throw;} //*TY 06/01/2000 - exception handling bug workaround
+# define _STLP_THROW_RETURN_BUG // known limitation
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION // known limitation
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX // known limitation
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER // known limitation
+# define _STLP_NO_RELOPS_NAMESPACE // known limitation
+// end of stl_apple.h
diff --git a/stlport/stl/config/_as400.h b/stlport/stl/config/_as400.h
new file mode 100644
index 0000000..28d960b
--- /dev/null
+++ b/stlport/stl/config/_as400.h
@@ -0,0 +1,55 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+// AS/400 C++ config
+
+# ifdef _REENTRANT
+# define _PTHREADS
+# endif
+
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+# define _STLP_NO_BOOL
+# define _STLP_LIMITED_DEFAULT_TEMPLATES
+
+# define _STLP_HAS_NO_NAMESPACES
+# define _STLP_NEED_TYPENAME
+# define _STLP_NEED_EXPLICIT
+# define _STLP_HAS_NO_EXCEPTIONS
+# define _STLP_NO_EXCEPTION_SPEC
+# define _STLP_NO_ARROW_OPERATOR
+# define _STLP_NO_NEW_STYLE_CASTS
+
+# define _STLP_NEED_MUTABLE
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX
+# define _STLP_NO_BAD_ALLOC
+# define _STLP_NO_MEMBER_TEMPLATES
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+# define _STLP_NO_QUALIFIED_FRIENDS
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+
+# define _STLP_NO_METHOD_SPECIALIZATION
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+
+// # define _STLP_NO_EXCEPTION_HEADER
+
+# define _STLP_HAS_NO_NEW_C_HEADERS
+
+# define _STLP_STATIC_CONST_INIT_BUG
+# define _STLP_THROW_RETURN_BUG
+# define _STLP_LINK_TIME_INSTANTIATION
+# define _STLP_NO_TEMPLATE_CONVERSIONS
+
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_TRIVIAL_DESTRUCTOR_BUG 1
+
+# if defined(_LONG_LONG)
+# define _STLP_LONG_LONG long long
+# endif
+# if defined(_PTHREADS)
+# define _MULTI_THREADED
+# endif
+// fbp : to fix __partition() problem
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
diff --git a/stlport/stl/config/_auto_link.h b/stlport/stl/config/_auto_link.h
new file mode 100644
index 0000000..8898c55
--- /dev/null
+++ b/stlport/stl/config/_auto_link.h
@@ -0,0 +1,61 @@
+/* We do not use auto link feature when:
+ * - user asked not to use it (_STLP_DONT_USE_AUTO_LINK)
+ * - STLport is used only as a STL library (_STLP_NO_IOSTREAMS || _STLP_USE_NO_IOSTREAMS)
+ * - we are building a C translation unit, STLport is a C++ Standard library implementation
+ */
+#if !defined (__BUILDING_STLPORT) && !defined (_STLP_DONT_USE_AUTO_LINK) && \
+ !defined (_STLP_NO_IOSTREAMS) && !defined (_STLP_USE_NO_IOSTREAMS) && \
+ defined (__cplusplus)
+
+# define _STLP_STRINGIZE(X) _STLP_STRINGIZE_AUX(X)
+# define _STLP_STRINGIZE_AUX(X) #X
+
+# if defined (_STLP_DEBUG)
+# define _STLP_LIB_OPTIM_MODE "stld"
+# elif defined (_DEBUG)
+# define _STLP_LIB_OPTIM_MODE "d"
+# else
+# define _STLP_LIB_OPTIM_MODE ""
+# endif
+
+# if defined (_STLP_LIB_NAME_MOTIF)
+# define _STLP_LIB_MOTIF "_"_STLP_LIB_NAME_MOTIF
+# else
+# define _STLP_LIB_MOTIF ""
+# endif
+
+# if defined (_STLP_USE_DYNAMIC_LIB)
+# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# define _STLP_LIB_TYPE "_x"
+# else
+# define _STLP_LIB_TYPE ""
+# endif
+# else
+# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# define _STLP_LIB_TYPE "_statix"
+# else
+# define _STLP_LIB_TYPE "_static"
+# endif
+# endif
+
+# if defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_VERSION_STR "."_STLP_STRINGIZE(_STLPORT_MAJOR)"."_STLP_STRINGIZE(_STLPORT_MINOR)
+# else
+# define _STLP_VERSION_STR ""
+# endif
+
+# define _STLP_STLPORT_LIB "stlport"_STLP_LIB_OPTIM_MODE""_STLP_LIB_TYPE""_STLP_LIB_MOTIF""_STLP_VERSION_STR".lib"
+
+# if defined (_STLP_VERBOSE)
+# pragma message ("STLport: Auto linking to "_STLP_STLPORT_LIB)
+# endif
+# pragma comment (lib, _STLP_STLPORT_LIB)
+
+# undef _STLP_STLPORT_LIB
+# undef _STLP_LIB_OPTIM_MODE
+# undef _STLP_LIB_TYPE
+# undef _STLP_STRINGIZE_AUX
+# undef _STLP_STRINGIZE
+
+#endif /* _STLP_DONT_USE_AUTO_LINK */
+
diff --git a/stlport/stl/config/_bc.h b/stlport/stl/config/_bc.h
new file mode 100644
index 0000000..e3802dc
--- /dev/null
+++ b/stlport/stl/config/_bc.h
@@ -0,0 +1,138 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly */
+
+#define _STLP_COMPILER "Borland"
+
+#if (__BORLANDC__ < 0x551)
+# error - Borland compilers below version 5.5.1 not supported.
+#endif
+
+#pragma defineonoption _STLP_NO_RTTI -RT-
+
+#define _STLP_DONT_SUP_DFLT_PARAM
+
+#if (__BORLANDC__ >= 0x580)
+# define _STLP_HAS_INCLUDE_NEXT
+# define _STLP_NATIVE_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/dinkumware/##header>
+# define _STLP_NO_NEW_C_HEADERS
+# define _STLP_NO_FORCE_INSTANTIATE
+#endif
+
+#if (__BORLANDC__ >= 0x570) && (__BORLANDC__ < 0x580)
+# define _STLP_NO_NEW_C_HEADERS
+# define _STLP_NO_FORCE_INSTANTIATE
+# define _STLP_DEF_CONST_DEF_PARAM_BUG
+# define _STLP_USE_DEFAULT_FILE_OFFSET
+
+# if defined (__cplusplus)
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include/c++/ ## GCC_VERSION
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../include/c++/ ## GCC_VERSION
+# endif
+
+# undef _SYS_CDEFS_H
+# include </usr/include/sys/cdefs.h>
+
+# ifdef __MT__
+# define _PTHREADS
+# if !defined (_RTLDLL)
+# define _STLP_DONT_USE_PTHREAD_SPINLOCK
+# endif
+# else
+# define _NOTHREADS
+# endif
+
+# pragma defineonoption _CPPUNWIND -xd
+# define _STLP_NO_EXCEPTION_HEADER
+# define _STLP_DONT_USE_EXCEPTIONS
+#endif
+
+#if (__BORLANDC__ >= 0x560) && (__BORLANDC__ < 0x570)
+# define _USE_OLD_RW_STL
+#endif
+
+#if (__BORLANDC__ >= 0x560)
+# if !defined (__BUILDING_STLPORT)
+# define NOWINBASEINTERLOCK
+# endif
+# define _STLP_LANG_INVARIANT_DEFINED
+#endif
+
+#if (__BORLANDC__ < 0x590)
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION
+ // <bitset> problems
+# define _STLP_MEMBER_SPECIALIZATION_BUG 1
+# ifdef __cplusplus
+# define _STLP_TR1 _STLP_STD_NAME::tr1::
+# endif
+#endif
+
+#if (__BORLANDC__ < 0x564)
+# define _STLP_QUALIFIED_SPECIALIZATION_BUG
+# define _STLP_NO_MOVE_SEMANTIC
+#endif
+
+#define _STLP_DONT_USE_PRIV_NAMESPACE
+#define _STLP_NO_TYPENAME_BEFORE_NAMESPACE
+#define _STLP_NO_VENDOR_STDLIB_L
+#define _STLP_NO_VENDOR_MATH_F
+#define _STLP_DONT_USE_SHORT_STRING_OPTIM 1
+
+#if (__BORLANDC__ < 0x570) || (__BORLANDC__ >= 0x580)
+#define _STLP_NO_NATIVE_MBSTATE_T
+#undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+#endif
+
+#if (__BORLANDC__ < 0x580) && !defined (_RTLDLL)
+# define _UNCAUGHT_EXCEPTION 1
+#endif
+
+// <limits> problem
+#define _STLP_STATIC_CONST_INIT_BUG
+
+#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG 1
+
+#define _STLP_LONG_LONG __int64
+
+// auto enable thread safety and exceptions:
+#ifndef _CPPUNWIND
+# define _STLP_HAS_NO_EXCEPTIONS
+#endif
+
+#if defined (__MT__) && !defined (_NOTHREADS)
+# define _STLP_THREADS
+#endif
+
+#define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+
+#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+
+#if defined (_DLL)
+# define _STLP_DLL
+#endif
+#if defined (_RTLDLL)
+# define _STLP_RUNTIME_DLL
+#endif
+#include <stl/config/_detect_dll_or_lib.h>
+#undef _STLP_RUNTIME_DLL
+#undef _STLP_DLL
+
+#if defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DECLSPEC 1
+# if defined (__BUILDING_STLPORT)
+# define _STLP_CALL __cdecl __export
+# else
+# define _STLP_CALL __cdecl
+# endif
+#else
+# define _STLP_CALL __cdecl
+#endif
+
+#if !defined (__linux__)
+# include <stl/config/_auto_link.h>
+#endif
+
+#include <stl/config/_feedback.h>
diff --git a/stl/config/_como.h b/stlport/stl/config/_como.h
similarity index 100%
rename from stl/config/_como.h
rename to stlport/stl/config/_como.h
diff --git a/stlport/stl/config/_cray.h b/stlport/stl/config/_cray.h
new file mode 100644
index 0000000..55327c1
--- /dev/null
+++ b/stlport/stl/config/_cray.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#define _STLP_COMPILER "CC"
+
+// Mostly correct guess, change it for Alpha (and other environments
+// that has 64-bit "long")
+# define _STLP_UINT32_T unsigned long
+
+// Uncomment if long long is available
+# define _STLP_LONG_LONG long long
+
+// Uncomment this if your compiler can't inline while(), for()
+# define _STLP_LOOP_INLINE_PROBLEMS 1
+
+// Uncomment this if your compiler does not support exceptions
+// Cray C++ supports exceptions when '-h exceptions' option is user;
+// therefore '-D_STLP_HAS_NO_EXCEPTIONS' must be used when '-h exceptions'
+// is NOT used.
+//# define _STLP_HAS_NO_EXCEPTIONS 1
+
+// Delete?
+// Define this if compiler lacks <exception> header
+//# define _STLP_NO_EXCEPTION_HEADER 1
+
+// Uncomment this if your C library has lrand48() function
+# define _STLP_RAND48 1
+
+// Uncomment if native new-style C library headers lile <cstddef>, etc are not available.
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+// uncomment if new-style headers <new> is available
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+// uncomment this if <iostream> and other STD headers put their stuff in ::namespace,
+// not std::
+# define _STLP_VENDOR_GLOBAL_STD
+
+// uncomment this if <cstdio> and the like put stuff in ::namespace,
+// not std::
+# define _STLP_VENDOR_GLOBAL_CSTD
+
+# define _STLP_NATIVE_C_HEADER(__x) </usr/include/##__x>
+// WARNING: Following is hardcoded to the system default C++ include files
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(__x) </opt/ctl/CC/CC/include/##__x>
+
+
+# define _STLP_NO_NATIVE_MBSTATE_T
+# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS
+//# define _STLP_VENDOR_GLOBAL_EXCEPT_STD
diff --git a/stlport/stl/config/_cygwin.h b/stlport/stl/config/_cygwin.h
new file mode 100644
index 0000000..8610743
--- /dev/null
+++ b/stlport/stl/config/_cygwin.h
@@ -0,0 +1,9 @@
+#define _STLP_PLATFORM "Cygwin"
+
+#define _STLP_UNIX
+
+#ifndef _STLP_USE_STDIO_IO
+# define _STLP_USE_UNIX_IO
+#endif
+
+#define _STLP_LDOUBLE_96
diff --git a/stlport/stl/config/_dec.h b/stlport/stl/config/_dec.h
new file mode 100644
index 0000000..fc8ace7
--- /dev/null
+++ b/stlport/stl/config/_dec.h
@@ -0,0 +1,113 @@
+#define _STLP_COMPILER "Dec"
+
+# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+
+# define _STLP_NATIVE_HEADER(header) <../cxx/##header>
+# define _STLP_NATIVE_C_HEADER(x) <../include/##x>
+
+#if (__DECCXX_VER < 60300000)
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../cxx/##header>
+#else
+# define _STLP_NATIVE_CPP_C_HEADER(header) </usr/include/cxx_cname/##header>
+#endif
+
+# define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <../cxx/##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../cxx/##header>
+
+/* Alpha is little-endian */
+# define _STLP_LITTLE_ENDIAN
+
+// collisions
+# define _STLP_DONT_PUT_STLPORT_IN_STD
+
+#if (__DECCXX_VER < 60000000)
+
+/*
+ automatic template instantiation does not
+ work with namespaces ;(
+*/
+# define _STLP_HAS_NO_NAMESPACES 1
+
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NEED_EXPLICIT 1
+
+# define _STLP_NO_BOOL 1
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_BAD_ALLOC 1
+
+
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_BROKEN_USING_DIRECTIVE 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+
+#endif
+
+
+#ifndef __NO_USE_STD_IOSTREAM
+/* default is to use new iostreams, anyway */
+# ifndef __USE_STD_IOSTREAM
+# define __USE_STD_IOSTREAM
+# endif
+#endif
+
+/*
+# ifndef __STD_STRICT_ANSI_ERRORS
+# endif
+*/
+
+#ifndef __EXCEPTIONS
+# define _STLP_HAS_NO_EXCEPTIONS 1
+#endif
+
+# ifdef __IMPLICIT_INCLUDE_ENABLED
+
+/* but, works with ours ;). */
+# define _STLP_LINK_TIME_INSTANTIATION 1
+# else
+# undef _STLP_LINK_TIME_INSTANTIATION
+# endif
+
+# if defined (__IMPLICIT_USING_STD) && !defined (__NO_USE_STD_IOSTREAM)
+/*
+ we should ban that !
+ # error "STLport won't work with new iostreams and std:: being implicitly included. Please use -std strict_ansi[_errors] or specify __NO_USE_STD_IOSTREAM"
+*/
+# endif
+
+# if (defined (__STD_STRICT_ANSI) || defined (__STD_STRICT_ANSI_ERRORS))
+# define _STLP_STRICT_ANSI 1
+# else
+/* we want to enforce it */
+# define _STLP_LONG_LONG long long
+# endif
+
+/* unsigned 32-bit integer type */
+# define _STLP_UINT32_T unsigned int
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+/* # define _STLP_RAND48 1 */
+
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+
+# if (__DECCXX_VER <= 60600000)
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# endif
+
+#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED)
+# define _STLP_DEC_THREADS
+#endif
diff --git a/stlport/stl/config/_dec_vms.h b/stlport/stl/config/_dec_vms.h
new file mode 100644
index 0000000..44a0fb8
--- /dev/null
+++ b/stlport/stl/config/_dec_vms.h
@@ -0,0 +1,89 @@
+// OpenVMS version
+
+#define _STLP_COMPILER "Dec Vms"
+
+# define _STLP_NATIVE_HEADER(header) <sys$library:##header>
+# define _STLP_NATIVE_C_HEADER(x) <sys$library:##x>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <sys$library:##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <sys$library:##header>
+
+#if (__DECCXX_VER < 60000000)
+
+// automatic template instantiation does not
+// work with namespaces ;(
+# define _STLP_HAS_NO_NAMESPACES 1
+
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NEED_EXPLICIT 1
+
+# define _STLP_NO_BOOL 1
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_BAD_ALLOC 1
+
+# define _STLP_NO_NEW_NEW_HEADER 1
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_BROKEN_USING_DIRECTIVE 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+
+#endif
+
+
+#ifdef __NO_USE_STD_IOSTREAM
+# define _STLP_USE_NO_IOSTREAMS 1
+# else
+// default is to use new iostreams, anyway
+# ifndef __USE_STD_IOSTREAM
+# define __USE_STD_IOSTREAM
+# endif
+#endif
+
+#ifndef __EXCEPTIONS
+# define _STLP_HAS_NO_EXCEPTIONS 1
+#endif
+
+# ifdef __IMPLICIT_INCLUDE_ENABLED
+
+#ifdef _STLP_USE_NO_IOSTREAMS
+// implicit include introduces conflicts
+// between stlport and native lib.
+# undef __IMPLICIT_INCLUDE_ENABLED
+#endif
+
+// but, works with ours ;).
+# define _STLP_LINK_TIME_INSTANTIATION 1
+
+# endif
+
+# if defined (__IMPLICIT_USING_STD) && !defined (__NO_USE_STD_IOSTREAM)
+// we should ban that !
+# error "STLport won't work with new iostreams and std:: being implicitly included. Please use -std strict_ansi[_errors] or specify __NO_USE_STD_IOSTREAM"
+# endif
+
+# if !(defined (__STD_STRICT_ANSI) || defined (__STD_STRICT_ANSI_ERRORS))
+// we want to enforce it
+# define _STLP_LONG_LONG long long
+# endif
+
+// unsigned 32-bit integer type
+# define _STLP_UINT32_T unsigned int
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+// # define _STLP_RAND48 1
+
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+
diff --git a/stlport/stl/config/_detect_dll_or_lib.h b/stlport/stl/config/_detect_dll_or_lib.h
new file mode 100644
index 0000000..a062e69
--- /dev/null
+++ b/stlport/stl/config/_detect_dll_or_lib.h
@@ -0,0 +1,74 @@
+/* File used to define macros:
+ * _STLP_USE_DYNAMIC_LIB: To signal use STLport as a dll or build of the
+ * STLport dlls.
+ * _STLP_USE_STATIC_LIB: To signal use of STLport as a static lib or build of
+ * the STLport static libs.
+ * _STLP_USING_CROSS_NATIVE_RUNTIME_LIB: Signal that we are using a native runtime
+ * in a version different from the STLport one.
+ * If _STLP_USE_DYNAMIC_LIB or _STLP_USE_STATIC_LIB is alreday defined it means that
+ * user forces use of a specific version. In this case _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+ * will surely be defined otherwise there is no need to force macro defines.
+ *
+ * Before including this file the compiler must define:
+ * _STLP_DLL: If we are building a dll
+ * _STLP_RUNTIME_DLL: If we are using native runtime as a dll
+ */
+#if defined (__BUILDING_STLPORT)
+# undef _STLP_USE_DYNAMIC_LIB
+# undef _STLP_USE_STATIC_LIB
+# if defined (_STLP_DLL)
+/* We are building the STLport dll */
+# define _STLP_USE_DYNAMIC_LIB
+# if !defined (_STLP_RUNTIME_DLL)
+# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+# endif
+# else
+# define _STLP_USE_STATIC_LIB
+# if defined (_STLP_RUNTIME_DLL)
+# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+# endif
+# endif
+#else
+# if !defined (_STLP_NO_IOSTREAMS)
+/* STLport use only depend on _STLP_RUNTIME_DLL as we are replacing
+ * the native runtime.
+ */
+# if defined (_STLP_RUNTIME_DLL)
+# if !defined (_STLP_USE_STATIC_LIB)
+# if !defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DYNAMIC_LIB
+# endif
+# else
+/* The user is forcing use of STLport as a dynamic library. We signal it so
+ * that the STLport namespace will be modify to report such a combination
+ * and force the user to link with the rebuilt STLport library.
+ */
+# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+# endif
+# else
+# if !defined(_STLP_USE_DYNAMIC_LIB)
+# if !defined (_STLP_USE_STATIC_LIB)
+# define _STLP_USE_STATIC_LIB
+# endif
+# else
+/* Idem previous remark but the user forces use of the static native runtime.
+ */
+# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+# endif
+# endif
+# else
+/* If we do not build and use STLport libs we consider that we are in a static lib
+ * mode as only dynamic lib needs additional export/import specifier.
+ */
+# define _STLP_USE_STATIC_LIB
+# endif
+#endif
+
+/* we don't have a static native runtime library on evc3/evc4 */
+#ifdef _STLP_WCE
+# undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+#endif
+
+#if !defined (_STLP_USE_DYNAMIC_LIB) && !defined (_STLP_USE_STATIC_LIB)
+# error Unknown STLport usage config (dll/lib?)
+#endif
diff --git a/stlport/stl/config/_dm.h b/stlport/stl/config/_dm.h
new file mode 100644
index 0000000..4f70732
--- /dev/null
+++ b/stlport/stl/config/_dm.h
@@ -0,0 +1,121 @@
+// STLport configuration file for Digital Mars C++
+
+#define _STLP_COMPILER __DMC_VERSION_STRING__
+
+#if (__DMC__ < 0x849)
+# error "Digital Mars C++ compilers before version 8.49 are not supported!"
+#endif
+
+/* DMC goes too far in template instanciation and tries to fully instanciate
+ * slist<pair<const int, string> > for instance. The generation of assignment
+ * operator fails of course so we are force to use mutable key for this compiler.
+ */
+#define _STLP_NO_CONST_IN_PAIR
+#define _STLP_DONT_SUP_DFLT_PARAM
+
+#ifndef _CPPUNWIND
+# define _STLP_NO_EXCEPTIONS
+#endif
+
+#ifndef _CPPRTTI
+# define _STLP_NO_RTTI
+#endif
+
+#define _STLP_VENDOR_GLOBAL_CSTD
+
+//DMC prefer enum to real static const variable because it do not consider
+//static const as const enough to be used in switch declaration...
+#define _STLP_STATIC_CONST_INIT_BUG
+
+#if !defined (_WIN32)
+// it's not fully supported on non-Win32 platforms
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS
+#endif
+
+/* _STLP_NO_OWN_NAMESPACE is defined because Digital Mars' linker and libarian
+ appear to have problems with STLport namespaces. Summary of the issues:
+
+ STATIC: Digital Mars' librarian (lib.exe) may fail with "len <= IDMAX" error
+ if _STLP_DEBUG is defined. This is because Digital Mars' librarian uses
+ Microsoft OMF format, which limits identifier length to about 512 bytes.
+ With STLport namespaces, some identifiers such as Category_Map in
+ src/locale_catalog.cpp may exceed the maximum OMF identifier length.
+
+ DYNAMIC: Export issues with cin, cout, cerr, clog in src/iostream.cpp.
+ Exports in Digital Mars 'def' file must match mangled names in iostream.cpp.
+ With STLport namespaces, the mangled names in the intermediate files no
+ longer match these pre-defined exports. To use STLport dynamic libraries
+ and STLport namespaces with Digital Mars, the pre-defined exports in
+ src/iostream.cpp and the related Digital Mars 'def' files would need to be
+ revised. */
+#define _STLP_NO_OWN_NAMESPACE 1
+
+// select threads strategy
+#if defined (_MT) && !defined (_STLP_NO_THREADS)
+# define _STLP_THREADS
+#endif
+
+#ifndef _BOOL_DEFINED
+# define _STLP_NO_BOOL
+#else
+# define _STLP_DONT_USE_BOOL_TYPEDEF
+#endif
+
+#if _INTEGRAL_MAX_BITS >= 64
+# define _STLP_LONG_LONG long long
+#endif
+
+#define _STLP_MARK_PARAMETER_AS_UNUSED(X)
+#define _STLP_DONT_USE_PRIV_NAMESPACE
+#define _STLP_PRIV
+#define _STLP_THROW_RETURN_BUG
+
+#if !defined (_DLL)
+# undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+#endif
+
+#if (__DMC__ < 0x849)
+# define _STLP_NO_BAD_ALLOC
+#endif
+
+#define _STLP_USE_ABBREVS
+#define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+
+#define _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND
+#define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+
+#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+
+#define _STLP_NEED_ADDITIONAL_STATIC_DECLSPEC
+
+//#define _STLP_IMPORT_TEMPLATE_KEYWORD __declspec(dllimport)
+//#define _STLP_EXPORT_TEMPLATE_KEYWORD __declspec(dllexport)
+
+#if defined (_WINDLL)
+# define _STLP_DLL
+#endif
+#if defined (_DLL)
+# define _STLP_RUNTIME_DLL
+#endif
+#include <stl/config/_detect_dll_or_lib.h>
+#undef _STLP_RUNTIME_DLL
+#undef _STLP_DLL
+
+#if defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DECLSPEC 1
+# if defined (__BUILDING_STLPORT)
+# define _STLP_CALL __export
+# else
+# define _STLP_CALL
+# endif
+#else
+# define _STLP_CALL
+#endif
+
+#include <stl/config/_auto_link.h>
+
+#undef __SC__
+
+#include <stl/config/_feedback.h>
diff --git a/stlport/stl/config/_epilog.h b/stlport/stl/config/_epilog.h
new file mode 100644
index 0000000..30d1e24
--- /dev/null
+++ b/stlport/stl/config/_epilog.h
@@ -0,0 +1,29 @@
+#if defined (_STLP_MSVC) || defined (__ICL)
+
+# pragma warning (pop)
+# pragma pack (pop)
+
+#elif defined (__BORLANDC__)
+
+# pragma option pop
+# pragma option -w-pow // -w-8062 Previous options and warnings not restored
+
+#elif defined (__sgi) && !defined (__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+
+# pragma reset woff 1174
+# pragma reset woff 1375
+# pragma reset woff 1209
+/* from iterator_base.h */
+# pragma reset woff 1183
+
+#elif defined (__DECCXX)
+
+# ifdef __PRAGMA_ENVIRONMENT
+# pragma __environment __restore
+# endif
+
+#elif defined (__IBMCPP__)
+
+# pragma info(restore)
+
+#endif
diff --git a/stlport/stl/config/_evc.h b/stlport/stl/config/_evc.h
new file mode 100644
index 0000000..c460450
--- /dev/null
+++ b/stlport/stl/config/_evc.h
@@ -0,0 +1,333 @@
+/*
+ * File to have Microsoft eMbedded Visual C++ 3.0 and .NET working with STLport
+ * May 2004
+ * Origin : Zdenek Nemec - zero@mapfactor.com
+ * Michael Fink - vividos@users.sourceforge.net
+ */
+
+#ifndef _STLP_EVC_H
+#define _STLP_EVC_H
+
+#define _STLP_COMPILER "eMbedded Visual C++"
+
+// This flag is being used by STLport to support
+// old-fashioned Windows CE SDK (see stl_wince.h)
+// do not use with eMebedded Visual C++ 3 or 4!
+#ifdef _STLP_WINCE
+# undef _STLP_WINCE
+#endif
+
+/* Compiler dependent define. The following defines may be available:
+ * _STLP_WCE_EVC3 when compiling under eMbedded Visual C++ 3
+ * _STLP_WCE_NET when compiling under eMbedded Visual C++ .NET
+ * _STLP_WCE always defined when compiling with one of the above
+ */
+#undef _STLP_WCE_EVC3
+#undef _STLP_WCE_NET
+
+#if (_WIN32_WCE > 300)
+# define _STLP_WCE_NET UNDER_CE
+#elif (_WIN32_WCE == 300)
+# define _STLP_WCE_EVC3 UNDER_CE
+#else
+# error No support for Windows CE below 3.0!
+#endif
+
+// This is defined for all platforms using Windows CE
+#define _STLP_WCE
+
+/* All Windows CE versions up to at least version 5 are little-endian, even
+ * if the hardware (like e.g. MIPS) can be configured for big-endian, too. */
+#define _STLP_LITTLE_ENDIAN
+
+// Ensure _DEBUG is defined.
+#if defined (DEBUG) && !defined (_DEBUG)
+# define _DEBUG
+#endif
+
+// inherit all msvc6 options
+#include <stl/config/_msvc.h>
+
+// CE up to at least version 5 has no C locale support
+#define _STLP_NO_LOCALE_SUPPORT
+
+#if _WIN32_WCE >= 420
+ // SDKs built with PB5 have terminate&co in namespace std...
+# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_STD
+# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_STD
+ // ...and new_handler/set_new_handler in the global namespace.
+# define _STLP_GLOBAL_NEW_HANDLER 1
+#endif
+
+// Always threaded in eMbedded Visual C++ 3.0 and .NET
+#ifndef _MT
+# define _MT
+#endif
+
+// we don't have a static native runtime library
+#undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
+
+#if _WIN32_WCE < 400
+// no long double under CE3 and older
+# define _STLP_NO_LONG_DOUBLE
+#endif
+
+// no *f and *l math functions available
+#define _STLP_NO_VENDOR_MATH_F
+#define _STLP_NO_VENDOR_MATH_L
+
+/*
+ * Redirect cout, cerr and clog:
+ * If defined redirect cout, cerr and clog to
+ * files stdout.txt, stderr.txt and stdlog.txt
+ */
+//# define _STLP_REDIRECT_STDSTREAMS
+
+/*
+ * Static class members may generate LNK1179:
+ * Wrong COMDAT packing may cause LNK1179 error.
+ * For details see http://groups.google.com/groups?th=8a05c82c4ffee280
+ * example P78. This define is not used/needed at this moment
+ * but may came handy in future...
+ */
+//# define _STLP_STATIC_MEMBERS_BUG
+
+// Use wide-string interface of windows native functions (CreateFile...).
+// Note that this should be defined all the time while under CE.
+#if defined (UNICODE)
+# define _STLP_USE_WIDE_INTERFACE
+#endif
+
+// Force exception std to std instead of __std_alias.
+#if defined (__cplusplus) && !defined (_STLP_HAS_NO_NAMESPACES)
+# ifdef _STLP_VENDOR_EXCEPT_STD
+# undef _STLP_VENDOR_EXCEPT_STD
+# endif
+# define _STLP_VENDOR_EXCEPT_STD std
+#endif
+
+// short string optimization bug under evc3, evc4 using ARM compiler
+#if _MSC_VER < 1400 && (defined (ARM) || defined (_ARM_))
+# define _STLP_DONT_USE_SHORT_STRING_OPTIM
+#endif
+
+// when using MFC, disable another placement new declaration, since there is one in wcealt.h
+#if !defined (__BUILDING_STLPORT) && defined (_MFC_VER)
+# define __PLACEMENT_NEW_INLINE
+#endif
+
+// threads
+#undef _REENTRANT
+#define _REENTRANT
+#undef _NOTHREADS
+
+// Use old fashioned headers (ctime vs. time.h).
+#undef _STLP_NO_NEW_C_HEADERS
+#define _STLP_NO_NEW_C_HEADERS
+
+// exception handling support: only on evc4 and user added /GX to project settings
+#if defined (_STLP_WCE_EVC3) || !defined (_CPPUNWIND)
+# define _STLP_NO_EXCEPTION_HEADER
+# define _STLP_NO_EXCEPTIONS
+# undef _STLP_USE_EXCEPTIONS
+# ifndef _STLP_THROW_BAD_ALLOC
+# define _STLP_THROW_BAD_ALLOC { _STLP_WINCE_TRACE(L"out of memory"); ExitThread(1); }
+# endif
+#endif
+
+#define _STLP_WINCE_TRACE(msg) OutputDebugString(msg)
+
+/*
+ * eMbedded Visual C++ .NET specific settings
+ */
+#if defined (_STLP_WCE_NET)
+
+// evc4 has no locale and time support
+# define _STLP_NO_LOCALE_SUPPORT
+# define _STLP_NO_TIME_SUPPORT
+
+// ptrdiff_t is not defined in evc4 headers
+# ifndef _PTRDIFF_T_DEFINED
+ typedef int ptrdiff_t;
+# define _PTRDIFF_T_DEFINED
+# endif
+
+/*
+ * Helper macros for including the native headers in cases where a file with
+ * the same name also exists in the STLport include folder. The idea behind
+ * this is that we first go up one directory and then down into a dir that
+ * is only present in the native install but not in STLport.
+ *
+ */
+# if !defined (_STLP_NATIVE_INCLUDE_PATH)
+# if defined (_X86_)
+# if defined (_STLP_WCE_TARGET_PROC_SUBTYPE_EMULATOR)
+# define _STLP_NATIVE_INCLUDE_PATH ../Emulator
+# else
+# define _STLP_NATIVE_INCLUDE_PATH ../X86
+# endif
+# elif defined (_ARM_)
+# if _MSC_VER < 1400
+ // eVC3/4
+# if defined (ARMV4)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4
+# elif defined (ARMV4I)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i
+# elif defined (ARMV4T)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4t
+# else
+# error Unknown ARM SDK.
+# endif
+# else
+ // VC8 crosscompiling for CE
+# if defined (ARMV4)
+ // VC8 bundled Pocket PC 2003 SDK don't have a target CPU subfolder.
+# if defined(WIN32_PLATFORM_PSPC)
+# define _STLP_NATIVE_INCLUDE_PATH ../Include
+# else
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4
+# endif
+# elif defined(ARMV4I) || defined(ARMV4T)
+# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i
+# else
+# error Unknown ARM SDK.
+# endif
+# endif
+# elif defined (_MIPS_)
+# if defined (MIPS16)
+# define _STLP_NATIVE_INCLUDE_PATH ../mips16
+# elif defined (MIPSII)
+# define _STLP_NATIVE_INCLUDE_PATH ../mipsII
+# elif defined (MIPSII_FP)
+# define _STLP_NATIVE_INCLUDE_PATH ../mipsII_fp
+# elif defined (MIPSIV)
+# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV
+# elif defined (MIPSIV_FP)
+# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV_fp
+# else
+# error Unknown MIPS SDK.
+# endif
+# elif defined (SHx)
+# if defined (SH3)
+# define _STLP_NATIVE_INCLUDE_PATH ../sh3
+# elif defined (SH4)
+# define _STLP_NATIVE_INCLUDE_PATH ../sh4
+# else
+# error Unknown SHx SDK.
+# endif
+# else
+# error Unknown SDK.
+# endif
+# endif /* !_STLP_NATIVE_INCLUDE_PATH */
+
+/* Workaround when using MFCCE and using <new> together: MFCCE's wcealt.h doesn't
+ * check for __PLACEMENT_NEW_INLINE before defining operator new, so when <new>
+ * defines the operatore before, there will be an error C2084:
+ * "function 'void *__cdecl operator new(unsigned int,void *)' already has a body".
+ */
+# ifdef _STLP_USE_MFC
+# define __PLACEMENT_NEW_INLINE
+# endif
+
+#endif /* _STLP_WCE_NET */
+
+/*
+ * eMbedded Visual C++ 3.0 specific settings
+ */
+#if defined (_STLP_WCE_EVC3)
+
+# define _STLP_NO_NATIVE_MBSTATE_T
+
+// evc3 has no locale and time support
+# define _STLP_NO_LOCALE_SUPPORT
+# define _STLP_NO_TIME_SUPPORT
+
+// evc3 has new, but no explicit header
+# define _STLP_NO_NEW_HEADER
+# define _STLP_NO_NEW_NEW_HEADER
+
+// evc3 has no bad_alloc and no typeinfo
+# undef _STLP_NO_BAD_ALLOC
+# define _STLP_NO_BAD_ALLOC
+
+# undef _STLP_NO_TYPEINFO
+# define _STLP_NO_TYPEINFO
+
+// missing things in eMbedded Visual C++ 3.0 headers
+# ifndef _SIZE_T_DEFINED
+ typedef unsigned int size_t;
+# define _SIZE_T_DEFINED
+# endif
+
+# ifndef _WCHAR_T_DEFINED
+ typedef unsigned short wchar_t;
+# define _WCHAR_T_DEFINED
+# endif
+
+// ptrdiff_t is not defined in evc3 headers
+# ifndef _PTRDIFF_T_DEFINED
+ typedef int ptrdiff_t;
+# define _PTRDIFF_T_DEFINED
+# endif
+
+// clock_t is not defined in evc3 headers
+# ifndef _CLOCK_T_DEFINED
+ typedef long clock_t;
+# define _CLOCK_T_DEFINED
+# endif
+
+// Struct tm is not defined in evc3 headers
+# ifndef _TM_DEFINED
+struct tm {
+ int tm_sec; /* seconds after the minute - [0,59] */
+ int tm_min; /* minutes after the hour - [0,59] */
+ int tm_hour; /* hours since midnight - [0,23] */
+ int tm_mday; /* day of the month - [1,31] */
+ int tm_mon; /* months since January - [0,11] */
+ int tm_year; /* years since 1900 */
+ int tm_wday; /* days since Sunday - [0,6] */
+ int tm_yday; /* days since January 1 - [0,365] */
+ int tm_isdst; /* daylight savings time flag */
+};
+# define _TM_DEFINED
+# endif
+
+// define placement new and delete operator
+// note: when MFCCE headers are included first, don't define the new operator,
+// since it was already defined in wcealt.h
+# ifdef __cplusplus
+# ifndef __PLACEMENT_NEW_INLINE
+# ifndef _MFC_VER
+inline void *__cdecl operator new(size_t, void *_P) { return (_P); }
+# endif /* _MFC_VER */
+inline void __cdecl operator delete(void *, void *) { return; }
+# define __PLACEMENT_NEW_INLINE
+# endif
+# endif /* __cplusplus */
+
+// evc3 doesn't have native wide functions, e.g. fgetwc, wmemmove
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS
+
+// evc3 doesn't have assert.h
+# ifndef _ASSERT_DEFINED
+# define assert(expr) _STLP_ASSERT(expr)
+# define _ASSERT_DEFINED
+# endif
+
+#endif /* _STLP_WCE_EVC3 */
+
+/*
+ * original call: TerminateProcess(GetCurrentProcess(), 0);
+ * we substitute the GetCurrentProcess() with the result of the inline function
+ * defined in kfuncs.h, since we then can avoid including <windows.h> at all.
+ * all needed Win32 API functions are defined in <stl/_windows.h>
+ */
+#ifndef _ABORT_DEFINED
+# define _STLP_ABORT() TerminateProcess(reinterpret_cast<HANDLE>(66), 0)
+# define _ABORT_DEFINED
+#endif
+
+// Notice: windows.h isn't included here anymore; all needed defines are in
+// stl/_windows.h now
+
+#endif /* _STLP_EVC_H */
diff --git a/stlport/stl/config/_feedback.h b/stlport/stl/config/_feedback.h
new file mode 100644
index 0000000..0171ca5
--- /dev/null
+++ b/stlport/stl/config/_feedback.h
@@ -0,0 +1,43 @@
+/* Helper header to give feedback about build environment configuration
+ * thanks to #pragma message directives.
+ */
+
+#if defined (_STLP_VERBOSE)
+# define _STLP_VERBOSE_MODE_SUPPORTED
+
+# if defined (_STLP_COMPILER)
+# pragma message (_STLP_COMPILER)
+# endif
+
+# if defined (_STLP_NO_RTTI)
+# pragma message ("STLport: RTTI support -> Disabled")
+# else
+# pragma message ("STLport: RTTI support -> Enabled")
+# endif
+
+# if defined (_STLP_HAS_NO_EXCEPTIONS)
+# pragma message ("STLport: Exception support -> Disabled")
+# else
+# pragma message ("STLport: Exception support -> Enabled")
+# endif
+
+# if defined (_STLP_THREADS)
+# pragma message ("STLport: Threading model -> Multi")
+# else
+# pragma message ("STLport: Threading model -> Mono")
+# endif
+
+# if defined (_STLP_USE_DYNAMIC_LIB)
+# pragma message ("STLport: Library model -> Dynamic")
+# else
+# pragma message ("STLport: Library model -> Static")
+# endif
+
+# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# if defined (_STLP_USE_DYNAMIC_LIB)
+# pragma message ("STLport: Native library model -> Static")
+# else
+# pragma message ("STLport: Native library model -> Dynamic")
+# endif
+# endif
+#endif
diff --git a/stlport/stl/config/_freebsd.h b/stlport/stl/config/_freebsd.h
new file mode 100644
index 0000000..ab9339b
--- /dev/null
+++ b/stlport/stl/config/_freebsd.h
@@ -0,0 +1,3 @@
+#define _STLP_PLATFORM "Free BSD"
+
+#define _STLP_USE_UNIX_IO
diff --git a/stl/config/_fujitsu.h b/stlport/stl/config/_fujitsu.h
similarity index 100%
rename from stl/config/_fujitsu.h
rename to stlport/stl/config/_fujitsu.h
diff --git a/stlport/stl/config/_gcc.h b/stlport/stl/config/_gcc.h
new file mode 100644
index 0000000..0d41863
--- /dev/null
+++ b/stlport/stl/config/_gcc.h
@@ -0,0 +1,198 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ */
+
+#define _STLP_COMPILER "gcc"
+
+#define _STLP_HAS_INCLUDE_NEXT 1
+
+#if (__GNUC__ < 2) || ((__GNUC__ < 3) && ((__GNUC_MINOR__ < 95) || (__GNUC_MINOR__ == 96)))
+/* We do not support neither the unofficial 2.96 gcc version. */
+# error GNU compilers before 2.95 are not supported anymore.
+#endif
+
+/* Systems having GLIBC installed have different traits */
+#if defined (__linux__)
+# ifndef _STLP_USE_GLIBC
+# define _STLP_USE_GLIBC 1
+# endif
+# if defined (__UCLIBC__) && !defined (_STLP_USE_UCLIBC)
+# define _STLP_USE_UCLIBC 1
+# endif
+#endif
+
+#if defined (__CYGWIN__) && \
+ (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 3) && !defined (_GLIBCPP_USE_C99)
+# define _STLP_NO_VENDOR_MATH_L
+# define _STLP_NO_VENDOR_STDLIB_L
+#endif
+
+#if (__GNUC__ < 3)
+# define _STLP_NO_VENDOR_STDLIB_L
+#endif
+
+#if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 4))
+/* define for gcc versions before 3.4.0. */
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+#endif
+
+#if !defined (_REENTRANT) && (defined (_THREAD_SAFE) || \
+ (defined (__OpenBSD__) && defined (_POSIX_THREADS)) || \
+ (defined (__MINGW32__) && defined (_MT)))
+# define _REENTRANT
+#endif
+
+#if defined (__DJGPP)
+# define _STLP_RAND48 1
+# define _NOTHREADS 1
+# undef _PTHREADS
+# define _STLP_LITTLE_ENDIAN
+#endif
+
+#if defined (__MINGW32__)
+/* Mingw32, egcs compiler using the Microsoft C runtime */
+# if (__GNUC__ >= 3)
+/* For gcc before version 3 this macro is defined below */
+# define _STLP_VENDOR_GLOBAL_CSTD
+# endif
+# undef _STLP_NO_DRAND48
+# define _STLP_NO_DRAND48
+# define _STLP_CALL
+#endif /* __MINGW32__ */
+
+#if defined (__CYGWIN__) || defined (__MINGW32__)
+# if !defined (_STLP_USE_STATIC_LIB)
+# define _STLP_USE_DECLSPEC 1
+# if !defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DYNAMIC_LIB
+# endif
+# define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
+# define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
+# define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+# endif
+/* The following is defined independently of _STLP_USE_STATIC_LIB because it is also
+ * used to import symbols from PSDK under MinGW
+ */
+# define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+#else
+# if (__GNUC__ >= 4)
+# if !defined (_STLP_USE_STATIC_LIB)
+# if !defined (_STLP_USE_DYNAMIC_LIB)
+# define _STLP_USE_DYNAMIC_LIB
+# endif
+# define _STLP_USE_DECLSPEC 1
+# define _STLP_EXPORT_DECLSPEC __attribute__((visibility("default")))
+# define _STLP_IMPORT_DECLSPEC __attribute__((visibility("default")))
+# define _STLP_CLASS_EXPORT_DECLSPEC __attribute__((visibility("default")))
+# define _STLP_CLASS_IMPORT_DECLSPEC __attribute__((visibility("default")))
+# endif
+# endif
+#endif
+
+#if defined (__CYGWIN__) || defined (__MINGW32__) || !(defined (_STLP_USE_GLIBC) || defined (__sun) || defined(__APPLE__))
+# if !defined (__MINGW32__) && !defined (__CYGWIN__)
+# define _STLP_NO_NATIVE_MBSTATE_T 1
+# endif
+# if !defined (__MINGW32__) || (__GNUC__ < 3) || (__GNUC__ == 3) && (__GNUC_MINOR__ < 4)
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+# endif
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+#endif
+
+#define _STLP_NORETURN_FUNCTION __attribute__((noreturn))
+
+/* Mac OS X is a little different with namespaces and cannot instantiate
+ * static data members in template classes */
+#if defined (__APPLE__)
+# if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3)))
+/* Mac OS X is missing a required typedef and standard macro */
+typedef unsigned int wint_t;
+# endif
+
+# define __unix
+
+# define _STLP_NO_LONG_DOUBLE
+
+/* Mac OS X needs all "::" scope references to be "std::" */
+# define _STLP_USE_NEW_C_HEADERS
+
+# define _STLP_NO_VENDOR_STDLIB_L
+
+#endif /* __APPLE__ */
+
+/* g++ 2.7.x and above */
+#define _STLP_LONG_LONG long long
+
+#ifdef _STLP_USE_UCLIBC
+ /* No *f math fuctions variants (i.e. sqrtf, fabsf, etc.) */
+# define _STLP_NO_VENDOR_MATH_F
+ /* No *l math fuctions variants (i.e. sqrtl, fabsl, etc.) */
+# define _STLP_NO_VENDOR_MATH_L
+# define _STLP_NO_LONG_DOUBLE
+#endif
+
+#if defined (__OpenBSD__) || defined (__FreeBSD__)
+# define _STLP_NO_VENDOR_MATH_L
+# define _STLP_NO_VENDOR_STDLIB_L /* no llabs */
+# ifndef __unix
+# define __unix
+# endif
+#endif
+
+#if defined (__alpha__)
+# define _STLP_NO_VENDOR_MATH_L
+#endif
+
+#if defined (__hpux)
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_NO_VENDOR_STDLIB_L /* no llabs */
+ /* No *f math fuctions variants (i.e. sqrtf, fabsf, etc.) */
+# define _STLP_NO_VENDOR_MATH_F
+#endif
+
+#if (__GNUC__ >= 3)
+# ifndef _STLP_HAS_NO_NEW_C_HEADERS
+/*
+# ifndef _STLP_USE_UCLIBC
+*/
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+/*
+# endif
+*/
+# else
+# ifdef _STLP_USE_GLIBC
+# define _STLP_VENDOR_LONG_DOUBLE_MATH 1
+# endif
+# endif
+#endif
+
+#if (__GNUC__ < 3)
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_DONT_USE_PTHREAD_SPINLOCK 1
+# ifndef __HONOR_STD
+# define _STLP_VENDOR_GLOBAL_EXCEPT_STD 1
+# endif
+/* egcs fails to initialize builtin types in expr. like this : new(p) char(); */
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+#endif
+
+#undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+#undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+
+/* strict ANSI prohibits "long long" ( gcc) */
+#if defined ( __STRICT_ANSI__ )
+# undef _STLP_LONG_LONG
+#endif
+
+#ifndef __EXCEPTIONS
+# undef _STLP_DONT_USE_EXCEPTIONS
+# define _STLP_DONT_USE_EXCEPTIONS 1
+#endif
+
+#if (__GNUC__ >= 3)
+/* Instantiation scheme that used (default) in gcc 3 made void of sense explicit
+ instantiation within library: nothing except increased library size. - ptr
+ */
+# define _STLP_NO_FORCE_INSTANTIATE
+#endif
diff --git a/stlport/stl/config/_hpacc.h b/stlport/stl/config/_hpacc.h
new file mode 100644
index 0000000..920b8b4
--- /dev/null
+++ b/stlport/stl/config/_hpacc.h
@@ -0,0 +1,129 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ */
+
+#define _STLP_COMPILER "aCC"
+
+/* system C-library dependent */
+#if defined (_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+/* # define _STLP_RAND48 1 */
+/* #define _STLP_NO_NATIVE_MBSTATE_T 1 */
+#define _STLP_HPACC_BROKEN_BUFEND 1
+#define _STLP_WCHAR_HPACC_EXCLUDE 1
+
+/* this was reported to help, just as with SUN CC 4.2 */
+#define _STLP_INLINE_STRING_LITERAL_BUG
+
+/* specific prolog is needed to select correct threads impl */
+#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+
+/* HP aCC with +noeh */
+#ifdef __HPACC_NOEH
+# define _STLP_HAS_NO_EXCEPTIONS 1
+#endif
+
+#define _STLP_NO_FORCE_INSTANTIATE
+#define _STLP_LONG_LONG long long
+#define _STLP_NO_VENDOR_STDLIB_L
+
+/* The aCC6 compiler is using the EDG Front End. Unfortunately, prior to
+ * version A.06.12, defining the __EDG__ and __EDG_VERSION__ macros was
+ * disabled. It was corrected in A.06.12.
+ */
+#if ((__HP_aCC > 60000) && (__HP_aCC < 61200))
+# define __EDG__
+# define __EDG_VERSION__ 306
+#endif
+
+#if (__HP_aCC >= 32500 )
+# define _STLP_USE_NEW_C_HEADERS
+
+# define _STLP_FORCE_ALLOCATORS(t,a) \
+ typedef typename _Alloc_traits<t,a>::_Orig _STLP_dummy_type1;\
+ typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind<t>::other _STLP_dummy_type2;
+
+# if defined (_HP_NAMESPACE_STD) // option -AA
+/* from now, we have a full standard lib in namespace std
+ *
+ * -AA indicates that we are compiling against Rogue Wave 2.2.1
+ * STL shipped with the HP aCC compiler. -AA tells the compiler
+ * to use the STL defined in the include_std directory.
+ */
+# define _STLP_NATIVE_INCLUDE_PATH ../include_std
+# else // option -Aa
+# define _STLP_VENDOR_GLOBAL_STD 1
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_DONT_THROW_RANGE_ERRORS 1
+# endif
+#endif
+
+#if (__HP_aCC >= 31400 && __HP_aCC < 32500)
+# define _STLP_FORCE_ALLOCATORS(t,a) \
+typedef typename _Alloc_traits<t,a>::_Orig _STLP_dummy_type1;\
+typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind<t>::other _STLP_dummy_type2;
+# define _STLP_NO_CWCHAR
+# if defined (_NAMESPACE_STD) // option -AA
+/* from now, we have a full standard lib in namespace std */
+# define _STLP_NATIVE_INCLUDE_PATH ../include_std
+# else /* kind of compatibility mode */
+# define _STLP_VENDOR_GLOBAL_STD 1
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_DONT_THROW_RANGE_ERRORS 1
+# define _STLP_NO_ROPE 1
+# endif
+#endif /* 314 */
+
+#if ((__HP_aCC >= 30000 && __HP_aCC < 31400) || (__HP_aCC == 1)) // A.03.13: __HP_aCC == 1
+
+# if (__HP_aCC != 1)
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# endif
+
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+/* aCC bug ? need explicit args on constructors of partial specialized
+ * classes
+ */
+# define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS 1
+/* ?? fbp : maybe present in some versions ? */
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+/* <exception> and stuff is in global namespace */
+# define _STLP_VENDOR_GLOBAL_EXCEPT_STD
+/* fbp : moved here */
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+/* # define _INCLUDE_HPUX_SOURCE */
+# define _XPG4
+# define _INCLUDE_XOPEN_SOURCE
+# define _INCLUDE_AES_SOURCE
+#endif
+
+#if (__HP_aCC <= 30000 && __HP_aCC >= 12100)
+/* Special kludge to workaround bug in aCC A.01.23, CR JAGac40634 */
+# ifdef _STLP_DEBUG
+static void _STLP_dummy_literal() { const char *p = "x";}
+static void _STLP_dummy_literal_2() { const char *p = "123456789"; }
+static void _STLP_dummy_literal_3() { const char *p = "123456700000000000000089";}
+# endif
+
+# define _STLP_VENDOR_GLOBAL_STD 1
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_DONT_THROW_RANGE_ERRORS 1
+# define _STLP_STATIC_CONST_INIT_BUG 1
+# if (__HP_aCC < 12700)
+/* new flag: on most HP compilers cwchar is missing */
+# define _STLP_NO_CWCHAR
+# endif
+
+# define _STLP_FORCE_ALLOCATORS(t,a) \
+ typedef typename _Alloc_traits<t,a>::_Orig _STLP_dummy_type1;\
+ typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind<t>::other _STLP_dummy_type2;
+#endif
+
+#if __HP_aCC == 1
+# define _STLP_BROKEN_USING_IN_CLASS
+# define _STLP_USING_BASE_MEMBER
+# define _STLP_NO_CWCHAR
+/* # define _STLP_NO_WCHAR_T 1 */
+#endif
diff --git a/stlport/stl/config/_hpux.h b/stlport/stl/config/_hpux.h
new file mode 100644
index 0000000..385c514
--- /dev/null
+++ b/stlport/stl/config/_hpux.h
@@ -0,0 +1,17 @@
+#ifndef __stl_config__hpux_h
+#define __stl_config__hpux_h
+
+#define _STLP_PLATFORM "HP Unix"
+
+#define _STLP_USE_UNIX_IO
+
+#ifdef __GNUC__
+# define _STLP_NO_WCHAR_T
+# define _STLP_NO_CWCHAR
+# define _STLP_NO_LONG_DOUBLE
+# ifndef _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE 199506
+# endif
+#endif
+
+#endif /* __stl_config__hpux_h */
diff --git a/stlport/stl/config/_ibm.h b/stlport/stl/config/_ibm.h
new file mode 100644
index 0000000..f74f6d9
--- /dev/null
+++ b/stlport/stl/config/_ibm.h
@@ -0,0 +1,144 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ */
+
+#if defined (__IBMCPP__) || defined (__IBMC__)
+# define _STLP_COMPILER "Visual Age C++"
+#elif defined (__xlC__)
+# define _STLP_COMPILER "xlc"
+#else
+# error "Unknown compiler"
+#endif
+
+#if !defined(__IBMCPP__) || (__IBMCPP__ < 500)
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+#endif
+
+/* string literal problem, same as with SUN and aCC */
+# define _STLP_INLINE_STRING_LITERAL_BUG 1
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+
+
+# ifdef __IBMCPP__
+# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+# endif
+
+/* # if ( defined (__MULTI__) && defined (__WINDOWS__))
+ * # define _STLP_WIN32THREADS 1 Only Visual Age 3.5 for Windows
+ * # endif
+ */
+
+# if ( defined (__MULTI__) && defined (__OS2__))
+# define _STLP_OS2THREADS 1
+# endif
+
+/* __TEMPINC__ is set when /Ft+ option is used */
+# ifdef __TEMPINC__
+# define _STLP_LINK_TIME_INSTANTIATION 1
+# endif
+
+# if defined (__MVS__)
+/* long long support is buggy - reported by Tinny Ng
+ * # if __EXTENDED__ && __COMPILER_VER__ >= 0x22060000
+ * # define _STLP_LONG_LONG long long
+ * # endif
+ */
+/* boris : hstash reported it can be treated like UNIX */
+# define _STLP_NO_TYPEINFO 1
+# undef _STLP_NATIVE_INCLUDE_PATH
+# define _STLP_NATIVE_INCLUDE_PATH /usr/lpp/ioclib/include
+/* same for C headers like <string.h> */
+# undef _STLP_NATIVE_C_INCLUDE_PATH
+# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH /usr/include
+
+# elif (defined (__WINDOWS__) || defined (_AIX) || defined (__OS2__) ) && (__IBMCPP__ >= 350)
+
+# define _STLP_LONG_LONG long long
+
+#endif
+
+#if !( defined( __xlC__ ) && __xlC__ >= 0x500 )
+
+/* AIX xlC 3.1 , 3.0.1 ==0x301
+ * Visual Age C++ 3.x
+ * OS-390 C++
+ * fbp : should be more version-specific!
+ */
+
+# define _STLP_NO_BOOL 1
+# define _STLP_DONT_USE_BOOL_TYPEDEF 1
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NEED_EXPLICIT 1
+# define _STLP_NO_ARROW_OPERATOR 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+# define _STLP_NO_BAD_ALLOC 1
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+
+# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+# if defined (__OS2__) && (__IBMCPP__ <= 350)
+# define _STLP_NO_TYPEINFO 1
+# endif
+# define _STLP_NO_NEW_NEW_HEADER 1
+
+# define _STLP_STATIC_CONST_INIT_BUG 1
+/* # define _STLP_THROW_RETURN_BUG 1 */
+
+
+# define _STLP_NO_TEMPLATE_CONVERSIONS 1
+# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+
+/* AIX xlC, Visual Age 3.0 for OS/2 and MS */
+# define _STLP_TRIVIAL_DESTRUCTOR_BUG
+
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+
+#if __IBMCPP__ <= 350
+# define _STLP_NEED_UNREACHABLE_RETURN 1
+#endif
+
+#if __IBMCPP__ < 350
+# define _STLP_NO_LONG_DOUBLE 1
+#endif
+
+#if __IBMCPP__ >= 365
+/* does not have new C headers, but has div() */
+# define _STLP_LDIV
+#endif
+
+#endif /* xlC 5 */
+
+/* detect xlC5 by: */
+#if defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 700)
+# define _STLP_USE_EXCEPTIONS 1
+# define _STLP_STATIC_CONST_INIT_BUG 1
+/* #pragma report(disable,CPPC1500029)
+ * unsigned 32-bit integer type
+ */
+# define _STLP_UINT32_T unsigned int
+# if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+# endif
+/* # define _STLP_RAND48 1 */
+#endif /* __IBMCPP__ == 500 */
diff --git a/stl/config/_icc.h b/stlport/stl/config/_icc.h
similarity index 100%
rename from stl/config/_icc.h
rename to stlport/stl/config/_icc.h
diff --git a/stlport/stl/config/_intel.h b/stlport/stl/config/_intel.h
new file mode 100644
index 0000000..01e09d6
--- /dev/null
+++ b/stlport/stl/config/_intel.h
@@ -0,0 +1,72 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Intel ICL"
+
+#define _STLP_IMPORT_TEMPLATE_KEYWORD extern
+
+/* You need to undef following macro if your icl install is binded to MSVC 6
+ * native lib and you are building with /Qvc7 or /Qvc7.1 or /Qvc8 option.
+ */
+/* #define _STLP_MSVC_LIB 1200 */
+/* You need to undef following macro if your icl install is binded to MSVC .Net 2002
+ * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7.1
+ * or /Qvc8 option.
+ */
+/* #define _STLP_MSVC_LIB 1300 */
+/* You need to undef following macro if your icl install is binded to MSVC .Net 2003
+ * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7
+ * or /Qvc8 option.
+ */
+/* #define _STLP_MSVC_LIB 1310 */
+/* You need to undef following macro if your icl install is binded to MSVC 2005
+ * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7
+ * or /Qvc7.1 option.
+ */
+/* #define _STLP_MSVC_LIB 1400 */
+
+#include <stl/config/_msvc.h>
+
+#if defined (_STLP_DONT_RETURN_VOID)
+# undef _STLP_DONT_RETURN_VOID
+#endif
+
+#if (__ICL < 900)
+# define _STLP_NOTHROW
+#endif
+
+#if (__ICL <= 810)
+/* If method specialization is activated, compiler do not export some
+ * symbols anymore.
+ */
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+#endif
+
+#if (__ICL >= 800 && __ICL < 900)
+# define _STLP_STATIC_CONST_INIT_BUG 1
+#endif
+
+#if (__ICL >= 450)
+# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
+#endif
+
+#if (__ICL < 450)
+/* only static STLport lib works for ICL */
+# undef _STLP_USE_STATIC_LIB
+# undef _STLP_USE_DYNAMIC_LIB
+# define _STLP_USE_STATIC_LIB
+/* disable hook which makes template symbols to be searched for in the library */
+# undef _STLP_NO_CUSTOM_IO
+#endif
+
+#undef _STLP_LONG_LONG
+#define _STLP_LONG_LONG long long
+
+#if defined (__cplusplus) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
+namespace std
+{
+ void _STLP_CALL unexpected();
+}
+#endif
+
+#include <stl/config/_feedback.h>
diff --git a/stlport/stl/config/_kai.h b/stlport/stl/config/_kai.h
new file mode 100644
index 0000000..267158f
--- /dev/null
+++ b/stlport/stl/config/_kai.h
@@ -0,0 +1,43 @@
+// STLport config file for KAI C++ compiler
+
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+
+# ifndef __KAI_STRICT /* _NO_LONGLONG */
+# define _STLP_LONG_LONG long long
+# endif
+
+# if !defined (__EXCEPTIONS) && ! defined (_EXCEPTIONS)
+# define _STLP_HAS_NO_EXCEPTIONS
+# endif
+
+# ifndef __BUILDING_STLPORT
+# define _STLP_LINK_TIME_INSTANTIATION 1
+# endif
+
+// two levels of macros do not work good with kcc.
+# define _STLP_NATIVE_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_C_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/##header>
+
+// KAI C++ uses EDG front-end, but apparently different switches
+// # define __EDG_SWITCHES 1
+
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+# define _STLP_VENDOR_MB_NAMESPACE std
+
+// boris : some of those may also apply to KCC 3.4
+# if __KCC_VERSION < 4000
+# define _STLP_VENDOR_GLOBAL_EXCEPT_STD 1
+
+# endif
+
+# if defined (__sgi)
+// this requires some discrimination on whether we are actually on
+// a system officially supported by KAI.
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+# include <standards.h>
+# endif
+
diff --git a/stlport/stl/config/_linux.h b/stlport/stl/config/_linux.h
new file mode 100644
index 0000000..b36a766
--- /dev/null
+++ b/stlport/stl/config/_linux.h
@@ -0,0 +1,125 @@
+#ifndef __stl_config__linux_h
+#define __stl_config__linux_h
+
+#define _STLP_PLATFORM "Linux"
+
+#include <features.h>
+
+/* This is defined wether library in use is glibc or not.
+ This may be treated as presence of GNU libc compatible
+ header files (these define is not really intended to check
+ for the presence of a particular library, but rather is used
+ to define an INTERFACE.) */
+#ifndef _STLP_USE_GLIBC
+# define _STLP_USE_GLIBC 1
+#endif
+
+#ifndef _STLP_USE_STDIO_IO
+# define _STLP_USE_UNIX_IO
+#endif
+
+/* #define _STLP_USE_STDIO_IO */
+
+/* If not explicitly specified otherwise, work with threads
+ */
+#if !defined(_STLP_NO_THREADS) && !defined(_REENTRANT)
+# define _REENTRANT
+#endif
+
+#if defined(_REENTRANT) && !defined(_PTHREADS)
+# define _PTHREADS
+#endif
+
+#ifdef __UCLIBC__ /* uClibc 0.9.27 */
+# define _STLP_USE_UCLIBC 1
+# if !defined(__UCLIBC_HAS_WCHAR__)
+# ifndef _STLP_NO_WCHAR_T
+# define _STLP_NO_WCHAR_T
+# endif
+# ifndef _STLP_NO_NATIVE_MBSTATE_T
+# define _STLP_NO_NATIVE_MBSTATE_T
+# endif
+# ifndef _STLP_NO_NATIVE_WIDE_STREAMS
+# define _STLP_NO_NATIVE_WIDE_STREAMS
+# endif
+# endif /* __UCLIBC_HAS_WCHAR__ */
+ /* Hmm, bogus _GLIBCPP_USE_NAMESPACES seems undefined... */
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+#endif
+
+
+#if defined(_PTHREADS)
+# define _STLP_THREADS
+# define _STLP_PTHREADS
+/*
+# ifndef __USE_UNIX98
+# define __USE_UNIX98
+# endif
+*/
+/* This feature exist at least since glibc 2.2.4 */
+/* # define __FIT_XSI_THR */ /* Unix 98 or X/Open System Interfaces Extention */
+# ifdef __USE_XOPEN2K
+/* The IEEE Std. 1003.1j-2000 introduces functions to implement spinlocks. */
+# ifndef __UCLIBC__ /* There are no spinlocks in uClibc 0.9.27 */
+# define _STLP_USE_PTHREAD_SPINLOCK
+# else
+# ifndef _STLP_DONT_USE_PTHREAD_SPINLOCK
+ /* in uClibc (0.9.26) pthread_spinlock* declared in headers
+ * but absent in library */
+# define _STLP_DONT_USE_PTHREAD_SPINLOCK
+# endif
+# endif
+# ifndef _STLP_DONT_USE_PTHREAD_SPINLOCK
+# define _STLP_USE_PTHREAD_SPINLOCK
+# define _STLP_STATIC_MUTEX _STLP_mutex
+# endif
+/* # define __FIT_PSHARED_MUTEX */
+# endif
+#endif
+
+/* Endiannes */
+#include <endian.h>
+#if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN) || !defined(__BIG_ENDIAN)
+# error "One of __BYTE_ORDER, __LITTLE_ENDIAN and __BIG_ENDIAN undefined; Fix me!"
+#endif
+
+#if ( __BYTE_ORDER == __LITTLE_ENDIAN )
+# define _STLP_LITTLE_ENDIAN 1
+#elif ( __BYTE_ORDER == __BIG_ENDIAN )
+# define _STLP_BIG_ENDIAN 1
+#else
+# error "__BYTE_ORDER neither __BIG_ENDIAN nor __LITTLE_ENDIAN; Fix me!"
+#endif
+
+#if defined(__GNUC__) && (__GNUC__ < 3)
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+#endif
+
+#ifdef __GLIBC__
+# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || (__GLIBC__ > 2)
+/* From glibc 2.3.x default allocator is malloc_alloc, if was not defined other */
+# if !defined(_STLP_USE_MALLOC) && !defined(_STLP_USE_NEWALLOC) && !defined(_STLP_USE_PERTHREAD_ALLOC) && !defined(_STLP_USE_NODE_ALLOC)
+# define _STLP_USE_MALLOC 1
+# endif
+# endif
+/* Following platforms has no long double:
+ * - Alpha
+ * - PowerPC
+ * - SPARC, 32-bits (64-bits platform has long double)
+ * - MIPS, 32-bits
+ * - ARM
+ * - SH4
+ */
+# if defined(__alpha__) || \
+ defined(__ppc__) || defined(PPC) || defined(__powerpc__) || \
+ ((defined(__sparc) || defined(__sparcv9) || defined(__sparcv8plus)) && !defined ( __WORD64 ) && !defined(__arch64__)) /* ? */ || \
+ (defined(_MIPS_SIM) && (_MIPS_SIM == _ABIO32)) || \
+ defined(__arm__) || \
+ defined(__sh__)
+ /* # if defined(__NO_LONG_DOUBLE_MATH) */
+# define _STLP_NO_LONG_DOUBLE
+# endif
+#endif
+
+
+#endif /* __stl_config__linux_h */
diff --git a/stlport/stl/config/_mac.h b/stlport/stl/config/_mac.h
new file mode 100644
index 0000000..575c183
--- /dev/null
+++ b/stlport/stl/config/_mac.h
@@ -0,0 +1,6 @@
+#define _STLP_PLATFORM "Mac"
+
+#define _STLP_MAC 1
+
+#error Looks like unsupported platform
+#define _STLP_USE_UNIX_EMULATION_IO
diff --git a/stlport/stl/config/_macosx.h b/stlport/stl/config/_macosx.h
new file mode 100644
index 0000000..54a9222
--- /dev/null
+++ b/stlport/stl/config/_macosx.h
@@ -0,0 +1,9 @@
+#define _STLP_PLATFORM "Mac OS X"
+
+#if defined (__BIG_ENDIAN__)
+# define _STLP_BIG_ENDIAN 1
+#elif defined (__LITTLE_ENDIAN__)
+# define _STLP_LITTLE_ENDIAN 1
+#endif
+
+#define _STLP_USE_UNIX_IO
diff --git a/stl/config/_mlc.h b/stlport/stl/config/_mlc.h
similarity index 100%
rename from stl/config/_mlc.h
rename to stlport/stl/config/_mlc.h
diff --git a/stlport/stl/config/_msvc.h b/stlport/stl/config/_msvc.h
new file mode 100644
index 0000000..418d018
--- /dev/null
+++ b/stlport/stl/config/_msvc.h
@@ -0,0 +1,265 @@
+/* STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ * Microsoft Visual C++ 6.0, 7.0, 7.1, 8.0, ICL
+ */
+
+#if !defined (_STLP_COMPILER)
+# define _STLP_COMPILER "Microsoft Visual Studio C++"
+#endif
+
+#if !defined (__ICL) && !defined (_STLP_MSVC)
+# define _STLP_MSVC _MSC_VER
+#endif
+
+#if !defined (_STLP_MSVC_LIB)
+# define _STLP_MSVC_LIB _MSC_VER
+#endif
+
+#if defined (__BUILDING_STLPORT) && defined (_MANAGED)
+/* Building a managed version of STLport is not supported because we haven't
+ * found a good reason to support it. However, building a managed translation
+ * unit using STLport _is_ supported.
+ */
+# error Sorry but building a managed version of STLport is not supported.
+#endif
+
+#if defined (_STLP_USING_PLATFORM_SDK_COMPILER)
+/* This is a specific section for compilers coming with platform SDKs. Native
+ * library coming with it is different from the one coming with commercial
+ * MSVC compilers so there is some specific settings.
+ */
+# define _STLP_NATIVE_INCLUDE_PATH ../crt
+# define _STLP_VENDOR_GLOBAL_CSTD
+# define _STLP_VENDOR_TERMINATE_STD
+# define _STLP_GLOBAL_NEW_HANDLER
+# if (_STLP_MSVC_LIB <= 1400)
+/* We hope this bug will be fixed in future versions. */
+# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+# endif
+#endif
+
+#define _STLP_CALL __cdecl
+
+#ifndef _STLP_LONG_LONG
+# define _STLP_LONG_LONG __int64
+#endif
+
+#define _STLP_PRAGMA_ONCE
+
+/* These switches depend on compiler flags. We are hoping here that compilers
+ * simulating MSVC behavior use identical macros to report compilation context.
+ * Otherwise those macros will have to be undef in specific compiler configuration
+ * files.
+ */
+#ifndef _CPPUNWIND
+# define _STLP_DONT_USE_EXCEPTIONS 1
+#endif
+
+#ifndef _CPPRTTI
+# define _STLP_NO_RTTI 1
+#endif
+
+#if defined (_MT) && !defined (_STLP_NO_THREADS)
+# define _STLP_THREADS 1
+#endif
+
+#if !defined (_NATIVE_WCHAR_T_DEFINED)
+# define _STLP_WCHAR_T_IS_USHORT 1
+#endif
+
+#define _STLP_NO_VENDOR_STDLIB_L 1
+
+#if defined (_STLP_MSVC)
+
+# if (_STLP_MSVC < 1200)
+# error Microsoft Visual C++ compilers before version 6 (SP5) are not supported.
+# endif
+
+# define _STLP_NORETURN_FUNCTION __declspec(noreturn)
+
+/* Full compiler version comes from boost library intrinsics.hpp header. */
+# if defined (_MSC_FULL_VER) && (_MSC_FULL_VER >= 140050215)
+# define _STLP_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
+# define _STLP_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T)
+# define _STLP_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T)
+# define _STLP_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
+# define _STLP_IS_POD(T) __is_pod(T)
+# define _STLP_HAS_TYPE_TRAITS_INTRINSICS
+# endif
+
+# ifndef _STLP_MSVC50_COMPATIBILITY
+# define _STLP_MSVC50_COMPATIBILITY 1
+# endif
+
+# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
+# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG 1
+# define _STLP_NO_STATIC_CONST_DEFINITION 1
+
+/* # ifndef __BUILDING_STLPORT
+ * # define _STLP_USE_TEMPLATE_EXPORT 1
+ * # endif
+ */
+
+/** Note: the macro _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT is defined
+unconditionally and undef'ed here when applicable. */
+# if defined (UNDER_CE)
+/* eVCx:
+uncaught_exception is declared in the SDKs delivered with eVC4 (eVC3 is
+unknown) and they all reside in namespace 'std' there. However, they are not
+part of any lib so linking fails. When using VC8 to crosscompile for CE 5 on
+an ARMV4I, the uncaught_exception test fails, the function returns the wrong
+value. */
+/* All eVCs up to at least VC8/CE5 have a broken new operator that
+ returns null instead of throwing bad_alloc. */
+# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+# else
+/* VCx:
+These are present at least since VC6, but the uncaught_exception() of VC6 is
+broken, it returns the wrong value in the unittests. 7.1 and later seem to
+work, 7.0 is still unknown (we assume it works until negative report). */
+# if (_STLP_MSVC >= 1300)// VC7 and later
+# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+# endif
+# if (_STLP_MSVC < 1300)
+# define _STLP_NOTHROW
+# endif
+# endif
+
+# if (_STLP_MSVC <= 1300)
+# define _STLP_STATIC_CONST_INIT_BUG 1
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+/* There is no partial spec, and MSVC breaks on simulating it for iterator_traits queries */
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+# define _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1
+/* VC++ cannot handle default allocator argument in template constructors */
+# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# endif
+
+# if (_STLP_MSVC < 1300) /* including MSVC 6.0 */
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1
+# endif
+
+# define _STLP_HAS_NATIVE_FLOAT_ABS 1
+
+// TODO: some eVC4 compilers report _MSC_VER 1201 or 1202, which category do they belong to?
+# if (_STLP_MSVC > 1200) && (_STLP_MSVC < 1310)
+# define _STLP_NO_MOVE_SEMANTIC
+# endif
+
+# if (_STLP_MSVC < 1300)
+/* TODO: remove this if it is handled and documented elsewhere
+ * dums: VC6 do not handle correctly member templates of class that are explicitely
+ * instanciated to be exported. There is a workaround, seperate the non template methods
+ * from the template ones within 2 different classes and only export the non template one.
+ * It is implemented for basic_string and locale at the writing of this note.
+ * However this problem hos not been considered as important enough to remove template member
+ * methods for other classes. Moreover Boost (www.boost.org) required it to be granted.
+ * The workaround is activated thanks to the _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND macro defined
+ * later in this config file.
+ */
+/*
+# if defined (_DLL)
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# endif
+*/
+
+/* Boris : not defining this macro for SP5 causes other problems */
+/*# if !defined (_MSC_FULL_VER) || (_MSC_FULL_VER < 12008804 ) */
+# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1
+/*# endif */
+# define _STLP_DONT_USE_BOOL_TYPEDEF 1
+# define _STLP_DONT_RETURN_VOID 1
+# endif
+
+# if (_STLP_MSVC < 1300) /* MSVC 6.0 and earlier */
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+/* defined for DEBUG and NDEBUG too, to allow user mix own debug build with STLP release library */
+# define _STLP_USE_ABBREVS
+# endif
+
+#endif /* _STLP_MSVC */
+
+/* The desktop variants starting with VC8 have a set of more secure replacements
+ * for the error-prone string handling functions of the C standard lib. */
+/* When user do not consider 'unsafe' string functions as deprecated using _CRT_SECURE_NO_DEPRECATE
+ * macro we use 'unsafe' functions for performance reasons. */
+#if (_STLP_MSVC_LIB >= 1400) && !defined (_STLP_USING_PLATFORM_SDK_COMPILER) && !defined (UNDER_CE) && \
+ !defined (_CRT_SECURE_NO_DEPRECATE)
+# define _STLP_USE_SAFE_STRING_FUNCTIONS 1
+#endif
+
+#if (_STLP_MSVC_LIB <= 1310)
+# define _STLP_VENDOR_GLOBAL_CSTD
+#endif
+
+#if (_STLP_MSVC_LIB >= 1300) && !defined(UNDER_CE)
+/* Starting with MSVC 7.0 and compilers simulating it,
+ * we assume that the new SDK is granted:
+ */
+# define _STLP_NEW_PLATFORM_SDK 1
+#endif
+
+#if (_STLP_MSVC_LIB < 1300) /* including MSVC 6.0 */
+# define _STLP_GLOBAL_NEW_HANDLER 1
+# define _STLP_VENDOR_UNEXPECTED_STD
+# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+#endif
+
+#define _STLP_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
+#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
+
+#if defined (__DLL) || defined (_DLL) || defined (_RTLDLL) || defined (_AFXDLL)
+# define _STLP_RUNTIME_DLL
+#endif
+#if defined (__BUILDING_STLPORT) && \
+ (defined (_STLP_USE_DYNAMIC_LIB) || \
+ defined (_STLP_RUNTIME_DLL) && !defined (_STLP_USE_STATIC_LIB))
+# define _STLP_DLL
+#endif
+#include <stl/config/_detect_dll_or_lib.h>
+#undef _STLP_RUNTIME_DLL
+#undef _STLP_DLL
+
+#if defined (_STLP_USE_DYNAMIC_LIB)
+# undef _STLP_USE_DECLSPEC
+# define _STLP_USE_DECLSPEC 1
+# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300)
+# define _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND 1
+# endif
+#endif
+
+#if !defined (_STLP_IMPORT_TEMPLATE_KEYWORD)
+# if !defined (_MSC_EXTENSIONS) || defined (_STLP_MSVC) && (_STLP_MSVC >= 1300)
+# define _STLP_IMPORT_TEMPLATE_KEYWORD
+# else
+# define _STLP_IMPORT_TEMPLATE_KEYWORD extern
+# endif
+#endif
+#define _STLP_EXPORT_TEMPLATE_KEYWORD
+
+#include <stl/config/_auto_link.h>
+
+#if defined (_STLP_USING_PLATFORM_SDK_COMPILER)
+/* The Windows 64 bits SDK required for the moment link to bufferoverflowU.lib for
+ * additional buffer overrun checks. Rather than require the STLport build system and
+ * users to explicitely link with it we use the MSVC auto link feature.
+ */
+# if !defined (_STLP_DONT_USE_AUTO_LINK) || defined (__BUILDING_STLPORT)
+# pragma comment (lib, "bufferoverflowU.lib")
+# if defined (_STLP_VERBOSE)
+# pragma message ("STLport: Auto linking to bufferoverflowU.lib")
+# endif
+# endif
+#endif
+
+#if defined (_STLP_MSVC)
+# include <stl/config/_feedback.h>
+#endif
diff --git a/stlport/stl/config/_mwerks.h b/stlport/stl/config/_mwerks.h
new file mode 100644
index 0000000..f91f3b1
--- /dev/null
+++ b/stlport/stl/config/_mwerks.h
@@ -0,0 +1,159 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Metrowerk Codewarrior"
+
+// Bring in definition of __MSL__ and related items
+#include <mslGlobals.h>
+#include <ansi_parms.h>
+
+//
+// Compiler features
+//
+
+
+// *** CodeWarrior Compiler Common Features ***
+# if __option(longlong)
+# define _STLP_LONG_LONG long long
+# endif
+
+# define _STLP_USE_UNIX_EMULATION_IO 1
+
+# define _STLP_USE_AUTO_PTR_CONVERSIONS 1
+
+# ifdef __INTEL__
+# define _STLP_LITTLE_ENDIAN
+# else
+# define _STLP_BIG_ENDIAN
+# endif
+
+#if defined(_MSL_NO_LOCALE)
+#define _STLP_NO_IMPORT_LOCALE
+#endif
+#if !__option( wchar_type )
+# define _STLP_WCHAR_T_IS_USHORT
+#endif
+
+# if __MWERKS__ < 0x3000
+// *** CodeWarrior Compiler Common Bugs ***
+# define __MSL_FIX_ITERATORS__(myType) // Some MSL headers rely on this
+# define _STLP_THROW_RETURN_BUG 1
+# endif
+
+// *** Version-specific settings ***
+
+# if __MWERKS__ >= 0x2405
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+# endif
+
+# if __MWERKS__ < 0x2405
+# define _STLP_STATIC_CONST_INIT_BUG
+# endif
+
+# if __MWERKS__ <= 0x2303
+# define _STLP_NO_TEMPLATE_CONVERSIONS 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# endif
+
+# if __MWERKS__ < 0x2301
+# define _STLP_MEMBER_SPECIALIZATION_BUG 1
+# endif
+
+# if __MWERKS__ < 0x2300 // CW Pro5 features
+# define _STLP_INLINE_MEMBER_TEMPLATES 1
+# define _STLP_RELOPS_IN_STD_BUG 1
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+# define _STLP_NO_TYPENAME_ON_RETURN_TYPE
+# endif
+
+# if __MWERKS__ < 0x2200 // CW Pro4 features
+# define _STLP_BROKEN_USING_DIRECTIVE 1
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# endif
+
+# if __MWERKS__ < 0x2100 // CW Pro3 features
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NO_ARROW_OPERATOR 1
+# define _STLP_TEMPLATE_PARAM_SUBTYPE_BUG 1
+# define _STLP_FORCED_INLINE_INSTANTIATION_BUG 1
+# define _STLP_MULTI_CONST_TEMPLATE_ARG_BUG 1
+# define _STLP_INLINE_NAME_RESOLUTION_BUG 1
+// *** Metrowerks Standard Library Bug ***
+# define _STLP_MSVC50_COMPATIBILITY 1
+# endif
+
+# if __MWERKS__ < 0x2000 // v. 2.0 features
+# define _STLP_NO_WCHAR_T 1
+# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 // dwa 8/21/97 - this bug fixed for CWPro2
+# endif
+
+# if __MWERKS__ < 0x1900 // dwa 8/19/97 - 1.9 Compiler feature defines
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+# define _STLP_BASE_TYPEDEF_BUG 1
+# define _STLP_BASE_MATCH_BUG 1
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+# define _STLP_DEFAULT_TYPE_PARAM 1 // More limited template parameters
+
+# if __MWERKS__ < 0x1800
+ __GIVE_UP_WITH_STL(CW_18)
+# endif
+
+# endif
+
+
+// fixes to native inclusion wrappers.
+# if __MWERKS__ >= 0x2300 // CWPro5 changes paths - dwa 2/28/99
+# define _STLP_NATIVE_INCLUDE_PATH ../include
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+# define _STLP_NATIVE_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_C_HEADER(header) <../include/##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/##header>
+# else
+
+# define _STLP_NATIVE_INCLUDE_PATH Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include
+# define _STLP_NATIVE_C_INCLUDE_PATH Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes
+# define _STLP_NATIVE_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include:##header>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include:##header>
+# define _STLP_NATIVE_C_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes:##header>
+# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes:##header>
+
+# endif
+
+//Following block come from boost intrinsics.hpp file:
+#if defined (__MSL_CPP__) && (__MSL_CPP__ >= 0x8000)
+ // Metrowerks compiler is acquiring intrinsic type traits support
+ // post version 8. We hook into the published interface to pick up
+ // user defined specializations as well as compiler intrinsics as
+ // and when they become available:
+# include <msl_utility>
+# define _STLP_HAS_TRIVIAL_CONSTRUCTOR(T) Metrowerks::has_trivial_default_ctor<T>::value
+# define _STLP_HAS_TRIVIAL_COPY(T) Metrowerks::has_trivial_copy_ctor<T>::value
+# define _STLP_HAS_TRIVIAL_ASSIGN(T) Metrowerks::has_trivial_assignment<T>::value
+# define _STLP_HAS_TRIVIAL_DESTRUCTOR(T) Metrowerks::has_trivial_dtor<T>::value
+# define _STLP_IS_POD(T) Metrowerks::is_POD<T>::value
+# define _STLP_HAS_TYPE_TRAITS_INTRINSICS
+#endif
+
+// fbp
+# if !defined( __MSL_CPP__ ) || __MSL_CPP__ <= 0x4105
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+# endif
+
+# if defined(__MACH__)
+# define _STLP_MAC
+# define O_BINARY 0
+# elif defined(macintosh)
+# define _NOTHREADS
+# endif
+# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1
diff --git a/stl/config/_native_headers.h b/stlport/stl/config/_native_headers.h
similarity index 100%
rename from stl/config/_native_headers.h
rename to stlport/stl/config/_native_headers.h
diff --git a/stlport/stl/config/_openbsd.h b/stlport/stl/config/_openbsd.h
new file mode 100644
index 0000000..86a19d1
--- /dev/null
+++ b/stlport/stl/config/_openbsd.h
@@ -0,0 +1,12 @@
+#define _STLP_PLATFORM "Open BSD"
+
+#define _STLP_USE_UNIX_IO
+
+#if defined (_POSIX_THREADS) && !defined (_STLP_THREADS)
+# define _STLP_THREADS
+#endif
+
+#if defined (_POSIX_THREADS) && !defined (_STLP_DONT_USE_PTHREAD_SPINLOCK)
+# define _STLP_USE_PTHREAD_SPINLOCK
+# define _STLP_STATIC_MUTEX _STLP_mutex
+#endif
diff --git a/stlport/stl/config/_prolog.h b/stlport/stl/config/_prolog.h
new file mode 100644
index 0000000..a16a794
--- /dev/null
+++ b/stlport/stl/config/_prolog.h
@@ -0,0 +1,43 @@
+
+#if defined (_STLP_MSVC) || defined (__ICL)
+
+# pragma warning (push)
+# include <stl/config/_warnings_off.h>
+/* We are forcing the alignment to guaranty that libraries are use
+ * with the same alignment as the one use to build them.
+ */
+# if !defined (_WIN64)
+# pragma pack(push, 8)
+# else
+# pragma pack(push, 16)
+# endif
+
+#elif defined (__BORLANDC__)
+
+# pragma option push
+# pragma option -Vx- -Ve- -a8 -b -pc
+# include <stl/config/_warnings_off.h>
+
+#elif defined (__sgi) && !defined (__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+
+# pragma set woff 1209
+# pragma set woff 1174
+# pragma set woff 1375
+/* from iterator_base.h */
+# pragma set woff 1183
+
+#elif defined (__DECCXX)
+
+# ifdef __PRAGMA_ENVIRONMENT
+# pragma __environment __save
+# pragma __environment __header_defaults
+# endif
+
+#elif defined (__IBMCPP__)
+/* supress EDC3130: A constant is being used as a conditional expression */
+# pragma info(nocnd)
+#elif defined (__WATCOMCPLUSPLUS__)
+# pragma warning 604 10 /* must lookahead to determine... */
+# pragma warning 594 10 /* resolved as declaration/type */
+# pragma warning 595 10 /* resolved as an expression */
+#endif
diff --git a/stlport/stl/config/_sgi.h b/stlport/stl/config/_sgi.h
new file mode 100644
index 0000000..7500f3d
--- /dev/null
+++ b/stlport/stl/config/_sgi.h
@@ -0,0 +1,94 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "CC"
+
+#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+
+// define native include path before trying to include anything
+
+#define _STLP_NATIVE_HEADER(__x) </usr/include/CC/##__x>
+#define _STLP_NATIVE_C_HEADER(__x) </usr/include/##__x>
+#define _STLP_NATIVE_OLD_STREAMS_HEADER(__x) </usr/include/CC/##__x>
+#define _STLP_NATIVE_CPP_C_HEADER(__x) </usr/include/CC/##__x>
+#define _STLP_NATIVE_CPP_RUNTIME_HEADER(__x) </usr/include/CC/##__x>
+
+#define _STLP_NO_NATIVE_MBSTATE_T
+
+#define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS
+#define _STLP_NO_NATIVE_WIDE_FUNCTIONS
+#define _STLP_NO_MEMBER_TEMPLATE_CLASSES
+
+// #define _STLP_NO_BAD_ALLOC
+
+#define _STL_HAS_NAMESPACES
+
+#if ! defined (__EXCEPTIONS) && ! defined (_STLP_NO_EXCEPTIONS)
+# define _STLP_NO_EXCEPTIONS
+#endif
+
+#define __EDG_SWITCHES
+
+#define _STLP_USE_SGI_STRING 1
+
+#define _STLP_HAS_NO_NEW_C_HEADERS 1
+// # define _STLP_VENDOR_GLOBAL_EXCEPT_STD
+
+#define _STLP_NO_POST_COMPATIBLE_SECTION
+
+#include <standards.h>
+
+#if !(_COMPILER_VERSION >= 730)
+# define _STLP_NO_NEW_NEW_HEADER 1
+#endif
+
+#if (_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
+# define _STLP_EXTERN_RANGE_ERRORS
+#endif
+
+#if !defined(_BOOL)
+# define _STLP_NO_BOOL
+#endif
+#if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32
+# define _STLP_STATIC_CONST_INIT_BUG
+#endif
+
+#if (_COMPILER_VERSION < 720) || (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32)
+# define _STLP_DEF_CONST_PLCT_NEW_BUG
+# define _STLP_DEF_CONST_DEF_PARAM_BUG
+#endif
+#if !((_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32)
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+#endif
+#if !defined(_STANDARD_C_PLUS_PLUS)
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+#endif
+#if !((_COMPILER_VERSION >= 721) && defined(_NAMESPACES))
+# define _STLP_HAS_NO_NAMESPACES
+#endif
+#if (_COMPILER_VERSION < 721) || !defined(_STL_HAS_NAMESPACES) || defined(_STLP_NO_NAMESPACES)
+# define _STLP_NO_EXCEPTION_HEADER
+#endif
+#if _COMPILER_VERSION < 730 || !defined(_STANDARD_C_PLUS_PLUS) || !defined(_NAMESPACES)
+# define _STLP_NO_BAD_ALLOC
+#endif
+#if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI
+# define _STLP_LONG_LONG long long
+#endif
+#if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
+# define _STLP_USE_NO_IOSTREAMS
+#endif
+#if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
+# define _STLP_NO_AT_MEMBER_FUNCTION
+#endif
+// # if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS))
+#if !(_COMPILER_VERSION >= 721 && defined(_STANDARD_C_PLUS_PLUS))
+# define _STLP_NO_TEMPLATE_CONVERSIONS
+#endif
+#if !((_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32)
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER
+#endif
+
+#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED) && !defined (__GNUC__)
+# define _STLP_SGI_THREADS
+#endif
diff --git a/stlport/stl/config/_solaris.h b/stlport/stl/config/_solaris.h
new file mode 100644
index 0000000..8756a06
--- /dev/null
+++ b/stlport/stl/config/_solaris.h
@@ -0,0 +1,77 @@
+#ifndef __stl_config__solaris_h
+#define __stl_config__solaris_h
+
+#define _STLP_PLATFORM "Sun Solaris"
+
+/* include system features file */
+#include <sys/feature_tests.h>
+
+/* system-dependent defines */
+#define _STLP_USE_UNIX_IO
+
+#ifdef __GNUC__
+/*
+ * See comments (and configuration defines) in the host.h
+ */
+# if !(defined(__SunOS_5_5_1) || defined(__SunOS_5_6) || defined(__SunOS_5_7) || \
+ defined(__SunOS_5_8) || defined(__SunOS_5_9) || defined(__SunOS_5_10))
+# error Uncomment one of the defines (__SunOS_5_x) in the file stlport/stl/config/host.h
+# endif
+#endif
+
+#if defined (__SunOS_5_8) && ! defined (_STLP_HAS_NO_NEW_C_HEADERS) && ( __cplusplus >= 199711L)
+# define _STLP_HAS_NATIVE_FLOAT_ABS
+#endif
+
+#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)
+# define _STLP_RAND48 1
+#endif
+
+#if (defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)) || defined (__SunOS_5_6)
+# define _STLP_WCHAR_SUNPRO_EXCLUDE 1
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+#endif
+
+/* boris : this should always be defined for Solaris 5 & 6. Any ideas how to do it? */
+#if !(defined ( __KCC ) && __KCC_VERSION > 3400 ) && \
+ ((defined(__SunOS_5_5_1) || defined(__SunOS_5_6) ))
+# ifndef _STLP_NO_NATIVE_MBSTATE_T
+# define _STLP_NO_NATIVE_MBSTATE_T 1
+# endif
+#endif /* KCC */
+
+/* For SPARC we use lightweight synchronization */
+#if defined (__sparc) /* && (defined (_REENTRANT) || defined (_PTHREADS)) */
+# if ( (defined (__GNUC__) && defined (__sparc_v9__)) || \
+ defined (__sparcv9) ) \
+ && !defined(_NOTHREADS) && !defined (_STLP_NO_SPARC_SOLARIS_THREADS)
+# define _STLP_SPARC_SOLARIS_THREADS
+# define _STLP_THREADS_DEFINED
+# endif
+#endif
+
+/* gcc does not support ELF64 yet ; however; it supports ultrasparc + v8plus.
+ * limits.h contains invalid values for this combination
+ */
+#ifdef __GNUC__
+# if (defined (__sparc_v9__) || defined (__sparcv9)) && !defined ( __WORD64 ) && !defined(__arch64__)
+# define __LONG_MAX__ 2147483647L
+# endif
+#endif
+
+/*
+ * Attention! See comments (and configuration defines) in the host.h
+ * (you host may has MATH_F and MATH_L functions)
+ *
+ */
+#if !defined(__SunOS_5_10) && !defined(_STLP_SOLARIS_MATH_PATCH)
+# define _STLP_NO_VENDOR_MATH_F
+# define _STLP_NO_VENDOR_MATH_L
+#endif
+
+#ifdef __GNUC__
+# define _STLP_WCHAR_BORLAND_EXCLUDE
+# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
+#endif
+
+#endif /* __stl_config__solaris_h */
diff --git a/stlport/stl/config/_sunprocc.h b/stlport/stl/config/_sunprocc.h
new file mode 100644
index 0000000..15fe5cd
--- /dev/null
+++ b/stlport/stl/config/_sunprocc.h
@@ -0,0 +1,166 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Sunpro CC"
+
+#define _STLP_LONG_LONG long long
+
+// GAB: 11/09/05
+// Starting with 5.0 the STLport code expects to be
+// instantiated during compile time. This is due to undefing
+// a number of defines that are also used in the c versions
+// of the file. When they are undefed the c version fails to
+// compile.
+// # define _STLP_LINK_TIME_INSTANTIATION 1
+
+#if ! defined(_BOOL)
+# define _STLP_NO_BOOL 1
+#endif
+
+// compatibility mode stuff
+#if (__SUNPRO_CC >= 0x510) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 ))
+# define _STLP_NATIVE_INCLUDE_PATH ../CC/Cstd
+# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../CC
+#elif (__SUNPRO_CC >= 0x500) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 ))
+# define _STLP_NATIVE_INCLUDE_PATH ../CC
+#elif (defined (__SUNPRO_CC_COMPAT) && __SUNPRO_CC_COMPAT == 4)
+# define _STLP_NATIVE_INCLUDE_PATH ../CC4
+#else
+# define _STLP_NATIVE_INCLUDE_PATH ../CC
+#endif
+
+#define _STLP_STATIC_CONST_INIT_BUG 1
+
+#if (__SUNPRO_CC < 0x530)
+// those are tested and proved not to work...
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+#endif
+
+#ifdef _STLP_USE_NO_IOSTREAMS
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+#endif
+
+// those do not depend on compatibility
+#if (__SUNPRO_CC < 0x510)
+# define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1
+# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+#endif
+
+#if (__SUNPRO_CC < 0x510) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5))
+
+# define _STLP_NO_QUALIFIED_FRIENDS 1
+
+// no partial , just for explicit one
+# define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
+# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+
+# define _STLP_NO_MEMBER_TEMPLATES 1
+
+# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+#endif
+
+// Features that depend on compatibility switch
+#if ( __SUNPRO_CC < 0x500 ) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5))
+
+# ifndef _STLP_USE_NO_IOSTREAMS
+# define _STLP_USE_NO_IOSTREAMS 1
+# endif
+# define _STLP_NO_NEW_NEW_HEADER 1
+// # define _STLP_NO_RELOPS_NAMESPACE
+# define _STLP_HAS_NO_NAMESPACES 1
+# define _STLP_NEED_MUTABLE 1
+# define _STLP_NO_BAD_ALLOC 1
+# define _STLP_NO_EXCEPTION_HEADER 1
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+#elif (__SUNPRO_CC < 0x510)
+// # define _STLP_NATIVE_C_HEADER(header) <../CC/##header##.SUNWCCh>
+# define _STLP_NATIVE_CPP_C_HEADER(header) <../CC/##header##.SUNWCCh>
+# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include
+#elif defined( __SunOS_5_5_1 ) || defined( __SunOS_5_6 ) || defined( __SunOS_5_7 )
+# define _STLP_NATIVE_C_INCLUDE_PATH ../CC/std
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std
+#else
+# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include
+# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std
+#endif
+
+#if ( __SUNPRO_CC < 0x500 )
+
+# undef _STLP_NATIVE_C_HEADER
+# undef _STLP_NATIVE_CPP_C_HEADER
+
+# define wint_t __wint_t
+// famous CC 4.2 bug
+# define _STLP_INLINE_STRING_LITERAL_BUG 1
+// /usr/include
+# define _STLP_NATIVE_C_INCLUDE_PATH ../include
+
+// 4.2 cannot handle iterator_traits<_Tp>::iterator_category as a return type ;(
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+
+// 4.2 does not like it
+# undef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
+
+# define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+
+# define _STLP_NEED_TYPENAME 1
+# define _STLP_NEED_EXPLICIT 1
+# define _STLP_NO_BAD_ALLOC 1
+# define _STLP_NO_ARROW_OPERATOR 1
+
+# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG 1
+# undef _STLP_HAS_NO_NEW_C_HEADERS
+# define _STLP_HAS_NO_NEW_C_HEADERS 1
+// # define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+
+# if ( __SUNPRO_CC < 0x420 )
+# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+# define _STLP_NO_NEW_STYLE_CASTS 1
+# define _STLP_NO_METHOD_SPECIALIZATION 1
+# if ( __SUNPRO_CC > 0x401 )
+# if (__SUNPRO_CC==0x410)
+# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+# endif
+# else
+ // SUNPro C++ 4.0.1
+# define _STLP_BASE_MATCH_BUG 1
+# define _STLP_BASE_TYPEDEF_BUG 1
+# if (( __SUNPRO_CC < 0x401 ) && !defined(__SUNPRO_C))
+ __GIVE_UP_WITH_STL(SUNPRO_401)
+# endif
+# endif /* 4.0.1 */
+# endif /* 4.2 */
+#endif /* < 5.0 */
+
+#ifndef _MBSTATET_H
+# define _MBSTATET_H
+# undef _MBSTATE_T
+# define _MBSTATE_T
+typedef struct __mbstate_t {
+# if defined(_LP64)
+ long __filler[4];
+# else
+ int __filler[6];
+# endif
+} __mbstate_t;
+# ifndef _STLP_HAS_NO_NAMESPACES
+namespace std {
+ typedef __mbstate_t mbstate_t;
+}
+using std::mbstate_t;
+# else
+typedef __mbstate_t mbstate_t;
+# endif
+#endif /* __MBSTATET_H */
+
+#if !defined(_STLP_HAS_NO_NEW_C_HEADERS) && !defined(_STLP_NO_NEW_C_HEADERS)
+/* Since Sun Studio uses <iso/stdlib_iso.h>, we are at its
+ * mercy. GCC is built on top of <stdlib.h>. */
+#define _STLP_NO_VENDOR_STDLIB_L
+#endif
diff --git a/stlport/stl/config/_system.h b/stlport/stl/config/_system.h
new file mode 100644
index 0000000..c0b4add
--- /dev/null
+++ b/stlport/stl/config/_system.h
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * Purpose of this file :
+ *
+ * To hold COMPILER-SPECIFIC portion of STLport settings.
+ * In general, user should not edit this file unless
+ * using the compiler not recognized below.
+ *
+ * If your compiler is not being recognized yet,
+ * please look for definitions of macros in stl_mycomp.h,
+ * copy stl_mycomp.h to stl_YOUR_COMPILER_NAME,
+ * adjust flags for your compiler, and add <include config/stl_YOUR_COMPILER_NAME>
+ * to the secton controlled by unique macro defined internaly by your compiler.
+ *
+ * To change user-definable settings, please edit <user_config.h>
+ *
+ */
+
+#ifndef __stl_config__system_h
+#define __stl_config__system_h
+
+#if defined (__sun)
+# include <stl/config/_solaris.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# elif defined (__SUNPRO_CC) || defined (__SUNPRO_C)
+# include <stl/config/_sunprocc.h>
+/*
+# ifdef __KCC
+# include <stl/config/_kai.h>
+# endif
+*/
+# elif defined (__APOGEE__) /* Apogee 4.x */
+# include <stl/config/_apcc.h>
+# elif defined (__FCC_VERSION) /* Fujitsu Compiler, v4.0 assumed */
+# include <stl/config/_fujitsu.h>
+# endif
+#elif defined (__hpux)
+# include <stl/config/_hpux.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# elif defined (__HP_aCC)
+# include <stl/config/_hpacc.h>
+# endif
+#elif defined (ANDROID)
+/* Android mobile phone platform. Somewhat but not entirely GNU/Linux-like */
+# include <stl/config/_android.h>
+#elif defined (linux) || defined (__linux__)
+# include <stl/config/_linux.h>
+# if defined (__BORLANDC__)
+# include <stl/config/_bc.h> /* Borland C++ 0x570 */
+/* Intel's icc define __GNUC__! */
+# elif defined (__INTEL_COMPILER)
+# include <stl/config/_icc.h>
+# elif defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+/*
+# ifdef __KCC
+# include <stl/config/_kai.h>
+# endif
+*/
+#elif defined (__FreeBSD__)
+# include <stl/config/_freebsd.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+#elif defined (__OpenBSD__)
+# include <stl/config/_openbsd.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+#elif defined (__sgi) /* IRIX? */
+# define _STLP_PLATFORM "SGI Irix"
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# else
+# include <stl/config/_sgi.h>
+# endif
+#elif defined (__OS400__) /* AS/400 C++ */
+# define _STLP_PLATFORM "OS 400"
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# else
+# include <stl/config/_as400.h>
+# endif
+#elif defined (_AIX)
+# include <stl/config/_aix.h>
+# if defined (__xlC__) || defined (__IBMC__) || defined ( __IBMCPP__ )
+ /* AIX xlC, Visual Age C++ , OS-390 C++ */
+# include <stl/config/_ibm.h>
+# endif
+#elif defined (_CRAY) /* Cray C++ 3.4 or 3.5 */
+# define _STLP_PLATFORM "Cray"
+# include <config/_cray.h>
+#elif defined (__DECCXX) || defined (__DECC)
+# define _STLP_PLATFORM "DECC"
+# ifdef __vms
+# include <stl/config/_dec_vms.h>
+# else
+# include <stl/config/_dec.h>
+# endif
+#elif defined (macintosh) || defined (_MAC)
+# include <stl/config/_mac.h>
+# if defined (__MWERKS__)
+# include <stl/config/_mwerks.h>
+# endif
+#elif defined (__APPLE__)
+# include <stl/config/_macosx.h>
+# ifdef __GNUC__
+# include <stl/config/_gcc.h>
+# endif
+#elif defined (__CYGWIN__)
+# include <stl/config/_cygwin.h>
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+#elif defined (__MINGW32__)
+# define _STLP_PLATFORM "MinGW"
+# if defined (__GNUC__)
+# include <stl/config/_gcc.h>
+# endif
+# include <stl/config/_windows.h>
+#elif defined (_WIN32) || defined (__WIN32) || defined (WIN32) || defined (__WIN32__) || \
+ defined (__WIN16) || defined (WIN16) || defined (_WIN16)
+# if defined ( __BORLANDC__ ) /* Borland C++ / CodeGear C++ */
+# include <stl/config/_bc.h>
+# elif defined (__WATCOM_CPLUSPLUS__) || defined (__WATCOMC__) /* Watcom C++ */
+# include <stl/config/_watcom.h>
+# elif defined (__COMO__) || defined (__COMO_VERSION_)
+# include <stl/config/_como.h>
+# elif defined (__DMC__) /* Digital Mars C++ */
+# include <stl/config/_dm.h>
+# elif defined (__ICL) /* Intel reference compiler for Win */
+# include <stl/config/_intel.h>
+# elif defined (__MWERKS__)
+# include <stl/config/_mwerks.h>
+# elif defined (_MSC_VER) && (_MSC_VER >= 1200) && defined (UNDER_CE)
+ /* Microsoft eMbedded Visual C++ 3.0, 4.0 (.NET) */
+# include <stl/config/_evc.h>
+# elif defined (_MSC_VER)
+ /* Microsoft Visual C++ 6.0, 7.0, 7.1, 8.0 */
+# include <stl/config/_msvc.h>
+# endif
+
+# include <stl/config/_windows.h>
+#else
+# error Unknown platform !!
+#endif
+
+#if !defined (_STLP_COMPILER)
+/* Unable to identify the compiler, issue error diagnostic.
+ * Edit <config/stl_mycomp.h> to set STLport up for your compiler. */
+# include <stl/config/stl_mycomp.h>
+#endif
+
+#endif /* __stl_config__system_h */
diff --git a/stlport/stl/config/_warnings_off.h b/stlport/stl/config/_warnings_off.h
new file mode 100644
index 0000000..77e9815
--- /dev/null
+++ b/stlport/stl/config/_warnings_off.h
@@ -0,0 +1,51 @@
+/* This header turns off warnings that STLport headers generate for compiled
+ * user code.
+ */
+
+#if defined (_STLP_MSVC)
+# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+/*
+ * 31/07/2004: dums - now that we do not export the basic_string class anymore but only a base class
+ * we have to disable this warning as the string are used as data members type of many iostream classes.
+ */
+# pragma warning ( disable : 4251 ) // ignore template classes being exported in .dll's
+# endif
+
+# if (_STLP_MSVC < 1300) // VC6, eVC3, eVC4
+# pragma warning( disable : 4097 ) // typedef-name used as based class of (...)
+# pragma warning( disable : 4231 ) // non standard extension : 'extern' before template instanciation
+# pragma warning( disable : 4244 ) // implicit conversion: possible loss of data
+# pragma warning( disable : 4284 ) // for -> operator
+//This warning is necessary because of the native platform headers:
+# pragma warning( disable : 4290 ) // c++ exception specification ignored
+# pragma warning( disable : 4514 ) // unreferenced inline function has been removed
+# pragma warning( disable : 4660 ) // template-class specialization '...' is already instantiated
+# pragma warning( disable : 4701 ) // local variable '...' may be used without having been initialized
+# pragma warning( disable : 4710 ) // function (...) not inlined
+# pragma warning( disable : 4786 ) // identifier truncated to 255 characters
+# endif
+
+# if (_STLP_MSVC < 1400)
+# pragma warning( disable : 4511 ) // copy constructor cannot be generated
+# endif
+
+//Pool of common warnings for all MSVC supported versions:
+//Many are only useful if warning level is set to 4.
+# pragma warning( disable : 4100 ) // unreferenced formal parameter
+# pragma warning( disable : 4127 ) // conditional expression is constant
+# pragma warning( disable : 4146 ) // unary minus operator applied to unsigned type, result still unsigned
+# pragma warning( disable : 4245 ) // conversion from 'enum ' to 'unsigned int', signed/unsigned mismatch
+# pragma warning( disable : 4355 ) // this used in base member initializer list (used in rope implementation)
+# pragma warning( disable : 4510 ) // default constructor cannot be generated
+# pragma warning( disable : 4512 ) // assignment operator could not be generated
+# pragma warning( disable : 4571 ) // catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions
+# pragma warning( disable : 4610 ) // struct '...' can never be instantiated - user defined construtor required
+#elif defined (__BORLANDC__)
+# pragma option -w-ccc // -w-8008 Condition is always true OR Condition is always false
+# pragma option -w-inl // -w-8027 Functions containing reserved words are not expanded inline
+# pragma option -w-ngu // -w-8041 Negating unsigned value
+# pragma option -w-pow // -w-8062 Previous options and warnings not restored
+# pragma option -w-rch // -w-8066 Unreachable code
+# pragma option -w-par // -w-8057 Parameter 'parameter' is never used
+#endif
diff --git a/stlport/stl/config/_watcom.h b/stlport/stl/config/_watcom.h
new file mode 100644
index 0000000..b0d2def
--- /dev/null
+++ b/stlport/stl/config/_watcom.h
@@ -0,0 +1,151 @@
+// STLport configuration file
+// It is internal STLport header - DO NOT include it directly
+
+#define _STLP_COMPILER "Watcom"
+
+#if (__WATCOMC__ < 1250)
+# error Not supported!
+#endif
+
+#ifndef _CPPRTTI
+# define _STLP_NO_RTTI 1
+#endif
+
+// for switches (-xs, -xss, -xst)
+#if !(defined (__SW_XS) || defined (__SW_XSS) || defined(__SW_XST))
+# define _STLP_HAS_NO_EXCEPTIONS 1
+#endif
+
+#if defined (_MT) && !defined (_NOTHREADS)
+# define _STLP_THREADS 1
+#endif
+
+#define _STLP_NO_VENDOR_STDLIB_L
+#define _STLP_NO_VENDOR_MATH_F
+#define _STLP_NO_VENDOR_MATH_L
+
+#define _STLP_LONG_LONG long long
+
+#define _STLP_CALL __cdecl
+#define _STLP_IMPORT_DECLSPEC __declspec(dllimport)
+
+#define _STLP_NO_CONST_IN_PAIR
+
+//#define _STLP_DONT_USE_PRIV_NAMESPACE
+//#define _STLP_NO_MOVE_SEMANTIC
+//#define _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER
+#define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE
+
+#define _STLP_NO_RELOPS_NAMESPACE
+
+#define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+#define _STLP_NO_STATIC_CONST_DEFINITION
+
+//#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG
+#define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+//#define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+
+#define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+#define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+//#define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+//#define _STLP_NO_MEMBER_TEMPLATES 1
+//#define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+
+//#define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+//#define _STLP_HAS_NO_NAMESPACES 1
+//#define _STLP_NEED_TYPENAME 1
+
+#define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1
+
+//#define _STLP_STATIC_CONST_INIT_BUG 1
+// #define _STLP_THROW_RETURN_BUG 1
+//#define _STLP_NO_TEMPLATE_CONVERSIONS 1
+
+#define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+
+#define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+#define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+
+//#define _STLP_NONTEMPL_BASE_MATCH_BUG
+//#define _STLP_NO_EXCEPTION_HEADER 1
+#define _STLP_NO_BAD_ALLOC 1
+
+//#define _STLP_NO_TYPENAME_ON_RETURN_TYPE
+//#define _STLP_NESTED_TYPE_PARAM_BUG 1
+
+//#define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1
+
+#define _STLP_NO_ARROW_OPERATOR 1
+// This one is present in 11, but apparently has bugs (with auto_ptr).
+//#define _STLP_NO_NEW_STYLE_CASTS 1
+
+// Get rid of Watcom's min and max macros
+#undef min
+#undef max
+
+// On QNX, headers are supposed to be found in /usr/include,
+// so default "../include" should work.
+#ifndef __QNX__
+# define _STLP_NATIVE_INCLUDE_PATH ../h
+#else
+// boris : is this true or just the header is not in /usr/include ?
+# define _STLP_NO_TYPEINFO 1
+#endif
+
+// Inline replacements for locking calls under Watcom
+// Define _STLP_NO_WATCOM_INLINE_INTERLOCK to keep using
+// standard WIN32 calls
+// Define _STL_MULTIPROCESSOR to enable lock
+#define _STLP_NO_WATCOM_INLINE_INTERLOCK
+#if !defined(_STLP_NO_WATCOM_INLINE_INTERLOCK)
+
+long __stl_InterlockedIncrement( long *var );
+long __stl_InterlockedDecrement( long *var );
+
+#ifdef _STL_MULTIPROCESSOR
+// Multiple Processors, add lock prefix
+#pragma aux __stl_InterlockedIncrement parm [ ecx ] = \
+ ".586" \
+ "mov eax, 1" \
+ "lock xadd [ecx], eax" \
+ "inc eax" \
+ value [eax];
+
+
+#pragma aux __stl_InterlockedDecrement parm [ ecx ] = \
+ ".586" \
+ "mov eax, 0FFFFFFFFh" \
+ "lock xadd [ecx], eax" \
+ "dec eax" \
+ value [eax];
+#else
+// Single Processor, lock prefix not needed
+#pragma aux __stl_InterlockedIncrement parm [ ecx ] = \
+ ".586" \
+ "mov eax, 1" \
+ "xadd [ecx], eax" \
+ "inc eax" \
+ value [eax];
+
+#pragma aux __stl_InterlockedDecrement parm [ ecx ] = \
+ ".586" \
+ "mov eax, 0FFFFFFFFh" \
+ "xadd [ecx], eax" \
+ "dec eax" \
+ value [eax];
+#endif // _STL_MULTIPROCESSOR
+
+long __stl_InterlockedExchange( long *Destination, long Value );
+
+// xchg has auto-lock
+#pragma aux __stl_InterlockedExchange parm [ecx] [eax] = \
+ ".586" \
+ "xchg eax, [ecx]" \
+ value [eax];
+
+# define _STLP_ATOMIC_INCREMENT(__x) __stl_InterlockedIncrement((long*)__x)
+# define _STLP_ATOMIC_DECREMENT(__x) __stl_InterlockedDecrement((long*)__x)
+# define _STLP_ATOMIC_EXCHANGE(__x, __y) __stl_InterlockedExchange((long*)__x, (long)__y)
+# define _STLP_ATOMIC_EXCHANGE_PTR(__x, __y) __stl_InterlockedExchange((long*)__x, (long)__y)
+#endif /* INLINE INTERLOCK */
+
diff --git a/stlport/stl/config/_windows.h b/stlport/stl/config/_windows.h
new file mode 100644
index 0000000..6b42e11
--- /dev/null
+++ b/stlport/stl/config/_windows.h
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_INTERNAL_WINDOWS_H
+#define _STLP_INTERNAL_WINDOWS_H
+
+#if !defined (_STLP_PLATFORM)
+# define _STLP_PLATFORM "Windows"
+#endif
+
+#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN)
+# if defined (_MIPSEB)
+# define _STLP_BIG_ENDIAN 1
+# endif
+# if defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \
+ defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \
+ defined (__alpha__)
+# define _STLP_LITTLE_ENDIAN 1
+# endif
+# if defined (__ia64__)
+ /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */
+# if defined (__BIG_ENDIAN__)
+# define _STLP_BIG_ENDIAN 1
+# else
+# define _STLP_LITTLE_ENDIAN 1
+# endif
+# endif
+#endif /* _STLP_BIG_ENDIAN */
+
+#if !defined (_STLP_WINDOWS_H_INCLUDED)
+# define _STLP_WINDOWS_H_INCLUDED
+# if defined (__BUILDING_STLPORT)
+# include <stl/config/_native_headers.h>
+/* Here we define _STLP_OUTERMOST_HEADER_ID to avoid indirect inclusion
+ * of STLport stuffs from C/C++ Standard headers exposed by STLport
+ * as configuration is not yet completed. */
+# if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x100
+# endif
+# if !defined (WIN32_LEAN_AND_MEAN)
+# define WIN32_LEAN_AND_MEAN
+# endif
+# if !defined (VC_EXTRALEAN)
+# define VC_EXTRALEAN
+# endif
+/* Don't let windows.h define its min and max macros. */
+# if !defined (NOMINMAX)
+# define NOMINMAX
+# endif
+# if !defined (STRICT)
+# define STRICT
+# endif
+# if defined (_STLP_USE_MFC)
+# include <afx.h>
+# else
+# include <windows.h>
+# endif
+# if (_STLP_OUTERMOST_HEADER_ID == 0x100)
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+# else
+/* This section serves as a replacement for windows.h header. */
+# if defined (__cplusplus)
+extern "C" {
+# endif
+# if (defined (_M_AMD64) || defined (_M_IA64) || (!defined (_STLP_WCE) && defined (_M_MRX000)) || defined (_M_ALPHA) || \
+ (defined (_M_PPC) && (_STLP_MSVC_LIB >= 1000))) && !defined (RC_INVOKED)
+# define InterlockedIncrement _InterlockedIncrement
+# define InterlockedDecrement _InterlockedDecrement
+# define InterlockedExchange _InterlockedExchange
+# define _STLP_STDCALL
+# else
+# if defined (_MAC)
+# define _STLP_STDCALL _cdecl
+# else
+# define _STLP_STDCALL __stdcall
+# endif
+# endif
+
+# if defined (_STLP_NEW_PLATFORM_SDK)
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long volatile *);
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long volatile *);
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long volatile *, long);
+# if defined (_WIN64)
+_STLP_IMPORT_DECLSPEC void* _STLP_STDCALL _InterlockedExchangePointer(void* volatile *, void*);
+# endif
+# elif !defined (_STLP_WCE)
+/* boris : for the latest SDK, you may actually need the other version of the declaration (above)
+ * even for earlier VC++ versions. There is no way to tell SDK versions apart, sorry ...
+ */
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long*);
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long*);
+_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long*, long);
+# else
+/* start of eMbedded Visual C++ specific section */
+# include <stl/config/_native_headers.h>
+
+/* Don't let windef.h define its min and max macros. */
+# if !defined (NOMINMAX)
+# define NOMINMAX
+# endif
+# include <windef.h> /* needed for basic windows types */
+
+ /** in SDKs generated with PB5, windef.h somehow includes headers which then
+ define setjmp. */
+# if (_WIN32_WCE >= 0x500)
+# define _STLP_NATIVE_SETJMP_H_INCLUDED
+# endif
+
+# ifndef _WINBASE_ /* winbase.h already included? */
+long WINAPI InterlockedIncrement(long*);
+long WINAPI InterlockedDecrement(long*);
+long WINAPI InterlockedExchange(long*, long);
+# endif
+
+# ifndef __WINDOWS__ /* windows.h already included? */
+
+# if defined (x86)
+# include <winbase.h> /* needed for inline versions of Interlocked* functions */
+# endif
+
+# ifndef _MFC_VER
+
+# define MessageBox MessageBoxW
+int WINAPI MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
+
+# define wvsprintf wvsprintfW
+int WINAPI wvsprintfW(LPWSTR, LPCWSTR, va_list ArgList);
+
+void WINAPI ExitThread(DWORD dwExitCode);
+
+# if !defined (COREDLL)
+# define _STLP_WCE_WINBASEAPI DECLSPEC_IMPORT
+# else
+# define _STLP_WCE_WINBASEAPI
+# endif
+
+_STLP_WCE_WINBASEAPI int WINAPI
+MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
+ int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
+
+_STLP_WCE_WINBASEAPI UINT WINAPI GetACP();
+
+_STLP_WCE_WINBASEAPI BOOL WINAPI TerminateProcess(HANDLE hProcess, DWORD uExitCode);
+
+# define OutputDebugString OutputDebugStringW
+void WINAPI OutputDebugStringW(LPCWSTR);
+
+_STLP_WCE_WINBASEAPI void WINAPI Sleep(DWORD);
+
+# undef _STLP_WCE_WINBASEAPI
+
+# endif /* !_MFC_VER */
+
+# endif /* !__WINDOWS__ */
+
+/* end of eMbedded Visual C++ specific section */
+# endif
+
+# if !defined (_STLP_WCE)
+_STLP_IMPORT_DECLSPEC void _STLP_STDCALL Sleep(unsigned long);
+_STLP_IMPORT_DECLSPEC void _STLP_STDCALL OutputDebugStringA(const char* lpOutputString);
+# endif
+
+# if defined (InterlockedIncrement)
+# pragma intrinsic(_InterlockedIncrement)
+# pragma intrinsic(_InterlockedDecrement)
+# pragma intrinsic(_InterlockedExchange)
+# if defined (_WIN64)
+# pragma intrinsic(_InterlockedExchangePointer)
+# endif
+# endif
+# if defined (__cplusplus)
+} /* extern "C" */
+# endif
+
+# endif
+
+/* Here we use a macro different than the InterlockedExchangePointer SDK one
+ * to avoid macro definition conflict. */
+# if !defined (_WIN64)
+/* Under 32 bits platform we rely on a simple InterlockedExchange call. */
+# if defined (__cplusplus)
+/* We do not define this function if we are not in a C++ translation unit just
+ * because of the 'inline' keyword portability issue it would introduce. We will
+ * have to fix it the day we need this function for a C translation unit.
+ */
+inline
+void* _STLP_CALL STLPInterlockedExchangePointer(void* volatile* __a, void* __b) {
+# if defined (_STLP_MSVC)
+/* Here MSVC produces warning if 64 bits portability issue is activated.
+ * MSVC do not see that _STLP_ATOMIC_EXCHANGE_PTR is a macro which content
+ * is based on the platform, Win32 or Win64
+ */
+# pragma warning (push)
+# pragma warning (disable : 4311) // pointer truncation from void* to long
+# pragma warning (disable : 4312) // conversion from long to void* of greater size
+# endif
+# if !defined (_STLP_NO_NEW_STYLE_CASTS)
+ return reinterpret_cast<void*>(InterlockedExchange(reinterpret_cast<long*>(const_cast<void**>(__a)),
+ reinterpret_cast<long>(__b)));
+# else
+ return (void*)InterlockedExchange((long*)__a, (long)__b);
+# endif
+# if defined (_STLP_MSVC)
+# pragma warning (pop)
+# endif
+}
+# endif
+# else
+# define STLPInterlockedExchangePointer _InterlockedExchangePointer
+# endif
+
+#endif /* _STLP_WINDOWS_H_INCLUDED */
+
+/* _STLP_WIN95_LIKE signal the Windows 95 OS or assimilated Windows OS version that
+ * has Interlockeded[Increment, Decrement] Win32 API functions not returning modified
+ * value.
+ */
+#if (defined (WINVER) && (WINVER < 0x0410) && (!defined (_WIN32_WINNT) || (_WIN32_WINNT < 0x400))) || \
+ (!defined (WINVER) && (defined (_WIN32_WINDOWS) && (_WIN32_WINDOWS < 0x0410) || \
+ (defined (_WIN32_WINNT) && (_WIN32_WINNT < 0x400))))
+# define _STLP_WIN95_LIKE
+#endif
+
+/* Between Windows 95 (0x400) and later Windows OSes an API enhancement forces us
+ * to change _Refcount_Base internal struct. As _Refcount_base member methods might
+ * be partially inlined we need to check that STLport build/use are coherent. To do
+ * so we try to generate a link time error thanks to the following macro.
+ * This additional check is limited to old compilers that might still be used with
+ * Windows 95. */
+#if (defined (_DEBUG) || defined (_STLP_DEBUG)) && \
+ (defined (_STLP_MSVC) && (_STLP_MSVC < 1310) || \
+ defined (__GNUC__) && (__GNUC__ < 3))
+/* We invert symbol names based on macro detection, when building for Windows
+ * 95 we expose a
+ * building_for_windows95_or_previous_but_library_built_for_windows98_or_later
+ * function in order to have a more obvious link error message signaling how
+ * the lib has been built and how it is used. */
+# if defined (__BUILDING_STLPORT)
+# if defined (_STLP_WIN95_LIKE)
+# define _STLP_SIGNAL_RUNTIME_COMPATIBILITY building_for_windows95_but_library_built_for_at_least_windows98
+# else
+# define _STLP_SIGNAL_RUNTIME_COMPATIBILITY building_for_at_least_windows98_but_library_built_for_windows95
+# endif
+# else
+# if defined (_STLP_WIN95_LIKE)
+# define _STLP_CHECK_RUNTIME_COMPATIBILITY building_for_windows95_but_library_built_for_at_least_windows98
+# else
+# define _STLP_CHECK_RUNTIME_COMPATIBILITY building_for_at_least_windows98_but_library_built_for_windows95
+# endif
+# endif
+#endif
+
+#if defined (__WIN16) || defined (WIN16) || defined (_WIN16)
+# define _STLP_WIN16
+#else
+# define _STLP_WIN32
+#endif
+
+#if defined(_STLP_WIN32)
+# define _STLP_USE_WIN32_IO /* CreateFile/ReadFile/WriteFile */
+#endif
+
+#if defined(__MINGW32__) && !defined(_STLP_USE_STDIO_IO)
+# define _STLP_USE_WIN32_IO /* CreateFile/ReadFile/WriteFile */
+#endif /* __MINGW32__ */
+
+#ifdef _STLP_WIN16
+# define _STLP_USE_UNIX_EMULATION_IO /* _open/_read/_write */
+# define _STLP_LDOUBLE_80
+#endif
+
+#endif /* _STLP_INTERNAL_WINDOWS_H */
diff --git a/stlport/stl/config/compat.h b/stlport/stl/config/compat.h
new file mode 100644
index 0000000..434f314
--- /dev/null
+++ b/stlport/stl/config/compat.h
@@ -0,0 +1,80 @@
+
+/*
+ * Compatibility section
+ * This section sets new-style macros based on old-style ones, for compatibility
+ */
+
+#if defined (__STL_DEBUG) && !defined (_STLP_DEBUG)
+# define _STLP_DEBUG __STL_DEBUG
+#endif
+#if defined (__STL_NO_ANACHRONISMS) && !defined (_STLP_NO_ANACHRONISMS)
+# define _STLP_NO_ANACHRONISMS __STL_NO_ANACHRONISMS
+#endif
+#if defined (__STL_NO_EXTENSIONS) && !defined (_STLP_NO_EXTENSIONS)
+# define _STLP_NO_EXTENSIONS __STL_NO_EXTENSIONS
+#endif
+#if defined (__STL_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS)
+# define _STLP_NO_EXCEPTIONS __STL_NO_EXCEPTIONS
+#endif
+#if defined (__STL_NO_NAMESPACES) && !defined (_STLP_NO_NAMESPACES)
+# define _STLP_NO_NAMESPACES __STL_NO_NAMESPACES
+#endif
+#if defined (__STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
+# define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS __STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS
+#endif
+#if defined (__STL_NO_OWN_NAMESPACE) && !defined (_STLP_NO_OWN_NAMESPACE)
+# define _STLP_NO_OWN_NAMESPACE __STL_NO_OWN_NAMESPACE
+#endif
+
+#if defined (__STL_NO_RELOPS_NAMESPACE) && !defined (_STLP_NO_RELOPS_NAMESPACE)
+# define _STLP_NO_RELOPS_NAMESPACE __STL_NO_RELOPS_NAMESPACE
+#endif
+
+#if defined (__STL_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_UNINITIALIZED)
+# define _STLP_DEBUG_UNINITIALIZED __STL_DEBUG_UNINITIALIZED
+#endif
+#if defined (__STL_SHRED_BYTE) && !defined (_STLP_SHRED_BYTE)
+# define _STLP_SHRED_BYTE __STL_SHRED_BYTE
+#endif
+#if defined (__STL_USE_MFC) && !defined (_STLP_USE_MFC)
+# define _STLP_USE_MFC __STL_USE_MFC
+#endif
+
+#if defined (__STL_USE_NEWALLOC) && !defined (_STLP_USE_NEWALLOC)
+# define _STLP_USE_NEWALLOC __STL_USE_NEWALLOC
+#endif
+#if defined (__STL_USE_MALLOC) && !defined (_STLP_USE_MALLOC)
+# define _STLP_USE_MALLOC __STL_USE_MALLOC
+#endif
+
+#if defined (__STL_DEBUG_ALLOC) && !defined (_STLP_DEBUG_ALLOC)
+# define _STLP_DEBUG_ALLOC __STL_DEBUG_ALLOC
+#endif
+
+#if defined (__STL_DEBUG_MESSAGE) && !defined (_STLP_DEBUG_MESSAGE)
+# define _STLP_DEBUG_MESSAGE __STL_DEBUG_MESSAGE
+#endif
+
+#if defined (__STL_DEBUG_TERMINATE) && !defined (_STLP_DEBUG_TERMINATE)
+# define _STLP_DEBUG_TERMINATE __STL_DEBUG_TERMINATE
+#endif
+
+#if defined (__STL_USE_ABBREVS) && !defined (_STLP_USE_ABBREVS)
+# define _STLP_USE_ABBREVS __STL_USE_ABBREVS
+#endif
+
+#if defined (__STL_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_NO_MSVC50_COMPATIBILITY)
+# define _STLP_NO_MSVC50_COMPATIBILITY __STL_NO_MSVC50_COMPATIBILITY
+#endif
+
+/* STLport do not support anymore the iostream wrapper mode so this macro should
+ * always been define for other libraries that was using it:
+ */
+#if !defined (_STLP_OWN_IOSTREAMS)
+# define _STLP_OWN_IOSTREAMS
+#endif
+
+#if defined (_STLP_NO_OWN_IOSTREAMS)
+# error STLport do not support anymore the wrapper mode. If you want to use STLport \
+use its iostreams implementation or no iostreams at all.
+#endif
diff --git a/stlport/stl/config/features.h b/stlport/stl/config/features.h
new file mode 100644
index 0000000..b5b4e3a
--- /dev/null
+++ b/stlport/stl/config/features.h
@@ -0,0 +1,1079 @@
+ /*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_FEATURES_H
+#define _STLP_FEATURES_H
+
+/*
+ * Purpose of this file:
+ *
+ * Defines all STLport settings.
+ * This file is actually a wrapper : it includes compiler-specific
+ * settings from <config/stlcomp.h>
+ * and user-defined settings from <config/user_config.h>.
+ * See <config/stl_mycomp.h> and <config/user_config.h> for the description
+ * of those macros
+ *
+ */
+
+/* Definition of the STLport version informations */
+#include <stl/_stlport_version.h>
+
+/* Other macros defined by this file:
+
+ * bool, true, and false, if _STLP_NO_BOOL is defined.
+ * typename, as a null macro if it's not already a keyword.
+ * explicit, as a null macro if it's not already a keyword.
+ * namespace-related macros (_STLP_STD, _STLP_BEGIN_NAMESPACE, etc.)
+ * exception-related macros (_STLP_TRY, _STLP_UNWIND, etc.)
+ * _STLP_ASSERT, either as a test or as a null macro, depending on
+ whether or not _STLP_ASSERTIONS is defined.
+*/
+
+/* Definition of the 2 STLport debug levels */
+#define _STLP_STLPORT_DBG_LEVEL 1
+#define _STLP_STANDARD_DBG_LEVEL 2
+
+/* Placeholder for user to override settings.
+ * It could be also used to mask settings from
+ * different directories.
+ */
+#include <stl/config/user_config.h>
+
+#if defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_LEVEL)
+# define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL
+#endif
+
+#if defined (__BUILDING_STLPORT)
+/* For the STLport implementation we can use everything:
+ */
+# if defined (_STLP_NO_ANACHRONISMS)
+# undef _STLP_NO_ANACHRONISMS
+# endif
+# if defined (_STLP_NO_EXTENSIONS)
+# undef _STLP_NO_EXTENSIONS
+# endif
+/* Moreover there are things that have no sens:
+ */
+# if defined (_STLP_NO_IOSTREAMS)
+# error If you do not use iostreams you do not need to build the STLport library.
+# endif
+#endif
+
+/* ========================================================= */
+/* This file is used for compatibility; it accepts old-style config
+ switches */
+#include <stl/config/compat.h>
+
+/* Common configuration file for this particular installation. */
+#include <stl/config/host.h>
+
+/* Operational Environment specific */
+#include <stl/config/_system.h>
+
+/* ========================================================= */
+
+/* some fixes to configuration. This also includes modifications
+ * of STLport switches depending on compiler flags,
+ * or settings applicable to a group of compilers, such as
+ * to all who use EDG front-end.
+ */
+#include <stl/config/stl_confix.h>
+
+#if !defined (_STLP_NO_MEMBER_TEMPLATES) && !defined (_STLP_MEMBER_TEMPLATES)
+# define _STLP_MEMBER_TEMPLATES 1
+#endif
+
+#if !defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+# define _STLP_MEMBER_TEMPLATE_CLASSES 1
+#endif
+
+#if defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1
+#endif
+
+#if !defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# define _STLP_CLASS_PARTIAL_SPECIALIZATION 1
+#endif
+
+#if !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER)
+# define _STLP_FUNCTION_TMPL_PARTIAL_ORDER 1
+#endif
+
+#if !defined (_STLP_DONT_USE_SHORT_STRING_OPTIM) && !defined (_STLP_USE_SHORT_STRING_OPTIM)
+# define _STLP_USE_SHORT_STRING_OPTIM 1
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXTENSIONS) && \
+ !defined (_STLP_NO_CONTAINERS_EXTENSION) && !defined (_STLP_USE_CONTAINERS_EXTENSION)
+# define _STLP_USE_CONTAINERS_EXTENSION
+#endif
+
+#if defined (_STLP_USE_CONTAINERS_EXTENSION)
+# define _STLP_TEMPLATE_FOR_CONT_EXT template <class _KT>
+#else
+# define _STLP_TEMPLATE_FOR_CONT_EXT
+#endif
+
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS) && \
+ (defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS))
+# error Sorry but according the STLport settings your compiler can not support the pointer specialization feature.
+#endif
+
+#if defined (_STLP_WHOLE_NATIVE_STD) && defined (_STLP_NO_OWN_NAMESPACE)
+# error Sorry but asking for both STLport to be in the real std namespace and also having STLport import all native std stuff \
+ is invalid, chose one or none.
+#endif
+
+#if defined (_STLP_VERBOSE) && !defined (_STLP_VERBOSE_MODE_SUPPORTED)
+# error Sorry but the verbose mode is not implemented for your compiler.
+#endif
+
+#if defined (_STLP_NO_IOSTREAMS) && \
+ !defined (_STLP_USE_NEWALLOC) && !defined (_STLP_USE_MALLOC)
+# define _STLP_USE_NEWALLOC
+#endif
+
+#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN)
+# if defined (_MIPSEB) || defined (__sparc) || defined (_AIX) || \
+ defined (__hpux) || defined (macintosh) || defined (_MAC)
+# define _STLP_BIG_ENDIAN 1
+# elif defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \
+ defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \
+ defined (__alpha__)
+# define _STLP_LITTLE_ENDIAN 1
+# elif defined (__ia64__)
+ /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */
+# if defined (__BIG_ENDIAN__)
+# define _STLP_BIG_ENDIAN 1
+# else
+# define _STLP_LITTLE_ENDIAN 1
+# endif
+# else
+# error "can't determine endianess"
+# endif
+#endif /* _STLP_BIG_ENDIAN */
+
+/* ==========================================================
+ * final workaround tuning based on given flags
+ * ========================================================== */
+
+#ifndef _STLP_UINT32_T
+# define _STLP_UINT32_T unsigned long
+#endif
+#ifndef _STLP_ABORT
+# define _STLP_ABORT() abort()
+#endif
+
+#if !defined (_STLP_HAS_NO_NAMESPACES)
+# if defined _STLP_NO_NAMESPACES
+# undef _STLP_USE_NAMESPACES
+# else
+/* assume it as the default, turn it off later if NO_NAMESPACES selected */
+# undef _STLP_USE_NAMESPACES
+# define _STLP_USE_NAMESPACES 1
+# endif
+#endif
+
+#if defined (_STLP_NO_IOSTREAMS)
+# define _STLP_USE_NO_IOSTREAMS
+#endif
+
+/* Operating system recognition (basic) */
+#if (defined(__unix) || defined(__linux__) || defined(__QNX__) || defined(_AIX) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__Lynx__) || defined(__hpux) || defined(__sgi)) && \
+ !defined (_STLP_UNIX)
+# define _STLP_UNIX 1
+#endif /* __unix */
+
+#if !defined (_STLP_NO_LONG_DOUBLE)
+# define _STLP_LONGEST_FLOAT_TYPE long double
+#else
+# define _STLP_LONGEST_FLOAT_TYPE double
+#endif
+
+/* Native headers access macros */
+#if !defined (_STLP_HAS_INCLUDE_NEXT)
+# include <stl/config/_native_headers.h>
+#endif
+
+/* shared library tune-up */
+
+#if defined (__BUILDING_STLPORT)
+/* if we are rebuilding right now, place everything here */
+# undef _STLP_DESIGNATED_DLL
+# define _STLP_DESIGNATED_DLL 1
+#endif
+
+/* Use own namespace always if possible and not explicitly instructed otherwise */
+#if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_BROKEN_USING_DIRECTIVE) && \
+ !defined (_STLP_NO_OWN_NAMESPACE)
+# undef _STLP_USE_OWN_NAMESPACE
+# define _STLP_USE_OWN_NAMESPACE 1
+#else
+# undef _STLP_WHOLE_NATIVE_STD
+#endif
+
+#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED)
+
+# if defined (_PTHREADS)
+# define _STLP_PTHREADS
+# define _STLP_THREADS
+# endif
+# if defined (_UITHREADS)
+# define _STLP_UITHREADS
+# define _STLP_THREADS
+# endif
+
+# if defined (_STLP_WIN32) && !defined (_STLP_PTHREADS)
+# define _STLP_WIN32THREADS 1
+# elif ((defined (__sun) && !defined (__linux__)) || defined (_UITHREADS) ) && \
+ !defined(_STLP_PTHREADS)
+# define _STLP_UITHREADS
+# else
+# define _STLP_PTHREADS
+# endif /* __sgi */
+# define _STLP_THREADS_DEFINED
+#endif
+
+#if (defined (_REENTRANT) || defined (_THREAD_SAFE)) && !defined (_STLP_THREADS)
+# define _STLP_THREADS
+#endif
+
+#ifndef _STLP_STATIC_MUTEX
+# define _STLP_STATIC_MUTEX _STLP_mutex_base
+#endif
+
+#if (defined (_MFC_VER) || defined (_AFXDLL)) && !defined (_STLP_USE_MFC)
+# define _STLP_USE_MFC 1
+#endif
+
+#if defined (_STLP_THREADS)
+# define _STLP_VOLATILE volatile
+#else
+# define _STLP_VOLATILE
+#endif
+
+#if !defined (_STLP_USE_NEW_C_HEADERS) && !defined (_STLP_HAS_NO_NEW_C_HEADERS)
+# define _STLP_USE_NEW_C_HEADERS
+#endif
+/* disable new-style headers if requested */
+#if defined (_STLP_NO_NEW_C_HEADERS)
+# undef _STLP_USE_NEW_C_HEADERS
+#endif
+
+#if defined (_STLP_BASE_TYPEDEF_BUG)
+# undef _STLP_BASE_TYPEDEF_OUTSIDE_BUG
+# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+#endif
+
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG
+#endif
+
+/* SUNpro 4.2 inline string literal bug */
+#ifdef _STLP_INLINE_STRING_LITERAL_BUG
+# define _STLP_FIX_LITERAL_BUG(__x) __x = __x;
+#else
+# define _STLP_FIX_LITERAL_BUG(__x)
+#endif
+
+#if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
+# undef _STLP_NO_DEFAULT_NON_TYPE_PARAM
+# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+#endif
+
+#if !defined (_STLP_STATIC_ASSERT)
+/* Some compiler support 0 size array so we use negative size array to generate
+ * a compilation time error.
+ */
+# define _STLP_STATIC_ASSERT(expr) typedef char __static_assert[expr ? 1 : -1];
+#endif
+
+/* apple mpw exception handling bug */
+#ifndef _STLP_MPWFIX_TRY
+# define _STLP_MPWFIX_TRY
+#endif
+#ifndef _STLP_MPWFIX_CATCH
+# define _STLP_MPWFIX_CATCH
+#endif
+#ifndef _STLP_MPWFIX_CATCH_ACTION
+# define _STLP_MPWFIX_CATCH_ACTION(action)
+#endif
+
+#if !defined (_STLP_WEAK)
+# define _STLP_WEAK
+#endif
+
+/* default parameters as template types derived from arguments ( not always supported ) */
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname
+#else
+# if !defined (_STLP_DEFAULT_TYPE_PARAM)
+# define _STLP_DEFAULT_TYPE_PARAM 1
+# endif
+# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname = defval
+#endif
+
+#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) class _Alloc
+#else
+# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) \
+ class _Alloc = allocator< pair < _Key, _Tp > >
+#endif
+
+/* default parameters as complete types */
+#if defined (_STLP_DEFAULT_TYPE_PARAM)
+# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname = defval
+# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name = val
+#else
+# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname
+# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name
+#endif
+
+/* SGI compatibility */
+
+#ifdef _STLP_NO_WCHAR_T
+# ifndef _STLP_NO_NATIVE_WIDE_STREAMS
+# define _STLP_NO_NATIVE_WIDE_STREAMS 1
+# endif
+#else
+# define _STLP_HAS_WCHAR_T 1
+#endif
+
+#if !defined (_STLP_NO_AT_MEMBER_FUNCTION)
+# define _STLP_CAN_THROW_RANGE_ERRORS 1
+#endif
+
+/* debug mode tool */
+#if defined (_STLP_DEBUG)
+# define _STLP_NON_DBG_NAME(X) _NonDbg_##X
+#endif
+
+/* pointer specialization tool */
+#if defined (_STLP_USE_PTR_SPECIALIZATIONS)
+# define _STLP_PTR_IMPL_NAME(X) _Impl_##X
+#endif
+
+#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \
+ defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+# define _STLP_NO_MEM_T_NAME(X) _NoMemT_##X
+#endif
+
+/* this always mean the C library is in global namespace */
+#if defined (_STLP_HAS_NO_NEW_C_HEADERS) && !defined (_STLP_VENDOR_GLOBAL_CSTD)
+# define _STLP_VENDOR_GLOBAL_CSTD 1
+#endif
+
+/* Depending of whether compiler supports namespaces,
+ * tune the parameters for vendor-supplied libraries.
+ * This section is guarded by _STLP_HAS_NO_NAMESPACES, not by _STLP_USE_NAMESPACES,
+ * since it depends only on the native features, not on user's preference whether
+ * to use namespace for STLport or not.
+ */
+#if !defined (_STLP_HAS_NO_NAMESPACES)
+/* Import some vendor's headers into corresponding STLport ones if they might be needed
+ * (if we wrap native iostreams and use namepace other than std::) */
+# if defined (_STLP_WHOLE_NATIVE_STD)
+# define _STLP_IMPORT_VENDOR_STD 1
+# endif
+
+/* if using stlport:: namespace or if C library stuff is not in vendor's std::,
+ * try importing 'em.
+ * MSVC has ambiguity problem when we try to import C-style std:: stuff back into global namespace */
+# if defined (_STLP_USE_NAMESPACES) && (defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_VENDOR_GLOBAL_CSTD))
+# define _STLP_IMPORT_VENDOR_CSTD 1
+# endif
+
+# if defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS) && !defined (_STLP_DO_IMPORT_CSTD_FUNCTIONS)
+# define _STLP_NO_CSTD_FUNCTION_IMPORTS
+# endif
+
+# define _STLP_USING_NAMESPACE(x) using namespace x ;
+
+namespace std { }
+namespace __std_alias = std;
+
+/* assume std:: namespace for C++ std library if not being told otherwise */
+# if defined (_STLP_VENDOR_GLOBAL_STD)
+# define _STLP_VENDOR_STD
+# else
+# define _STLP_VENDOR_STD std
+# endif
+
+/* tune things that come from C library */
+# if defined (_STLP_VENDOR_GLOBAL_CSTD) || !defined(_STLP_USE_NEW_C_HEADERS)
+/* in old-style headers, C functions go to global scope. */
+# define _STLP_VENDOR_CSTD
+# define _STLP_USING_VENDOR_CSTD
+# else
+# define _STLP_VENDOR_CSTD _STLP_VENDOR_STD
+# define _STLP_USING_VENDOR_CSTD _STLP_USING_NAMESPACE(_STLP_VENDOR_CSTD)
+# endif /* _STLP_VENDOR_CSTD */
+/* exception, typeinfo, new - always come from the vendor */
+# if !defined (_STLP_VENDOR_EXCEPT_STD)
+# if defined (_STLP_VENDOR_GLOBAL_EXCEPT_STD)
+# define _STLP_VENDOR_EXCEPT_STD
+# else
+# define _STLP_VENDOR_EXCEPT_STD _STLP_VENDOR_STD
+# endif
+# endif
+# define _STLP_OLD_IO_NAMESPACE
+# if !defined (_STLP_VENDOR_MB_NAMESPACE)
+# define _STLP_VENDOR_MB_NAMESPACE _STLP_VENDOR_CSTD
+# endif
+#else
+/* compiler has no namespace support */
+# define _STLP_VENDOR_STD
+# define _STLP_VENDOR_CSTD
+# define _STLP_USING_NAMESPACE(x)
+# define _STLP_USING_VENDOR_CSTD
+# define _STLP_VENDOR_EXCEPT_STD
+#endif
+
+#if defined (_STLP_USE_NAMESPACES)
+
+# if defined (_STLP_USE_OWN_NAMESPACE)
+# if !defined (_STLP_STD_NAME)
+# if !defined (_STLP_DEBUG)
+# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# ifndef _STLP_THREADS
+# define _STLP_STD_NAME stlpmtx_std
+# else
+# define _STLP_STD_NAME stlp_std
+# endif
+# else
+# ifndef _STLP_THREADS
+# define _STLP_STD_NAME stlpxmtx_std
+# else
+# define _STLP_STD_NAME stlpx_std
+# endif
+# endif
+# else
+/*
+ * The STLport debug mode is binary incompatible with the other modes,
+ * lets make it clear on the STLport namespace to generate link errors rather
+ * than runtime ones.
+ */
+# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB)
+# ifndef _STLP_THREADS
+# define _STLP_STD_NAME stlpdmtx_std
+# else
+# define _STLP_STD_NAME stlpd_std
+# endif
+# else
+# ifndef _STLP_THREADS
+# define _STLP_STD_NAME stlpdxmtx_std
+# else
+# define _STLP_STD_NAME stlpdx_std
+# endif
+# endif
+# endif
+# endif
+namespace _STLP_STD_NAME { }
+# else
+# define _STLP_STD_NAME std
+# endif /* _STLP_USE_OWN_NAMESPACE */
+
+# define _STLP_BEGIN_NAMESPACE namespace _STLP_STD_NAME {
+# define _STLP_BEGIN_TR1_NAMESPACE namespace tr1 {
+# define _STLP_END_NAMESPACE }
+
+/* decide whether or not we use separate namespace for rel ops */
+# if defined (_STLP_NO_RELOPS_NAMESPACE)
+# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops {}
+# define _STLP_END_RELOPS_NAMESPACE }
+# else
+/* Use std::rel_ops namespace */
+# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops {
+# define _STLP_END_RELOPS_NAMESPACE } }
+# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+# endif /* Use std::rel_ops namespace */
+
+# define _STLP_STD ::_STLP_STD_NAME
+# if !defined (_STLP_TR1)
+# define _STLP_TR1 _STLP_STD::tr1::
+# endif
+
+# if !defined (_STLP_DONT_USE_PRIV_NAMESPACE)
+# define _STLP_PRIV_NAME priv
+# define _STLP_PRIV _STLP_STD::_STLP_PRIV_NAME::
+# define _STLP_MOVE_TO_PRIV_NAMESPACE namespace _STLP_PRIV_NAME {
+# define _STLP_MOVE_TO_STD_NAMESPACE }
+# else
+# if !defined (_STLP_PRIV)
+# define _STLP_PRIV _STLP_STD::
+# endif
+# define _STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_MOVE_TO_STD_NAMESPACE
+# endif
+
+/* Official STLport namespace when std is not redefined.
+ * Here we don't use a macro because we do not need it and because
+ * stlport is used as file name by boost and folder name under beos:
+ */
+namespace stlport = _STLP_STD_NAME;
+
+/* Backward compatibility:
+ */
+namespace _STL = _STLP_STD_NAME;
+#undef __STLPORT_NAMESPACE
+#define __STLPORT_NAMESPACE _STLP_STD_NAME
+
+#else /* _STLP_USE_NAMESPACES */
+/* STLport is being put into global namespace */
+# define _STLP_STD
+# define _STLP_PRIV
+# define _STLP_TR1
+# define _STLP_BEGIN_NAMESPACE
+# define _STLP_BEGIN_TR1_NAMESPACE
+# define _STLP_END_NAMESPACE
+# define _STLP_MOVE_TO_PRIV_NAMESPACE
+# define _STLP_MOVE_TO_STD_NAMESPACE
+
+/* boris : it was found out that _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+ causes less problems than having relational operator templates in global namespace
+ Please define _STLP_NO_RELOPS_NAMESPACE in config/user_config.h if your code rely on them. */
+# if !defined (_STLP_NO_RELOPS_NAMESPACE)
+# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+# endif
+# define _STLP_BEGIN_RELOPS_NAMESPACE
+# define _STLP_END_RELOPS_NAMESPACE
+# undef _STLP_USE_OWN_NAMESPACE
+#endif /* _STLP_USE_NAMESPACES */
+
+#define STLPORT_CSTD _STLP_VENDOR_CSTD
+#define STLPORT _STLP_STD_NAME
+
+#if defined(_STLP_BOGUS_TEMPLATE_TYPE_MATCHING_BUG)
+# define _STLP_SIMPLE_TYPE(T) _stl_trivial_proxy<T>
+#else
+# define _STLP_SIMPLE_TYPE(T) T
+#endif
+
+#ifndef _STLP_RAND48
+# define _STLP_NO_DRAND48
+#endif
+
+/* advanced keywords usage */
+#define __C_CAST(__x, __y) ((__x)(__y))
+#ifndef _STLP_NO_NEW_STYLE_CASTS
+# define __CONST_CAST(__x,__y) const_cast<__x>(__y)
+# define __STATIC_CAST(__x,__y) static_cast<__x>(__y)
+# define __REINTERPRET_CAST(__x,__y) reinterpret_cast<__x>(__y)
+#else
+# define __STATIC_CAST(__x,__y) __C_CAST(__x, __y)
+# define __CONST_CAST(__x,__y) __C_CAST(__x, __y)
+# define __REINTERPRET_CAST(__x,__y) __C_CAST(__x, __y)
+#endif
+
+#if defined (_STLP_NEED_TYPENAME) && ! defined (typename)
+# define typename
+#endif
+
+#if defined (_STLP_NEED_TYPENAME) || defined (_STLP_NO_TYPENAME_ON_RETURN_TYPE )
+# define _STLP_TYPENAME_ON_RETURN_TYPE
+#else
+# define _STLP_TYPENAME_ON_RETURN_TYPE typename
+#endif
+
+#ifdef _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER
+# define _STLP_HEADER_TYPENAME
+#else
+# define _STLP_HEADER_TYPENAME typename
+#endif
+
+#ifdef _STLP_NO_TYPENAME_BEFORE_NAMESPACE
+# define _STLP_TYPENAME
+#else
+# define _STLP_TYPENAME typename
+#endif
+
+#ifndef _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+# define _STLP_TEMPLATE template
+#else
+# define _STLP_TEMPLATE
+#endif
+
+#if defined (_STLP_USE_CONTAINERS_EXTENSION)
+# define _STLP_KEY_TYPE_FOR_CONT_EXT(type)
+# define _STLP_TEMPLATE_FOR_CONT_EXT template <class _KT>
+#else
+# define _STLP_KEY_TYPE_FOR_CONT_EXT(type) typedef type _KT;
+# define _STLP_TEMPLATE_FOR_CONT_EXT
+#endif
+
+#if defined (_STLP_NEED_EXPLICIT) && !defined (explicit)
+# define explicit
+#endif
+
+#if !defined (_STLP_NEED_MUTABLE)
+# define _STLP_MUTABLE(type, x) x
+#else
+# define _STLP_MUTABLE(type, x) __CONST_CAST(type*, this)->x
+# define mutable
+#endif
+
+#if defined (_STLP_NO_SIGNED_BUILTINS)
+/* old HP-UX doesn't understand "signed" keyword */
+# define signed
+#endif
+
+#if defined (_STLP_LOOP_INLINE_PROBLEMS)
+# define _STLP_INLINE_LOOP
+#else
+# define _STLP_INLINE_LOOP inline
+#endif
+
+#ifndef _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX
+# define _STLP_TEMPLATE_NULL template<>
+#else
+# define _STLP_TEMPLATE_NULL
+#endif
+
+#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+# define _STLP_OPERATOR_TEMPLATE
+#else
+# define _STLP_OPERATOR_TEMPLATE _STLP_TEMPLATE_NULL
+#endif
+
+#ifndef _STLP_CLASS_PARTIAL_SPECIALIZATION
+/* unless we have other compiler problem, try simulating partial spec here */
+# if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+# define _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
+# endif
+/* For your own iterators, please use inheritance from iterator<> instead of these obsolete queries. */
+# if (defined (_STLP_NESTED_TYPE_PARAM_BUG) || !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS))
+# if ! defined ( _STLP_USE_OLD_HP_ITERATOR_QUERIES )
+# define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+# endif
+# elif defined ( _STLP_NO_ANACHRONISMS )
+# undef _STLP_USE_OLD_HP_ITERATOR_QUERIES
+# endif
+#endif
+
+#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+# define _STLP_NULL_TMPL_ARGS <>
+# else
+# define _STLP_NULL_TMPL_ARGS
+#endif
+
+#if !defined (_STLP_ALLOCATOR_TYPE_DFL)
+# if defined (_STLP_DONT_SUP_DFLT_PARAM)
+# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
+# endif
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+# define _STLP_ALLOCATOR_TYPE_DFL
+# else
+# define _STLP_ALLOCATOR_TYPE_DFL = allocator_type()
+# endif
+#endif
+
+/* When the compiler do not correctly initialized the basic types value in default parameters we prefer
+ * to avoid them to be able to correct this bug.
+ */
+#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG)
+# define _STLP_DONT_SUP_DFLT_PARAM 1
+#endif
+
+#if defined (__SGI_STL_NO_ARROW_OPERATOR) && ! defined (_STLP_NO_ARROW_OPERATOR)
+# define _STLP_NO_ARROW_OPERATOR
+#endif
+
+#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !(defined (_STLP_NO_ARROW_OPERATOR)) && \
+ !defined (_STLP_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_MSVC50_COMPATIBILITY)
+/* this one is needed for proper reverse_iterator<> operator ->() handling */
+# define _STLP_MSVC50_COMPATIBILITY 1
+# endif
+#endif
+
+#if defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION )
+# if (defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 600) )
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef typename _STLP_STD :: reverse_iterator<const_iterator> const_reverse_iterator; \
+ typedef typename _STLP_STD :: reverse_iterator<iterator> reverse_iterator
+# elif (defined (__sgi) && ! defined (__GNUC__)) || defined (__SUNPRO_CC) || defined (__xlC__)
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator<const_iterator> const_reverse_iterator; \
+ typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator<iterator> reverse_iterator
+# else
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef _STLP_STD::reverse_iterator<const_iterator> const_reverse_iterator; \
+ typedef _STLP_STD::reverse_iterator<iterator> reverse_iterator
+# endif
+#else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+# if defined (_STLP_MSVC50_COMPATIBILITY)
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef _STLP_STD::__reverse_iterator<const_iterator, value_type, const_reference, \
+ const_pointer, difference_type> const_reverse_iterator; \
+ typedef _STLP_STD::__reverse_iterator<iterator, value_type, reference, pointer, difference_type> \
+ reverse_iterator
+# else
+# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \
+ typedef _STLP_STD::__reverse_iterator<const_iterator, value_type, const_reference, \
+ difference_type> const_reverse_iterator; \
+ typedef _STLP_STD::__reverse_iterator<iterator, value_type, \
+ reference, difference_type> \
+ reverse_iterator
+# endif
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+#define _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS \
+ _STLP_DECLARE_REVERSE_ITERATORS(reverse_bidirectional_iterator)
+#define _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS \
+ _STLP_DECLARE_REVERSE_ITERATORS(reverse_iterator)
+
+#define __IMPORT_CONTAINER_TYPEDEFS(_Super) \
+ typedef typename _Super::value_type value_type; \
+ typedef typename _Super::size_type size_type; \
+ typedef typename _Super::difference_type difference_type; \
+ typedef typename _Super::reference reference; \
+ typedef typename _Super::const_reference const_reference; \
+ typedef typename _Super::pointer pointer; \
+ typedef typename _Super::const_pointer const_pointer; \
+ typedef typename _Super::allocator_type allocator_type;
+
+
+#define __IMPORT_ITERATORS(_Super) \
+ typedef typename _Super::iterator iterator; \
+ typedef typename _Super::const_iterator const_iterator;
+
+#define __IMPORT_REVERSE_ITERATORS(_Super) \
+ typedef typename _Super::const_reverse_iterator const_reverse_iterator; \
+ typedef typename _Super::reverse_iterator reverse_iterator;
+
+#define __IMPORT_SUPER_COPY_ASSIGNMENT(__derived_name, _Self, _SUPER) \
+ __derived_name(const _Super& __x) : _SUPER(__x) {} \
+ _Self& operator=(const _Super& __x) { \
+ *(_Super*)this = __x; \
+ return *this; \
+ } \
+ __derived_name(const _Self& __x) : _SUPER(__x) {} \
+ _Self& operator=(const _Self& __x) { \
+ *(_Super*)this = __x; \
+ return *this; \
+ }
+
+#define __IMPORT_WITH_ITERATORS(_Super) \
+ __IMPORT_CONTAINER_TYPEDEFS(_Super) __IMPORT_ITERATORS(_Super)
+
+#define __IMPORT_WITH_REVERSE_ITERATORS(_Super) \
+ __IMPORT_WITH_ITERATORS(_Super) __IMPORT_REVERSE_ITERATORS(_Super)
+
+#if defined (_STLP_TRIVIAL_CONSTRUCTOR_BUG)
+# define __TRIVIAL_CONSTRUCTOR(__type) __type() {}
+#else
+# define __TRIVIAL_CONSTRUCTOR(__type)
+#endif
+
+#if defined (_STLP_TRIVIAL_DESTRUCTOR_BUG)
+# define __TRIVIAL_DESTRUCTOR(__type) ~__type() {}
+#else
+# define __TRIVIAL_DESTRUCTOR(__type)
+#endif
+
+#define __TRIVIAL_STUFF(__type) \
+ __TRIVIAL_CONSTRUCTOR(__type) __TRIVIAL_DESTRUCTOR(__type)
+
+#if defined (_STLP_STATIC_CONST_INIT_BUG)
+# define _STLP_STATIC_CONSTANT(__type, __assignment) enum { __assignment }
+#else
+# define _STLP_STATIC_CONSTANT(__type, __assignment) static const __type __assignment
+#endif
+
+#if defined (_STLP_HAS_NO_EXCEPTIONS)
+# define _STLP_NO_EXCEPTIONS
+#endif
+
+#if !defined (_STLP_DONT_USE_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_USE_EXCEPTIONS)
+# define _STLP_USE_EXCEPTIONS
+#endif
+
+#if defined (_STLP_USE_EXCEPTIONS)
+# define _STLP_TRY try
+# define _STLP_CATCH_ALL catch(...)
+# ifndef _STLP_THROW
+# define _STLP_THROW(x) throw x
+# endif
+# define _STLP_RETHROW throw
+
+# define _STLP_UNWIND(action) catch(...) { action; throw; }
+
+# ifdef _STLP_THROW_RETURN_BUG
+# define _STLP_RET_AFTER_THROW(data) return data;
+# else
+# define _STLP_RET_AFTER_THROW(data)
+# endif
+
+# if !defined (_STLP_THROWS)
+# define _STLP_THROWS(x) throw(x)
+# endif
+# if !defined (_STLP_NOTHROW)
+# define _STLP_NOTHROW throw()
+# endif
+#else
+# define _STLP_TRY
+# define _STLP_CATCH_ALL if (false)
+# ifndef _STLP_THROW
+# define _STLP_THROW(x)
+# endif
+# define _STLP_RETHROW {}
+# define _STLP_UNWIND(action)
+# define _STLP_THROWS(x)
+# define _STLP_NOTHROW
+# define _STLP_RET_AFTER_THROW(data)
+#endif
+
+/*
+ * Here we check _STLP_NO_EXCEPTIONS which means that the compiler has no
+ * exception support but not the _STLP_USE_EXCEPTIONS which simply means
+ * that the user do not want to use them.
+ */
+#if !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTION_SPEC)
+# define _STLP_THROWS_INHERENTLY(x) throw x
+# define _STLP_NOTHROW_INHERENTLY throw()
+#else
+# define _STLP_THROWS_INHERENTLY(x)
+# define _STLP_NOTHROW_INHERENTLY
+#endif
+
+/* STLport function not returning are functions that throw so we translate
+ * the noreturn functions in throwing functions taking also into account
+ * exception support activation.
+ */
+#if defined (_STLP_NORETURN_FUNCTION) && !defined (_STLP_NO_EXCEPTIONS) && \
+ !defined (_STLP_FUNCTION_THROWS)
+# define _STLP_FUNCTION_THROWS _STLP_NORETURN_FUNCTION
+#else
+# define _STLP_FUNCTION_THROWS
+#endif
+
+#if defined(_STLP_NO_BOOL)
+# if (defined (__IBMCPP__) && (__IBMCPP__ < 400)) && ! defined (_AIX)
+# include <isynonym.hpp>
+# if defined (__OS400__)
+typedef int bool;
+# elif !( defined (__xlC__) || defined (_AIX))
+typedef Boolean bool;
+# endif
+# else
+# if defined(_STLP_YVALS_H)
+# include <yvals.h>
+# else
+# if defined (_STLP_DONT_USE_BOOL_TYPEDEF)
+# define bool int
+# else
+typedef int bool;
+# endif
+# define true 1
+# define false 0
+# endif
+# endif /* __IBMCPP__ */
+#else
+# define _STLP_BOOL_KEYWORD 1
+#endif /* _STLP_NO_BOOL */
+
+/* uninitialized value filler */
+#ifndef _STLP_SHRED_BYTE
+/* This value is designed to cause problems if an error occurs */
+# define _STLP_SHRED_BYTE 0xA3
+#endif /* _STLP_SHRED_BYTE */
+
+/* shared library tune-up */
+#ifndef _STLP_IMPORT_DECLSPEC
+# define _STLP_IMPORT_DECLSPEC
+#endif
+
+/* a keyword used to instantiate export template */
+#ifndef _STLP_EXPORT_TEMPLATE_KEYWORD
+# define _STLP_EXPORT_TEMPLATE_KEYWORD
+#endif
+#ifndef _STLP_IMPORT_TEMPLATE_KEYWORD
+# define _STLP_IMPORT_TEMPLATE_KEYWORD
+#endif
+
+#if !defined (_STLP_NO_CONST_IN_PAIR)
+# define _STLP_CONST const
+#else
+# define _STLP_CONST
+#endif
+
+#ifdef _STLP_USE_NO_IOSTREAMS
+/*
+ * If we do not use iostreams we do not use the export/import
+ * techniques to avoid build of the STLport library.
+ */
+# undef _STLP_USE_DECLSPEC
+/* We also undef USE_DYNAMIC_LIB macro as this macro add some code
+ * to use the dynamic (shared) STLport library for some platform/compiler
+ * configuration leading to problem when not linking to the STLport lib.
+ */
+# undef _STLP_USE_DYNAMIC_LIB
+#endif
+
+#if defined (_STLP_DLLEXPORT_NEEDS_PREDECLARATION) && defined (_STLP_USE_DECLSPEC)
+# if ! defined (_STLP_USE_TEMPLATE_EXPORT)
+/* this setting turns on "extern template" extension use */
+# define _STLP_USE_TEMPLATE_EXPORT
+# endif
+# if defined (_STLP_DESIGNATED_DLL) && ! defined (_STLP_NO_FORCE_INSTANTIATE)
+# define _STLP_NO_FORCE_INSTANTIATE
+# endif
+#endif
+
+#if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */
+# define _STLP_EXPORT _STLP_EXPORT_TEMPLATE_KEYWORD
+#else
+# define _STLP_EXPORT _STLP_IMPORT_TEMPLATE_KEYWORD
+#endif
+
+#ifndef _STLP_EXPORT_TEMPLATE
+# define _STLP_EXPORT_TEMPLATE _STLP_EXPORT template
+#endif
+
+#if defined (_STLP_USE_DECLSPEC) /* using export/import technique */
+
+# ifndef _STLP_EXPORT_DECLSPEC
+# define _STLP_EXPORT_DECLSPEC
+# endif
+# ifndef _STLP_IMPORT_DECLSPEC
+# define _STLP_IMPORT_DECLSPEC
+# endif
+# ifndef _STLP_CLASS_EXPORT_DECLSPEC
+# define _STLP_CLASS_EXPORT_DECLSPEC
+# endif
+# ifndef _STLP_CLASS_IMPORT_DECLSPEC
+# define _STLP_CLASS_IMPORT_DECLSPEC
+# endif
+# if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */
+# define _STLP_DECLSPEC _STLP_EXPORT_DECLSPEC
+# define _STLP_CLASS_DECLSPEC _STLP_CLASS_EXPORT_DECLSPEC
+# else
+# define _STLP_DECLSPEC _STLP_IMPORT_DECLSPEC /* Other modules, importing STLport exports */
+# define _STLP_CLASS_DECLSPEC _STLP_CLASS_IMPORT_DECLSPEC
+# endif
+
+#else /* Not using DLL export/import specifications */
+
+# define _STLP_DECLSPEC
+# define _STLP_CLASS_DECLSPEC
+
+#endif
+
+#define _STLP_EXPORT_TEMPLATE_CLASS _STLP_EXPORT template class _STLP_CLASS_DECLSPEC
+
+#if defined (_STLP_NEED_ADDITIONAL_STATIC_DECLSPEC)
+# define _STLP_STATIC_DECLSPEC _STLP_DECLSPEC
+#else
+# define _STLP_STATIC_DECLSPEC
+#endif
+
+#if !defined (_STLP_CALL)
+# define _STLP_CALL
+#endif
+
+#ifndef _STLP_USE_NO_IOSTREAMS
+
+# if defined (__DECCXX) && ! defined (__USE_STD_IOSTREAM)
+# define __USE_STD_IOSTREAM
+# endif
+
+/* We only need to expose details of streams implementation
+ if we use non-standard i/o or are building STLport*/
+# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE) || !defined(_STLP_NO_CUSTOM_IO)
+# define _STLP_EXPOSE_STREAM_IMPLEMENTATION 1
+# endif
+
+/* We only need to expose details of global implementation if we are building STLport
+ or have not instantiated everything in the lib */
+# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE)
+# undef _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION 1
+# endif
+
+#else /* _STLP_USE_NO_IOSTREAMS */
+/* when we are not using SGI iostreams, we must expose globals, but not streams implementation */
+# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
+#endif /* _STLP_USE_NO_IOSTREAMS */
+
+#ifdef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
+# define _STLP_PSPEC2(t1,t2) < t1,t2 >
+# define _STLP_PSPEC3(t1,t2,t3) < t1,t2,t3 >
+#else
+# define _STLP_PSPEC2(t1,t2) /* nothing */
+# define _STLP_PSPEC3(t1,t2,t3) /* nothing */
+#endif
+
+/* Activation of the partial template workaround:
+ */
+#if !defined(_STLP_DONT_USE_PARTIAL_SPEC_WRKD) &&\
+ (!defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) || !defined(_STLP_FUNCTION_TMPL_PARTIAL_ORDER))
+# define _STLP_USE_PARTIAL_SPEC_WORKAROUND
+#endif
+
+#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
+# define _STLP_RELOPS_OPERATORS(_TMPL, _TP) \
+_TMPL inline bool _STLP_CALL operator!=(const _TP& __x, const _TP& __y) {return !(__x == __y);}\
+_TMPL inline bool _STLP_CALL operator>(const _TP& __x, const _TP& __y) {return __y < __x;}\
+_TMPL inline bool _STLP_CALL operator<=(const _TP& __x, const _TP& __y) { return !(__y < __x);}\
+_TMPL inline bool _STLP_CALL operator>=(const _TP& __x, const _TP& __y) { return !(__x < __y);}
+#else
+# define _STLP_RELOPS_OPERATORS(_TMPL, _TP)
+#endif
+
+#if defined ( _STLP_USE_ABBREVS )
+# include <stl/_abbrevs.h>
+#endif
+
+/* Some really useful macro */
+#define _STLP_ARRAY_SIZE(A) sizeof(A) / sizeof(A[0])
+#define _STLP_ARRAY_AND_SIZE(A) A, sizeof(A) / sizeof(A[0])
+
+#if !defined (_STLP_MARK_PARAMETER_AS_UNUSED)
+# define _STLP_MARK_PARAMETER_AS_UNUSED(X) (void*)X;
+#endif
+
+#if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
+# if defined (_STLP_USE_NO_IOSTREAMS)
+# undef _STLP_CHECK_RUNTIME_COMPATIBILITY
+# else
+/* The extern "C" simply makes the symbol simpler. */
+#if defined (__cplusplus)
+extern "C"
+#endif
+void _STLP_DECLSPEC _STLP_CALL _STLP_CHECK_RUNTIME_COMPATIBILITY();
+# endif
+#endif
+
+/* some cleanup */
+#undef _STLP_DONT_USE_BOOL_TYPEDEF
+#undef _STLP_YVALS_H
+#undef _STLP_LOOP_INLINE_PROBLEMS
+#undef _STLP_NEED_EXPLICIT
+#undef _STLP_NEED_TYPENAME
+#undef _STLP_NO_NEW_STYLE_CASTS
+#undef __AUTO_CONFIGURED
+
+#endif /* _STLP_FEATURES_H */
diff --git a/stlport/stl/config/host.h b/stlport/stl/config/host.h
new file mode 100644
index 0000000..b4b6089
--- /dev/null
+++ b/stlport/stl/config/host.h
@@ -0,0 +1,342 @@
+/*
+ * This file defines site configuration.
+ */
+
+/*
+ * _STLP_NO_THREADS: if defined, STLport don't use any
+ * multithreading support. Synonym is _NOTHREADS
+ */
+/*
+#define _NOTHREADS
+#define _STLP_NO_THREADS
+*/
+
+/* _PTHREADS: if defined, use POSIX threads for multithreading support. */
+/*
+#define _PTHREADS
+*/
+
+/* compatibility section
+ */
+
+#if (defined (_STLP_NOTHREADS) || defined (_STLP_NO_THREADS) || defined (NOTHREADS))
+# if !defined (_NOTHREADS)
+# define _NOTHREADS
+# endif
+# if !defined (_STLP_NO_THREADS)
+# define _STLP_NO_THREADS
+# endif
+#endif
+
+#if !defined(_STLP_USE_DYNAMIC_LIB) && !defined(_STLP_USE_STATIC_LIB)
+/*
+ * Turn _STLP_USE_DYNAMIC_LIB to enforce use of .dll version of STLport library.
+ * NOTE: please do that only if you know what you are doing!
+ * Changing default will require you to change makefiles in "build" accordingly
+ * and to rebuild STLPort library!
+ * On UNIX, this has no effect, see build/lib/README for make tags.
+ * See STLport configuration file (build/lib/configure.bat) for help in building
+ * the require library versions.
+ */
+/*
+#define _STLP_USE_DYNAMIC_LIB
+*/
+
+/*
+ * Turn _STLP_USE_STATIC_LIB to enforce use of static version of STLport library.
+ * NOTE: please do that only if you know what you are doing!
+ * Changing default will require you to change makefile in "build" accordingly
+ * and to rebuild STLPort library!
+ * On UNIX, this has no effect, see build/lib/README for make tags.
+ * See STLport configuration file (build/lib/configure.bat) for help in building
+ * the require library versions.
+ */
+/*
+#define _STLP_USE_STATIC_LIB
+*/
+#endif
+
+/*
+ * Edit relative path below (or put full path) to get native
+ * compiler vendor's headers included. Default is "../include"
+ * for _STLP_NATIVE_INCLUDE_PATH, default for other macros is
+ * _STLP_NATIVE_INCLUDE_PATH.
+ * Hint: never install STLport in the directory that ends with "include"
+ */
+/*
+#undef _STLP_NATIVE_INCLUDE_PATH
+#define _STLP_NATIVE_INCLUDE_PATH ../include
+*/
+/* same for C library headers like <cstring> */
+/*
+#undef _STLP_NATIVE_CPP_C_INCLUDE_PATH
+#define _STLP_NATIVE_CPP_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+*/
+/* same for C headers like <string.h> */
+/*
+#undef _STLP_NATIVE_C_INCLUDE_PATH
+#define _STLP_NATIVE_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+*/
+/* Some compilers locate basic C++ runtime support headers (<new>, <typeinfo>, <exception>) in separate directory */
+/*
+#undef _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH
+#define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH
+*/
+
+/*
+ * If namespases available, STLport use own namespace (and masquerade
+ * it as std). Disable own namespace may cause undefined behaviour.
+ */
+/*
+#define _STLP_NO_OWN_NAMESPACE 1
+*/
+
+/*
+ * Uncomment _STLP_LEAKS_PEDANTIC to force deallocation of ALL allocated
+ * memory chunks. Normally not required. But if you worry about quazi-leaks
+ * (may be reported by some leaks detection tools), use
+ * _STLP_LEAKS_PEDANTIC. It should be used with _STLP_USE_NEWALLOC or
+ * _STLP_USE_MALLOC (see below), the default node_alloc allocator also clean
+ * its internal memory pool but only if STLport is used as a dynamic library
+ * under Win32 (using MSVC like compilers).
+ */
+/*
+#define _STLP_LEAKS_PEDANTIC 1
+*/
+
+/*
+ * Uncomment _STLP_USE_NEWALLOC to force allocator<T> to use plain "new"
+ * instead of STLport optimized node allocator engine.
+ */
+/*
+#define _STLP_USE_NEWALLOC 1
+*/
+
+/*
+ * Uncomment _STLP_USE_MALLOC to force allocator<T> to use plain "malloc"
+ * instead of STLport optimized node allocator engine.
+ *
+ * This is default allocator for glibc 2.3.x and later, if not mentioned other
+ */
+/*
+#define _STLP_USE_MALLOC 1
+*/
+
+/*
+ * Uncomment _STLP_USE_PERTHREAD_ALLOC to force allocator<T> to use
+ * a specific implementation targetting the massively multi-threaded
+ * environment. The implementation is based on the POSIX pthread
+ * interface.
+ */
+/*
+#define _STLP_USE_PERTHREAD_ALLOC 1
+*/
+
+/*
+ * Uncomment _STLP_USE_NODE_ALLOC if you want to force allocator<T> to use
+ * "node_alloc" allocator (this is default allocator for STLport, if not
+ * used other above, except glibc 2.3.x and later, where default is
+ * "malloc", due to better results)
+ */
+/*
+#define _STLP_USE_NODE_ALLOC 1
+*/
+
+/*
+ * Set _STLP_DEBUG_ALLOC to use allocators that perform memory debugging,
+ * such as padding/checking for memory consistency
+ */
+/*
+#define _STLP_DEBUG_ALLOC 1
+*/
+
+/*
+ * For compiler not supporting partial template specialization or ordering of
+ * template functions STLport implement a workaround based on inheritance
+ * detection. This inheritance can introduce trouble in client code when
+ * a user class derived a STL container (which is not advised as STL containers
+ * do not have virtual destructors). To disable this workaround turn this macro on:
+ */
+/*
+#define _STLP_DONT_USE_PARTIAL_SPEC_WRKD 1
+*/
+
+/*
+ * Uncomment this to force all debug diagnostic to be directed through a
+ * user-defined global function:
+ * void __stl_debug_message(const char * format_str, ...)
+ * instead of predefined STLport routine.
+ * This allows you to take control of debug message output.
+ * Default routine calls fprintf(stderr,...)
+ * Note : If you set this macro, you must supply __stl_debug_message
+ * function definition somewhere.
+ */
+/*
+#define _STLP_DEBUG_MESSAGE 1
+*/
+
+/*
+ * Uncomment this to force all failed assertions to be executed through
+ * user-defined global function:
+ * void __stl_debug_terminate(void). This allows
+ * you to take control of assertion behaviour for debugging purposes.
+ * Default routine calls _STLP_ABORT().
+ * Note : If you set this macro, you must supply __stl_debug_terminate
+ * function definition somewhere.
+ */
+/*
+#define _STLP_DEBUG_TERMINATE 1
+*/
+
+/*
+ * Uncomment that to disable exception handling code
+ */
+/*
+#define _STLP_DONT_USE_EXCEPTIONS 1
+*/
+
+/*
+ * _STLP_NO_NAMESPACES: if defined, don't put the library in namespace
+ * stlport:: or std::, even if the compiler supports namespaces
+ */
+/*
+#define _STLP_NO_NAMESPACES 1
+*/
+
+/*==========================================================
+ * Compatibility section
+ *==========================================================*/
+
+/*
+ * Use abbreviated class names for linker benefit (don't affect interface).
+ * This option is obsolete, but should work in this release.
+ *
+ */
+/*
+#define _STLP_USE_ABBREVS
+*/
+
+/*
+ * This definition precludes STLport reverse_iterator to be compatible with
+ * other parts of MSVC library. (With partial specialization, it just
+ * has no effect).
+ * Use it _ONLY_ if you use SGI-style reverse_iterator<> template explicitly
+ */
+/*
+#define _STLP_NO_MSVC50_COMPATIBILITY 1
+*/
+
+/*
+ * Use obsolete overloaded template functions iterator_category(), value_type(), distance_type()
+ * for querying iterator properties. Please note those names are non-standard and are not guaranteed
+ * to be used by every implementation. However, this setting is on by default when partial specialization
+ * is not implemented in the compiler and cannot be simulated (only if _STLP_NO_ANACHRONISMS is not set).
+ * Use of those interfaces for user-defined iterators is strongly discouraged:
+ * please use public inheritance from iterator<> template to achieve desired effect.
+ * Second form is to disable old-style queries in any case.
+ */
+/*
+#define _STLP_USE_OLD_HP_ITERATOR_QUERIES
+#define _STLP_NO_OLD_HP_ITERATOR_QUERIES
+*/
+
+
+/*
+ * On systems with support of large files (_LARGEFILE_SOURCE,
+ * _LARGEFILE64_SOURCE defined) we will use 64-bit file offset, even if
+ * __USE_FILE_OFFSET64 or _FILE_OFFSET_BITS not defined or _FILE_OFFSET_BITS
+ * less than 64. In the last case sizeof(std::streamoff) may not be equal to
+ * sizeof(off_t); if you want to force equal size of off_t and streamoff,
+ * uncomment macro below. But pay attention, this has influence on libstlport
+ * and in future usage it may cause conflict with defined _FILE_OFFSET_BITS macro.
+ */
+
+/*
+#define _STLP_USE_DEFAULT_FILE_OFFSET
+*/
+
+/*
+ * _STLP_USE_STDIO_IO, _STLP_USE_UNIX_IO: force selection of stdio calls
+ * (fopen/flose/fread/fwrite) under fstream buffers or unistd calls
+ * (open/close/read/write + mmap). On systems that have both (i.e. most Unixes)
+ * _STLP_USE_UNIX_IO is used.
+ *
+ * There is a third variant for Windows: _STLP_USE_WIN32_IO, that based
+ * on Windows calls (CreateFile/CloseHandle/ReadFile/WriteFile + CreateFileMapping,
+ * MapViewOfFile)
+ *
+ * Uncomment only one define here!
+ */
+/*
+#define _STLP_USE_UNIX_IO
+*/
+/*
+#define _STLP_USE_STDIO_IO
+*/
+/*
+#define _STLP_USE_WIN32_IO
+ */
+
+/*==========================================================================*/
+
+/* This section contains swithes which should be off by default,
+ * but so few compilers would have it undefined, so that we set them here,
+ * with the option to be turned off later in compiler-specific file
+ */
+
+#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
+#define _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT
+
+/*==========================================================================*/
+
+#if defined(__sun) && defined(__GNUC__)
+/* __SunOS_5_x is not defined in headers, and there is no way to derive it from headers only;
+ * nevertheless this macro defined automagically by SunPro compilers family;
+ *
+ * gcc know nothing about it, but defining it with -D on compiler command line
+ * is a bad idea from one side, and this info still useful when we want to use
+ * (or don't use) some Solaris version-specific features from other side.
+ * Of course, the best way is to define it in spec file, but this is beyond our scope.
+ *
+ * Uncomment ONE of the following, depends on what Solaris version you use.
+ */
+
+/*
+#define __SunOS_5_5_1
+ */
+/*
+#define __SunOS_5_6
+ */
+/*
+#define __SunOS_5_7
+ */
+/*
+#define __SunOS_5_8
+ */
+/*
+#define __SunOS_5_9
+ */
+/*
+#define __SunOS_5_10
+ */
+#endif
+
+#if defined(__sun)
+/* With following patches Solaris 8 and 9 will have *l and *f (long double and float)
+ * variants of math functions:
+ * SunOS 5.8 patch 111721-04 (May/08/2003)
+ * <http://sunsolve.sun.com/search/document.do?assetkey=1-21-111721-04-1>
+ * SunOS 5.9 patch 111722-04 (May/08/2003)
+ * <http://sunsolve.sun.com/search/document.do?assetkey=1-21-111722-04-1>
+ * Solaris 10 has this functions from box.
+ */
+/*
+#define _STLP_SOLARIS_MATH_PATCH
+ */
+#endif
+
+/*
+ Local Variables:
+ mode:C++
+ End:
+*/
diff --git a/stlport/stl/config/stl_confix.h b/stlport/stl/config/stl_confix.h
new file mode 100644
index 0000000..ddcdf1d
--- /dev/null
+++ b/stlport/stl/config/stl_confix.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * STLport configuration file
+ * It is internal STLport header - DO NOT include it directly
+ * Purpose of this file : to define STLport settings that depend on
+ * compiler flags or can be otherwise missed
+ *
+ */
+
+#ifndef _STLP_CONFIX_H
+#define _STLP_CONFIX_H
+
+/* If, by any chance, C compiler gets there, try to help it to pass smoothly */
+#if ! defined (__cplusplus) && ! defined (_STLP_HAS_NO_NAMESPACES)
+# define _STLP_HAS_NO_NAMESPACES
+#endif
+
+#if defined (__MINGW32__)
+# define _STLP_NO_DRAND48
+#endif
+
+/* Modena C++ library */
+#if defined (__MWERKS__) && __MWERKS__ <= 0x2303 || (defined (__KCC) && __KCC_VERSION < 3400)
+# include <mcompile.h>
+# define _STLP_USE_MSIPL 1
+# if defined (__KCC) || (defined(__MSL_CPP__) && \
+ ( (__MSL_CPP__ >= 0x5000 && defined( _MSL_NO_MESSAGE_FACET )) || \
+ (__MSL_CPP__ < 0x5000 && defined( MSIPL_NL_TYPES ))))
+# define _STLP_NO_NATIVE_MESSAGE_FACET 1
+# endif
+#endif
+
+/* common switches for EDG front-end */
+/* __EDG_SWITCHES do not seem to be an official EDG macro.
+ * We keep it for historical reason. */
+#if defined (__EDG_SWITCHES)
+# if !(defined(_TYPENAME) || defined (_TYPENAME_IS_KEYWORD))
+# undef _STLP_NEED_TYPENAME
+# define _STLP_NEED_TYPENAME 1
+# endif
+# ifndef _WCHAR_T_IS_KEYWORD
+# undef _STLP_NO_WCHAR_T
+# define _STLP_NO_WCHAR_T 1
+# endif
+# ifndef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES
+# undef _STLP_NO_CLASS_PARTIAL_SPECIALIZATION
+# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+# endif
+# ifndef _MEMBER_TEMPLATES
+# undef _STLP_NO_MEMBER_TEMPLATES
+# define _STLP_NO_MEMBER_TEMPLATES 1
+# undef _STLP_NO_MEMBER_TEMPLATE_CLASSES
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# endif
+# ifndef _MEMBER_TEMPLATE_KEYWORD
+# undef _STLP_NO_MEMBER_TEMPLATE_KEYWORD
+# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+# endif
+# if !defined (__EXCEPTIONS) && ! defined (_EXCEPTIONS)
+# undef _STLP_HAS_NO_EXCEPTIONS
+# define _STLP_HAS_NO_EXCEPTIONS
+# endif
+# undef __EDG_SWITCHES
+#endif /* EDG */
+
+/* __EDG_VERSION__ is an official EDG macro, compilers based
+ * on EDG have to define it. */
+#if defined (__EDG_VERSION__)
+# if (__EDG_VERSION__ >= 244) && !defined (_STLP_HAS_INCLUDE_NEXT)
+# define _STLP_HAS_INCLUDE_NEXT
+# endif
+# if (__EDG_VERSION__ <= 240) && !defined (_STLP_DONT_RETURN_VOID)
+# define _STLP_DONT_RETURN_VOID
+# endif
+# if !defined (__EXCEPTIONS) && !defined (_STLP_HAS_NO_EXCEPTIONS)
+# define _STLP_HAS_NO_EXCEPTIONS
+# endif
+# if !defined (__NO_LONG_LONG) && !defined (_STLP_LONG_LONG)
+# define _STLP_LONG_LONG long long
+# endif
+#endif
+
+#endif
diff --git a/stlport/stl/config/stl_mycomp.h b/stlport/stl/config/stl_mycomp.h
new file mode 100644
index 0000000..f92902f
--- /dev/null
+++ b/stlport/stl/config/stl_mycomp.h
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * Purpose of this file :
+ *
+ * A list of COMPILER-SPECIFIC portion of STLport settings.
+ * This file is provided to help in manual configuration
+ * of STLport. This file is being included by stlcomp.h
+ * when STLport is unable to identify your compiler.
+ * Please remove the error diagnostic below before adjusting
+ * macros.
+ *
+ */
+#ifndef _STLP_MYCOMP_H
+#define _STLP_MYCOMP_H
+
+#error "Your compiler version is not recognized by STLport. Please edit <stlport/stl/config/stl_mycomp.h>"
+
+//==========================================================
+
+// the values choosen here as defaults try to give
+// maximum functionality on the most conservative settings
+
+// Mostly correct guess, change it for Alpha (and other environments
+// that has 64-bit "long")
+// # define _STLP_UINT32_T unsigned long
+
+// Disables wchar_t functionality
+// # define _STLP_NO_WCHAR_T 1
+
+// Define if wchar_t is not an intrinsic type, and is actually a typedef to unsigned short.
+// # define _STLP_WCHAR_T_IS_USHORT 1
+
+// Uncomment if long long is available
+// # define _STLP_LONG_LONG long long
+
+// Uncomment if long double is not available
+// # define _STLP_NO_LONG_DOUBLE 1
+
+// Uncomment this if your compiler does not support "typename" keyword
+// # define _STLP_NEED_TYPENAME 1
+
+// Uncomment this if your compiler does not support "mutable" keyword
+// # define _STLP_NEED_MUTABLE 1
+
+// Uncomment this if your compiler does not support "explicit" keyword
+// # define _STLP_NEED_EXPLICIT 1
+
+// Uncomment if new-style-casts like const_cast<> are not available
+// # define _STLP_NO_NEW_STYLE_CASTS 1
+
+// Uncomment this if your compiler does not have "bool" type
+// # define _STLP_NO_BOOL 1
+
+// Uncomment this if your compiler does not have "bool" type, but has "bool" keyword reserved
+// # define _STLP_DONT_USE_BOOL_TYPEDEF 1
+
+// Uncomment this if your compiler does not have "bool" type, but defines "bool" in <yvals.h>
+// # define _STLP_YVALS_H 1
+
+// Uncomment this if your compiler has limited or no default template arguments for classes
+// # define _STLP_LIMITED_DEFAULT_TEMPLATES 1
+
+// Uncomment this if your compiler support only complete (not dependent on other parameters)
+// types as default parameters for class templates
+// # define _STLP_DEFAULT_TYPE_PARAM 1
+
+// Uncomment this if your compiler do not support default parameters in template class methods
+// # define _STLP_DONT_SUP_DFLT_PARAM 1
+
+// Uncomment this if your compiler has problem with not-type
+// default template parameters
+// # define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
+
+// Define if compiler has
+// trouble with functions getting non-type-parameterized classes as parameters
+// # define _STLP_NON_TYPE_TMPL_PARAM_BUG 1
+
+// Uncomment this if your compiler does not support namespaces
+// # define _STLP_HAS_NO_NAMESPACES 1
+
+// Uncomment if "using" keyword does not work with template types
+// # define _STLP_BROKEN_USING_DIRECTIVE 1
+
+// Uncomment this if your compiler does not support exceptions
+// # define _STLP_HAS_NO_EXCEPTIONS 1
+
+// Uncomment this when you are able to detect that the user do not
+// want to use the exceptions feature.
+// # define _STLP_DONT_USE_EXCEPTIONS 1
+
+// Uncomment this if your compiler does not support exception specifications
+// # define _STLP_NO_EXCEPTION_SPEC
+
+// Define this if your compiler requires return statement after throw()
+// # define _STLP_THROW_RETURN_BUG 1
+
+// Define this if your compiler do not support return of void
+// # define _STLP_DONT_RETURN_VOID 1
+
+// Header <new> that comes with the compiler
+// does not define bad_alloc exception
+// # define _STLP_NO_BAD_ALLOC 1
+
+// Define this if your compiler do not throw bad_alloc from the new operator
+// # define _STLP_NEW_DONT_THROW_BAD_ALLOC 1
+
+// Define this if your compiler has no rtti support or if it has been disabled
+// # define _STLP_NO_RTTI 1
+
+// Define this if there is no native type_info definition
+// # define _STLP_NO_TYPEINFO 1
+
+// Uncomment if member template methods are not available
+// # define _STLP_NO_MEMBER_TEMPLATES 1
+
+// Uncomment if member template classes are not available
+// # define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+
+// Uncomment if your compiler do not support the std::allocator rebind technique
+// This is a special case of bad member template classes support, it is automatically
+// defined if _STLP_NO_MEMBER_TEMPLATE_CLASSES is defined.
+// # define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1
+
+// Uncomment if no "template" keyword should be used with member template classes
+// # define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1
+
+// Compiler does not accept friend declaration qualified with namespace name.
+// # define _STLP_NO_QUALIFIED_FRIENDS 1
+
+// Uncomment if partial specialization is not available
+// # define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1
+
+// Define if class being partially specialized require full name (template parameters)
+// of itself for method declarations
+// # define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS
+
+// Compiler has problem with qualified specializations (cont int, volatile int...)
+// # define _STLP_QUALIFIED_SPECIALIZATION_BUG
+
+// Compiler has problems specializing members of partially
+// specialized class
+// # define _STLP_MEMBER_SPECIALIZATION_BUG
+
+// Uncomment if partial order of template functions is not available
+// # define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1
+
+// Uncomment if specialization of methods is not allowed
+// # define _STLP_NO_METHOD_SPECIALIZATION 1
+
+// Uncomment if full specialization does not use partial spec. syntax : template <> struct ....
+// # define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1
+
+// Uncomment if compiler does not support explicit template arguments for functions
+// # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
+
+// Uncomment this if your compiler can't inline while(), for()
+// # define _STLP_LOOP_INLINE_PROBLEMS 1
+
+// Define if the compiler fails to match a template function argument of base
+// # define _STLP_BASE_MATCH_BUG 1
+
+// Define if the compiler fails to match a template function argument of base
+// (non-template)
+//# define _STLP_NONTEMPL_BASE_MATCH_BUG 1
+
+// Define if the compiler rejects outline method definition
+// explicitly taking nested types/typedefs
+// # define _STLP_NESTED_TYPE_PARAM_BUG 1
+
+// Compiler requires typename keyword on outline method definition
+// explicitly taking nested types/typedefs
+// #define _STLP_TYPENAME_ON_RETURN_TYPE
+
+// Define if the baseclass typedefs not visible from outside
+// # define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1
+
+// if your compiler have serious problems with typedefs, try this one
+// # define _STLP_BASE_TYPEDEF_BUG 1
+
+// Uncomment if getting errors compiling mem_fun* adaptors
+// # define _STLP_MEMBER_POINTER_PARAM_BUG 1
+
+// Uncomment if the compiler can't handle a constant-initializer in the
+// declaration of a static const data member of integer type.
+// (See section 9.4.2, paragraph 4, of the C++ standard.)
+// # define _STLP_STATIC_CONST_INIT_BUG
+
+// Uncomment to indicate that the compiler do not like static constant
+// definition.
+// Meaningfull only if _STLP_STATIC_CONST_INIT_BUG is not defined.
+// # define _STLP_NO_STATIC_CONST_DEFINITION
+
+// Define if default constructor for builtin integer type fails to initialize it to 0
+// In expression like new(&char) char():
+//# define _STLP_DEF_CONST_PLCT_NEW_BUG 1
+// In default function parameter like _M_method(_Tp __x = _Tp())
+//# define _STLP_DEF_CONST_DEF_PARAM_BUG 1
+
+// Defined if constructor
+// required to explicitly call member's default constructors for const objects
+// # define _STLP_CONST_CONSTRUCTOR_BUG 1
+
+// Defined if the compiler has trouble calling POD-types constructors/destructors
+// # define _STLP_TRIVIAL_CONSTRUCTOR_BUG 1
+// # define _STLP_TRIVIAL_DESTRUCTOR_BUG 1
+
+// Define if having problems specializing maps/sets with
+// key type being const
+// # define _STLP_MULTI_CONST_TEMPLATE_ARG_BUG
+
+// Uncomment this to disable -> operators on all iterators
+// # define _STLP_NO_ARROW_OPERATOR 1
+
+// Uncomment this to disble at() member functions for containers
+// # define _STLP_NO_AT_MEMBER_FUNCTION 1
+
+// Define this if compiler lacks <exception> header
+// # define _STLP_NO_EXCEPTION_HEADER 1
+
+// Uncomment this if your C library has lrand48() function
+// # define _STLP_RAND48 1
+
+// Uncomment if native new-style C library headers lile <cstddef>, etc are not available.
+// # define _STLP_HAS_NO_NEW_C_HEADERS 1
+
+// uncomment if new-style headers <new> is available
+// # define _STLP_HAS_NEW_NEW_HEADER 1
+
+// uncomment this if <iostream> and other STD headers put their stuff in ::namespace,
+// not std::
+// # define _STLP_VENDOR_GLOBAL_STD
+
+// uncomment this if <cstdio> and the like put stuff in ::namespace,
+// not std::
+// # define _STLP_VENDOR_GLOBAL_CSTD
+
+// uncomment this if your compiler consider as ambiguous a function imported within
+// the stlport namespace and called without scope (:: or std::)
+// # define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1
+
+// uncomment this if your compiler define all the C math functions C++ additional
+// overloads in ::namespace and not only in std::.
+// # define _STLP_HAS_GLOBAL_C_MATH_FUNCTIONS 1
+
+// Edit relative path below (or put full path) to get native
+// compiler headers included. Default is "../include".
+// C headers may reside in different directory, so separate macro is provided.
+// Hint : never install STLport in the directory that ends with "include"
+// # define _STLP_NATIVE_INCLUDE_PATH ../include
+// # define _STLP_NATIVE_C_INCLUDE_PATH ../include
+// # define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include
+
+// This macro constructs header path from directory and name.
+// You may change it if your compiler does not understand "/".
+// # define _STLP_MAKE_HEADER(path, header) <path/header>
+
+// This macro constructs native include header path from include path and name.
+// You may have do define it if experimenting problems with preprocessor
+// # define _STLP_NATIVE_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_INCLUDE_PATH,header)
+
+// Same for C headers
+// #define _STLP_NATIVE_C_HEADER(header)
+
+//==========================================================
+#endif
diff --git a/stlport/stl/config/user_config.h b/stlport/stl/config/user_config.h
new file mode 100644
index 0000000..4efd727
--- /dev/null
+++ b/stlport/stl/config/user_config.h
@@ -0,0 +1,326 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/*
+ * Purpose of this file :
+ *
+ * To hold user-definable portion of STLport settings which may be overridden
+ * on per-project basis.
+ * Please note that if you use STLport iostreams (compiled library) then you have
+ * to use consistent settings when you compile STLport library and your project.
+ * Those settings are defined in host.h and have to be the same for a given
+ * STLport installation.
+ */
+
+
+/*==========================================================
+ * User-settable macros that control compilation:
+ * Features selection
+ *==========================================================*/
+
+/*
+ * Use this switch for embedded systems where no iostreams are available
+ * at all. STLport own iostreams will also get disabled automatically then.
+ * You can either use STLport iostreams, or no iostreams.
+ * If you want iostreams, you have to compile library in ../build/lib
+ * and supply resulting library at link time.
+ */
+/*
+#define _STLP_NO_IOSTREAMS 1
+*/
+
+/*
+ * Set _STLP_DEBUG to turn the "Debug Mode" on.
+ * That gets you checked iterators/ranges in the manner
+ * of "Safe STL". Very useful for debugging. Thread-safe.
+ * Please do not forget to link proper STLport library flavor
+ * (e.g libstlportstlg.so or libstlportstlg.a) when you set this flag
+ * in STLport iostreams mode, namespace customization guaranty that you
+ * link to the right library.
+ */
+/*
+#define _STLP_DEBUG 1
+*/
+/*
+ * You can also choose the debug level:
+ * STLport debug level: Default value
+ * Check only what the STLport implementation consider as invalid.
+ * It also change the iterator invalidation schema.
+ * Standard debug level: Check for all operations the standard consider as "undefined behavior"
+ * even if STlport implement it correctly. It also invalidates iterators
+ * more often.
+ */
+/*
+#define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL
+#define _STLP_DEBUG_LEVEL _STLP_STANDARD_DBG_LEVEL
+*/
+/* When an inconsistency is detected by the 'safe STL' the program will abort.
+ * If you prefer an exception define the following macro. The thrown exception
+ * will be the Standard runtime_error exception.
+ */
+/*
+#define _STLP_DEBUG_MODE_THROWS
+ */
+
+/*
+ * _STLP_NO_CUSTOM_IO : define this if you do not instantiate basic_xxx iostream
+ * classes with custom types (which is most likely the case). Custom means types
+ * other than char, wchar_t, char_traits<> and allocator<> like
+ * basic_ostream<my_char_type, my_traits<my_char_type> > or
+ * basic_string<char, char_traits<char>, my_allocator >
+ * When this option is on, most non-inline template functions definitions for iostreams
+ * are not seen by the client which saves a lot of compile time for most compilers,
+ * also object and executable size for some.
+ * Default is off, just not to break compilation for those who do use those types.
+ * That also guarantees that you still use optimized standard i/o when you compile
+ * your program without optimization. Option does not affect STLport library build; you
+ * may use the same binary library with and without this option, on per-project basis.
+ */
+/*
+#define _STLP_NO_CUSTOM_IO
+*/
+
+/*
+ * _STLP_NO_RELOPS_NAMESPACE: if defined, don't put the relational
+ * operator templates (>, <=, >=, !=) in namespace std::rel_ops, even
+ * if the compiler supports namespaces.
+ * Note : if the compiler do not support namespaces, those operators are not be provided by default,
+ * to simulate hiding them into rel_ops. This was proved to resolve many compiler bugs with ambiguity.
+ */
+/*
+#define _STLP_NO_RELOPS_NAMESPACE 1
+*/
+
+/*
+ * If STLport use its own namespace, see _STLP_NO_OWN_NAMESPACE in host.h, it will try
+ * by default to rename std:: for the user to stlport::. If you do not want this feature,
+ * please define the following switch and then use stlport::
+ */
+/*
+#define _STLP_DONT_REDEFINE_STD 1
+*/
+
+/*
+ * _STLP_WHOLE_NATIVE_STD : only meaningful if STLport uses its own namespace.
+ * Normally, STLport only imports necessary components from native std:: namespace.
+ * You might want everything from std:: being available in std:: namespace when you
+ * include corresponding STLport header (like STLport <map> provides std::map as well, etc.),
+ * if you are going to use both stlport:: and std:: components in your code.
+ * Otherwise this option is not recommended as it increases the size of your object files
+ * and slows down compilation.
+ * Beware, if you do not use STLport iostream (_STLP_NO_IOSTREAMS above), ask STLport to
+ * not rename std:: in stlport:: and try to have access to whole native Standard stuff then
+ * STLport will only throw exceptions from the std namespace and not from stlport.
+ * For instance a problem in stlport::vector::at will throw a std::out_of_range exception
+ * and not a stlport::out_of_range.
+ * Notice that STLport exceptions inherits from std::exception.
+ */
+/*
+#define _STLP_WHOLE_NATIVE_STD
+*/
+
+/*
+ * Use this option to catch uninitialized members in your classes.
+ * When it is set, construct() and destroy() fill the class storage
+ * with _STLP_SHRED_BYTE (see below).
+ * Note : _STLP_DEBUG and _STLP_DEBUG_ALLOC don't set this option automatically.
+ */
+/*
+#define _STLP_DEBUG_UNINITIALIZED 1
+#define _STLP_DEBUG_ALLOC 1
+*/
+
+/*
+ * Uncomment and provide a definition for the byte with which raw memory
+ * will be filled if _STLP_DEBUG_ALLOC or _STLP_DEBUG_UNINITIALIZED is defined.
+ * Choose a value which is likely to cause a noticeable problem if dereferenced
+ * or otherwise abused. A good value may already be defined for your platform.
+ */
+/*
+#define _STLP_SHRED_BYTE 0xA3
+*/
+
+/*
+ * This option is for gcc users only and only affects systems where native linker
+ * does not let gcc to implement automatic instantiation of static template data members/
+ * It is being put in this file as there is no way to check if we are using GNU ld automatically,
+ * so it becomes user's responsibility.
+ */
+/*
+#define _STLP_GCC_USES_GNU_LD
+*/
+
+/*==========================================================
+ * Compatibility section
+ *==========================================================*/
+
+/*
+ * Define this macro to disable anachronistic constructs (like the ones used in HP STL and
+ * not included in final standard, etc.
+ */
+/*
+#define _STLP_NO_ANACHRONISMS 1
+*/
+
+/*
+ * Define this macro to disable STLport extensions (for example, to make sure your code will
+ * compile with some other implementation )
+ */
+/*
+#define _STLP_NO_EXTENSIONS 1
+*/
+
+/*
+ * You should define this macro if compiling with MFC - STLport <stl/config/_windows.h>
+ * then include <afx.h> instead of <windows.h> to get synchronisation primitives
+ */
+/*
+#define _STLP_USE_MFC 1
+*/
+
+/*
+ * boris : this setting is here as we cannot detect precense of new Platform SDK automatically
+ * If you are using new PSDK with VC++ 6.0 or lower,
+ * please define this to get correct prototypes for InterlockedXXX functions
+ */
+/*
+#define _STLP_NEW_PLATFORM_SDK 1
+*/
+
+/*
+ * For the same reason as the one above we are not able to detect easily use
+ * of the compiler coming with the Platform SDK instead of the one coming with
+ * a Microsoft Visual Studio release. This change native C/C++ library location
+ * and implementation, please define this to get correct STLport configuration.
+ */
+/*
+#define _STLP_USING_PLATFORM_SDK_COMPILER 1
+*/
+
+/*
+ * Some compilers support the automatic linking feature.
+ * Uncomment the following if you prefer to specify the STLport library
+ * to link with yourself.
+ * For the moment, this feature is only supported and implemented within STLport
+ * by the Microsoft compilers.
+ */
+/*
+#define _STLP_DONT_USE_AUTO_LINK 1
+*/
+
+/*
+ * If you customize the STLport generated library names don't forget to give
+ * the motif you used during configuration here if you still want the auto link
+ * to work. (Do not remove double quotes in the macro value)
+ */
+/*
+#define _STLP_LIB_NAME_MOTIF "???"
+ */
+
+/*
+ * Uncomment to get feedback at compilation time about result of build environment
+ * introspection.
+ */
+/*
+#define _STLP_VERBOSE 1
+*/
+
+/*
+ * Use minimum set of default arguments on template classes that have more
+ * than one - for example map<>, set<>.
+ * This has effect only if _STLP_LIMITED_DEFAULT_TEMPLATES is on.
+ * If _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS is set, you'll be able to compile
+ * set<T> with those compilers, but you'll have to use __set__<T, less<T>>
+ *
+ * Affects : map<>, multimap<>, set<>, multiset<>, hash_*<>,
+ * queue<>, priority_queue<>, stack<>, istream_iterator<>
+ */
+/*
+#define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS 1
+*/
+
+/*
+ * The agregation of strings using the + operator is an expensive operation
+ * as it requires construction of temporary objects that need memory allocation
+ * and deallocation. The problem can be even more important if you are adding
+ * several strings together in a single expression. To avoid this problem STLport
+ * implement expression template. With this technique addition of 2 strings is not
+ * a string anymore but a temporary object having a reference to each of the
+ * original strings involved in the expression. This object carry information
+ * directly to the destination string to set its size correctly and only make
+ * a single call to the allocator. This technique also works for the addition of
+ * N elements where elements are basic_string, C string or a single character.
+ * The drawback can be longer compilation time and bigger executable size.
+ * Another problem is that some compilers (gcc) fail to use string proxy object
+ * if do with class derived from string (see unit tests for details).
+ * STLport rebuild: Yes
+ */
+/*
+#define _STLP_USE_TEMPLATE_EXPRESSION 1
+*/
+
+
+/*
+ * By default the STLport basic_string implementation use a little static buffer
+ * (of 16 chars when writing this doc) to avoid systematically memory allocation
+ * in case of little basic_string. The drawback of such a method is bigger
+ * basic_string size and some performance penalty for method like swap. If you
+ * prefer systematical dynamic allocation turn on this macro.
+ * STLport rebuild: Yes
+ */
+/*
+#define _STLP_DONT_USE_SHORT_STRING_OPTIM 1
+*/
+
+/*
+ * To reduce the famous code bloat trouble due to the use of templates STLport grant
+ * a specialization of some containers for pointer types. So all instanciations
+ * of those containers with a pointer type will use the same implementation based on
+ * a container of void*. This feature has shown very good result on object files size
+ * but after link phase and optimization you will only experiment benefit if you use
+ * many container with pointer types.
+ * There are however a number of limitation to use this option:
+ * - with compilers not supporting partial template specialization feature, you won't
+ * be able to access some nested container types like iterator as long as the
+ * definition of the type used to instanciate the container will be incomplete
+ * (see IncompleteClass definition in test/unit/vector_test.cpp).
+ * - you won't be able to use complex Standard allocator implementations which are
+ * allocators having pointer nested type not being a real C pointer.
+ */
+/*
+#define _STLP_USE_PTR_SPECIALIZATIONS 1
+*/
+
+/*
+ * To achieve many different optimizations within the template implementations STLport
+ * uses some type traits technique. With this macro you can ask STLport to use the famous
+ * boost type traits rather than the internal one. The advantages are more compiler
+ * integration and a better support. If you only define this macro once the STLport has been
+ * built you just have to add the boost install path within your include path. If you want
+ * to use this feature at STLport built time you will have to define the
+ * STLP_BUILD_BOOST_PATH enrironment variable with the value of the boost library path.
+ */
+
+/*
+#define _STLP_USE_BOOST_SUPPORT 1
+*/
+
+
+/*==========================================================*/
+
+/*
+ Local Variables:
+ mode: C++
+ End:
+*/
diff --git a/stlport/stl/debug/_debug.c b/stlport/stl/debug/_debug.c
new file mode 100644
index 0000000..99d5c6b
--- /dev/null
+++ b/stlport/stl/debug/_debug.c
@@ -0,0 +1,628 @@
+/*
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_DEBUG_C
+#define _STLP_DEBUG_C
+
+#if defined (_STLP_DEBUG)
+#if defined (_STLP_THREADS)
+# if !defined (_STLP_NEED_MUTABLE)
+# define _STLP_ACQUIRE_LOCK(_Lock) _Lock._M_acquire_lock();
+# define _STLP_RELEASE_LOCK(_Lock) _Lock._M_release_lock();
+# else
+# define _STLP_ACQUIRE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_acquire_lock();
+# define _STLP_RELEASE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_release_lock();
+# endif /* _STLP_NEED_MUTABLE */
+#else
+# define _STLP_ACQUIRE_LOCK(_Lock)
+# define _STLP_RELEASE_LOCK(_Lock)
+#endif /* _STLP_THREADS */
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//==========================================================
+// global non-inline functions
+//==========================================================
+// [ i1, i2)
+#if !defined (__DMC__)
+template <class _Iterator>
+inline bool _STLP_CALL
+stlp_in_range_aux(const _Iterator& __it, const _Iterator& __first,
+ const _Iterator& __last, const random_access_iterator_tag &) {
+ return ( __it >= __first &&
+ __it < __last);
+}
+#endif
+
+template <class _Iterator1, class _Iterator>
+#if defined (_STLP_MSVC)
+inline bool _STLP_CALL stlp_in_range_aux(_Iterator1 __it, const _Iterator& __first,
+#else
+inline bool _STLP_CALL stlp_in_range_aux(const _Iterator1& __it, const _Iterator& __first,
+#endif
+ const _Iterator& __last, const forward_iterator_tag &) {
+ _Iterator1 __i(__first);
+ for (; __i != __last && __i != __it; ++__i);
+ return (__i != __last);
+}
+
+#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
+template <class _Iterator1, class _Iterator>
+inline bool _STLP_CALL
+stlp_in_range_aux(const _Iterator1& __it, const _Iterator& __first,
+ const _Iterator& __last, const bidirectional_iterator_tag &) {
+ _Iterator1 __i(__first);
+ for (; __i != __last && __i != __it; ++__i);
+ return (__i != __last);
+}
+#endif
+
+template <class _Iterator>
+bool _STLP_CALL __check_range_aux(const _Iterator& __first, const _Iterator& __last,
+ const __false_type& /*_IsIntegral*/) {
+ _STLP_VERBOSE_RETURN(__valid_range(__first,__last), _StlMsg_INVALID_RANGE )
+ return true;
+}
+
+template <class _Integral>
+bool _STLP_CALL __check_range_aux(_Integral /*__first*/, _Integral /*__last*/,
+ const __true_type& /*_IsIntegral*/)
+{ return true; }
+
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator& __first, const _Iterator& __last) {
+ typedef typename _IsIntegral<_Iterator>::_Ret _Integral;
+ return __check_range_aux(__first, __last, _Integral());
+}
+
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator& __it,
+ const _Iterator& __start, const _Iterator& __finish) {
+ _STLP_VERBOSE_RETURN(stlp_in_range(__it, __start, __finish),
+ _StlMsg_NOT_IN_RANGE_1)
+ return true;
+}
+
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator& __first, const _Iterator& __last,
+ const _Iterator& __start, const _Iterator& __finish) {
+ _STLP_VERBOSE_RETURN(stlp_in_range(__first, __last, __start, __finish),
+ _StlMsg_NOT_IN_RANGE_2)
+ return true;
+}
+
+template <class _Tp>
+bool _STLP_CALL __check_ptr_range(const _Tp* __first, const _Tp* __last) {
+ _STLP_VERBOSE_RETURN((__first != 0 || __last == 0), _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_RETURN(__valid_range(__first, __last, random_access_iterator_tag()),
+ _StlMsg_INVALID_RANGE)
+ return true;
+}
+
+//===============================================================
+template <class _Iterator>
+void _STLP_CALL __invalidate_range(const __owned_list* __base,
+ const _Iterator& __first,
+ const _Iterator& __last) {
+ typedef __owned_link _L_type;
+ _STLP_ACQUIRE_LOCK(__base->_M_lock)
+ _L_type* __prev = __CONST_CAST(_L_type*, &__base->_M_node);
+ _L_type* __pos = __prev->_M_next;
+
+ while (__pos != 0) {
+ if (!(&__first == __STATIC_CAST(_Iterator*, __pos) || &__last == __STATIC_CAST(_Iterator*, __pos)) &&
+ stlp_in_range_aux(__STATIC_CAST(_Iterator*, __pos)->_M_iterator,
+ __first._M_iterator, __last._M_iterator,
+ _STLP_ITERATOR_CATEGORY(__first, _Iterator))) {
+ __pos->_M_owner = 0;
+ __prev->_M_next = __pos->_M_next;
+ }
+ else {
+ __prev = __pos;
+ }
+ __pos = __prev->_M_next;
+ }
+ _STLP_RELEASE_LOCK(__base->_M_lock)
+}
+
+template <class _Iterator>
+void _STLP_CALL __invalidate_iterator(const __owned_list* __base,
+ const _Iterator& __it) {
+ typedef __owned_link _L_type;
+ _STLP_ACQUIRE_LOCK(__base->_M_lock)
+ _L_type* __prev = __CONST_CAST(_L_type*, &__base->_M_node);
+ _L_type* __pos = __prev->_M_next;
+ while (__pos != 0) {
+ // this requires safe iterators to be derived from __owned_link
+ if ((__pos != __STATIC_CAST(const _L_type*, &__it)) &&
+ (__STATIC_CAST(_Iterator*, __pos)->_M_iterator == __it._M_iterator)) {
+ __pos->_M_owner = 0;
+ __prev->_M_next = __pos->_M_next;
+ }
+ else {
+ __prev = __pos;
+ }
+ __pos = __prev->_M_next;
+ }
+ _STLP_RELEASE_LOCK(__base->_M_lock)
+}
+
+template <class _Iterator>
+void _STLP_CALL __change_range_owner(const _Iterator& __first,
+ const _Iterator& __last,
+ const __owned_list* __dst) {
+ if (__first._Owner() == __dst)
+ return;
+
+ typedef __owned_link _L_type;
+ // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here
+ //_STLP_ACQUIRE_LOCK(__base->_M_lock)
+ __owned_list *__base = __CONST_CAST(__owned_list*, __first._Owner());
+ _L_type* __src_prev = &__base->_M_node;
+ _L_type* __pos = __src_prev->_M_next;
+ _L_type* __dst_prev = __CONST_CAST(_L_type*, &__dst->_M_node);
+
+ while (__pos != 0) {
+ if (!(&__first == __STATIC_CAST(_Iterator*, __pos) || &__last == __STATIC_CAST(_Iterator*, __pos)) &&
+ stlp_in_range_aux(__STATIC_CAST(_Iterator*, __pos)->_M_iterator,
+ __first._M_iterator, __last._M_iterator,
+ _STLP_ITERATOR_CATEGORY(__first, _Iterator))) {
+ __pos->_M_owner = __CONST_CAST(__owned_list*, __dst);
+ //remove __pos from __base:
+ __src_prev->_M_next = __pos->_M_next;
+ //add __pos to __dst:
+ __pos->_M_next = __dst_prev->_M_next;
+ __dst_prev->_M_next = __pos;
+ }
+ else {
+ __src_prev = __pos;
+ }
+ __pos = __src_prev->_M_next;
+ }
+
+#if defined(_STLP_WCE) && defined(_ARM_)
+ // Note: This part is needed for compiling under Windows CE under ARM and correctly using
+ // _STLP_DEBUG mode. This comes from a bug in the ARM compiler where checked iterators that
+ // are passed by value are not copied over correctly. When __change_range_owner is called,
+ // e.g. in std::list::splice() the wrong _M_owner field gets modified and the __first
+ // iterator has the old _M_owner field, but was moved to the new __owned_list. Setting
+ // the first iterator's _M_owner field fixes this. Ugly but works.
+ __pos = __CONST_CAST(_Iterator*, &__first);
+ __pos->_M_owner = __CONST_CAST(__owned_list*, __dst);
+#endif
+ //_STLP_RELEASE_LOCK(__base->_M_lock)
+}
+
+template <class _Iterator>
+void _STLP_CALL __change_ite_owner(const _Iterator& __it,
+ const __owned_list* __dst) {
+ if (__it._Owner() == __dst)
+ return;
+
+ typedef __owned_link _L_type;
+ // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here
+ //_STLP_ACQUIRE_LOCK(__base->_M_lock)
+ __owned_list *__base = __CONST_CAST(__owned_list*, __it._Owner());
+ _L_type* __prev = &__base->_M_node;
+ _L_type* __pos = __prev->_M_next;
+ _L_type* __dst_prev = __CONST_CAST(_L_type*, &__dst->_M_node);
+
+ while (__pos != 0) {
+ // this requires safe iterators to be derived from __owned_link
+ if ((__pos != __STATIC_CAST(const _L_type*, &__it)) &&
+ (__STATIC_CAST(_Iterator*, __pos)->_M_iterator == __it._M_iterator)) {
+ __pos->_M_owner = __CONST_CAST(__owned_list*, __dst);
+ //remove __pos from __base:
+ __prev->_M_next = __pos->_M_next;
+ //add __pos to __dst:
+ __pos->_M_next = __dst_prev->_M_next;
+ __dst_prev->_M_next = __pos;
+ }
+ else {
+ __prev = __pos;
+ }
+ __pos = __prev->_M_next;
+ }
+ //_STLP_RELEASE_LOCK(__base->_M_lock)
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_DEBUG */
+
+#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
+
+# ifndef _STLP_INTERNAL_CSTDLIB
+# include <stl/_cstdlib.h>
+# endif
+
+//==========================================================
+// .c section
+// owned_list non-inline methods and global functions
+//==========================================================
+
+# if defined (_STLP_ASSERTIONS)
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+# if !defined (_STLP_STRING_LITERAL)
+# define _STLP_STRING_LITERAL(__x) __x
+# endif
+
+# if defined (_STLP_USE_WIDE_INTERFACE)
+// note: WinCE needs this to format single-byte strings in __stl_debug_engine::_Message
+# define _STLP_PERCENT_S "%hs"
+# else
+# define _STLP_PERCENT_S "%s"
+# endif /* _STLP_USE_WIDE_INTERFACE */
+
+# define _STLP_MESSAGE_TABLE_BODY = { \
+_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error: " _STLP_PERCENT_S "\n"), \
+_STLP_STRING_LITERAL(_STLP_PERCENT_S "(%d): STL assertion failure : " _STLP_PERCENT_S "\n" _STLP_ASSERT_MSG_TRAILER), \
+_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error : " _STLP_PERCENT_S "\n" _STLP_PERCENT_S "(%d): STL assertion failure: " _STLP_PERCENT_S " \n" _STLP_ASSERT_MSG_TRAILER), \
+_STLP_STRING_LITERAL("Invalid argument to operation (see operation documentation)"), \
+_STLP_STRING_LITERAL("Taking an iterator out of destroyed (or otherwise corrupted) container"), \
+_STLP_STRING_LITERAL("Trying to extract an object out from empty container"),\
+_STLP_STRING_LITERAL("Past-the-end iterator could not be erased"), \
+_STLP_STRING_LITERAL("Index out of bounds"), \
+_STLP_STRING_LITERAL("Container doesn't own the iterator"), \
+_STLP_STRING_LITERAL("Container is owner of the iterator, but should not"), \
+_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) iterator used"), \
+_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) lefthand iterator in expression"), \
+_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) righthand iterator in expression"), \
+_STLP_STRING_LITERAL("Iterators used in expression are from different owners"), \
+_STLP_STRING_LITERAL("Iterator could not be dereferenced (past-the-end ?)"), \
+_STLP_STRING_LITERAL("Range [first,last) is invalid"), \
+_STLP_STRING_LITERAL("Iterator is not in range [first,last)"), \
+_STLP_STRING_LITERAL("Range [first,last) is not in range [start,finish)"), \
+_STLP_STRING_LITERAL("The advance would produce invalid iterator"), \
+_STLP_STRING_LITERAL("Iterator is singular (advanced beyond the bounds ?)"), \
+_STLP_STRING_LITERAL("Invalid strict weak ordering predicate, if pred(a, b) then we should have !pred(b, a)"), \
+_STLP_STRING_LITERAL("Invalid equivalent predicate, if pred(a, b) then we should have pred(b, a)"), \
+_STLP_STRING_LITERAL("Memory block deallocated twice"), \
+_STLP_STRING_LITERAL("Deallocating a block that was never allocated"), \
+_STLP_STRING_LITERAL("Deallocating a memory block allocated for another type"), \
+_STLP_STRING_LITERAL("Size of block passed to deallocate() doesn't match block size"), \
+_STLP_STRING_LITERAL("Pointer underrun - safety margin at front of memory block overwritten"), \
+_STLP_STRING_LITERAL("Pointer overrrun - safety margin at back of memory block overwritten"), \
+_STLP_STRING_LITERAL("Attempt to dereference null pointer returned by auto_ptr::get()"), \
+_STLP_STRING_LITERAL("Memory allocation function returned a wrongly align memory block"), \
+_STLP_STRING_LITERAL("Unknown problem") \
+ }
+
+template <class _Dummy>
+const char* __stl_debug_engine<_Dummy>::_Message_table[_StlMsg_MAX] _STLP_MESSAGE_TABLE_BODY;
+
+# undef _STLP_STRING_LITERAL
+# undef _STLP_PERCENT_S
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+# if !defined (_STLP_DEBUG_MESSAGE)
+# ifndef _STLP_INTERNAL_CSTDARG
+# include <stl/_cstdarg.h>
+# endif
+# ifndef _STLP_INTERNAL_CSTDIO
+# include <stl/_cstdio.h>
+# endif
+# if defined (_STLP_DEBUG_MODE_THROWS) && !defined (_STLP_RANGE_ERRORS_H)
+# include <stl/_range_errors.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...) {
+ STLPORT_CSTD::va_list __args;
+ va_start( __args, __format_str );
+
+# if !defined (_STLP_DEBUG_MODE_THROWS)
+# if defined (_STLP_USE_WIDE_INTERFACE)
+ TCHAR __buffer[512];
+ int _convert = strlen(__format_str) + 1;
+ LPWSTR _lpw = (LPWSTR)alloca(_convert * sizeof(wchar_t));
+ _lpw[0] = '\0';
+ MultiByteToWideChar(GetACP(), 0, __format_str, -1, _lpw, _convert);
+ wvsprintf(__buffer, _lpw, __args);
+ _STLP_WINCE_TRACE(__buffer);
+# elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL))
+ char __buffer [4096];
+
+# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args);
+# else
+ vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args);
+# endif
+
+ OutputDebugStringA(__buffer);
+
+# elif defined (__amigaos__)
+ STLPORT_CSTD::vfprintf(stderr, __format_str, (char *)__args);
+# else
+ STLPORT_CSTD::vfprintf(stderr, __format_str, __args);
+# endif
+# else
+ char __buffer[4096];
+
+# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
+ vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args);
+# elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL))
+ vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args);
+# else
+ vsprintf(__buffer, __format_str, __args);
+# endif
+# endif
+
+# ifdef _STLP_DEBUG_MESSAGE_POST
+ _STLP_DEBUG_MESSAGE_POST
+# endif
+
+ va_end(__args);
+
+# if defined (_STLP_DEBUG_MODE_THROWS)
+ __stl_throw_runtime_error(__buffer);
+# endif
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+# else
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...)
+{}
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+# endif /* _STLP_DEBUG_MESSAGE */
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_IndexedError(int __error_ind, const char* __f, int __l) {
+ __stl_debug_message(_Message_table[_StlFormat_ERROR_RETURN],
+ __f, __l, _Message_table[__error_ind]);
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l) {
+ __stl_debug_message(_Message_table[_StlFormat_VERBOSE_ASSERTION_FAILURE],
+ __f, __l, _Message_table[__error_ind], __f, __l, __expr);
+ __stl_debug_terminate();
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Assert(const char* __expr, const char* __f, int __l) {
+ __stl_debug_message(_Message_table[_StlFormat_ASSERTION_FAILURE],__f, __l, __expr);
+ __stl_debug_terminate();
+}
+
+// if exceptions are present, sends unique exception
+// if not, calls abort() to terminate
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Terminate()
+{ _STLP_ABORT(); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_ASSERTIONS */
+
+# if defined (_STLP_DEBUG)
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//==========================================================
+// owned_list non-inline methods
+//==========================================================
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Invalidate_all(__owned_list* __l) {
+ _STLP_ACQUIRE_LOCK(__l->_M_lock);
+ _Stamp_all(__l, 0);
+ __l->_M_node._M_next =0;
+ _STLP_RELEASE_LOCK(__l->_M_lock);
+}
+
+// boris : this is unasafe routine; should be used from within critical section only !
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Stamp_all(__owned_list* __l, __owned_list* __o) {
+ // crucial
+ if (__l->_M_node._M_owner) {
+ for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next;
+ __pos != 0; __pos = (__owned_link*)__pos->_M_next) {
+ _STLP_ASSERT(__pos->_Owner()== __l)
+ __pos->_M_owner=__o;
+ }
+ }
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Verify(const __owned_list* __l) {
+ _STLP_ACQUIRE_LOCK(__l->_M_lock);
+ if (__l) {
+ _STLP_ASSERT(__l->_M_node._Owner() != 0)
+ for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next;
+ __pos != 0; __pos = (__owned_link*)__pos->_M_next) {
+ _STLP_ASSERT(__pos->_Owner()== __l)
+ }
+ }
+ _STLP_RELEASE_LOCK(__l->_M_lock);
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Swap_owners(__owned_list& __x, __owned_list& __y) {
+ /*
+ * according to the standard : --no swap() function invalidates any references,
+ * pointers, or iterators referring to the elements of the containers being swapped.
+ */
+
+ __owned_link* __tmp;
+
+ /*
+ * boris : there is a deadlock potential situation here if we lock two containers sequentially.
+ * As user is supposed to provide its own synchronization around swap() ( it is unsafe to do any container/iterator access
+ * in parallel with swap()), we just do not use any locking at all -- that behaviour is closer to non-debug version
+ */
+
+ __tmp = __x._M_node._M_next;
+
+ _Stamp_all(&__x, &__y);
+ _Stamp_all(&__y, &__x);
+
+ __x._M_node._M_next = __y._M_node._M_next;
+ __y._M_node._M_next = __tmp;
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_Set_owner(__owned_list& __src, __owned_list& __dst) {
+ if (&__src == &__dst)
+ return;
+
+ // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here
+ typedef __owned_link _L_type;
+ _L_type* __prev = &__src._M_node;
+ _L_type* __pos = __prev->_M_next;
+
+ while (__pos != 0) {
+ __pos->_M_owner = &__dst;
+ __prev = __pos;
+ __pos = __prev->_M_next;
+ }
+ __prev->_M_next = __dst._M_node._M_next;
+ __dst._M_node._M_next = __src._M_node._M_next;
+ __src._M_node._M_next = 0;
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_M_detach(__owned_list* __l, __owned_link* __c_node) {
+ if (__l != 0) {
+
+ _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER)
+
+ _STLP_ACQUIRE_LOCK(__l->_M_lock)
+ // boris : re-test the condition in case someone else already deleted us
+ if(__c_node->_M_owner != 0) {
+ __owned_link* __prev, *__next;
+
+ for (__prev = &__l->_M_node; (__next = __prev->_M_next) != __c_node;
+ __prev = __next) {
+ _STLP_ASSERT(__next && __next->_Owner() == __l)
+ }
+
+ __prev->_M_next = __c_node->_M_next;
+ __c_node->_M_owner=0;
+ }
+ _STLP_RELEASE_LOCK(__l->_M_lock)
+ }
+}
+
+template <class _Dummy>
+void _STLP_CALL
+__stl_debug_engine<_Dummy>::_M_attach(__owned_list* __l, __owned_link* __c_node) {
+ if (__l ==0) {
+ (__c_node)->_M_owner = 0;
+ } else {
+ _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER)
+ _STLP_ACQUIRE_LOCK(__l->_M_lock)
+ __c_node->_M_owner = __l;
+ __c_node->_M_next = __l->_M_node._M_next;
+ __l->_M_node._M_next = __c_node;
+ _STLP_RELEASE_LOCK(__l->_M_lock)
+ }
+}
+
+template <class _Dummy>
+void* _STLP_CALL
+__stl_debug_engine<_Dummy>::_Get_container_ptr(const __owned_link* __l) {
+ const __owned_list* __owner = __l->_Owner();
+ _STLP_VERBOSE_RETURN_0(__owner != 0, _StlMsg_INVALID_ITERATOR)
+ void* __ret = __CONST_CAST(void*,__owner->_Owner());
+ _STLP_VERBOSE_RETURN_0(__ret !=0, _StlMsg_INVALID_CONTAINER)
+ return __ret;
+}
+
+template <class _Dummy>
+bool _STLP_CALL
+__stl_debug_engine<_Dummy>::_Check_same_owner(const __owned_link& __i1,
+ const __owned_link& __i2) {
+ _STLP_VERBOSE_RETURN(__i1._Valid(), _StlMsg_INVALID_LEFTHAND_ITERATOR)
+ _STLP_VERBOSE_RETURN(__i2._Valid(), _StlMsg_INVALID_RIGHTHAND_ITERATOR)
+ _STLP_VERBOSE_RETURN((__i1._Owner() == __i2._Owner()), _StlMsg_DIFFERENT_OWNERS)
+ return true;
+}
+
+template <class _Dummy>
+bool _STLP_CALL
+__stl_debug_engine<_Dummy>::_Check_same_or_null_owner(const __owned_link& __i1,
+ const __owned_link& __i2) {
+ _STLP_VERBOSE_RETURN(__i1._Owner() == __i2._Owner(), _StlMsg_DIFFERENT_OWNERS)
+ return true;
+}
+
+template <class _Dummy>
+bool _STLP_CALL
+__stl_debug_engine<_Dummy>::_Check_if_owner( const __owned_list * __l, const __owned_link& __it) {
+ const __owned_list* __owner_ptr = __it._Owner();
+ _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR)
+ _STLP_VERBOSE_RETURN(__l == __owner_ptr, _StlMsg_NOT_OWNER)
+ return true;
+}
+
+template <class _Dummy>
+bool _STLP_CALL
+__stl_debug_engine<_Dummy>::_Check_if_not_owner( const __owned_list * __l, const __owned_link& __it) {
+ const __owned_list* __owner_ptr = __it._Owner();
+ _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR)
+ _STLP_VERBOSE_RETURN(__l != __owner_ptr, _StlMsg_SHOULD_NOT_OWNER)
+ return true;
+}
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_DEBUG */
+
+#endif /* if defined (EXPOSE_GLOBALS_IMPLEMENTATION) */
+
+#endif /* header guard */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/debug/_debug.h b/stlport/stl/debug/_debug.h
new file mode 100644
index 0000000..6a2a8ce
--- /dev/null
+++ b/stlport/stl/debug/_debug.h
@@ -0,0 +1,473 @@
+/*
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_DEBUG_H
+#define _STLP_DEBUG_H
+
+#if (defined (_STLP_DEBUG) || defined (_STLP_DEBUG_ALLOC)) && \
+ !defined (_STLP_ASSERTIONS)
+# define _STLP_ASSERTIONS 1
+#endif
+
+#if defined (_STLP_ASSERTIONS)
+
+# if !defined (_STLP_FILE__)
+# define _STLP_FILE__ __FILE__
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+enum {
+ //General errors
+ _StlFormat_ERROR_RETURN,
+ _StlFormat_ASSERTION_FAILURE,
+ _StlFormat_VERBOSE_ASSERTION_FAILURE,
+ _StlMsg_INVALID_ARGUMENT,
+ //Container/Iterator related errors
+ _StlMsg_INVALID_CONTAINER,
+ _StlMsg_EMPTY_CONTAINER,
+ _StlMsg_ERASE_PAST_THE_END,
+ _StlMsg_OUT_OF_BOUNDS,
+ _StlMsg_NOT_OWNER,
+ _StlMsg_SHOULD_NOT_OWNER,
+ _StlMsg_INVALID_ITERATOR,
+ _StlMsg_INVALID_LEFTHAND_ITERATOR,
+ _StlMsg_INVALID_RIGHTHAND_ITERATOR,
+ _StlMsg_DIFFERENT_OWNERS ,
+ _StlMsg_NOT_DEREFERENCEABLE ,
+ _StlMsg_INVALID_RANGE ,
+ _StlMsg_NOT_IN_RANGE_1 ,
+ _StlMsg_NOT_IN_RANGE_2 ,
+ _StlMsg_INVALID_ADVANCE ,
+ _StlMsg_SINGULAR_ITERATOR ,
+ //Bad predicate for sorting
+ _StlMsg_INVALID_STRICT_WEAK_PREDICATE,
+ _StlMsg_INVALID_EQUIVALENT_PREDICATE,
+ // debug alloc messages
+ _StlMsg_DBA_DELETED_TWICE ,
+ _StlMsg_DBA_NEVER_ALLOCATED ,
+ _StlMsg_DBA_TYPE_MISMATCH ,
+ _StlMsg_DBA_SIZE_MISMATCH ,
+ _StlMsg_DBA_UNDERRUN ,
+ _StlMsg_DBA_OVERRUN ,
+ // auto_ptr messages
+ _StlMsg_AUTO_PTR_NULL ,
+ //Memory alignent message
+ _StlMsg_WRONG_MEMORY_ALIGNMENT,
+ _StlMsg_UNKNOWN
+ /* _StlMsg_MAX */
+};
+
+/* have to hardcode that ;() */
+# define _StlMsg_MAX 31
+
+class __owned_link;
+class __owned_list;
+
+# if defined (_STLP_DEBUG_MODE_THROWS)
+# define _STLP_MESSAGE_NORETURN _STLP_FUNCTION_THROWS
+# else
+# define _STLP_MESSAGE_NORETURN
+# endif
+
+template <class _Dummy>
+class __stl_debug_engine {
+public:
+ // Basic routine to report any debug message
+ // Use _STLP_DEBUG_MESSAGE to override
+ static void _STLP_MESSAGE_NORETURN _STLP_CALL _Message(const char * format_str, ...);
+
+ // Micsellanous function to report indexed error message
+ static void _STLP_CALL _IndexedError(int __ind, const char* __f, int __l);
+
+ // Basic assertion report mechanism.
+ // Reports failed assertion via __stl_debug_message and calls _Terminate
+ // if _STLP_DEBUG_TERMINATE is specified, calls __stl_debug_terminate instead
+ static void _STLP_CALL _Assert(const char* __expr, const char* __f, int __l);
+
+ // The same, with additional diagnostics
+ static void _STLP_CALL _VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l);
+
+ // If exceptions are present, sends unique exception
+ // If not, calls _STLP_ABORT() to terminate
+ // Use _STLP_DEBUG_TERMINATE to override
+ static void _STLP_CALL _Terminate();
+
+# if defined (_STLP_DEBUG)
+ // owned_list/link delegate non-inline functions here
+
+ static bool _STLP_CALL _Check_same_owner( const __owned_link& __i1,
+ const __owned_link& __i2);
+ static bool _STLP_CALL _Check_same_or_null_owner( const __owned_link& __i1,
+ const __owned_link& __i2);
+ static bool _STLP_CALL _Check_if_owner( const __owned_list*, const __owned_link&);
+
+ static bool _STLP_CALL _Check_if_not_owner( const __owned_list*, const __owned_link&);
+
+ static void _STLP_CALL _Verify(const __owned_list*);
+
+ static void _STLP_CALL _Swap_owners(__owned_list&, __owned_list&);
+
+ static void _STLP_CALL _Invalidate_all(__owned_list*);
+
+ static void _STLP_CALL _Set_owner(__owned_list& /*src*/, __owned_list& /*dst*/);
+
+ static void _STLP_CALL _Stamp_all(__owned_list*, __owned_list*);
+
+ static void _STLP_CALL _M_detach(__owned_list*, __owned_link*);
+
+ static void _STLP_CALL _M_attach(__owned_list*, __owned_link*);
+
+ // accessor : check and get pointer to the container
+ static void* _STLP_CALL _Get_container_ptr(const __owned_link*);
+# endif
+
+ // debug messages and formats
+ static const char* _Message_table[_StlMsg_MAX];
+};
+
+# undef _STLP_MESSAGE_NORETURN
+
+# if defined (_STLP_USE_TEMPLATE_EXPORT)
+_STLP_EXPORT_TEMPLATE_CLASS __stl_debug_engine<bool>;
+# endif
+
+typedef __stl_debug_engine<bool> __stl_debugger;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+# if !defined (_STLP_ASSERT)
+# define _STLP_ASSERT(expr) \
+ if (!(expr)) { _STLP_PRIV __stl_debugger::_Assert( # expr, _STLP_FILE__, __LINE__); }
+# endif
+
+#else
+# define _STLP_ASSERT(expr)
+#endif
+
+// this section is for _STLP_DEBUG only
+#if defined (_STLP_DEBUG)
+
+# if !defined (_STLP_VERBOSE_ASSERT)
+// fbp : new form not requiring ";"
+# define _STLP_VERBOSE_ASSERT(expr, __diag_num) \
+ if (!(expr)) { _STLP_PRIV __stl_debugger::_VerboseAssert\
+ ( # expr, _STLP_PRIV __diag_num, _STLP_FILE__, __LINE__ ); \
+ }
+# endif
+
+# define _STLP_DEBUG_CHECK(expr) _STLP_ASSERT(expr)
+
+# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+# define _STLP_STD_DEBUG_CHECK(expr) _STLP_DEBUG_CHECK(expr)
+# else
+# define _STLP_STD_DEBUG_CHECK(expr)
+# endif
+
+# if !defined (_STLP_VERBOSE_RETURN)
+# define _STLP_VERBOSE_RETURN(__expr,__diag_num) if (!(__expr)) { \
+ _STLP_PRIV __stl_debugger::_IndexedError(__diag_num, _STLP_FILE__ , __LINE__); \
+ return false; }
+# endif
+
+# if !defined (_STLP_VERBOSE_RETURN_0)
+# define _STLP_VERBOSE_RETURN_0(__expr,__diag_num) if (!(__expr)) { \
+ _STLP_PRIV __stl_debugger::_IndexedError(__diag_num, _STLP_FILE__, __LINE__); \
+ return 0; }
+# endif
+
+# ifndef _STLP_INTERNAL_THREADS_H
+# include <stl/_threads.h>
+# endif
+
+# ifndef _STLP_INTERNAL_ITERATOR_BASE_H
+# include <stl/_iterator_base.h>
+# endif
+
+# ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+# endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*
+ * Special debug iterator traits having an additionnal static member
+ * method _Check. It is used by the slist debug implementation to check
+ * the special before_begin iterator.
+ */
+template <class _Traits>
+struct _DbgTraits : _Traits {
+ typedef _DbgTraits<typename _Traits::_ConstTraits> _ConstTraits;
+ typedef _DbgTraits<typename _Traits::_NonConstTraits> _NonConstTraits;
+
+ template <class _Iterator>
+ static bool _Check(const _Iterator&) {return true;}
+};
+
+//=============================================================
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2,
+ const random_access_iterator_tag&)
+{ return (__i1 < __i2) || (__i1 == __i2); }
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2,
+ const bidirectional_iterator_tag&) {
+ // check if comparable
+ bool __dummy(__i1==__i2);
+ return (__dummy==__dummy);
+}
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2,
+ const forward_iterator_tag&) {
+ // check if comparable
+ bool __dummy(__i1==__i2);
+ return (__dummy==__dummy);
+}
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator&,const _Iterator&,
+ const input_iterator_tag&)
+{ return true; }
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator&,const _Iterator&,
+ const output_iterator_tag&)
+{ return true; }
+
+template <class _Iterator>
+inline bool _STLP_CALL __valid_range(const _Iterator& __i1, const _Iterator& __i2)
+{ return __valid_range(__i1,__i2,_STLP_ITERATOR_CATEGORY(__i1, _Iterator)); }
+
+// Note : that means in range [i1, i2].
+template <class _Iterator>
+inline bool _STLP_CALL stlp_in_range(const _Iterator& _It,
+ const _Iterator& __i1, const _Iterator& __i2)
+{ return __valid_range(__i1,_It) && __valid_range(_It,__i2); }
+
+template <class _Iterator>
+inline bool _STLP_CALL stlp_in_range(const _Iterator& __first, const _Iterator& __last,
+ const _Iterator& __start, const _Iterator& __finish)
+{ return __valid_range(__first,__last) && __valid_range(__start,__first) && __valid_range(__last,__finish); }
+
+//==========================================================
+class _STLP_CLASS_DECLSPEC __owned_link {
+public:
+ // Note: This and the following special defines for compiling under Windows CE under ARM
+ // is needed for correctly using _STLP_DEBUG mode. This comes from a bug in the ARM
+ // compiler where checked iterators that are passed by value call _M_attach with the wrong
+ // this pointer and calling _M_detach can't find the correct pointer to the __owned_link.
+ // This is circumvented by managing a _M_self pointer that points to the correct value.
+ // Ugly but works.
+#if defined(_STLP_WCE) && defined(_ARM_)
+ __owned_link() : _M_self(this), _M_owner(0) {}
+ __owned_link(const __owned_list* __c) : _M_self(this), _M_owner(0), _M_next(0)
+ { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__c), this); }
+ __owned_link(const __owned_link& __rhs): _M_self(this), _M_owner(0)
+ { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__rhs._M_owner), this); }
+#else
+ __owned_link() : _M_owner(0) {}
+ __owned_link(const __owned_list* __c) : _M_owner(0), _M_next(0)
+ { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__c), this); }
+ __owned_link(const __owned_link& __rhs): _M_owner(0)
+ { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__rhs._M_owner), this); }
+#endif
+ __owned_link& operator=(const __owned_link& __rhs) {
+ __owned_list* __new_owner = __CONST_CAST(__owned_list*,__rhs._M_owner);
+ __owned_list* __old_owner = _M_owner;
+ if ( __old_owner != __new_owner ) {
+ __stl_debugger::_M_detach(__old_owner, this);
+ __stl_debugger::_M_attach(__new_owner, this);
+ }
+ return *this;
+ }
+#if defined(_STLP_WCE) && defined(_ARM_)
+ ~__owned_link() {
+ __stl_debugger::_M_detach(_M_owner, _M_self);
+ _Invalidate();
+ }
+#else
+ ~__owned_link() {
+ __stl_debugger::_M_detach(_M_owner, this);
+ _Invalidate();
+ }
+#endif
+
+ const __owned_list* _Owner() const { return _M_owner; }
+ __owned_list* _Owner() { return _M_owner; }
+ void _Set_owner(const __owned_list* __o) { _M_owner= __CONST_CAST(__owned_list*,__o); }
+ bool _Valid() const { return _M_owner != 0; }
+ void _Invalidate() { _M_owner = 0; _M_next = 0; }
+ void _Link_to_self() { _M_next = 0; }
+
+ __owned_link* _Next() { return _M_next; }
+ const __owned_link* _Next() const { return _M_next; }
+
+public:
+#if defined(_STLP_WCE) && defined(_ARM_)
+ __owned_link* _M_self;
+#endif
+
+ __owned_list* _M_owner;
+ __owned_link* _M_next;
+};
+
+
+class _STLP_CLASS_DECLSPEC __owned_list {
+public:
+ __owned_list(void* __o) {
+ // fprintf(stderr, "__owned_list(): %p\n",(void*)this);
+ _M_node._M_owner = __REINTERPRET_CAST(__owned_list*,__o);
+ _M_node._M_next = 0;
+ }
+ ~__owned_list() {
+ // fprintf(stderr, "~__owned_list(): %p\n",(void*)this);
+ _Invalidate_all();
+ // that prevents detach
+ _M_node._Invalidate();
+ }
+ const void* _Owner() const { return (const void*)_M_node._M_owner; }
+ void* _Owner() { return (void*)_M_node._M_owner; }
+ bool _Valid() const { return _M_node._M_owner != 0; }
+ void _Invalidate() { _M_node._M_owner = 0; }
+
+ __owned_link* _First() { return _M_node._Next(); }
+ __owned_link* _Last() { return 0 ; }
+
+ const __owned_link* _First() const { return (__owned_link*)_M_node._M_next; }
+ const __owned_link* _Last() const { return 0 ;}
+
+ void _Verify() const { __stl_debugger::_Verify(this); }
+ void _Swap_owners(__owned_list& __y) { __stl_debugger::_Swap_owners(*this, __y); }
+ void _Invalidate_all() { __stl_debugger::_Invalidate_all(this); }
+ void _Set_owner(__owned_list& __y) { __stl_debugger::_Set_owner(*this, __y); }
+
+ mutable __owned_link _M_node;
+ mutable _STLP_mutex _M_lock;
+
+private:
+ // should never be called, should be left not implemented,
+ // but some compilers complain about it ;(
+ __owned_list(const __owned_list&){}
+ __owned_list& operator = (const __owned_list&) { return *this; }
+
+ friend class __owned_link;
+ friend class __stl_debug_engine<bool>;
+};
+
+
+//==========================================================
+
+// forward declaratioins
+
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator&, const _Iterator&);
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator&,
+ const _Iterator&, const _Iterator&);
+template <class _Iterator>
+bool _STLP_CALL __check_range(const _Iterator&, const _Iterator& ,
+ const _Iterator&, const _Iterator& );
+template <class _Tp>
+bool _STLP_CALL __check_ptr_range(const _Tp*, const _Tp*);
+
+template <class _Iterator>
+void _STLP_CALL __invalidate_range(const __owned_list* __base,
+ const _Iterator& __first,
+ const _Iterator& __last);
+
+template <class _Iterator>
+void _STLP_CALL __invalidate_iterator(const __owned_list* __base,
+ const _Iterator& __it);
+
+template <class _Iterator>
+void _STLP_CALL __change_range_owner(const _Iterator& __first,
+ const _Iterator& __last,
+ const __owned_list* __dst);
+
+template <class _Iterator>
+void _STLP_CALL __change_ite_owner(const _Iterator& __it,
+ const __owned_list* __dst);
+
+//============================================================
+inline bool _STLP_CALL
+__check_same_owner(const __owned_link& __i1, const __owned_link& __i2)
+{ return __stl_debugger::_Check_same_owner(__i1,__i2); }
+
+inline bool _STLP_CALL
+__check_same_or_null_owner(const __owned_link& __i1, const __owned_link& __i2)
+{ return __stl_debugger::_Check_same_or_null_owner(__i1,__i2); }
+
+template <class _Iterator>
+inline bool _STLP_CALL __check_if_owner( const __owned_list* __owner,
+ const _Iterator& __it)
+{ return __stl_debugger::_Check_if_owner(__owner, (const __owned_link&)__it); }
+
+template <class _Iterator>
+inline bool _STLP_CALL __check_if_not_owner( const __owned_list* __owner,
+ const _Iterator& __it)
+{ return __stl_debugger::_Check_if_not_owner(__owner, (const __owned_link&)__it); }
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#else
+# define _STLP_VERBOSE_ASSERT(expr, diagnostic)
+# define _STLP_DEBUG_CHECK(expr)
+#endif /* _STLP_DEBUG */
+
+#if defined (_STLP_ASSERTIONS)
+
+# if !defined (_STLP_ASSERT_MSG_TRAILER)
+# define _STLP_ASSERT_MSG_TRAILER
+# endif
+
+// dwa 12/30/98 - if _STLP_DEBUG_MESSAGE is defined, the user can supply own definition.
+# if !defined (_STLP_DEBUG_MESSAGE)
+# define __stl_debug_message __stl_debugger::_Message
+# else
+extern void __stl_debug_message(const char * format_str, ...);
+# endif
+
+// fbp: if _STLP_DEBUG_TERMINATE is defined, the user can supply own definition.
+# if !defined (_STLP_DEBUG_TERMINATE)
+# define __stl_debug_terminate __stl_debugger::_Terminate
+# else
+extern void __stl_debug_terminate();
+# endif
+
+#endif
+
+#if defined (_STLP_ASSERTIONS) && !defined (_STLP_LINK_TIME_INSTANTIATION)
+# include <stl/debug/_debug.c>
+#endif
+
+#endif /* DEBUG_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/debug/_deque.h b/stlport/stl/debug/_deque.h
new file mode 100644
index 0000000..f5c5ff5
--- /dev/null
+++ b/stlport/stl/debug/_deque.h
@@ -0,0 +1,414 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DBG_DEQUE_H
+#define _STLP_INTERNAL_DBG_DEQUE_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#define _STLP_NON_DBG_DEQUE _STLP_PRIV _STLP_NON_DBG_NAME(deque) <_Tp,_Alloc>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Tp, class _Alloc>
+inline _Tp* value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_DEQUE >&)
+{ return (_Tp*)0; }
+template <class _Tp, class _Alloc>
+inline random_access_iterator_tag iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_DEQUE >&)
+{ return random_access_iterator_tag(); }
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class deque :
+#if !defined (__DMC__)
+ private
+#endif
+ _STLP_PRIV __construct_checker<_STLP_NON_DBG_DEQUE >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ , public __stlport_class<deque<_Tp, _Alloc> >
+#endif
+{
+ typedef deque<_Tp,_Alloc> _Self;
+ typedef _STLP_NON_DBG_DEQUE _Base;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_DEQUE > _ConstructCheck;
+
+public:
+ // Basic types
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+ // Iterators
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > > const_iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+protected:
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+ void _Invalidate_all()
+ { _M_iter_list._Invalidate_all(); }
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+public:
+ // Basic accessors
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ reference operator[](size_type __n) {
+ _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+ const_reference operator[](size_type __n) const {
+ _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+
+ reference at(size_type __n) { return _M_non_dbg_impl.at(__n); }
+ const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); }
+
+ reference front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ const_reference front() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ reference back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+ const_reference back() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+
+ // Constructor, destructor.
+ explicit deque(const allocator_type& __a = allocator_type()) :
+ _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
+ deque(const _Self& __x) :
+ _ConstructCheck(__x), _M_non_dbg_impl(__x._M_non_dbg_impl),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(size_type __n, const value_type& __x = _Tp(),
+#else
+ deque(size_type __n, const value_type& __x,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type()) :
+ _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(size_type __n) :
+ _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ deque(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
+ _M_iter_list(&_M_non_dbg_impl) {
+ }
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
+ _M_iter_list(&_M_non_dbg_impl) {
+ }
+# endif
+#else
+ deque(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first, __last, __a),
+ _M_iter_list(&_M_non_dbg_impl) {
+ }
+
+ deque(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
+ _M_iter_list(&_M_non_dbg_impl) {
+ }
+#endif
+
+ _Self& operator=(const _Self& __x) {
+ if (this != &__x) {
+ _Invalidate_all();
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+
+ void swap(_Self& __x) {
+ _M_iter_list._Swap_owners(__x._M_iter_list);
+ _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public:
+ void assign(size_type __n, const _Tp& __val) {
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void assign(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
+ }
+ void assign(const value_type *__first, const value_type *__last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__first, __last);
+ }
+#endif
+
+public: // push_* and pop_*
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back(const value_type& __t = _Tp()) {
+#else
+ void push_back(const value_type& __t) {
+#endif
+ _Invalidate_all();
+ _M_non_dbg_impl.push_back(__t);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back() {
+ _Invalidate_all();
+ _M_non_dbg_impl.push_back();
+ }
+#endif
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __t = _Tp()) {
+#else
+ void push_front(const value_type& __t) {
+#endif
+ _Invalidate_all();
+ _M_non_dbg_impl.push_front(__t);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front() {
+ _Invalidate_all();
+ _M_non_dbg_impl.push_front();
+ }
+#endif
+
+ void pop_back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(end());
+ _M_non_dbg_impl.pop_back();
+ }
+
+ void pop_front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(begin());
+ _M_non_dbg_impl.pop_front();
+ }
+
+public: // Insert
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const value_type& __x) {
+#endif
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Invalidate_all();
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Invalidate_all();
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator));
+ }
+#endif
+
+ void insert(iterator __pos, size_type __n, const value_type& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ if (__n != 0) _Invalidate_all();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ // We perform invalidate first to detect self referencing in __check_range as __first and __last
+ // will have been invalidated.
+ if (__first != __last) _Invalidate_all();
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ void insert(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ if (__first != __last) _Invalidate_all();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ //Sequence requirements 23.1.1 Table 67:
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first));
+ if (__first != __last) _Invalidate_all();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+
+ void insert(iterator __pos,
+ iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ //Sequence requirements 23.1.1 Table 67:
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first));
+ if (__first != __last) _Invalidate_all();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+#endif
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _Tp()) {
+#else
+ void resize(size_type __new_size, const value_type& __x) {
+#endif
+ if (__new_size != size()) {
+ if ((__new_size > size()) || (__new_size < size() - 1))
+ _Invalidate_all();
+ else
+ _Invalidate_iterator(end());
+ }
+ _M_non_dbg_impl.resize(__new_size, __x);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type new_size) { resize(new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif
+
+ // Erase
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ if (__pos._M_iterator == _M_non_dbg_impl.begin()) {
+ _Invalidate_iterator(__pos);
+ } else {
+ typename _Base::iterator tmp = --(_M_non_dbg_impl.end());
+ if (__pos._M_iterator == tmp)
+ _Invalidate_iterator(__pos);
+ else
+ _Invalidate_all();
+ }
+ return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ if (!empty()) {
+ if (__first._M_iterator == _M_non_dbg_impl.begin() ||
+ __last._M_iterator == _M_non_dbg_impl.end())
+ _Invalidate_iterators(__first, __last);
+ else
+ _Invalidate_all();
+ }
+ return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
+ }
+
+ void clear() {
+ _Invalidate_all();
+ _M_non_dbg_impl.clear();
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_DEQUE
+
+#endif /* _STLP_INTERNAL_DEQUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/debug/_hashtable.h b/stlport/stl/debug/_hashtable.h
new file mode 100644
index 0000000..523f7e3
--- /dev/null
+++ b/stlport/stl/debug/_hashtable.h
@@ -0,0 +1,340 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DBG_HASHTABLE_H
+#define _STLP_INTERNAL_DBG_HASHTABLE_H
+
+// Hashtable class, used to implement the hashed associative containers
+// hash_set, hash_map, hash_multiset, and hash_multimap,
+// unordered_set, unordered_map, unordered_multiset, unordered_multimap
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Key, class _Equal>
+class _DbgEqual {
+public:
+ _DbgEqual() {}
+ _DbgEqual(const _Equal& __eq) : _M_non_dbg_eq(__eq) {}
+ _DbgEqual(const _DbgEqual& __eq) : _M_non_dbg_eq(__eq._M_non_dbg_eq) {}
+
+#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
+ bool operator () (const _Key& __lhs, const _Key& __rhs) const
+#else
+ template <class _Kp1, class _Kp2>
+ bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const
+#endif
+ {
+#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
+ _STLP_VERBOSE_ASSERT(_M_non_dbg_eq(__rhs, __lhs) == _M_non_dbg_eq(__lhs, __rhs), _StlMsg_INVALID_EQUIVALENT_PREDICATE)
+#endif
+ return _M_non_dbg_eq(__lhs, __rhs) ? true : false;
+ }
+
+ _Equal non_dbg_key_eq() const { return _M_non_dbg_eq; }
+private:
+ _Equal _M_non_dbg_eq;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+#define _STLP_NON_DBG_HT \
+_STLP_PRIV _STLP_NON_DBG_NAME(hashtable) <_Val, _Key, _HF, _Traits, _ExK, _STLP_PRIV _DbgEqual<_Key, _EqK>, _All>
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Val, class _Key, class _HF,
+ class _ExK, class _EqK, class _All>
+inline _Val*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_HT >&)
+{ return (_Val*)0; }
+
+template <class _Val, class _Key, class _HF,
+ class _ExK, class _EqK, class _All>
+inline forward_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_HT >&)
+{ return forward_iterator_tag(); }
+#endif
+
+template <class _Val, class _Key, class _HF,
+ class _Traits, class _ExK, class _EqK, class _All>
+class hashtable {
+ typedef hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> _Self;
+ typedef _STLP_NON_DBG_HT _Base;
+
+ typedef typename _Traits::_NonConstTraits _NonConstTraits;
+ typedef typename _Traits::_ConstTraits _ConstTraits;
+ typedef typename _Traits::_NonConstLocalTraits _NonConstLocalTraits;
+ typedef typename _Traits::_ConstLocalTraits _ConstLocalTraits;
+
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+public:
+ typedef _Key key_type;
+ typedef _HF hasher;
+ typedef _EqK key_equal;
+
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstTraits> > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstTraits> > const_iterator;
+ //typedef _STLP_PRIV _DBG_iter<_Base, _DbgTraits<_NonConstLocalTraits> > local_iterator;
+ typedef iterator local_iterator;
+ //typedef _STLP_PRIV _DBG_iter<_Base, _DbgTraits<_ConstLocalTraits> > const_local_iterator;
+ typedef const_iterator const_local_iterator;
+
+ typedef typename _Base::iterator _Base_iterator;
+ typedef typename _Base::const_iterator _Base_const_iterator;
+
+ hasher hash_funct() const { return _M_non_dbg_impl.hash_funct(); }
+ key_equal key_eq() const { return _M_non_dbg_impl.key_eq().non_dbg_key_eq(); }
+
+private:
+ void _Invalidate_iterator(const const_iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const const_iterator& __first, const const_iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+public:
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const _ExK& __ext,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __hf, __eql, __ext, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ hashtable(size_type __n,
+ const _HF& __hf,
+ const _EqK& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __hf, __eql, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ hashtable(const _Self& __ht)
+ : _M_non_dbg_impl(__ht._M_non_dbg_impl),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ hashtable(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+
+ _Self& operator=(const _Self& __ht) {
+ if (this != &__ht) {
+ //Should not invalidate end iterator
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl = __ht._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ void swap(_Self& __ht) {
+ _M_iter_list._Swap_owners(__ht._M_iter_list);
+ _M_non_dbg_impl.swap(__ht._M_non_dbg_impl);
+ }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ local_iterator begin(size_type __n) {
+ //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return local_iterator(&_M_iter_list, _M_non_dbg_impl.begin(__n));
+ }
+ local_iterator end(size_type __n) {
+ //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return local_iterator(&_M_iter_list, _M_non_dbg_impl.end(__n));
+ }
+
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_local_iterator begin(size_type __n) const {
+ //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return const_local_iterator(&_M_iter_list, _M_non_dbg_impl.begin(__n));
+ }
+ const_local_iterator end(size_type __n) const {
+ //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return const_local_iterator(&_M_iter_list, _M_non_dbg_impl.end(__n));
+ }
+
+ pair<iterator, bool> insert_unique(const value_type& __obj) {
+ pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__obj);
+ return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
+ }
+
+ iterator insert_equal(const value_type& __obj)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__obj)); }
+
+ pair<iterator, bool> insert_unique_noresize(const value_type& __obj) {
+ pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique_noresize(__obj);
+ return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
+ }
+
+ iterator insert_equal_noresize(const value_type& __obj)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal_noresize(__obj)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert_unique(_InputIterator __f, _InputIterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
+ }
+
+ template <class _InputIterator>
+ void insert_equal(_InputIterator __f, _InputIterator __l){
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
+ }
+
+#else
+ void insert_unique(const value_type* __f, const value_type* __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ _M_non_dbg_impl.insert_unique(__f, __l);
+ }
+
+ void insert_equal(const value_type* __f, const value_type* __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ _M_non_dbg_impl.insert_equal(__f, __l);
+ }
+
+ void insert_unique(const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_non_dbg_impl.insert_unique(__f._M_iterator, __l._M_iterator);
+ }
+
+ void insert_equal(const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _M_non_dbg_impl.insert_equal(__f._M_iterator, __l._M_iterator);
+ }
+#endif
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __key)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__key)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __key) const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__key)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __key) const { return _M_non_dbg_impl.count(__key); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __key) {
+ pair<_Base_iterator, _Base_iterator> __res = _M_non_dbg_impl.equal_range(__key);
+ return pair<iterator,iterator> (iterator(&_M_iter_list,__res.first),
+ iterator(&_M_iter_list,__res.second));
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __key) const {
+ pair <_Base_const_iterator, _Base_const_iterator> __res = _M_non_dbg_impl.equal_range(__key);
+ return pair<const_iterator,const_iterator> (const_iterator(&_M_iter_list,__res.first),
+ const_iterator(&_M_iter_list,__res.second));
+ }
+
+ size_type erase(const key_type& __key) {
+ pair<iterator, iterator> __p = equal_range(__key);
+ size_type __n = _STLP_STD::distance(__p.first, __p.second);
+ _Invalidate_iterators(__p.first, __p.second);
+ _M_non_dbg_impl.erase(__p.first._M_iterator, __p.second._M_iterator);
+ return __n;
+ }
+
+ void erase(const const_iterator& __it) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__it))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __it))
+ _Invalidate_iterator(__it);
+ _M_non_dbg_impl.erase(__it._M_iterator);
+ }
+ void erase(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last,
+ const_iterator(begin()), const_iterator(end())))
+ _Invalidate_iterators(__first, __last);
+ _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator);
+ }
+
+ void rehash(size_type __num_buckets_hint) { _M_non_dbg_impl.rehash(__num_buckets_hint); }
+ void resize(size_type __num_elements_hint) { _M_non_dbg_impl.resize(__num_elements_hint); }
+
+ void clear() {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.clear();
+ }
+
+ reference _M_insert(const value_type& __obj) { return _M_non_dbg_impl._M_insert(__obj); }
+
+ size_type bucket_count() const { return _M_non_dbg_impl.bucket_count(); }
+ size_type max_bucket_count() const { return _M_non_dbg_impl.max_bucket_count(); }
+ size_type elems_in_bucket(size_type __n) const {
+ _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.elems_in_bucket(__n);
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type bucket(const _KT& __k) const { return _M_non_dbg_impl.bucket(__k); }
+
+ float load_factor() const { return _M_non_dbg_impl.load_factor(); }
+ float max_load_factor() const { return _M_non_dbg_impl.max_load_factor(); }
+ void max_load_factor(float __z) {
+ _STLP_VERBOSE_ASSERT((__z > 0.0f), _StlMsg_INVALID_ARGUMENT)
+ _M_non_dbg_impl.max_load_factor(__z);
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_HT
+
+#endif /* _STLP_INTERNAL_HASHTABLE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/debug/_iterator.h b/stlport/stl/debug/_iterator.h
new file mode 100644
index 0000000..b2c8956
--- /dev/null
+++ b/stlport/stl/debug/_iterator.h
@@ -0,0 +1,457 @@
+/*
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_DBG_ITERATOR_H
+#define _STLP_DBG_ITERATOR_H
+
+#ifndef _STLP_INTERNAL_PAIR_H
+# include <stl/_pair.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+//============================================================
+
+template <class _Iterator>
+void _Decrement(_Iterator& __it, const bidirectional_iterator_tag &)
+{ --__it; }
+
+template <class _Iterator>
+void _Decrement(_Iterator& __it, const random_access_iterator_tag &)
+{ --__it; }
+
+template <class _Iterator>
+void _Decrement(_Iterator& __it, const forward_iterator_tag &)
+{ _STLP_ASSERT(0) }
+
+template <class _Iterator>
+void _Advance(_Iterator&, ptrdiff_t, const forward_iterator_tag &)
+{ _STLP_ASSERT(0) }
+
+template <class _Iterator>
+void _Advance(_Iterator& __it, ptrdiff_t, const bidirectional_iterator_tag &)
+{ _STLP_ASSERT(0) }
+
+template <class _Iterator>
+void _Advance(_Iterator& __it, ptrdiff_t __n, const random_access_iterator_tag &)
+{ __it += __n; }
+
+template <class _Iterator>
+ptrdiff_t _DBG_distance(const _Iterator& __x, const _Iterator& __y, const random_access_iterator_tag &)
+{ return __x - __y; }
+
+template <class _Iterator>
+ptrdiff_t _DBG_distance(const _Iterator&, const _Iterator&, const forward_iterator_tag &) {
+ _STLP_ASSERT(0)
+ return 0;
+}
+
+template <class _Iterator>
+ptrdiff_t _DBG_distance(const _Iterator&, const _Iterator&, const bidirectional_iterator_tag &) {
+ _STLP_ASSERT(0)
+ return 0;
+}
+
+template <class _Iterator>
+bool _CompareIt(const _Iterator&, const _Iterator&, const forward_iterator_tag &) {
+ _STLP_ASSERT(0)
+ return false;
+}
+
+template <class _Iterator>
+bool _CompareIt(const _Iterator&, const _Iterator&, const bidirectional_iterator_tag &) {
+ _STLP_ASSERT(0)
+ return false;
+}
+
+template <class _Iterator>
+bool _CompareIt(const _Iterator& __x, const _Iterator& __y, const random_access_iterator_tag &)
+{ return __x < __y; }
+
+template <class _Iterator>
+bool _Dereferenceable(const _Iterator& __it)
+{ return (__it._Get_container_ptr() != 0) && !(__it._M_iterator == (__it._Get_container_ptr())->end()); }
+
+template <class _Iterator>
+bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const forward_iterator_tag &)
+{ return (__n == 1) && _Dereferenceable(__it); }
+
+template <class _Iterator>
+bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const bidirectional_iterator_tag &) {
+ typedef typename _Iterator::_Container_type __container_type;
+ __container_type* __c = __it._Get_container_ptr();
+ return (__c != 0) && ((__n == 1 && __it._M_iterator != __c->end() ) ||
+ (__n == -1 && __it._M_iterator != __c->begin()));
+}
+
+template <class _Iterator>
+bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const random_access_iterator_tag &) {
+ typedef typename _Iterator::_Container_type __container_type;
+ __container_type* __c = __it._Get_container_ptr();
+ if (__c == 0) return false;
+ ptrdiff_t __new_pos = (__it._M_iterator - __c->begin()) + __n;
+ return (__new_pos >= 0) && (__STATIC_CAST(typename __container_type::size_type, __new_pos) <= __c->size());
+}
+
+
+template <class _Container>
+struct _DBG_iter_base : public __owned_link {
+public:
+ typedef typename _Container::value_type value_type;
+ typedef typename _Container::reference reference;
+ typedef typename _Container::pointer pointer;
+ typedef ptrdiff_t difference_type;
+ //private:
+ typedef typename _Container::iterator _Nonconst_iterator;
+ typedef typename _Container::const_iterator _Const_iterator;
+ typedef _Container _Container_type;
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ typedef typename iterator_traits<_Const_iterator>::iterator_category _Iterator_category;
+#else
+ typedef typename _Container::_Iterator_category _Iterator_category;
+#endif
+ typedef _Iterator_category iterator_category;
+
+ _DBG_iter_base() : __owned_link(0) {}
+ _DBG_iter_base(const __owned_list* __c, const _Const_iterator& __it) :
+#if defined(__HP_aCC) && (__HP_aCC < 60000)
+ __owned_link(__c), _M_iterator(*__REINTERPRET_CAST(const _Nonconst_iterator *, &__it)) {}
+#else
+ __owned_link(__c), _M_iterator(*(const _Nonconst_iterator*)&__it) {}
+#endif
+ _Container* _Get_container_ptr() const {
+ return (_Container*)__stl_debugger::_Get_container_ptr(this);
+ }
+
+ void __increment();
+ void __decrement();
+ void __advance(ptrdiff_t __n);
+
+// protected:
+ _Nonconst_iterator _M_iterator;
+};
+
+template <class _Container>
+inline void _DBG_iter_base<_Container>::__increment() {
+ _STLP_DEBUG_CHECK(_Incrementable(*this, 1, _Iterator_category()))
+ ++_M_iterator;
+}
+
+template <class _Container>
+inline void _DBG_iter_base<_Container>::__decrement() {
+ _STLP_DEBUG_CHECK(_Incrementable(*this, -1, _Iterator_category()))
+ _Decrement(_M_iterator, _Iterator_category());
+}
+
+template <class _Container>
+inline void _DBG_iter_base<_Container>::__advance(ptrdiff_t __n) {
+ _STLP_DEBUG_CHECK(_Incrementable(*this, __n, _Iterator_category()))
+ _Advance(_M_iterator, __n, _Iterator_category());
+}
+
+template <class _Container>
+ptrdiff_t operator-(const _DBG_iter_base<_Container>& __x,
+ const _DBG_iter_base<_Container>& __y ) {
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Iterator_category;
+ _STLP_DEBUG_CHECK(__check_same_owner(__x, __y))
+ return _DBG_distance(__x._M_iterator,__y._M_iterator, _Iterator_category());
+}
+
+template <class _Container, class _Traits>
+struct _DBG_iter_mid : public _DBG_iter_base<_Container> {
+ typedef _DBG_iter_mid<_Container, typename _Traits::_NonConstTraits> _Nonconst_self;
+ typedef typename _Container::iterator _Nonconst_iterator;
+ typedef typename _Container::const_iterator _Const_iterator;
+
+ _DBG_iter_mid() {}
+
+ explicit _DBG_iter_mid(const _Nonconst_self& __it) :
+ _DBG_iter_base<_Container>(__it) {}
+
+ _DBG_iter_mid(const __owned_list* __c, const _Const_iterator& __it) :
+ _DBG_iter_base<_Container>(__c, __it) {}
+};
+
+template <class _Container, class _Traits>
+struct _DBG_iter : public _DBG_iter_mid<_Container, _Traits> {
+ typedef _DBG_iter_base<_Container> _Base;
+public:
+ typedef typename _Base::value_type value_type;
+ typedef typename _Base::difference_type difference_type;
+ typedef typename _Traits::reference reference;
+ typedef typename _Traits::pointer pointer;
+
+ typedef typename _Base::_Nonconst_iterator _Nonconst_iterator;
+ typedef typename _Base::_Const_iterator _Const_iterator;
+
+private:
+ typedef _DBG_iter<_Container, _Traits> _Self;
+ typedef _DBG_iter_mid<_Container, typename _Traits::_NonConstTraits> _Nonconst_mid;
+
+public:
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+ typedef typename _Base::iterator_category iterator_category;
+#endif
+ typedef typename _Base::_Iterator_category _Iterator_category;
+
+public:
+ _DBG_iter() {}
+ // boris : real type of iter would be nice
+ _DBG_iter(const __owned_list* __c, const _Const_iterator& __it) :
+ _DBG_iter_mid<_Container, _Traits>(__c, __it) {}
+
+ // This allows conversions from iterator to const_iterator without being
+ // redundant with the copy constructor below.
+ _DBG_iter(const _Nonconst_mid& __rhs) :
+ _DBG_iter_mid<_Container, _Traits>(__rhs) {}
+
+ _DBG_iter(const _Self& __rhs) :
+ _DBG_iter_mid<_Container, _Traits>(__rhs) {}
+
+ // This allows conversions from iterator to const_iterator without being
+ // redundant with the copy assignment operator below.
+ _Self& operator=(const _Nonconst_mid& __rhs) {
+ (_Base&)*this = __rhs;
+ return *this;
+ }
+
+ _Self& operator=(const _Self& __rhs) {
+ (_Base&)*this = __rhs;
+ return *this;
+ }
+
+ reference operator*() const;
+
+ _STLP_DEFINE_ARROW_OPERATOR
+
+ _Self& operator++() {
+ this->__increment();
+ return *this;
+ }
+ _Self operator++(int) {
+ _Self __tmp = *this;
+ this->__increment();
+ return __tmp;
+ }
+ _Self& operator--() {
+ this->__decrement();
+ return *this;
+ }
+ _Self operator--(int) {
+ _Self __tmp = *this;
+ this->__decrement();
+ return __tmp;
+ }
+
+ _Self& operator+=(difference_type __n) {
+ this->__advance(__n);
+ return *this;
+ }
+
+ _Self& operator-=(difference_type __n) {
+ this->__advance(-__n);
+ return *this;
+ }
+ _Self operator+(difference_type __n) const {
+ _Self __tmp(*this);
+ __tmp.__advance(__n);
+ return __tmp;
+ }
+ _Self operator-(difference_type __n) const {
+ _Self __tmp(*this);
+ __tmp.__advance(-__n);
+ return __tmp;
+ }
+ reference operator[](difference_type __n) const { return *(*this + __n); }
+};
+
+template <class _Container, class _Traits>
+inline
+#if defined (_STLP_NESTED_TYPE_PARAM_BUG)
+_STLP_TYPENAME_ON_RETURN_TYPE _Traits::reference
+#else
+_STLP_TYPENAME_ON_RETURN_TYPE _DBG_iter<_Container, _Traits>::reference
+#endif
+_DBG_iter<_Container, _Traits>::operator*() const {
+ _STLP_DEBUG_CHECK(_Dereferenceable(*this))
+ _STLP_DEBUG_CHECK(_Traits::_Check(*this))
+ return *this->_M_iterator;
+}
+
+template <class _Container>
+inline bool
+operator==(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) {
+ _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
+ return __x._M_iterator == __y._M_iterator;
+}
+
+template <class _Container>
+inline bool
+operator<(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) {
+ _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return _CompareIt(__x._M_iterator , __y._M_iterator, _Category());
+}
+
+template <class _Container>
+inline bool
+operator>(const _DBG_iter_base<_Container>& __x,
+ const _DBG_iter_base<_Container>& __y) {
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return _CompareIt(__y._M_iterator , __x._M_iterator, _Category());
+}
+
+template <class _Container>
+inline bool
+operator>=(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) {
+ _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return !_CompareIt(__x._M_iterator , __y._M_iterator, _Category());
+}
+
+template <class _Container>
+inline bool
+operator<=(const _DBG_iter_base<_Container>& __x,
+ const _DBG_iter_base<_Container>& __y) {
+ typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return !_CompareIt(__y._M_iterator , __x._M_iterator, _Category());
+}
+
+template <class _Container>
+inline bool
+operator!=(const _DBG_iter_base<_Container>& __x,
+ const _DBG_iter_base<_Container>& __y) {
+ _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y))
+ return __x._M_iterator != __y._M_iterator;
+}
+
+//------------------------------------------
+
+template <class _Container, class _Traits>
+inline _DBG_iter<_Container, _Traits>
+operator+(ptrdiff_t __n, const _DBG_iter<_Container, _Traits>& __it) {
+ _DBG_iter<_Container, _Traits> __tmp(__it);
+ return __tmp += __n;
+}
+
+
+template <class _Iterator>
+inline _Iterator _Non_Dbg_iter(_Iterator __it)
+{ return __it; }
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _Container, class _Traits>
+inline typename _DBG_iter<_Container, _Traits>::_Nonconst_iterator
+_Non_Dbg_iter(const _DBG_iter<_Container, _Traits>& __it)
+{ return __it._M_iterator; }
+#endif
+
+/*
+ * Helper classes to check iterator range or pointer validity
+ * at construction time.
+ */
+template <class _Container>
+class __construct_checker {
+ typedef typename _Container::value_type value_type;
+protected:
+ __construct_checker() {}
+
+ __construct_checker(const value_type* __p) {
+ _STLP_VERBOSE_ASSERT((__p != 0), _StlMsg_INVALID_ARGUMENT)
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ __construct_checker(const _InputIter& __f, const _InputIter& __l) {
+ typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
+ _M_check_dispatch(__f, __l, _Integral());
+ }
+
+ template <class _Integer>
+ void _M_check_dispatch(_Integer , _Integer, const __true_type& /*IsIntegral*/) {}
+
+ template <class _InputIter>
+ void _M_check_dispatch(const _InputIter& __f, const _InputIter& __l, const __false_type& /*IsIntegral*/) {
+ _STLP_DEBUG_CHECK(__check_range(__f,__l))
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ __construct_checker(const value_type* __f, const value_type* __l) {
+ _STLP_DEBUG_CHECK(__check_ptr_range(__f,__l))
+ }
+
+ typedef _DBG_iter_base<_Container> _IteType;
+ __construct_checker(const _IteType& __f, const _IteType& __l) {
+ _STLP_DEBUG_CHECK(__check_range(__f,__l))
+ }
+#endif
+#if defined (__BORLANDC__)
+ ~__construct_checker(){}
+#endif
+};
+
+#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
+# if defined (_STLP_NESTED_TYPE_PARAM_BUG) ||\
+ (defined (__SUNPRO_CC) && __SUNPRO_CC < 0x600)
+# define _STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS 1
+# endif
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Container>
+inline ptrdiff_t*
+distance_type(const _STLP_PRIV _DBG_iter_base<_Container>&) { return (ptrdiff_t*) 0; }
+
+# if !defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Container>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _DBG_iter_base<_Container>::value_type*
+value_type(const _STLP_PRIV _DBG_iter_base<_Container>&) {
+ typedef _STLP_TYPENAME _STLP_PRIV _DBG_iter_base<_Container>::value_type _Val;
+ return (_Val*)0;
+}
+
+template <class _Container>
+inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _DBG_iter_base<_Container>::_Iterator_category
+iterator_category(const _STLP_PRIV _DBG_iter_base<_Container>&) {
+ typedef _STLP_TYPENAME _STLP_PRIV _DBG_iter_base<_Container>::_Iterator_category _Category;
+ return _Category();
+}
+# endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* INTERNAL_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/debug/_list.h b/stlport/stl/debug/_list.h
new file mode 100644
index 0000000..c45e1e7
--- /dev/null
+++ b/stlport/stl/debug/_list.h
@@ -0,0 +1,495 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DBG_LIST_H
+#define _STLP_INTERNAL_DBG_LIST_H
+
+#ifndef _STLP_INTERNAL_ALGO_H
+# include <stl/_algo.h>
+#endif
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#define _STLP_NON_DBG_LIST _STLP_PRIV _STLP_NON_DBG_NAME(list) <_Tp, _Alloc>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Tp, class _Alloc>
+inline _Tp*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&)
+{ return (_Tp*)0; }
+template <class _Tp, class _Alloc>
+inline bidirectional_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&)
+{ return bidirectional_iterator_tag(); }
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class list :
+#if !defined (__DMC__)
+ private
+#endif
+ _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ , public __stlport_class<list<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_NON_DBG_LIST _Base;
+ typedef list<_Tp, _Alloc> _Self;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST > _ConstructCheck;
+
+public:
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+public:
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > > const_iterator;
+
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+private:
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ typedef typename _Base::iterator _Base_iterator;
+
+public:
+ explicit list(const allocator_type& __a = allocator_type()) :
+ _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n, const _Tp& __x = _Tp(),
+#else
+ list(size_type __n, const _Tp& __x,
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n)
+ : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ list(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# endif
+#else
+
+ list(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first, __last, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+ list(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+#endif
+
+ list(const _Self& __x) :
+ _ConstructCheck(__x),
+ _M_non_dbg_impl(__x._M_non_dbg_impl) , _M_iter_list(&_M_non_dbg_impl) {}
+
+ _Self& operator=(const _Self& __x) {
+ if (this != &__x) {
+ //Should not invalidate end iterator
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+
+ // those are here to enforce checking
+ reference front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ const_reference front() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ reference back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+ const_reference back() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+
+ void swap(_Self& __x) {
+ _M_iter_list._Swap_owners(__x._M_iter_list);
+ _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const _Tp& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const _Tp& __x) {
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ return iterator(&_M_iter_list,_M_non_dbg_impl.insert(__pos._M_iterator, __x) );
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ void insert(iterator __pos, const _Tp* __first, const _Tp* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first))
+# endif
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+ void insert(iterator __pos,
+ iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first))
+# endif
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+#endif
+
+ void insert(iterator __pos, size_type __n, const _Tp& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
+ }
+
+ void push_back(const_reference __x) { _M_non_dbg_impl.push_back(__x); }
+ void pop_back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(end());
+ _M_non_dbg_impl.pop_back();
+ }
+
+ void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); }
+ void pop_front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(begin());
+ _M_non_dbg_impl.pop_front();
+ }
+
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _Invalidate_iterator(__pos);
+ return iterator(&_M_iter_list,_M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _Invalidate_iterators(__first, __last);
+ return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const _Tp& __x = _Tp()) {
+#else
+ void resize(size_type __new_size, const _Tp& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _Base_iterator __i = _M_non_dbg_impl.begin();
+ size_type __len = 0;
+ for ( ; __i != _M_non_dbg_impl.end() && __len < __new_size; ++__i, ++__len);
+
+ if (__len == __new_size)
+ erase(iterator(&_M_iter_list, __i), end());
+ else // __i == end()
+ _M_non_dbg_impl.insert(_M_non_dbg_impl.end(), __new_size - __len, __x);
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ _Invalidate_iterators(begin(), end());
+ }
+#else
+ void assign(const _Tp* __first, const _Tp* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.assign(__first, __last);
+ _Invalidate_iterators(begin(), end());
+ }
+
+ void assign(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
+ _Invalidate_iterators(begin(), end());
+ }
+
+ void assign(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
+ _Invalidate_iterators(begin(), end());
+ }
+#endif
+
+ void assign(size_type __n, const _Tp& __val) {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+ void remove(const _Tp& __x) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ while (__first != __last) {
+ _Base_iterator __next = __first;
+ ++__next;
+ if (__x == *__first) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __first));
+ _M_non_dbg_impl.erase(__first);
+ }
+ __first = __next;
+ }
+ }
+
+ void clear() {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.clear();
+ }
+
+public:
+ void splice(iterator __pos, _Self& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl);
+#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
+ if (get_allocator() == __x.get_allocator())
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ else
+#endif
+ // Std: 23.2.2.4:4
+ // end iterator is not invalidated:
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+
+ void splice(iterator __pos, _Self& __x, iterator __i) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&(__x._M_iter_list),__i))
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator);
+#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
+ if (get_allocator() == __x.get_allocator())
+ _STLP_PRIV __change_ite_owner(__i, &_M_iter_list);
+ else
+#endif
+ // Std: 23.2.2.4:7
+ __x._Invalidate_iterator(__i);
+ }
+
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end()))
+ _STLP_DEBUG_CHECK(this == &__x ? !_STLP_PRIV __check_range(__pos, __first, __last) : true)
+#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL)
+ if (this->get_allocator() == __x.get_allocator())
+ _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
+ else
+#endif
+ // Std: 23.2.2.4:12
+ __x._Invalidate_iterators(__first, __last);
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __first._M_iterator, __last._M_iterator);
+ }
+
+ void merge(_Self& __x) {
+#if !defined (_STLP_NO_EXTENSIONS)
+ _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(begin()._M_iterator, end()._M_iterator))
+ _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator))
+#endif
+ _M_non_dbg_impl.merge(__x._M_non_dbg_impl);
+ if (this->get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+ void reverse() {
+ _M_non_dbg_impl.reverse();
+ }
+ void unique() {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ if (__first == __last) return;
+ _Base_iterator __next = __first;
+ while (++__next != __last) {
+ if (*__first == *__next) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __next));
+ _M_non_dbg_impl.erase(__next);
+ }
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+ void sort() {
+ _M_non_dbg_impl.sort();
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ while (__first != __last) {
+ _Base_iterator __next = __first;
+ ++__next;
+ if (__pred(*__first)) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __first));
+ _M_non_dbg_impl.erase(__first);
+ }
+ __first = __next;
+ }
+ }
+
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __binary_pred) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ if (__first == __last) return;
+ _Base_iterator __next = __first;
+ while (++__next != __last) {
+ if (__binary_pred(*__first, *__next)) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __next));
+ _M_non_dbg_impl.erase(__next);
+ }
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x, _StrictWeakOrdering __comp) {
+#if !defined (_STLP_NO_EXTENSIONS)
+ _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __comp))
+ _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __comp))
+#endif
+ _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __comp);
+ if (this->get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp) {
+ _M_non_dbg_impl.sort(__comp);
+ }
+#endif
+};
+
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_LIST
+
+#endif /* _STLP_INTERNAL_LIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/debug/_slist.h b/stlport/stl/debug/_slist.h
new file mode 100644
index 0000000..2eeaf36
--- /dev/null
+++ b/stlport/stl/debug/_slist.h
@@ -0,0 +1,613 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DBG_SLIST_H
+#define _STLP_INTERNAL_DBG_SLIST_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#define _STLP_NON_DBG_SLIST _STLP_PRIV _STLP_NON_DBG_NAME(slist) <_Tp, _Alloc>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Tp, class _Alloc>
+inline _Tp*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
+{ return (_Tp*)0; }
+
+template <class _Tp, class _Alloc>
+inline forward_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&)
+{ return forward_iterator_tag(); }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*
+ * slist special debug traits version.
+ */
+template <class _Traits>
+struct _SlistDbgTraits : _Traits {
+ typedef _SlistDbgTraits<typename _Traits::_ConstTraits> _ConstTraits;
+ typedef _SlistDbgTraits<typename _Traits::_NonConstTraits> _NonConstTraits;
+
+ /*
+ * We don't want the before_begin iterator to return false at _Dereferenceable
+ * call to do not break the current debug framework but calling * operator should
+ * fail.
+ */
+ template <class _Iterator>
+ static bool _Check(const _Iterator& __it)
+ { return !(__it._M_iterator == (__it._Get_container_ptr())->before_begin()); }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class slist :
+#if !defined (__DMC__)
+ private
+#endif
+ _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ , public __stlport_class<slist<_Tp, _Alloc> >
+#endif
+{
+private:
+ typedef _STLP_NON_DBG_SLIST _Base;
+ typedef slist<_Tp,_Alloc> _Self;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST > _ConstructCheck;
+
+public:
+
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Nonconst_traits<value_type> > > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Const_traits<value_type> > > const_iterator;
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+private:
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ typedef typename _Base::iterator _Base_iterator;
+
+public:
+ explicit slist(const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__a) , _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n, const value_type& __x = _Tp(),
+#else
+ slist(size_type __n, const value_type& __x,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n) : _M_non_dbg_impl(__n) , _M_iter_list(&_M_non_dbg_impl) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ slist(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# endif
+#else
+
+ slist(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first, __last, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ slist(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+#endif
+
+ slist(const _Self& __x) :
+ _ConstructCheck(__x),
+ _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
+
+ _Self& operator= (const _Self& __x) {
+ if (this != &__x) {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ ~slist() {}
+
+ void assign(size_type __n, const value_type& __val) {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+ iterator before_begin()
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
+ const_iterator before_begin() const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); }
+
+ iterator begin()
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin());}
+
+ iterator end()
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+
+ void swap(_Self& __x) {
+ _M_iter_list._Swap_owners(__x._M_iter_list);
+ _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ reference front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return _M_non_dbg_impl.front();
+ }
+ const_reference front() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return _M_non_dbg_impl.front();
+ }
+ void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); }
+ void pop_front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _M_non_dbg_impl.pop_front();
+ }
+ iterator previous(const_iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ return iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
+ }
+ const_iterator previous(const_iterator __pos) const {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ return const_iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator));
+ }
+
+public:
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert_after(iterator __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ return iterator(&_M_iter_list,_M_non_dbg_impl.insert_after(__pos._M_iterator, __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos) {
+ return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert_after(iterator __pos, size_type __n, const value_type& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _M_non_dbg_impl.insert_after(__pos._M_iterator, __n, __x);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void assign(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator);
+ }
+ void assign(const value_type *__first, const value_type *__last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.assign(__first, __last);
+ }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InIter>
+ void insert_after(iterator __pos, _InIter __first, _InIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert_after(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+
+ template <class _InIter>
+ void insert(iterator __pos, _InIter __first, _InIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void insert_after(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert_after(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+ void insert_after(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.insert_after(__pos._M_iterator, __first, __last);
+ }
+
+ void insert(iterator __pos, const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ }
+ void insert(iterator __pos, const value_type* __first,
+ const value_type* __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last))
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
+ }
+#endif
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos, const value_type& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos) {
+ return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp));
+ }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
+ }
+
+public:
+ iterator erase_after(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ iterator __tmp = __pos; ++__tmp;
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp))
+ _Invalidate_iterator(__tmp);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__pos._M_iterator));
+ }
+ iterator erase_after(iterator __before_first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __last, begin(), end()))
+ iterator __tmp = __before_first; ++__tmp;
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp))
+ _Invalidate_iterators(__tmp, __last);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__before_first._M_iterator, __last._M_iterator));
+ }
+
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_VERBOSE_ASSERT(__pos._M_iterator != _M_non_dbg_impl.before_begin(), _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Invalidate_iterator(__pos);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _Invalidate_iterators(__first, __last);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _Tp()) {
+#else
+ void resize(size_type __new_size, const value_type& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _M_non_dbg_impl.resize(__new_size, __x);
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear() {
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.clear();
+ }
+
+public:
+ // Removes all of the elements from the list __x to *this, inserting
+ // them immediately after __pos. __x must not be *this. Complexity:
+ // linear in __x.size().
+ void splice_after(iterator __pos, _Self& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
+ _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl);
+ if (get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+
+ // Moves the element that follows __prev to *this, inserting it immediately
+ // after __pos. This is constant time.
+ void splice_after(iterator __pos, _Self& __x, iterator __prev) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__prev))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __prev))
+ iterator __elem = __prev; ++__elem;
+ _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl, __prev._M_iterator);
+ if (get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV __change_ite_owner(__elem, &_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterator(__elem);
+ }
+ }
+
+ // Moves the range [__before_first + 1, __before_last + 1) to *this,
+ // inserting it immediately after __pos. This is constant time.
+ void splice_after(iterator __pos, _Self& __x,
+ iterator __before_first, iterator __before_last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __before_last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __before_first))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first))
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_last))
+ iterator __first = __before_first; ++__first;
+ iterator __last = __before_last; ++__last;
+ if (get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__first, __last);
+ }
+ _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl,
+ __before_first._M_iterator, __before_last._M_iterator);
+ }
+
+ void splice(iterator __pos, _Self& __x) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT)
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl);
+ if (get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+
+ void splice(iterator __pos, _Self& __x, iterator __i) {
+ //__pos should be owned by *this and not be the before_begin iterator
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ //__i should be dereferenceable, not before_begin and be owned by __x
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list ,__i))
+ _STLP_VERBOSE_ASSERT(!(__i == __x.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ if (get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV __change_ite_owner(__i, &_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterator(__i);
+ }
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator);
+ }
+
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT)
+ //_STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end()))
+ if (get_allocator() == __x.get_allocator()) {
+ _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__first, __last);
+ }
+ _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl,
+ __first._M_iterator, __last._M_iterator);
+ }
+
+ void reverse()
+ { _M_non_dbg_impl.reverse(); }
+
+ void remove(const value_type& __val) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ while (__first != __last) {
+ _Base_iterator __next = __first;
+ ++__next;
+ if (__val == *__first) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __first));
+ _M_non_dbg_impl.erase(__first);
+ }
+ __first = __next;
+ }
+ }
+ void unique() {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ if (__first == __last) return;
+ _Base_iterator __next = __first;
+ while (++__next != __last) {
+ if (*__first == *__next) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __next));
+ _M_non_dbg_impl.erase(__next);
+ }
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+ void merge(_Self& __x) {
+ _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
+#if !defined (_STLP_NO_EXTENSIONS)
+ /* comments below due to bug in GCC compilers: ones eat all memory and die if see
+ * something like namespace_name::func_name() - ptr
+ */
+ _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end()))
+ _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator))
+#endif
+ _M_non_dbg_impl.merge(__x._M_non_dbg_impl);
+ if (get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+ void sort() {
+ _M_non_dbg_impl.sort();
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ while (__first != __last) {
+ _Base_iterator __next = __first;
+ ++__next;
+ if (__pred(*__first)) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __first));
+ _M_non_dbg_impl.erase(__first);
+ }
+ __first = __next;
+ }
+ }
+
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __pred) {
+ _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end();
+ if (__first == __last) return;
+ _Base_iterator __next = __first;
+ while (++__next != __last) {
+ if (__binary_pred(*__first, *__next)) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __next));
+ _M_non_dbg_impl.erase(__next);
+ }
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x, _StrictWeakOrdering __ord) {
+ _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT)
+#if !defined (_STLP_NO_EXTENSIONS)
+ /* comments below due to bug in GCC compilers: ones eat all memory and die if see
+ * something like namespace_name::func_name() - ptr
+ */
+ _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __ord))
+ _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __ord))
+#endif
+ _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __ord);
+ if (get_allocator() == __x.get_allocator()) {
+ __x._M_iter_list._Set_owner(_M_iter_list);
+ }
+ else {
+ __x._Invalidate_iterators(__x.begin(), __x.end());
+ }
+ }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _M_non_dbg_impl.sort(__comp); }
+#endif
+};
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_SLIST
+
+#endif /* _STLP_INTERNAL_DBG_SLIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/debug/_string.h b/stlport/stl/debug/_string.h
new file mode 100644
index 0000000..49f7ab2
--- /dev/null
+++ b/stlport/stl/debug/_string.h
@@ -0,0 +1,828 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#ifndef _STLP_DBG_STRING_H
+#define _STLP_DBG_STRING_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define _STLP_NON_DBG_STRING_NAME _STLP_NON_DBG_NAME(str)
+#define _STLP_NON_DBG_STRING _STLP_PRIV _STLP_NON_DBG_STRING_NAME <_CharT, _Traits, _Alloc>
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _CharT,class _Traits, class _Alloc>
+inline _CharT*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&)
+{ return (_CharT*)0; }
+template <class _CharT, class _Traits, class _Alloc>
+inline random_access_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&)
+{ return random_access_iterator_tag(); }
+#endif
+
+template <class _CharT, class _Traits, class _Alloc>
+class basic_string :
+#if !defined (__DMC__)
+ private
+#else
+ public
+#endif
+ _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string)
+ , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
+#endif
+{
+protected:
+ typedef _STLP_NON_DBG_STRING _Base;
+ typedef basic_string<_CharT, _Traits, _Alloc> _Self;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING > _ConstructCheck;
+ typedef typename _IsPOD<_CharT>::_Type _Char_Is_POD;
+
+public:
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+ typedef typename _Base::traits_type traits_type;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits<value_type> > > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits<value_type> > > const_iterator;
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+public: // Constructor, destructor, assignment.
+ typedef typename _Base::_Reserve_t _Reserve_t;
+
+private:
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+ void _Invalidate_all()
+ { _M_iter_list._Invalidate_all(); }
+ void _Compare_Capacity (size_type __old_capacity) {
+ if (this->capacity() > __old_capacity) {
+ _Invalidate_all();
+ }
+ }
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const iterator& __f, const iterator& __l)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __f, __l); }
+
+public:
+#include <stl/_string_npos.h>
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ explicit basic_string(const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(_Reserve_t __r, size_t __n,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__r, __n, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(const _Self& __s)
+ : _ConstructCheck(__s),
+ _M_non_dbg_impl(__s._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__s._M_non_dbg_impl, __pos, __n, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(const _CharT* __s, size_type __n,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__s), _M_non_dbg_impl(__s, __n, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(const _CharT* __s,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__s),
+ _M_non_dbg_impl(__s, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+ basic_string(size_type __n, _CharT __c,
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __c, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ basic_string(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base >(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ basic_string(const _CharT* __f, const _CharT* __l,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__f, __l),
+ _M_non_dbg_impl(__f, __l, __a), _M_iter_list(&_M_non_dbg_impl) {
+ }
+ basic_string(const_iterator __f, const_iterator __l,
+ const allocator_type & __a = allocator_type())
+ : _ConstructCheck(__f, __l),
+ _M_non_dbg_impl(__f._M_iterator, __l._M_iterator, __a), _M_iter_list(&_M_non_dbg_impl) {
+ }
+#else
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l,
+ const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__f, __l),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l), __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ basic_string(_InputIterator __f, _InputIterator __l)
+ : _ConstructCheck(__f, __l),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# endif
+#endif
+
+private:
+ // constructor from non-debug version for substr
+ basic_string (const _Base& __x)
+ : _M_non_dbg_impl(__x), _M_iter_list(&_M_non_dbg_impl) {}
+
+public:
+ _Self& operator=(const _Self& __s) {
+ if (this != &__s) {
+ assign(__s);
+ }
+ return *this;
+ }
+
+ _Self& operator=(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return assign(__s);
+ }
+
+ _Self& operator=(_CharT __c) {
+ return assign(1, __c);
+ }
+
+ // Iterators.
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ // Size, capacity, etc.
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type length() const { return _M_non_dbg_impl.length(); }
+ size_t max_size() const { return _M_non_dbg_impl.max_size(); }
+
+ void resize(size_type __n, _CharT __c) {
+ if (__n > capacity())
+ _Invalidate_all();
+ else if (__n < size())
+ _Invalidate_iterators(begin() + __n, end());
+ _M_non_dbg_impl.resize(__n, __c);
+ }
+ void resize(size_type __n) { resize(__n, _STLP_DEFAULT_CONSTRUCTED(_CharT)); }
+ size_type capacity() const { return _M_non_dbg_impl.capacity(); }
+
+ void reserve(size_type __s = 0) {
+ if (__s > capacity()) _Invalidate_all();
+ _M_non_dbg_impl.reserve(__s);
+ }
+
+ void clear() {
+ _Invalidate_all();
+ _M_non_dbg_impl.clear();
+ }
+
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+
+ const_reference operator[](size_type __n) const {
+ _STLP_VERBOSE_ASSERT(__n <= this->size(), _StlMsg_OUT_OF_BOUNDS);
+ return _M_non_dbg_impl[__n];
+ }
+
+ reference operator[](size_type __n) {
+ _STLP_VERBOSE_ASSERT(__n < this->size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+
+ const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); }
+ reference at(size_type __n) { return _M_non_dbg_impl.at(__n); }
+
+ // Append, operator+=, push_back.
+ _Self& operator+=(const _Self& __s) { return append(__s); }
+ _Self& operator+=(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return append(__s);
+ }
+ _Self& operator+=(_CharT __c) { return append(1, __c); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ _Self& append(_InputIter __first, _InputIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ _Self& append(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__f, __l);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+ _Self& append(const _Self& __s) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__s._M_non_dbg_impl);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(const _Self& __s, size_type __pos, size_type __n) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__s._M_non_dbg_impl, __pos, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__s, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.append(__s);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& append(size_type __n, _CharT __c) {
+ size_type __old_capacity = this->capacity();
+ _M_non_dbg_impl.append(__n, __c);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ void push_back(_CharT __c) {
+ size_type __old_capacity = this->capacity();
+ _M_non_dbg_impl.push_back(__c);
+ _Compare_Capacity(__old_capacity);
+ }
+
+ void pop_back() {
+ _Invalidate_iterator(this->end());
+ _M_non_dbg_impl.pop_back();
+ }
+
+ // Assign
+ _Self& assign(const _Self& __s) {
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__s._M_non_dbg_impl);
+ return *this;
+ }
+
+ _Self& assign(const _Self& __s, size_type __pos, size_type __n) {
+ if (__pos < __s.size()) {
+ _Invalidate_all();
+ }
+ _M_non_dbg_impl.assign(__s._M_non_dbg_impl, __pos, __n);
+ return *this;
+ }
+
+ _Self& assign(const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__s, __s + __n);
+ return *this;
+ }
+
+ _Self& assign(const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__s);
+ return *this;
+ }
+
+ _Self& assign(size_type __n, _CharT __c) {
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__n, __c);
+ return *this;
+ }
+
+#if defined(_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ inline _Self& assign(_InputIter __first, _InputIter __last) {
+ _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ return *this;
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || \
+ !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
+ _Self& assign(const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__f, __l);
+ return *this;
+ }
+ _Self& assign(const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__f._M_iterator, __l._M_iterator);
+ return *this;
+ }
+#endif
+
+ // Insert
+ _Self& insert(size_type __pos, const _Self& __s) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _Self& __s,
+ size_type __beg, size_type __n) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl, __beg, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos, __s, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& insert(size_type __pos, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return insert(__pos, __s, _Traits::length(__s));
+ }
+
+ _Self& insert(size_type __pos, size_type __n, _CharT __c) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos, __n, __c);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ iterator insert(iterator __p, _CharT __c) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ size_type __old_capacity = capacity();
+ typename _Base::iterator __ret = _M_non_dbg_impl.insert(__p._M_iterator, __c);
+ _Compare_Capacity(__old_capacity);
+ return iterator(&_M_iter_list, __ret);
+ }
+
+ void insert(iterator __p, size_t __n, _CharT __c) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator, __n, __c);
+ _Compare_Capacity(__old_capacity);
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ void insert(iterator __p, _InputIter __first, _InputIter __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+
+ size_type __old_capacity = this->capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ void insert(iterator __p, const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f,__l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator, __f, __l);
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ // Those overloads are necessary to check self referencing correctly in non debug
+ // basic_string implementation
+ void insert(iterator __p, const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f,__l))
+# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __f))
+# endif
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator, __f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ }
+ void insert(iterator __p, iterator __f, iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f,__l))
+# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __f))
+# endif
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__p._M_iterator, __f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+
+ // Erase.
+ _Self& erase(size_type __pos = 0, size_type __n = npos) {
+ if (__pos < size()) {
+ _Invalidate_iterators(begin() + __pos, end());
+ }
+ _M_non_dbg_impl.erase(__pos, __n);
+ return *this;
+ }
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
+ _Invalidate_iterators(__pos, end());
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+ iterator erase(iterator __f, iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ _Invalidate_iterators(__f, end());
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__f._M_iterator, __l._M_iterator));
+ }
+
+ // Substring.
+ _Self substr(size_type __pos = 0, size_type __n = npos) const
+ { return _M_non_dbg_impl.substr(__pos, __n); }
+
+ // Replace. (Conceptually equivalent to erase followed by insert.)
+ _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos, __n, __s._M_non_dbg_impl);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos, __n1, __s, __n2);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos, __n1, __s);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) {
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__pos, __n1, __n2, __c);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __f, iterator __l, const _Self& __s) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s._M_non_dbg_impl);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __f, iterator __l, const _CharT* __s, size_type __n) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s, __n);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __f, iterator __l, const _CharT* __s) {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+ _Self& replace(iterator __f, iterator __l, size_type __n, _CharT __c) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __n, __c);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIter>
+ _Self& replace(iterator __first, iterator __last,
+ _InputIter __f, _InputIter __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l));
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ _Self& replace(iterator __first, iterator __last,
+ const _CharT* __f, const _CharT* __l) {
+ _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, __f, __l);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ _Self& replace(iterator __first, iterator __last,
+ const_iterator __f, const_iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
+ __f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+ _Self& replace(iterator __first, iterator __last,
+ iterator __f, iterator __l) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
+ __f._M_iterator, __l._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ return *this;
+ }
+#endif
+
+ // Other modifier member functions.
+ void swap(_Self& __s) {
+ _M_iter_list._Swap_owners(__s._M_iter_list);
+ _M_non_dbg_impl.swap(__s._M_non_dbg_impl);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ int compare(const _Self& __s) const
+ { return _M_non_dbg_impl.compare(__s._M_non_dbg_impl); }
+ int compare(size_type __pos, size_type __n, const _Self& __s) const
+ { return _M_non_dbg_impl.compare(__pos, __n, __s._M_non_dbg_impl); }
+ int compare(size_type __pos1, size_type __n1, const _Self& __s,
+ size_type __pos2, size_type __n2) const
+ { return _M_non_dbg_impl.compare(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2); }
+ int compare(const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_non_dbg_impl.compare(__s);
+ }
+ int compare(size_type __pos, size_type __n, const _CharT* __s) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_non_dbg_impl.compare(__pos, __n, __s);
+ }
+ int compare(size_type __pos1, size_type __n1, const _CharT* __s,
+ size_type __n2) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ return _M_non_dbg_impl.compare(__pos1, __n1, __s, __n2);
+ }
+
+ // Helper functions for compare.
+ static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
+ const _CharT* __f2, const _CharT* __l2)
+ { return _Base::_M_compare(__f1, __l1, __f2, __l2); }
+ static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1,
+ const _CharT* __f2, const _CharT* __l2)
+ { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2, __l2); }
+ static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
+ const_iterator __f2, const_iterator __l2)
+ { return _Base::_M_compare(__f1, __l1, __f2._M_iterator, __l2._M_iterator); }
+ static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1,
+ const_iterator __f2, const_iterator __l2)
+ { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2._M_iterator, __l2._M_iterator); }
+
+ const _CharT* c_str() const { return _M_non_dbg_impl.c_str(); }
+ const _CharT* data() const { return _M_non_dbg_impl.data(); }
+
+ size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
+ { return _M_non_dbg_impl.copy(__s, __n, __pos); }
+
+ // find.
+ size_type find(const _Self& __s, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find(__s._M_non_dbg_impl, __pos); }
+ size_type find(const _CharT* __s, size_type __pos = 0) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find(__s, __pos);
+ }
+ size_type find(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find(__s, __pos, __n);
+ }
+ // WIE: Versant schema compiler 5.2.2 ICE workaround
+ size_type find(_CharT __c) const { return find(__c, 0); }
+ size_type find(_CharT __c, size_type __pos /* = 0 */) const
+ { return _M_non_dbg_impl.find(__c, __pos); }
+
+ // rfind.
+ size_type rfind(const _Self& __s, size_type __pos = npos) const
+ { return _M_non_dbg_impl.rfind(__s._M_non_dbg_impl, __pos); }
+ size_type rfind(const _CharT* __s, size_type __pos = npos) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.rfind(__s, __pos);
+ }
+ size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.rfind(__s, __pos, __n);
+ }
+ size_type rfind(_CharT __c, size_type __pos = npos) const
+ { return _M_non_dbg_impl.rfind(__c, __pos); }
+
+ // find_first_of
+ size_type find_first_of(const _Self& __s, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find_first_of(__s._M_non_dbg_impl, __pos); }
+ size_type find_first_of(const _CharT* __s, size_type __pos = 0) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_first_of(__s, __pos);
+ }
+ size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_first_of(__s, __pos, __n);
+ }
+ size_type find_first_of(_CharT __c, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find_first_of(__c, __pos); }
+
+ // find_last_of
+ size_type find_last_of(const _Self& __s, size_type __pos = npos) const
+ { return _M_non_dbg_impl.find_last_of(__s._M_non_dbg_impl, __pos); }
+ size_type find_last_of(const _CharT* __s, size_type __pos = npos) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_last_of(__s, __pos);
+ }
+ size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_last_of(__s, __pos, __n);
+ }
+ size_type find_last_of(_CharT __c, size_type __pos = npos) const
+ { return _M_non_dbg_impl.rfind(__c, __pos); }
+
+ // find_first_not_of
+ size_type find_first_not_of(const _Self& __s, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find_first_not_of(__s._M_non_dbg_impl, __pos); }
+ size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_first_not_of(__s, __pos);
+ }
+ size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_first_not_of(__s, __pos, __n);
+ }
+ size_type find_first_not_of(_CharT __c, size_type __pos = 0) const
+ { return _M_non_dbg_impl.find_first_not_of(__c, __pos); }
+
+ // find_last_not_of
+ size_type find_last_not_of(const _Self& __s, size_type __pos = npos) const
+ { return _M_non_dbg_impl.find_last_not_of(__s._M_non_dbg_impl, __pos); }
+ size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_last_not_of(__s, __pos);
+ }
+ size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const {
+ _STLP_FIX_LITERAL_BUG(__s)
+ _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
+ return _M_non_dbg_impl.find_last_not_of(__s, __pos, __n);
+ }
+ size_type find_last_not_of(_CharT __c, size_type __pos = npos) const
+ { return _M_non_dbg_impl.find_last_not_of(__c, __pos); }
+
+#if defined (_STLP_USE_TEMPLATE_EXPRESSION)
+# include <stl/debug/_string_sum_methods.h>
+#endif
+};
+
+// This is a hook to instantiate STLport exports in a designated DLL
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME <char, char_traits<char>, allocator<char> > >;
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS basic_string<char, char_traits<char>, allocator<char> >;
+# if defined (_STLP_HAS_WCHAR_T)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME <wchar_t, char_traits<wchar_t>, allocator<wchar_t> > >;
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_EXPORT_TEMPLATE_CLASS basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
+# endif
+#endif
+
+#undef _STLP_NON_DBG_STRING
+#undef _STLP_NON_DBG_STRING_NAME
+
+#if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
+template <class _CharT, class _Traits, class _Alloc>
+const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0;
+#endif
+
+#if defined (basic_string)
+_STLP_MOVE_TO_STD_NAMESPACE
+#undef basic_string
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_DBG_STRING */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stl/debug/_string_sum_methods.h b/stlport/stl/debug/_string_sum_methods.h
similarity index 100%
rename from stl/debug/_string_sum_methods.h
rename to stlport/stl/debug/_string_sum_methods.h
diff --git a/stlport/stl/debug/_tree.h b/stlport/stl/debug/_tree.h
new file mode 100644
index 0000000..a32eda2
--- /dev/null
+++ b/stlport/stl/debug/_tree.h
@@ -0,0 +1,317 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DBG_TREE_H
+#define _STLP_INTERNAL_DBG_TREE_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
+# include <stl/_function_base.h>
+#endif
+
+#ifndef _STLP_INTERNAL_ALLOC_H
+# include <stl/_alloc.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Key, class _Compare>
+class _DbgCompare {
+public:
+ _DbgCompare() {}
+ _DbgCompare(const _Compare& __cmp) : _M_non_dbg_cmp(__cmp) {}
+ _DbgCompare(const _DbgCompare& __cmp) : _M_non_dbg_cmp(__cmp._M_non_dbg_cmp) {}
+
+#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
+ bool operator () (const _Key& __lhs, const _Key& __rhs) const {
+#else
+ template <class _Kp1, class _Kp2>
+ bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const {
+#endif
+ if (_M_non_dbg_cmp(__lhs, __rhs)) {
+ return true;
+ }
+ return false;
+ }
+
+ _Compare non_dbg_key_comp() const { return _M_non_dbg_cmp; }
+private:
+ _Compare _M_non_dbg_cmp;
+};
+
+#define _STLP_NON_DBG_TREE _STLP_PRIV _STLP_NON_DBG_NAME(Rb_tree) <_Key, _STLP_PRIV _DbgCompare<_Key, _Compare>, _Value, _KeyOfValue, _Traits, _Alloc>
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+_STLP_MOVE_TO_STD_NAMESPACE
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc >
+inline _Value*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&)
+{ return (_Value*)0; }
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits, class _Alloc >
+inline bidirectional_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&)
+{ return bidirectional_iterator_tag(); }
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Key, class _Compare,
+ class _Value, class _KeyOfValue, class _Traits,
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
+class _Rb_tree {
+ typedef _STLP_NON_DBG_TREE _Base;
+ typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self;
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+public:
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+ typedef typename _Base::key_type key_type;
+
+ typedef typename _Traits::_NonConstTraits _NonConstIteTraits;
+ typedef typename _Traits::_ConstTraits _ConstIteTraits;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstIteTraits> > iterator;
+ typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstIteTraits> > const_iterator;
+
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+private:
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ typedef typename _Base::iterator _Base_iterator;
+ typedef typename _Base::const_iterator _Base_const_iterator;
+
+public:
+ _Rb_tree()
+ : _M_non_dbg_impl(), _M_iter_list(&_M_non_dbg_impl) {}
+ _Rb_tree(const _Compare& __comp)
+ : _M_non_dbg_impl(__comp), _M_iter_list(&_M_non_dbg_impl) {}
+ _Rb_tree(const _Compare& __comp, const allocator_type& __a)
+ : _M_non_dbg_impl(__comp, __a), _M_iter_list(&_M_non_dbg_impl) {}
+ _Rb_tree(const _Self& __x)
+ : _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ _Rb_tree(__move_source<_Self> src):
+ _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+ ~_Rb_tree() {}
+
+ _Self& operator=(const _Self& __x) {
+ if (this != &__x) {
+ //Should not invalidate end iterator:
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+ _Compare key_comp() const { return _M_non_dbg_impl.key_comp().non_dbg_key_comp(); }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const { return _M_non_dbg_impl.count(__x); }
+
+ void swap(_Self& __t) {
+ _M_non_dbg_impl.swap(__t._M_non_dbg_impl);
+ _M_iter_list._Swap_owners(__t._M_iter_list);
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __k)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __k) const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const
+ { return const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range(const _KT& __x) {
+ return pair<iterator, iterator>(iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)),
+ iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)));
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
+ return pair<const_iterator,const_iterator>(const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)),
+ const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)));
+ }
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator,iterator> equal_range_unique(const _KT& __x) {
+ _STLP_STD::pair<_Base_iterator, _Base_iterator> __p;
+ __p = _M_non_dbg_impl.equal_range_unique(__x);
+ return pair<iterator, iterator>(iterator(&_M_iter_list, __p.first), iterator(&_M_iter_list, __p.second));
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range_unique(const _KT& __x) const {
+ _STLP_STD::pair<_Base_const_iterator, _Base_const_iterator> __p;
+ __p = _M_non_dbg_impl.equal_range_unique(__x);
+ return pair<const_iterator, const_iterator>(const_iterator(&_M_iter_list, __p.first),
+ const_iterator(&_M_iter_list, __p.second));
+ }
+
+ pair<iterator,bool> insert_unique(const value_type& __x) {
+ _STLP_STD::pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__x);
+ return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
+ }
+ iterator insert_equal(const value_type& __x)
+ { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__x)); }
+
+ iterator insert_unique(iterator __pos, const value_type& __x) {
+ _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos))
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert_unique(__pos._M_iterator, __x));
+ }
+ iterator insert_equal(iterator __pos, const value_type& __x) {
+ _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __pos))
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__pos._M_iterator, __x));
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template<class _InputIterator>
+ void insert_equal(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first,__last))
+ _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+ template<class _InputIterator>
+ void insert_unique(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first,__last))
+ _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+ void insert_unique(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first,__last))
+ _M_non_dbg_impl.insert_unique(__first._M_iterator, __last._M_iterator);
+ }
+ void insert_unique(const value_type* __first, const value_type* __last) {
+ _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last))
+ _M_non_dbg_impl.insert_unique(__first, __last);
+ }
+ void insert_equal(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first,__last))
+ _M_non_dbg_impl.insert_equal(__first._M_iterator, __last._M_iterator);
+ }
+ void insert_equal(const value_type* __first, const value_type* __last) {
+ _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last))
+ _M_non_dbg_impl.insert_equal(__first, __last);
+ }
+#endif
+
+ void erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos))
+ _STLP_DEBUG_CHECK(_Dereferenceable(__pos))
+ _Invalidate_iterator(__pos);
+ _M_non_dbg_impl.erase(__pos._M_iterator);
+ }
+ size_type erase(const key_type& __x) {
+ pair<iterator, iterator> __p = equal_range(__x);
+ size_type __n = _STLP_STD::distance(__p.first._M_iterator, __p.second._M_iterator);
+ _Invalidate_iterators(__p.first, __p.second);
+ _M_non_dbg_impl.erase(__p.first._M_iterator, __p.second._M_iterator);
+ return __n;
+ }
+ size_type erase_unique(const key_type& __x) {
+ _Base_iterator __i = _M_non_dbg_impl.find(__x);
+ if (__i != _M_non_dbg_impl.end()) {
+ _Invalidate_iterator(iterator(&_M_iter_list, __i));
+ _M_non_dbg_impl.erase(__i);
+ return 1;
+ }
+ return 0;
+ }
+
+ void erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(__check_range(__first, __last, begin(), end()))
+ _Invalidate_iterators(__first, __last);
+ _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator);
+ }
+ void erase(const key_type* __first, const key_type* __last) {
+ while (__first != __last) erase(*__first++);
+ }
+
+ void clear() {
+ //should not invalidate end:
+ _Invalidate_iterators(begin(), end());
+ _M_non_dbg_impl.clear();
+ }
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_TREE
+
+#endif /* _STLP_INTERNAL_DBG_TREE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/debug/_vector.h b/stlport/stl/debug/_vector.h
new file mode 100644
index 0000000..c5800e9
--- /dev/null
+++ b/stlport/stl/debug/_vector.h
@@ -0,0 +1,425 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_INTERNAL_DBG_VECTOR_H
+#define _STLP_INTERNAL_DBG_VECTOR_H
+
+#ifndef _STLP_DBG_ITERATOR_H
+# include <stl/debug/_iterator.h>
+#endif
+
+#define _STLP_NON_DBG_VECTOR _STLP_PRIV _STLP_NON_DBG_NAME(vector) <_Tp, _Alloc>
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
+template <class _Tp, class _Alloc>
+inline _Tp*
+value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_VECTOR >&)
+{ return (_Tp*)0; }
+template <class _Tp, class _Alloc>
+inline random_access_iterator_tag
+iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_VECTOR >&)
+{ return random_access_iterator_tag(); }
+#endif
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _Tp, class _NcIt>
+struct _Vector_const_traits;
+
+template <class _Tp, class _NcIt>
+struct _Vector_nonconst_traits {
+ typedef _Nonconst_traits<_Tp> _BaseT;
+ typedef _Tp value_type;
+ typedef _Tp& reference;
+ typedef _Tp* pointer;
+ typedef _Vector_const_traits<_Tp, _NcIt> _ConstTraits;
+ typedef _Vector_nonconst_traits<_Tp, _NcIt> _NonConstTraits;
+};
+
+template <class _Tp, class _NcIt>
+struct _Vector_const_traits {
+ typedef _Const_traits<_Tp> _BaseT;
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+ typedef _Vector_const_traits<_Tp, _NcIt> _ConstTraits;
+ typedef _Vector_nonconst_traits<_Tp, _NcIt> _NonConstTraits;
+};
+
+_STLP_TEMPLATE_NULL
+struct _Vector_nonconst_traits<bool, _Bit_iterator> {
+ typedef _Bit_iterator::value_type value_type;
+ typedef _Bit_iterator::reference reference;
+ typedef _Bit_iterator::pointer pointer;
+ typedef _Vector_const_traits<bool, _Bit_iterator> _ConstTraits;
+ typedef _Vector_nonconst_traits<bool, _Bit_iterator> _NonConstTraits;
+};
+
+_STLP_TEMPLATE_NULL
+struct _Vector_const_traits<bool, _Bit_iterator> {
+ typedef _Bit_const_iterator::value_type value_type;
+ typedef _Bit_const_iterator::reference reference;
+ typedef _Bit_const_iterator::pointer pointer;
+ typedef _Vector_const_traits<bool, _Bit_iterator> _ConstTraits;
+ typedef _Vector_nonconst_traits<bool, _Bit_iterator> _NonConstTraits;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class vector :
+#if !defined (__DMC__)
+ private
+#endif
+ _STLP_PRIV __construct_checker< _STLP_NON_DBG_VECTOR >
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ , public __stlport_class<vector<_Tp, _Alloc> >
+#endif
+{
+private:
+ typedef _STLP_NON_DBG_VECTOR _Base;
+ typedef vector<_Tp, _Alloc> _Self;
+ typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_VECTOR > _ConstructCheck;
+ _Base _M_non_dbg_impl;
+ _STLP_PRIV __owned_list _M_iter_list;
+
+public:
+ __IMPORT_CONTAINER_TYPEDEFS(_Base)
+
+ typedef _STLP_PRIV _DBG_iter<_Base,
+ _STLP_PRIV _DbgTraits<_STLP_PRIV _Vector_nonconst_traits<value_type, typename _Base::iterator> > > iterator;
+
+ typedef _STLP_PRIV _DBG_iter<_Base,
+ _STLP_PRIV _DbgTraits<_STLP_PRIV _Vector_const_traits<value_type, typename _Base::iterator> > > const_iterator;
+
+private:
+ void _Invalidate_all()
+ { _M_iter_list._Invalidate_all(); }
+ void _Invalidate_iterator(const iterator& __it)
+ { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
+ void _Invalidate_iterators(const iterator& __first, const iterator& __last)
+ { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
+
+ void _Check_Overflow(size_type __nb) {
+ if (size() + __nb > capacity())
+ _Invalidate_all();
+ }
+ void _Compare_Capacity (size_type __old_capacity) {
+ if (capacity() > __old_capacity) {
+ _Invalidate_all();
+ }
+ }
+
+public:
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+ allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
+
+ iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
+ iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+ const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const { return _M_non_dbg_impl.size(); }
+ size_type max_size() const { return _M_non_dbg_impl.max_size(); }
+ size_type capacity() const { return _M_non_dbg_impl.capacity(); }
+ bool empty() const { return _M_non_dbg_impl.empty(); }
+
+ reference operator[](size_type __n) {
+ _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+
+ const_reference operator[](size_type __n) const {
+ _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS)
+ return _M_non_dbg_impl[__n];
+ }
+
+ reference at(size_type __n) { return _M_non_dbg_impl.at(__n); }
+ const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); }
+
+ explicit vector(const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(size_type __n, const _Tp& __x = _Tp(),
+#else
+ vector(size_type __n, const _Tp& __x,
+#endif
+ const allocator_type& __a = allocator_type())
+ : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(size_type __n)
+ : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {}
+#endif
+
+ vector(const _Self& __x)
+ : _ConstructCheck(__x), _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ vector(__move_source<_Self> src)
+ : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
+ _M_iter_list(&_M_non_dbg_impl) {
+# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
+ src.get()._M_iter_list._Invalidate_all();
+# else
+ src.get()._M_iter_list._Set_owner(_M_iter_list);
+# endif
+ }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last)
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)),
+ _M_iter_list(&_M_non_dbg_impl) {}
+# endif
+#else
+ vector(const _Tp* __first, const _Tp* __last,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last), _M_non_dbg_impl(__first, __last, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+
+ // mysterious VC++ bug ?
+ vector(const_iterator __first, const_iterator __last ,
+ const allocator_type& __a = allocator_type())
+ : _ConstructCheck(__first, __last),
+ _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a),
+ _M_iter_list(&_M_non_dbg_impl) {}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __x) {
+ if (this != &__x) {
+ _Invalidate_all();
+ _M_non_dbg_impl = __x._M_non_dbg_impl;
+ }
+ return *this;
+ }
+
+ void reserve(size_type __n) {
+ if (capacity() < __n)
+ _Invalidate_all();
+ _M_non_dbg_impl.reserve(__n);
+ }
+
+ reference front() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ const_reference front() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *begin();
+ }
+ reference back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+ const_reference back() const {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ return *(--end());
+ }
+
+ void swap(_Self& __x) {
+ _M_iter_list._Swap_owners(__x._M_iter_list);
+ _M_non_dbg_impl.swap(__x._M_non_dbg_impl);
+ }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos, const _Tp& __x = _Tp()) {
+#else
+ iterator insert(iterator __pos, const _Tp& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Check_Overflow(1);
+ return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x));
+ }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos)
+ { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InputIterator>
+ void insert(iterator __pos,
+ _InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos._M_iterator,
+ _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ void insert (iterator __pos,
+ const value_type *__first, const value_type *__last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first,__last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last);
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+
+#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ //Sequence requirements 23.1.1 Table 67:
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first));
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ }
+ void insert(iterator __pos,
+ iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ //Sequence requirements 23.1.1 Table 67:
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first));
+ size_type __old_capacity = capacity();
+ _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator);
+ _Compare_Capacity(__old_capacity);
+ }
+#endif
+
+ void insert (iterator __pos, size_type __n, const _Tp& __x){
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Check_Overflow(__n);
+ _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x);
+ }
+
+ void pop_back() {
+ _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER)
+ _Invalidate_iterator(end());
+ _M_non_dbg_impl.pop_back();
+ }
+ iterator erase(iterator __pos) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos))
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos))
+ _Invalidate_iterators(__pos, end());
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
+ }
+ iterator erase(iterator __first, iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
+ _Invalidate_iterators(__first, end());
+ return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator));
+ }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) {
+#else
+ void resize(size_type __new_size, const _Tp& __x) {
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ if (__new_size > capacity()) {
+ _Invalidate_all();
+ }
+ else if (__new_size < size()) {
+ _Invalidate_iterators(begin() + __new_size, end());
+ }
+ _M_non_dbg_impl.resize(__new_size, __x);
+ }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
+ }
+#else
+private:
+ void _M_assign(const value_type *__first, const value_type *__last) {
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__first, __last);
+ }
+public:
+ void assign(const value_type *__first, const value_type *__last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first,__last))
+ _M_assign(__first, __last);
+ }
+
+ void assign(const_iterator __first, const_iterator __last) {
+ _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last))
+ _M_assign(__first._M_iterator, __last._M_iterator);
+ }
+#endif
+
+public:
+ void assign(size_type __n, const _Tp& __val) {
+ _Invalidate_all();
+ _M_non_dbg_impl.assign(__n, __val);
+ }
+
+ void clear() {
+ _Invalidate_all();
+ _M_non_dbg_impl.clear();
+ }
+ void push_back(const _Tp& __x) {
+ _Check_Overflow(1);
+ _M_non_dbg_impl.push_back(__x);
+ }
+};
+
+_STLP_END_NAMESPACE
+
+#undef _STLP_NON_DBG_VECTOR
+
+#endif /* _STLP_DBG_VECTOR_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/msl_string.h b/stlport/stl/msl_string.h
new file mode 100644
index 0000000..1fa4931
--- /dev/null
+++ b/stlport/stl/msl_string.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1998
+ * Mark of the Unicorn, 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. Mark of the Unicorn, Inc. makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+#if defined( _STLP_USE_MSIPL ) && !defined( _STLP_MSL_STRING_H_ )
+#define _STLP_MSL_STRING_H_
+
+//# define char_traits __msl_char_traits
+# define basic_string __msl_basic_string
+# define b_str_ref __msl_b_str_ref
+# define basic_istream __msl_basic_istream
+# define basic_ostream __msl_basic_ostream
+# define string __msl_string
+# define wstring __msl_wstring
+# define iterator_traits __msl_iterator_traits
+
+namespace std
+{
+ template<class charT, class traits> class basic_istream;
+ template<class charT, class traits> class basic_ostream;
+}
+
+#if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <string>
+#else
+# include _STLP_NATIVE_HEADER(string)
+#endif
+
+// # undef char_traits
+# undef basic_string
+# undef b_str_ref
+# undef basic_istream
+# undef basic_ostream
+# undef string
+# undef wstring
+# undef iterator_traits
+
+#endif
diff --git a/stlport/stl/pointers/_deque.h b/stlport/stl/pointers/_deque.h
new file mode 100644
index 0000000..f82a559
--- /dev/null
+++ b/stlport/stl/pointers/_deque.h
@@ -0,0 +1,390 @@
+/*
+ * Copyright (c) 2004
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_SPECIALIZED_DEQUE_H
+#define _STLP_SPECIALIZED_DEQUE_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+/*
+ * struct helper to cast deque iterators:
+ */
+template <class _StorageT, class _ValueT>
+struct _DequeIteCast {
+ typedef _Deque_iterator<_ValueT, _Nonconst_traits<_ValueT> > iterator;
+ typedef _Deque_iterator<_ValueT, _Const_traits<_ValueT> > const_iterator;
+ typedef _Deque_iterator<_StorageT, _Nonconst_traits<_StorageT> > storage_iterator;
+ typedef _Deque_iterator<_StorageT, _Const_traits<_StorageT> > const_storage_iterator;
+ typedef _CastTraits<_StorageT, _ValueT> cast_traits;
+
+ static iterator to_value_type_ite (storage_iterator const& __ite) {
+ iterator tmp;
+ tmp._M_cur = cast_traits::to_value_type_ptr(__ite._M_cur);
+ tmp._M_first = cast_traits::to_value_type_ptr(__ite._M_first);
+ tmp._M_last = cast_traits::to_value_type_ptr(__ite._M_last);
+ tmp._M_node = cast_traits::to_value_type_pptr(__ite._M_node);
+ return tmp;
+ }
+ static storage_iterator to_storage_type_ite (iterator const& __ite) {
+ storage_iterator tmp;
+ tmp._M_cur = cast_traits::to_storage_type_ptr(__ite._M_cur);
+ tmp._M_first = cast_traits::to_storage_type_ptr(__ite._M_first);
+ tmp._M_last = cast_traits::to_storage_type_ptr(__ite._M_last);
+ tmp._M_node = cast_traits::to_storage_type_pptr(__ite._M_node);
+ return tmp;
+ }
+
+ static const_iterator to_value_type_cite (const_storage_iterator const& __ite) {
+ const_iterator tmp;
+ tmp._M_cur = cast_traits::to_value_type_ptr(__ite._M_cur);
+ tmp._M_first = cast_traits::to_value_type_ptr(__ite._M_first);
+ tmp._M_last = cast_traits::to_value_type_ptr(__ite._M_last);
+ tmp._M_node = cast_traits::to_value_type_pptr(__ite._M_node);
+ return tmp;
+ }
+
+ static const_storage_iterator to_storage_type_cite (const_iterator const& __ite) {
+ const_storage_iterator tmp;
+ tmp._M_cur = cast_traits::to_storage_type_ptr(__ite._M_cur);
+ tmp._M_first = cast_traits::to_storage_type_ptr(__ite._M_first);
+ tmp._M_last = cast_traits::to_storage_type_ptr(__ite._M_last);
+ tmp._M_node = cast_traits::to_storage_type_pptr(__ite._M_node);
+ return tmp;
+ }
+};
+
+#define DEQUE_IMPL _STLP_PTR_IMPL_NAME(deque)
+#if defined (__BORLANDC__) || defined (__DMC__)
+# define typename
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<void***, void**, allocator<void**> >;
+_STLP_EXPORT template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Deque_base<void*,allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS DEQUE_IMPL<void*,allocator<void*> >;
+#endif
+
+#if defined (_STLP_DEBUG)
+# define deque _STLP_NON_DBG_NAME(deque)
+#else
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class deque
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (deque)
+ : public __stlport_class<deque<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
+ typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV DEQUE_IMPL<_StorageType, _StorageTypeAlloc> _Base;
+ typedef deque<_Tp, _Alloc> _Self;
+
+ typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
+ typedef _STLP_PRIV _DequeIteCast<_StorageType, _Tp> ite_cast_traits;
+
+public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag _Iterator_category;
+ _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
+ typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
+ typedef _STLP_PRIV _Deque_iterator<value_type, _Nonconst_traits<value_type> > iterator;
+ typedef _STLP_PRIV _Deque_iterator<value_type, _Const_traits<value_type> > const_iterator;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+
+public: // Basic accessors
+ iterator begin() { return ite_cast_traits::to_value_type_ite(_M_impl.begin()); }
+ iterator end() { return ite_cast_traits::to_value_type_ite(_M_impl.end()); }
+ const_iterator begin() const { return ite_cast_traits::to_value_type_cite(_M_impl.begin()); }
+ const_iterator end() const { return ite_cast_traits::to_value_type_cite(_M_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const
+ { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const
+ { return const_reverse_iterator(begin()); }
+
+ reference operator[](size_type __n)
+ { return cast_traits::to_value_type_ref(_M_impl[__n]); }
+ const_reference operator[](size_type __n) const
+ { return cast_traits::to_value_type_cref(_M_impl[__n]); }
+
+ reference at(size_type __n)
+ { return cast_traits::to_value_type_ref(_M_impl.at(__n)); }
+ const_reference at(size_type __n) const
+ { return cast_traits::to_value_type_cref(_M_impl.at(__n)); }
+
+ reference front() { return cast_traits::to_value_type_ref(_M_impl.front()); }
+ reference back() { return cast_traits::to_value_type_ref(_M_impl.back()); }
+ const_reference front() const { return cast_traits::to_value_type_cref(_M_impl.front()); }
+ const_reference back() const { return cast_traits::to_value_type_cref(_M_impl.back()); }
+
+ size_type size() const { return _M_impl.size(); }
+ size_type max_size() const { return _M_impl.max_size(); }
+ bool empty() const { return _M_impl.empty(); }
+ allocator_type get_allocator() const { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
+
+ explicit deque(const allocator_type& __a = allocator_type())
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+ deque(const _Self& __x) : _M_impl(__x._M_impl) {}
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
+#else
+ deque(size_type __n, const value_type& __val,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__n, cast_traits::to_storage_type_cref(__val), _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+ // int,long variants may be needed
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ explicit deque(size_type __n) : _M_impl(__n) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+#if !defined (_STLP_USE_ITERATOR_WRAPPER)
+ : _M_impl(__first, __last,
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
+#else
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
+#endif
+#if defined (_STLP_USE_ITERATOR_WRAPPER)
+ insert(end(), __first, __last);
+#endif
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last)
+# if !defined (_STLP_USE_ITERATOR_WRAPPER)
+ : _M_impl(__first, __last) {}
+# else
+ { insert(end(), __first, __last); }
+# endif
+# endif
+
+#else
+ deque(const_pointer __first, const_pointer __last,
+ const allocator_type& __a = allocator_type() )
+ : _M_impl(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+ deque(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _M_impl(ite_cast_traits::to_storage_type_cite(__first),
+ ite_cast_traits::to_storage_type_cite(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ deque(__move_source<_Self> src)
+ : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
+#endif
+
+ _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; }
+
+ void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ void assign(size_type __n, const value_type& __val) {
+ _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val));
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type&)
+ { _M_impl.assign(__n, __val); }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.assign(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+# else
+ _M_impl.assign(__first, __last);
+# endif
+ }
+#else
+ void assign(const_pointer __first, const_pointer __last)
+ { _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last)); }
+ void assign(const_iterator __first, const_iterator __last)
+ { _M_impl.assign(ite_cast_traits::to_storage_type_cite(__first),
+ ite_cast_traits::to_storage_type_cite(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void push_back(const value_type& __t)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { _M_impl.push_back(cast_traits::to_storage_type_cref(__t)); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void push_front(const value_type& __t)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { _M_impl.push_front(cast_traits::to_storage_type_cref(__t)); }
+
+# if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ void push_back() { _M_impl.push_back(); }
+ void push_front() { _M_impl.push_front(); }
+# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_back() { _M_impl.pop_back(); }
+ void pop_front() { _M_impl.pop_front(); }
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert(iterator __pos, const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { return ite_cast_traits::to_value_type_ite(_M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
+ cast_traits::to_storage_type_cref(__x))); }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&) {
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+# else
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __first, __last);
+# endif
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos,
+ const_pointer __first, const_pointer __last) {
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
+ cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+ void insert(iterator __pos,
+ const_iterator __first, const_iterator __last) {
+ _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos),
+ ite_cast_traits::to_storage_type_cite(__first),
+ ite_cast_traits::to_storage_type_cite(__last));
+ }
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void resize(size_type __new_size, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { _M_impl.resize(__new_size); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ iterator erase(iterator __pos)
+ { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__pos))); }
+
+ iterator erase(iterator __first, iterator __last)
+ { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__first),
+ ite_cast_traits::to_storage_type_ite(__last))); }
+ void clear() { _M_impl.clear(); }
+
+private:
+ _Base _M_impl;
+};
+
+#if defined (deque)
+# undef deque
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#undef DEQUE_IMPL
+#if defined (__BORLANDC__) || defined (__DMC__)
+# undef typename
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_SPECIALIZED_DEQUE_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/pointers/_list.h b/stlport/stl/pointers/_list.h
new file mode 100644
index 0000000..52a9262
--- /dev/null
+++ b/stlport/stl/pointers/_list.h
@@ -0,0 +1,345 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_PTR_SPECIALIZED_LIST_H
+#define _STLP_PTR_SPECIALIZED_LIST_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define LIST_IMPL _STLP_PTR_IMPL_NAME(list)
+#if defined (__BORLANDC__) || defined (__DMC__)
+# define typename
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS _List_node<void*>;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _List_node<void*> >;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_List_node_base, _List_node<void*>, allocator<_List_node<void*> > >;
+_STLP_EXPORT_TEMPLATE_CLASS _List_base<void*, allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS LIST_IMPL<void*, allocator<void*> >;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_DEBUG)
+# define list _STLP_NON_DBG_NAME(list)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class list
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list)
+ : public __stlport_class<list<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
+ typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV LIST_IMPL<_StorageType, _StorageTypeAlloc> _Base;
+ typedef typename _Base::iterator _BaseIte;
+ typedef typename _Base::const_iterator _BaseConstIte;
+ typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
+ typedef list<_Tp, _Alloc> _Self;
+
+public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
+ typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
+ typedef bidirectional_iterator_tag _Iterator_category;
+
+ typedef _STLP_PRIV _List_iterator<value_type, _Nonconst_traits<value_type> > iterator;
+ typedef _STLP_PRIV _List_iterator<value_type, _Const_traits<value_type> > const_iterator;
+
+ _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
+
+ explicit list(const allocator_type& __a = allocator_type())
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
+#else
+ list(size_type __n, const value_type& __val,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__n, cast_traits::to_storage_type_cref(__val),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit list(size_type __n)
+ : _M_impl(__n) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+# if !defined (_STLP_USE_ITERATOR_WRAPPER)
+ : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+# else
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
+ insert(begin(), __first, __last);
+ }
+# endif
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last)
+# if !defined (_STLP_USE_WRAPPER_ITERATOR)
+ : _M_impl(__first, __last) {}
+# else
+ { insert(begin(), __first, __last); }
+# endif
+# endif
+
+#else /* _STLP_MEMBER_TEMPLATES */
+
+ list(const value_type *__first, const value_type *__last,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+ list(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ list(const _Self& __x) : _M_impl(__x._M_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ list(__move_source<_Self> src)
+ : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
+#endif
+
+ iterator begin() { return iterator(_M_impl.begin()._M_node); }
+ const_iterator begin() const { return const_iterator(_M_impl.begin()._M_node); }
+
+ iterator end() { return iterator(_M_impl.end()._M_node); }
+ const_iterator end() const { return const_iterator(_M_impl.end()._M_node); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ bool empty() const { return _M_impl.empty(); }
+ size_type size() const { return _M_impl.size(); }
+ size_type max_size() const { return _M_impl.max_size(); }
+
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+ reference back() { return *(--end()); }
+ const_reference back() const { return *(--end()); }
+
+ void swap(_Self &__x) { _M_impl.swap(__x._M_impl); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+ void clear() { _M_impl.clear(); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const_reference __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert(iterator __pos, const_reference __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { return iterator(_M_impl.insert(_BaseIte(__pos._M_node),
+ cast_traits::to_storage_type_cref(__x))._M_node); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&)
+ { _M_impl.insert(_BaseIte(__pos._M_node), __n, __val); }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.insert(_BaseIte(__pos._M_node),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+# else
+ _M_impl.insert(_BaseIte(__pos._M_node), __first, __last);
+# endif
+ }
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos, const value_type *__first, const value_type *__last)
+ { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last)); }
+ void insert(iterator __pos, const_iterator __first, const_iterator __last)
+ { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
+
+ void push_front(const value_type& __x) { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); }
+ void push_back(const value_type& __x) { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos) { return iterator(_M_impl.insert(__pos._M_node)._M_node); }
+ void push_front() { _M_impl.push_front();}
+ void push_back() { _M_impl.push_back();}
+# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ iterator erase(iterator __pos)
+ { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); }
+ iterator erase(iterator __first, iterator __last)
+ { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void resize(size_type __new_size) { _M_impl.resize(__new_size); }
+ void resize(size_type __new_size, const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/
+ {_M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));}
+
+ void pop_front() { _M_impl.pop_front(); }
+ void pop_back() { _M_impl.pop_back(); }
+
+ _Self& operator=(const _Self& __x)
+ { _M_impl = __x._M_impl; return *this; }
+ void assign(size_type __n, const value_type& __val)
+ { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&)
+ { _M_impl.assign(__n, __val); }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.assign(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+# else
+ _M_impl.assign(__first, __last);
+# endif
+ }
+#else
+ void assign(const value_type *__first, const value_type *__last) {
+ _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+ void assign(const_iterator __first, const_iterator __last)
+ { _M_impl.assign(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
+#endif
+
+ void splice(iterator __pos, _Self& __x)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); }
+ void splice(iterator __pos, _Self& __x, iterator __i)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); }
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl,
+ _BaseIte(__first._M_node), _BaseIte(__last._M_node)); }
+
+ void remove(const_reference __val)
+ { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); }
+ void unique() { _M_impl.unique(); }
+ void merge(_Self& __x) { _M_impl.merge(__x._M_impl); }
+ void reverse() { _M_impl.reverse(); }
+ void sort() { _M_impl.sort(); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Predicate>
+ void remove_if(_Predicate __pred)
+ { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); }
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __bin_pred)
+ { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__bin_pred)); }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self &__x, _StrictWeakOrdering __comp)
+ { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+private:
+ _Base _M_impl;
+};
+
+#if defined (list)
+# undef list
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#undef LIST_IMPL
+#if defined (__BORLANDC__) || defined (__DMC__)
+# undef typename
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_PTR_SPECIALIZED_LIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/pointers/_set.h b/stlport/stl/pointers/_set.h
new file mode 100644
index 0000000..f997a5a
--- /dev/null
+++ b/stlport/stl/pointers/_set.h
@@ -0,0 +1,564 @@
+/*
+ * Copyright (c) 2005
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_PTR_SPECIALIZED_SET_H
+#define _STLP_PTR_SPECIALIZED_SET_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#if defined (__BORLANDC__) || defined (__DMC__)
+# define typename
+#endif
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, Const_traits)
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_EXPORT template struct _STLP_CLASS_DECLSPEC less<void*>;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+typedef _Rb_tree_node<void*> _Node;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Rb_tree_node_base, _Node, allocator<_Node> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree_base<void*, allocator<void*> >;
+# if defined (_STLP_DEBUG)
+_STLP_EXPORT_TEMPLATE_CLASS _DbgCompare<void*, less<void*> >;
+# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree)
+_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree<void*, _DbgCompare<void*, less<void*> >, void*, _Identity<void*>,
+ _SetTraitsT<void*>, allocator<void*> >;
+# undef _Rb_tree
+# endif
+_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree<void*, less<void*>, void*, _Identity<void*>,
+ _SetTraitsT<void*>, allocator<void*> >;
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Key>) >
+class set
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<set<_Key, _Compare, _Alloc> >
+#endif
+{
+#if !defined (__BORLANDC__)
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare> _AssocStorageTypes;
+ typedef typename _AssocStorageTypes::_KeyStorageType _KeyStorageType;
+ typedef typename _AssocStorageTypes::_CompareStorageType _CompareStorageType;
+#else
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare>::_KeyStorageType _KeyStorageType;
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare>::_CompareStorageType _CompareStorageType;
+#endif
+ typedef typename _Alloc_traits<_KeyStorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV _CastTraits<_KeyStorageType, _Key> cast_traits;
+
+ typedef set<_Key, _Compare, _Alloc> _Self;
+public:
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+
+protected:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _SetTraitsT<value_type> _SetTraits;
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_PRIV _Identity<value_type>,
+ _SetTraits, _Alloc> _Priv_Rep_type;
+
+ typedef _STLP_PRIV _SetTraitsT<_KeyStorageType> _SetStorageTraits;
+
+public:
+ //dums: need the following public for the __move_traits framework
+ typedef _STLP_PRIV _Rb_tree<_KeyStorageType, _CompareStorageType,
+ _KeyStorageType, _STLP_PRIV _Identity<_KeyStorageType>,
+ _SetStorageTraits, _StorageTypeAlloc> _Rep_type;
+
+private:
+ typedef typename _Rep_type::iterator base_iterator;
+ typedef typename _Rep_type::const_iterator const_base_iterator;
+
+public:
+ typedef typename _Priv_Rep_type::pointer pointer;
+ typedef typename _Priv_Rep_type::const_pointer const_pointer;
+ typedef typename _Priv_Rep_type::reference reference;
+ typedef typename _Priv_Rep_type::const_reference const_reference;
+ typedef typename _Priv_Rep_type::iterator iterator;
+ typedef typename _Priv_Rep_type::const_iterator const_iterator;
+ typedef typename _Priv_Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Priv_Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Priv_Rep_type::size_type size_type;
+ typedef typename _Priv_Rep_type::difference_type difference_type;
+ typedef typename _Priv_Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing set
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+#if defined (_STLP_DEBUG)
+ static iterator _S_to_value_ite(const_base_iterator __ite)
+ { return iterator(__ite._Owner(), __ite._M_iterator._M_node); }
+ static base_iterator _S_to_storage_ite(const_iterator __ite)
+ { return base_iterator(__ite._Owner(), __ite._M_iterator._M_node); }
+#else
+ static iterator _S_to_value_ite(const_base_iterator __ite)
+ { return iterator(__ite._M_node); }
+ static base_iterator _S_to_storage_ite(const_iterator __ite)
+ { return base_iterator(__ite._M_node); }
+#endif
+
+public:
+ set() : _M_t(_CompareStorageType(), _StorageTypeAlloc()) {}
+ explicit set(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), _StorageTypeAlloc()) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_unique(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_unique(__first, __last);
+# endif
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last, const _Compare& __comp)
+ : _M_t(__comp, _StorageTypeAlloc()) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_unique(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_unique(__first, __last);
+# endif
+ }
+# endif
+ template <class _InputIterator>
+ set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_unique(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_unique(__first, __last);
+# endif
+ }
+#else
+ set(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), _StorageTypeAlloc()) {
+ _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+
+ set(const value_type* __first, const value_type* __last,
+ const _Compare& __comp, const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
+ _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+
+ set(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), _StorageTypeAlloc())
+ { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+
+ set(const_iterator __first, const_iterator __last,
+ const _Compare& __comp, const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType))
+ { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ set(const _Self& __x) : _M_t(__x._M_t) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ set(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+#endif
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return _M_t.key_comp(); }
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_t.get_allocator(), value_type); }
+
+ iterator begin() { return _S_to_value_ite(_M_t.begin()); }
+ iterator end() { return _S_to_value_ite(_M_t.end()); }
+ const_iterator begin() const { return _S_to_value_ite(_M_t.begin()); }
+ const_iterator end() const { return _S_to_value_ite(_M_t.end()); }
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ // insert/erase
+ pair<iterator,bool> insert(const value_type& __x) {
+ pair<base_iterator, bool> ret = _M_t.insert_unique(cast_traits::to_storage_type_cref(__x));
+ return pair<iterator, bool>(_S_to_value_ite(ret.first), ret.second);
+ }
+ iterator insert(iterator __pos, const value_type& __x)
+ { return _S_to_value_ite(_M_t.insert_unique(_S_to_storage_ite(__pos), cast_traits::to_storage_type_cref(__x))); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_unique(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_unique(__first, __last);
+# endif
+ }
+#else
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+ void insert(const value_type* __first, const value_type* __last) {
+ _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+#endif
+ void erase(iterator __pos)
+ { _M_t.erase(_S_to_storage_ite(__pos)); }
+ size_type erase(const key_type& __x)
+ { return _M_t.erase_unique(cast_traits::to_storage_type_cref(__x)); }
+ void erase(iterator __first, iterator __last)
+ { _M_t.erase(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+ void clear() { _M_t.clear(); }
+
+ // set operations:
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x)
+ { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const
+ { return _M_t.find(cast_traits::to_storage_type_crefT(__x)) == _M_t.end() ? 0 : 1; }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x)
+ { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x)
+ { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __x) {
+ pair<base_iterator, base_iterator> __ret;
+ __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x));
+ return pair<iterator, iterator>(_S_to_value_ite(__ret.first),
+ _S_to_value_ite(__ret.second));
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
+ pair<const_base_iterator, const_base_iterator> __ret;
+ __ret = _M_t.equal_range_unique(cast_traits::to_storage_type_crefT(__x));
+ return pair<const_iterator, const_iterator>(_S_to_value_ite(__ret.first),
+ _S_to_value_ite(__ret.second));
+ }
+};
+
+//Specific iterator traits creation
+_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, Const_traits)
+
+template <class _Key, _STLP_DFL_TMPL_PARAM(_Compare, less<_Key>),
+ _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Key>) >
+class multiset
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ : public __stlport_class<multiset<_Key, _Compare, _Alloc> >
+#endif
+{
+#if !defined (__BORLANDC__)
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare> _AssocStorageTypes;
+ typedef typename _AssocStorageTypes::_KeyStorageType _KeyStorageType;
+ typedef typename _AssocStorageTypes::_CompareStorageType _CompareStorageType;
+#else
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare>::_KeyStorageType _KeyStorageType;
+ typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare>::_CompareStorageType _CompareStorageType;
+#endif
+ typedef typename _Alloc_traits<_KeyStorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV _CastTraits<_KeyStorageType, _Key> cast_traits;
+
+ typedef multiset<_Key, _Compare, _Alloc> _Self;
+public:
+ // typedefs:
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+
+protected:
+ //Specific iterator traits creation
+ typedef _STLP_PRIV _MultisetTraitsT<value_type> _MultisetTraits;
+ typedef _STLP_PRIV _Rb_tree<key_type, key_compare,
+ value_type, _STLP_PRIV _Identity<value_type>,
+ _MultisetTraits, _Alloc> _Priv_Rep_type;
+
+ typedef _STLP_PRIV _MultisetTraitsT<_KeyStorageType> _MultisetStorageTraits;
+public:
+ //dums: need the following public for the __move_traits framework
+ typedef _STLP_PRIV _Rb_tree<_KeyStorageType, _CompareStorageType,
+ _KeyStorageType, _STLP_PRIV _Identity<_KeyStorageType>,
+ _MultisetStorageTraits, _StorageTypeAlloc> _Rep_type;
+
+private:
+ typedef typename _Rep_type::iterator base_iterator;
+ typedef typename _Rep_type::const_iterator const_base_iterator;
+
+public:
+ typedef typename _Priv_Rep_type::pointer pointer;
+ typedef typename _Priv_Rep_type::const_pointer const_pointer;
+ typedef typename _Priv_Rep_type::reference reference;
+ typedef typename _Priv_Rep_type::const_reference const_reference;
+ typedef typename _Priv_Rep_type::iterator iterator;
+ typedef typename _Priv_Rep_type::const_iterator const_iterator;
+ typedef typename _Priv_Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Priv_Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Priv_Rep_type::size_type size_type;
+ typedef typename _Priv_Rep_type::difference_type difference_type;
+ typedef typename _Priv_Rep_type::allocator_type allocator_type;
+
+private:
+ _Rep_type _M_t; // red-black tree representing multiset
+ _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
+
+#if defined (_STLP_DEBUG)
+ static iterator _S_to_value_ite(const_base_iterator __ite)
+ { return iterator(__ite._Owner(), __ite._M_iterator._M_node); }
+ static base_iterator _S_to_storage_ite(const_iterator __ite)
+ { return base_iterator(__ite._Owner(), __ite._M_iterator._M_node); }
+#else
+ static iterator _S_to_value_ite(const_base_iterator __ite)
+ { return iterator(__ite._M_node); }
+ static base_iterator _S_to_storage_ite(const_iterator __ite)
+ { return base_iterator(__ite._M_node); }
+#endif
+
+public:
+ multiset() : _M_t(_Compare(), _StorageTypeAlloc()) {}
+ explicit multiset(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {}
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last)
+ : _M_t(_Compare(), _StorageTypeAlloc()) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_equal(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_equal(__first, __last);
+# endif
+ }
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp)
+ : _M_t(__comp, _StorageTypeAlloc()) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_equal(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_equal(__first, __last);
+# endif
+ }
+# endif
+ template <class _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_equal(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_equal(__first, __last);
+# endif
+ }
+
+#else
+ multiset(const value_type* __first, const value_type* __last)
+ : _M_t(_Compare(), _StorageTypeAlloc()) {
+ _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+
+ multiset(const value_type* __first, const value_type* __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {
+ _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+
+ multiset(const_iterator __first, const_iterator __last)
+ : _M_t(_Compare(), _StorageTypeAlloc())
+ { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+
+ multiset(const_iterator __first, const_iterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType))
+ { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ multiset(const _Self& __x)
+ : _M_t(__x._M_t) {}
+
+ _Self& operator=(const _Self& __x) {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ multiset(__move_source<_Self> src)
+ : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {}
+#endif
+
+ // accessors:
+ key_compare key_comp() const { return _M_t.key_comp(); }
+ value_compare value_comp() const { return _M_t.key_comp(); }
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_t.get_allocator(), value_type); }
+
+ iterator begin() { return _S_to_value_ite(_M_t.begin()); }
+ iterator end() { return _S_to_value_ite(_M_t.end()); }
+ const_iterator begin() const { return _S_to_value_ite(_M_t.begin()); }
+ const_iterator end() const { return _S_to_value_ite(_M_t.end()); }
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+ bool empty() const { return _M_t.empty(); }
+ size_type size() const { return _M_t.size(); }
+ size_type max_size() const { return _M_t.max_size(); }
+ void swap(_Self& __x) { _M_t.swap(__x._M_t); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+ // insert/erase
+ iterator insert(const value_type& __x)
+ { return _S_to_value_ite(_M_t.insert_equal(cast_traits::to_storage_type_cref(__x))); }
+ iterator insert(iterator __pos, const value_type& __x) {
+ return _S_to_value_ite(_M_t.insert_equal(_S_to_storage_ite(__pos),
+ cast_traits::to_storage_type_cref(__x)));
+ }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ _M_t.insert_equal(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last));
+# else
+ _M_t.insert_equal(__first, __last);
+# endif
+ }
+#else
+ void insert(const value_type* __first, const value_type* __last) {
+ _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+ void insert(const_iterator __first, const_iterator __last)
+ { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ void erase(iterator __pos)
+ { _M_t.erase(_S_to_storage_ite(__pos)); }
+ size_type erase(const key_type& __x)
+ { return _M_t.erase(cast_traits::to_storage_type_cref(__x)); }
+ void erase(iterator __first, iterator __last)
+ { _M_t.erase(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); }
+ void clear() { _M_t.clear(); }
+
+ // multiset operations:
+
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator find(const _KT& __x)
+ { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator find(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ size_type count(const _KT& __x) const
+ { return _M_t.count(cast_traits::to_storage_type_crefT(__x)); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator lower_bound(const _KT& __x)
+ { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator lower_bound(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ iterator upper_bound(const _KT& __x)
+ { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ const_iterator upper_bound(const _KT& __x) const
+ { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<iterator, iterator> equal_range(const _KT& __x) {
+ pair<base_iterator, base_iterator> __ret;
+ __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x));
+ return pair<iterator, iterator>(_S_to_value_ite(__ret.first),
+ _S_to_value_ite(__ret.second));
+ }
+ _STLP_TEMPLATE_FOR_CONT_EXT
+ pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
+ pair<const_base_iterator, const_base_iterator> __ret;
+ __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x));
+ return pair<const_iterator, const_iterator>(_S_to_value_ite(__ret.first),
+ _S_to_value_ite(__ret.second));
+ }
+};
+
+#if defined (__BORLANDC__) || defined (__DMC__)
+# undef typename
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_PTR_SPECIALIZED_SET_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/pointers/_slist.h b/stlport/stl/pointers/_slist.h
new file mode 100644
index 0000000..76189fe
--- /dev/null
+++ b/stlport/stl/pointers/_slist.h
@@ -0,0 +1,427 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_SPECIALIZED_SLIST_H
+#define _STLP_SPECIALIZED_SLIST_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define SLIST_IMPL _STLP_PTR_IMPL_NAME(slist)
+
+#if defined (__BORLANDC__) || defined (__DMC__)
+# define typename
+#endif
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+_STLP_EXPORT_TEMPLATE_CLASS _Slist_node<void*>;
+typedef _Slist_node<void*> _VoidPtrSNode;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Slist_node_base, _VoidPtrSNode, allocator<_VoidPtrSNode> >;
+_STLP_EXPORT_TEMPLATE_CLASS _Slist_base<void*, allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS SLIST_IMPL<void*, allocator<void*> >;
+
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#if defined (_STLP_DEBUG)
+# define slist _STLP_NON_DBG_NAME(slist)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class slist
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (slist)
+ : public __stlport_class<slist<_Tp, _Alloc> >
+#endif
+{
+ typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_Type _StorageType;
+ typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV SLIST_IMPL<_StorageType, _StorageTypeAlloc> _Base;
+ typedef typename _Base::iterator _BaseIte;
+ typedef typename _Base::const_iterator _BaseConstIte;
+ typedef slist<_Tp, _Alloc> _Self;
+ typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
+ typedef _STLP_PRIV _Slist_node_base _Node_base;
+
+public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef forward_iterator_tag _Iterator_category;
+
+ typedef _STLP_PRIV _Slist_iterator<value_type, _Nonconst_traits<value_type> > iterator;
+ typedef _STLP_PRIV _Slist_iterator<value_type, _Const_traits<value_type> > const_iterator;
+
+ _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
+ typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
+
+public:
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
+
+ explicit slist(const allocator_type& __a = allocator_type())
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type),
+#else
+ slist(size_type __n, const value_type& __x,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__n, cast_traits::to_storage_type_cref(__x), _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit slist(size_type __n) : _M_impl(__n) {}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ // We don't need any dispatching tricks here, because _M_insert_after_range
+ // already does them.
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
+# if !defined (_STLP_USE_ITERATOR_WRAPPER)
+ : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+# else
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {
+ insert_after(before_begin(), __first, __last);
+ }
+# endif
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ // VC++ needs this crazyness
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last)
+# if !defined (_STLP_USE_WRAPPER_ITERATOR)
+ : _M_impl(__first, __last) {}
+# else
+ { insert_after(before_begin(), __first, __last); }
+# endif
+# endif
+#else /* _STLP_MEMBER_TEMPLATES */
+ slist(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type() )
+ : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+ slist(const value_type* __first, const value_type* __last,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(cast_traits::to_storage_type_cptr(__first), cast_traits::to_storage_type_cptr(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ slist(const _Self& __x) : _M_impl(__x._M_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ slist(__move_source<_Self> src)
+ : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
+#endif
+
+ _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; }
+
+ void assign(size_type __n, const value_type& __val)
+ { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_assign_dispatch(_Integer __n, _Integer __val,
+ const __true_type&)
+ { _M_impl.assign(__n, __val); }
+
+ template <class _InputIterator>
+ void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.assign(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+# else
+ _M_impl.assign(__first, __last);
+# endif
+ }
+#else
+ void assign(const value_type *__first, const value_type *__last) {
+ _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+ void assign(const_iterator __first, const_iterator __last) {
+ _M_impl.assign(_BaseConstIte(__first._M_node),
+ _BaseConstIte(__last._M_node));
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ iterator before_begin() { return iterator(_M_impl.before_begin()._M_node); }
+ const_iterator before_begin() const { return const_iterator(const_cast<_Node_base*>(_M_impl.before_begin()._M_node)); }
+
+ iterator begin() { return iterator(_M_impl.begin()._M_node); }
+ const_iterator begin() const { return const_iterator(const_cast<_Node_base*>(_M_impl.begin()._M_node));}
+
+ iterator end() { return iterator(_M_impl.end()._M_node); }
+ const_iterator end() const { return iterator(_M_impl.end()._M_node); }
+
+ size_type size() const { return _M_impl.size(); }
+ size_type max_size() const { return _M_impl.max_size(); }
+ bool empty() const { return _M_impl.empty(); }
+
+ void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+public:
+ reference front() { return *begin(); }
+ const_reference front() const { return *begin(); }
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_front(const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void push_front(const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); }
+
+# if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_front() { _M_impl.push_front();}
+# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void pop_front() { _M_impl.pop_front(); }
+
+ iterator previous(const_iterator __pos)
+ { return iterator(_M_impl.previous(_BaseConstIte(__pos._M_node))._M_node); }
+ const_iterator previous(const_iterator __pos) const
+ { return const_iterator(const_cast<_Node_base*>(_M_impl.previous(_BaseConstIte(__pos._M_node))._M_node)); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert_after(iterator __pos, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { return iterator(_M_impl.insert_after(_BaseIte(__pos._M_node),
+ cast_traits::to_storage_type_cref(__x))._M_node); }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert_after(iterator __pos)
+ { return iterator(_M_impl.insert_after(_BaseIte(__pos._M_node))._M_node);}
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert_after(iterator __pos, size_type __n, const value_type& __x)
+ { _M_impl.insert_after(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_insert_after_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&) {
+ _M_impl.insert_after(_BaseIte(__pos._M_node), __n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_after_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.insert_after(_BaseIte(__pos._M_node),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void insert_after(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_after_dispatch(__pos, __first, __last, _Integral());
+# else
+ _M_impl.insert_after(_BaseIte(__pos._M_node), __first, __last);
+# endif
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert_after(iterator __pos,
+ const_iterator __first, const_iterator __last)
+ { _M_impl.insert_after(_BaseIte(__pos._M_node),
+ _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
+ void insert_after(iterator __pos,
+ const value_type* __first, const value_type* __last) {
+ _M_impl.insert_after(_BaseIte(__pos._M_node),
+ cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert(iterator __pos, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { return iterator(_M_impl.insert(_BaseIte(__pos._M_node),
+ cast_traits::to_storage_type_cref(__x))._M_node); }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ iterator insert(iterator __pos)
+ { return iterator(_M_impl.insert(_BaseIte(__pos._M_node))._M_node); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+private:
+ template <class _Integer>
+ void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ const __true_type&) {
+ _M_impl.insert(_BaseIte(__pos._M_node), __n, __val);
+ }
+
+ template <class _InputIterator>
+ void _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ const __false_type&) {
+ _M_impl.insert(_BaseIte(__pos._M_node), _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first),
+ _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last));
+ }
+
+public:
+# endif
+
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
+# if defined (_STLP_USE_ITERATOR_WRAPPER)
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
+ _M_insert_dispatch(__pos, __first, __last, _Integral());
+# else
+ _M_impl.insert(_BaseIte(__pos._M_node), __first, __last);
+# endif
+ }
+
+#else /* _STLP_MEMBER_TEMPLATES */
+ void insert(iterator __pos, const_iterator __first, const_iterator __last)
+ { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); }
+ void insert(iterator __pos, const value_type* __first, const value_type* __last)
+ { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ iterator erase_after(iterator __pos)
+ { return iterator(_M_impl.erase_after(_BaseIte(__pos._M_node))._M_node); }
+ iterator erase_after(iterator __before_first, iterator __last)
+ { return iterator(_M_impl.erase_after(_BaseIte(__before_first._M_node),
+ _BaseIte(__last._M_node))._M_node); }
+
+ iterator erase(iterator __pos)
+ { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); }
+ iterator erase(iterator __first, iterator __last)
+ { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void resize(size_type __new_size, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { _M_impl.resize(__new_size); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear() { _M_impl.clear(); }
+
+ void splice_after(iterator __pos, _Self& __x,
+ iterator __before_first, iterator __before_last)
+ { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl,
+ _BaseIte(__before_first._M_node), _BaseIte(__before_last._M_node)); }
+ void splice_after(iterator __pos, _Self& __x, iterator __prev)
+ { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__prev._M_node)); }
+ void splice_after(iterator __pos, _Self& __x)
+ { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl); }
+ void splice(iterator __pos, _Self& __x)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); }
+ void splice(iterator __pos, _Self& __x, iterator __i)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); }
+ void splice(iterator __pos, _Self& __x, iterator __first, iterator __last)
+ { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl,
+ _BaseIte(__first._M_node), _BaseIte(__last._M_node)); }
+
+ void reverse() { _M_impl.reverse(); }
+
+ void remove(const value_type& __val) { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); }
+ void unique() { _M_impl.unique(); }
+ void merge(_Self& __x) { _M_impl.merge(__x._M_impl); }
+ void sort() {_M_impl.sort(); }
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ template <class _Predicate>
+ void remove_if(_Predicate __pred)
+ { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); }
+
+ template <class _BinaryPredicate>
+ void unique(_BinaryPredicate __pred)
+ { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__pred)); }
+
+ template <class _StrictWeakOrdering>
+ void merge(_Self& __x, _StrictWeakOrdering __comp)
+ { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
+
+ template <class _StrictWeakOrdering>
+ void sort(_StrictWeakOrdering __comp)
+ { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+private:
+ _Base _M_impl;
+};
+
+#if defined (slist)
+# undef slist
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#undef SLIST_IMPL
+
+#if defined (__BORLANDC__) || defined (__DMC__)
+# undef typename
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_SPECIALIZED_SLIST_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/stl/pointers/_tools.h b/stlport/stl/pointers/_tools.h
new file mode 100644
index 0000000..ec94806
--- /dev/null
+++ b/stlport/stl/pointers/_tools.h
@@ -0,0 +1,471 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+#define _STLP_POINTERS_SPEC_TOOLS_H
+
+#ifndef _STLP_TYPE_TRAITS_H
+# include <stl/type_traits.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+//Some usefull declarations:
+template <class _Tp> struct less;
+
+_STLP_MOVE_TO_PRIV_NAMESPACE
+
+template <class _StorageT, class _ValueT, class _BinaryPredicate>
+struct _BinaryPredWrapper;
+
+/*
+ * Since the compiler only allows at most one non-trivial
+ * implicit conversion we can make use of a shim class to
+ * be sure that functions below doesn't accept classes with
+ * implicit pointer conversion operators
+ */
+struct _VoidPointerShim
+{ _VoidPointerShim(void*); };
+struct _ConstVoidPointerShim
+{ _ConstVoidPointerShim(const void*); };
+struct _VolatileVoidPointerShim
+{ _VolatileVoidPointerShim(volatile void*); };
+struct _ConstVolatileVoidPointerShim
+{ _ConstVolatileVoidPointerShim(const volatile void*); };
+
+//The dispatch functions:
+template <class _Tp>
+char _UseVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
+char _UseVoidPtrStorageType(const __true_type& /*POD*/, ...);
+char* _UseVoidPtrStorageType(const __true_type& /*POD*/, _VoidPointerShim);
+
+template <class _Tp>
+char _UseConstVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
+char _UseConstVoidPtrStorageType(const __true_type& /*POD*/, ...);
+char* _UseConstVoidPtrStorageType(const __true_type& /*POD*/, _ConstVoidPointerShim);
+
+template <class _Tp>
+char _UseVolatileVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
+char _UseVolatileVoidPtrStorageType(const __true_type& /*POD*/, ...);
+char* _UseVolatileVoidPtrStorageType(const __true_type& /*POD*/, _VolatileVoidPointerShim);
+
+template <class _Tp>
+char _UseConstVolatileVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&);
+char _UseConstVolatileVoidPtrStorageType(const __true_type& /*POD*/, ...);
+char* _UseConstVolatileVoidPtrStorageType(const __true_type& /*POD*/, _ConstVolatileVoidPointerShim);
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/* Thanks to class partial specialization the pointer specialization feature can even be used in
+ * presence of incomplete type:
+ * struct MyStruct {
+ * typedef vector<MyStruct> MyStructContainer;
+ * typedef MyStructContainer::iterator MyStructIterator;
+ * };
+ */
+
+template <class _Tp>
+struct _StorageType {
+ typedef _Tp _QualifiedType;
+ typedef _Tp _Type;
+ enum { use_const_volatile_void_ptr = 0 };
+};
+
+template <class _Tp>
+struct _StorageType<_Tp*> {
+ // Even if we detect a pointer type we use dispatch function to consider if it can be stored as a void*.
+ // For instance function pointer might not necessarily be convertible to void*.
+ enum { use_void_ptr = (sizeof(_UseVoidPtrStorageType(__true_type(),
+ __STATIC_CAST(_Tp*, 0))) == sizeof(char*)) };
+ enum { use_const_volatile_void_ptr = use_void_ptr };
+ typedef typename __select<use_void_ptr,
+ void*,
+ _Tp*>::_Ret _QualifiedType;
+ typedef _QualifiedType _Type;
+};
+
+template <class _Tp>
+struct _StorageType<_Tp const*> {
+ enum { use_void_ptr = (sizeof(_UseConstVoidPtrStorageType(__true_type(),
+ __STATIC_CAST(const _Tp*, 0))) == sizeof(char*)) };
+ enum { use_const_volatile_void_ptr = use_void_ptr };
+ typedef typename __select<use_void_ptr,
+ const void*,
+ const _Tp*>::_Ret _QualifiedType;
+ typedef typename __select<use_void_ptr,
+ void*,
+ const _Tp*>::_Ret _Type;
+};
+
+template <class _Tp>
+struct _StorageType<_Tp volatile*> {
+ enum { use_void_ptr = (sizeof(_UseVolatileVoidPtrStorageType(__true_type(),
+ __STATIC_CAST(_Tp volatile*, 0))) == sizeof(char*)) };
+ enum { use_const_volatile_void_ptr = use_void_ptr };
+ typedef typename __select<use_void_ptr,
+ volatile void*,
+ volatile _Tp*>::_Ret _QualifiedType;
+ typedef typename __select<use_void_ptr,
+ void*,
+ volatile _Tp*>::_Ret _Type;
+};
+
+template <class _Tp>
+struct _StorageType<_Tp const volatile*> {
+ enum { use_void_ptr = (sizeof(_UseConstVolatileVoidPtrStorageType(__true_type(),
+ __STATIC_CAST(_Tp const volatile*, 0))) == sizeof(char*)) };
+ enum { use_const_volatile_void_ptr = use_void_ptr };
+ typedef typename __select<use_void_ptr,
+ const volatile void*,
+ const volatile _Tp*>::_Ret _QualifiedType;
+ typedef typename __select<use_void_ptr,
+ void*,
+ const volatile _Tp*>::_Ret _Type;
+};
+#else
+template <class _Tp>
+struct _StorageType {
+ typedef typename __type_traits<_Tp>::is_POD_type _PODType;
+
+#if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
+ static _Tp __null_rep();
+#else
+ static _Tp __null_rep;
+#endif
+ enum { use_void_ptr = (sizeof(_UseVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
+ enum { use_const_void_ptr = (sizeof(_UseConstVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
+ enum { use_volatile_void_ptr = (sizeof(_UseVolatileVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
+ enum { use_const_volatile_void_ptr = (sizeof(_UseConstVolatileVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) };
+
+ typedef typename __select<!use_const_volatile_void_ptr,
+ _Tp,
+ typename __select<use_void_ptr,
+ void*,
+ typename __select<use_const_void_ptr,
+ const void*,
+ typename __select<use_volatile_void_ptr,
+ volatile void*,
+ const volatile void*>::_Ret >::_Ret >::_Ret >::_Ret _QualifiedType;
+
+#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ /* If the compiler do not support the iterator_traits structure we cannot wrap
+ * iterators pass to container template methods. The iterator dereferenced value
+ * has to be storable without any cast in the chosen storage type. To guaranty
+ * that the void pointer has to be correctly qualified.
+ */
+ typedef _QualifiedType _Type;
+#else
+ /* With iterator_traits we can wrap passed iterators and make the necessary casts.
+ * We can always use a simple void* storage type:
+ */
+ typedef typename __select<use_const_volatile_void_ptr,
+ void*,
+ _Tp>::_Ret _Type;
+#endif
+};
+#endif
+
+template <class _Tp, class _Compare>
+struct _AssocStorageTypes {
+ typedef _StorageType<_Tp> _StorageTypeInfo;
+ typedef typename _StorageTypeInfo::_Type _SType;
+
+ //We need to also check that the comparison functor used to instanciate the assoc container
+ //is the default Standard less implementation:
+ enum { ptr_type = _StorageTypeInfo::use_const_volatile_void_ptr };
+ typedef typename _IsSTLportClass<_Compare>::_Ret _STLportLess;
+ enum { is_default_less = __type2bool<_STLportLess>::_Ret };
+ typedef typename __select<is_default_less, _SType, _Tp>::_Ret _KeyStorageType;
+ typedef typename __select<is_default_less && ptr_type,
+ _BinaryPredWrapper<_KeyStorageType, _Tp, _Compare>,
+ _Compare>::_Ret _CompareStorageType;
+};
+
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/*
+ * Base struct to deal with qualifiers
+ */
+template <class _StorageT, class _QualifiedStorageT>
+struct _VoidCastTraitsAux {
+ typedef _QualifiedStorageT void_cv_type;
+ typedef _StorageT void_type;
+
+ static void_type * uncv_ptr(void_cv_type *__ptr)
+ { return __ptr; }
+ static void_type const* uncv_cptr(void_cv_type const*__ptr)
+ { return __ptr; }
+ static void_type ** uncv_pptr(void_cv_type **__ptr)
+ { return __ptr; }
+ static void_type & uncv_ref(void_cv_type & __ref)
+ { return __ref; }
+ static void_type const& uncv_cref(void_cv_type const& __ref)
+ { return __ref; }
+ static void_cv_type* cv_ptr(void_type *__ptr)
+ { return __ptr; }
+ static void_cv_type const* cv_cptr(void_type const*__ptr)
+ { return __ptr; }
+ static void_cv_type ** cv_pptr(void_type **__ptr)
+ { return __ptr; }
+ static void_cv_type & cv_ref(void_type & __ref)
+ { return __ref; }
+ static void_cv_type const& cv_cref(void_type const& __ref)
+ { return __ref; }
+};
+
+template <class _VoidCVType>
+struct _VoidCastTraitsAuxBase {
+ typedef _VoidCVType* void_cv_type;
+ typedef void* void_type;
+
+ static void_type* uncv_ptr(void_cv_type *__ptr)
+ { return __CONST_CAST(void_type*, __ptr); }
+ static void_type const* uncv_cptr(void_cv_type const*__ptr)
+ { return __CONST_CAST(void_type const*, __ptr); }
+ static void_type** uncv_pptr(void_cv_type **__ptr)
+ { return __CONST_CAST(void_type**, __ptr); }
+ static void_type& uncv_ref(void_cv_type &__ref)
+ { return __CONST_CAST(void_type&, __ref); }
+ static void_type const& uncv_cref(void_cv_type const& __ptr)
+ { return __CONST_CAST(void_type const&, __ptr); }
+ // The reverse versions
+ static void_cv_type * cv_ptr(void_type *__ptr)
+ { return __CONST_CAST(void_cv_type *, __ptr); }
+ static void_cv_type const* cv_cptr(void_type const*__ptr)
+ { return __CONST_CAST(void_cv_type const*, __ptr); }
+ static void_cv_type ** cv_pptr(void_type **__ptr)
+ { return __CONST_CAST(void_cv_type**, __ptr); }
+ static void_cv_type & cv_ref(void_type &__ref)
+ { return __CONST_CAST(void_cv_type &, __ref); }
+ static void_cv_type const& cv_cref(void_type const& __ref)
+ { return __CONST_CAST(void_cv_type const&, __ref); }
+};
+
+_STLP_TEMPLATE_NULL
+struct _VoidCastTraitsAux<void*, const void*> : _VoidCastTraitsAuxBase<void const>
+{};
+_STLP_TEMPLATE_NULL
+struct _VoidCastTraitsAux<void*, volatile void*> : _VoidCastTraitsAuxBase<void volatile>
+{};
+_STLP_TEMPLATE_NULL
+struct _VoidCastTraitsAux<void*, const volatile void*> : _VoidCastTraitsAuxBase<void const volatile>
+{};
+
+template <class _StorageT, class _ValueT>
+struct _CastTraits {
+ typedef _ValueT value_type;
+ typedef typename _StorageType<_ValueT>::_QualifiedType _QualifiedStorageT;
+ typedef _VoidCastTraitsAux<_StorageT, _QualifiedStorageT> cv_traits;
+ typedef typename cv_traits::void_type void_type;
+ typedef typename cv_traits::void_cv_type void_cv_type;
+
+ static value_type * to_value_type_ptr(void_type *__ptr)
+ { return __REINTERPRET_CAST(value_type *, cv_traits::cv_ptr(__ptr)); }
+ static value_type const* to_value_type_cptr(void_type const*__ptr)
+ { return __REINTERPRET_CAST(value_type const*, cv_traits::cv_cptr(__ptr)); }
+ static value_type ** to_value_type_pptr(void_type **__ptr)
+ { return __REINTERPRET_CAST(value_type **, cv_traits::cv_pptr(__ptr)); }
+ static value_type & to_value_type_ref(void_type &__ref)
+ { return __REINTERPRET_CAST(value_type &, cv_traits::cv_ref(__ref)); }
+ static value_type const& to_value_type_cref(void_type const& __ptr)
+ { return __REINTERPRET_CAST(value_type const&, cv_traits::cv_cref(__ptr)); }
+ // Reverse versions
+ static void_type * to_storage_type_ptr(value_type *__ptr)
+ { return cv_traits::uncv_ptr(__REINTERPRET_CAST(void_cv_type *, __ptr)); }
+ static void_type const* to_storage_type_cptr(value_type const*__ptr)
+ { return cv_traits::uncv_cptr(__REINTERPRET_CAST(void_cv_type const*, __ptr)); }
+ static void_type ** to_storage_type_pptr(value_type **__ptr)
+ { return cv_traits::uncv_pptr(__REINTERPRET_CAST(void_cv_type **, __ptr)); }
+ static void_type const& to_storage_type_cref(value_type const& __ref)
+ { return cv_traits::uncv_cref(__REINTERPRET_CAST(void_cv_type const&, __ref)); }
+
+ //Method used to treat set container template method extension
+ static void_type const& to_storage_type_crefT(value_type const& __ref)
+ { return to_storage_type_cref(__ref); }
+};
+
+template <class _Tp>
+struct _CastTraits<_Tp, _Tp> {
+ typedef _Tp storage_type;
+ typedef _Tp value_type;
+
+ static value_type * to_value_type_ptr(storage_type *__ptr)
+ { return __ptr; }
+ static value_type const* to_value_type_cptr(storage_type const*__ptr)
+ { return __ptr; }
+ static value_type ** to_value_type_pptr(storage_type **__ptr)
+ { return __ptr; }
+ static value_type & to_value_type_ref(storage_type &__ref)
+ { return __ref; }
+ static value_type const& to_value_type_cref(storage_type const&__ref)
+ { return __ref; }
+ // Reverse versions
+ static storage_type * to_storage_type_ptr(value_type *__ptr)
+ { return __ptr; }
+ static storage_type const* to_storage_type_cptr(value_type const*__ptr)
+ { return __ptr; }
+ static storage_type ** to_storage_type_pptr(value_type **__ptr)
+ { return __ptr; }
+ static storage_type const& to_storage_type_cref(value_type const& __ref)
+ { return __ref; }
+
+ //Method used to treat set container template method extension
+ template <class _Tp1>
+ static _Tp1 const& to_storage_type_crefT(_Tp1 const& __ref)
+ { return __ref; }
+};
+
+#define _STLP_USE_ITERATOR_WRAPPER
+
+template <class _StorageT, class _ValueT, class _Iterator>
+struct _IteWrapper {
+ typedef _CastTraits<_StorageT, _ValueT> cast_traits;
+ typedef iterator_traits<_Iterator> _IteTraits;
+
+ typedef typename _IteTraits::iterator_category iterator_category;
+ typedef _StorageT value_type;
+ typedef typename _IteTraits::difference_type difference_type;
+ typedef value_type* pointer;
+ typedef value_type const& const_reference;
+ //This wrapper won't be used for input so to avoid surprise
+ //the reference type will be a const reference:
+ typedef const_reference reference;
+
+ typedef _IteWrapper<_StorageT, _ValueT, _Iterator> _Self;
+ typedef _Self _Ite;
+
+ _IteWrapper(_Iterator &__ite) : _M_ite(__ite) {}
+
+ const_reference operator*() const { return cast_traits::to_storage_type_cref(*_M_ite); }
+
+ _Self& operator= (_Self const& __rhs) {
+ _M_ite = __rhs._M_ite;
+ return *this;
+ }
+
+ _Self& operator++() {
+ ++_M_ite;
+ return *this;
+ }
+
+ _Self& operator--() {
+ --_M_ite;
+ return *this;
+ }
+
+ _Self& operator += (difference_type __offset) {
+ _M_ite += __offset;
+ return *this;
+ }
+ difference_type operator -(_Self const& __other) const
+ { return _M_ite - __other._M_ite; }
+
+ bool operator == (_Self const& __other) const
+ { return _M_ite == __other._M_ite; }
+
+ bool operator != (_Self const& __other) const
+ { return _M_ite != __other._M_ite; }
+
+ bool operator < (_Self const& __rhs) const
+ { return _M_ite < __rhs._M_ite; }
+
+private:
+ _Iterator _M_ite;
+};
+
+template <class _Tp, class _Iterator>
+struct _IteWrapper<_Tp, _Tp, _Iterator>
+{ typedef _Iterator _Ite; };
+
+#else
+
+/*
+ * In this config the storage type is qualified in respect of the
+ * value_type qualification. Simple reinterpret_cast is enough.
+ */
+template <class _StorageT, class _ValueT>
+struct _CastTraits {
+ typedef _StorageT storage_type;
+ typedef _ValueT value_type;
+
+ static value_type * to_value_type_ptr(storage_type *__ptr)
+ { return __REINTERPRET_CAST(value_type*, __ptr); }
+ static value_type const* to_value_type_cptr(storage_type const*__ptr)
+ { return __REINTERPRET_CAST(value_type const*, __ptr); }
+ static value_type ** to_value_type_pptr(storage_type **__ptr)
+ { return __REINTERPRET_CAST(value_type **, __ptr); }
+ static value_type & to_value_type_ref(storage_type &__ref)
+ { return __REINTERPRET_CAST(value_type&, __ref); }
+ static value_type const& to_value_type_cref(storage_type const&__ref)
+ { return __REINTERPRET_CAST(value_type const&, __ref); }
+ // Reverse versions
+ static storage_type * to_storage_type_ptr(value_type *__ptr)
+ { return __REINTERPRET_CAST(storage_type*, __ptr); }
+ static storage_type const* to_storage_type_cptr(value_type const*__ptr)
+ { return __REINTERPRET_CAST(storage_type const*, __ptr); }
+ static storage_type ** to_storage_type_pptr(value_type **__ptr)
+ { return __REINTERPRET_CAST(storage_type **, __ptr); }
+ static storage_type const& to_storage_type_cref(value_type const&__ref)
+ { return __REINTERPRET_CAST(storage_type const&, __ref); }
+ template <class _Tp1>
+ static _Tp1 const& to_storage_type_crefT(_Tp1 const& __ref)
+ { return __ref; }
+};
+
+#endif
+
+//Wrapper functors:
+template <class _StorageT, class _ValueT, class _UnaryPredicate>
+struct _UnaryPredWrapper {
+ typedef _CastTraits<_StorageT, _ValueT> cast_traits;
+
+ _UnaryPredWrapper (_UnaryPredicate const& __pred) : _M_pred(__pred) {}
+
+ bool operator () (_StorageT const& __ref) const
+ { return _M_pred(cast_traits::to_value_type_cref(__ref)); }
+
+private:
+ _UnaryPredicate _M_pred;
+};
+
+template <class _StorageT, class _ValueT, class _BinaryPredicate>
+struct _BinaryPredWrapper {
+ typedef _CastTraits<_StorageT, _ValueT> cast_traits;
+
+ _BinaryPredWrapper () {}
+ _BinaryPredWrapper (_BinaryPredicate const& __pred) : _M_pred(__pred) {}
+
+ _BinaryPredicate get_pred() const { return _M_pred; }
+
+ bool operator () (_StorageT const& __fst, _StorageT const& __snd) const
+ { return _M_pred(cast_traits::to_value_type_cref(__fst), cast_traits::to_value_type_cref(__snd)); }
+
+ //Cast operator used to transparently access underlying predicate
+ //in set::key_comp() method
+ operator _BinaryPredicate() const
+ { return _M_pred; }
+
+private:
+ _BinaryPredicate _M_pred;
+};
+
+_STLP_MOVE_TO_STD_NAMESPACE
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_POINTERS_SPEC_TOOLS_H */
diff --git a/stlport/stl/pointers/_vector.h b/stlport/stl/pointers/_vector.h
new file mode 100644
index 0000000..64705bf
--- /dev/null
+++ b/stlport/stl/pointers/_vector.h
@@ -0,0 +1,243 @@
+/*
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* NOTE: This is an internal header file, included by other STL headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STLP_SPECIALIZED_VECTOR_H
+#define _STLP_SPECIALIZED_VECTOR_H
+
+#ifndef _STLP_POINTERS_SPEC_TOOLS_H
+# include <stl/pointers/_tools.h>
+#endif
+
+_STLP_BEGIN_NAMESPACE
+
+#define VECTOR_IMPL _STLP_PTR_IMPL_NAME(vector)
+
+#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_PRIV _Vector_base<void*,allocator<void*> >;
+_STLP_EXPORT_TEMPLATE_CLASS _STLP_PRIV VECTOR_IMPL<void*, allocator<void*> >;
+#endif
+
+#if defined (_STLP_DEBUG)
+# define vector _STLP_NON_DBG_NAME(vector)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+#endif
+
+template <class _Tp, _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Tp>) >
+class vector
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (vector)
+ : public __stlport_class<vector<_Tp, _Alloc> >
+#endif
+{
+ /* In the vector implementation iterators are pointer which give a number
+ * of opportunities for optimization. To not break those optimizations
+ * iterators passed to template should not be wrapped for casting purpose.
+ * So vector implementation will always use a qualified void pointer type and
+ * won't use iterator wrapping.
+ */
+ typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_QualifiedType _StorageType;
+ typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc;
+ typedef _STLP_PRIV VECTOR_IMPL<_StorageType, _StorageTypeAlloc> _Base;
+ typedef vector<_Tp, _Alloc> _Self;
+
+ typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits;
+
+public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef random_access_iterator_tag _Iterator_category;
+
+ _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
+ _STLP_FORCE_ALLOCATORS(value_type, _Alloc)
+ typedef typename _Alloc_traits<value_type, _Alloc>::allocator_type allocator_type;
+
+ allocator_type get_allocator() const
+ { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); }
+
+ iterator begin() { return cast_traits::to_value_type_ptr(_M_impl.begin()); }
+ const_iterator begin() const { return cast_traits::to_value_type_cptr(_M_impl.begin()); }
+ iterator end() { return cast_traits::to_value_type_ptr(_M_impl.end()); }
+ const_iterator end() const { return cast_traits::to_value_type_cptr(_M_impl.end()); }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+ size_type size() const { return _M_impl.size(); }
+ size_type max_size() const { return _M_impl.max_size(); }
+
+ size_type capacity() const { return _M_impl.capacity(); }
+ bool empty() const { return _M_impl.empty(); }
+
+ reference operator[](size_type __n) { return cast_traits::to_value_type_ref(_M_impl[__n]); }
+ const_reference operator[](size_type __n) const { return cast_traits::to_value_type_cref(_M_impl[__n]); }
+
+ reference front() { return cast_traits::to_value_type_ref(_M_impl.front()); }
+ const_reference front() const { return cast_traits::to_value_type_cref(_M_impl.front()); }
+ reference back() { return cast_traits::to_value_type_ref(_M_impl.back()); }
+ const_reference back() const { return cast_traits::to_value_type_cref(_M_impl.back()); }
+
+ reference at(size_type __n) { return cast_traits::to_value_type_ref(_M_impl.at(__n)); }
+ const_reference at(size_type __n) const { return cast_traits::to_value_type_cref(_M_impl.at(__n)); }
+
+ explicit vector(const allocator_type& __a = allocator_type())
+ : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type),
+#else
+ vector(size_type __n, const value_type& __val,
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__n, cast_traits::to_storage_type_cref(__val),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ explicit vector(size_type __n)
+ : _M_impl(__n, allocator_type() ) {}
+#endif
+
+ vector(const _Self& __x)
+ : _M_impl(__x._M_impl) {}
+
+#if !defined (_STLP_NO_MOVE_SEMANTIC)
+ explicit vector(__move_source<_Self> src)
+ : _M_impl(__move_source<_Base>(src.get()._M_impl)) {}
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL )
+ : _M_impl(__first, __last,
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+
+# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
+ template <class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last)
+ : _M_impl(__first, __last) {}
+# endif
+
+#else
+ vector(const_iterator __first, const_iterator __last,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(cast_traits::to_storage_type_cptr(__first), cast_traits::to_storage_type_cptr(__last),
+ _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {}
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+ _Self& operator=(const _Self& __x) { _M_impl = __x._M_impl; return *this; }
+
+ void reserve(size_type __n) {_M_impl.reserve(__n);}
+ void assign(size_type __n, const value_type& __val)
+ { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); }
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void assign(_InputIterator __first, _InputIterator __last)
+ { _M_impl.assign(__first, __last); }
+#else
+ void assign(const_iterator __first, const_iterator __last) {
+ _M_impl.assign(cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+#endif /* _STLP_MEMBER_TEMPLATES */
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_back(const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void push_back(const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ iterator insert(iterator __pos, const value_type& __x)
+#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+ { return cast_traits::to_value_type_ptr(_M_impl.insert(cast_traits::to_storage_type_ptr(__pos),
+ cast_traits::to_storage_type_cref(__x))); }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS)
+ void push_back() { _M_impl.push_back(); }
+ iterator insert(iterator __pos)
+ { return _M_impl.insert(cast_traits::to_storage_type_ptr(__pos)); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/
+
+ void swap(_Self& __x) { _M_impl.swap(__x._M_impl); }
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(_Self& __x) { swap(__x); }
+#endif
+
+#if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _InputIterator>
+ void insert(iterator __pos, _InputIterator __first, _InputIterator __last)
+ { _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), __first, __last); }
+#else
+ void insert(iterator __pos, const_iterator __first, const_iterator __last) {
+ _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), cast_traits::to_storage_type_cptr(__first),
+ cast_traits::to_storage_type_cptr(__last));
+ }
+#endif
+
+ void insert (iterator __pos, size_type __n, const value_type& __x) {
+ _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), __n, cast_traits::to_storage_type_cref(__x));
+ }
+
+ void pop_back() {_M_impl.pop_back();}
+ iterator erase(iterator __pos)
+ {return cast_traits::to_value_type_ptr(_M_impl.erase(cast_traits::to_storage_type_ptr(__pos)));}
+ iterator erase(iterator __first, iterator __last) {
+ return cast_traits::to_value_type_ptr(_M_impl.erase(cast_traits::to_storage_type_ptr(__first),
+ cast_traits::to_storage_type_ptr(__last)));
+ }
+
+#if !defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type))
+#else
+ void resize(size_type __new_size, const value_type& __x)
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+ { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); }
+
+#if defined(_STLP_DONT_SUP_DFLT_PARAM)
+ void resize(size_type __new_size) { _M_impl.resize(__new_size); }
+#endif /*_STLP_DONT_SUP_DFLT_PARAM*/
+
+ void clear() { _M_impl.clear(); }
+
+private:
+ _Base _M_impl;
+};
+
+#if defined (vector)
+# undef vector
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+#undef VECTOR_IMPL
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_SPECIALIZED_VECTOR_H */
diff --git a/stlport/stl/type_manips.h b/stlport/stl/type_manips.h
new file mode 100644
index 0000000..410b59d
--- /dev/null
+++ b/stlport/stl/type_manips.h
@@ -0,0 +1,321 @@
+/*
+ *
+ * Copyright (c) 2003
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+
+#ifndef _STLP_TYPE_MANIPS_H
+#define _STLP_TYPE_MANIPS_H
+
+_STLP_BEGIN_NAMESPACE
+
+struct __true_type {};
+struct __false_type {};
+
+#if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_DONT_USE_PRIV_NAMESPACE)
+_STLP_MOVE_TO_PRIV_NAMESPACE
+using _STLP_STD::__true_type;
+using _STLP_STD::__false_type;
+_STLP_MOVE_TO_STD_NAMESPACE
+#endif
+
+//bool to type
+template <int _Is>
+struct __bool2type
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct __bool2type<1> { typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct __bool2type<0> { typedef __false_type _Ret; };
+
+//type to bool
+template <class __bool_type>
+struct __type2bool { enum {_Ret = 1}; };
+
+_STLP_TEMPLATE_NULL
+struct __type2bool<__true_type> { enum {_Ret = 1}; };
+
+_STLP_TEMPLATE_NULL
+struct __type2bool<__false_type> { enum {_Ret = 0}; };
+
+//Negation
+template <class _BoolType>
+struct _Not { typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Not<__false_type> { typedef __true_type _Ret; };
+
+// logical and of 2 predicated
+template <class _P1, class _P2>
+struct _Land2 { typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Land2<__true_type, __true_type> { typedef __true_type _Ret; };
+
+// logical and of 3 predicated
+template <class _P1, class _P2, class _P3>
+struct _Land3 { typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Land3<__true_type, __true_type, __true_type> { typedef __true_type _Ret; };
+
+//logical or of 2 predicated
+template <class _P1, class _P2>
+struct _Lor2 { typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Lor2<__false_type, __false_type> { typedef __false_type _Ret; };
+
+// logical or of 3 predicated
+template <class _P1, class _P2, class _P3>
+struct _Lor3 { typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL
+struct _Lor3<__false_type, __false_type, __false_type> { typedef __false_type _Ret; };
+
+////////////////////////////////////////////////////////////////////////////////
+// class template __select
+// Selects one of two types based upon a boolean constant
+// Invocation: __select<_Cond, T, U>::Result
+// where:
+// flag is a compile-time boolean constant
+// T and U are types
+// Result evaluates to T if flag is true, and to U otherwise.
+////////////////////////////////////////////////////////////////////////////////
+// BEWARE: If the compiler do not support partial template specialization or nested template
+//classes the default behavior of the __select is to consider the condition as false and so return
+//the second template type!!
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if defined (__BORLANDC__)
+template <class _CondT, class _Tp1, class _Tp2>
+struct __selectT { typedef _Tp1 _Ret; };
+
+template <class _Tp1, class _Tp2>
+struct __selectT<__false_type, _Tp1, _Tp2> { typedef _Tp2 _Ret; };
+# endif
+
+# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x590)
+template <bool _Cond, class _Tp1, class _Tp2>
+struct __select { typedef _Tp1 _Ret; };
+
+template <class _Tp1, class _Tp2>
+struct __select<false, _Tp1, _Tp2> { typedef _Tp2 _Ret; };
+# else
+template <bool _Cond, class _Tp1, class _Tp2>
+struct __select
+{ typedef __selectT<typename __bool2type<_Cond>::_Ret, _Tp1, _Tp2>::_Ret _Ret; };
+# endif
+
+#else
+
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+template <int _Cond>
+struct __select_aux {
+ template <class _Tp1, class _Tp2>
+ struct _In {
+ typedef _Tp1 _Ret;
+ };
+};
+
+_STLP_TEMPLATE_NULL
+struct __select_aux<0> {
+ template <class _Tp1, class _Tp2>
+ struct _In {
+ typedef _Tp2 _Ret;
+ };
+};
+
+template <int _Cond, class _Tp1, class _Tp2>
+struct __select {
+ typedef typename __select_aux<_Cond>::_STLP_TEMPLATE _In<_Tp1, _Tp2>::_Ret _Ret;
+};
+# else /* _STLP_MEMBER_TEMPLATE_CLASSES */
+//default behavior
+template <int _Cond, class _Tp1, class _Tp2>
+struct __select {
+ typedef _Tp2 _Ret;
+};
+# endif /* _STLP_MEMBER_TEMPLATE_CLASSES */
+
+#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+/* Rather than introducing a new macro for the following constrution we use
+ * an existing one (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) that
+ * is used for a similar feature.
+ */
+#if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && \
+ (!defined (__GNUC__) || (__GNUC__ > 2))
+// Helper struct that will forbid volatile qualified types:
+# if !defined (__BORLANDC__)
+struct _NoVolatilePointerShim { _NoVolatilePointerShim(const void*); };
+template <class _Tp>
+char _STLP_CALL _IsCopyableFun(bool, _NoVolatilePointerShim, _Tp const*, _Tp*); // no implementation is required
+char* _STLP_CALL _IsCopyableFun(bool, ...); // no implementation is required
+
+template <class _Src, class _Dst>
+struct _Copyable {
+ static _Src* __null_src();
+ static _Dst* __null_dst();
+ enum { _Ret = (sizeof(_IsCopyableFun(false, __null_src(), __null_src(), __null_dst())) == sizeof(char)) };
+ typedef typename __bool2type<_Ret>::_Ret _RetT;
+};
+# else
+template <class _Tp1, class _Tp2> struct _AreSameTypes;
+template <class _Tp> struct _IsUnQual;
+template <class _Src, class _Dst>
+struct _Copyable {
+ typedef typename _AreSameTypes<_Src, _Dst>::_Ret _Tr1;
+ typedef typename _IsUnQual<_Dst>::_Ret _Tr2;
+ typedef typename _Land2<_Tr1, _Tr2>::_Ret _RetT;
+ enum { _Ret = __type2bool<_RetT>::_Ret };
+};
+# endif
+#else
+template <class _Src, class _Dst>
+struct _Copyable {
+ enum { _Ret = 0 };
+ typedef __false_type _RetT;
+};
+#endif
+
+/*
+ * The following struct will tell you if 2 types are the same and if copying memory
+ * from the _Src type to the _Dst type is right considering qualifiers. If _Src and
+ * _Dst types are the same unqualified types _Ret will be false if:
+ * - any of the type has the volatile qualifier
+ * - _Dst is const qualified
+ */
+template <class _Src, class _Dst>
+struct _AreCopyable {
+ enum { _Same = _Copyable<_Src, _Dst>::_Ret };
+ typedef typename _Copyable<_Src, _Dst>::_RetT _Ret;
+};
+
+template <class _Tp1, class _Tp2>
+struct _AreSameTypes {
+ enum { _Same = 0 };
+ typedef __false_type _Ret;
+};
+
+#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct _AreSameTypes<_Tp, _Tp> {
+ enum { _Same = 1 };
+ typedef __true_type _Ret;
+};
+#endif
+
+#if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+template <class _Src, class _Dst>
+struct _ConversionHelper {
+ static char _Test(bool, _Dst);
+ static char* _Test(bool, ...);
+ static _Src _MakeSource();
+};
+
+template <class _Src, class _Dst>
+struct _IsConvertible {
+ typedef _ConversionHelper<_Src*, const volatile _Dst*> _H;
+ enum { value = (sizeof(char) == sizeof(_H::_Test(false, _H::_MakeSource()))) };
+ typedef typename __bool2type<value>::_Ret _Ret;
+};
+
+# if defined (__BORLANDC__)
+# if (__BORLANDC__ < 0x590)
+template<class _Tp>
+struct _UnConstPtr { typedef _Tp _Type; };
+
+template<class _Tp>
+struct _UnConstPtr<_Tp*> { typedef _Tp _Type; };
+
+template<class _Tp>
+struct _UnConstPtr<const _Tp*> { typedef _Tp _Type; };
+# endif
+
+# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
+template <class _Tp>
+struct _IsConst { typedef __false_type _Ret; };
+# else
+template <class _Tp>
+struct _IsConst { typedef _AreSameTypes<_Tp, const _Tp>::_Ret _Ret; };
+# endif
+
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
+template <class _Tp>
+struct _IsConst <const _Tp> { typedef __true_type _Ret; };
+# endif
+
+# if (__BORLANDC__ < 0x590)
+template<class _Tp>
+struct _IsConst<_Tp*> { typedef _AreSameTypes<_Tp*, const _Tp*>::_Ret _Ret; };
+# endif
+template <class _Tp>
+struct _IsVolatile { typedef _AreSameTypes<_Tp, volatile _Tp>::_Ret _Ret; };
+
+template<class _Tp>
+struct _IsUnQual {
+ typedef _IsConst<_Tp>::_Ret _Tr1;
+ typedef _IsVolatile<_Tp>::_Ret _Tr2;
+ typedef _Not<_Tr1>::_Ret _NotCon;
+ typedef _Not<_Tr2>::_Ret _NotVol;
+ typedef _Land2<_NotCon, _NotVol>::_Ret _Ret;
+};
+
+# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
+template <class _Tp> struct _UnQual { typedef _Tp _Type; };
+template <class _Tp> struct _UnQual<const _Tp> { typedef _Tp _Type; };
+template <class _Tp> struct _UnQual<volatile _Tp> { typedef _Tp _Type; };
+template <class _Tp> struct _UnQual<const volatile _Tp> { typedef _Tp _Type; };
+# endif
+# endif
+
+/* This struct is intended to say if a pointer can be convertible to an other
+ * taking into account cv qualifications. It shouldn't be instanciated with
+ * something else than pointer type as it uses pass by value parameter that
+ * results in compilation error when parameter type has a special memory
+ * alignment
+ */
+template <class _Src, class _Dst>
+struct _IsCVConvertible {
+# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x590)
+ typedef _ConversionHelper<_Src, _Dst> _H;
+ enum { value = (sizeof(char) == sizeof(_H::_Test(false, _H::_MakeSource()))) };
+# else
+ enum { _Is1 = __type2bool<_IsConst<_Src>::_Ret>::_Ret };
+ enum { _Is2 = _IsConvertible<_UnConstPtr<_Src>::_Type, _UnConstPtr<_Dst>::_Type>::value };
+ enum { value = _Is1 ? 0 : _Is2 };
+# endif
+ typedef typename __bool2type<value>::_Ret _Ret;
+};
+
+#else
+template <class _Src, class _Dst>
+struct _IsConvertible {
+ enum { value = 0 };
+ typedef __false_type _Ret;
+};
+
+template <class _Src, class _Dst>
+struct _IsCVConvertible {
+ enum { value = 0 };
+ typedef __false_type _Ret;
+};
+#endif
+
+_STLP_END_NAMESPACE
+
+#endif /* _STLP_TYPE_MANIPS_H */
diff --git a/stlport/stl/type_traits.h b/stlport/stl/type_traits.h
new file mode 100644
index 0000000..af0923d
--- /dev/null
+++ b/stlport/stl/type_traits.h
@@ -0,0 +1,626 @@
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_TYPE_TRAITS_H
+#define _STLP_TYPE_TRAITS_H
+
+/*
+This header file provides a framework for allowing compile time dispatch
+based on type attributes. This is useful when writing template code.
+For example, when making a copy of an array of an unknown type, it helps
+to know if the type has a trivial copy constructor or not, to help decide
+if a memcpy can be used.
+
+The class template __type_traits provides a series of typedefs each of
+which is either __true_type or __false_type. The argument to
+__type_traits can be any type. The typedefs within this template will
+attain their correct values by one of these means:
+ 1. The general instantiation contain conservative values which work
+ for all types.
+ 2. Specializations may be declared to make distinctions between types.
+ 3. Some compilers (such as the Silicon Graphics N32 and N64 compilers)
+ will automatically provide the appropriate specializations for all
+ types.
+
+EXAMPLE:
+
+//Copy an array of elements which have non-trivial copy constructors
+template <class T> void copy(T* source, T* destination, int n, __false_type);
+//Copy an array of elements which have trivial copy constructors. Use memcpy.
+template <class T> void copy(T* source, T* destination, int n, __true_type);
+
+//Copy an array of any type by using the most efficient copy mechanism
+template <class T> inline void copy(T* source,T* destination,int n) {
+ copy(source, destination, n,
+ typename __type_traits<T>::has_trivial_copy_constructor());
+}
+*/
+
+#ifdef __WATCOMC__
+# include <stl/_cwchar.h>
+#endif
+
+#ifndef _STLP_TYPE_MANIPS_H
+# include <stl/type_manips.h>
+#endif
+
+#ifdef _STLP_USE_BOOST_SUPPORT
+# include <stl/boost_type_traits.h>
+# include <boost/type_traits/add_reference.hpp>
+# include <boost/type_traits/add_const.hpp>
+#endif /* _STLP_USE_BOOST_SUPPORT */
+
+_STLP_BEGIN_NAMESPACE
+
+#if !defined (_STLP_USE_BOOST_SUPPORT)
+
+// The following could be written in terms of numeric_limits.
+// We're doing it separately to reduce the number of dependencies.
+
+template <class _Tp> struct _IsIntegral
+{ typedef __false_type _Ret; };
+
+# ifndef _STLP_NO_BOOL
+_STLP_TEMPLATE_NULL struct _IsIntegral<bool>
+{ typedef __true_type _Ret; };
+# endif /* _STLP_NO_BOOL */
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<char>
+{ typedef __true_type _Ret; };
+
+# ifndef _STLP_NO_SIGNED_BUILTINS
+_STLP_TEMPLATE_NULL struct _IsIntegral<signed char>
+{ typedef __true_type _Ret; };
+# endif
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned char>
+{ typedef __true_type _Ret; };
+
+# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
+_STLP_TEMPLATE_NULL struct _IsIntegral<wchar_t>
+{ typedef __true_type _Ret; };
+# endif /* _STLP_HAS_WCHAR_T */
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<short>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned short>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<int>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned int>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<long>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned long>
+{ typedef __true_type _Ret; };
+
+# ifdef _STLP_LONG_LONG
+_STLP_TEMPLATE_NULL struct _IsIntegral<_STLP_LONG_LONG>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsIntegral<unsigned _STLP_LONG_LONG>
+{ typedef __true_type _Ret; };
+# endif /* _STLP_LONG_LONG */
+
+template <class _Tp> struct _IsRational
+{ typedef __false_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsRational<float>
+{ typedef __true_type _Ret; };
+
+_STLP_TEMPLATE_NULL struct _IsRational<double>
+{ typedef __true_type _Ret; };
+
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+_STLP_TEMPLATE_NULL struct _IsRational<long double>
+{ typedef __true_type _Ret; };
+# endif
+
+// Forward declarations.
+template <class _Tp> struct __type_traits;
+template <class _IsPOD> struct __type_traits_aux {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __false_type has_trivial_copy_constructor;
+ typedef __false_type has_trivial_assignment_operator;
+ typedef __false_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+_STLP_TEMPLATE_NULL
+struct __type_traits_aux<__false_type> {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __false_type has_trivial_copy_constructor;
+ typedef __false_type has_trivial_assignment_operator;
+ typedef __false_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+};
+
+_STLP_TEMPLATE_NULL
+struct __type_traits_aux<__true_type> {
+ typedef __true_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __true_type is_POD_type;
+};
+
+template <class _Tp>
+struct _IsRef {
+ typedef __false_type _Ret;
+};
+
+# if defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+/*
+ * Boris : simulation technique is used here according to Adobe Open Source License Version 1.0.
+ * Copyright 2000 Adobe Systems Incorporated and others. All rights reserved.
+ * Authors: Mat Marcus and Jesse Jones
+ * The original version of this source code may be found at
+ * http://opensource.adobe.com.
+ */
+
+struct _PointerShim {
+ /*
+ * Since the compiler only allows at most one non-trivial
+ * implicit conversion we can make use of a shim class to
+ * be sure that IsPtr below doesn't accept classes with
+ * implicit pointer conversion operators
+ */
+ _PointerShim(const volatile void*); // no implementation
+};
+
+// These are the discriminating functions
+char _STLP_CALL _IsP(bool, _PointerShim); // no implementation is required
+char* _STLP_CALL _IsP(bool, ...); // no implementation is required
+
+template <class _Tp>
+struct _IsPtr {
+ /*
+ * This template meta function takes a type T
+ * and returns true exactly when T is a pointer.
+ * One can imagine meta-functions discriminating on
+ * other criteria.
+ */
+ static _Tp& __null_rep();
+ enum { _Ptr = (sizeof(_IsP(false,__null_rep())) == sizeof(char)) };
+ typedef typename __bool2type<_Ptr>::_Ret _Ret;
+
+};
+
+// we make general case dependant on the fact the type is actually a pointer.
+template <class _Tp>
+struct __type_traits : __type_traits_aux<typename _IsPtr<_Tp>::_Ret> {};
+
+# else /* _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS */
+
+template <class _Tp> struct _IsPtr {
+ typedef __false_type _Ret;
+};
+
+template <class _Tp>
+struct __type_traits {
+ typedef __true_type this_dummy_member_must_be_first;
+ /* Do not remove this member. It informs a compiler which
+ automatically specializes __type_traits that this
+ __type_traits template is special. It just makes sure that
+ things work if an implementation is using a template
+ called __type_traits for something unrelated. */
+
+ /* The following restrictions should be observed for the sake of
+ compilers which automatically produce type specific specializations
+ of this class:
+ - You may reorder the members below if you wish
+ - You may remove any of the members below if you wish
+ - You must not rename members without making the corresponding
+ name change in the compiler
+ - Members you add will be treated like regular members unless
+
+ you add the appropriate support in the compiler. */
+# if !defined (_STLP_HAS_TYPE_TRAITS_INTRINSICS)
+ typedef __false_type has_trivial_default_constructor;
+ typedef __false_type has_trivial_copy_constructor;
+ typedef __false_type has_trivial_assignment_operator;
+ typedef __false_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+# else
+ typedef typename __bool2type<_STLP_HAS_TRIVIAL_CONSTRUCTOR(_Tp)>::_Ret has_trivial_default_constructor;
+ typedef typename __bool2type<_STLP_HAS_TRIVIAL_COPY(_Tp)>::_Ret has_trivial_copy_constructor;
+ typedef typename __bool2type<_STLP_HAS_TRIVIAL_ASSIGN(_Tp)>::_Ret has_trivial_assignment_operator;
+ typedef typename __bool2type<_STLP_HAS_TRIVIAL_DESTRUCTOR(_Tp)>::_Ret has_trivial_destructor;
+ typedef typename __bool2type<_STLP_IS_POD(_Tp)>::_Ret is_POD_type;
+# endif
+};
+
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp> struct _IsPtr<_Tp*>
+{ typedef __true_type _Ret; };
+template <class _Tp> struct _IsRef<_Tp&>
+{ typedef __true_type _Ret; };
+
+template <class _Tp> struct __type_traits<_Tp*> : __type_traits_aux<__true_type>
+{};
+# endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
+
+# endif /* _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS */
+
+// Provide some specializations. This is harmless for compilers that
+// have built-in __types_traits support, and essential for compilers
+// that don't.
+# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG)
+# define _STLP_DEFINE_TYPE_TRAITS_FOR(Type) \
+_STLP_TEMPLATE_NULL struct __type_traits< Type > : __type_traits_aux<__true_type> {}; \
+_STLP_TEMPLATE_NULL struct __type_traits< const Type > : __type_traits_aux<__true_type> {}; \
+_STLP_TEMPLATE_NULL struct __type_traits< volatile Type > : __type_traits_aux<__true_type> {}; \
+_STLP_TEMPLATE_NULL struct __type_traits< const volatile Type > : __type_traits_aux<__true_type> {}
+# else
+# define _STLP_DEFINE_TYPE_TRAITS_FOR(Type) \
+_STLP_TEMPLATE_NULL struct __type_traits< Type > : __type_traits_aux<__true_type> {};
+# endif
+
+# ifndef _STLP_NO_BOOL
+_STLP_DEFINE_TYPE_TRAITS_FOR(bool);
+# endif /* _STLP_NO_BOOL */
+_STLP_DEFINE_TYPE_TRAITS_FOR(char);
+# ifndef _STLP_NO_SIGNED_BUILTINS
+_STLP_DEFINE_TYPE_TRAITS_FOR(signed char);
+# endif
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned char);
+# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
+_STLP_DEFINE_TYPE_TRAITS_FOR(wchar_t);
+# endif /* _STLP_HAS_WCHAR_T */
+
+_STLP_DEFINE_TYPE_TRAITS_FOR(short);
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned short);
+_STLP_DEFINE_TYPE_TRAITS_FOR(int);
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned int);
+_STLP_DEFINE_TYPE_TRAITS_FOR(long);
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned long);
+
+# ifdef _STLP_LONG_LONG
+_STLP_DEFINE_TYPE_TRAITS_FOR(_STLP_LONG_LONG);
+_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned _STLP_LONG_LONG);
+# endif /* _STLP_LONG_LONG */
+
+_STLP_DEFINE_TYPE_TRAITS_FOR(float);
+_STLP_DEFINE_TYPE_TRAITS_FOR(double);
+
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+_STLP_DEFINE_TYPE_TRAITS_FOR(long double);
+# endif
+
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _ArePtrs, class _Src, class _Dst>
+struct _IsCVConvertibleIf
+{ typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; };
+
+template <class _Src, class _Dst>
+struct _IsCVConvertibleIf<__false_type, _Src, _Dst>
+{ typedef __false_type _Ret; };
+# else
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+template <class _ArePtrs>
+struct _IsCVConvertibleIfAux {
+ template <class _Src, class _Dst>
+ struct _In
+ { typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; };
+};
+
+_STLP_TEMPLATE_NULL
+struct _IsCVConvertibleIfAux<__false_type> {
+ template <class _Src, class _Dst>
+ struct _In
+ { typedef __false_type _Ret; };
+};
+
+template <class _ArePtrs, class _Src, class _Dst>
+struct _IsCVConvertibleIf {
+ typedef typename _IsCVConvertibleIfAux<_ArePtrs>::_STLP_TEMPLATE _In<_Src, _Dst>::_Ret _Ret;
+};
+# else
+/* default behavior: we prefer to miss an optimization rather than taking the risk of
+ * a compilation error if playing with types with exotic memory alignment.
+ */
+template <class _ArePtrs, class _Src, class _Dst>
+struct _IsCVConvertibleIf
+{ typedef __false_type _Ret; };
+# endif
+# endif
+
+template <class _Src, class _Dst>
+struct _TrivialNativeTypeCopy {
+ typedef typename _IsPtr<_Src>::_Ret _Ptr1;
+ typedef typename _IsPtr<_Dst>::_Ret _Ptr2;
+ typedef typename _Land2<_Ptr1, _Ptr2>::_Ret _BothPtrs;
+ typedef typename _IsCVConvertibleIf<_BothPtrs, _Src, _Dst>::_Ret _Convertible;
+ typedef typename _Land2<_BothPtrs, _Convertible>::_Ret _Trivial1;
+
+ typedef typename __bool2type<(sizeof(_Src) == sizeof(_Dst))>::_Ret _SameSize;
+
+#if !defined (__BORLANDC__) || (__BORLANDC__ < 0x564)
+ typedef typename _IsIntegral<_Src>::_Ret _Int1;
+#else
+ typedef typename _UnQual<_Src>::_Type _UnQuSrc;
+ typedef typename _IsIntegral<_UnQuSrc>::_Ret _Int1;
+#endif
+ typedef typename _IsIntegral<_Dst>::_Ret _Int2;
+ typedef typename _Land2<_Int1, _Int2>::_Ret _BothInts;
+
+ typedef typename _IsRational<_Src>::_Ret _Rat1;
+ typedef typename _IsRational<_Dst>::_Ret _Rat2;
+ typedef typename _Land2<_Rat1, _Rat2>::_Ret _BothRats;
+
+ typedef typename _Lor2<_BothInts, _BothRats>::_Ret _BothNatives;
+#if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x564)
+ typedef typename _Land2<_BothNatives, _SameSize>::_Ret _Trivial2;
+#else
+ typedef typename _IsUnQual<_Dst>::_Ret _UnQualDst;
+ typedef typename _Land3<_BothNatives, _SameSize, _UnQualDst>::_Ret _Trivial2;
+#endif
+ typedef typename _Lor2<_Trivial1, _Trivial2>::_Ret _Ret;
+};
+
+template <class _Src, class _Dst>
+struct _TrivialCopy {
+ typedef typename _TrivialNativeTypeCopy<_Src, _Dst>::_Ret _NativeRet;
+# if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
+ typedef typename __type_traits<_Src>::has_trivial_assignment_operator _Tr1;
+# else
+ typedef typename _UnConstPtr<_Src*>::_Type _UnConstSrc;
+ typedef typename __type_traits<_UnConstSrc>::has_trivial_assignment_operator _Tr1;
+# endif
+ typedef typename _AreCopyable<_Src, _Dst>::_Ret _Tr2;
+ typedef typename _Land2<_Tr1, _Tr2>::_Ret _UserRet;
+ typedef typename _Lor2<_NativeRet, _UserRet>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Src, class _Dst>
+struct _TrivialUCopy {
+ typedef typename _TrivialNativeTypeCopy<_Src, _Dst>::_Ret _NativeRet;
+# if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
+ typedef typename __type_traits<_Src>::has_trivial_copy_constructor _Tr1;
+# else
+ typedef typename _UnConstPtr<_Src*>::_Type _UnConstSrc;
+ typedef typename __type_traits<_UnConstSrc>::has_trivial_copy_constructor _Tr1;
+# endif
+ typedef typename _AreCopyable<_Src, _Dst>::_Ret _Tr2;
+ typedef typename _Land2<_Tr1, _Tr2>::_Ret _UserRet;
+ typedef typename _Lor2<_NativeRet, _UserRet>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Tp>
+struct _DefaultZeroValue {
+ typedef typename _IsIntegral<_Tp>::_Ret _Tr1;
+ typedef typename _IsRational<_Tp>::_Ret _Tr2;
+ typedef typename _IsPtr<_Tp>::_Ret _Tr3;
+ typedef typename _Lor3<_Tr1, _Tr2, _Tr3>::_Ret _Ret;
+};
+
+template <class _Tp>
+struct _TrivialInit {
+# if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560)
+ typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Tr1;
+# else
+ typedef typename _UnConstPtr<_Tp*>::_Type _Tp1;
+ typedef typename __type_traits<_Tp1>::has_trivial_copy_constructor _Tr1;
+# endif
+ typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2;
+ typedef typename _Not<_Tr2>::_Ret _Tr3;
+ typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+#endif /* !_STLP_USE_BOOST_SUPPORT */
+
+template <class _Tp>
+struct _IsPtrType {
+ typedef typename _IsPtr<_Tp>::_Ret _Type;
+ static _Type _Ret() { return _Type(); }
+};
+
+template <class _Tp>
+struct _IsRefType {
+ typedef typename _IsRef<_Tp>::_Ret _Type;
+ static _Type _Ret() { return _Type();}
+};
+
+template <class _Tp>
+struct __call_traits {
+#if defined (_STLP_USE_BOOST_SUPPORT) && !defined (_STLP_NO_EXTENSIONS)
+ typedef typename __select< ::boost::is_reference<_Tp>::value,
+ typename ::boost::add_const<_Tp>::type,
+ typename ::boost::add_reference< typename ::boost::add_const<_Tp>::type >::type>::_Ret const_param_type;
+ typedef typename __select< ::boost::is_reference<_Tp>::value,
+ typename ::boost::remove_const<_Tp>::type,
+ typename ::boost::add_reference<_Tp>::type>::_Ret param_type;
+#else
+ typedef const _Tp& const_param_type;
+ typedef _Tp& param_type;
+#endif
+};
+
+#if !defined (_STLP_USE_BOOST_SUPPORT) && !defined (_STLP_NO_EXTENSIONS) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+template <class _Tp>
+struct __call_traits<_Tp&> {
+ typedef _Tp& param_type;
+ typedef const _Tp& const_param_type;
+};
+template <class _Tp>
+struct __call_traits<const _Tp&> {
+ typedef _Tp& param_type;
+ typedef const _Tp& const_param_type;
+};
+#endif
+
+template <class _Tp1, class _Tp2>
+struct _BothPtrType {
+ typedef typename _IsPtr<_Tp1>::_Ret _IsPtr1;
+ typedef typename _IsPtr<_Tp2>::_Ret _IsPtr2;
+
+ typedef typename _Land2<_IsPtr1, _IsPtr2>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Tp1, class _Tp2, class _IsRef1, class _IsRef2>
+struct _OKToSwap {
+ typedef typename _AreSameTypes<_Tp1, _Tp2>::_Ret _Same;
+ typedef typename _Land3<_Same, _IsRef1, _IsRef2>::_Ret _Type;
+ static _Type _Answer() { return _Type(); }
+};
+
+template <class _Tp1, class _Tp2, class _IsRef1, class _IsRef2>
+inline _OKToSwap<_Tp1, _Tp2, _IsRef1, _IsRef2>
+_IsOKToSwap(_Tp1*, _Tp2*, const _IsRef1&, const _IsRef2&)
+{ return _OKToSwap<_Tp1, _Tp2, _IsRef1, _IsRef2>(); }
+
+template <class _Src, class _Dst>
+inline _TrivialCopy<_Src, _Dst> _UseTrivialCopy(_Src*, _Dst*)
+{ return _TrivialCopy<_Src, _Dst>(); }
+
+template <class _Src, class _Dst>
+inline _TrivialUCopy<_Src, _Dst> _UseTrivialUCopy(_Src*, _Dst*)
+{ return _TrivialUCopy<_Src, _Dst>(); }
+
+#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined (__BORLANDC__) || \
+ defined (__DMC__)
+struct _NegativeAnswer {
+ typedef __false_type _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Src, class _Dst>
+inline _NegativeAnswer _UseTrivialCopy(_Src*, const _Dst*)
+{ return _NegativeAnswer(); }
+
+template <class _Src, class _Dst>
+inline _NegativeAnswer _UseTrivialCopy(_Src*, volatile _Dst*)
+{ return _NegativeAnswer(); }
+
+template <class _Src, class _Dst>
+inline _NegativeAnswer _UseTrivialCopy(_Src*, const volatile _Dst*)
+{ return _NegativeAnswer(); }
+
+template <class _Src, class _Dst>
+inline _NegativeAnswer _UseTrivialUCopy(_Src*, const _Dst*)
+{ return _NegativeAnswer(); }
+
+template <class _Src, class _Dst>
+inline _NegativeAnswer _UseTrivialUCopy(_Src*, volatile _Dst*)
+{ return _NegativeAnswer(); }
+
+template <class _Src, class _Dst>
+inline _NegativeAnswer _UseTrivialUCopy(_Src*, const volatile _Dst*)
+{ return _NegativeAnswer(); }
+#endif
+
+template <class _Tp>
+inline _TrivialInit<_Tp> _UseTrivialInit(_Tp*)
+{ return _TrivialInit<_Tp>(); }
+
+template <class _Tp>
+struct _IsPOD {
+ typedef typename __type_traits<_Tp>::is_POD_type _Type;
+ static _Type _Answer() { return _Type(); }
+};
+
+template <class _Tp>
+inline _IsPOD<_Tp> _Is_POD(_Tp*)
+{ return _IsPOD<_Tp>(); }
+
+template <class _Tp>
+struct _DefaultZeroValueQuestion {
+ typedef typename _DefaultZeroValue<_Tp>::_Ret _Ret;
+ static _Ret _Answer() { return _Ret(); }
+};
+
+template <class _Tp>
+inline _DefaultZeroValueQuestion<_Tp> _HasDefaultZeroValue(_Tp*)
+{ return _DefaultZeroValueQuestion<_Tp>(); }
+
+/*
+ * Base class used:
+ * - to simulate partial template specialization
+ * - to simulate partial function ordering
+ * - to recognize STLport class from user specialized one
+ */
+template <class _Tp>
+struct __stlport_class
+{ typedef _Tp _Type; };
+
+template <class _Tp>
+struct _IsSTLportClass {
+ typedef typename _IsConvertible<_Tp, __stlport_class<_Tp> >::_Ret _Ret;
+#if defined (__BORLANDC__)
+ enum { _Is = _IsConvertible<_Tp, __stlport_class<_Tp> >::value };
+#endif
+};
+
+#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+template <class _Tp>
+struct _SwapImplemented {
+ typedef typename _IsSTLportClass<_Tp>::_Ret _Ret;
+# if defined (__BORLANDC__)
+ enum { _Is = _IsSTLportClass<_Tp>::_Is };
+# endif
+};
+#endif
+
+template <class _Tp>
+class _TpWithState : private _Tp {
+ _TpWithState();
+ int _state;
+};
+
+/* This is an internal helper struct used to guess if we are working
+ * on a stateless class. It can only be instanciated with a class type. */
+template <class _Tp>
+struct _IsStateless {
+ enum { _Is = sizeof(_TpWithState<_Tp>) == sizeof(int) };
+ typedef typename __bool2type<_Is>::_Ret _Ret;
+};
+
+_STLP_END_NAMESPACE
+
+#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
+# if defined (__BORLANDC__) || \
+ defined (__SUNPRO_CC) || \
+ (defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || \
+ (defined (__sgi) && defined (_COMPILER_VERSION)) || \
+ defined (__DMC__)
+# define _STLP_IS_POD_ITER(_It, _Tp) __type_traits< typename iterator_traits< _Tp >::value_type >::is_POD_type()
+# else
+# define _STLP_IS_POD_ITER(_It, _Tp) typename __type_traits< typename iterator_traits< _Tp >::value_type >::is_POD_type()
+# endif
+#else
+# define _STLP_IS_POD_ITER(_It, _Tp) _Is_POD( _STLP_VALUE_TYPE( _It, _Tp ) )._Answer()
+#endif
+
+#endif /* _STLP_TYPE_TRAITS_H */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/streambuf b/stlport/streambuf
new file mode 100644
index 0000000..f4dc253
--- /dev/null
+++ b/stlport/streambuf
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+#ifndef _STLP_STREAMBUF
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1066
+# include <stl/_prolog.h>
+# define _STLP_STREAMBUF
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1066) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_STREAMBUF
+# include <stl/_streambuf.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1066) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <streambuf>
+# else
+# include _STLP_NATIVE_HEADER(streambuf)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1066)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STREAMBUF */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/streambuf.h b/stlport/streambuf.h
similarity index 100%
rename from streambuf.h
rename to stlport/streambuf.h
diff --git a/stlport/string b/stlport/string
new file mode 100644
index 0000000..74d4589
--- /dev/null
+++ b/stlport/string
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_STRING
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x68
+# include <stl/_prolog.h>
+# define _STLP_STRING
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x68)
+# ifndef _STLP_INTERNAL_STRING_H
+# include <stl/_string.h>
+# endif
+
+# ifndef _STLP_STRING_HASH_H
+# include <stl/_string_hash.h>
+# endif
+
+# if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_STRING_IO_H)
+# include <stl/_string_io.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x68) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <string>
+# else
+# include _STLP_NATIVE_HEADER(string)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x68)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STRING */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/string.h b/stlport/string.h
new file mode 100644
index 0000000..52013cf
--- /dev/null
+++ b/stlport/string.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* Workaround for a "misbehaviour" when compiling resource scripts using
+ * eMbedded Visual C++. The standard .rc file includes windows header files,
+ * which in turn include string.h, which results in warnings and errors
+ */
+#ifndef _STLP_STRING_H
+
+#if !defined (RC_INVOKED)
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x269
+# include <stl/_cprolog.h>
+# elif (_STLP_OUTERMOST_HEADER_ID == 0x269) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_STRING_H
+# endif
+
+# if defined(_STLP_WCE_EVC3)
+struct _exception;
+# endif
+# if (_STLP_OUTERMOST_HEADER_ID != 0x269) || defined (_STLP_DONT_POP_HEADER_ID)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <string.h>
+# else
+# include _STLP_NATIVE_C_HEADER(string.h)
+# endif
+# else
+# if defined (__BORLANDC__) && !defined (__linux__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <_str.h>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(_str.h)
+# endif
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <string.h>
+# else
+# include _STLP_NATIVE_C_HEADER(string.h)
+# endif
+# endif
+# endif
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x269)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+# endif
+#endif /* RC_INVOKED */
+#endif /* _STLP_STRING_H */
diff --git a/stlport/strstream b/stlport/strstream
new file mode 100644
index 0000000..247574f
--- /dev/null
+++ b/stlport/strstream
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+// WARNING: The classes defined in this header are DEPRECATED. This
+// header is defined in section D.7.1 of the C++ standard, and it
+// MAY BE REMOVED in a future standard revision. You should use the
+// header <sstream> instead.
+
+
+#ifndef _STLP_STRSTREAM
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x1070
+# include <stl/_prolog.h>
+# define _STLP_STRSTREAM
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1070) && \
+ !(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
+# include <stl/_ioserr.h>
+
+# ifndef _STLP_INTERNAL_STRSTREAM
+# include <stl/_strstream.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x1070) || defined (_STLP_IMPORT_VENDOR_STD)
+/* Even if deprecated strstream header is still part of the Standard. Remove
+ * _STLP_IMPORT_VENDOR_STD check if the native compiler library do not grant
+ * it anymore. */
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <strstream>
+# else
+# include _STLP_NATIVE_HEADER(strstream)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x1070)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_STRSTREAM */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/strstream.h b/stlport/strstream.h
similarity index 100%
rename from strstream.h
rename to stlport/strstream.h
diff --git a/stlport/time.h b/stlport/time.h
new file mode 100644
index 0000000..e73aa85
--- /dev/null
+++ b/stlport/time.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x272
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x272) && ! defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#ifdef _STLP_WCE_EVC3
+/* only show message when directly including this file in a non-library build */
+# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x272)
+# pragma message("eMbedded Visual C++ 3 doesn't have a time.h header; STLport won't include native time.h here")
+# endif
+#else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <time.h>
+# else
+# include _STLP_NATIVE_C_HEADER(time.h)
+# endif
+#endif
+
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x272)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
diff --git a/stlport/type_traits b/stlport/type_traits
new file mode 100644
index 0000000..e6fe234
--- /dev/null
+++ b/stlport/type_traits
@@ -0,0 +1,798 @@
+// -*- C++ -*- Time-stamp: <08/07/20 19:10:15 ptr>
+
+/*
+ * Copyright (c) 2007, 2008
+ * Petr Ovtchenkov
+ *
+ * Licensed under the Academic Free License version 3.0
+ *
+ * Derived from original <misc/type_traits.h> of 'complement' project
+ * [http://complement.sourceforge.net]
+ * to make it close to JTC1/SC22/WG21 C++ 0x working draft
+ * [http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2008/n2521.pdf]
+ */
+
+#ifndef __STLP_TYPE_TRAITS
+#define __STLP_TYPE_TRAITS
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x3
+# include <stl/_prolog.h>
+#endif
+
+// libstdc++ v3, timestamp 20050519 (3.4.4) has __type_traits,
+// libstdc++ v3, timestamp 20060306 (3.4.6) has __type_traits,
+// while libstdc++ v3, 20050921 (4.0.2) not; use libstdc++ instead
+// # if defined(STLPORT) || (defined(__GNUC__) && (__GNUC__ < 4)) /* !defined(__GLIBCXX__) || (defined(__GNUC__) && (__GNUC__ < 4)) */
+
+_STLP_BEGIN_NAMESPACE
+
+_STLP_BEGIN_TR1_NAMESPACE
+
+namespace detail {
+
+struct __select_types
+{
+ typedef char __t1;
+ struct __t2
+ {
+ char __two[2];
+ };
+};
+
+template <class _Tp>
+struct __instance :
+ public __select_types
+{
+ private:
+ template <class _Up>
+ static __t1 __test(_Up(*)[1]);
+
+ template <class>
+ static __t2 __test(...);
+
+ public:
+#ifdef _STLP_STATIC_CONST_INIT_BUG
+ static const bool __value;
+#else
+ static const bool __value = sizeof(__test<_Tp>(0)) == sizeof(__select_types::__t1);
+#endif
+
+};
+
+#ifdef _STLP_STATIC_CONST_INIT_BUG
+template <class _Tp>
+const bool __instance<_Tp>::__value = sizeof(__instance<_Tp>::__test<_Tp>(0)) == sizeof(__select_types::__t1);
+#endif
+
+template <class T>
+struct __uoc_aux : // union or class
+ public __select_types
+{
+ private:
+ template <class _Up>
+ static __t1 __test( int _Up::* );
+
+ template <class>
+ static __t2 __test(...);
+
+ public:
+#ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION
+ static const bool __value;
+#else
+ static const bool __value = sizeof(__test<T>(0)) == sizeof(__select_types::__t1);
+#endif
+};
+
+#ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION
+template <class T>
+const bool __uoc_aux<T>::__value = sizeof(__uoc_aux<T>::__test<T>(0)) == sizeof(__select_types::__t1);
+#endif
+
+template <class T>
+class __empty
+{ };
+
+template <class T, bool B>
+class __inheritance_aux
+{};
+
+template <class T>
+class __inheritance_aux<T,true> :
+ public T
+{
+ public:
+ virtual ~__inheritance_aux()
+ { }
+};
+
+#if 0
+template <class T, bool B>
+struct __virtual_aux
+{
+ public:
+#ifdef _STLP_STATIC_CONST_INIT_BUG
+ static const bool __value;
+#else
+ static const bool __value = B ? (sizeof(__inheritance_aux<T,B>) == sizeof(T)) : false;
+#endif
+};
+
+#ifdef _STLP_STATIC_CONST_INIT_BUG
+template <class T, bool B>
+const bool __virtual_aux<T,B>::__value = B ? (sizeof(__inheritance_aux<T,B>) == sizeof(T)) : false;
+#endif
+#endif
+
+} // namespace detail
+
+template <class _Tp, _Tp __v>
+struct integral_constant
+{
+ static const _Tp value = __v;
+ // enum { value = __v }; ?
+
+ typedef _Tp value_type;
+ typedef integral_constant<_Tp, __v> type;
+};
+
+typedef integral_constant<bool, true> true_type;
+typedef integral_constant<bool, false> false_type;
+
+namespace detail {
+
+template <typename _Tp>
+struct __is_union_or_class :
+ public integral_constant<bool, __uoc_aux<_Tp>::__value>
+{ };
+
+#if 0
+template<typename _Tp>
+struct __is_vtbl : // has virtual table?
+ public integral_constant<bool, __virtual_aux<_Tp,__is_union_or_class<_Tp>::value >::__value>
+{ };
+#endif
+
+template <typename _Tp>
+struct __is_vtbl : // has virtual table?
+ public integral_constant<bool, __is_union_or_class<_Tp>::value ? (sizeof(__inheritance_aux<_Tp,__is_union_or_class<_Tp>::value>) == sizeof(_Tp)) : false >
+{ };
+
+} // namespace detail
+
+#define __SPEC_(C,T,B) \
+template <> \
+struct C<T> : \
+ public integral_constant<bool, B> \
+{ }
+
+#define __CV_SPEC(C,T,B) \
+__SPEC_(C,T,B); \
+__SPEC_(C,const T,B); \
+__SPEC_(C,volatile T,B); \
+__SPEC_(C,const volatile T,B)
+
+#define __SPEC_1(C,T,B) \
+template <class _Tp> \
+struct C<T> : \
+ public integral_constant<bool, B> \
+{ }
+
+#define __CV_SPEC_1(C,T,B) \
+__SPEC_1(C,T,B); \
+__SPEC_1(C,T const,B); \
+__SPEC_1(C,T volatile,B); \
+__SPEC_1(C,T const volatile,B)
+
+#define __SPEC_2(C,T,B) \
+template <class _Tp1, class _Tp2> \
+struct C<T> : \
+ public integral_constant<bool, B> \
+{ }
+
+#define __CV_SPEC_2(C,T,B) \
+__SPEC_2(C,T,B); \
+__SPEC_2(C,T const,B); \
+__SPEC_2(C,T volatile,B); \
+__SPEC_2(C,T const volatile,B)
+
+// [4.5.1] primary type categories:
+
+template <class _Tp>
+struct is_void :
+ public false_type
+{ };
+
+template <>
+struct is_void<void> :
+ public true_type
+{ };
+
+template <class _Tp>
+struct is_integral :
+ public false_type
+{ };
+
+__CV_SPEC(is_integral,bool,true);
+__CV_SPEC(is_integral,char,true);
+__CV_SPEC(is_integral,signed char,true);
+__CV_SPEC(is_integral,unsigned char,true);
+__CV_SPEC(is_integral,wchar_t,true);
+__CV_SPEC(is_integral,short,true);
+__CV_SPEC(is_integral,unsigned short,true);
+__CV_SPEC(is_integral,int,true);
+__CV_SPEC(is_integral,unsigned int,true);
+__CV_SPEC(is_integral,long,true);
+__CV_SPEC(is_integral,unsigned long,true);
+__CV_SPEC(is_integral,long long,true);
+__CV_SPEC(is_integral,unsigned long long,true);
+
+template <class _Tp>
+struct is_floating_point :
+ public false_type
+{ };
+
+__CV_SPEC(is_floating_point,float,true);
+__CV_SPEC(is_floating_point,double,true);
+__CV_SPEC(is_floating_point,long double,true);
+
+template <class _Tp>
+struct is_array :
+ public false_type
+{ };
+
+template <class _Tp, std::size_t _Sz>
+struct is_array<_Tp[_Sz]> :
+ public true_type
+{ };
+
+template <class _Tp>
+struct is_array<_Tp[]> :
+ public true_type
+{ };
+
+template <class _Tp>
+struct is_pointer :
+ public false_type
+{ };
+
+__CV_SPEC_1(is_pointer,_Tp *,true);
+
+template <class _Tp>
+struct is_lvalue_reference :
+ public false_type
+{ };
+
+template <class _Tp>
+struct is_lvalue_reference<_Tp&> :
+ public true_type
+{ };
+
+template <class _Tp>
+struct is_rvalue_reference :
+ public false_type
+{ };
+
+// template <class _Tp>
+// struct is_rvalue_reference<_Tp&&> :
+// public true_type
+// { };
+
+template <class _Tp>
+struct is_reference :
+ public false_type
+{ };
+
+template <class _Tp>
+struct is_reference<_Tp&> :
+ public true_type
+{ };
+
+template <class _Tp>
+struct is_function :
+ public integral_constant<bool, !(detail::__instance<_Tp>::__value
+ || detail::__is_union_or_class<_Tp>::value
+ || is_reference<_Tp>::value
+ || is_void<_Tp>::value)>
+{ };
+
+template <class _Tp>
+struct is_member_object_pointer :
+ public false_type
+{ };
+
+// _SPEC_FULL2(is_member_object_pointer, _Tp1 _Tp2::*,!is_function<_Tp1>::value);
+
+template <class _Tp1, class _Tp2>
+struct is_member_object_pointer<_Tp1 _Tp2::*> :
+ public integral_constant<bool, !is_function<_Tp1>::value>
+{ };
+
+template <class _Tp1, class _Tp2>
+struct is_member_object_pointer<_Tp1 _Tp2::* const> :
+ public integral_constant<bool, !is_function<_Tp1>::value>
+{ };
+
+template <class _Tp1, class _Tp2>
+struct is_member_object_pointer<_Tp1 _Tp2::* volatile> :
+ public integral_constant<bool, !is_function<_Tp1>::value>
+{ };
+
+template <class _Tp1, class _Tp2>
+struct is_member_object_pointer<_Tp1 _Tp2::* const volatile> :
+ public integral_constant<bool, !is_function<_Tp1>::value>
+{ };
+
+template <class _Tp>
+struct is_member_function_pointer :
+ public false_type
+{ };
+
+// _SPEC_FULL2(is_member_function_pointer,_Tp1 _Tp2::*,is_function<_Tp1>::value);
+
+template <class _Tp1, class _Tp2>
+struct is_member_function_pointer<_Tp1 _Tp2::*> :
+ public integral_constant<bool, is_function<_Tp1>::value>
+{ };
+
+template <class _Tp1, class _Tp2>
+struct is_member_function_pointer<_Tp1 _Tp2::* const> :
+ public integral_constant<bool, is_function<_Tp1>::value>
+{ };
+
+template <class _Tp1, class _Tp2>
+struct is_member_function_pointer<_Tp1 _Tp2::* volatile> :
+ public integral_constant<bool, is_function<_Tp1>::value>
+{ };
+
+template <class _Tp1, class _Tp2>
+struct is_member_function_pointer<_Tp1 _Tp2::* const volatile> :
+ public integral_constant<bool, is_function<_Tp1>::value>
+{ };
+
+template <class _Tp>
+struct is_member_pointer :
+ public integral_constant<bool, (is_member_object_pointer<_Tp>::value || is_member_function_pointer<_Tp>::value)>
+{ };
+
+// 4.5.2 composite type categories
+
+template <class _Tp>
+struct is_arithmetic :
+ public integral_constant<bool, (is_integral<_Tp>::value || is_floating_point<_Tp>::value)>
+{ };
+
+template <class _Tp>
+struct is_fundamental :
+ public integral_constant<bool, (is_arithmetic<_Tp>::value || is_void<_Tp>::value)>
+{ };
+
+// [4.5.1] primary type categories (continued):
+
+template <class _Tp>
+struct is_enum :
+ public integral_constant<bool, !(is_fundamental<_Tp>::value
+ || is_array<_Tp>::value
+ || is_pointer<_Tp>::value
+ || is_reference<_Tp>::value
+ || is_member_pointer<_Tp>::value
+ || is_function<_Tp>::value
+ || detail::__is_union_or_class<_Tp>::value) >
+{ };
+
+template <class T>
+struct is_union
+{ };
+
+template <class T>
+struct is_class
+{ };
+
+// is_function (above)
+
+// 4.5.2 composite type categories (continued)
+
+// is_arithmetic (above)
+// is_fundamental (above)
+
+template <class _Tp>
+struct is_object :
+ public integral_constant<bool, (is_arithmetic<_Tp>::value ||
+ is_array<_Tp>::value ||
+ is_pointer<_Tp>::value ||
+ is_member_pointer<_Tp>::value ||
+ detail::__is_union_or_class<_Tp>::value)>
+{ };
+
+template <class _Tp>
+struct is_scalar :
+ public integral_constant<bool, (is_arithmetic<_Tp>::value
+ || is_enum<_Tp>::value
+ || is_pointer<_Tp>::value
+ || is_member_pointer<_Tp>::value)>
+{ };
+
+template <class _Tp>
+struct is_compound :
+ public integral_constant<bool, !is_fundamental<_Tp>::value>
+{ };
+
+// is_member_pointer
+
+// 4.5.3 type properties:
+
+template <class _Tp>
+struct is_const :
+ public false_type
+{ };
+
+template <class _Tp>
+struct is_const<_Tp const> :
+ public true_type
+{ };
+
+template <class _Tp>
+struct is_volatile :
+ public false_type
+{ };
+
+template <class _Tp>
+struct is_volatile<_Tp volatile> :
+ public true_type
+{ };
+
+
+// 4.7.3 array modifications:
+
+template <class _Tp>
+struct remove_extent
+{
+ typedef _Tp type;
+};
+
+template <class _Tp, std::size_t _Sz>
+struct remove_extent<_Tp[_Sz]>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_extent<_Tp[]>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_all_extents
+{
+ typedef _Tp type;
+};
+
+template <class _Tp, std::size_t _Size>
+struct remove_all_extents<_Tp[_Size]>
+{
+ typedef typename remove_all_extents<_Tp>::type type;
+};
+
+template<typename _Tp>
+struct remove_all_extents<_Tp[]>
+{
+ typedef typename remove_all_extents<_Tp>::type type;
+};
+
+// 4.5.3 type properties (continued):
+
+template <class _Tp>
+struct is_trivial :
+ public integral_constant<bool, (is_void<_Tp>::value
+ || is_scalar<typename remove_all_extents<_Tp>::type>::value)>
+{ };
+
+template <class _Tp>
+struct is_standard_layout :
+ public integral_constant<bool, (is_void<_Tp>::value
+ || is_scalar<typename remove_all_extents<_Tp>::type>::value)>
+{ };
+
+template <class _Tp>
+struct is_pod :
+ public integral_constant<bool, (is_void<_Tp>::value
+ || is_scalar<typename remove_all_extents<_Tp>::type>::value)>
+{ };
+
+template<typename _Tp>
+struct is_empty
+ : public integral_constant<bool, (detail::__is_union_or_class<_Tp>::value
+ && (sizeof(detail::__empty<_Tp>) == sizeof(_Tp)))>
+{ };
+
+// is_polimorphic
+// is_abstract
+
+template <class _Tp>
+struct has_trivial_constructor :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_trivial_copy :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_trivial_assign :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_trivial_destructor :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_nothrow_constructor :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_nothrow_copy :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_nothrow_assign :
+ public integral_constant<bool, is_pod<_Tp>::value>
+{ };
+
+template <class _Tp>
+struct has_virtual_destructor :
+ public false_type
+{ };
+
+template <class _Tp>
+struct is_signed :
+ public false_type
+{ };
+
+__CV_SPEC(is_signed,signed char,true);
+__CV_SPEC(is_signed,short,true);
+__CV_SPEC(is_signed,int,true);
+__CV_SPEC(is_signed,long,true);
+__CV_SPEC(is_signed,long long,true);
+
+template <class _Tp>
+struct is_unsigned :
+ public false_type
+{ };
+
+__CV_SPEC(is_unsigned,unsigned char,true);
+__CV_SPEC(is_unsigned,unsigned short,true);
+__CV_SPEC(is_unsigned,unsigned int,true);
+__CV_SPEC(is_unsigned,unsigned long,true);
+__CV_SPEC(is_unsigned,unsigned long long,true);
+
+// alignment_of
+// rank
+// extent
+
+// 4.6 type relations:
+
+template <class _Tp1, class _Tp2>
+struct is_same :
+ public false_type
+{ };
+
+template <class _Tp>
+struct is_same<_Tp, _Tp> :
+ public true_type
+{ };
+
+// is_base_of
+// is_convertible
+
+// 4.7.1 const-volatile modifications
+
+template <class _Tp>
+struct remove_const
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_const<_Tp const>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_volatile
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_volatile<_Tp volatile>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_cv
+{
+ typedef typename remove_const<typename remove_volatile<_Tp>::type>::type type;
+};
+
+template <class _Tp>
+struct add_const
+{
+ typedef _Tp const type;
+};
+
+template <class _Tp>
+struct add_volatile
+{
+ typedef _Tp volatile type;
+};
+
+template <class _Tp>
+struct add_cv
+{
+ typedef typename add_const<typename add_volatile<_Tp>::type>::type type;
+};
+
+// 4.7.2 reference modifications:
+
+template <class _Tp>
+struct remove_reference
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_reference<_Tp&>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct add_reference
+{
+ typedef _Tp& type;
+};
+
+template <class _Tp>
+struct add_reference<_Tp&>
+{
+ typedef _Tp& type;
+};
+
+// 4.7.3 array modifications (see above)
+
+// 4.7.4 pointer modifications:
+
+template <class _Tp>
+struct remove_pointer
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_pointer<_Tp *>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_pointer<_Tp * const>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_pointer<_Tp * volatile>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct remove_pointer<_Tp * const volatile>
+{
+ typedef _Tp type;
+};
+
+template <class _Tp>
+struct add_pointer
+{
+ typedef typename remove_reference<_Tp>::type * type;
+};
+
+// 20.5.7 other transformations:
+
+// template <std::size_t Len, std::size_t Align> struct aligned_storage;
+// template <std::size_t Len, class... Types> struct aligned_union;
+
+namespace detail {
+
+template <bool,class _U>
+struct _decay_aux2
+{
+ typedef typename remove_cv<_U>::type type;
+};
+
+template <class _U>
+struct _decay_aux2<true,_U>
+{
+ typedef typename add_pointer<_U>::type type;
+};
+
+template <bool, class _U>
+struct _decay_aux1
+{
+ typedef typename _decay_aux2<is_function<_U>::value,_U>::type type;
+};
+
+template <class _U>
+struct _decay_aux1<true,_U>
+{
+ typedef typename remove_extent<_U>::type* type;
+};
+
+} // namespace detail
+
+template <class _Tp>
+class decay
+{
+ private:
+ typedef typename remove_reference<_Tp>::type _U;
+
+ public:
+ typedef typename detail::_decay_aux1<is_array<_U>::value,_U>::type type;
+};
+
+template <bool, class _Tp = void>
+struct enable_if
+{
+};
+
+template <class _Tp>
+struct enable_if<true,_Tp>
+{
+ typedef _Tp type;
+};
+
+template <bool, class _Tp1, class _Tp2>
+struct conditional
+{
+ typedef _Tp2 type;
+};
+
+template <class _Tp1, class _Tp2>
+struct conditional<true,_Tp1,_Tp2>
+{
+ typedef _Tp1 type;
+};
+
+// template <class... _Tp> struct common_type;
+
+#undef __CV_SPEC
+#undef __SPEC_
+#undef __CV_SPEC_1
+#undef __SPEC_1
+#undef __CV_SPEC_2
+#undef __SPEC_2
+
+_STLP_END_NAMESPACE // tr1
+
+_STLP_END_NAMESPACE
+
+// # else // __GLIBCXX__ && (__GNUC__ >= 4) && !STLPORT
+// # include <tr1/type_traits>
+// # endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x3)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif // __STLP_TYPE_TRAITS
+
diff --git a/stlport/typeinfo b/stlport/typeinfo
new file mode 100644
index 0000000..269123f
--- /dev/null
+++ b/stlport/typeinfo
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_TYPEINFO
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x473
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x473) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_TYPEINFO
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x473) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_TYPEINFO
+# include <stl/_typeinfo.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x473) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <typeinfo>
+# else
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x473)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/typeinfo.h b/stlport/typeinfo.h
new file mode 100644
index 0000000..0cea71a
--- /dev/null
+++ b/stlport/typeinfo.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+// DMC has hardcoded inclusion of typeinfo.h at the begining of any translation unit.
+// So inclusion of this header will directly reference the native header. This is not
+// a problem as typeinfo.h is neither a C nor C++ Standard header, this header should
+// never be used in user code.
+#if defined (__DMC__)
+// We define _STLP_OUTERMOST_HEADER_ID to signal to other STLport headers that inclusion
+// is done from native typeinfo.h (see exception header).
+# define _STLP_OUTERMOST_HEADER_ID 0x874
+# include <../include/typeinfo.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#else
+# ifndef _STLP_OLDSTD_typeinfo
+# define _STLP_OLDSTD_typeinfo
+
+# ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x874
+# include <stl/_prolog.h>
+# endif
+
+# ifndef _STLP_NO_TYPEINFO
+
+# if defined (__GNUC__)
+# undef _STLP_OLDSTD_typeinfo
+# include <typeinfo>
+# define _STLP_OLDSTD_typeinfo
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <typeinfo.h>
+# elif !defined (__BORLANDC__) || (__BORLANDC__ < 0x580)
+# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo.h)
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(typeinfo.h)
+# endif
+# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x580) || \
+ defined (__DMC__)
+using std::type_info;
+using std::bad_typeid;
+using std::bad_cast;
+# endif
+# endif
+
+// if <typeinfo> already included, do not import anything
+
+# if defined (_STLP_USE_OWN_NAMESPACE) && !(defined (_STLP_TYPEINFO) && !defined (_STLP_NO_NEW_NEW_HEADER))
+
+_STLP_BEGIN_NAMESPACE
+
+using /*_STLP_VENDOR_EXCEPT_STD */ :: type_info;
+# if !(defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)))
+using /* _STLP_VENDOR_EXCEPT_STD */ :: bad_typeid;
+# endif
+
+using /* _STLP_VENDOR_EXCEPT_STD */ :: bad_cast;
+
+_STLP_END_NAMESPACE
+
+# endif /* _STLP_OWN_NAMESPACE */
+
+# endif /* _STLP_NO_TYPEINFO */
+
+# if (_STLP_OUTERMOST_HEADER_ID == 0x874)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# endif
+
+# endif /* _STLP_OLDSTD_typeinfo */
+
+#endif /* __DMC__ */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/unordered_map b/stlport/unordered_map
similarity index 100%
rename from unordered_map
rename to stlport/unordered_map
diff --git a/unordered_set b/stlport/unordered_set
similarity index 100%
rename from unordered_set
rename to stlport/unordered_set
diff --git a/stlport/using/cstring b/stlport/using/cstring
new file mode 100644
index 0000000..42c5660
--- /dev/null
+++ b/stlport/using/cstring
@@ -0,0 +1,60 @@
+using _STLP_VENDOR_CSTD::size_t;
+
+#if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
+# if defined (__MSL__) && __MC68K__ && !_No_BlockMove && __dest_os == __mac_os
+# undef memcpy
+# undef memmove
+inline void* memcpy(void* dst, const void* src, size_t len)
+{ return _STLP_VENDOR_CSTD::__memcpy(dst, src, len); }
+inline void* memmove(void* dst, const void* src, size_t len)
+{ return _STLP_VENDOR_CSTD::__memmove(dst, src, len); }
+# else
+using _STLP_VENDOR_CSTD::memmove;
+using _STLP_VENDOR_CSTD::memcpy;
+# endif
+
+# if !defined (_STLP_WCE)
+// these functions just don't exist on Windows CE
+using _STLP_VENDOR_CSTD::strcoll;
+using _STLP_VENDOR_CSTD::strerror;
+using _STLP_VENDOR_CSTD::strxfrm;
+# endif
+
+# if defined (__BORLANDC__)
+extern "C++" {
+# endif
+using _STLP_VENDOR_CSTD::memchr;
+using _STLP_VENDOR_CSTD::strchr;
+using _STLP_VENDOR_CSTD::strpbrk;
+using _STLP_VENDOR_CSTD::strrchr;
+using _STLP_VENDOR_CSTD::strstr;
+# if defined (__BORLANDC__)
+}
+# endif
+
+using _STLP_VENDOR_CSTD::memcmp;
+using _STLP_VENDOR_CSTD::memset;
+
+using _STLP_VENDOR_CSTD::strcat;
+
+# if !defined (strcmp) || !defined (__BORLANDC__)
+using _STLP_VENDOR_CSTD::strcmp;
+# else
+using ::strcmp;
+# endif
+
+# if !defined (strcpy) || !defined (__BORLANDC__)
+using _STLP_VENDOR_CSTD::strcpy;
+# else
+using ::strcpy;
+# endif
+using _STLP_VENDOR_CSTD::strcspn;
+using _STLP_VENDOR_CSTD::strlen;
+using _STLP_VENDOR_CSTD::strncat;
+using _STLP_VENDOR_CSTD::strncmp;
+
+using _STLP_VENDOR_CSTD::strncpy;
+using _STLP_VENDOR_CSTD::strspn;
+
+using _STLP_VENDOR_CSTD::strtok;
+#endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
diff --git a/using/export b/stlport/using/export
similarity index 100%
rename from using/export
rename to stlport/using/export
diff --git a/using/fstream b/stlport/using/fstream
similarity index 100%
rename from using/fstream
rename to stlport/using/fstream
diff --git a/using/h/fstream.h b/stlport/using/h/fstream.h
similarity index 100%
rename from using/h/fstream.h
rename to stlport/using/h/fstream.h
diff --git a/using/h/iomanip.h b/stlport/using/h/iomanip.h
similarity index 100%
rename from using/h/iomanip.h
rename to stlport/using/h/iomanip.h
diff --git a/using/h/iostream.h b/stlport/using/h/iostream.h
similarity index 100%
rename from using/h/iostream.h
rename to stlport/using/h/iostream.h
diff --git a/using/h/ostream.h b/stlport/using/h/ostream.h
similarity index 100%
rename from using/h/ostream.h
rename to stlport/using/h/ostream.h
diff --git a/using/h/streambuf.h b/stlport/using/h/streambuf.h
similarity index 100%
rename from using/h/streambuf.h
rename to stlport/using/h/streambuf.h
diff --git a/using/h/strstream.h b/stlport/using/h/strstream.h
similarity index 100%
rename from using/h/strstream.h
rename to stlport/using/h/strstream.h
diff --git a/using/iomanip b/stlport/using/iomanip
similarity index 100%
rename from using/iomanip
rename to stlport/using/iomanip
diff --git a/using/ios b/stlport/using/ios
similarity index 100%
rename from using/ios
rename to stlport/using/ios
diff --git a/using/iosfwd b/stlport/using/iosfwd
similarity index 100%
rename from using/iosfwd
rename to stlport/using/iosfwd
diff --git a/using/iostream b/stlport/using/iostream
similarity index 100%
rename from using/iostream
rename to stlport/using/iostream
diff --git a/using/istream b/stlport/using/istream
similarity index 100%
rename from using/istream
rename to stlport/using/istream
diff --git a/using/locale b/stlport/using/locale
similarity index 100%
rename from using/locale
rename to stlport/using/locale
diff --git a/using/ostream b/stlport/using/ostream
similarity index 100%
rename from using/ostream
rename to stlport/using/ostream
diff --git a/using/sstream b/stlport/using/sstream
similarity index 100%
rename from using/sstream
rename to stlport/using/sstream
diff --git a/using/streambuf b/stlport/using/streambuf
similarity index 100%
rename from using/streambuf
rename to stlport/using/streambuf
diff --git a/using/strstream b/stlport/using/strstream
similarity index 100%
rename from using/strstream
rename to stlport/using/strstream
diff --git a/stlport/utility b/stlport/utility
new file mode 100644
index 0000000..4aaaa59
--- /dev/null
+++ b/stlport/utility
@@ -0,0 +1,60 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_UTILITY
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x75
+# include <stl/_prolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x75) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+# define _STLP_UTILITY
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x75) && !defined (_STLP_DONT_POP_HEADER_ID)
+# ifndef _STLP_INTERNAL_PAIR_H
+# include <stl/_pair.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x75) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <utility>
+# else
+# include _STLP_NATIVE_HEADER(utility)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x75)
+# if !defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
+#endif /* _STLP_UTILITY */
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/valarray b/stlport/valarray
new file mode 100644
index 0000000..0cb0776
--- /dev/null
+++ b/stlport/valarray
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_VALARRAY
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x76
+# include <stl/_prolog.h>
+# define _STLP_VALARRAY
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x76)
+# ifndef _STLP_VALARRAY_H
+# include <stl/_valarray.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x76) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <valarray>
+# else
+# include _STLP_NATIVE_HEADER(valarray)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x76)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_VALARRAY */
+
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/stlport/vector b/stlport/vector
new file mode 100644
index 0000000..92c41b7
--- /dev/null
+++ b/stlport/vector
@@ -0,0 +1,59 @@
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef _STLP_VECTOR
+
+#ifndef _STLP_OUTERMOST_HEADER_ID
+# define _STLP_OUTERMOST_HEADER_ID 0x77
+# include <stl/_prolog.h>
+# define _STLP_VECTOR
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x77)
+# ifndef _STLP_INTERNAL_ALGOBASE_H
+# include <stl/_algobase.h>
+# endif
+
+# ifndef _STLP_INTERNAL_VECTOR_H
+# include <stl/_vector.h>
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID != 0x77) || defined (_STLP_IMPORT_VENDOR_STD)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <vector>
+# else
+# include _STLP_NATIVE_HEADER(vector)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x77)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+#endif
+
+#endif /* _STLP_VECTOR */
+
+// Local Variables:
+// mode:C++
+// End:
+
diff --git a/stlport/wchar.h b/stlport/wchar.h
new file mode 100644
index 0000000..6d66799
--- /dev/null
+++ b/stlport/wchar.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x278
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x278) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+#if !defined (_STLP_WCE_EVC3) && !defined (_STLP_NO_WCHAR_T)
+
+# if defined (__BORLANDC__) && !defined (__linux__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <_str.h>
+# else
+# include _STLP_NATIVE_CPP_C_HEADER(_str.h)
+# endif
+# ifdef __cplusplus
+using _STLP_VENDOR_CSTD::strlen;
+using _STLP_VENDOR_CSTD::strspn;
+# endif
+# endif
+
+# if (((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))) && defined (__APPLE__)) || defined (__OpenBSD__)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <stddef.h>
+# else
+# include _STLP_NATIVE_C_HEADER(stddef.h)
+# endif
+# else
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# include_next <wchar.h>
+# else
+# include _STLP_NATIVE_C_HEADER(wchar.h)
+# endif
+# endif
+#endif /* !defined (_STLP_WCE_EVC3) && !defined (_STLP_NO_WCHAR_T) */
+
+#ifndef _STLP_INTERNAL_MBSTATE_T
+# include <stl/_mbstate_t.h>
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x278)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
+
diff --git a/stlport/wctype.h b/stlport/wctype.h
new file mode 100644
index 0000000..c64ab9b
--- /dev/null
+++ b/stlport/wctype.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#if !defined (_STLP_OUTERMOST_HEADER_ID)
+# define _STLP_OUTERMOST_HEADER_ID 0x279
+# include <stl/_cprolog.h>
+#elif (_STLP_OUTERMOST_HEADER_ID == 0x279) && !defined (_STLP_DONT_POP_HEADER_ID)
+# define _STLP_DONT_POP_HEADER_ID
+#endif
+
+/* evc3 doesn't have wctype.h */
+#if !defined(_STLP_WCE_EVC3)
+# if defined (_STLP_HAS_INCLUDE_NEXT)
+# if defined (__hpux)
+# include_next <stdarg.h>
+# include_next <wchar.h>
+# endif
+# include_next <wctype.h>
+# else
+# if defined (__hpux)
+# include _STLP_NATIVE_C_HEADER(stdarg.h)
+# include _STLP_NATIVE_C_HEADER(wchar.h)
+# endif
+# include _STLP_NATIVE_C_HEADER(wctype.h)
+# endif
+#endif
+
+#if (_STLP_OUTERMOST_HEADER_ID == 0x279)
+# if ! defined (_STLP_DONT_POP_HEADER_ID)
+# include <stl/_epilog.h>
+# undef _STLP_OUTERMOST_HEADER_ID
+# else
+# undef _STLP_DONT_POP_HEADER_ID
+# endif
+#endif
diff --git a/streambuf b/streambuf
deleted file mode 100644
index ead57c9..0000000
--- a/streambuf
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-#ifndef _STLP_STREAMBUF
-#define _STLP_STREAMBUF
-
-# ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x1066
-# include <stl/_prolog.h>
-# endif
-
-# ifdef _STLP_PRAGMA_ONCE
-# pragma once
-# endif
-
-# include <stl/_ioserr.h>
-# include <stl/_streambuf.h>
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x1066)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-
-#endif /* _STLP_STREAMBUF */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/string b/string
deleted file mode 100644
index c53d67f..0000000
--- a/string
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1997-1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_STRING
-# define _STLP_STRING
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x68
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#if defined (_STLP_USE_OWN_NAMESPACE)
-# include <stl/_string.h>
-#endif
-
-#include <stl/_string_hash.h>
-
-#if !defined (_STLP_USE_NO_IOSTREAMS)
-# include <stl/_string_io.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x68)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_STRING */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/string.h b/string.h
deleted file mode 100644
index 737bdb6..0000000
--- a/string.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-/* Workaround for a "misbehaviour" when compiling resource scripts using
- * eMbedded Visual C++. The standard .rc file includes windows header files,
- * which in turn include string.h, which results in warnings and errors
- */
-#ifndef _STLP_STRING_H
-
-#if !defined (RC_INVOKED)
-
-# ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x269
-# include <stl/_prolog.h>
-# elif (_STLP_OUTERMOST_HEADER_ID == 0x269) && !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-# define _STLP_STRING_H
-# endif
-
-# if defined(_STLP_WCE_EVC3)
-struct _exception;
-# endif
-# if (_STLP_OUTERMOST_HEADER_ID != 0x269) || defined (_STLP_DONT_POP_HEADER_ID)
-# include _STLP_NATIVE_C_HEADER(string.h)
-# else
-# if defined (__BORLANDC__)
-# include _STLP_NATIVE_CPP_C_HEADER(_str.h)
-# else
-# include _STLP_NATIVE_C_HEADER(string.h)
-# endif
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x269)
-# if defined (__BORLANDC__) && defined (_STLP_IMPORT_VENDOR_CSTD)
-# include <using/cstring>
-# endif /* BORLAND */
-# endif
-# endif
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x269)
-# if !defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-# endif
-#endif /* RC_INVOKED */
-#endif /* _STLP_STRING_H */
diff --git a/strstream b/strstream
deleted file mode 100644
index 163b5cd..0000000
--- a/strstream
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-// WARNING: The classes defined in this header are DEPRECATED. This
-// header is defined in section D.7.1 of the C++ standard, and it
-// MAY BE REMOVED in a future standard revision. You should use the
-// header <sstream> instead.
-
-
-#ifndef _STLP_STRSTREAM
-#define _STLP_STRSTREAM
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x1070
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#include <stl/_ioserr.h>
-
-#ifndef _STLP_INTERNAL_STRSTREAM
-# include <stl/_strstream.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x1070)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_STRSTREAM */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/test/compiler/Makefile.inc b/test/compiler/Makefile.inc
new file mode 100644
index 0000000..8470e62
--- /dev/null
+++ b/test/compiler/Makefile.inc
@@ -0,0 +1,6 @@
+# -*- makefile -*- Time-stamp: <04/10/17 21:16:38 ptr>
+
+PRGNAME = compiler_test
+SRC_CPP = ttei1.cpp ttei2.cpp ttei3.cpp ttei4.cpp ttei5.cpp ttei6.cpp ttei7.cpp \
+ partial_spec.cpp movable.cpp
+SRC_CC = eh.cc
diff --git a/test/compiler/README b/test/compiler/README
new file mode 100644
index 0000000..f942ef0
--- /dev/null
+++ b/test/compiler/README
@@ -0,0 +1,29 @@
+1. About this tests
+
+This is tests to check whether compiler understand or not some language
+construction. It is NOT tests for language support libraries, only tests for
+compiler!
+
+The main purposes of this tests is to help for developers to find correct
+workarounds, if compiler don't understand some (correct) language constructions.
+
+--------------------------------------------------------
+
+2. Compilation
+
+Compilation with GNU Make utility and gcc compiler:
+
+make -f gcc.mak -k
+
+
+
+--------------------------------------------------------
+
+Notes about tests.
+
+ttei1.cpp, ttei2.cpp, ttei3.cpp, ttei4.cpp, ttei5.cpp:
+
+tests for template-in-the-template explicit specialization.
+Indeed ttei3.cpp, ttei4.cpp, ttei5.cpp suggest syntax not approved by standard
+(14.7.3, paragraphs 16--18), but ttei3.cpp, ttei4.cpp accepted (recheck!) by VC6,
+while ttei5.cpp accepted by gcc before 3.4.0.
diff --git a/test/compiler/StTerm-order/Makefile b/test/compiler/StTerm-order/Makefile
new file mode 100644
index 0000000..1efc797
--- /dev/null
+++ b/test/compiler/StTerm-order/Makefile
@@ -0,0 +1,12 @@
+# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr>
+
+SRCROOT := ../../../build
+COMPILER_NAME := gcc
+
+# WITHOUT_STLPORT = 1
+# STLPORT_DIR := ../../..
+include Makefile.inc
+include ${SRCROOT}/Makefiles/top.mak
+
+#CXXFLAGS += -fuse-cxa-atexit
+LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR}
diff --git a/test/compiler/StTerm-order/Makefile.inc b/test/compiler/StTerm-order/Makefile.inc
new file mode 100644
index 0000000..b597030
--- /dev/null
+++ b/test/compiler/StTerm-order/Makefile.inc
@@ -0,0 +1,4 @@
+# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr>
+
+PRGNAME = stterm-test
+SRC_CC = stterm-test.cc
diff --git a/test/compiler/StTerm-order/stterm-test.cc b/test/compiler/StTerm-order/stterm-test.cc
new file mode 100644
index 0000000..0054f7d
--- /dev/null
+++ b/test/compiler/StTerm-order/stterm-test.cc
@@ -0,0 +1,117 @@
+/*
+ * The conversation with Matti Rintala on STLport forum 2005-08-24:
+ *
+ * Do you mean ISO/IEC 14882 3.6.3 [basic.start.term]?
+ *
+ * Yes. "Destructors (12.4) for initialized objects of static storage duration
+ * (declared at block scope or at namespace scope) are called as a result
+ * of returning from main and as a result of calling exit (18.3). These objects
+ * are destroyed in the reverse order of the completion of their constructor
+ * or of the completion of their dynamic initialization."
+ *
+ * I found a confirmation on the web that gcc may not strictly conform
+ * to this behaviour in certains cases unless -fuse-cxa-atexit is used.
+ *
+ * Test below give (without -fuse-cxa-atexit)
+
+Init::Init()
+Init::use_it
+It ctor done <-- 0
+Init::use_it done
+Init ctor done <-- 1
+Init2 ctor done <-- 2
+It dtor done <-- 0
+Init2 dtor done <-- 2
+Init dtor done <-- 1
+
+
+ * but should:
+
+Init::Init()
+Init::use_it
+It ctor done <-- 0
+Init::use_it done
+Init ctor done <-- 1
+Init2 ctor done <-- 2
+Init2 dtor done <-- 2
+Init dtor done <-- 1
+It dtor done <-- 0
+
+
+ */
+#include <stdio.h>
+
+using namespace std;
+
+class Init
+{
+ public:
+ Init();
+ ~Init();
+
+ static void use_it();
+};
+
+class Init2
+{
+ public:
+ Init2();
+ ~Init2();
+
+};
+
+static Init init;
+static Init2 init2;
+
+class It
+{
+ public:
+ It();
+ ~It();
+};
+
+Init::Init()
+{
+ printf( "Init::Init()\n" );
+ use_it();
+ printf( "Init ctor done\n" );
+}
+
+Init::~Init()
+{
+ printf( "Init dtor done\n" );
+}
+
+void Init::use_it()
+{
+ printf( "Init::use_it\n" );
+
+ static It it;
+
+ printf( "Init::use_it done\n" );
+}
+
+Init2::Init2()
+{
+ printf( "Init2 ctor done\n" );
+}
+
+Init2::~Init2()
+{
+ printf( "Init2 dtor done\n" );
+}
+
+It::It()
+{
+ printf( "It ctor done\n" );
+}
+
+It::~It()
+{
+ printf( "It dtor done\n" );
+}
+
+int main()
+{
+ return 0;
+}
diff --git a/test/compiler/eh.cc b/test/compiler/eh.cc
new file mode 100644
index 0000000..48dc920
--- /dev/null
+++ b/test/compiler/eh.cc
@@ -0,0 +1,60 @@
+#include <list> /* required, to expose allocator */
+#include <stdexcept>
+#include <stdio.h>
+
+using namespace std;
+
+struct BigStruct
+{
+ char _data[4096];
+};
+
+void bad_alloc_test()
+{
+ typedef allocator<BigStruct> BigStructAllocType;
+ BigStructAllocType bigStructAlloc;
+
+ try {
+ //Lets try to allocate almost 4096 Go (on most of the platforms) of memory:
+ BigStructAllocType::pointer pbigStruct = bigStructAlloc.allocate(1024 * 1024 * 1024);
+
+ // CPPUNIT_ASSERT( pbigStruct != 0 && "Allocation failed but no exception thrown" );
+ }
+ catch (bad_alloc const&) {
+ printf( "Ok\n" );
+ }
+ catch (...) {
+ //We shouldn't be there:
+ // CPPUNIT_ASSERT( false && "Not bad_alloc exception thrown." );
+ }
+}
+
+void bad_alloc_test1()
+{
+ try {
+ allocator<BigStruct> all;
+ BigStruct *bs = all.allocate(1024*1024*1024);
+
+ // throw bad_alloc();
+ }
+ catch ( bad_alloc const & ) {
+ printf( "I am here\n" );
+ }
+ catch ( ... ) {
+ }
+}
+
+int main()
+{
+ bad_alloc_test();
+#if 0
+ try {
+ throw bad_alloc();
+ }
+ catch ( bad_alloc& ) {
+ }
+ catch ( ... ) {
+ }
+#endif
+ return 0;
+}
diff --git a/test/compiler/gcc.mak b/test/compiler/gcc.mak
new file mode 100644
index 0000000..311eded
--- /dev/null
+++ b/test/compiler/gcc.mak
@@ -0,0 +1,12 @@
+# -*- Makefile -*- Time-stamp: <04/03/14 23:50:57 ptr>
+
+SRCROOT := ../../build
+COMPILER_NAME := gcc
+
+ALL_TAGS := compile-only
+STLPORT_DIR := ../..
+include Makefile.inc
+include ${SRCROOT}/Makefiles/top.mak
+
+compile-only: $(OUTPUT_DIRS) $(OBJ)
+
diff --git a/test/compiler/movable.cpp b/test/compiler/movable.cpp
new file mode 100644
index 0000000..04590b9
--- /dev/null
+++ b/test/compiler/movable.cpp
@@ -0,0 +1,20 @@
+#include <list>
+#include <vector>
+#include <string>
+
+using namespace std;
+
+struct S :
+ public string
+{
+};
+
+void test()
+{
+ list<S> l;
+ l.push_back( S() );
+
+ vector<S> v;
+ v.push_back( S() );
+}
+
diff --git a/test/compiler/partial_spec.cpp b/test/compiler/partial_spec.cpp
new file mode 100644
index 0000000..a572cd6
--- /dev/null
+++ b/test/compiler/partial_spec.cpp
@@ -0,0 +1,34 @@
+/*
+ * It is known that this code not compiled by following compilers:
+ *
+ * MSVC 6
+ *
+ * It is known that this code compiled by following compilers:
+ *
+ * MSVC 8
+ * gcc 4.1.1
+ */
+
+/*
+ * This code represent what STLport waits from a compiler which support
+ * the partial template function ordering (!_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER)
+ */
+
+template <class T1>
+struct template_struct {};
+
+template <class T1>
+int func(T1 p1);
+
+template <class T1>
+int func(template_struct<T1>);
+
+
+int foo()
+{
+ int tmp1 = 0;
+ template_struct<int> tmp2;
+ func(tmp1);
+ func(tmp2);
+ return 0;
+}
diff --git a/test/compiler/ttei1.cpp b/test/compiler/ttei1.cpp
new file mode 100644
index 0000000..7430d96
--- /dev/null
+++ b/test/compiler/ttei1.cpp
@@ -0,0 +1,31 @@
+/*
+ * It is known that this code not compiled by following compilers:
+ * gcc 2.95.3
+ * MSVC 6
+ *
+ * It is known that this code compiled by following compilers:
+ * gcc 3.3.3
+ * gcc 3.4.1
+ * MSVC 8 Beta
+ */
+
+struct A
+{
+ private:
+ struct B
+ {
+ template <typename T>
+ static void f( T& ) {}
+
+ template <bool V>
+ struct C
+ {
+ template <typename T>
+ static void f( T& ) {}
+ };
+ };
+};
+
+template <> template <typename T>
+void A::B::C<true>::f( T& ) {}
+
diff --git a/test/compiler/ttei2.cpp b/test/compiler/ttei2.cpp
new file mode 100644
index 0000000..68f8a18
--- /dev/null
+++ b/test/compiler/ttei2.cpp
@@ -0,0 +1,31 @@
+/*
+ * It is known that this code not compiled by following compilers:
+ *
+ * It is known that this code compiled by following compilers:
+ * gcc 2.95.3
+ * gcc 3.3.3
+ * gcc 3.4.1
+ * MSVC 6
+ * MSVC 8
+ */
+
+struct A
+{
+ private:
+ struct B
+ {
+ template <typename T>
+ static void f( T& ) {}
+
+ template <bool V>
+ struct C
+ {
+ };
+ };
+};
+
+template <>
+struct A::B::C<true>
+{
+};
+
diff --git a/test/compiler/ttei3.cpp b/test/compiler/ttei3.cpp
new file mode 100644
index 0000000..a7cdca2
--- /dev/null
+++ b/test/compiler/ttei3.cpp
@@ -0,0 +1,43 @@
+/*
+ * It is known that this code not compiled by following compilers:
+ * gcc 2.95.3
+ * gcc 3.3.3
+ * gcc 3.4.1
+ * gcc 4.1.1
+ *
+ * It is known that this code compiled by following compilers:
+ *
+ * MSVC 6
+ * MSVC 8 Beta
+ */
+
+/*
+ * Indeed this code is wrong: explicit template specialization
+ * have to appear out-of-class.
+ *
+ */
+
+struct A
+{
+ private:
+ struct B
+ {
+ template <typename T>
+ static void f( T& ) {}
+
+ template <bool V>
+ struct C
+ {
+ template <typename T>
+ static void f( T& ) {}
+ };
+
+ template <>
+ struct C<true>
+ {
+ template <typename T>
+ static void f( T& ) {}
+ };
+ };
+};
+
diff --git a/test/compiler/ttei4.cpp b/test/compiler/ttei4.cpp
new file mode 100644
index 0000000..7c56e0f
--- /dev/null
+++ b/test/compiler/ttei4.cpp
@@ -0,0 +1,42 @@
+/*
+ * It is known that this code not compiled by following compilers:
+ * gcc 2.95.3
+ * gcc 3.3.3
+ * gcc 3.4.1
+ * gcc 4.1.1
+ *
+ * It is known that this code compiled by following compilers:
+ *
+ * MSVC 6
+ * MSVC 8 Beta
+ */
+
+/*
+ * Indeed this code is wrong: 1. explicit template specialization
+ * have to appear out-of-class; 2. specialized struct C have to
+ * have function f.
+ *
+ */
+
+struct A
+{
+ private:
+ struct B
+ {
+ template <typename T>
+ static void f( T& ) {}
+
+ template <bool V>
+ struct C
+ {
+ template <typename T>
+ static void f( T& ) {}
+ };
+
+ template <>
+ struct C<true>
+ {
+ };
+ };
+};
+
diff --git a/test/compiler/ttei5.cpp b/test/compiler/ttei5.cpp
new file mode 100644
index 0000000..d2c916e
--- /dev/null
+++ b/test/compiler/ttei5.cpp
@@ -0,0 +1,43 @@
+/*
+ * It is known that this code not compiled by following compilers:
+ * gcc 3.4.1
+ * gcc 4.1.1
+ *
+ * It is known that this code compiled by following compilers:
+ * gcc 2.95.3
+ * gcc 3.3.3
+ *
+ * MSVC 6
+ * MSVC 8 Beta
+ */
+
+/*
+ * Indeed this code is wrong: explicit template specialization
+ * have to appear out-of-class.
+ *
+ */
+
+struct A
+{
+ private:
+ struct B
+ {
+ template <typename T>
+ static void f( T& ) {}
+
+ template <bool V>
+ struct C
+ {
+ template <typename T>
+ static void f( T& ) {}
+ };
+
+ template <>
+ struct C<true>
+ {
+ template <typename T>
+ static void f( T& ) {}
+ };
+ };
+};
+
diff --git a/test/compiler/ttei6.cpp b/test/compiler/ttei6.cpp
new file mode 100644
index 0000000..6e51e22
--- /dev/null
+++ b/test/compiler/ttei6.cpp
@@ -0,0 +1,30 @@
+/*
+ * It is known that this code not compiled by following compilers:
+ *
+ * It is known that this code compiled by following compilers:
+ *
+ * MSVC 6
+ * MSVC 8 Beta
+ */
+
+/*
+ * This code represent what STLport waits from a compiler which support
+ * member template classes (!_STLP_NO_MEMBER_TEMPLATE_CLASSES)
+ */
+
+template <typename T1>
+struct A
+{
+ template <typename T2>
+ struct B
+ {
+ typedef T2 _Type;
+ };
+};
+
+
+template <typename T1, typename T2>
+struct C
+{
+ typedef typename A<T1>:: template B<T2>::_Type ABType;
+};
diff --git a/test/compiler/ttei7.cpp b/test/compiler/ttei7.cpp
new file mode 100644
index 0000000..08742e3
--- /dev/null
+++ b/test/compiler/ttei7.cpp
@@ -0,0 +1,31 @@
+/*
+ * It is known that this code not compiled by following compilers:
+ *
+ * MSVC 6
+ *
+ * It is known that this code compiled by following compilers:
+ *
+ * MSVC 8 Beta
+ */
+
+/*
+ * This code represent what STLport waits from a compiler which support
+ * the rebind member template class technique (!_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
+ */
+
+template <typename T1>
+struct A
+{
+ template <typename T2>
+ struct B
+ {
+ typedef A<T2> _Type;
+ };
+};
+
+
+template <typename T, typename A>
+struct C
+{
+ typedef typename A:: template B<T>::_Type _ATType;
+};
diff --git a/test/eh/LeakCheck.h b/test/eh/LeakCheck.h
new file mode 100644
index 0000000..b6e7267
--- /dev/null
+++ b/test/eh/LeakCheck.h
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+/***********************************************************************************
+ LeakCheck.h
+
+ SUMMARY: A suite of template functions for verifying the behavior of
+ operations in the presence of exceptions. Requires that the operations
+ be written so that each operation that could cause an exception causes
+ simulate_possible_failure() to be called (see "nc_alloc.h").
+
+***********************************************************************************/
+#ifndef INCLUDED_MOTU_LeakCheck
+#define INCLUDED_MOTU_LeakCheck 1
+
+#include "Prefix.h"
+
+#include "nc_alloc.h"
+
+#include <cstdio>
+#include <cassert>
+#include <iterator>
+
+#include <iostream>
+
+EH_BEGIN_NAMESPACE
+
+template <class T1, class T2>
+inline ostream& operator << (
+ostream& s,
+const pair <T1, T2>& p) {
+ return s<<'['<<p.first<<":"<<p.second<<']';
+}
+EH_END_NAMESPACE
+
+/*===================================================================================
+ CheckInvariant
+
+ EFFECTS: Generalized function to check an invariant on a container. Specialize
+ this for particular containers if such a check is available.
+====================================================================================*/
+template <class C>
+void CheckInvariant(const C&)
+{}
+
+/*===================================================================================
+ WeakCheck
+
+ EFFECTS: Given a value and an operation, repeatedly applies the operation to a
+ copy of the value triggering the nth possible exception, where n increments
+ with each repetition until no exception is thrown or max_iters is reached.
+ Reports any detected memory leaks and checks any invariant defined for the
+ value type whether the operation succeeds or fails.
+====================================================================================*/
+template <class Value, class Operation>
+void WeakCheck(const Value& v, const Operation& op, long max_iters = 2000000) {
+ bool succeeded = false;
+ bool failed = false;
+ gTestController.SetCurrentTestCategory("weak");
+ for (long count = 0; !succeeded && !failed && count < max_iters; ++count) {
+ gTestController.BeginLeakDetection();
+ {
+ Value dup = v;
+#ifndef EH_NO_EXCEPTIONS
+ try {
+#endif
+ gTestController.SetFailureCountdown(count);
+ op( dup );
+ succeeded = true;
+#ifndef EH_NO_EXCEPTIONS
+ }
+ catch (...) {} // Just try again.
+#endif
+ gTestController.CancelFailureCountdown();
+ CheckInvariant(dup);
+ }
+ failed = gTestController.ReportLeaked();
+ EH_ASSERT( !failed );
+
+ if ( succeeded )
+ gTestController.ReportSuccess(count);
+ }
+ EH_ASSERT( succeeded || failed ); // Make sure the count hasn't gone over
+}
+
+/*===================================================================================
+ ConstCheck
+
+ EFFECTS: Similar to WeakCheck (above), but for operations which may not modify
+ their arguments. The operation is performed on the value itself, and no
+ invariant checking is performed. Leak checking still occurs.
+====================================================================================*/
+template <class Value, class Operation>
+void ConstCheck(const Value& v, const Operation& op, long max_iters = 2000000) {
+ bool succeeded = false;
+ bool failed = false;
+ gTestController.SetCurrentTestCategory("const");
+ for (long count = 0; !succeeded && !failed && count < max_iters; ++count) {
+ gTestController.BeginLeakDetection();
+ {
+#ifndef EH_NO_EXCEPTIONS
+ try {
+#endif
+ gTestController.SetFailureCountdown(count);
+ op( v );
+ succeeded = true;
+#ifndef EH_NO_EXCEPTIONS
+ }
+ catch(...) {} // Just try again.
+# endif
+ gTestController.CancelFailureCountdown();
+ }
+ failed = gTestController.ReportLeaked();
+ EH_ASSERT( !failed );
+
+ if ( succeeded )
+ gTestController.ReportSuccess(count);
+ }
+ EH_ASSERT( succeeded || failed ); // Make sure the count hasn't gone over
+}
+
+/*===================================================================================
+ StrongCheck
+
+ EFFECTS: Similar to WeakCheck (above), but additionally checks a component of
+ the "strong guarantee": if the operation fails due to an exception, the
+ value being operated on must be unchanged, as checked with operator==().
+
+ CAVEATS: Note that this does not check everything required for the strong
+ guarantee, which says that if an exception is thrown, the operation has no
+ effects. Do do that we would have to check that no there were no side-effects
+ on objects which are not part of v (e.g. iterator validity must be preserved).
+
+====================================================================================*/
+template <class Value, class Operation>
+void StrongCheck(const Value& v, const Operation& op, long max_iters = 2000000) {
+ bool succeeded = false;
+ bool failed = false;
+ gTestController.SetCurrentTestCategory("strong");
+ for ( long count = 0; !succeeded && !failed && count < max_iters; count++ ) {
+ gTestController.BeginLeakDetection();
+
+ {
+ Value dup = v;
+ {
+#ifndef EH_NO_EXCEPTIONS
+ try {
+#endif
+ gTestController.SetFailureCountdown(count);
+ op( dup );
+ succeeded = true;
+ gTestController.CancelFailureCountdown();
+# ifndef EH_NO_EXCEPTIONS
+ }
+ catch (...) {
+ gTestController.CancelFailureCountdown();
+ bool unchanged = (dup == v);
+ EH_ASSERT( unchanged );
+
+ if ( !unchanged ) {
+#if 0
+ typedef typename Value::value_type value_type;
+ EH_STD::ostream_iterator<value_type> o(EH_STD::cerr, " ");
+ EH_STD::cerr<<"EH test FAILED:\nStrong guaranee failed !\n";
+ EH_STD::copy(dup.begin(), dup.end(), o);
+ EH_STD::cerr<<"\nOriginal is:\n";
+ EH_STD::copy(v.begin(), v.end(), o);
+ EH_STD::cerr<<EH_STD::endl;
+#endif
+ failed = true;
+ }
+ } // Just try again.
+# endif
+ CheckInvariant(v);
+ }
+ }
+
+ bool leaked = gTestController.ReportLeaked();
+ EH_ASSERT( !leaked );
+ if ( leaked )
+ failed = true;
+
+ if ( succeeded )
+ gTestController.ReportSuccess(count);
+ }
+ EH_ASSERT( succeeded || failed ); // Make sure the count hasn't gone over
+}
+
+#endif // INCLUDED_MOTU_LeakCheck
diff --git a/test/eh/Prefix.h b/test/eh/Prefix.h
new file mode 100644
index 0000000..27ffd37
--- /dev/null
+++ b/test/eh/Prefix.h
@@ -0,0 +1,313 @@
+/***********************************************************************************
+ Prefix.h
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+ SUMMARY: Configuration #defines for STL EH test suite
+
+***********************************************************************************/
+
+#ifndef INCLUDED_MOTU_Prefix
+#define INCLUDED_MOTU_Prefix 1
+
+// Gives much more thorough checking, but may slow the tests
+// considerably if your malloc is slow.
+#define TESTCLASS_DEEP_DATA 1
+
+# ifndef NO_FAST_ALLOCATOR
+// # define NO_FAST_ALLOCATOR
+# endif
+
+// Define this to use the SGI STL. Undefine it to test a different installation
+#ifndef EH_NO_SGI_STL
+# define EH_USE_SGI_STL 1
+#endif
+
+#if EH_USE_SGI_STL
+
+#define EH_ASSERT _STLP_ASSERT
+
+//=========================================================================
+// SGI STL-specific #defines
+// These control the behavior of the test suite when used with the SGI
+// STL. They have no effect when testing other STL implementations.
+//=========================================================================
+
+#ifndef _STLP_USE_NEWALLOC
+# define _STLP_USE_NEWALLOC
+#endif
+
+#if 0 // !defined (_STLP_NO_CUSTOM_IO) && ! defined (__BORLANDC__)
+# define _STLP_NO_CUSTOM_IO
+#endif
+
+// Just include something to get whatever configuration header we're using.
+#include <utility>
+
+#ifndef _STLP_CALL
+# define _STLP_CALL
+#endif
+
+#if defined(_STLP_USE_NAMESPACES)
+# define EH_USE_NAMESPACES _STLP_USE_NAMESPACES
+#endif
+
+#define EH_BEGIN_NAMESPACE _STLP_BEGIN_NAMESPACE
+#define EH_END_NAMESPACE _STLP_END_NAMESPACE
+
+#define EH_NEW_HEADERS 1
+
+//#if defined (_STLP_USE_NEW_IOSTREAMS)
+#define EH_NEW_IOSTREAMS 1
+//#endif
+
+#if !defined (_STLP_USE_EXCEPTIONS)
+# define EH_NO_EXCEPTIONS
+#endif
+
+#if defined (_STLP_TEMPLATE_PARAM_SUBTYPE_BUG)
+# define EH_TEMPLATE_PARAM_SUBTYPE_BUG _STLP_TEMPLATE_PARAM_SUBTYPE_BUG
+#endif
+
+#if defined(_STLP_MULTI_CONST_TEMPLATE_ARG_BUG)
+# define EH_MULTI_CONST_TEMPLATE_ARG_BUG _STLP_MULTI_CONST_TEMPLATE_ARG_BUG
+#endif
+
+#if defined (STLPORT)
+# define EH_STD STLPORT
+#elif defined(__STD)
+# define EH_STD __STD
+#endif
+
+// we want to be portable here, so std:: won't work.
+#if defined(STLPORT_CSTD)
+# define EH_CSTD STLPORT_CSTD
+#else
+# define EH_CSTD std
+#endif
+
+#define EH_DISTANCE(a, b, result) EH_STD::distance(a, b, result)
+
+#define EH_HASHED_CONTAINERS_IMPLEMENTED 1
+#define EH_HASH_CONTAINERS_SUPPORT_RESIZE 1
+#define EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION 1
+#define EH_SLIST_IMPLEMENTED 1
+#define EH_SELECT1ST_HINT __select1st_hint
+// fbp : DEC cxx is unable to compile it for some reason
+#if !(defined (__DECCXX) || defined (__amigaos__) || \
+ (defined (__GNUC__) && (__GNUC__ <= 2) && (__GNUC_MINOR__ < 8)))
+# define EH_ROPE_IMPLEMENTED 1
+#endif
+#define EH_STRING_IMPLEMENTED 1
+// # define EH_BITSET_IMPLEMENTED 1
+//# define EH_VALARRAY_IMPLEMENTED 1 - we have no tests yet for valarray
+
+#define stl_destroy EH_STD::destroy
+#include <memory>
+
+template <class _Tp>
+class /*_STLP_CLASS_DECLSPEC*/ EH_allocator;
+
+template <class _Tp>
+class /*_STLP_CLASS_DECLSPEC*/ EH_allocator {
+public:
+
+ typedef _Tp value_type;
+ typedef value_type * pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef EH_CSTD::size_t size_type;
+ typedef EH_CSTD::ptrdiff_t difference_type;
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Tp1> struct rebind {
+ typedef EH_allocator<_Tp1> other;
+ };
+# endif
+ EH_allocator() _STLP_NOTHROW {}
+ # if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Tp1> EH_allocator(const EH_allocator<_Tp1>&) _STLP_NOTHROW {}
+ # endif
+ EH_allocator(const EH_allocator<_Tp>&) _STLP_NOTHROW {}
+ ~EH_allocator() _STLP_NOTHROW {}
+ pointer address(reference __x) { return &__x; }
+ const_pointer address(const_reference __x) const { return &__x; }
+ // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0.
+ _Tp* allocate(size_type __n, const void* = 0) const {
+ return __n != 0 ? __REINTERPRET_CAST(value_type*,EH_STD::__new_alloc::allocate(__n * sizeof(value_type))) : 0;
+ }
+ // __p is permitted to be a null pointer, only if n==0.
+ void deallocate(pointer __p, size_type __n) const {
+ _STLP_ASSERT( (__p == 0) == (__n == 0) )
+ if (__p != 0) EH_STD::__new_alloc::deallocate((void*)__p, __n * sizeof(value_type));
+ }
+ // backwards compatibility
+ void deallocate(pointer __p) const { if (__p != 0) EH_STD::__new_alloc::deallocate((void*)__p, sizeof(value_type)); }
+ size_type max_size() const _STLP_NOTHROW { return size_t(-1) / sizeof(value_type); }
+ void construct(pointer __p, const _Tp& __val) const { stlport::construct(__p, __val); }
+ void destroy(pointer __p) const { stlport::destroy(__p); }
+};
+
+template <class _T1> inline bool _STLP_CALL operator==(const EH_allocator<_T1>&, const EH_allocator<_T1>&) { return true; }
+template <class _T1> inline bool _STLP_CALL operator!=(const EH_allocator<_T1>&, const EH_allocator<_T1>&) { return false; }
+
+_STLP_BEGIN_NAMESPACE
+// If custom allocators are being used without member template classes support :
+// user (on purpose) is forced to define rebind/get operations !!!
+template <class _Tp1, class _Tp2>
+inline EH_allocator<_Tp2>& _STLP_CALL
+__stl_alloc_rebind(EH_allocator<_Tp1>& __a, const _Tp2*) { return (EH_allocator<_Tp2>&)(__a); }
+template <class _Tp1, class _Tp2>
+inline EH_allocator<_Tp2> _STLP_CALL
+__stl_alloc_create(const EH_allocator<_Tp1>&, const _Tp2*) { return EH_allocator<_Tp2>(); }
+_STLP_END_NAMESPACE
+
+# define eh_allocator(T) ::EH_allocator<T>
+
+# define EH_BIT_VECTOR_IMPLEMENTED
+
+# if defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined(_STLP_NO_BOOL)
+# define EH_BIT_VECTOR EH_STD::vector<bool, eh_allocator(bool) >
+# else
+# ifdef _STLP_NO_BOOL
+# undef EH_BIT_VECTOR_IMPLEMENTED
+# else
+# define EH_BIT_VECTOR EH_STD::vector<bool, eh_allocator(bool) >
+# endif
+# endif
+
+#else // !USE_SGI_STL
+//=========================================================================
+// Configuration for testing other non-SGI STL implementations
+//=========================================================================
+
+// Metrowerks configuration
+# ifdef __MWERKS__
+
+# define EH_ASSERT assert
+// Get MSL configuration header
+# include <ansi_parms.h>
+
+# if __MSL__ >= 24
+
+# define EH_NEW_HEADERS 1
+# if defined (_MSL_USING_NAMESPACE)
+# define EH_USE_NAMESPACES 1
+# endif
+# define EH_BIT_VECTOR vector<bool>
+# define EH_DISTANCE( a, b, result ) do { result = distance( a, b ); } while (0)
+
+# else
+
+# error No configuration for earlier versions of MSL
+
+# endif // __MSL__ >= 24
+
+// Bugs fixed in CWPro3
+# if __MWERKS__ < 0x2100
+# define EH_TEMPLATE_PARAM_SUBTYPE_BUG 1
+# endif
+
+// Bugs in CWPro3
+# if __MWERKS__ <= 0x2110
+# define EH_MULTI_CONST_TEMPLATE_ARG_BUG 1
+# else
+# pragma warning not sure the above bug is fixed yet
+# endif
+
+# define EH_SLIST_IMPLEMENTED 1
+//# define EH_HASHED_CONTAINERS_IMPLEMENTED 1
+
+# define EH_NEW_IOSTREAMS 1
+# define EH_USE_NOTHROW 1
+# endif // Metrowerks configuration
+
+#if defined (__SUNPRO_CC)
+# define stl_destroy __RWSTD::__destroy
+# define EH_DISTANCE( a, b, result ) distance( a, b, result )
+# define EH_BIT_VECTOR EH_STD::vector<bool>
+# define EH_NEW_HEADERS 1
+# define EH_USE_NAMESPACES 1
+# define EH_NEW_IOSTREAMS 1
+# define EH_ASSERT assert
+# define EH_STRING_IMPLEMENTED 1
+# elif defined (__KCC)
+# define stl_destroy EH_STD::destroy
+# define EH_DISTANCE( a, b, result ) do { result = distance( a, b ); } while (0)
+# define EH_BIT_VECTOR EH_STD::vector<bool>
+# define EH_NEW_HEADERS 1
+# define EH_USE_NAMESPACES 1
+# define EH_NEW_IOSTREAMS 1
+# define EH_ASSERT assert
+# define EH_CSTD
+# define EH_STRING_IMPLEMENTED 1
+# define EH_MULTI_CONST_TEMPLATE_ARG_BUG 1
+# define EH_SELECT1ST_HINT select1st
+# else
+# define stl_destroy destroy
+#endif
+
+//
+// Compiler-independent configuration
+//
+# ifdef EH_USE_NAMESPACES
+# ifdef STLPORT
+# define EH_STD STLPORT
+# else
+# define EH_STD std
+# endif
+# ifdef STLPORT_CSTD
+# define EH_STD STLPORT_CSTD
+# else
+# define EH_STD std
+# endif
+# define EH_BEGIN_NAMESPACE namespace EH_STD {
+# define EH_END_NAMESPACE }
+# else
+# define EH_BEGIN_NAMESPACE
+# define EH_END_NAMESPACE
+# define EH_STD
+# endif
+
+# ifndef EH_CSTD
+# define EH_CSTD EH_STD
+# endif
+
+#endif // !USE_SGI_STL
+
+
+//
+// Library-independent configuration.
+//
+#if defined( EH_MULTI_CONST_TEMPLATE_ARG_BUG) && !defined( EH_SELECT1ST_HINT )
+template <class Pair, class U>
+// JDJ (CW Pro1 doesn't like const when first_type is also const)
+struct eh_select1st_hint : public unary_function<Pair, U> {
+ const U& operator () (const Pair& x) const { return x.first; }
+};
+# define EH_SELECT1ST_HINT eh_select1st_hint
+#endif
+
+
+#if EH_USE_NAMESPACES
+# define EH_USE_STD using namespace EH_STD;
+#else
+# define EH_USE_STD
+#endif
+
+#if defined (EH_USE_NAMESPACES) && !defined(_STLP_VENDOR_GLOBAL_CSTD)
+# define USING_CSTD_NAME(name) using EH_CSTD :: name;
+#else
+# define USING_CSTD_NAME(name)
+#endif
+
+#endif // INCLUDED_MOTU_Prefix
diff --git a/test/eh/SortClass.h b/test/eh/SortClass.h
new file mode 100644
index 0000000..220300e
--- /dev/null
+++ b/test/eh/SortClass.h
@@ -0,0 +1,81 @@
+/***********************************************************************************
+ SortClass.h
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+ SUMMARY: A class designed to test operations that compares objects. All
+ comparisons on SortClass may fail. Also records its own address for
+ the sake of testing the stability of sorting algorithms.
+
+***********************************************************************************/
+#if ! defined (INCLUDED_MOTU_SortClass)
+#define INCLUDED_MOTU_SortClass 1
+
+# include "Prefix.h"
+# include "TestClass.h"
+
+class SortClass : public TestClass
+{
+public:
+ enum { kRange = 100 };
+
+ SortClass( int v ) : TestClass( v ), addr(0) {
+ ResetAddress();
+ }
+
+ SortClass() : TestClass( (int)get_random(kRange) ), addr(0) {
+ ResetAddress();
+ }
+
+ bool operator<( const TestClass& rhs ) const
+ {
+ simulate_possible_failure();
+ return (const TestClass&)*this < ( rhs );
+ }
+
+ bool operator==( const TestClass& rhs ) const
+ {
+ simulate_possible_failure();
+ return (const TestClass&)*this == ( rhs );
+ }
+
+ SortClass* GetAddress() const { return addr; }
+ void ResetAddress() { addr = this; }
+
+private:
+ SortClass* addr;
+};
+
+inline bool operator>( const SortClass& lhs, const SortClass& rhs ) {
+ return rhs < lhs;
+}
+
+inline bool operator<=( const SortClass& lhs, const SortClass& rhs ) {
+ return !(rhs < lhs);
+}
+
+inline bool operator>=( const SortClass& lhs, const SortClass& rhs ) {
+ return !(lhs < rhs);
+}
+
+inline bool operator != ( const SortClass& lhs, const SortClass& rhs ) {
+ return !(lhs == rhs);
+}
+
+#if defined( __MWERKS__ ) && __MWERKS__ <= 0x3000 && !__SGI_STL
+# if defined( __MSL__ ) && __MSL__ < 0x2406
+__MSL_FIX_ITERATORS__(SortClass);
+__MSL_FIX_ITERATORS__(const SortClass);
+# endif
+#endif
+
+#endif // INCLUDED_MOTU_SortClass
diff --git a/test/eh/TestClass.cpp b/test/eh/TestClass.cpp
new file mode 100644
index 0000000..8732c4f
--- /dev/null
+++ b/test/eh/TestClass.cpp
@@ -0,0 +1,24 @@
+/***********************************************************************************
+ TestClass.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "TestClass.h"
+
+#include <iostream>
+
+std::ostream& operator << (std::ostream& s, const TestClass& t) {
+ return s << t.value();
+}
+
+
diff --git a/test/eh/TestClass.h b/test/eh/TestClass.h
new file mode 100644
index 0000000..79f5c09
--- /dev/null
+++ b/test/eh/TestClass.h
@@ -0,0 +1,161 @@
+/***********************************************************************************
+ TestClass.h
+
+ * Copyright (c) 1997-1998
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+ SUMMARY: TestClass simulates a class that uses resources. It is designed to
+ cause exceptions when it is constructed or copied.
+
+***********************************************************************************/
+#ifndef INCLUDED_MOTU_TestClass
+#define INCLUDED_MOTU_TestClass 1
+
+# include "Prefix.h"
+
+# include <functional>
+# include <utility>
+# include <climits>
+
+#include <iosfwd>
+#include "random_number.h"
+#include "nc_alloc.h"
+
+class TestClass
+{
+public:
+ inline TestClass();
+ inline TestClass( int value );
+ inline TestClass( const TestClass& rhs );
+ inline ~TestClass();
+
+ inline TestClass& operator=( const TestClass& rhs );
+ inline int value() const;
+
+ inline TestClass operator!() const;
+
+ bool operator==( const TestClass& rhs ) const
+ {
+ return value() == rhs.value();
+ }
+
+ bool operator<( const TestClass& rhs ) const {
+ return value() < rhs.value();
+ }
+
+protected:
+ static inline unsigned int get_random(unsigned range = UINT_MAX);
+private:
+ inline void Init( int value );
+
+#if TESTCLASS_DEEP_DATA
+ int *p;
+#else
+ int v;
+#endif
+};
+
+#if defined( __MWERKS__ ) && __MWERKS__ <= 0x3000 && !__SGI_STL
+# if defined( __MSL__ ) && __MSL__ < 0x2406
+# include <iterator.h>
+__MSL_FIX_ITERATORS__(TestClass);
+__MSL_FIX_ITERATORS__(const TestClass);
+typedef EH_STD::pair<const TestClass, TestClass> pair_testclass_testclass;
+__MSL_FIX_ITERATORS__( pair_testclass_testclass );
+__MSL_FIX_ITERATORS__( const pair_testclass_testclass );
+# endif
+#endif
+
+inline void TestClass::Init( int value )
+{
+#if TESTCLASS_DEEP_DATA
+ p = new int( value );
+#else
+ simulate_constructor();
+ v = value;
+#endif
+}
+
+inline TestClass::TestClass()
+{
+ Init( int(get_random()) );
+}
+
+inline TestClass::TestClass( int value )
+{
+ Init( value );
+}
+
+inline TestClass::TestClass( const TestClass& rhs )
+{
+ Init( rhs.value() );
+}
+
+inline TestClass::~TestClass()
+{
+#if TESTCLASS_DEEP_DATA
+ delete p;
+#else
+ simulate_destructor();
+#endif
+}
+
+inline TestClass& TestClass::operator=( const TestClass& rhs )
+{
+#if TESTCLASS_DEEP_DATA
+ int *newP = new int( rhs.value() );
+ delete p;
+ p = newP;
+#else
+ simulate_possible_failure();
+ v = rhs.value();
+#endif
+ return *this;
+}
+
+inline int TestClass::value() const
+{
+#if TESTCLASS_DEEP_DATA
+ return *p;
+#else
+ return v;
+#endif
+}
+
+inline TestClass TestClass::operator!() const
+{
+ return TestClass( value()+1 );
+}
+
+inline bool operator>( const TestClass& lhs, const TestClass& rhs ) {
+ return rhs < lhs;
+}
+
+inline bool operator>=( const TestClass& lhs, const TestClass& rhs ) {
+ return !(lhs < rhs);
+}
+
+inline bool operator<=( const TestClass& lhs, const TestClass& rhs ) {
+ return !(rhs < lhs);
+}
+
+inline bool operator != ( const TestClass& lhs, const TestClass& rhs ) {
+ return lhs.value() != rhs.value();
+}
+
+inline unsigned int TestClass::get_random( unsigned range )
+{
+ return random_number( range );
+}
+
+extern std::ostream& operator << ( std::ostream& s, const TestClass&);
+
+#endif // INCLUDED_MOTU_TestClass
diff --git a/test/eh/Tests.h b/test/eh/Tests.h
new file mode 100644
index 0000000..8102fb3
--- /dev/null
+++ b/test/eh/Tests.h
@@ -0,0 +1,59 @@
+/***********************************************************************************
+ Tests.h
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+ SUMMARY: Declarations of all of the tests in the exception test suite.
+
+***********************************************************************************/
+#if ! defined (INCLUDED_MOTU_Tests)
+#define INCLUDED_MOTU_Tests 1
+
+#include "Prefix.h"
+
+void test_algobase();
+void test_algo();
+void test_list();
+void test_map();
+void test_multimap();
+void test_set();
+void test_multiset();
+void test_vector();
+void test_deque();
+void test_bit_vector();
+
+#if defined (EH_HASHED_CONTAINERS_IMPLEMENTED)
+void test_hash_map();
+void test_hash_multimap();
+void test_hash_set();
+void test_hash_multiset();
+#endif
+
+#if defined (EH_ROPE_IMPLEMENTED)
+void test_rope();
+#endif
+
+#if defined( EH_SLIST_IMPLEMENTED )
+void test_slist();
+#endif
+
+#if defined( EH_STRING_IMPLEMENTED )
+void test_string();
+#endif
+#if defined( EH_BITSET_IMPLEMENTED )
+void test_bitset();
+#endif
+#if defined( EH_VALARRAY_IMPLEMENTED )
+void test_valarray();
+#endif
+
+#endif // INCLUDED_MOTU_Tests
diff --git a/test/eh/ThrowCompare.h b/test/eh/ThrowCompare.h
new file mode 100644
index 0000000..34811b5
--- /dev/null
+++ b/test/eh/ThrowCompare.h
@@ -0,0 +1,46 @@
+/***********************************************************************************
+ ThrowCompare.h
+
+ Interface for the ThrowCompare class
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#ifndef ThrowCompare_H_
+#define ThrowCompare_H_
+
+#include "Prefix.h"
+#include "TestClass.h"
+
+struct ThrowCompare {
+ bool operator()( const TestClass& a, const TestClass& b ) const {
+ simulate_possible_failure();
+ return a < b;
+ }
+};
+
+
+struct ThrowEqual {
+ inline bool operator()( const TestClass& a, const TestClass& b ) const {
+ simulate_possible_failure();
+ return a == b;
+ }
+};
+
+struct ThrowHash { // : private ThrowCompare
+ inline EH_CSTD::size_t operator()( const TestClass& a ) const {
+ simulate_possible_failure();
+ return EH_CSTD::size_t(a.value());
+ }
+};
+
+#endif // ThrowCompare_H_
diff --git a/test/eh/bcb.mak b/test/eh/bcb.mak
new file mode 100644
index 0000000..6a13314
--- /dev/null
+++ b/test/eh/bcb.mak
@@ -0,0 +1,78 @@
+# ---------------------------------------------------------------------------
+BCC32=bcc32
+CPP32=cpp32
+
+!if !$d(BCB)
+BCB = $(MAKEDIR)\..
+!endif
+
+# ---------------------------------------------------------------------------
+# IDE SECTION
+# ---------------------------------------------------------------------------
+# The following section of the project makefile is managed by the BCB IDE.
+# It is recommended to use the IDE to change any of the values in this
+# section.
+# ---------------------------------------------------------------------------
+
+# ---------------------------------------------------------------------------
+PROJECT = eh_test.exe
+OBJFILES = TestClass.obj \
+ nc_alloc.obj \
+ random_number.obj \
+ test_algo.obj \
+ test_algobase.obj \
+ test_bit_vector.obj \
+ test_bitset.obj \
+ test_deque.obj \
+ test_hash_map.obj \
+ test_hash_set.obj \
+ test_list.obj \
+ test_map.obj \
+ test_rope.obj \
+ test_set.obj \
+ test_slist.obj \
+ test_string.obj \
+ test_valarray.obj \
+ test_vector.obj main.obj
+
+# ---------------------------------------------------------------------------
+PATHCPP = .;
+PATHPAS = .;
+PATHASM = .;
+PATHRC = .;
+
+# USERDEFINES = _STLP_NO_OWN_IOSTREAMS
+
+USERDEFINES = _DEBUG
+
+SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES
+# SYSDEFINES = NO_STRICT;USEPACKAGES
+ # ---------------------------------------------------------------------------
+CFLAG1 = -w- -jb -j1 -I.;..\..\stlport;$(BCB)\include; -Od -v -N -x -xp -tWC -D$(SYSDEFINES);$(USERDEFINES)
+
+LDFLAGS = -L..\..\lib;$(BCB)\..\lib cw32i.lib stlp.4.5.lib
+
+.autodepend
+# ---------------------------------------------------------------------------
+
+all : $(PROJECT)
+ cd ..\..\lib
+ ..\test\eh\eh_test.exe -s 100
+
+$(PROJECT) : $(OBJFILES)
+ $(BCC32) -e$(PROJECT) $(CFLAG1) $(LDFLAGS) $(OBJFILES)
+
+clean:
+ del *.obj *.exe *.core *.tds
+
+# ---------------------------------------------------------------------------
+.cpp.obj:
+ $(BCC32) $(CFLAG1) -n$(@D) -c $<
+
+.cpp.exe:
+ $(BCC32) $(CFLAG1) $(LDFLAGS) -n$(@D) $<
+
+.cpp.i:
+ $(CPP32) $(CFLAG1) -n. -Sr -Ss -Sd {$< }
+# ---------------------------------------------------------------------------
+
diff --git a/test/eh/bug.cpp b/test/eh/bug.cpp
new file mode 100644
index 0000000..b723d5c
--- /dev/null
+++ b/test/eh/bug.cpp
@@ -0,0 +1,39 @@
+#include <set>
+#include <vector>
+#include <iostream>
+#include <boost/timer.hpp>
+#include <boost/lexical_cast.hpp>
+
+struct compare
+{
+ bool operator()(int* x, int* y)
+ { return *x < *y; }
+
+};
+
+int main(int argc, char const* const argv[])
+{
+ std::size_t niters = argc < 2 ? 1000 : boost::lexical_cast<std::size_t>(argv[1]);
+
+ boost::timer t;
+
+ std::vector<int> v;
+ for (int n = 0; n < niters; ++n)
+ {
+ v.insert(v.begin() + v.size()/2, n);
+ }
+
+ std::cout << "vector fill: " << t.elapsed() << std::endl;
+
+ std::multiset<int*,compare> m;
+ for (int n = 0; n < niters; ++n)
+ {
+ m.insert(&v[n]);
+ }
+ std::cout << "map fill 1: " << t.elapsed() << std::endl;
+ for (int n = 0; n < niters; ++n)
+ {
+ m.insert(&v[n]);
+ }
+ std::cout << "map fill 2: " << t.elapsed() << std::endl;
+}
diff --git a/test/eh/como-linux.mak b/test/eh/como-linux.mak
new file mode 100644
index 0000000..530a62e
--- /dev/null
+++ b/test/eh/como-linux.mak
@@ -0,0 +1,69 @@
+#
+# Note : this makefile has been tested for como-4.3.0.1+gcc-2.96 on Redhat 7.3
+#
+
+.SUFFIXES:
+.SUFFIXES: .cc .cpp .o .exe .out
+
+srcdir = .
+VPATH = .
+
+# point this to proper location
+STL_INCL=../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE)
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+TEST = ./eh_test.out
+
+CC = como
+CXX = $(CC)
+
+CXXFLAGS = -DLIBCIO= --diag_suppress=68 -D__null=0L -D__GNUG__ -D_STLP_DEBUG -I${STL_INCL} -I. ${CXX_EXTRA_FLAGS}
+
+LIBS = -L../../lib -lstlport_como_stldebug -lpthread -lm
+LIBSTDCXX =
+
+check: $(TEST)
+
+$(TEST_EXE) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE)
+
+
+$(TEST) : $(TEST_EXE)
+ $(TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H -o $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* > $@
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.out *.o *.ii *.ti
diff --git a/test/eh/como.mak b/test/eh/como.mak
new file mode 100644
index 0000000..a4ec20c
--- /dev/null
+++ b/test/eh/como.mak
@@ -0,0 +1,67 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+
+# point this to proper location
+STL_INCL=../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE)
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+TEST = ./eh_test.out
+
+CC = e:\lang\como\bin\como
+CXX = $(CC)
+
+# __COMO__ appears not to be defined automatically ;(
+CXXFLAGS = -D__COMO__ -D_MSC_VER=1200 --exceptions --microsoft -D_STLP_DEBUG -I${STL_INCL} -I. ${CXX_EXTRA_FLAGS}
+
+LIBS = -lm
+LIBSTDCXX =
+
+check: $(TEST)
+
+$(TEST_EXE) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE)
+
+
+$(TEST) : $(TEST_EXE)
+ $(TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H -o $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* > $@
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/cray.mak b/test/eh/cray.mak
new file mode 100644
index 0000000..418a4ca
--- /dev/null
+++ b/test/eh/cray.mak
@@ -0,0 +1,56 @@
+
+SHELL=/bin/sh
+
+# srcdir = .
+# VPATH = .
+
+STL_INCL=-I${PWD}/../../stlport/
+
+AUX_LIST=TestClass.o main.o nc_alloc.o random_number.o
+
+TEST_LIST=test_algo.o \
+test_algobase.o test_list.o test_slist.o \
+test_bit_vector.o test_vector.o \
+test_deque_cray.o test_set.o test_map.o \
+test_hash_map.o test_hash_set.o test_rope.o \
+test_string.o test_bitset.o test_valarray.o
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST)
+EXECS = $(LIST:%.o=%)
+TESTS = $(LIST:%.o=%.out)
+TEST_EXE = eh_test
+TEST = eh_test.out
+
+CC = CC
+CXX = $(CC)
+
+#CXXFLAGS = -hexceptions -DEH_DELETE_HAS_THROW_SPEC -I. ${STL_INCL} ${DEBUG_FLAGS}
+CXXFLAGS = -D_STLP_HAS_NO_EXCEPTIONS -I. ${STL_INCL} ${DEBUG_FLAGS}
+
+#LIBS = -L../../lib -lstlportx -lpthread
+LIBS = -L../../lib -lstlport -lpthread
+
+.SUFFIXES: .cpp .i .o .out
+
+check: $(TEST)
+
+$(TEST) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(LIBS) $(OBJECTS) -o $(TEST_EXE)
+ ./$(TEST_EXE) -s 100
+
+.cpp.o:
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+.cpp.i:
+ $(CXX) $(CXXFLAGS) $< -E > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $*.cpp -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $(LIBS) $*.o -o $*
+ ./$* -q
+ -rm -f $*
+
+clean:
+ -rm -fr ${TEST_EXE} *.o *.ii *.out core
diff --git a/test/eh/cygwin.mak b/test/eh/cygwin.mak
new file mode 100644
index 0000000..582c219
--- /dev/null
+++ b/test/eh/cygwin.mak
@@ -0,0 +1,123 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC = c++
+CXX = $(CC)
+
+# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS
+# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails
+# in the assembler with 'invalid relocation type'
+CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW
+D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB
+NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+LIBS = -lm
+D_LIBSTLPORT = -L../../lib -lstlport_cygwin_stldebug
+LIBSTLPORT = -L../../lib -lstlport_cygwin
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+OBJDIR=obj
+D_OBJDIR=d_obj
+NOSGI_OBJDIR=nosgi_obj
+
+$(OBJDIR):
+ mkdir obj
+$(D_OBJDIR):
+ mkdir d_obj
+$(NOSGI_OBJDIR):
+ mkdir nosgi_obj
+
+$(TEST_EXE) : $(OBJDIR) $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+
+$(TEST) : $(TEST_EXE)
+ echo "Cygwin has bugs in exception handling, runnning w/o throwing exceptions..."
+ ./$(TEST_EXE) -e
+
+$(D_TEST) : $(D_TEST_EXE)
+ echo "Cygwin has bugs in exception handling, runnning w/o throwing exceptions..."
+ ./$(D_TEST_EXE) -e
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ echo "Cygwin has bugs in exception handling, runnning w/o throwing exceptions..."
+ ./$(NOSGI_TEST_EXE) -e
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -D_STLP_DEBUG -D_REENTRANT -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(D_LIBSTLPORT) $(LIBS) -o $*
+ ./$* > $@
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/deccxx.mak b/test/eh/deccxx.mak
new file mode 100644
index 0000000..5b986e8
--- /dev/null
+++ b/test/eh/deccxx.mak
@@ -0,0 +1,73 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+SHELL=/bin/sh
+
+# srcdir = .
+# VPATH = .
+
+
+# point this to proper location
+STL_INCL= -I../../stlport
+
+# STL_INCL= -DEH_NO_SGI_STL
+
+AUX_LIST=TestClass.o main.o nc_alloc.o random_number.o
+
+TEST_LIST=test_algo.o \
+test_algobase.o test_list.o test_slist.o \
+test_bit_vector.o test_vector.o \
+test_deque.o test_set.o test_map.o \
+test_hash_map.o test_hash_set.o test_rope.o \
+test_string.o test_bitset.o test_valarray.o
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST)
+EXECS = $(LIST:%.o=%)
+TESTS = $(LIST:%.o=%.out)
+TEST_EXE = eh_test
+TEST = eh_test.out
+
+CC = cxx
+CXX = $(CC)
+
+# -std strict_ansi_errors
+
+CXXFLAGS = ${STL_INCL} -std strict_ansi_errors -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC -gall
+
+# CXXFLAGS = ${STL_INCL} -std strict_ansi_errors -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC
+
+# This is to test with native STL
+# CXXFLAGS = +w2 -xildoff -D_STLP_USE_NEWALLOC -DEH_NO_SGI_STL -DEH_NEW_HEADERS -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC
+
+
+LIBS = -L../../lib -lstlport_dec -lm
+LIBSTDCXX =
+
+.SUFFIXES: .cpp .i .o .out .res
+
+check: $(TEST)
+
+$(TEST) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(TEST_EXE) -s 100
+
+.cpp.o:
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+.cpp.i:
+ $(CXX) $(CXXFLAGS) $< -E > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $*.cpp -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* -q
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $*.cpp -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache cxx_repository
diff --git a/test/eh/descrip.mms b/test/eh/descrip.mms
new file mode 100644
index 0000000..148d48b
--- /dev/null
+++ b/test/eh/descrip.mms
@@ -0,0 +1,54 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated manually for MMS
+
+# point this to proper location
+STL_INCL= /include="../../stlport"
+
+
+# STL_INCL= -DEH_NO_SGI_STL
+
+.SUFFIXES .obj .cpp
+
+all : check
+
+AUX_LIST=TestClass.obj,main.obj,nc_alloc.obj,random_number.obj
+
+TEST_LIST=test_algo.obj,-
+test_algobase.obj,test_list.obj,test_slist.obj,-
+test_bit_vector.obj,test_vector.obj,-
+test_deque.obj,test_set.obj,test_map.obj,-
+test_hash_map.obj,test_hash_set.obj,test_rope.obj,-
+test_string.obj,test_bitset.obj,test_valarray.obj
+
+LIST=$(AUX_LIST),$(TEST_LIST)
+
+OBJECTS = $(LIST)
+EXECS = $(LIST:%.obj=%.exe)
+TESTS = $(LIST:%.obj=%.out)
+TEST_EXE = eh_test.exe
+TEST = eh_test.out
+
+CC = cxx
+CXX = $(CC)
+LINK = cxxlink
+
+# -std strict_ansi_errors
+
+CXXFLAGS = $(STL_INCL) /define=(__NO_USE_STD_IOSTREAM,EH_VECTOR_OPERATOR_NEW,EH_DELETE_HAS_THROW_SPEC)
+
+# This is to test with native STL
+# CXXFLAGS = +w2 -xildoff -D__STL_USE_NEWALLOC -DEH_NO_SGI_STL -DEH_NEW_HEADERS -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC
+
+
+LIBS =
+LIBSTDCXX =
+
+check : $(TEST)
+
+$(TEST) : $(OBJECTS)
+ $(LINK)/exe=$(TEST_EXE) $(OBJECTS) $(LIBS)
+ run $(TEST_EXE)
+
+.cpp.obj :
+ $(CXX) $(CXXFLAGS) /obj=$@ $<
+
diff --git a/test/eh/djgpp.mak b/test/eh/djgpp.mak
new file mode 100644
index 0000000..dcf638a
--- /dev/null
+++ b/test/eh/djgpp.mak
@@ -0,0 +1,121 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC = gcc
+CXX = $(CC)
+
+# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS
+# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails
+# in the assembler with 'invalid relocation type'
+CXXFLAGS = -Wall -ftemplate-depth-32 -mbnu210 -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_NO_SGI_IOSTREAMS
+D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB
+NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_SGI_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+LIBS = -lstdcxx -lm
+D_LIBSTLPORT = ../../lib/libstlport_djgpp_debug_static.a
+LIBSTLPORT = ../../lib/libstlport_djgpp_stldebug_static.a
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+
+OBJDIR=obj
+D_OBJDIR=d_obj
+NOSGI_OBJDIR=nosgi_obj
+
+$(OBJDIR):
+ mkdir obj
+$(D_OBJDIR):
+ mkdir d_obj
+$(NOSGI_OBJDIR):
+ mkdir nosgi_obj
+
+$(TEST_EXE) : $(OBJDIR) $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+
+$(TEST) : $(TEST_EXE)
+ $(TEST_EXE)
+
+$(D_TEST) : $(D_TEST_EXE)
+ $(D_TEST_EXE)
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* > $@
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/egcs.mak b/test/eh/egcs.mak
new file mode 100644
index 0000000..d622835
--- /dev/null
+++ b/test/eh/egcs.mak
@@ -0,0 +1,75 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+
+# point this to proper location
+STL_INCL=../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE)
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+TEST = ./eh_test.out
+
+CC = egcs-c++
+CXX = $(CC)
+
+# for egcs
+REPO_FLAGS =
+
+# CXXFLAGS = -g -Wall -I${STL_INCL} -I. -D_STLP_USE_NEWALLOC -D_STLP_DEBUG_ALLOC ${REPO_FLAGS} -DEH_NEW_HEADERS
+
+# CXXFLAGS = -Wall -ansi -I${STL_INCL} -I. -D_STLP_DEBUG ${REPO_FLAGS} ${CXX_EXTRA_FLAGS}
+CXXFLAGS = -Wall -g -D_STLP_USE_NEWALLOC -DNO_FAST_ALLOCATOR -ansi -I${STL_INCL} -I. ${REPO_FLAGS} ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_NO_DEBUG_EXCEPTIONS
+
+# CXXFLAGS = -Wall -I${STL_INCL} -I. -D_STLP_USE_NEWALLOC ${REPO_FLAGS} ${CXX_EXTRA_FLAGS}
+
+
+LIBS = -lm
+LIBSTDCXX =
+
+check: $(TEST)
+
+$(TEST_EXE) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE)
+
+
+$(TEST) : $(TEST_EXE)
+ $(TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H -o $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* > $@
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} $(OBJDIR) $(D_OBJDIR) $(NOSGI_OBJDIR) *.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/export b/test/eh/export
new file mode 100644
index 0000000..ab0ab1a
--- /dev/null
+++ b/test/eh/export
@@ -0,0 +1,37 @@
+LeakCheck.h
+Prefix.h
+SortClass.h
+TestClass.cpp
+TestClass.h
+Tests.h
+ThrowCompare.h
+export
+gcc.mak
+main.cpp
+nc_alloc.cpp
+nc_alloc.h
+random_number.cpp
+random_number.h
+sunpro.mak
+test_algo.cpp
+test_algobase.cpp
+test_assign_op.h
+test_bit_vector.cpp
+test_bitset.cpp
+test_construct.h
+test_deque.cpp
+test_hash_map.cpp
+test_hash_resize.h
+test_hash_set.cpp
+test_insert.h
+test_list.cpp
+test_map.cpp
+test_push_back.h
+test_push_front.h
+test_rope.cpp
+test_set.cpp
+test_slist.cpp
+test_string.cpp
+test_valarray.cpp
+test_vector.cpp
+vc.mak
diff --git a/test/eh/gcc-99r1.mak b/test/eh/gcc-99r1.mak
new file mode 100644
index 0000000..482763f
--- /dev/null
+++ b/test/eh/gcc-99r1.mak
@@ -0,0 +1,109 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC =c++
+CXX = $(CC)
+
+# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS
+# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails
+# in the assembler with 'invalid relocation type'
+CXXFLAGS = -Wall -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -g -D_STLP_HAS_NO_NAMESPACES
+D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG
+NOSGI_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+LIBS = -lm
+D_LIBSTLPORT = -L../../lib -lstlport_gcc_stldebug
+LIBSTLPORT = -L../../lib -lstlport_gcc
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+
+$(TEST_EXE) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+
+$(TEST) : $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" time ./$(TEST_EXE) -s 100
+
+$(D_TEST) : $(D_TEST_EXE)
+ $(D_TEST_EXE)
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -O2 -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBSTLPORT) $(LIBS) -o $*
+ ./$* > $@
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} $(D_TEST_EXE) *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/gcc-amigaos-m68k.mak b/test/eh/gcc-amigaos-m68k.mak
new file mode 100644
index 0000000..fc1e2ab
--- /dev/null
+++ b/test/eh/gcc-amigaos-m68k.mak
@@ -0,0 +1,119 @@
+#
+# This requires GNU make.
+#
+
+srcdir = .
+VPATH = .
+SHELL = /bin/sh
+
+# point this to proper location
+STL_INCL = -I../../stlport
+
+AUX_LIST = TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST = test_algo.cpp \
+ test_algobase.cpp test_list.cpp test_slist.cpp \
+ test_bit_vector.cpp test_vector.cpp \
+ test_deque.cpp test_set.cpp test_map.cpp \
+ test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+ test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST = ${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC = gcc
+CXX = g++
+
+CXXFLAGS = -s -noixemul -m68020 -Wall -O2 ${STL_INCL} -I. -DEH_VECTOR_OPERATOR_NEW
+D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB
+NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+LIBS = -lm
+D_LIBSTLPORT = -L../../lib -lstlport_gcc_stldebug
+LIBSTLPORT = -L../../lib -lstlport_gcc
+
+all: $(TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+
+OBJDIR=obj
+D_OBJDIR=d_obj
+NOSGI_OBJDIR=nosgi_obj
+
+$(OBJDIR):
+ mkdir obj
+$(D_OBJDIR):
+ mkdir d_obj
+$(NOSGI_OBJDIR):
+ mkdir nosgi_obj
+
+$(TEST_EXE) : $(OBJDIR) $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+$(TEST) : $(TEST_EXE)
+ $(TEST_EXE) -s 100
+
+$(D_TEST) : $(D_TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100
+
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* > $@
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/gcc-apple-macosx.mak b/test/eh/gcc-apple-macosx.mak
new file mode 100644
index 0000000..5b40abd
--- /dev/null
+++ b/test/eh/gcc-apple-macosx.mak
@@ -0,0 +1,122 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+SHELL=/bin/sh
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC = g++
+CXX = $(CC)
+
+# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS
+# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails
+# in the assembler with 'invalid relocation type'
+CXXFLAGS = -Wall -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW
+D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB
+NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+LIBS = -lm
+D_LIBSTLPORT = -L../../lib -lstlport_gcc_debug
+LIBSTLPORT = -L../../lib -lstlport_gcc
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+
+OBJDIR=obj
+D_OBJDIR=d_obj
+NOSGI_OBJDIR=nosgi_obj
+
+$(OBJDIR):
+ mkdir obj
+$(D_OBJDIR):
+ mkdir d_obj
+$(NOSGI_OBJDIR):
+ mkdir nosgi_obj
+
+$(TEST_EXE) : $(OBJDIR) $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+$(TEST) : $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" time ./$(TEST_EXE) -s 100
+
+$(D_TEST) : $(D_TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100
+
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBSTLPORT) $(LIBS) -o $*
+ ./$* > $@
+# -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/gcc-freebsd.mak b/test/eh/gcc-freebsd.mak
new file mode 100644
index 0000000..095add2
--- /dev/null
+++ b/test/eh/gcc-freebsd.mak
@@ -0,0 +1,123 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+SHELL=/bin/sh
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC = c++ -pthread
+CXX = $(CC)
+
+# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS
+# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails
+# in the assembler with 'invalid relocation type'
+CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW
+
+D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB
+NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+LIBS = -lm
+D_LIBSTLPORT = -L../../lib -lstlport_gcc_stldebug
+LIBSTLPORT = -L../../lib -lstlport_gcc
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+OBJDIR=obj
+D_OBJDIR=d_obj
+NOSGI_OBJDIR=nosgi_obj
+
+$(OBJDIR):
+ mkdir obj
+$(D_OBJDIR):
+ mkdir d_obj
+$(NOSGI_OBJDIR):
+ mkdir nosgi_obj
+
+
+$(TEST_EXE) : $(OBJDIR) $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+
+$(TEST) : $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(TEST_EXE) -s 100
+
+$(D_TEST) : $(D_TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* > $@
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/gcc-hp11.mak b/test/eh/gcc-hp11.mak
new file mode 100644
index 0000000..8c6b0a9
--- /dev/null
+++ b/test/eh/gcc-hp11.mak
@@ -0,0 +1,123 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+SHELL=/bin/sh
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+# CC = g++ -pthreads
+CC = g++ -D_REENTRANT -D_POSIX_C_SOURCE=199506L -D__EXTENSIONS__
+CXX = $(CC)
+
+# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS
+# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails
+# in the assembler with 'invalid relocation type'
+CXXFLAGS = -Wall -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW
+D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB
+NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+LIBS = -lpthread -lm
+D_LIBSTLPORT = -L../../lib -lstlport_gcc_debug
+LIBSTLPORT = -L../../lib -lstlport_gcc
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+OBJDIR=obj
+D_OBJDIR=d_obj
+NOSGI_OBJDIR=nosgi_obj
+
+$(OBJDIR):
+ mkdir obj
+$(D_OBJDIR):
+ mkdir d_obj
+$(NOSGI_OBJDIR):
+ mkdir nosgi_obj
+
+$(TEST_EXE) : $(OBJDIR) $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+
+$(TEST) : $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" time ./$(TEST_EXE) -s 100
+
+$(D_TEST) : $(D_TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100
+
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -D_STLP_DEBUG -D_STLP_NO_OWN_IOSTREAMS -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBSTLPORT) $(LIBS) -o $*
+ ./$* > $@
+# -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/gcc-irix.mak b/test/eh/gcc-irix.mak
new file mode 100644
index 0000000..d9688ea
--- /dev/null
+++ b/test/eh/gcc-irix.mak
@@ -0,0 +1,122 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+SHELL=/bin/sh
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC = g++
+CXX = $(CC)
+
+# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS
+# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails
+# in the assembler with 'invalid relocation type'
+CXXFLAGS = -Wall -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW
+D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB
+NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+LIBS = -lm
+D_LIBSTLPORT = -L../../lib -lstlport_gcc_debug
+LIBSTLPORT = -L../../lib -lstlport_gcc
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+
+OBJDIR=obj
+D_OBJDIR=d_obj
+NOSGI_OBJDIR=nosgi_obj
+
+$(OBJDIR):
+ mkdir obj
+$(D_OBJDIR):
+ mkdir obj
+$(NOSGI_OBJDIR):
+ mkdir obj
+
+$(TEST_EXE) : $(OBJDIR) $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+$(TEST) : $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" time ./$(TEST_EXE) -s 100
+
+$(D_TEST) : $(D_TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100
+
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -D_STLP_DEBUG -D_STLP_NO_OWN_IOSTREAMS -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBSTLPORT) $(LIBS) -o $*
+ ./$* > $@
+# -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/gcc-linux.mak b/test/eh/gcc-linux.mak
new file mode 100644
index 0000000..3866d37
--- /dev/null
+++ b/test/eh/gcc-linux.mak
@@ -0,0 +1,120 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+SHELL=/bin/sh
+
+srcdir = .
+VPATH = .
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC = c++ -pthread
+CXX = $(CC)
+
+# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS
+# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails
+# in the assembler with 'invalid relocation type'
+CXXFLAGS = -Wall ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW
+D_CXXFLAGS = -Wall -g ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB
+NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+LIBS = -lm
+D_LIBSTLPORT = -L../../lib -lstlport_gcc_stldebug
+LIBSTLPORT = -L../../lib -lstlport_gcc
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+OBJDIR=obj
+D_OBJDIR=d_obj
+NOSGI_OBJDIR=nosgi_obj
+
+$(OBJDIR):
+ mkdir obj
+$(D_OBJDIR):
+ mkdir d_obj
+$(NOSGI_OBJDIR):
+ mkdir nosgi_obj
+
+$(TEST_EXE) : $(OBJDIR) $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+$(TEST) : $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(TEST_EXE) -s 100
+
+$(D_TEST) : $(D_TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -USINGLE -DMAIN -o $*.o
+ $(CXX) $(D_CXXFLAGS) $*.o $(LIBS) $(D_LIBSTLPORT) -o $*
+ ./$* > $@
+# -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/gcc-netbsd.mak b/test/eh/gcc-netbsd.mak
new file mode 100644
index 0000000..4f9504e
--- /dev/null
+++ b/test/eh/gcc-netbsd.mak
@@ -0,0 +1,122 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+SHELL=/bin/sh
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC = c++
+CXX = $(CC)
+
+# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS
+# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails
+# in the assembler with 'invalid relocation type'
+CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW
+D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB
+NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+LIBS = -lm -lpthread
+D_LIBSTLPORT = -L../../lib -R../../lib -lstlport_gcc_stldebug
+LIBSTLPORT = -L../../lib -R../../lib -lstlport_gcc
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+OBJDIR=obj
+D_OBJDIR=d_obj
+NOSGI_OBJDIR=nosgi_obj
+
+$(OBJDIR):
+ mkdir obj
+$(D_OBJDIR):
+ mkdir d_obj
+$(NOSGI_OBJDIR):
+ mkdir nosgi_obj
+
+$(TEST_EXE) : $(OBJDIR) $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+
+$(TEST) : $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(TEST_EXE) -s 100
+
+$(D_TEST) : $(D_TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100
+
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* > $@
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/gcc.mak b/test/eh/gcc.mak
new file mode 100644
index 0000000..7e0c50a
--- /dev/null
+++ b/test/eh/gcc.mak
@@ -0,0 +1,122 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+SHELL=/bin/sh
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC = g++ -pthread
+CXX = $(CC)
+
+# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS
+# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails
+# in the assembler with 'invalid relocation type'
+CXXFLAGS = -Wall -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW
+D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB
+NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+LIBS = -lm
+D_LIBSTLPORT = -L../../lib -lstlport_gcc_debug
+LIBSTLPORT = -L../../lib -lstlport_gcc
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+
+OBJDIR=obj
+D_OBJDIR=d_obj
+NOSGI_OBJDIR=nosgi_obj
+
+$(OBJDIR):
+ mkdir obj
+$(D_OBJDIR):
+ mkdir d_obj
+$(NOSGI_OBJDIR):
+ mkdir nosgi_obj
+
+$(TEST_EXE) : $(OBJDIR) $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJDIR) $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJDIR) $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+$(TEST) : $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" time ./$(TEST_EXE) -s 100
+
+$(D_TEST) : $(D_TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(D_TEST_EXE) -s 100
+
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBSTLPORT) $(LIBS) -o $*
+ ./$* > $@
+# -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/gcc7.mak b/test/eh/gcc7.mak
new file mode 100644
index 0000000..33160c4
--- /dev/null
+++ b/test/eh/gcc7.mak
@@ -0,0 +1,93 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC = c++
+CXX = $(CC)
+
+CXXFLAGS = -Wall -fhandle-exceptions -g ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED
+
+check: $(TEST)
+
+LIBS = -lm
+D_LIBSTLPORT = -L../../lib -lstlport_gcc_debug
+LIBSTLPORT = -L../../lib -lstlport_gcc
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+
+$(TEST_EXE) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE)
+
+
+$(TEST) : $(TEST_EXE)
+ $(TEST_EXE)
+
+$(D_TEST) : $(D_TEST_EXE)
+ $(D_TEST_EXE)
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* > $@
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/hp.mak b/test/eh/hp.mak
new file mode 100644
index 0000000..8ae7e6b
--- /dev/null
+++ b/test/eh/hp.mak
@@ -0,0 +1,81 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+# SHELL=/bin/sh
+# srcdir = .
+# VPATH = .
+
+
+# point this to proper location
+STL_INCL= -I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+OBJECTS = test_algo.o \
+test_algobase.o test_list.o test_slist.o \
+test_bit_vector.o test_vector.o \
+test_deque.o test_set.o test_map.o \
+test_hash_map.o test_hash_set.o test_rope.o \
+test_string.o test_bitset.o test_valarray.o
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+# OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE)
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = eh_test
+TEST = eh_test.out
+
+CC = CC
+CXX = $(CC)
+
+CXXFLAGS = -w ${STL_INCL} -D_STLP_NO_CUSTOM_IO
+
+LIBS = -lm
+
+LIBSTLPORT = -L../../lib -lstlport_hp
+
+check: $(TEST)
+
+all: $(TEST_EXE)
+ echo done.
+
+$(TEST_EXE) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) ${LIBSTLPORT} $(LIBS) -o $(TEST_EXE)
+
+$(TEST) : $(TEST_EXE)
+ $(TEST_EXE)
+
+SUFFIXES: .cpp .o .i .s .out .res .y
+
+.cpp.o :
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+.cpp.i :
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+.cpp.out:
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* -q
+ -rm -f $*
+
+.cpp.s:
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache
+
+
+
+
+
+
diff --git a/test/eh/hpacc.mak b/test/eh/hpacc.mak
new file mode 100644
index 0000000..fea2904
--- /dev/null
+++ b/test/eh/hpacc.mak
@@ -0,0 +1,119 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC = aCC
+CXX = $(CC)
+
+CXX_EXTRA_FLAGS = -AA -DEH_DELETE_HAS_THROW_SPEC
+# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS
+# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails
+# in the assembler with 'invalid relocation type'
+CXXFLAGS = -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW
+D_CXXFLAGS = -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB
+NOSGI_CXXFLAGS = -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+HP_VERSION=$(shell uname -r)
+ifeq (${HP_VERSION},B.10.20)
+PTHREAD_LIB=-lcma
+else
+PTHREAD_LIB=-lpthread +nostl
+endif
+
+LIBS = $(PTHREAD_LIB) -lm
+
+D_LIBSTLPORT = -L../../lib -lstlport_aCC_debug
+LIBSTLPORT = -L../../lib -lstlport_aCC
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+
+$(TEST_EXE) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+
+$(TEST) : $(TEST_EXE)
+ $(TEST_EXE)
+
+$(D_TEST) : $(D_TEST_EXE)
+ $(D_TEST_EXE)
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* > $@
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/intel.mak b/test/eh/intel.mak
new file mode 100644
index 0000000..edc50ec
--- /dev/null
+++ b/test/eh/intel.mak
@@ -0,0 +1,69 @@
+# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+################################################################################
+# Begin Project
+RSC=rc.exe
+CPP=icl.exe
+F90=fl32.exe
+
+OUTDIR=.
+INTDIR=.
+
+# set this directories
+STL_INCL=../../stlport
+VC_INCL=.
+# d:/vc41/msdev/include
+
+Dep_stl = TestClass.obj main.obj nc_alloc.obj \
+random_number.obj test_algo.obj test_algobase.obj test_bit_vector.obj test_deque.obj \
+test_hash_map.obj test_hash_set.obj test_list.obj test_map.obj test_rope.obj test_set.obj \
+test_slist.obj test_vector.obj test_string.obj test_bitset.obj test_valarray.obj
+
+LINK32=link.exe
+
+CPP_PROJ=/nologo /W3 /GX /D "WIN32" /MTd /Zi /Gm /Od /D "_CONSOLE" /I$(STL_INCL) /I. /D_DEBUG
+
+CPP_LIBS = /link /libpath:"..\..\lib"
+
+check: eh_test.out
+
+eh_test.out : $(Dep_stl)
+ $(CPP) $(CPP_PROJ) $(Dep_stl) -o eh_test.exe $(CPP_LIBS)
+ .\eh_test.exe
+ echo done
+
+clean :
+ -@erase "$(INTDIR)\*.obj"
+ -@erase "$(OUTDIR)\*.exe"
+ -@erase "$(OUTDIR)\*.obj"
+
+
+.exe.out:
+ $< > $@
+
+.cpp.exe:
+ $(CPP) $(CPP_PROJ) -DMAIN $< $(CPP_LIBS)
+
+.c.obj:
+ $(CPP) $(CPP_PROJ) /c $<
+
+.cpp.obj:
+ $(CPP) $(CPP_PROJ) /c $<
+
+.cxx.obj:
+ $(CPP) $(CPP_PROJ) /c $<
+
+.cpp.E:
+ $(CPP) $(CPP_PROJ) -E $< >$*.E
+
+.cpp.sbr:
+ $(CPP) $(CPP_PROJ) $<
diff --git a/test/eh/intel45.mak b/test/eh/intel45.mak
new file mode 100644
index 0000000..f605eef
--- /dev/null
+++ b/test/eh/intel45.mak
@@ -0,0 +1,109 @@
+# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+################################################################################
+# Begin Project
+RSC=rc.exe
+CPP=icl.exe
+LINK32=xilink.exe
+
+OUTDIR=.
+INTDIR=.
+
+# set this directories
+STL_PATH=..\..
+
+Dep_stl = TestClass.obj main.obj nc_alloc.obj \
+random_number.obj test_algo.obj test_algobase.obj test_bit_vector.obj test_deque.obj \
+test_hash_map.obj test_hash_set.obj test_list.obj test_map.obj test_rope.obj test_set.obj \
+test_slist.obj test_vector.obj test_string.obj test_bitset.obj test_valarray.obj
+
+CPP_LIBS = /link /incremental:no /LIBPATH:$(STL_PATH)\lib
+
+#disable warnings complaining about debug ...info exceeded....
+CPP_PRJ_EXTRA = /Qwd985
+CPP_PRJ_CMN = /nologo /W3 /GR /GX /DWIN32 /D_WINDOWS /D_CONSOLE /I$(STL_PATH)\stlport /I.
+
+#
+LIBTYPE = STATIC
+# LIBTYPE = DYNAMIC
+#
+#DEBUG = STL
+DEBUG = ON
+#DEBUG =
+#
+IOS = SGI
+#IOS = NOSGI
+#IOS = NONE
+
+!IF "$(IOS)" == "NOSGI"
+CPP_PRJ_IOS = /D_STLP_NO_OWN_IOSTREAMS
+!ELSEIF "$(IOS)" == "NONE"
+CPP_PRJ_IOS = /D_STLP_NO_IOSTREAM
+!ELSE
+CPP_PRJ_IOS =
+!ENDIF
+
+#MT/MD etc should be LAST in CPP_PRJ_LIBTYP string!!!
+#Library selection should be BEFORE debug processing!!!
+!IF "$(LIBTYPE)" == "STATIC"
+CPP_PRJ_LIBTYP = /MT
+!ELSE
+CPP_PRJ_LIBTYP = /MD
+!ENDIF
+
+!IF "$(DEBUG)" == ""
+CPP_PRJ_DBG = /DNDEBUG /O2 /Qsox-
+!ELSE
+CPP_PRJ_LIBTYP = $(CPP_PRJ_LIBTYP)d
+CPP_PRJ_DBG = /D_DEBUG /Od
+!IF "$(DEBUG)" == "STL"
+CPP_PRJ_DBG = $(CPP_PRJ_DBG) /D_STLP_DEBUG
+!ENDIF
+CPP_PRJ_CMN = $(CPP_PRJ_CMN) /Zi /Gm
+!ENDIF
+
+CPP_PROJ = $(CPP_PRJ_CMN) $(CPP_PRJ_EXTRA) $(CPP_PRJ_IOS) $(CPP_PRJ_LIBTYP) $(CPP_PRJ_DBG)
+
+check: eh_test.out
+
+eh_test.out : $(Dep_stl)
+ $(CPP) $(CPP_PROJ) $(Dep_stl) /Feeh_test.exe $(CPP_LIBS)
+ cd ..\..\lib
+ ..\test\eh\eh_test.exe -s 100
+ echo done
+
+clean :
+ -@erase "$(INTDIR)\*.obj"
+ -@erase "$(OUTDIR)\*.exe"
+ -@erase "$(OUTDIR)\*.obj"
+
+
+.exe.out:
+ $< > $@
+
+.cpp.exe:
+ $(CPP) $(CPP_PROJ) -DMAIN $<
+
+.c.obj:
+ $(CPP) $(CPP_PROJ) /c $<
+
+.cpp.obj:
+ $(CPP) $(CPP_PROJ) /c $<
+
+.cxx.obj:
+ $(CPP) $(CPP_PROJ) /c $<
+
+.cpp.E:
+ $(CPP) $(CPP_PROJ) -E $< >$*.E
+
+.cpp.sbr:
+ $(CPP) $(CPP_PROJ) $<
diff --git a/test/eh/intel50.mak b/test/eh/intel50.mak
new file mode 100644
index 0000000..ea1d1d0
--- /dev/null
+++ b/test/eh/intel50.mak
@@ -0,0 +1,115 @@
+# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+################################################################################
+# Begin Project
+RSC=rc.exe
+CPP=icl.exe
+LINK32=xilink.exe
+
+OUTDIR=.
+INTDIR=.
+
+# set this directories
+STL_PATH=..\..
+
+Dep_stl = TestClass.obj main.obj nc_alloc.obj \
+random_number.obj test_algo.obj test_algobase.obj test_bit_vector.obj test_deque.obj \
+test_hash_map.obj test_hash_set.obj test_list.obj test_map.obj test_rope.obj test_set.obj \
+test_slist.obj test_vector.obj test_string.obj test_bitset.obj test_valarray.obj
+
+# linker finds proper STLport lib automatically, only path to the library is needed
+CPP_PRJ_LINK = /link /incremental:no /LIBPATH:$(STL_PATH)\lib
+
+#disable warnings complaining about debug ...info exceeded....
+CPP_PRJ_EXTRA = /Qwd985
+CPP_PRJ_CMN = /nologo /W3 /GR /GX /DWIN32 /D_WINDOWS /D_CONSOLE /I$(STL_PATH)\stlport /I.
+
+#
+LIBTYPE = STATIC
+# LIBTYPE = DYNAMIC
+#
+#DEBUG = STL
+DEBUG = ON
+#DEBUG =
+#
+IOS = SGI
+#IOS = NOSGI
+#IOS = NONE
+
+!IF "$(IOS)" == "NOSGI"
+CPP_PRJ_IOS = /D_STLP_NO_SGI_IOSTREAMS
+!ELSEIF "$(IOS)" == "NONE"
+CPP_PRJ_IOS = /D_STLP_NO_IOSTREAM
+!ELSE
+CPP_PRJ_IOS =
+!ENDIF
+
+#MT/MD etc should be LAST in CPP_PRJ_LIBTYP string!!!
+#Library selection should be BEFORE debug processing!!!
+!IF "$(LIBTYPE)" == "STATIC"
+CPP_PRJ_LIBTYP = /D_STLP_USE_STATIC_LIB /MT
+!ELSE
+CPP_PRJ_LIBTYP = /D_STLP_USE_DYNAMIC_LIB /MD
+!ENDIF
+
+!IF "$(DEBUG)" == ""
+CPP_PRJ_DBG = /DNDEBUG /O2 /Qsox-
+!ELSE
+CPP_PRJ_LIBTYP = $(CPP_PRJ_LIBTYP)d
+CPP_PRJ_DBG = /D_DEBUG /Od
+!IF "$(DEBUG)" == "STL"
+CPP_PRJ_DBG = $(CPP_PRJ_DBG) /D_STLP_DEBUG
+!ENDIF
+CPP_PRJ_CMN = $(CPP_PRJ_CMN) /Zi /Gm
+!ENDIF
+
+CPP_IGNORE_LIB = LIBCMT
+#CPP_PRJ_LINK = $(CPP_PRJ_LINK) /NODEFAULTLIB:$(CPP_IGNORE_LIB)
+CPP_PRJ_LINK = $(CPP_PRJ_LINK) /VERBOSE:LIB
+
+CPP_PROJ = $(CPP_PRJ_CMN) $(CPP_PRJ_EXTRA) $(CPP_PRJ_IOS) $(CPP_PRJ_LIBTYP) $(CPP_PRJ_DBG)
+
+check: eh_test.out
+
+eh_test.out : $(Dep_stl)
+ $(CPP) $(CPP_PROJ) $(Dep_stl) /Feeh_test.exe $(CPP_PRJ_LINK)
+# fbp : this is to locate DLL
+ cd ..\..\lib
+ ..\test\eh\eh_test.exe -s 100
+ echo done
+
+clean :
+ -@erase "$(INTDIR)\*.obj"
+ -@erase "$(OUTDIR)\*.exe"
+ -@erase "$(OUTDIR)\*.obj"
+
+
+.exe.out:
+ $< > $@
+
+.cpp.exe:
+ $(CPP) $(CPP_PROJ) -DMAIN $< $(CPP_PRJ_LINK)
+
+.c.obj:
+ $(CPP) $(CPP_PROJ) /c $<
+
+.cpp.obj:
+ $(CPP) $(CPP_PROJ) /c $<
+
+.cxx.obj:
+ $(CPP) $(CPP_PROJ) /c $<
+
+.cpp.E:
+ $(CPP) $(CPP_PROJ) -E $< >$*.E
+
+.cpp.sbr:
+ $(CPP) $(CPP_PROJ) $<
diff --git a/test/eh/kai.mak b/test/eh/kai.mak
new file mode 100644
index 0000000..8ce85b9
--- /dev/null
+++ b/test/eh/kai.mak
@@ -0,0 +1,65 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+
+# point this to proper location
+STL_INCL= -I../../stlport
+# STL_INCL= -DEH_NO_SGI_STL
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+# TEST_LIST=test_deque.cpp
+
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE)
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = eh_test
+TEST = eh_test.out
+
+CC = KCC
+CXX = $(CC)
+
+CXXFLAGS = -w -mt --one_per ${STL_INCL} -D_STLP_USE_NEWALLOC -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC
+
+# This is to test with native STL
+# CXXFLAGS = -w -mt --one_per -D_STLP_USE_NEWALLOC -DEH_NO_SGI_STL -DEH_NEW_HEADERS -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC
+
+# This is to test with STLport iostreams
+LIBS = -L../../lib -lstlport_kcc -lm
+
+LIBSTDCXX =
+
+check: $(TEST)
+
+$(TEST) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE)
+ $(TEST_EXE)
+
+SUFFIXES: .cpp.o.out.res
+
+%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* -q
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache ti_files
diff --git a/test/eh/locale.cpp b/test/eh/locale.cpp
new file mode 100644
index 0000000..1f5a1c5
--- /dev/null
+++ b/test/eh/locale.cpp
@@ -0,0 +1,60 @@
+#include <exception>
+#include <iostream>
+#include <locale>
+#include <ctime>
+
+using namespace std;
+
+void main()
+{
+ try
+ {
+ locale c_loc;
+ //locale sys(c_loc, "LC_TIME=UKR_UKR.OCP;LC_NUMERIC=RUS_RUS.OCP;LC_CTYPE=ukr_ukr.ocp;", locale::numeric | locale::time | locale::ctype);
+ locale sys(".ocp");
+ locale::global(sys);
+ cin.imbue(sys);
+ cout.imbue(sys);
+
+ cout<<"Locale name is: "<<sys.name().c_str()<<'\n';
+
+ cout<<"Enter real number:";
+ double value;
+ cin>>value;
+ cout<<value<<'\n';
+
+ // Time test.
+ long lcur_time;
+ time(&lcur_time);
+ struct tm* cur_time=localtime(&lcur_time);
+
+ const numpunct<char>& num_punct=use_facet<numpunct<char> >(cout.getloc());
+ cout << num_punct.decimal_point() << '\n';
+ const time_put<char, ostreambuf_iterator<char, char_traits<char> > >& time_fac=
+ use_facet<time_put<char, ostreambuf_iterator<char, char_traits<char> > > >(cout.getloc());
+ time_fac.put(cout, cout, NULL, cur_time, 'x'); cout<<'\n';
+ time_fac.put(cout, cout, NULL, cur_time, 'x', '#'); cout<<'\n';
+ time_fac.put(cout, cout, NULL, cur_time, 'X'); cout<<'\n';
+ time_fac.put(cout, cout, NULL, cur_time, 'c'); cout<<'\n';
+ time_fac.put(cout, cout, NULL, cur_time, 'c', '#'); cout<<'\n';
+ time_fac.put(cout, cout, NULL, cur_time, 'I'); cout<<'\n';
+
+ const ctype<char>& char_type=use_facet<ctype<char> >(cout.getloc());
+ if(char_type.is(ctype_base::upper, '')) puts("Upper");
+ if(char_type.is(ctype_base::lower, '¯')) puts("Lower");
+ puts("Next");
+ if(isupper('', cout.getloc())) puts("Upper");
+ if(islower('¯', cout.getloc())) puts("Lower");
+ /*for(int ch=128; ch<256; ch++)
+ printf("Character %c (%d) - upper %c, lower %c\n",(char)ch, ch,toupper((char)ch, cout.getloc()), tolower((char)ch, cout.getloc()));*/
+ }
+ catch(exception &e)
+ {
+ cout<<"Exception fired:\n"<<e.what()<<'\n';
+ }
+ catch(...)
+ {
+ cout<<"Unknown exception throwed!\n";
+ }
+ cout.flush();
+}
diff --git a/test/eh/main.cpp b/test/eh/main.cpp
new file mode 100644
index 0000000..eed07d4
--- /dev/null
+++ b/test/eh/main.cpp
@@ -0,0 +1,407 @@
+/***********************************************************************************
+ Main.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * 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. Moscow Center for SPARC Technology makes
+no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Prefix.h"
+#include "Tests.h"
+
+#if defined (EH_NEW_IOSTREAMS)
+# include <iostream>
+# else
+# include <iostream.h>
+#endif
+
+#if defined(macintosh)&&(!defined(__MRC__) && !defined(__SC__)) || defined (_MAC) && defined(__MWERKS__)
+
+# include <console.h>
+# include <Types.h>
+# include <Strings.h>
+
+# ifdef EH_NEW_HEADERS
+# include <cstdio>
+# include <cstring>
+# include <cassert>
+# else
+# include <stdio.h>
+# include <string.h>
+# include <assert.h>
+# endif
+
+# if defined (_STL_DEBUG)
+
+# if defined ( EH_USE_SGI_STL )
+// Override assertion behavior
+# include <cstdarg>
+//# include <stldebug.h>
+void STLPORT::__stl_debug_message(const char * format_str, ...)
+{
+ std::va_list args;
+ va_start( args, format_str );
+ char msg[256];
+ std::vsnprintf(msg, sizeof(msg)/sizeof(*msg) - 1, format_str, args );
+ DebugStr( c2pstr(msg) );
+}
+# else
+/*===================================================================================
+ __assertion_failed (override standard library function)
+
+ EFFECTS: Breaks into the debugger and shows the assertion. This implementation
+ is Mac-specific; others could be added for other platforms.
+====================================================================================*/
+extern "C"
+{
+ void __assertion_failed(char *condition, char *testfilename, int lineno);
+ void __assertion_failed(char *condition, char *testfilename, int lineno)
+ {
+ char msg[256];
+ std::strncpy( msg, condition, 255 );
+ std::strncat( msg, ": ", 255 );
+ std::strncat( msg, testfilename, 255 );
+ std::strncat( msg, ", ", 255 );
+ char line[20];
+ std::sprintf( line, "%d", lineno );
+ std::strncat( msg, line, 255 );
+ DebugStr( c2pstr( msg ) );
+ }
+}
+# endif
+
+# endif
+
+#endif
+
+#include "nc_alloc.h"
+
+#if defined (EH_NEW_HEADERS)
+# include <vector>
+# include <cstring>
+# else
+# include <vector.h>
+# include <string.h>
+#endif
+
+#include "TestClass.h"
+#include "LeakCheck.h"
+#include "test_construct.h"
+#ifdef __BORLANDC__
+# include <except.h>
+#endif
+
+# if defined(EH_USE_NAMESPACES)
+namespace // dwa 1/21/00 - must use unnamed namespace here to avoid conflict under gcc using native streams
+{
+ using namespace std;
+ // using std::cerr;
+ // using std::endl;
+}
+# endif
+
+
+/*===================================================================================
+ usage (file-static helper)
+
+ EFFECTS: Prints a message describing the command-line parameters
+====================================================================================*/
+static void usage(const char* name)
+{
+ cerr<<"Usage : "<<name<<" [-n <iterations>] [-s <size>] [-l] [-e] [-q]/[-v] [-t] [test_name...]\n";
+ cerr<<"\t[-n <iterations>] : number of test iterations, default==100;"<<endl;
+ cerr<<"\t[-s <size>] : base value for random container sizes, default==1000;"<<endl;
+ cerr<<"\t[-e] : don't throw exceptions, test for leak in normal conditions;"<<endl;
+// This option was never actually used -- dwa 9/22/97
+// cerr<<"\t[-i] : ignore leak errors;"<<endl;
+ cerr<<"\t[-q] : quiet mode;"<<endl;
+ cerr<<"\t[-v] : verbose mode;"<<endl;
+ cerr<<"\t[-t] : track each allocation;"<<endl;
+ cerr<<"\t[test name [test name...]] : run only some of the tests by name (default==all tests):"<<endl;
+ cerr<<"\t\tpossible test names are : algo vector bit_vector list slist deque set map hash_set hash_map rope string bitset valarray"<<endl;
+ EH_CSTD::exit(1);
+}
+
+#ifdef EH_NEW_HEADERS
+# include <set>
+#else
+# include <set.h>
+#endif
+
+#if defined(_WIN32_WCE)
+#include <fstream>
+#endif
+
+int _STLP_CALL main(int argc, char** argv)
+{
+#if defined(_WIN32_WCE)
+ std::ofstream file( "\\eh_test.txt" );
+ std::streambuf* old_cout_buf = cout.rdbuf(file.rdbuf());
+ std::streambuf* old_cerr_buf = cerr.rdbuf(file.rdbuf());
+#endif
+#if defined( __MWERKS__ ) && defined( macintosh ) // Get command line.
+ argc = ccommand(&argv);
+ // Allow the i/o window to be repositioned.
+// EH_STD::string s;
+// getline(EH_STD::cin, s);
+#endif
+ unsigned int niters=2;
+ bool run_all=true;
+ bool run_slist = false;
+ bool run_list = false;
+ bool run_vector = false;
+ bool run_bit_vector = false;
+ bool run_deque = false;
+ bool run_hash_map = false;
+ bool run_hash_set = false;
+ bool run_set = false;
+ bool run_map = false;
+ bool run_algo = false;
+ bool run_algobase = false;
+ bool run_rope = false;
+ bool run_string = false;
+ bool run_bitset = false;
+ bool run_valarray = false;
+
+ int cur_argv;
+ char *p, *p1;
+#if defined (EH_NEW_IOSTREAMS)
+ std::ios_base::sync_with_stdio(false);
+#endif
+
+ cerr << argv[0]<<" : Exception handling testsuite.\n";
+ cerr.flush();
+
+ bool track_allocations = false;
+ // parse parameters :
+ // leak_test [-iterations] [-test] ...
+ for (cur_argv=1; cur_argv<argc; cur_argv++) {
+ p = argv[cur_argv];
+ if (*p == '-') {
+ switch (p[1]) {
+ case 'q':
+ gTestController.SetVerbose(false);
+ break;
+ case 'v':
+ gTestController.SetVerbose(true);
+ break;
+#if 0 // This option was never actually used -- dwa 9/22/97
+ case 'i':
+ gTestController.IgnoreLeaks(true);
+ break;
+#endif
+ case 'n':
+ p1 = argv[++cur_argv];
+ if (p1 && EH_CSTD::sscanf(p1, "%i", &niters)==1)
+ cerr <<" Doing "<<niters<<" iterations\n";
+ else
+ usage(argv[0]);
+ break;
+ case 't':
+ track_allocations = true;
+ break;
+ case 'e':
+ gTestController.TurnOffExceptions();
+ break;
+ case 's':
+ p1 = argv[++cur_argv];
+ if (p1 && EH_CSTD::sscanf(p1, "%i", &random_base)==1)
+ cerr <<" Setting "<<random_base<<" as base for random sizes.\n";
+ else
+ usage(argv[0]);
+ break;
+ default:
+ usage(argv[0]);
+ break;
+ }
+ } else {
+ run_all = false;
+ // test name
+ if (EH_CSTD::strcmp(p, "algo")==0) {
+ run_algo=true;
+ } else if (EH_CSTD::strcmp(p, "vector")==0) {
+ run_vector=true;
+ } else if (EH_CSTD::strcmp(p, "bit_vector")==0) {
+ run_bit_vector=true;
+ } else if (EH_CSTD::strcmp(p, "list")==0) {
+ run_list=true;
+ } else if (EH_CSTD::strcmp(p, "slist")==0) {
+ run_slist=true;
+ } else if (EH_CSTD::strcmp(p, "deque")==0) {
+ run_deque=true;
+ } else if (EH_CSTD::strcmp(p, "set")==0) {
+ run_set=true;
+ } else if (EH_CSTD::strcmp(p, "map")==0) {
+ run_map=true;
+ } else if (EH_CSTD::strcmp(p, "hash_set")==0) {
+ run_hash_set=true;
+ } else if (EH_CSTD::strcmp(p, "hash_map")==0) {
+ run_hash_map=true;
+ } else if (EH_CSTD::strcmp(p, "rope")==0) {
+ run_rope=true;
+ } else if (EH_CSTD::strcmp(p, "string")==0) {
+ run_string=true;
+ } else if (EH_CSTD::strcmp(p, "bitset")==0) {
+ run_bitset=true;
+ } else if (EH_CSTD::strcmp(p, "valarray")==0) {
+ run_valarray=true;
+ } else {
+ usage(argv[0]);
+ }
+
+ }
+ }
+
+ gTestController.TrackAllocations( track_allocations );
+
+ // Over and over...
+ for ( unsigned i = 0; i < niters ; i++ )
+ {
+ cerr << "iteration #" << i << "\n";
+ if (run_all || run_algobase) {
+ gTestController.SetCurrentContainer("algobase");
+ cerr << "EH test : algobase" << endl;
+ test_algobase();
+ }
+ if (run_all || run_algo) {
+ gTestController.SetCurrentContainer("algo");
+ cerr << "EH test : algo" << endl;
+ test_algo();
+ }
+
+ if (run_all || run_vector) {
+ gTestController.SetCurrentContainer("vector");
+ cerr << "EH test : vector" << endl;
+ test_vector();
+ }
+
+#if defined( EH_BIT_VECTOR_IMPLEMENTED )
+ if (run_all || run_bit_vector) {
+ gTestController.SetCurrentContainer("bit_vector");
+ cerr << "EH test : bit_vector" << endl;
+ test_bit_vector();
+ }
+#endif
+
+ if (run_all || run_list) {
+ gTestController.SetCurrentContainer("list");
+ cerr << "EH test : list" << endl;
+ test_list();
+ }
+
+#if defined( EH_SLIST_IMPLEMENTED )
+ if (run_all || run_slist) {
+ gTestController.SetCurrentContainer("slist");
+ cerr << "EH test : slist" << endl;
+ test_slist();
+ }
+#endif // EH_SLIST_IMPLEMENTED
+
+ if (run_all || run_deque) {
+ gTestController.SetCurrentContainer("deque");
+ cerr << "EH test : deque" << endl;
+ test_deque();
+ }
+ if (run_all || run_set) {
+ gTestController.SetCurrentContainer("set");
+ cerr << "EH test : set" << endl;
+ test_set();
+ gTestController.SetCurrentContainer("multiset");
+ cerr << "EH test : multiset" << endl;
+ test_multiset();
+ }
+
+ if (run_all || run_map) {
+ gTestController.SetCurrentContainer("map");
+ cerr << "EH test : map" << endl;
+ test_map();
+ gTestController.SetCurrentContainer("multimap");
+ cerr << "EH test : multimap" << endl;
+ test_multimap();
+ }
+
+#if defined( EH_HASHED_CONTAINERS_IMPLEMENTED )
+ if (run_all || run_hash_map) {
+ gTestController.SetCurrentContainer("hash_map");
+ cerr << "EH test : hash_map" << endl;
+ test_hash_map();
+ gTestController.SetCurrentContainer("hash_multimap");
+ cerr << "EH test : hash_multimap" << endl;
+ test_hash_multimap();
+ }
+
+ if (run_all || run_hash_set) {
+ gTestController.SetCurrentContainer("hash_set");
+ cerr << "EH test : hash_set" << endl;
+ test_hash_set();
+ gTestController.SetCurrentContainer("hash_multiset");
+ cerr << "EH test : hash_multiset" << endl;
+ test_hash_multiset();
+ }
+#endif // EH_HASHED_CONTAINERS_IMPLEMENTED
+
+#if defined( EH_ROPE_IMPLEMENTED )
+ // CW1.8 can't compile this for some reason!
+#if !( defined(__MWERKS__) && __MWERKS__ < 0x1900 )
+ if (run_all || run_rope) {
+ gTestController.SetCurrentContainer("rope");
+ cerr << "EH test : rope" << endl;
+ test_rope();
+ }
+#endif
+#endif // EH_ROPE_IMPLEMENTED
+#if defined( EH_STRING_IMPLEMENTED )
+ if (run_all || run_string) {
+ gTestController.SetCurrentContainer("string");
+ cerr << "EH test : string" << endl;
+ test_string();
+ }
+#endif
+#if defined( EH_BITSET_IMPLEMENTED )
+ if (run_all || run_bitset) {
+ gTestController.SetCurrentContainer("bitset");
+ cerr << "EH test : bitset" << endl;
+ test_bitset();
+ }
+#endif
+#if defined( EH_VALARRAY_IMPLEMENTED )
+ if (run_all || run_bitset) {
+ gTestController.SetCurrentContainer("valarray");
+ cerr << "EH test : valarray" << endl;
+ test_valarray();
+ }
+#endif
+ }
+
+ gTestController.TrackAllocations( false );
+
+ cerr << "EH test : Done\n";
+
+#if defined(_WIN32_WCE)
+ cout.rdbuf(old_cout_buf);
+ cerr.rdbuf(old_cerr_buf);
+ file.close();
+#endif
+
+ return 0;
+}
+
diff --git a/test/eh/mingw32.mak b/test/eh/mingw32.mak
new file mode 100644
index 0000000..72183bc
--- /dev/null
+++ b/test/eh/mingw32.mak
@@ -0,0 +1,111 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+srcdir = .
+VPATH = .
+
+# point this to proper location
+STL_INCL=-I../../stlport
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=obj/%.o) $(STAT_MODULE)
+D_OBJECTS = $(LIST:%.cpp=d_obj/%.o) $(STAT_MODULE)
+NOSGI_OBJECTS = $(LIST:%.cpp=nosgi_obj/%.o) $(STAT_MODULE)
+
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = ./eh_test
+D_TEST_EXE = ./eh_test_d
+NOSGI_TEST_EXE = ./eh_test_nosgi
+
+TEST = ./eh_test.out
+D_TEST = ./eh_test_d.out
+NOSGI_TEST = ./eh_test_nosgi.out
+
+CC = c++
+CXX = $(CC)
+
+# dwa 12/22/99 -- had to turn off -ansi flag so we could use SGI IOSTREAMS
+# also, test_slist won't compile with -O3/-O2 when targeting PPC. It fails
+# in the assembler with 'invalid relocation type'
+CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW
+D_CXXFLAGS = -Wall -g -O ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -DEH_VECTOR_OPERATOR_NEW -D_STLP_DEBUG -D_STLP_USE_STATIC_LIB
+NOSGI_CXXFLAGS = -Wall -g -O2 ${STL_INCL} -I. ${CXX_EXTRA_FLAGS} -D_STLP_NO_OWN_IOSTREAMS -D_STLP_DEBUG_UNINITIALIZED -DEH_VECTOR_OPERATOR_NEW
+
+check: $(TEST)
+
+LIBS = -lm
+
+D_LIBSTLPORT = -L../../lib -lstlport_mingw32_debug_static
+LIBSTLPORT = -L../../lib -lstlport_mingw32_static
+
+all: $(TEST_EXE) $(D_TEST_EXE) $(NOSGI_TEST_EXE)
+
+check_nosgi: $(NOSGI_TEST)
+check_d: $(D_TEST)
+
+
+$(TEST_EXE) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBSTLPORT) $(LIBS) -o $(TEST_EXE)
+
+$(D_TEST_EXE) : $(D_OBJECTS)
+ $(CXX) $(D_CXXFLAGS) $(D_OBJECTS) $(D_LIBSTLPORT) $(LIBS) -o $(D_TEST_EXE)
+
+$(NOSGI_TEST_EXE) : $(NOSGI_OBJECTS)
+ $(CXX) $(NOSGI_CXXFLAGS) $(NOSGI_OBJECTS) $(LIBS) -o $(NOSGI_TEST_EXE)
+
+
+$(TEST) : $(TEST_EXE)
+ $(TEST_EXE)
+
+$(D_TEST) : $(D_TEST_EXE)
+ $(D_TEST_EXE)
+
+$(NOSGI_TEST) : $(NOSGI_TEST_EXE)
+ $(NOSGI_TEST_EXE)
+
+SUFFIXES: .cpp.o.exe.out.res
+
+nosgi_obj/%.o : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -c -o $@
+
+d_obj/%.o : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -c -o $@
+
+obj/%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+nosgi_obj/%.i : %.cpp
+ $(CXX) $(NOSGI_CXXFLAGS) $< -E -H > $@
+
+d_obj/%.i : %.cpp
+ $(CXX) $(D_CXXFLAGS) $< -E -H > $@
+
+obj/%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* > $@
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+%.E: %.cpp
+ $(CXX) $(CXXFLAGS) -E $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o */*.o *.rpo *.obj *.out core *~ Templates.DB
diff --git a/test/eh/mwerks_console_OS_X.c b/test/eh/mwerks_console_OS_X.c
new file mode 100644
index 0000000..3597fca
--- /dev/null
+++ b/test/eh/mwerks_console_OS_X.c
@@ -0,0 +1,193 @@
+/* Metrowerks Standard Library
+ * Copyright © 1995-2002 Metrowerks Corporation. All rights reserved.
+ *
+ * $Date$
+ * $Revision$
+ */
+
+#include <ansi_parms.h>
+#include <size_t.h>
+#include <console.h>
+#include <unistd.h>
+
+#if __MACH__
+ short InstallConsole(short fd)
+ {
+ #pragma unused (fd)
+
+ return 0;
+ }
+#else
+ #include <Carbon.h>
+
+ typedef int (*ReadPtr)(int, void *, __std(size_t));
+ typedef int (*WritePtr)(int, const void *, __std(size_t));
+
+ static struct
+ {
+ Boolean isLoaded;
+ CFBundleRef theBundle;
+ ReadPtr theRead;
+ WritePtr theWrite;
+ } __msl_os_x;
+
+ static OSErr __msl_CreateFrameworkBundleFromName(CFStringRef theFrameworkName,
+ CFBundleRef *theBundle)
+ {
+ OSErr theErr;
+ FSRef theRef;
+ CFURLRef theFrameworkURL;
+ CFURLRef theBundleURL;
+
+ /* Find the folder containing all the frameworks */
+ theErr = FSFindFolder(kOnAppropriateDisk, kFrameworksFolderType, false, &theRef);
+
+ if (theErr == noErr)
+ {
+ /* Turn the framework folder FSRef into a CFURL */
+ theFrameworkURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &theRef);
+
+ if (theFrameworkURL != NULL)
+ {
+ /* Create a CFURL pointing to the desired framework */
+ theBundleURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault,
+ theFrameworkURL, theFrameworkName, false);
+
+ CFRelease(theFrameworkURL);
+
+ if (theBundleURL != NULL)
+ {
+ /* Turn the CFURL into a bundle reference */
+ *theBundle = CFBundleCreate(kCFAllocatorSystemDefault, theBundleURL);
+
+ CFRelease(theBundleURL);
+ }
+ }
+ }
+
+ return theErr;
+ }
+
+ short InstallConsole(short fd)
+ {
+ #pragma unused (fd)
+ OSErr theErr;
+ short theResult;
+
+ theResult = -1;
+
+ /* Start with no bundle */
+ __msl_os_x.isLoaded = false;
+ __msl_os_x.theBundle = NULL;
+ __msl_os_x.theRead = NULL;
+ __msl_os_x.theWrite = NULL;
+
+ /* Create a bundle reference based on its name */
+ theErr = __msl_CreateFrameworkBundleFromName(CFSTR("System.framework"),
+ &__msl_os_x.theBundle);
+
+ if ((theErr == noErr) && (__msl_os_x.theBundle != NULL))
+ {
+ theResult = 0;
+
+ __msl_os_x.isLoaded = CFBundleLoadExecutable(__msl_os_x.theBundle);
+
+ if (__msl_os_x.isLoaded)
+ {
+ /* Lookup the functions in the bundle by name */
+ __msl_os_x.theRead = (ReadPtr)
+ CFBundleGetFunctionPointerForName(__msl_os_x.theBundle, CFSTR("read"));
+ __msl_os_x.theWrite = (WritePtr)
+ CFBundleGetFunctionPointerForName(__msl_os_x.theBundle, CFSTR("write"));
+ }
+ }
+
+ return theResult;
+ }
+#endif
+
+void RemoveConsole(void)
+{
+#if !__MACH__
+ if (__msl_os_x.theBundle != NULL)
+ {
+ if (__msl_os_x.isLoaded)
+ {
+ __msl_os_x.theRead = NULL;
+ __msl_os_x.theWrite = NULL;
+
+ CFBundleUnloadExecutable(__msl_os_x.theBundle);
+ __msl_os_x.isLoaded = false;
+ }
+
+ CFRelease(__msl_os_x.theBundle);
+ __msl_os_x.theBundle = NULL;
+ }
+#endif
+}
+
+long WriteCharsToConsole(char *buffer, long n)
+{
+#if __MACH__
+ return write(1, buffer, n);
+#else
+ /* Call the function if it was found */
+ if (__msl_os_x.theWrite == NULL)
+ return -1;
+ else
+ return __msl_os_x.theWrite(1, buffer, n);
+#endif
+}
+
+#if __MACH__
+long WriteCharsToErrorConsole(char *buffer, long n)
+{
+ return write(2, buffer, n);
+}
+#endif
+
+long ReadCharsFromConsole(char *buffer, long n)
+{
+#if __MACH__
+ return read(0, buffer, n);
+#else
+ /* Call the function if it was found */
+ if (__msl_os_x.theRead == NULL)
+ return -1;
+ else
+ return __msl_os_x.theRead(0, buffer, n);
+#endif
+}
+
+/* JWW - This code should never be reached, but it's needed for link purposes */
+char *__ttyname(long fildes)
+{
+#pragma unused (fildes)
+ /* all streams have the same name */
+ static char *__devicename = "Terminal";
+
+ if (fildes >= 0 && fildes <= 2)
+ return (__devicename);
+
+ return (0L);
+}
+
+int kbhit(void)
+{
+ return 0;
+}
+
+int getch(void)
+{
+ return 0;
+}
+
+void clrscr()
+{
+ return;
+}
+
+/* Change record:
+ * JWW 010919 Created Mach-O console stubs file
+ * JWW 020418 Use __std() for all size_t, and #include <size_t.h> to get proper C++ definitions
+ */
\ No newline at end of file
diff --git a/test/eh/mwerks_debug_prefix.h b/test/eh/mwerks_debug_prefix.h
new file mode 100644
index 0000000..874b1f0
--- /dev/null
+++ b/test/eh/mwerks_debug_prefix.h
@@ -0,0 +1,8 @@
+//mwerks_debug_prefix.h
+#define _STLP_NO_FORCE_INSTANTIATE 1// for debugging
+#define EH_VECTOR_OPERATOR_NEW 1
+#define _STLP_DEBUG 1 // enable the use of allocation debugging
+
+#if __MWERKS__ >= 0x3000
+#include <MSLCarbonPrefix.h>
+#endif
\ No newline at end of file
diff --git a/test/eh/mwerks_nosgi_debug_prefix.h b/test/eh/mwerks_nosgi_debug_prefix.h
new file mode 100644
index 0000000..6652825
--- /dev/null
+++ b/test/eh/mwerks_nosgi_debug_prefix.h
@@ -0,0 +1,5 @@
+//mwerks_nosgi_debug_prefix.h
+#define _STLP_NO_SGI_IOSTREAMS 1
+#define _STLP_NO_FORCE_INSTANTIATE 1 // for debugging
+#define _STLP_DEBUG_UNINITIALIZED 1 // enable the use of allocation debugging
+#define EH_VECTOR_OPERATOR_NEW 1
diff --git a/test/eh/mwerks_nosgi_prefix.h b/test/eh/mwerks_nosgi_prefix.h
new file mode 100644
index 0000000..660fac2
--- /dev/null
+++ b/test/eh/mwerks_nosgi_prefix.h
@@ -0,0 +1,5 @@
+//mwerks_nosgi_prefix.h
+#define _STLP_NO_SGI_IOSTREAMS 1
+#define _STLP_NO_FORCE_INSTANTIATE 1 // for debugging
+#define EH_VECTOR_OPERATOR_NEW 1
+#define NDEBUG 1
diff --git a/test/eh/mwerks_prefix.h b/test/eh/mwerks_prefix.h
new file mode 100644
index 0000000..30131e5
--- /dev/null
+++ b/test/eh/mwerks_prefix.h
@@ -0,0 +1,8 @@
+//mwerks_prefix.h
+#define _STLP_NO_FORCE_INSTANTIATE 1// for debugging
+#define EH_VECTOR_OPERATOR_NEW 1
+#define NDEBUG 1
+
+#if __MWERKS__ >= 0x3000
+#include <MSLCarbonPrefix.h>
+#endif
\ No newline at end of file
diff --git a/test/eh/nc_alloc.cpp b/test/eh/nc_alloc.cpp
new file mode 100644
index 0000000..6234eab
--- /dev/null
+++ b/test/eh/nc_alloc.cpp
@@ -0,0 +1,328 @@
+/************************************************************************************************
+ NC_ALLOC.CPP
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+************************************************************************************************/
+
+#include "nc_alloc.h"
+#include <string>
+
+#if defined (EH_NEW_HEADERS)
+# include <new>
+# include <cassert>
+# include <cstdlib>
+#else
+# include <assert.h>
+# include <stdlib.h>
+# include <new.h>
+#endif
+
+#if defined (EH_NEW_IOSTREAMS)
+# include <iostream>
+#else
+# include <iostream.h>
+#endif
+
+long alloc_count = 0;
+long object_count = 0;
+long TestController::possible_failure_count = 0;
+const char* TestController::current_test = "<unknown>";
+const char* TestController::current_test_category = "no category";
+const char* TestController::current_container = 0;
+bool TestController::nc_verbose = true;
+bool TestController::never_fail = false;
+bool TestController::track_allocations = false;
+bool TestController::leak_detection_enabled = false;
+TestController gTestController;
+
+//************************************************************************************************
+void TestController::maybe_fail(long) {
+ if (never_fail || Failure_threshold() == kNotInExceptionTest)
+ return;
+
+ // throw if allocation would satisfy the threshold
+ if (possible_failure_count++ >= Failure_threshold()) {
+ // what about doing some standard new_handler() behavior here (to test it!) ???
+
+ // reset and simulate an out-of-memory failure
+ Failure_threshold() = kNotInExceptionTest;
+#ifndef EH_NO_EXCEPTIONS
+ throw EH_STD::bad_alloc();
+#endif
+ }
+}
+
+#if defined (EH_HASHED_CONTAINERS_IMPLEMENTED)
+# if defined (__SGI_STL)
+# if defined (EH_NEW_HEADERS)
+# include <hash_set>
+# else
+# include <hash_set.h>
+# endif
+# elif defined (__MSL__)
+# include <hashset.h>
+# else
+# error what do I include to get hash_set?
+# endif
+#else
+# if defined (EH_NEW_HEADERS)
+# include <set>
+# else
+# include <set.h>
+# endif
+#endif
+
+#if !defined (EH_HASHED_CONTAINERS_IMPLEMENTED)
+typedef EH_STD::set<void*, EH_STD::less<void*> > allocation_set;
+#else
+
+USING_CSTD_NAME(size_t)
+
+struct hash_void {
+ size_t operator()(void* x) const { return (size_t)x; }
+};
+
+typedef EH_STD::hash_set<void*, ::hash_void, EH_STD::equal_to<void*> > allocation_set;
+#endif
+
+static allocation_set& alloc_set() {
+ static allocation_set s;
+ return s;
+}
+
+// Prevents infinite recursion during allocation
+static bool using_alloc_set = false;
+
+#if !defined (NO_FAST_ALLOCATOR)
+//
+// FastAllocator -- speeds up construction of TestClass objects when
+// TESTCLASS_DEEP_DATA is enabled, and speeds up tracking of allocations
+// when the suite is run with the -t option.
+//
+class FastAllocator {
+public:
+ //FastAllocator() : mFree(0), mUsed(0) {}
+ static void *Allocate(size_t s) {
+ void *result = 0;
+
+ if (s <= sizeof(Block)) {
+ if (mFree != 0) {
+ result = mFree;
+ mFree = mFree->next;
+ }
+ else if (mBlocks != 0 && mUsed < kBlockCount) {
+ result = (void*)&mBlocks[mUsed++];
+ }
+ }
+ return result;
+ }
+
+ static bool Free(void* p) {
+ Block* b = (Block*)p;
+ if (mBlocks == 0 || b < mBlocks || b >= mBlocks + kBlockCount)
+ return false;
+ b->next = mFree;
+ mFree = b;
+ return true;
+ }
+
+ struct Block;
+ friend struct Block;
+
+ enum {
+ // Number of fast allocation blocks to create.
+ kBlockCount = 1500,
+
+ // You may need to adjust this number for your platform.
+ // A good choice will speed tests. A bad choice will still work.
+ kMinBlockSize = 48
+ };
+
+ struct Block {
+ union {
+ Block *next;
+ double dummy; // fbp - force alignment
+ char dummy2[kMinBlockSize];
+ };
+ };
+
+ static Block* mBlocks;
+ static Block *mFree;
+ static size_t mUsed;
+};
+
+FastAllocator::Block *FastAllocator::mBlocks =
+(FastAllocator::Block*)EH_CSTD::calloc( sizeof(FastAllocator::Block), FastAllocator::kBlockCount );
+FastAllocator::Block *FastAllocator::mFree;
+size_t FastAllocator::mUsed;
+
+
+static FastAllocator gFastAllocator;
+#endif
+
+inline char* AllocateBlock(size_t s) {
+#if !defined (NO_FAST_ALLOCATOR)
+ char * const p = (char*)gFastAllocator.Allocate( s );
+ if (p != 0)
+ return p;
+#endif
+
+ return (char*)EH_CSTD::malloc(s);
+}
+
+static void* OperatorNew( size_t s ) {
+ if (!using_alloc_set) {
+ simulate_possible_failure();
+ ++alloc_count;
+ }
+
+ char *p = AllocateBlock(s);
+
+ if (gTestController.TrackingEnabled() &&
+ gTestController.LeakDetectionEnabled() &&
+ !using_alloc_set) {
+ using_alloc_set = true;
+ bool inserted = alloc_set().insert(p).second;
+ // Suppress warning about unused variable.
+ inserted;
+ EH_ASSERT(inserted);
+ using_alloc_set = false;
+ }
+
+ return p;
+}
+
+void* _STLP_CALL operator new(size_t s)
+#ifdef EH_DELETE_HAS_THROW_SPEC
+throw(EH_STD::bad_alloc)
+#endif
+{ return OperatorNew( s ); }
+
+#ifdef EH_USE_NOTHROW
+void* _STLP_CALL operator new(size_t size, const EH_STD::nothrow_t&) throw() {
+ try {
+ return OperatorNew( size );
+ }
+ catch (...) {
+ return 0;
+ }
+}
+#endif
+
+#if 1 /* defined (EH_VECTOR_OPERATOR_NEW) */
+void* _STLP_CALL operator new[](size_t size ) throw(EH_STD::bad_alloc) {
+ return OperatorNew( size );
+}
+
+# ifdef EH_USE_NOTHROW
+void* _STLP_CALL operator new[](size_t size, const EH_STD::nothrow_t&) throw() {
+ try {
+ return OperatorNew(size);
+ }
+ catch (...) {
+ return 0;
+ }
+}
+# endif
+
+void _STLP_CALL operator delete[](void* ptr) throw()
+{ operator delete( ptr ); }
+#endif
+
+#if defined (EH_DELETE_HAS_THROW_SPEC)
+void _STLP_CALL operator delete(void* s) throw()
+#else
+void _STLP_CALL operator delete(void* s)
+#endif
+{
+ if ( s != 0 ) {
+ if ( !using_alloc_set ) {
+ --alloc_count;
+
+ if ( gTestController.TrackingEnabled() && gTestController.LeakDetectionEnabled() ) {
+ using_alloc_set = true;
+ allocation_set::iterator p = alloc_set().find( (char*)s );
+ EH_ASSERT( p != alloc_set().end() );
+ alloc_set().erase( p );
+ using_alloc_set = false;
+ }
+ }
+# if ! defined (NO_FAST_ALLOCATOR)
+ if ( !gFastAllocator.Free( s ) )
+# endif
+ EH_CSTD::free(s);
+ }
+}
+
+
+/*===================================================================================
+ ClearAllocationSet (private helper)
+
+ EFFECTS: Empty the set of allocated blocks.
+====================================================================================*/
+void TestController::ClearAllocationSet() {
+ if (!using_alloc_set) {
+ using_alloc_set = true;
+ alloc_set().clear();
+ using_alloc_set = false;
+ }
+}
+
+
+bool TestController::ReportLeaked() {
+ EndLeakDetection();
+
+ EH_ASSERT( !using_alloc_set || (alloc_count == static_cast<int>(alloc_set().size())) );
+
+ if (alloc_count != 0 || object_count != 0) {
+ EH_STD::cerr<<"\nEH TEST FAILURE !\n";
+ PrintTestName(true);
+ if (alloc_count)
+ EH_STD::cerr << "ERROR : " << alloc_count << " outstanding allocations.\n";
+ if (object_count)
+ EH_STD::cerr << "ERROR : " << object_count << " non-destroyed objects.\n";
+ alloc_count = object_count = 0;
+ return true;
+ }
+ return false;
+}
+
+
+
+/*===================================================================================
+ PrintTestName
+
+ EFFECTS: Prints information about the current test. If err is false, ends with
+ an ellipsis, because the test is ongoing. If err is true an error is being
+ reported, and the output ends with an endl.
+====================================================================================*/
+
+void TestController::PrintTestName(bool err) {
+ if (current_container)
+ EH_STD::cerr<<"["<<current_container<<"] :";
+ EH_STD::cerr<<"testing "<<current_test <<" (" << current_test_category <<")";
+ if (err)
+ EH_STD::cerr<<EH_STD::endl;
+ else
+ EH_STD::cerr<<" ... ";
+}
+
+void TestController::ReportSuccess(int count) {
+ if (nc_verbose)
+ EH_STD::cerr<<(count+1)<<" try successful"<<EH_STD::endl;
+}
+
+long& TestController::Failure_threshold() {
+ static long failure_threshold = kNotInExceptionTest;
+ return failure_threshold;
+}
diff --git a/test/eh/nc_alloc.h b/test/eh/nc_alloc.h
new file mode 100644
index 0000000..e978362
--- /dev/null
+++ b/test/eh/nc_alloc.h
@@ -0,0 +1,184 @@
+/***********************************************************************************
+ TestController.h
+
+ SUMMARY: An "faux-singleton" object to encapsulate a hodgepodge of state and
+ functionality relating to the test suite. Probably should be broken
+ into smaller pieces.
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#if !INCLUDED_MOTU_nc_alloc
+#define INCLUDED_MOTU_nc_alloc 1
+
+#include "Prefix.h"
+
+#if defined (EH_NEW_HEADERS)
+# include <utility>
+#else
+# include <pair.h>
+#endif
+
+extern long alloc_count;
+extern long object_count;
+
+struct TestController {
+ // Report that the current test has succeeded.
+ static void ReportSuccess(int);
+
+ //
+ // Leak detection
+ //
+
+ // Turn the recording of the addresses of individual allocated
+ // blocks on or off. If not called, allocations will only be
+ // counted, but deallocations won't be checked for validity.
+ static void TrackAllocations( bool );
+ static bool TrackingEnabled();
+
+ // Call this to begin a new leak-detection cycle. Resets all
+ // allocation counts, etc.
+ static void BeginLeakDetection();
+
+ // Returns true iff leak detection is currently in effect
+ static bool LeakDetectionEnabled();
+
+ // Ends leak detection and reports any resource leaks.
+ // Returns true if any occurred.
+ static bool ReportLeaked();
+
+ //
+ // Exception-safety
+ //
+
+ // Don't test for exception-safety
+ static void TurnOffExceptions();
+
+ // Set operator new to fail on the nth invocation
+ static void SetFailureCountdown( long n );
+
+ // Set operator new to never fail.
+ static void CancelFailureCountdown();
+
+ // Throws an exception if the count has been reached. Call this
+ // before every operation that might fail in the real world.
+ static void maybe_fail(long);
+
+ //
+ // Managing verbose feedback.
+ //
+
+ // Call to begin a strong, weak, or const test. If verbose
+ // reporting is enabled, prints the test category.
+ static void SetCurrentTestCategory( const char* str );
+
+ // Call to set the name of the container being tested.
+ static void SetCurrentContainer( const char* str );
+
+ // Sets the name of the current test.
+ static void SetCurrentTestName(const char* str);
+
+ // Turn verbose reporting on or off.
+ static void SetVerbose(bool val);
+
+private:
+ enum { kNotInExceptionTest = -1 };
+
+ static void ClearAllocationSet();
+ static void EndLeakDetection();
+ static void PrintTestName( bool err=false );
+
+ static long& Failure_threshold();
+ static long possible_failure_count;
+ static const char* current_test;
+ static const char* current_test_category;
+ static const char* current_container;
+ static bool nc_verbose;
+ static bool never_fail;
+ static bool track_allocations;
+ static bool leak_detection_enabled;
+};
+
+extern TestController gTestController;
+
+//
+// inline implementations
+//
+
+inline void simulate_possible_failure() {
+ gTestController.maybe_fail(0);
+}
+
+inline void simulate_constructor() {
+ gTestController.maybe_fail(0);
+ ++object_count;
+}
+
+inline void simulate_destructor() {
+ --object_count;
+}
+
+inline void TestController::TrackAllocations(bool track) {
+ track_allocations = track;
+}
+
+inline bool TestController::TrackingEnabled() {
+ return track_allocations;
+}
+
+inline void TestController::SetFailureCountdown(long count) {
+ Failure_threshold() = count;
+ possible_failure_count = 0;
+}
+
+inline void TestController::CancelFailureCountdown() {
+ Failure_threshold() = kNotInExceptionTest;
+}
+
+inline void TestController::BeginLeakDetection() {
+ alloc_count = 0;
+ object_count = 0;
+ ClearAllocationSet();
+ leak_detection_enabled = true;
+}
+
+inline bool TestController::LeakDetectionEnabled() {
+ return leak_detection_enabled;
+}
+
+inline void TestController::EndLeakDetection() {
+ leak_detection_enabled = false;
+}
+
+inline void TestController::SetCurrentTestCategory(const char* str) {
+ current_test_category = str;
+ if (nc_verbose)
+ PrintTestName();
+}
+
+inline void TestController::SetCurrentContainer(const char* str) {
+ current_container=str;
+}
+
+inline void TestController::SetCurrentTestName(const char* str) {
+ current_test = str;
+}
+
+inline void TestController::SetVerbose(bool val) {
+ nc_verbose = val;
+}
+
+inline void TestController::TurnOffExceptions() {
+ never_fail = true;
+}
+
+#endif // INCLUDED_MOTU_nc_alloc
diff --git a/test/eh/random_number.cpp b/test/eh/random_number.cpp
new file mode 100644
index 0000000..a5bf598
--- /dev/null
+++ b/test/eh/random_number.cpp
@@ -0,0 +1,39 @@
+/***********************************************************************************
+ random_number.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "random_number.h"
+#include "Prefix.h"
+#if defined (EH_NEW_HEADERS)
+# include <functional>
+# include <cstdlib>
+#else
+# include <function.h>
+# include <stdlib.h>
+#endif
+
+unsigned random_number( size_t range )
+{
+#if !defined( __SGI_STL )
+ if (range == 0) return 0;
+ return (unsigned)(EH_STD::rand() + EH_STD::rand()) % range;
+#else
+ static EH_STD::subtractive_rng rnd;
+ if (range==0) return 0;
+ return rnd(range);
+#endif
+}
+
+// default base for random container sizes
+unsigned random_base = 1000;
diff --git a/test/eh/random_number.h b/test/eh/random_number.h
new file mode 100644
index 0000000..20754c1
--- /dev/null
+++ b/test/eh/random_number.h
@@ -0,0 +1,27 @@
+/***********************************************************************************
+ random_number.h
+
+ * Copyright (c) 1997-1998
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#ifndef RANDOM_NUMBER_DWA120298_H_
+#define RANDOM_NUMBER_DWA120298_H_
+
+#include <stddef.h>
+
+// Return a random number in the given range.
+unsigned random_number( size_t range );
+
+// default base for random container sizes
+extern unsigned random_base;
+
+#endif // #include guard
diff --git a/test/eh/sgi_mipspro.mak b/test/eh/sgi_mipspro.mak
new file mode 100644
index 0000000..dd2db1a
--- /dev/null
+++ b/test/eh/sgi_mipspro.mak
@@ -0,0 +1,62 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+SHELL=/bin/sh
+
+# srcdir = .
+# VPATH = .
+
+
+STL_INCL=-I${PWD}/../../stlport/
+
+# STL_INCL= -DEH_NO_SGI_STL
+
+AUX_LIST=TestClass.o main.o nc_alloc.o random_number.o
+
+TEST_LIST=test_algo.o \
+test_algobase.o test_list.o test_slist.o \
+test_bit_vector.o test_vector.o \
+test_deque.o test_set.o test_map.o \
+test_hash_map.o test_hash_set.o test_rope.o \
+test_string.o test_bitset.o test_valarray.o
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST)
+EXECS = $(LIST:%.o=%)
+TESTS = $(LIST:%.o=%.out)
+TEST_EXE = eh_test
+TEST = eh_test.out
+
+CC = CC
+CXX = $(CC)
+
+# CXXFLAGS = -J 4 -ansi -LANG:std -I. ${STL_INCL} ${DEBUG_FLAGS} -I. -D_STLP_NO_OWN_IOSTREAMS -D_STLP_NO_NEW_IOSTREAMS
+CXXFLAGS = -J 4 -ansi -LANG:std -I. ${STL_INCL} ${DEBUG_FLAGS} -I.
+
+LIBS = -L../../lib -lstlport_mipspro -lm
+LIBSTDCXX =
+
+.SUFFIXES: .cpp .i .o .out .res
+
+check: $(TEST)
+
+$(TEST) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(TEST_EXE) -s 100
+
+.cpp.o:
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+.cpp.i:
+ $(CXX) $(CXXFLAGS) $< -E > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $*.cpp -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* -q
+ -rm -f $*
+
+clean:
+ -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache cxx_repository
diff --git a/test/eh/sunpro-64.mak b/test/eh/sunpro-64.mak
new file mode 100644
index 0000000..773bf0a
--- /dev/null
+++ b/test/eh/sunpro-64.mak
@@ -0,0 +1,69 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+
+SHELL=/bin/sh
+
+# point this to proper location
+STL_INCL= -I${PWD}/../../stlport
+
+# STL_INCL= -DEH_NO_SGI_STL
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE)
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = eh_test
+TEST = eh_test.out
+
+CC = CC
+CXX = $(CC)
+
+CXXFLAGS = ${STL_INCL} -xarch=v9 -library=no%Cstd -features=rtti -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC -xildoff -g -D_REENTRANT -DNO_FAST_ALLOCATOR
+
+# This is to test with native STL
+# CXXFLAGS = +w2 -xildoff -D_STLP_USE_NEWALLOC -DEH_NO_SGI_STL -DEH_NEW_HEADERS -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC
+
+
+LIBS = -lm
+LIBSTDCXX =
+
+LIBSTLPORT = -library=no%Cstd -L../../lib -lstlport_sunpro64
+
+
+check: $(TEST)
+
+$(TEST) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) ${LIBSTLPORT} $(LIBS) -o $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib;${LD_LIBRARY_PATH}" ./$(TEST_EXE) -s 100
+
+SUFFIXES: .cpp.o.out.res
+
+%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) -o $*
+ ./$* -q
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache
diff --git a/test/eh/sunpro.mak b/test/eh/sunpro.mak
new file mode 100644
index 0000000..682668f
--- /dev/null
+++ b/test/eh/sunpro.mak
@@ -0,0 +1,71 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+
+SHELL=/bin/sh
+
+# point this to proper location
+STL_INCL= -I${PWD}/../../stlport
+
+# STL_INCL= -DEH_NO_SGI_STL
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE)
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = eh_test
+TEST = eh_test.out
+
+CC = CC
+CXX = $(CC)
+
+# CXXFLAGS = ${STL_INCL} -library=no%Cstd -qoption ccfe -instlib=../../lib/libstlport_sunpro.so -features=rtti -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC
+
+CXXFLAGS = ${STL_INCL} -library=no%Cstd -features=rtti -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC
+
+# This is to test with native STL
+# CXXFLAGS = +w2 -xildoff -D_STLP_USE_NEWALLOC -DEH_NO_SGI_STL -DEH_NEW_HEADERS -DEH_VECTOR_OPERATOR_NEW -DEH_DELETE_HAS_THROW_SPEC
+
+
+LIBS = -lm
+LIBSTDCXX =
+
+LIBSTLPORT = -library=no%Cstd -L../../lib -lstlport_sunpro
+
+
+check: $(TEST)
+
+$(TEST) : $(OBJECTS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) ${LIBSTLPORT} $(LIBS) -o $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib;${LD_LIBRARY_PATH}" ./$(TEST_EXE) -s 100
+
+SUFFIXES: .cpp.o.out.res
+
+%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBS) ${LIBSTLPORT} -o $*
+ LD_LIBRARY_PATH="../../lib;${LD_LIBRARY_PATH}" ./$*
+
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache
diff --git a/test/eh/sunpro42.mak b/test/eh/sunpro42.mak
new file mode 100644
index 0000000..6e58f6a
--- /dev/null
+++ b/test/eh/sunpro42.mak
@@ -0,0 +1,76 @@
+# ;;; -*- Mode:makefile;-*-
+# Generated automatically from Makefile.in by configure.
+# This requires GNU make.
+
+# SHELL=/bin/sh
+# srcdir = .
+# VPATH = .
+
+SHELL=/bin/sh
+
+# point this to proper location
+STL_INCL= -I../../stlport
+
+# STL_INCL= -DEH_NO_SGI_STL
+
+AUX_LIST=TestClass.cpp main.cpp nc_alloc.cpp random_number.cpp
+
+TEST_LIST=test_algo.cpp \
+test_algobase.cpp test_list.cpp test_slist.cpp \
+test_bit_vector.cpp test_vector.cpp \
+test_deque.cpp test_set.cpp test_map.cpp \
+test_hash_map.cpp test_hash_set.cpp test_rope.cpp \
+test_string.cpp test_bitset.cpp test_valarray.cpp
+
+LIST=${AUX_LIST} ${TEST_LIST}
+
+OBJECTS = $(LIST:%.cpp=%.o) $(STAT_MODULE)
+EXECS = $(LIST:%.cpp=%)
+TESTS = $(LIST:%.cpp=%.out)
+TEST_EXE = eh_test
+TEST = eh_test.out
+
+CC = CC
+CXX = $(CC)
+
+CXXFLAGS = $(ARCHF) +w2 -mt -features=rtti ${STL_INCL}
+# CXXFLAGS = +w2 ${STL_INCL}
+
+
+
+LIBS = -lm
+
+LIBSTLPORT = -L../../lib -lstlport_sunpro42
+
+check: $(TEST)
+
+$(TEST) : $(OBJECTS)
+ echo 'Info: For CC 4.x, warnings from ld in the form "symbol `XXX' has differing sizes" are normal.'
+ $(CXX) $(CXXFLAGS) $(OBJECTS) ${LIBSTLPORT} $(LIBS) -o $(TEST_EXE)
+ LD_LIBRARY_PATH="../../lib:$(LD_LIBRARY_PATH)" ./$(TEST_EXE) -s 100
+
+SUFFIXES: .cpp.o.out.res
+
+%.o : %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -o $@
+
+%.i : %.cpp
+ $(CXX) $(CXXFLAGS) $< -E -H > $@
+
+%.out: %.cpp
+ $(CXX) $(CXXFLAGS) $< -c -USINGLE -DMAIN -g -o $*.o
+ $(CXX) $(CXXFLAGS) $*.o $(LIBSTLPORT) $(LIBS) -o $*
+ ./$* -q
+ -rm -f $*
+
+%.s: %.cpp
+ $(CXX) $(CXXFLAGS) -O4 -S -pto $< -o $@
+
+clean:
+ -rm -fr ${TEST_EXE} *.o *.rpo *.obj *.out core *~ Templates.DB SunWS_cache
+
+
+
+
+
+
diff --git a/test/eh/test.cpp b/test/eh/test.cpp
new file mode 100644
index 0000000..8994303
--- /dev/null
+++ b/test/eh/test.cpp
@@ -0,0 +1,42 @@
+ #include <iostream>
+ #include <set>
+ #include <vector>
+
+ template<class T>
+ inline void printElements(const T& coll, const char* msg = "")
+ {
+ typename T::const_iterator it;
+ std::cout << msg;
+ for(it = coll.begin(); it != coll.end(); ++it) {
+ std::cout << *it << ' ';
+ }
+ std::cout << std:: endl;
+ }
+
+ int main(int /* argc */, char** /* argv */)
+ {
+ std::set<int> set1, set2;
+ std::vector<int> aVector;
+
+ aVector.push_back(1);
+ aVector.push_back(1);
+
+ set1.insert(aVector.begin(), aVector.end());
+
+ set2.insert(1);
+ set2.insert(1);
+
+ printElements(aVector, "vector: ");
+ printElements(set1, "set1 : ");
+ printElements(set2, "set2 : ");
+
+ return 0;
+ }
+# if 0
+# include <iostream>
+main()
+{
+ // std::stringstream tstr;
+ std::cout<<"hello world\n";
+}
+# endif
diff --git a/test/eh/test_algo.cpp b/test/eh/test_algo.cpp
new file mode 100644
index 0000000..7ff905b
--- /dev/null
+++ b/test/eh/test_algo.cpp
@@ -0,0 +1,261 @@
+/***********************************************************************************
+ test_algo.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Tests.h"
+#include "LeakCheck.h"
+#include "SortClass.h"
+
+#if defined (EH_NEW_HEADERS)
+# include <algorithm>
+# include <cassert>
+#else
+# include <algo.h>
+# include <assert.h>
+#endif
+
+#if defined (EH_NEW_IOSTREAMS)
+# include <iostream>
+#else
+# include <iostream.h>
+#endif
+
+//
+// SortBuffer -- a buffer of SortClass objects that can be used to test sorting.
+//
+struct SortBuffer
+{
+ enum { kBufferSize = 100 };
+
+ SortClass* begin() { return items; }
+ const SortClass* begin() const { return items; }
+ SortClass* end() { return items + kBufferSize; }
+ const SortClass* end() const { return items + kBufferSize; }
+
+ // Sort each half of the buffer and reset the address of each element
+ // so that merge() can be tested for stability.
+ void PrepareMerge()
+ {
+ EH_STD::sort( begin(), begin() + ( end() - begin() )/2 );
+ EH_STD::sort( begin() + ( end() - begin() )/2, end() );
+ for ( SortClass* p = begin(); p != end(); p++ )
+ p->ResetAddress();
+ }
+
+ SortBuffer()
+ {
+ PrepareMerge();
+ }
+
+ SortBuffer( const SortBuffer& rhs )
+ {
+ SortClass* q = begin();
+ for ( const SortClass* p = rhs.begin() ; p != rhs.end(); p++,q++ )
+ *q = *p;
+ }
+
+private:
+ SortClass items[kBufferSize];
+};
+
+//
+// less_by_reference -- a functor for comparing objects against a
+// constant value.
+//
+template <class T>
+struct less_by_reference
+{
+ less_by_reference( const T& arg ) : fArg(arg) {}
+ bool operator()( const T& x ) const { return x < fArg; }
+private:
+ const T& fArg;
+};
+
+struct test_stable_partition
+{
+ test_stable_partition( const SortBuffer& buf )
+ : orig( buf ), partitionPoint(SortClass::kRange / 2) {
+ gTestController.SetCurrentTestName("stable_partition()");
+ }
+
+ void operator()( SortBuffer& buf ) const
+ {
+ less_by_reference<SortClass> throw_cmp( partitionPoint );
+
+ SortClass* d = EH_STD::stable_partition( buf.begin(), buf.end(), throw_cmp );
+
+ // Suppress warning about unused variable.
+ d;
+
+ // If we get here no exception occurred during the operation.
+ // Stop any potential failures that might occur during verification.
+ gTestController.CancelFailureCountdown();
+
+ // Prepare an array of counts of the occurrence of each value in
+ // the legal range.
+ unsigned counts[SortClass::kRange];
+ EH_STD::fill_n( counts, (int)SortClass::kRange, 0 );
+ for ( const SortClass *q = orig.begin(); q != orig.end(); q++ )
+ counts[ q->value() ]++;
+
+ less_by_reference<TestClass> cmp( partitionPoint );
+ for ( const SortClass* p = buf.begin(); p != buf.end(); p++ )
+ {
+ // Check that adjacent items with the same value haven't been
+ // reordered. This could be a more thorough test.
+ if ( p != buf.begin() && p->value() == p[-1].value() ) {
+ EH_ASSERT( p->GetAddress() > p[-1].GetAddress() );
+ }
+
+ // Check that the partitioning worked.
+ EH_ASSERT( (p < d) == cmp( *p ) );
+
+ // Decrement the appropriate count for each value.
+ counts[ p->value() ]--;
+ }
+
+ // Check that the values were only rearranged, and none were lost.
+ for ( unsigned j = 0; j < SortClass::kRange; j++ ) {
+ EH_ASSERT( counts[j] == 0 );
+ }
+ }
+
+private:
+ const SortBuffer& orig;
+ SortClass partitionPoint;
+};
+
+void assert_sorted_version( const SortBuffer& orig, const SortBuffer& buf );
+
+/*===================================================================================
+ assert_sorted_version
+
+ EFFECTS: Asserts that buf is a stable-sorted version of orig.
+====================================================================================*/
+void assert_sorted_version( const SortBuffer& orig, const SortBuffer& buf )
+{
+ // Stop any potential failures that might occur during verification.
+ gTestController.CancelFailureCountdown();
+
+ // Prepare an array of counts of the occurrence of each value in
+ // the legal range.
+ unsigned counts[SortClass::kRange];
+ EH_STD::fill_n( counts, (int)SortClass::kRange, 0 );
+ for ( const SortClass *q = orig.begin(); q != orig.end(); q++ )
+ counts[ q->value() ]++;
+
+ // Check that each element is greater than the previous one, or if they are
+ // equal, that their order has been preserved.
+ for ( const SortClass* p = buf.begin(); p != buf.end(); p++ )
+ {
+ if ( p != buf.begin() ) {
+ EH_ASSERT( p->value() > p[-1].value()
+ || p->value() == p[-1].value() && p->GetAddress() > p[-1].GetAddress() );
+ }
+ // Decrement the appropriate count for each value.
+ counts[ p->value() ]--;
+ }
+
+ // Check that the values were only rearranged, and none were lost.
+ for ( unsigned j = 0; j < SortClass::kRange; j++ ) {
+ EH_ASSERT( counts[j] == 0 );
+ }
+}
+
+//
+// The test operators
+//
+struct test_stable_sort_1
+{
+ test_stable_sort_1( const SortBuffer& buf )
+ : orig( buf ) {
+ gTestController.SetCurrentTestName("stable_sort() #1");
+ }
+
+ void operator()( SortBuffer& buf ) const
+ {
+ EH_STD::stable_sort( buf.begin(), buf.end() );
+ assert_sorted_version( orig, buf );
+ }
+
+private:
+ const SortBuffer& orig;
+};
+
+struct test_stable_sort_2
+{
+ test_stable_sort_2( const SortBuffer& buf )
+ : orig( buf ) {
+ gTestController.SetCurrentTestName("stable_sort() #2");
+ }
+
+ void operator()( SortBuffer& buf ) const
+ {
+ EH_STD::stable_sort( buf.begin(), buf.end(), EH_STD::less<SortClass>() );
+ assert_sorted_version( orig, buf );
+ }
+
+private:
+ const SortBuffer& orig;
+};
+
+struct test_inplace_merge_1
+{
+ test_inplace_merge_1( SortBuffer& buf )
+ : orig( buf ) {
+ gTestController.SetCurrentTestName("inplace_merge #1()");
+ }
+
+ void operator()( SortBuffer& buf ) const
+ {
+ EH_STD::inplace_merge( buf.begin(), buf.begin() + ( buf.end() - buf.begin() )/2, buf.end() );
+ assert_sorted_version( orig, buf );
+ }
+
+private:
+ const SortBuffer& orig;
+};
+
+struct test_inplace_merge_2
+{
+ test_inplace_merge_2( SortBuffer& buf )
+ : orig( buf ) {
+ gTestController.SetCurrentTestName("inplace_merge() #2");
+ }
+
+ void operator()( SortBuffer& buf ) const
+ {
+ EH_STD::inplace_merge( buf.begin(), buf.begin() + ( buf.end() - buf.begin() )/2, buf.end(),
+ EH_STD::less<SortClass>() );
+ assert_sorted_version( orig, buf );
+ }
+
+private:
+ const SortBuffer& orig;
+};
+
+void test_algo()
+{
+ SortBuffer mergeBuf;
+ mergeBuf.PrepareMerge();
+
+ EH_STD::cerr<<"EH test : testing algo.h"<<EH_STD::endl;
+ WeakCheck( mergeBuf, test_inplace_merge_1( mergeBuf ) );
+ WeakCheck( mergeBuf, test_inplace_merge_2( mergeBuf ) );
+
+ SortBuffer buf;
+ WeakCheck( buf, test_stable_sort_1( buf ) );
+ WeakCheck( buf, test_stable_sort_2( buf ) );
+ WeakCheck( buf, test_stable_partition( buf ) );
+}
diff --git a/test/eh/test_algobase.cpp b/test/eh/test_algobase.cpp
new file mode 100644
index 0000000..6db4929
--- /dev/null
+++ b/test/eh/test_algobase.cpp
@@ -0,0 +1,98 @@
+/***********************************************************************************
+ test_algobase.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+
+# include "Prefix.h"
+# if defined (EH_NEW_HEADERS)
+# ifdef __SUNPRO_CC
+# include <stdio.h>
+# endif
+#include <algorithm>
+# else
+#include <algo.h>
+# endif
+#include "Tests.h"
+#include "LeakCheck.h"
+#include "TestClass.h"
+
+// EH_USE_STD
+
+enum { kBufferSize = 100 };
+
+struct test_uninitialized_copy
+{
+ test_uninitialized_copy()
+ : stuff( new TestClass[kBufferSize] ), end_of_stuff(stuff + kBufferSize) {
+ gTestController.SetCurrentTestName("uninitialized_copy()");
+ }
+
+ ~test_uninitialized_copy() { delete[] stuff; }
+
+ void operator()( TestClass* buffer ) const
+ {
+ EH_STD::uninitialized_copy((TestClass*)stuff, (TestClass*)end_of_stuff, buffer );
+ EH_ASSERT( EH_STD::equal( (TestClass*)stuff, (TestClass*)end_of_stuff, buffer ) );
+ stl_destroy( buffer, buffer+kBufferSize );
+ }
+
+private:
+ TestClass * stuff;
+ TestClass * end_of_stuff;
+};
+
+struct test_uninitialized_fill
+{
+ test_uninitialized_fill() {
+ gTestController.SetCurrentTestName("uninitialized_fill()");
+ }
+
+ void operator()( TestClass* buffer ) const
+ {
+ TestClass* buf_end = buffer + kBufferSize;
+ EH_STD::uninitialized_fill( buffer, buf_end, testValue );
+ for ( EH_CSTD::size_t i = 0; i < kBufferSize; i++ )
+ EH_ASSERT( buffer[i] == testValue );
+ stl_destroy( buffer, buf_end );
+ }
+private:
+ TestClass testValue;
+};
+
+struct test_uninitialized_fill_n
+{
+ test_uninitialized_fill_n() {
+ gTestController.SetCurrentTestName("uninitialized_fill_n()");
+ }
+ void operator()( TestClass* buffer ) const
+ {
+ TestClass* end = buffer + kBufferSize;
+ EH_STD::uninitialized_fill_n( buffer, (EH_CSTD::size_t)kBufferSize, testValue );
+ for ( EH_CSTD::size_t i = 0; i < kBufferSize; i++ )
+ EH_ASSERT( buffer[i] == testValue );
+ stl_destroy( buffer, end );
+ }
+private:
+ TestClass testValue;
+};
+
+void test_algobase()
+{
+ // force alignment
+ double arr[ sizeof(TestClass) * kBufferSize ];
+ TestClass* c = (TestClass*)arr;
+ WeakCheck( c, test_uninitialized_copy() );
+ WeakCheck( c, test_uninitialized_fill() );
+ WeakCheck( c, test_uninitialized_fill_n() );
+}
diff --git a/test/eh/test_assign_op.h b/test/eh/test_assign_op.h
new file mode 100644
index 0000000..018e7c6
--- /dev/null
+++ b/test/eh/test_assign_op.h
@@ -0,0 +1,47 @@
+/***********************************************************************************
+ test_assign_op.h
+
+ SUMMARY: Test functor template for assignment operators.
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#ifndef test_assign_op_H_
+#define test_assign_op_H_
+
+#include "Prefix.h"
+#ifdef EH_NEW_HEADERS
+# include <cassert>
+#else
+# include <assert.h>
+#endif
+#include "nc_alloc.h"
+
+template <class T>
+struct test_assign_op {
+ test_assign_op( const T& src )
+ : source(src) {
+ gTestController.SetCurrentTestName("assignment operator");
+ }
+
+ void operator()( T& t ) const {
+ t = source;
+
+ // Prevent simulated failures during verification
+ gTestController.CancelFailureCountdown();
+ //EH_ASSERT( source == t );
+ }
+private:
+ const T& source;
+};
+
+#endif // test_assign_op_H_
diff --git a/test/eh/test_bit_vector.cpp b/test/eh/test_bit_vector.cpp
new file mode 100644
index 0000000..2b1121e
--- /dev/null
+++ b/test/eh/test_bit_vector.cpp
@@ -0,0 +1,129 @@
+/***********************************************************************************
+ test_bit_vector.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Tests.h"
+
+#if defined( EH_BIT_VECTOR_IMPLEMENTED )
+
+# if defined (EH_NEW_HEADERS)
+# ifdef __SUNPRO_CC
+# include <stdio.h>
+# endif
+#include <vector>
+# else
+#include <bvector.h>
+# endif
+
+#include "LeakCheck.h"
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+
+typedef EH_BIT_VECTOR BitVector;
+
+inline sequence_container_tag
+container_category(const BitVector&)
+{
+ return sequence_container_tag();
+}
+
+USING_CSTD_NAME(size_t)
+
+ //
+// test_BitVector_reserve
+//
+struct test_BitVector_reserve
+{
+ test_BitVector_reserve( size_t n ) : fAmount(n)
+ {
+ gTestController.SetCurrentTestName("BitVector::reserve()");
+ }
+
+ void operator()( BitVector& v ) const
+ {
+ v.reserve( fAmount );
+ }
+private:
+ size_t fAmount;
+};
+
+/*===================================================================================
+ test_bit_vector
+
+ EFFECTS: Performs tests on bit vectors
+====================================================================================*/
+void test_bit_vector()
+{
+#define __WORD_BIT (int(CHAR_BIT*sizeof(unsigned int)))
+
+ // Make some bit vectors to work with.
+ BitVector emptyVector;
+ BitVector testVector, testVector2;
+
+ EH_ASSERT( testVector.size() == 0 );
+
+ size_t BitVectorSize = random_number( random_base );
+ // Half the time, choose a size that will guarantee immediate reallocation
+ if ( random_number(2) )
+ BitVectorSize = BitVectorSize / __WORD_BIT * __WORD_BIT;
+
+ EH_ASSERT( testVector.size() == 0 );
+ testVector.reserve(BitVectorSize);
+ EH_ASSERT( testVector.size() == 0 );
+ while (testVector.size() < BitVectorSize) {
+ testVector.push_back(random_number(2) != 0);
+ testVector2.push_back(random_number(2) != 0);
+ }
+
+ // Test insertions
+ StrongCheck(testVector, test_insert_one<BitVector>(testVector) );
+ StrongCheck(testVector, test_insert_one<BitVector>(testVector,0) );
+ StrongCheck(testVector, test_insert_one<BitVector>(testVector, (int)testVector.size()) );
+
+ StrongCheck(testVector, test_insert_n<BitVector>(testVector, random_number(random_base) ) );
+ StrongCheck(testVector, test_insert_n<BitVector>(testVector, random_number(random_base),0 ) );
+ StrongCheck(testVector, test_insert_n<BitVector>(testVector, random_number(random_base), (int)testVector.size()) );
+#if 0
+ // Allocate some random bools to insert
+ size_t insCnt = 1 + random_number(random_base);
+ bool *insFirst = new BitVector::value_type[insCnt];
+ for (size_t n = 0; n < insCnt; n++)
+ insFirst[n] = random_number(2);
+ StrongCheck(testVector, insert_range_tester(testVector, insFirst, insFirst+insCnt));
+ StrongCheck(testVector, insert_range_at_begin_tester(testVector, insFirst, insFirst+insCnt));
+ StrongCheck(testVector, insert_range_at_end_tester(testVector, insFirst, insFirst+insCnt));
+ ConstCheck(0, test_construct_pointer_range<BitVector>( insFirst, insFirst + insCnt));
+ delete[] insFirst;
+#endif
+ StrongCheck(testVector, insert_range_tester(testVector, testVector2.begin(), testVector2.end()));
+ StrongCheck(testVector, insert_range_at_begin_tester(testVector, testVector2.begin(),
+ testVector2.end()));
+ StrongCheck(testVector, insert_range_at_end_tester(testVector, testVector2.begin(),
+ testVector2.end()));
+ StrongCheck(testVector, test_BitVector_reserve( testVector.capacity() + random_number(50)));
+ StrongCheck(testVector, test_push_back<BitVector>(testVector));
+ StrongCheck(emptyVector, test_push_back<BitVector>(emptyVector));
+
+ ConstCheck(0, test_default_construct<BitVector>());
+ ConstCheck(0, test_construct_n<BitVector>(random_number(random_base)));
+ ConstCheck(0, test_construct_n_instance<BitVector>(random_number(random_base)));
+ ConstCheck(0, test_construct_iter_range<BitVector>(testVector2));
+ ConstCheck(testVector, test_copy_construct<BitVector>() );
+ WeakCheck(testVector, test_assign_op<BitVector>(testVector2) );
+}
+
+# endif /* BIT_VECTOR_IMPLEMENTED */
diff --git a/test/eh/test_bitset.cpp b/test/eh/test_bitset.cpp
new file mode 100644
index 0000000..fd26f99
--- /dev/null
+++ b/test/eh/test_bitset.cpp
@@ -0,0 +1,39 @@
+/***********************************************************************************
+ test_bitset.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Prefix.h"
+#if defined( EH_BITSET_IMPLEMENTED )
+#include "Tests.h"
+#include <bitset>
+#include "TestClass.h"
+#include "LeakCheck.h"
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+
+typedef bitset<100> TestBitset;
+
+inline sequence_container_tag
+container_category(const TestBitset&)
+{
+ return sequence_container_tag();
+}
+
+void test_bitset()
+{
+}
+#endif // EH_BITSET_IMPLEMENTED
diff --git a/test/eh/test_construct.h b/test/eh/test_construct.h
new file mode 100644
index 0000000..a90003a
--- /dev/null
+++ b/test/eh/test_construct.h
@@ -0,0 +1,125 @@
+/***********************************************************************************
+ test_construct.h
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#ifndef test_construct_H_
+#define test_construct_H_
+
+#include "Prefix.h"
+#if defined (EH_NEW_HEADERS)
+# include <algorithm>
+# include <cassert>
+# include <cstdlib>
+#else
+# include <algo.h>
+# include <assert.h>
+# include <stdlib.h>
+#endif
+
+USING_CSTD_NAME(size_t)
+
+template <class T>
+struct test_copy_construct {
+ test_copy_construct() {
+ gTestController.SetCurrentTestName("copy constructor");
+ }
+
+ void operator()( const T& t ) const {
+ T aCopy( t );
+ // Prevent simulated failures during verification
+ gTestController.CancelFailureCountdown();
+ //EH_ASSERT( aCopy == t );
+ CheckInvariant(t);
+ }
+};
+
+template <class T>
+struct test_default_construct {
+ test_default_construct() {
+ gTestController.SetCurrentTestName("default constructor");
+ }
+
+ void operator()( int ) const {
+ T t;
+ CheckInvariant(t);
+ }
+};
+
+template <class T>
+struct test_construct_n {
+ test_construct_n( size_t _n ) : n(_n+1) {
+ gTestController.SetCurrentTestName("n-size constructor");
+ }
+
+ void operator()( int ) const {
+ T t(n);
+ CheckInvariant(t);
+ }
+
+ size_t n;
+};
+
+template <class T>
+struct test_construct_n_instance {
+ test_construct_n_instance( size_t _n ) : n(_n+1) {
+ gTestController.SetCurrentTestName("n-size with instance constructor");
+ }
+
+ void operator()( int ) const {
+ typedef typename T::value_type Value_type;
+ Value_type Val = 0;
+ T t( n, Val );
+ CheckInvariant(t);
+ }
+
+ size_t n;
+};
+
+template <class T>
+struct test_construct_pointer_range {
+ test_construct_pointer_range( const typename T::value_type *first,
+ const typename T::value_type* last )
+ : fItems( first ), fEnd( last ) {
+ gTestController.SetCurrentTestName("pointer range constructor");
+ }
+
+ void operator()( int ) const {
+ T t( fItems, fEnd );
+ // Prevent simulated failures during verification
+ gTestController.CancelFailureCountdown();
+ CheckInvariant(t);
+ }
+
+ const typename T::value_type* fItems, *fEnd;
+};
+
+template <class T>
+struct test_construct_iter_range {
+
+ test_construct_iter_range( const T& src ) : fItems( src ) {
+ gTestController.SetCurrentTestName("iterator range constructor");
+ }
+
+ void operator()( int ) const {
+ T t( fItems.begin(), fItems.end() );
+ // Prevent simulated failures during verification
+ gTestController.CancelFailureCountdown();
+ EH_ASSERT( t == fItems );
+ CheckInvariant(t);
+ }
+
+ const T& fItems;
+};
+
+#endif // test_construct_H_
diff --git a/test/eh/test_deque.cpp b/test/eh/test_deque.cpp
new file mode 100644
index 0000000..2a37756
--- /dev/null
+++ b/test/eh/test_deque.cpp
@@ -0,0 +1,95 @@
+/***********************************************************************************
+ test_deque.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+
+#include "Tests.h"
+# if defined (EH_NEW_HEADERS)
+# ifdef __SUNPRO_CC
+# include <stdio.h>
+# else
+# include <cstdio>
+# endif
+# include <deque>
+# else
+# include <stdio.h>
+# include <deque.h>
+# endif
+#include "TestClass.h"
+#include "LeakCheck.h"
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+
+typedef TestClass DQTestClass;
+
+typedef EH_STD::deque<DQTestClass, eh_allocator(DQTestClass) > TestDeque;
+
+inline sequence_container_tag
+container_category(const TestDeque&)
+{
+ return sequence_container_tag();
+}
+
+void test_deque()
+{
+ size_t dequeSize = random_number(random_base);
+ TestDeque emptyDeque;
+ TestDeque testDeque, testDeque2;
+ while ( testDeque.size() < dequeSize )
+ {
+ DQTestClass x;
+ testDeque.push_back( x );
+ testDeque2.push_back( DQTestClass() );
+ }
+
+ ConstCheck( testDeque, test_copy_construct<TestDeque>() );
+ WeakCheck( testDeque, test_insert_one<TestDeque>(testDeque) );
+ StrongCheck( testDeque, test_insert_one<TestDeque>(testDeque, 0) );
+ StrongCheck( testDeque, test_insert_one<TestDeque>(testDeque, (int)testDeque.size()) );
+
+ WeakCheck( testDeque, test_insert_n<TestDeque>(testDeque, random_number(random_base) ) );
+ StrongCheck( testDeque, test_insert_n<TestDeque>(testDeque, random_number(random_base), 0 ) );
+ StrongCheck( testDeque, test_insert_n<TestDeque>(testDeque, random_number(random_base), (int)testDeque.size() ) );
+
+ size_t insCnt = random_number(random_base);
+ DQTestClass *insFirst = new TestDeque::value_type[insCnt + 1];
+
+ WeakCheck( testDeque, insert_range_tester(testDeque, insFirst, insFirst + insCnt) );
+ StrongCheck( testDeque, insert_range_at_begin_tester(testDeque, insFirst, insFirst + insCnt) );
+ StrongCheck( testDeque, insert_range_at_end_tester(testDeque, insFirst, insFirst + insCnt) );
+
+ ConstCheck( 0, test_construct_pointer_range<TestDeque>(insFirst, insFirst + insCnt) );
+ delete[] insFirst;
+
+ WeakCheck( testDeque, insert_range_tester(testDeque, testDeque2.begin(), testDeque2.end() ) );
+
+ StrongCheck( testDeque, test_push_back<TestDeque>(testDeque) );
+ StrongCheck( emptyDeque, test_push_back<TestDeque>(emptyDeque) );
+ StrongCheck( testDeque, test_push_front<TestDeque>(testDeque) );
+ StrongCheck( emptyDeque, test_push_front<TestDeque>(emptyDeque) );
+
+
+ ConstCheck( 0, test_default_construct<TestDeque>() );
+ ConstCheck( 0, test_construct_n<TestDeque>( random_number(random_base) ) );
+ ConstCheck( 0, test_construct_n_instance<TestDeque>( random_number(random_base) ) );
+ ConstCheck( 0, test_construct_iter_range<TestDeque>( testDeque2 ) );
+
+ testDeque2.resize( testDeque.size() * 3 / 2 );
+ WeakCheck( testDeque, test_assign_op<TestDeque>( testDeque2 ) );
+ testDeque2.resize( testDeque.size() * 2 / 3 );
+ WeakCheck( testDeque, test_assign_op<TestDeque>( testDeque2 ) );
+}
diff --git a/test/eh/test_hash_map.cpp b/test/eh/test_hash_map.cpp
new file mode 100644
index 0000000..420bbb8
--- /dev/null
+++ b/test/eh/test_hash_map.cpp
@@ -0,0 +1,131 @@
+/***********************************************************************************
+ test_hash_map.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Tests.h"
+#if defined( EH_HASHED_CONTAINERS_IMPLEMENTED )
+#include "TestClass.h"
+#include "LeakCheck.h"
+
+# include <hash_map>
+
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+#include "ThrowCompare.h"
+#include "test_hash_resize.h"
+/*
+template struct pair<const TestClass, TestClass>;
+template struct __hashtable_node<pair<const TestClass, TestClass> >;
+template class hash_map<TestClass, TestClass, ThrowHash, ThrowEqual>;
+template class hash_multimap<TestClass, TestClass, ThrowHash, ThrowEqual>;
+*/
+
+typedef EH_STD::__hash_multimap__<TestClass, TestClass, ThrowHash, ThrowEqual,
+ eh_allocator(TestClass) > TestMultiMap;
+
+
+inline multimap_tag
+container_category(const TestMultiMap&) {
+ return multimap_tag();
+}
+
+void test_hash_multimap() {
+# if !(defined (_MSC_VER) && (_MSC_VER < 1100))
+ TestMultiMap testMultiMap, testMultiMap2;
+
+ const size_t hash_mapSize = random_number(random_base);
+
+ while ( testMultiMap.size() < hash_mapSize )
+ {
+ TestMultiMap::value_type x;
+ testMultiMap.insert( x );
+ testMultiMap2.insert( TestMultiMap::value_type() );
+ }
+
+# if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE )
+ WeakCheck( testMultiMap, test_hash_resize<TestMultiMap>() );
+ // TestMultiMap == TestMultiMap: no such operator! - ptr
+ // StrongCheck( testMultiMap, test_insert_noresize<TestMultiMap>(testMultiMap) );
+# endif
+ WeakCheck( testMultiMap, test_insert_value<TestMultiMap>(testMultiMap) );
+
+ size_t insCnt = random_number(random_base);
+ TestMultiMap::value_type *insFirst = new TestMultiMap::value_type[1+insCnt];
+ WeakCheck( testMultiMap, insert_range_tester(testMultiMap, insFirst, insFirst+insCnt) );
+ ConstCheck( 0, test_construct_pointer_range<TestMultiMap>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+
+ WeakCheck( testMultiMap, insert_range_tester(testMultiMap, testMultiMap2.begin(), testMultiMap2.end() ) );
+
+ ConstCheck( 0, test_default_construct<TestMultiMap>() );
+# if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION
+ ConstCheck( 0, test_construct_iter_range_n<TestMultiMap>( testMultiMap2 ) );
+# endif
+ ConstCheck( testMultiMap, test_copy_construct<TestMultiMap>() );
+
+ WeakCheck( testMultiMap, test_assign_op<TestMultiMap>( testMultiMap2 ) );
+# endif
+}
+
+typedef EH_STD::__hash_map__<TestClass, TestClass, ThrowHash,
+ ThrowEqual, eh_allocator(TestClass) > TestMap;
+
+inline map_tag
+container_category(const TestMap&)
+{
+ return map_tag();
+}
+
+void test_hash_map()
+{
+# if !(defined (_MSC_VER) && (_MSC_VER < 1100))
+ TestMap testMap, testMap2;
+
+ const size_t hash_mapSize = random_number(random_base);
+
+ while ( testMap.size() < hash_mapSize ) {
+ TestMap::value_type x;
+ testMap.insert( x );
+ testMap2.insert( TestMap::value_type() );
+ }
+
+#if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE )
+ WeakCheck( testMap, test_hash_resize<TestMap>() );
+ // TestMultiMap == TestMultiMap: no such operator! - ptr
+ // StrongCheck( testMap, test_insert_noresize<TestMap>(testMap) );
+#endif
+ WeakCheck( testMap, test_insert_value<TestMap>(testMap) );
+
+ size_t insCnt = random_number(random_base);
+ TestMap::value_type *insFirst = new TestMap::value_type[1+insCnt];
+ WeakCheck( testMap, insert_range_tester(testMap, insFirst, insFirst+insCnt) );
+ ConstCheck( 0, test_construct_pointer_range<TestMap>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+
+ WeakCheck( testMap, insert_range_tester(testMap, testMap2.begin(), testMap2.end() ) );
+
+ ConstCheck( 0, test_default_construct<TestMap>() );
+# if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION
+ ConstCheck( 0, test_construct_iter_range_n<TestMap>( testMap2 ) );
+# endif
+ ConstCheck( testMap, test_copy_construct<TestMap>() );
+
+ WeakCheck( testMap, test_assign_op<TestMap>( testMap2 ) );
+# endif
+}
+
+#endif // EH_HASHED_CONTAINERS_IMPLEMENTED
diff --git a/test/eh/test_hash_resize.h b/test/eh/test_hash_resize.h
new file mode 100644
index 0000000..d7beb3e
--- /dev/null
+++ b/test/eh/test_hash_resize.h
@@ -0,0 +1,56 @@
+/***********************************************************************************
+ test_hash_resize.h
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#ifndef test_hash_resize__
+#define test_hash_resize__
+
+#include "random_number.h"
+#include "nc_alloc.h"
+
+template <class T>
+struct test_hash_resize
+{
+ test_hash_resize()
+ {
+ gTestController.SetCurrentTestName("hash resize");
+ }
+
+ void operator()( T& t ) const
+ {
+ t.resize( 1+random_number(random_base) + t.bucket_count() );
+ }
+};
+
+template <class T>
+struct test_construct_iter_range_n
+{
+ test_construct_iter_range_n( const T& src )
+ : fItems( src )
+ {
+ gTestController.SetCurrentTestName("iterator range n-size constructor");
+ }
+
+ void operator()( int ) const
+ {
+ T t( fItems.begin(), fItems.end(), fItems.size() );
+ // prevent simulated failures during verification
+ gTestController.CancelFailureCountdown();
+ CheckInvariant(t);
+ }
+
+ const T& fItems;
+};
+
+#endif //__test_hash_resize__
diff --git a/test/eh/test_hash_set.cpp b/test/eh/test_hash_set.cpp
new file mode 100644
index 0000000..e4479e5
--- /dev/null
+++ b/test/eh/test_hash_set.cpp
@@ -0,0 +1,127 @@
+/***********************************************************************************
+ test_hash_set.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Tests.h"
+
+#if defined( EH_HASHED_CONTAINERS_IMPLEMENTED )
+
+# include <hash_set>
+
+#include "TestClass.h"
+#include "LeakCheck.h"
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+#include "ThrowCompare.h"
+#include "test_hash_resize.h"
+
+typedef EH_STD::__hash_multiset__<TestClass, ThrowHash, ThrowEqual,
+ eh_allocator(TestClass) > TestMultiSet;
+
+inline multiset_tag
+container_category(const TestMultiSet&)
+{
+ return multiset_tag();
+}
+
+void test_hash_multiset()
+{
+# if !(defined (_MSC_VER) && (_MSC_VER < 1100))
+ TestMultiSet testMultiSet, testMultiSet2;
+
+ const size_t hash_setSize = random_number(random_base);
+
+ while ( testMultiSet.size() < hash_setSize )
+ {
+ TestMultiSet::value_type x;
+ testMultiSet.insert( x );
+ testMultiSet2.insert( TestMultiSet::value_type() );
+ }
+
+# if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE )
+ WeakCheck( testMultiSet, test_hash_resize<TestMultiSet>() );
+ // TestMultiSet == TestMultiSet: no such operator! - ptr
+ // StrongCheck( testMultiSet, test_insert_noresize<TestMultiSet>(testMultiSet) );
+# endif
+ WeakCheck( testMultiSet, test_insert_value<TestMultiSet>(testMultiSet) );
+
+ size_t insCnt = random_number(random_base);
+ TestMultiSet::value_type *insFirst = new TestMultiSet::value_type[1+insCnt];
+ WeakCheck( testMultiSet, insert_range_tester(testMultiSet, insFirst, insFirst+insCnt) );
+ ConstCheck( 0, test_construct_pointer_range<TestMultiSet>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+
+ WeakCheck( testMultiSet, insert_range_tester(testMultiSet, testMultiSet2.begin(), testMultiSet2.end() ) );
+
+ ConstCheck( 0, test_default_construct<TestMultiSet>() );
+# if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION
+ ConstCheck( 0, test_construct_iter_range_n<TestMultiSet>( testMultiSet2 ) );
+# endif
+ ConstCheck( testMultiSet, test_copy_construct<TestMultiSet>() );
+
+ WeakCheck( testMultiSet, test_assign_op<TestMultiSet>( testMultiSet2 ) );
+# endif
+}
+
+typedef EH_STD::__hash_set__<TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestSet;
+
+inline set_tag
+container_category(const TestSet&)
+{
+ return set_tag();
+}
+
+void test_hash_set()
+{
+# if !(defined (_MSC_VER) && (_MSC_VER < 1100))
+ TestSet testSet, testSet2;
+
+ const size_t hash_setSize = random_number(random_base);
+
+ while ( testSet.size() < hash_setSize )
+ {
+ TestSet::value_type x;
+ testSet.insert( x );
+ testSet2.insert( TestSet::value_type() );
+ }
+
+# if defined( EH_HASH_CONTAINERS_SUPPORT_RESIZE )
+ WeakCheck( testSet, test_hash_resize<TestSet>() );
+ // TestMultiSet == TestMultiSet: no such operator! - ptr
+ // StrongCheck( testSet, test_insert_noresize<TestSet>(testSet) );
+# endif
+ WeakCheck( testSet, test_insert_value<TestSet>(testSet) );
+
+ size_t insCnt = random_number(random_base);
+ TestSet::value_type *insFirst = new TestSet::value_type[1+insCnt];
+ WeakCheck( testSet, insert_range_tester(testSet, insFirst, insFirst+insCnt) );
+ ConstCheck( 0, test_construct_pointer_range<TestSet>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+
+ WeakCheck( testSet, insert_range_tester(testSet, testSet2.begin(), testSet2.end() ) );
+
+ ConstCheck( 0, test_default_construct<TestSet>() );
+# if EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION
+ ConstCheck( 0, test_construct_iter_range_n<TestSet>( testSet2 ) );
+# endif
+ ConstCheck( testSet, test_copy_construct<TestSet>() );
+
+ WeakCheck( testSet, test_assign_op<TestSet>( testSet2 ) );
+# endif
+}
+
+#endif // EH_HASHED_CONTAINERS_IMPLEMENTED
diff --git a/test/eh/test_insert.h b/test/eh/test_insert.h
new file mode 100644
index 0000000..cd56a5f
--- /dev/null
+++ b/test/eh/test_insert.h
@@ -0,0 +1,552 @@
+/***********************************************************************************
+ test_insert.h
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#ifndef test_insert_H_
+#define test_insert_H_
+
+# include "Prefix.h"
+# if defined (EH_NEW_HEADERS)
+# include <utility>
+# include <vector>
+# include <cassert>
+# include <climits>
+# else
+# include <vector.h>
+# include <assert.h>
+# include <limits.h>
+# endif
+#include "random_number.h"
+#include "nc_alloc.h"
+#include "ThrowCompare.h"
+
+// A classification system for containers, for verification
+struct container_tag {};
+struct sequence_container_tag {};
+struct associative_container_tag {};
+
+struct set_tag {};
+struct multiset_tag {};
+struct map_tag {};
+struct multimap_tag {};
+
+template <class C, class Iter>
+size_t CountNewItems( const C&, const Iter& firstNew,
+ const Iter& lastNew, sequence_container_tag )
+{
+ size_t dist = 0;
+#if 0 //def __SUNPRO_CC
+ EH_DISTANCE( firstNew, lastNew, dist );
+#else
+ EH_DISTANCE( Iter(firstNew), Iter(lastNew), dist );
+#endif
+ return dist;
+}
+
+template <class C, class Iter>
+size_t CountNewItems( const C& c, const Iter& firstNew,
+ const Iter& lastNew, multimap_tag )
+{
+ return CountNewItems( c, firstNew, lastNew, sequence_container_tag() );
+}
+
+template <class C, class Iter>
+size_t CountNewItems( const C& c, const Iter& firstNew,
+ const Iter& lastNew, multiset_tag )
+{
+ return CountNewItems( c, firstNew, lastNew, sequence_container_tag() );
+}
+
+
+template <class C, class Iter, class KeyOfValue>
+#ifdef __BORLANDC__
+size_t CountUniqueItems_Aux( const C& original, const Iter& firstNew,
+#else
+size_t CountUniqueItems_Aux( const C& original, Iter firstNew,
+#endif
+ Iter lastNew, const KeyOfValue& keyOfValue )
+{
+ typedef typename C::key_type key;
+ typedef typename C::const_iterator const_iter;
+ typedef EH_STD::vector<key> key_list;
+ typedef typename key_list::iterator key_iterator;
+ key_list keys;
+ size_t dist = 0;
+#ifdef __SUNPRO_CC
+ EH_DISTANCE( firstNew, lastNew, dist );
+#else
+ EH_DISTANCE( Iter(firstNew), Iter(lastNew), dist );
+#endif
+ keys.reserve( dist );
+ for ( Iter x = firstNew; x != lastNew; ++x )
+ keys.push_back( keyOfValue(*x) );
+
+ EH_STD::sort( keys.begin(), keys.end() );
+ key_iterator last = EH_STD::unique( keys.begin(), keys.end() );
+
+ size_t cnt = 0;
+ for ( key_iterator tmp = keys.begin(); tmp != last; ++tmp )
+ {
+ if ( const_iter(original.find( *tmp )) == const_iter(original.end()) )
+ ++cnt;
+ }
+ return cnt;
+}
+
+#if ! defined (__SGI_STL)
+EH_BEGIN_NAMESPACE
+template <class T>
+struct identity
+{
+ const T& operator()( const T& x ) const { return x; }
+};
+# if ! defined (__KCC)
+template <class _Pair>
+struct select1st : public unary_function<_Pair, typename _Pair::first_type> {
+ const typename _Pair::first_type& operator()(const _Pair& __x) const {
+ return __x.first;
+ }
+};
+# endif
+EH_END_NAMESPACE
+#endif
+
+template <class C, class Iter>
+size_t CountUniqueItems( const C& original, const Iter& firstNew,
+ const Iter& lastNew, set_tag )
+{
+ typedef typename C::value_type value_type;
+ return CountUniqueItems_Aux( original, firstNew, lastNew,
+ EH_STD::identity<value_type>() );
+}
+
+template <class C, class Iter>
+size_t CountUniqueItems( const C& original, const Iter& firstNew,
+ const Iter& lastNew, map_tag )
+{
+#ifdef EH_MULTI_CONST_TEMPLATE_ARG_BUG
+ return CountUniqueItems_Aux( original, firstNew, lastNew,
+ EH_SELECT1ST_HINT<C::value_type, C::key_type>() );
+#else
+ typedef typename C::value_type value_type;
+ return CountUniqueItems_Aux( original, firstNew, lastNew,
+ EH_STD::select1st<value_type>() );
+#endif
+}
+
+template <class C, class Iter>
+size_t CountNewItems( const C& original, const Iter& firstNew,
+ const Iter& lastNew, map_tag )
+{
+ return CountUniqueItems( original, firstNew, lastNew,
+ container_category( original ) );
+}
+
+template <class C, class Iter>
+size_t CountNewItems( const C& original, const Iter& firstNew,
+ const Iter& lastNew, set_tag )
+{
+ return CountUniqueItems( original, firstNew, lastNew,
+ container_category( original ) );
+}
+
+template <class C, class SrcIter>
+inline void VerifyInsertion( const C& original, const C& result,
+ const SrcIter& firstNew, const SrcIter& lastNew,
+ size_t, associative_container_tag )
+{
+ typedef typename C::const_iterator DstIter;
+ DstIter first1 = original.begin();
+ DstIter first2 = result.begin();
+
+ DstIter* from_orig = new DstIter[original.size()];
+ DstIter* last_from_orig = from_orig;
+
+ // fbp : for hashed containers, the following is needed :
+ while ( first2 != result.end() )
+ {
+ EH_STD::pair<DstIter, DstIter> p = EH_STD::mismatch( first1, original.end(), first2 );
+ if ( p.second != result.end() )
+ {
+ SrcIter srcItem = EH_STD::find( SrcIter(firstNew), SrcIter(lastNew), *p.second );
+
+ if (srcItem == lastNew)
+ {
+ // not found in input range, probably re-ordered from the orig
+ DstIter* tmp;
+ tmp = EH_STD::find( from_orig, last_from_orig, p.first );
+
+ // if already here, exclude
+ if (tmp != last_from_orig)
+ {
+ EH_STD::copy(tmp+1, last_from_orig, tmp);
+ last_from_orig--;
+ }
+ else
+ {
+ // register re-ordered element
+ DstIter dstItem;
+ dstItem = EH_STD::find( first1, original.end(), *p.first );
+ EH_ASSERT( dstItem != original.end() );
+ *last_from_orig = dstItem;
+ last_from_orig++;
+ ++p.first;
+ }
+ }
+ ++p.second;
+ }
+ first1 = p.first;
+ first2 = p.second;
+ }
+
+ delete [] from_orig;
+}
+
+// VC++
+template <class C, class SrcIter>
+inline void VerifyInsertion(
+ const C& original, const C& result, const SrcIter& firstNew,
+ const SrcIter& lastNew, size_t, set_tag )
+{
+ VerifyInsertion( original, result, firstNew, lastNew,
+ size_t(0), associative_container_tag() );
+}
+
+template <class C, class SrcIter>
+inline void VerifyInsertion(const C& original, const C& result,
+ const SrcIter& firstNew, const SrcIter& lastNew,
+ size_t, multiset_tag )
+{
+ VerifyInsertion( original, result, firstNew, lastNew,
+ size_t(0), associative_container_tag() );
+}
+
+template <class C, class SrcIter>
+inline void VerifyInsertion(
+ const C& original, const C& result, const SrcIter& firstNew,
+ const SrcIter& lastNew, size_t, map_tag )
+{
+ VerifyInsertion( original, result, firstNew, lastNew,
+ size_t(0), associative_container_tag() );
+}
+
+template <class C, class SrcIter>
+inline void VerifyInsertion(
+ const C& original, const C& result, const SrcIter& firstNew,
+ const SrcIter& lastNew, size_t, multimap_tag )
+{
+ VerifyInsertion( original, result, firstNew, lastNew,
+ size_t(0), associative_container_tag() );
+}
+
+template <class C, class SrcIter>
+void VerifyInsertion(
+# ifdef _MSC_VER
+ const C& original, const C& result, SrcIter firstNew,
+ SrcIter lastNew, size_t insPos, sequence_container_tag )
+# else
+ const C& original, const C& result, const SrcIter& firstNew,
+ const SrcIter& lastNew, size_t insPos, sequence_container_tag )
+# endif
+{
+ typename C::const_iterator p1 = original.begin();
+ typename C::const_iterator p2 = result.begin();
+ SrcIter tmp(firstNew);
+
+ for ( size_t n = 0; n < insPos; n++, ++p1, ++p2)
+ EH_ASSERT( *p1 == *p2 );
+
+ for (; tmp != lastNew; ++p2, ++tmp ) {
+ EH_ASSERT(p2 != result.end());
+ EH_ASSERT(*p2 == *tmp);
+ }
+
+ for (; p2 != result.end(); ++p1, ++p2 )
+ EH_ASSERT( *p1 == *p2 );
+ EH_ASSERT( p1 == original.end() );
+}
+
+template <class C, class SrcIter>
+inline void VerifyInsertion( const C& original, const C& result,
+ const SrcIter& firstNew,
+ const SrcIter& lastNew, size_t insPos )
+{
+ EH_ASSERT( result.size() == original.size() +
+ CountNewItems( original, firstNew, lastNew,
+ container_category(original) ) );
+ VerifyInsertion( original, result, firstNew, lastNew, insPos,
+ container_category(original) );
+}
+
+template <class C, class Value>
+void VerifyInsertN( const C& original, const C& result, size_t insCnt,
+ const Value& val, size_t insPos )
+{
+ typename C::const_iterator p1 = original.begin();
+ typename C::const_iterator p2 = result.begin();
+ (void)val; //*TY 02/06/2000 - to suppress unused variable warning under nondebug build
+
+ for ( size_t n = 0; n < insPos; n++ )
+ EH_ASSERT( *p1++ == *p2++ );
+
+ while ( insCnt-- > 0 )
+ {
+ EH_ASSERT(p2 != result.end());
+ EH_ASSERT(*p2 == val );
+ ++p2;
+ }
+
+ while ( p2 != result.end() ) {
+ EH_ASSERT( *p1 == *p2 );
+ ++p1; ++p2;
+ }
+ EH_ASSERT( p1 == original.end() );
+}
+
+template <class C>
+void prepare_insert_n( C&, size_t ) {}
+
+// Metrowerks 1.8 compiler requires that specializations appear first (!!)
+// or it won't call them. Fixed in 1.9, though.
+inline void MakeRandomValue(bool& b) { b = bool(random_number(2) != 0); }
+
+template<class T>
+inline void MakeRandomValue(T&) {}
+
+template <class C>
+struct test_insert_one
+{
+ test_insert_one( const C& orig, int pos =-1 )
+ : original( orig ), fPos( random_number( orig.size() ))
+ {
+ MakeRandomValue( fInsVal );
+ if ( pos != -1 )
+ {
+ fPos = size_t(pos);
+ if ( pos == 0 )
+ gTestController.SetCurrentTestName("single insertion at begin()");
+ else
+ gTestController.SetCurrentTestName("single insertion at end()");
+ }
+ else
+ gTestController.SetCurrentTestName("single insertion at random position");
+ }
+
+ void operator()( C& c ) const
+ {
+ prepare_insert_n( c, (size_t)1 );
+ typename C::iterator pos = c.begin();
+ EH_STD::advance( pos, size_t(fPos) );
+ c.insert( pos, fInsVal );
+
+ // Prevent simulated failures during verification
+ gTestController.CancelFailureCountdown();
+ // Success. Check results.
+ VerifyInsertion( original, c, &fInsVal, 1+&fInsVal, fPos );
+ }
+private:
+ typename C::value_type fInsVal;
+ const C& original;
+ size_t fPos;
+};
+
+template <class C>
+struct test_insert_n
+{
+ test_insert_n( const C& orig, size_t insCnt, int pos =-1 )
+ : original( orig ), fPos( random_number( orig.size() )), fInsCnt(insCnt)
+ {
+ MakeRandomValue( fInsVal );
+ if (pos!=-1)
+ {
+ fPos=size_t(pos);
+ if (pos==0)
+ gTestController.SetCurrentTestName("n-ary insertion at begin()");
+ else
+ gTestController.SetCurrentTestName("n-ary insertion at end()");
+ }
+ else
+ gTestController.SetCurrentTestName("n-ary insertion at random position");
+ }
+
+ void operator()( C& c ) const
+ {
+ prepare_insert_n( c, fInsCnt );
+ typename C::iterator pos = c.begin();
+ EH_STD::advance( pos, fPos );
+ c.insert( pos, fInsCnt, fInsVal );
+
+ // Prevent simulated failures during verification
+ gTestController.CancelFailureCountdown();
+ // Success. Check results.
+ VerifyInsertN( original, c, fInsCnt, fInsVal, fPos );
+ }
+private:
+ typename C::value_type fInsVal;
+ const C& original;
+ size_t fPos;
+ size_t fInsCnt;
+};
+
+template <class C>
+struct test_insert_value
+{
+ test_insert_value( const C& orig )
+ : original( orig )
+ {
+ MakeRandomValue( fInsVal );
+ gTestController.SetCurrentTestName("insertion of random value");
+ }
+
+ void operator()( C& c ) const
+ {
+ c.insert( fInsVal );
+
+ // Prevent simulated failures during verification
+ gTestController.CancelFailureCountdown();
+ // Success. Check results.
+ VerifyInsertion( original, c, &fInsVal, 1+&fInsVal, size_t(0) );
+ }
+private:
+ typename C::value_type fInsVal;
+ const C& original;
+};
+
+template <class C>
+struct test_insert_noresize
+{
+ test_insert_noresize( const C& orig )
+ : original( orig )
+ {
+ MakeRandomValue( fInsVal );
+ gTestController.SetCurrentTestName("insertion of random value without resize");
+ }
+
+ void operator()( C& c ) const
+ {
+ c.insert_noresize( fInsVal );
+
+ // Prevent simulated failures during verification
+ gTestController.CancelFailureCountdown();
+ // Success. Check results.
+ VerifyInsertion( original, c, &fInsVal, 1+&fInsVal, size_t(0) );
+ }
+private:
+ typename C::value_type fInsVal;
+ const C& original;
+};
+
+template <class C, class Position, class Iter>
+void do_insert_range( C& c_inst, Position offset,
+ Iter first, Iter last, sequence_container_tag )
+{
+ typedef typename C::iterator CIter;
+ CIter pos = c_inst.begin();
+ EH_STD::advance( pos, offset );
+ c_inst.insert( pos, first, last );
+}
+
+template <class C, class Position, class Iter>
+void do_insert_range( C& c, Position,
+ Iter first, Iter last, associative_container_tag )
+{
+ c.insert( first, last );
+}
+
+template <class C, class Position, class Iter>
+void do_insert_range( C& c, Position, Iter first, Iter last, multiset_tag )
+{
+ c.insert( first, last );
+}
+
+template <class C, class Position, class Iter>
+void do_insert_range( C& c, Position, Iter first, Iter last, multimap_tag )
+{
+ c.insert( first, last );
+}
+
+template <class C, class Position, class Iter>
+void do_insert_range( C& c, Position, Iter first, Iter last, set_tag )
+{
+ c.insert( first, last );
+}
+
+template <class C, class Position, class Iter>
+void do_insert_range( C& c, Position, Iter first, Iter last, map_tag )
+{
+ c.insert( first, last );
+}
+
+/*
+template <class C, class Iter>
+void prepare_insert_range( C&, size_t, Iter, Iter) {}
+*/
+
+template <class C, class Iter>
+struct test_insert_range
+{
+ test_insert_range( const C& orig, Iter first, Iter last, int pos=-1 )
+ : fFirst( first ),
+ fLast( last ),
+ original( orig ),
+ fPos( random_number( orig.size() ))
+ {
+ gTestController.SetCurrentTestName("range insertion");
+ if ( pos != -1 )
+ {
+ fPos = size_t(pos);
+ if ( pos == 0 )
+ gTestController.SetCurrentTestName("range insertion at begin()");
+ else
+ gTestController.SetCurrentTestName("range insertion at end()");
+ }
+ else
+ gTestController.SetCurrentTestName("range insertion at random position");
+ }
+
+ void operator()( C& c ) const
+ {
+// prepare_insert_range( c, fPos, fFirst, fLast );
+ do_insert_range( c, fPos, fFirst, fLast, container_category(c) );
+
+ // Prevent simulated failures during verification
+ gTestController.CancelFailureCountdown();
+ // Success. Check results.
+ VerifyInsertion( original, c, fFirst, fLast, fPos );
+ }
+private:
+ Iter fFirst, fLast;
+ const C& original;
+ size_t fPos;
+};
+
+template <class C, class Iter>
+test_insert_range<C, Iter> insert_range_tester( const C& orig, const Iter& first, const Iter& last )
+{
+ return test_insert_range<C, Iter>( orig, first, last );
+}
+
+template <class C, class Iter>
+test_insert_range<C, Iter> insert_range_at_begin_tester( const C& orig, const Iter& first, const Iter& last )
+{
+ return test_insert_range<C, Iter>( orig, first, last , 0);
+}
+
+template <class C, class Iter>
+test_insert_range<C, Iter> insert_range_at_end_tester( const C& orig, const Iter& first, const Iter& last )
+{
+ return test_insert_range<C, Iter>( orig, first, last , (int)orig.size());
+}
+
+#endif // test_insert_H_
diff --git a/test/eh/test_list.cpp b/test/eh/test_list.cpp
new file mode 100644
index 0000000..e6375c5
--- /dev/null
+++ b/test/eh/test_list.cpp
@@ -0,0 +1,108 @@
+/***********************************************************************************
+ test_list.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Tests.h"
+#include "TestClass.h"
+#include "LeakCheck.h"
+# if defined (EH_NEW_HEADERS)
+#include <list>
+#else
+#include <list.h>
+#endif
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+#include "nc_alloc.h"
+
+typedef EH_STD::__list__<TestClass, eh_allocator(TestClass) > TestList;
+
+inline sequence_container_tag
+container_category(const TestList&)
+{
+ return sequence_container_tag();
+}
+
+//
+// list sort() member test operation. Does not verify stability.
+//
+struct test_list_sort
+{
+ test_list_sort()
+ {
+ gTestController.SetCurrentTestName("list::sort()");
+ }
+
+ void operator()( TestList& list ) const
+ {
+ list.sort();
+
+ gTestController.CancelFailureCountdown();
+
+ for ( TestList::iterator p = list.begin(); p != list.end(); p++ )
+ if ( p != list.begin() ) {
+ TestList::iterator tmp=p;
+ --tmp;
+ EH_ASSERT( *p >= *tmp );
+ }
+ }
+};
+
+void test_list()
+{
+ TestList testList, testList2;
+ size_t listSize = random_number(random_base);
+
+ while ( testList.size() < listSize )
+ {
+ TestClass x;
+ testList.push_back( x );
+ testList2.push_back( TestClass() );
+ }
+
+ StrongCheck( testList, test_insert_one<TestList>(testList) );
+ StrongCheck( testList, test_insert_one<TestList>(testList, 0) );
+ StrongCheck( testList, test_insert_one<TestList>(testList, (int)testList.size()) );
+
+ WeakCheck( testList, test_insert_n<TestList>(testList, random_number(random_base) ) );
+ WeakCheck( testList, test_insert_n<TestList>(testList, random_number(random_base), 0 ) );
+ WeakCheck( testList, test_insert_n<TestList>(testList, random_number(random_base), (int)testList.size() ) );
+
+ size_t insCnt = random_number(random_base);
+ TestClass *insFirst = new TestList::value_type[1+insCnt];
+
+ WeakCheck( testList, insert_range_tester(testList, insFirst, insFirst+insCnt) );
+ WeakCheck( testList, insert_range_at_begin_tester(testList, insFirst, insFirst+insCnt) );
+ WeakCheck( testList, insert_range_at_end_tester(testList, insFirst, insFirst+insCnt) );
+
+ ConstCheck( 0, test_construct_pointer_range<TestList>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+
+ WeakCheck( testList, insert_range_tester(testList, testList2.begin(), testList2.end() ) );
+
+ StrongCheck( testList, test_push_front<TestList>(testList) );
+ StrongCheck( testList, test_push_back<TestList>(testList) );
+
+ StrongCheck( testList, test_list_sort() ); // Simply to verify strength.
+
+ ConstCheck( 0, test_default_construct<TestList>() );
+ ConstCheck( 0, test_construct_n<TestList>( random_number(random_base) ) );
+ ConstCheck( 0, test_construct_n_instance<TestList>( random_number(random_base) ) );
+ ConstCheck( 0, test_construct_iter_range<TestList>( testList2 ) );
+ ConstCheck( testList, test_copy_construct<TestList>() );
+
+ WeakCheck( testList, test_assign_op<TestList>( testList2 ) );
+}
diff --git a/test/eh/test_map.cpp b/test/eh/test_map.cpp
new file mode 100644
index 0000000..9678b17
--- /dev/null
+++ b/test/eh/test_map.cpp
@@ -0,0 +1,127 @@
+/***********************************************************************************
+ test_map.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Tests.h"
+#include "TestClass.h"
+#include "LeakCheck.h"
+# if defined (EH_NEW_HEADERS)
+#include <map>
+# else
+#include <multimap.h>
+#include <map.h>
+# endif
+
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+#include "ThrowCompare.h"
+#include "test_insert.h"
+
+template <class K, class V, class Comp, class A>
+inline multimap_tag
+container_category(const EH_STD::__multimap__<K,V,Comp, A>&)
+{
+ return multimap_tag();
+}
+
+template <class K, class V, class Comp, class A >
+inline map_tag
+container_category(const EH_STD::__map__<K,V,Comp, A>&)
+{
+ return map_tag();
+}
+
+typedef EH_STD::__multimap__<TestClass, TestClass, ThrowCompare, eh_allocator(TestClass) > TestMultiMap;
+
+void test_multimap()
+{
+ TestMultiMap testMultiMap, testMultiMap2;
+
+ const size_t mapSize = random_number(random_base);
+
+ while ( testMultiMap.size() < mapSize )
+ {
+ TestMultiMap::value_type x;
+ testMultiMap.insert( x );
+ testMultiMap2.insert( TestMultiMap::value_type() );
+ }
+
+ StrongCheck( testMultiMap, test_insert_value<TestMultiMap>(testMultiMap) );
+
+ size_t insCnt = 1 + random_number(random_base);
+ TestMultiMap::value_type *insFirst = new TestMultiMap::value_type[insCnt];
+
+ WeakCheck( testMultiMap, insert_range_tester(testMultiMap, insFirst, insFirst+insCnt) );
+
+ ConstCheck( 0, test_construct_pointer_range<TestMultiMap>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+
+
+ WeakCheck( testMultiMap, insert_range_tester(testMultiMap, testMultiMap2.begin(), testMultiMap2.end() ) );
+
+
+ ConstCheck( 0, test_default_construct<TestMultiMap>() );
+
+ ConstCheck( 0, test_construct_iter_range<TestMultiMap>( testMultiMap2 ) );
+
+ ConstCheck( testMultiMap, test_copy_construct<TestMultiMap>() );
+
+ WeakCheck( testMultiMap, test_assign_op<TestMultiMap>( testMultiMap2 ) );
+}
+
+typedef EH_STD::__map__<TestClass, TestClass, ThrowCompare, eh_allocator(TestClass) > TestMap;
+
+void CheckInvariant( const TestMap& m );
+
+void CheckInvariant( const TestMap& m )
+{
+// assert( map.__rb_verify() );
+ size_t total = 0;
+ EH_DISTANCE( m.begin(), m.end(), total );
+ assert( m.size() == total );
+}
+
+void test_map()
+{
+ TestMap testMap, testMap2;
+
+ const size_t mapSize = random_number(random_base);
+
+ while ( testMap.size() < mapSize )
+ {
+ TestMap::value_type x;
+ testMap.insert( x );
+ testMap2.insert( TestMap::value_type() );
+ }
+
+ StrongCheck( testMap, test_insert_value<TestMap>(testMap) );
+
+ size_t insCnt = random_number(random_base);
+ TestMap::value_type *insFirst = new TestMap::value_type[1+insCnt];
+
+ WeakCheck( testMap, insert_range_tester(testMap, insFirst, insFirst+insCnt) );
+
+ ConstCheck( 0, test_construct_pointer_range<TestMap>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+
+ WeakCheck( testMap, insert_range_tester(testMap, testMap2.begin(), testMap2.end() ) );
+ ConstCheck( 0, test_default_construct<TestMap>() );
+ ConstCheck( 0, test_construct_iter_range<TestMap>( testMap2 ) );
+ ConstCheck( testMap, test_copy_construct<TestMap>() );
+ WeakCheck( testMap, test_assign_op<TestMap>( testMap2 ) );
+}
+
diff --git a/test/eh/test_push_back.h b/test/eh/test_push_back.h
new file mode 100644
index 0000000..e4e3b6e
--- /dev/null
+++ b/test/eh/test_push_back.h
@@ -0,0 +1,50 @@
+/***********************************************************************************
+ test_push_back.h
+
+ Interface for the test_push_back class
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#ifndef test_push_back_H_
+#define test_push_back_H_
+# ifdef EH_NEW_HEADERS
+# include <cassert>
+# else
+# include <assert.h>
+# endif
+
+# include "Prefix.h"
+#include "nc_alloc.h"
+
+template <class C>
+struct test_push_back
+{
+ test_push_back( const C& orig ) : original( orig )
+ {
+ gTestController.SetCurrentTestName("push_back() method");
+ }
+
+ void operator()( C& c ) const
+ {
+ typedef typename C::value_type _value_type;
+ c.push_back(_value_type() );
+ // Prevent simulated failures during verification
+ gTestController.CancelFailureCountdown();
+ EH_ASSERT( c.size() == original.size() + 1 );
+ EH_ASSERT( EH_STD::equal( original.begin(), original.end(), c.begin() ) );
+ }
+private:
+ const C& original;
+};
+
+#endif // test_push_back_H_
diff --git a/test/eh/test_push_front.h b/test/eh/test_push_front.h
new file mode 100644
index 0000000..feff911
--- /dev/null
+++ b/test/eh/test_push_front.h
@@ -0,0 +1,46 @@
+/***********************************************************************************
+ test_push_front.h
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#ifndef test_push_front_H_
+#define test_push_front_H_
+
+# if defined (EH_NEW_HEADERS)
+# include <cassert>
+# else
+# include <assert.h>
+# endif
+# include "Prefix.h"
+
+template <class C>
+struct test_push_front
+{
+ test_push_front( const C& orig ) : original( orig ) {
+ gTestController.SetCurrentTestName("push_front() method");
+ }
+
+ void operator()( C& c ) const
+ {
+ typedef typename C::value_type _value_type;
+ c.push_front( _value_type() );
+ EH_ASSERT( c.size() == original.size() + 1 );
+ typename C::const_iterator next = c.begin();
+
+ EH_ASSERT( EH_STD::equal( original.begin(), original.end(), ++next ) );
+ }
+private:
+ const C& original;
+};
+
+#endif // test_push_front_H_
diff --git a/test/eh/test_rope.cpp b/test/eh/test_rope.cpp
new file mode 100644
index 0000000..33f89cb
--- /dev/null
+++ b/test/eh/test_rope.cpp
@@ -0,0 +1,99 @@
+/***********************************************************************************
+ test_rope.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+
+# ifdef __SUNPRO_CC
+# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1
+# endif
+
+#include "Prefix.h"
+#include "Tests.h"
+#include "TestClass.h"
+#include "LeakCheck.h"
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+
+#if defined( EH_ROPE_IMPLEMENTED )
+#if !( defined(__MWERKS__) && __MWERKS__ < 0x1900 ) // CW1.8 can't compile this!
+# define __STD_STUFF 1
+# if defined (EH_NEW_HEADERS)
+#include <rope>
+#else
+#include <rope.h>
+#endif
+
+
+typedef STLPORT::rope<char, eh_allocator(char) > TestRope;
+
+inline sequence_container_tag
+container_category(const TestRope&)
+{
+ return sequence_container_tag();
+}
+
+void test_rope()
+{
+ TestRope testRope, testRope2;
+ size_t ropeSize = random_number(random_base);
+
+ while ( testRope.size() < ropeSize )
+ {
+ TestRope::value_type x = TestRope::value_type(random_number(random_base)); // initialize before use
+ testRope.push_back( x );
+ testRope2.push_back( TestRope::value_type() );
+ }
+ WeakCheck( testRope, test_insert_one<TestRope>(testRope) );
+ WeakCheck( testRope, test_insert_one<TestRope>(testRope, 0) );
+ WeakCheck( testRope, test_insert_one<TestRope>(testRope, (int)testRope.size()) );
+
+ WeakCheck( testRope, test_insert_n<TestRope>(testRope, random_number(random_base) ) );
+ WeakCheck( testRope, test_insert_n<TestRope>(testRope, random_number(random_base), 0 ) );
+ WeakCheck( testRope, test_insert_n<TestRope>(testRope, random_number(random_base), (int)testRope.size() ) );
+
+ size_t insCnt = random_number(random_base);
+ TestRope::value_type *insFirst = new TestRope::value_type[1+insCnt];
+
+ WeakCheck( testRope, insert_range_tester(testRope, insFirst, insFirst+insCnt) );
+ WeakCheck( testRope, insert_range_at_begin_tester(testRope, insFirst, insFirst+insCnt) );
+ WeakCheck( testRope, insert_range_at_end_tester(testRope, insFirst, insFirst+insCnt) );
+
+ ConstCheck( 0, test_construct_pointer_range<TestRope>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+
+ WeakCheck( testRope, insert_range_tester(testRope, testRope2.begin(), testRope2.end() ) );
+
+ WeakCheck( testRope, test_push_front<TestRope>(testRope) );
+ WeakCheck( testRope, test_push_back<TestRope>(testRope) );
+
+ ConstCheck( 0, test_default_construct<TestRope>() );
+
+// dwa 1/25/00 - not actually valid for rope, because it doesn't
+// have the constructor in question! The code will compile, but with the
+// wrong result (the constructor that gets used does something different).
+
+// ConstCheck( 0, test_construct_n<TestRope>( random_number(random_base) ) );
+
+ ConstCheck( 0, test_construct_n_instance<TestRope>( random_number(random_base) ) );
+ ConstCheck( 0, test_construct_iter_range<TestRope>( testRope2 ) );
+ ConstCheck( testRope, test_copy_construct<TestRope>() );
+
+ WeakCheck( testRope, test_assign_op<TestRope>( testRope2 ) );
+}
+#endif // __MWERKS__
+
+#endif // EH_ROPE_IMPLEMENTED
diff --git a/test/eh/test_set.cpp b/test/eh/test_set.cpp
new file mode 100644
index 0000000..7d2bd08
--- /dev/null
+++ b/test/eh/test_set.cpp
@@ -0,0 +1,100 @@
+/***********************************************************************************
+ test_set.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Tests.h"
+#include "TestClass.h"
+#include "LeakCheck.h"
+#if defined (EH_NEW_HEADERS)
+# include <set>
+#else
+# include <multiset.h>
+# include <set.h>
+#endif
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+#include "ThrowCompare.h"
+
+void test_multiset();
+
+typedef EH_STD::__multiset__<TestClass, ThrowCompare, eh_allocator(TestClass) > TestMultiSet;
+
+inline multiset_tag
+container_category(const TestMultiSet&) {
+ return multiset_tag();
+}
+
+void test_multiset() {
+ TestMultiSet testMultiSet, testMultiSet2;
+
+ const size_t setSize = random_number(random_base);
+
+ while (testMultiSet.size() < setSize) {
+ TestMultiSet::value_type x;
+ testMultiSet.insert( x );
+ testMultiSet2.insert( TestMultiSet::value_type() );
+ }
+
+ StrongCheck( testMultiSet, test_insert_value<TestMultiSet>(testMultiSet) );
+
+ size_t insCnt = random_number(random_base);
+ TestMultiSet::value_type *insFirst = new TestMultiSet::value_type[1+insCnt];
+ WeakCheck( testMultiSet, insert_range_tester(testMultiSet, insFirst, insFirst+insCnt) );
+ ConstCheck( 0, test_construct_pointer_range<TestMultiSet>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+ WeakCheck( testMultiSet, insert_range_tester(testMultiSet, testMultiSet2.begin(), testMultiSet2.end() ) );
+
+ ConstCheck( 0, test_default_construct<TestMultiSet>() );
+ ConstCheck( 0, test_construct_iter_range<TestMultiSet>( testMultiSet2 ) );
+ ConstCheck( testMultiSet, test_copy_construct<TestMultiSet>() );
+
+ WeakCheck( testMultiSet, test_assign_op<TestMultiSet>( testMultiSet2 ) );
+}
+
+typedef EH_STD::__set__<TestClass, ThrowCompare, eh_allocator(TestClass) > TestSet;
+
+inline set_tag
+container_category(const TestSet&) {
+ return set_tag();
+}
+
+void test_set() {
+ TestSet testSet, testSet2;
+
+ const size_t setSize = random_number(random_base);
+
+ while ( testSet.size() < setSize ) {
+ TestSet::value_type x;
+ testSet.insert( x );
+ testSet2.insert( TestSet::value_type() );
+ }
+ StrongCheck( testSet, test_insert_value<TestSet>(testSet) );
+
+ size_t insCnt = random_number(random_base);
+ TestSet::value_type *insFirst = new TestSet::value_type[1+insCnt];
+
+ WeakCheck( testSet, insert_range_tester(testSet, insFirst, insFirst+insCnt) );
+
+ ConstCheck( 0, test_construct_pointer_range<TestSet>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+ WeakCheck( testSet, insert_range_tester(testSet, testSet2.begin(), testSet2.end() ) );
+
+ ConstCheck( 0, test_default_construct<TestSet>() );
+ ConstCheck( 0, test_construct_iter_range<TestSet>( testSet2 ) );
+ ConstCheck( testSet, test_copy_construct<TestSet>() );
+ WeakCheck( testSet, test_assign_op<TestSet>( testSet2 ) );
+}
diff --git a/test/eh/test_slist.cpp b/test/eh/test_slist.cpp
new file mode 100644
index 0000000..2741e4c
--- /dev/null
+++ b/test/eh/test_slist.cpp
@@ -0,0 +1,91 @@
+/***********************************************************************************
+ test_slist.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Tests.h"
+#if defined( EH_SLIST_IMPLEMENTED )
+# include "TestClass.h"
+# include "LeakCheck.h"
+# if defined (EH_NEW_HEADERS) && defined (EH_USE_SGI_STL)
+# include <slist>
+# else
+# include <slist.h>
+# endif
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+
+#if defined (__GNUC__) && defined (__APPLE__)
+typedef EH_STD::slist<TestClass, eh_allocator(TestClass) > TestSList;
+#else
+typedef EH_STD::__slist__<TestClass, eh_allocator(TestClass) > TestSList;
+#endif
+
+inline sequence_container_tag
+container_category(const TestSList&) {
+ return sequence_container_tag();
+}
+
+struct test_slist_sort {
+ test_slist_sort() {
+ gTestController.SetCurrentTestName("slist::sort()");
+ }
+ void operator()( TestSList& slist ) const {
+ slist.sort();
+ for ( TestSList::iterator p = slist.begin(), q; p != slist.end(); q = p, p++ )
+ if ( p != slist.begin() ) {
+ EH_ASSERT( *p >= *q );
+ }
+ }
+};
+
+void test_slist() {
+ TestSList testSList, testSList2;
+ size_t slistSize = random_number(random_base);
+
+ while (testSList.size() < slistSize) {
+ TestClass x;
+ testSList.push_front( x );
+ testSList2.push_front( TestClass() );
+ }
+
+ StrongCheck( testSList, test_insert_one<TestSList>(testSList) );
+ StrongCheck( testSList, test_insert_one<TestSList>(testSList, 0) );
+ StrongCheck( testSList, test_insert_one<TestSList>(testSList, (int)testSList.size()) );
+
+ WeakCheck( testSList, test_insert_n<TestSList>(testSList, random_number(random_base) ) );
+ WeakCheck( testSList, test_insert_n<TestSList>(testSList, random_number(random_base), 0 ) );
+ WeakCheck( testSList, test_insert_n<TestSList>(testSList, random_number(random_base), (int)testSList.size() ) );
+
+ size_t insCnt = random_number(random_base);
+ TestClass *insFirst = new TestSList::value_type[1+insCnt];
+ WeakCheck( testSList, insert_range_tester(testSList, insFirst, insFirst+insCnt) );
+
+ ConstCheck( 0, test_construct_pointer_range<TestSList>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+ WeakCheck( testSList, test_insert_range<TestSList,TestSList::iterator>(testSList, testSList2.begin(), testSList2.end() ) );
+ StrongCheck( testSList, test_push_front<TestSList>(testSList) );
+ StrongCheck( testSList, test_slist_sort() ); // Simply to verify strength.
+
+ ConstCheck( 0, test_default_construct<TestSList>() );
+ ConstCheck( 0, test_construct_n<TestSList>( random_number(random_base) ) );
+ ConstCheck( 0, test_construct_n_instance<TestSList>( random_number(random_base) ) );
+ ConstCheck( 0, test_construct_iter_range<TestSList>( testSList2 ) );
+ ConstCheck( testSList, test_copy_construct<TestSList>() );
+ WeakCheck( testSList, test_assign_op<TestSList>( testSList2 ) );
+}
+
+#endif // EH_SLIST_IMPLEMENTED
diff --git a/test/eh/test_string.cpp b/test/eh/test_string.cpp
new file mode 100644
index 0000000..a8c9442
--- /dev/null
+++ b/test/eh/test_string.cpp
@@ -0,0 +1,79 @@
+/***********************************************************************************
+ test_string.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Prefix.h"
+#if defined( EH_STRING_IMPLEMENTED )
+#include "Tests.h"
+#include "TestClass.h"
+#include "LeakCheck.h"
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+#include <string>
+
+USING_CSTD_NAME(size_t)
+
+typedef EH_STD::basic_string<char, EH_STD::char_traits<char>, eh_allocator(char) > TestString;
+
+inline sequence_container_tag
+container_category(const TestString&)
+{
+ return sequence_container_tag();
+}
+
+void test_string() {
+ TestString testString, testString2;
+ size_t ropeSize = random_number(random_base);
+
+ while ( testString.size() < ropeSize ) {
+ TestString::value_type x = TestString::value_type(random_number(random_base)) ; // initialize before use
+ testString.append(1, x );
+ testString2.append(1, TestString::value_type() );
+ }
+ WeakCheck( testString, test_insert_one<TestString>(testString) );
+ WeakCheck( testString, test_insert_one<TestString>(testString, 0) );
+ WeakCheck( testString, test_insert_one<TestString>(testString, (int)testString.size()) );
+
+ WeakCheck( testString, test_insert_n<TestString>(testString, random_number(random_base) ) );
+ WeakCheck( testString, test_insert_n<TestString>(testString, random_number(random_base), 0 ) );
+ WeakCheck( testString, test_insert_n<TestString>(testString, random_number(random_base), (int)testString.size() ) );
+
+ size_t insCnt = random_number(random_base);
+ TestString::value_type *insFirst = new TestString::value_type[1+insCnt];
+
+ WeakCheck( testString, insert_range_tester(testString, insFirst, insFirst+insCnt) );
+ WeakCheck( testString, insert_range_at_begin_tester(testString, insFirst, insFirst+insCnt) );
+ WeakCheck( testString, insert_range_at_end_tester(testString, insFirst, insFirst+insCnt) );
+
+ ConstCheck( 0, test_construct_pointer_range<TestString>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+
+ WeakCheck( testString, insert_range_tester(testString, testString2.begin(), testString2.end() ) );
+ /*
+ WeakCheck( testString, test_push_front<TestString>(testString) );
+ WeakCheck( testString, test_push_back<TestString>(testString) );
+ */
+ ConstCheck( 0, test_default_construct<TestString>() );
+ // requires _Reserve_t ConstCheck( 0, test_construct_n<TestString>( random_number(random_base) ) );
+ ConstCheck( 0, test_construct_n_instance<TestString>( random_number(random_base) ) );
+ ConstCheck( 0, test_construct_iter_range<TestString>( testString2 ) );
+ ConstCheck( testString, test_copy_construct<TestString>() );
+
+ WeakCheck( testString, test_assign_op<TestString>( testString2 ) );
+}
+
+#endif // EH_ROPE_IMPLEMENTED
diff --git a/test/eh/test_valarray.cpp b/test/eh/test_valarray.cpp
new file mode 100644
index 0000000..f1bc75e
--- /dev/null
+++ b/test/eh/test_valarray.cpp
@@ -0,0 +1,81 @@
+// Boris - this file is, um, rather incomplete. Please remove from distribution.
+
+/***********************************************************************************
+ test_string.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Prefix.h"
+#if defined( EH_VALARRAY_IMPLEMENTED )
+#include "Tests.h"
+#include <valarray>
+#include "TestClass.h"
+#include "LeakCheck.h"
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+
+typedef __valarray__<TestClass, eh_allocator(TestClass) > TestValarray;
+
+inline sequence_container_tag
+container_category(const TestValarray&)
+{
+ return sequence_container_tag();
+}
+
+void test_rope()
+{
+ TestValarray testValarray, testValarray2;
+ size_t ropeSize = random_number(random_base);
+
+ while ( testValarray.size() < ropeSize )
+ {
+ TestValarray::value_type x = random_number(random_base) ; // initialize before use
+ testValarray.push_back( x );
+ testValarray2.push_back( TestValarray::value_type() );
+ }
+ WeakCheck( testValarray, test_insert_one<TestValarray>(testValarray) );
+ WeakCheck( testValarray, test_insert_one<TestValarray>(testValarray, 0) );
+ WeakCheck( testValarray, test_insert_one<TestValarray>(testValarray, testValarray.size()) );
+
+ WeakCheck( testValarray, test_insert_n<TestValarray>(testValarray, random_number(random_base) ) );
+ WeakCheck( testValarray, test_insert_n<TestValarray>(testValarray, random_number(random_base), 0 ) );
+ WeakCheck( testValarray, test_insert_n<TestValarray>(testValarray, random_number(random_base), testValarray.size() ) );
+
+ size_t insCnt = random_number(random_base);
+ TestValarray::value_type *insFirst = new TestValarray::value_type[1+insCnt];
+
+ WeakCheck( testValarray, insert_range_tester(testValarray, insFirst, insFirst+insCnt) );
+ WeakCheck( testValarray, insert_range_at_begin_tester(testValarray, insFirst, insFirst+insCnt) );
+ WeakCheck( testValarray, insert_range_at_end_tester(testValarray, insFirst, insFirst+insCnt) );
+
+ ConstCheck( 0, test_construct_pointer_range<TestValarray>(insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+
+ WeakCheck( testValarray, insert_range_tester(testValarray, testValarray2.begin(), testValarray2.end() ) );
+
+ WeakCheck( testValarray, test_push_front<TestValarray>(testValarray) );
+ WeakCheck( testValarray, test_push_back<TestValarray>(testValarray) );
+
+ ConstCheck( 0, test_default_construct<TestValarray>() );
+ ConstCheck( 0, test_construct_n<TestValarray>( random_number(random_base) ) );
+ ConstCheck( 0, test_construct_n_instance<TestValarray>( random_number(random_base) ) );
+ ConstCheck( 0, test_construct_iter_range<TestValarray>( testValarray2 ) );
+ ConstCheck( testValarray, test_copy_construct<TestValarray>() );
+
+ WeakCheck( testValarray, test_assign_op<TestValarray>( testValarray2 ) );
+}
+
+#endif // EH_ROPE_IMPLEMENTED
diff --git a/test/eh/test_vector.cpp b/test/eh/test_vector.cpp
new file mode 100644
index 0000000..55c35b9
--- /dev/null
+++ b/test/eh/test_vector.cpp
@@ -0,0 +1,126 @@
+/***********************************************************************************
+ test_vector.cpp
+
+ * Copyright (c) 1997
+ * Mark of the Unicorn, 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. Mark of the Unicorn makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+
+***********************************************************************************/
+#include "Tests.h"
+#include "TestClass.h"
+#include "LeakCheck.h"
+# if defined (EH_NEW_HEADERS)
+#include <vector>
+#else
+#include <vector.h>
+#endif
+#include "test_construct.h"
+#include "test_assign_op.h"
+#include "test_push_back.h"
+#include "test_insert.h"
+#include "test_push_front.h"
+
+# if defined (__GNUC__) && defined (__APPLE__)
+typedef EH_STD::vector<TestClass, eh_allocator(TestClass) > TestVector;
+# else
+typedef EH_STD::__vector__<TestClass, eh_allocator(TestClass) > TestVector;
+# endif
+
+inline sequence_container_tag
+container_category(const TestVector&)
+{
+ return sequence_container_tag();
+}
+
+void prepare_insert_n( TestVector& c, size_t insCnt );
+
+void prepare_insert_n( TestVector& c, size_t insCnt )
+{
+ if ( random_number(2) )
+ c.reserve( c.size() + insCnt );
+}
+
+struct test_reserve
+{
+ test_reserve( size_t n ) : fAmount(n) {
+ gTestController.SetCurrentTestName("vector::reserve()");
+ }
+
+ void operator()( TestVector& v ) const
+ {
+ v.reserve( fAmount );
+ }
+private:
+ size_t fAmount;
+};
+
+inline void prepare_insert_range( TestVector& vec, size_t, TestClass* first, TestClass* last )
+{
+ if ( random_number(2) )
+ {
+ ptrdiff_t d = 0;
+ EH_DISTANCE( first, last, d );
+ vec.reserve( vec.size() + d );
+ }
+}
+
+void test_vector()
+{
+
+ ConstCheck( 0, test_construct_n<TestVector>( random_number(random_base) ) );
+
+ TestVector emptyVector;
+ TestVector testVector, testVector2;
+ size_t vectorSize = random_number(random_base);
+
+ testVector.reserve(vectorSize*4);
+ while ( testVector.size() < vectorSize )
+ {
+ TestClass x;
+ testVector.push_back( x );
+ testVector2.push_back( TestClass() );
+ }
+
+ size_t insCnt = random_number(random_base);
+ TestClass *insFirst = new TestVector::value_type[1+ insCnt];
+
+ ConstCheck( 0, test_construct_pointer_range<TestVector>(insFirst, insFirst+insCnt) );
+
+ WeakCheck( testVector, insert_range_tester(testVector, insFirst, insFirst+insCnt) );
+ WeakCheck( testVector, insert_range_at_begin_tester(testVector, insFirst, insFirst+insCnt) );
+ WeakCheck( testVector, insert_range_at_end_tester(testVector, insFirst, insFirst+insCnt) );
+ delete[] insFirst;
+
+ WeakCheck( testVector, test_insert_one<TestVector>(testVector) );
+ WeakCheck( testVector, test_insert_one<TestVector>(testVector, 0) );
+ WeakCheck( testVector, test_insert_one<TestVector>(testVector, (int)testVector.size()) );
+
+ WeakCheck( testVector, test_insert_n<TestVector>(testVector, random_number(random_base) ) );
+ WeakCheck( testVector, test_insert_n<TestVector>(testVector, random_number(random_base), 0 ) );
+ WeakCheck( testVector, test_insert_n<TestVector>(testVector, random_number(random_base), (int)testVector.size() ) );
+
+ WeakCheck( testVector, insert_range_tester(testVector, testVector2.begin(), testVector2.end() ) );
+
+
+ StrongCheck( testVector, test_reserve( testVector.capacity() + random_number(random_base) ) );
+ StrongCheck( testVector, test_push_back<TestVector>(testVector) );
+ StrongCheck( emptyVector, test_push_back<TestVector>(emptyVector) );
+
+ ConstCheck( 0, test_default_construct<TestVector>() );
+ ConstCheck( 0, test_construct_n_instance<TestVector>( random_number(random_base) ) );
+ ConstCheck( 0, test_construct_iter_range<TestVector>( testVector2 ) );
+ ConstCheck( testVector, test_copy_construct<TestVector>() );
+
+ testVector2.resize( testVector.size() * 3 / 2 );
+ WeakCheck( testVector, test_assign_op<TestVector>( testVector2 ) );
+ testVector2.clear();
+ testVector2.resize( testVector.size() * 2 / 3 );
+ WeakCheck( testVector, test_assign_op<TestVector>( testVector2 ) );
+}
diff --git a/test/unit/_template.cpp b/test/unit/_template.cpp
new file mode 100644
index 0000000..a2a86d6
--- /dev/null
+++ b/test/unit/_template.cpp
@@ -0,0 +1,31 @@
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class Test : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(test);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void test();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+//
+// tests implementation
+//
+void Test::test()
+{
+ CPPUNIT_ASSERT(true);
+}
diff --git a/test/unit/accum_test.cpp b/test/unit/accum_test.cpp
new file mode 100644
index 0000000..bb58561
--- /dev/null
+++ b/test/unit/accum_test.cpp
@@ -0,0 +1,50 @@
+#include <vector>
+#include <numeric>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class AccumTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(AccumTest);
+ CPPUNIT_TEST(accum1);
+ CPPUNIT_TEST(accum2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void accum1();
+ void accum2();
+ static int mult(int initial_, int element_);
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(AccumTest);
+
+//
+// tests implementation
+//
+void AccumTest::accum1()
+{
+ vector<int> v(5);
+ for(int i = 0; (size_t)i < v.size(); ++i)
+ v[i] = i + 1;
+ int sum = accumulate(v.begin(), v.end(), 0);
+ CPPUNIT_ASSERT(sum==15);
+}
+void AccumTest::accum2()
+{
+ vector<int> v(5);
+ for(int i = 0; (size_t)i < v.size(); ++i)
+ v[i] = i + 1;
+ int prod = accumulate(v.begin(), v.end(), 1, mult);
+ CPPUNIT_ASSERT(prod==120);
+}
+int AccumTest::mult(int initial_, int element_)
+{
+ return initial_ * element_;
+}
diff --git a/test/unit/adj_test.cpp b/test/unit/adj_test.cpp
new file mode 100644
index 0000000..588838c
--- /dev/null
+++ b/test/unit/adj_test.cpp
@@ -0,0 +1,135 @@
+#include <vector>
+#include <numeric>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class AdjTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(AdjTest);
+ CPPUNIT_TEST(adjfind0);
+ CPPUNIT_TEST(adjfind1);
+ CPPUNIT_TEST(adjfind2);
+ CPPUNIT_TEST(adjdiff0);
+ CPPUNIT_TEST(adjdiff1);
+ CPPUNIT_TEST(adjdiff2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void adjfind0();
+ void adjfind1();
+ void adjfind2();
+ void adjdiff0();
+ void adjdiff1();
+ void adjdiff2();
+ static int equal_length(const char* v1_, const char* v2_);
+ static int mult(int a_, int b_);
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(AdjTest);
+
+//
+// tests implementation
+//
+void AdjTest::adjfind0()
+{
+ int numbers1 [5] = { 1, 2, 4, 8, 16 };
+ int numbers2 [5] = { 5, 3, 2, 1, 1 };
+
+ int* location = adjacent_find((int*)numbers1, (int*)numbers1 + 5);
+ CPPUNIT_ASSERT(location == numbers1 + 5); // no adj so loc should be _last
+
+ location = adjacent_find((int*)numbers2, (int*)numbers2 + 5);
+ CPPUNIT_ASSERT(location != numbers2 + 5); // adj location off should be 3 (first 1)
+ CPPUNIT_ASSERT((location - numbers2)==3);
+}
+void AdjTest::adjfind1()
+{
+ typedef vector<int> IntVector;
+ IntVector v(10);
+ for (int i = 0; (size_t)i < v.size(); ++i)
+ v[i] = i;
+ IntVector::iterator location;
+ location = adjacent_find(v.begin(), v.end());
+ CPPUNIT_ASSERT(location == v.end());
+ v[6] = 7;
+ location = adjacent_find(v.begin(), v.end());
+ CPPUNIT_ASSERT(location != v.end());
+}
+void AdjTest::adjfind2()
+{
+ typedef vector <const char*> CStrVector;
+
+ const char* names[] = { "Brett", "Graham", "Jack", "Mike", "Todd" };
+
+ const int nameCount = sizeof(names)/sizeof(names[0]);
+ CStrVector v(nameCount);
+ for(int i = 0; i < nameCount; i++)
+ v[i] = names[i];
+ CStrVector::iterator location;
+ location = adjacent_find(v.begin(), v.end(), equal_length);
+
+ CPPUNIT_ASSERT(location != v.end());
+}
+int AdjTest::equal_length(const char* v1_, const char* v2_)
+{
+ return ::strlen(v1_) == ::strlen(v2_);
+}
+void AdjTest::adjdiff0()
+{
+ int numbers[5] = { 1, 2, 4, 8, 16 };
+ int difference[5];
+ adjacent_difference(numbers, numbers + 5, (int*)difference);
+ CPPUNIT_ASSERT(difference[0]==1);
+ CPPUNIT_ASSERT(difference[1]==1);
+ CPPUNIT_ASSERT(difference[2]==2);
+ CPPUNIT_ASSERT(difference[3]==4);
+ CPPUNIT_ASSERT(difference[4]==8);
+}
+void AdjTest::adjdiff1()
+{
+ vector <int> v(10);
+ for(int i = 0; (size_t)i < v.size(); ++i)
+ v[i] = i * i;
+ vector<int> result(v.size());
+ adjacent_difference(v.begin(), v.end(), result.begin());
+ CPPUNIT_ASSERT(result[0]==0)
+ CPPUNIT_ASSERT(result[1]==1)
+ CPPUNIT_ASSERT(result[2]==3)
+ CPPUNIT_ASSERT(result[3]==5)
+ CPPUNIT_ASSERT(result[4]==7)
+ CPPUNIT_ASSERT(result[5]==9)
+ CPPUNIT_ASSERT(result[6]==11)
+ CPPUNIT_ASSERT(result[7]==13)
+ CPPUNIT_ASSERT(result[8]==15)
+ CPPUNIT_ASSERT(result[9]==17)
+}
+void AdjTest::adjdiff2()
+{
+ vector <int> v(10);
+ for (int i = 0; (size_t)i < v.size(); ++i)
+ v[i] = i + 1;
+ vector <int> result(v.size());
+ adjacent_difference(v.begin(), v.end(), result.begin(), mult);
+ CPPUNIT_ASSERT(result[0]==1)
+ CPPUNIT_ASSERT(result[1]==2)
+ CPPUNIT_ASSERT(result[2]==6)
+ CPPUNIT_ASSERT(result[3]==12)
+ CPPUNIT_ASSERT(result[4]==20)
+ CPPUNIT_ASSERT(result[5]==30)
+ CPPUNIT_ASSERT(result[6]==42)
+ CPPUNIT_ASSERT(result[7]==56)
+ CPPUNIT_ASSERT(result[8]==72)
+ CPPUNIT_ASSERT(result[9]==90)
+}
+int AdjTest::mult(int a_, int b_)
+{
+ return a_ * b_;
+}
diff --git a/test/unit/advance_test.cpp b/test/unit/advance_test.cpp
new file mode 100644
index 0000000..bd7a168
--- /dev/null
+++ b/test/unit/advance_test.cpp
@@ -0,0 +1,38 @@
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class AdvanceTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(AdvanceTest);
+ CPPUNIT_TEST(adv);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void adv();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(AdvanceTest);
+
+//
+// tests implementation
+//
+void AdvanceTest::adv()
+{
+ typedef vector <int> IntVector;
+ IntVector v(10);
+ for (int i = 0; (size_t)i < v.size(); ++i)
+ v[i] = i;
+ IntVector::iterator location = v.begin();
+ CPPUNIT_ASSERT(*location==0);
+ advance(location, 5);
+ CPPUNIT_ASSERT(*location==5);
+}
diff --git a/test/unit/alg_test.cpp b/test/unit/alg_test.cpp
new file mode 100644
index 0000000..da4977a
--- /dev/null
+++ b/test/unit/alg_test.cpp
@@ -0,0 +1,364 @@
+#include <list>
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+# include <slist>
+#endif
+#include <deque>
+#include <vector>
+#include <algorithm>
+#include <functional>
+#include <map>
+#include <string>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class AlgTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(AlgTest);
+ CPPUNIT_TEST(min_max);
+ CPPUNIT_TEST(count_test);
+ CPPUNIT_TEST(sort_test);
+ CPPUNIT_TEST(search_n_test);
+ CPPUNIT_TEST(find_first_of_test);
+ CPPUNIT_TEST(find_first_of_nsc_test);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void min_max();
+ void count_test();
+ void sort_test();
+ void search_n_test();
+ void find_first_of_test();
+ void find_first_of_nsc_test();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(AlgTest);
+
+//
+// tests implementation
+//
+void AlgTest::min_max()
+{
+ int i = min(4, 7);
+ CPPUNIT_ASSERT( i == 4 );
+ char c = max('a', 'z');
+ CPPUNIT_ASSERT( c == 'z' );
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ c = min('a', 'z', greater<char>());
+ CPPUNIT_ASSERT( c == 'z' );
+ i = max(4, 7, greater<int>());
+ CPPUNIT_ASSERT( i == 4 );
+#endif
+}
+
+void AlgTest::count_test()
+{
+ {
+ int i[] = { 1, 4, 2, 8, 2, 2 };
+ int n = count(i, i + 6, 2);
+ CPPUNIT_ASSERT(n==3);
+#if defined (STLPORT) && !defined (_STLP_NO_ANACHRONISMS)
+ n = 0;
+ count(i, i + 6, 2, n);
+ CPPUNIT_ASSERT(n==3);
+#endif
+ }
+ {
+ vector<int> i;
+ i.push_back(1);
+ i.push_back(4);
+ i.push_back(2);
+ i.push_back(8);
+ i.push_back(2);
+ i.push_back(2);
+ int n = count(i.begin(), i.end(), 2);
+ CPPUNIT_ASSERT(n==3);
+#if defined (STLPORT) && !defined (_STLP_NO_ANACHRONISMS)
+ n = 0;
+ count(i.begin(), i.end(), 2, n);
+ CPPUNIT_ASSERT(n==3);
+#endif
+ }
+}
+
+void AlgTest::sort_test()
+{
+ {
+ vector<int> years;
+ years.push_back(1962);
+ years.push_back(1992);
+ years.push_back(2001);
+ years.push_back(1999);
+ sort(years.begin(), years.end());
+ CPPUNIT_ASSERT(years[0]==1962);
+ CPPUNIT_ASSERT(years[1]==1992);
+ CPPUNIT_ASSERT(years[2]==1999);
+ CPPUNIT_ASSERT(years[3]==2001);
+ }
+ {
+ deque<int> years;
+ years.push_back(1962);
+ years.push_back(1992);
+ years.push_back(2001);
+ years.push_back(1999);
+ sort(years.begin(), years.end()); // <-- changed!
+ CPPUNIT_ASSERT(years[0]==1962);
+ CPPUNIT_ASSERT(years[1]==1992);
+ CPPUNIT_ASSERT(years[2]==1999);
+ CPPUNIT_ASSERT(years[3]==2001);
+ }
+}
+
+#define ARRAY_SIZE(arr) sizeof(arr) / sizeof(arr[0])
+
+void AlgTest::search_n_test()
+{
+ int ints[] = {0, 1, 2, 3, 3, 4, 4, 4, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5};
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ //search_n
+ //Forward iterator
+ {
+ slist<int> slint(ints, ints + ARRAY_SIZE(ints));
+ slist<int>::iterator slit = search_n(slint.begin(), slint.end(), 2, 2);
+ CPPUNIT_ASSERT( slit != slint.end() );
+ CPPUNIT_ASSERT( *(slit++) == 2 );
+ CPPUNIT_ASSERT( *slit == 2 );
+ }
+#endif
+
+ //Bidirectionnal iterator
+ {
+ list<int> lint(ints, ints + ARRAY_SIZE(ints));
+ list<int>::iterator lit = search_n(lint.begin(), lint.end(), 3, 3);
+ CPPUNIT_ASSERT( lit != lint.end() );
+ CPPUNIT_ASSERT( *(lit++) == 3 );
+ CPPUNIT_ASSERT( *(lit++) == 3 );
+ CPPUNIT_ASSERT( *lit == 3 );
+ }
+
+ //Random access iterator
+ {
+ deque<int> dint(ints, ints + ARRAY_SIZE(ints));
+ deque<int>::iterator dit = search_n(dint.begin(), dint.end(), 4, 4);
+ CPPUNIT_ASSERT( dit != dint.end() );
+ CPPUNIT_ASSERT( *(dit++) == 4 );
+ CPPUNIT_ASSERT( *(dit++) == 4 );
+ CPPUNIT_ASSERT( *(dit++) == 4 );
+ CPPUNIT_ASSERT( *dit == 4 );
+ }
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ //search_n with predicate
+ //Forward iterator
+ {
+ slist<int> slint(ints, ints + ARRAY_SIZE(ints));
+ slist<int>::iterator slit = search_n(slint.begin(), slint.end(), 2, 1, greater<int>());
+ CPPUNIT_ASSERT( slit != slint.end() );
+ CPPUNIT_ASSERT( *(slit++) > 1 );
+ CPPUNIT_ASSERT( *slit > 2 );
+ }
+#endif
+
+ //Bidirectionnal iterator
+ {
+ list<int> lint(ints, ints + ARRAY_SIZE(ints));
+ list<int>::iterator lit = search_n(lint.begin(), lint.end(), 3, 2, greater<int>());
+ CPPUNIT_ASSERT( lit != lint.end() );
+ CPPUNIT_ASSERT( *(lit++) > 2 );
+ CPPUNIT_ASSERT( *(lit++) > 2 );
+ CPPUNIT_ASSERT( *lit > 2 );
+ }
+
+ //Random access iterator
+ {
+ deque<int> dint(ints, ints + ARRAY_SIZE(ints));
+ deque<int>::iterator dit = search_n(dint.begin(), dint.end(), 4, 3, greater<int>());
+ CPPUNIT_ASSERT( dit != dint.end() );
+ CPPUNIT_ASSERT( *(dit++) > 3 );
+ CPPUNIT_ASSERT( *(dit++) > 3 );
+ CPPUNIT_ASSERT( *(dit++) > 3 );
+ CPPUNIT_ASSERT( *dit > 3 );
+ }
+
+ // test for bug reported by Jim Xochellis
+ {
+ int array[] = {0, 0, 1, 0, 1, 1};
+ int* array_end = array + sizeof(array) / sizeof(*array);
+ CPPUNIT_ASSERT(search_n(array, array_end, 3, 1) == array_end);
+ }
+
+ // test for bug with counter == 1, reported by Timmie Smith
+ {
+ int array[] = {0, 1, 2, 3, 4, 5};
+ int* array_end = array + sizeof(array) / sizeof(*array);
+ CPPUNIT_ASSERT( search_n(array, array_end, 1, 1, equal_to<int>() ) == &array[1] );
+ }
+}
+
+struct MyIntComparable {
+ MyIntComparable(int val) : _val(val) {}
+ bool operator == (const MyIntComparable& other) const
+ { return _val == other._val; }
+
+private:
+ int _val;
+};
+
+void AlgTest::find_first_of_test()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ slist<int> intsl;
+ intsl.push_front(1);
+ intsl.push_front(2);
+
+ {
+ vector<int> intv;
+ intv.push_back(0);
+ intv.push_back(1);
+ intv.push_back(2);
+ intv.push_back(3);
+
+ vector<int>::iterator first;
+ first = find_first_of(intv.begin(), intv.end(), intsl.begin(), intsl.end());
+ CPPUNIT_ASSERT( first != intv.end() );
+ CPPUNIT_ASSERT( *first == 1 );
+ }
+ {
+ vector<int> intv;
+ intv.push_back(3);
+ intv.push_back(2);
+ intv.push_back(1);
+ intv.push_back(0);
+
+ vector<int>::iterator first;
+ first = find_first_of(intv.begin(), intv.end(), intsl.begin(), intsl.end());
+ CPPUNIT_ASSERT( first != intv.end() );
+ CPPUNIT_ASSERT( *first == 2 );
+ }
+#endif
+
+ list<int> intl;
+ intl.push_front(1);
+ intl.push_front(2);
+
+ {
+ vector<int> intv;
+ intv.push_back(0);
+ intv.push_back(1);
+ intv.push_back(2);
+ intv.push_back(3);
+
+ vector<int>::iterator first;
+ first = find_first_of(intv.begin(), intv.end(), intl.begin(), intl.end());
+ CPPUNIT_ASSERT( first != intv.end() );
+ CPPUNIT_ASSERT( *first == 1 );
+ }
+ {
+ vector<int> intv;
+ intv.push_back(3);
+ intv.push_back(2);
+ intv.push_back(1);
+ intv.push_back(0);
+
+ vector<int>::iterator first;
+ first = find_first_of(intv.begin(), intv.end(), intl.begin(), intl.end());
+ CPPUNIT_ASSERT( first != intv.end() );
+ CPPUNIT_ASSERT( *first == 2 );
+ }
+ {
+ char chars[] = {1, 2};
+
+ vector<int> intv;
+ intv.push_back(0);
+ intv.push_back(1);
+ intv.push_back(2);
+ intv.push_back(3);
+
+ vector<int>::iterator first;
+ first = find_first_of(intv.begin(), intv.end(), chars, chars + sizeof(chars));
+ CPPUNIT_ASSERT( first != intv.end() );
+ CPPUNIT_ASSERT( *first == 1 );
+ }
+ {
+ unsigned char chars[] = {1, 2, 255};
+
+ vector<int> intv;
+ intv.push_back(-10);
+ intv.push_back(1029);
+ intv.push_back(255);
+ intv.push_back(4);
+
+ vector<int>::iterator first;
+ first = find_first_of(intv.begin(), intv.end(), chars, chars + sizeof(chars));
+ CPPUNIT_ASSERT( first != intv.end() );
+ CPPUNIT_ASSERT( *first == 255 );
+ }
+ {
+ signed char chars[] = {93, 2, -101, 13};
+
+ vector<int> intv;
+ intv.push_back(-10);
+ intv.push_back(1029);
+ intv.push_back(-2035);
+ intv.push_back(-101);
+ intv.push_back(4);
+
+ vector<int>::iterator first;
+ first = find_first_of(intv.begin(), intv.end(), chars, chars + sizeof(chars));
+ CPPUNIT_ASSERT( first != intv.end() );
+ CPPUNIT_ASSERT( *first == -101 );
+ }
+ {
+ char chars[] = {1, 2};
+
+ vector<MyIntComparable> intv;
+ intv.push_back(0);
+ intv.push_back(1);
+ intv.push_back(2);
+ intv.push_back(3);
+
+ vector<MyIntComparable>::iterator first;
+ first = find_first_of(intv.begin(), intv.end(), chars, chars + sizeof(chars));
+ CPPUNIT_ASSERT( first != intv.end() );
+ CPPUNIT_ASSERT( *first == 1 );
+ }
+}
+
+typedef pair<int, string> Pair;
+
+struct ValueFinder :
+ public binary_function<const Pair&, const string&, bool>
+{
+ bool operator () ( const Pair &p, const string& value ) const
+ { return p.second == value; }
+};
+
+void AlgTest::find_first_of_nsc_test()
+{
+ // Non-symmetrical comparator
+
+ map<int, string> m;
+ vector<string> values;
+
+ m[1] = "one";
+ m[4] = "four";
+ m[10] = "ten";
+ m[20] = "twenty";
+
+ values.push_back( "four" );
+ values.push_back( "ten" );
+
+ map<int, string>::iterator i = find_first_of(m.begin(), m.end(), values.begin(), values.end(), ValueFinder());
+
+ CPPUNIT_ASSERT( i != m.end() );
+ CPPUNIT_ASSERT( i->first == 4 || i->first == 10 );
+ CPPUNIT_ASSERT( i->second == "four" || i->second == "ten" );
+}
diff --git a/test/unit/algorithm_header_test.cpp b/test/unit/algorithm_header_test.cpp
new file mode 100644
index 0000000..8c3577f
--- /dev/null
+++ b/test/unit/algorithm_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <algorithm>
diff --git a/test/unit/allocator_test.cpp b/test/unit/allocator_test.cpp
new file mode 100644
index 0000000..2760cd1
--- /dev/null
+++ b/test/unit/allocator_test.cpp
@@ -0,0 +1,168 @@
+#include <memory>
+#include <vector>
+
+#include <cstdio>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class AllocatorTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(AllocatorTest);
+ CPPUNIT_TEST(zero_allocation);
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ CPPUNIT_TEST(bad_alloc_test);
+#endif
+#if defined (STLPORT) && defined (_STLP_THREADS) && defined (_STLP_USE_PERTHREAD_ALLOC)
+ CPPUNIT_TEST(per_thread_alloc);
+#endif
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void zero_allocation();
+ void bad_alloc_test();
+ void per_thread_alloc();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(AllocatorTest);
+
+//
+// tests implementation
+//
+void AllocatorTest::zero_allocation()
+{
+ typedef allocator<char> CharAllocator;
+ CharAllocator charAllocator;
+
+ char* buf = charAllocator.allocate(0);
+ charAllocator.deallocate(buf, 0);
+
+ charAllocator.deallocate(0, 0);
+}
+
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+
+struct BigStruct
+{
+ char _data[4096];
+};
+
+void AllocatorTest::bad_alloc_test()
+{
+ typedef allocator<BigStruct> BigStructAllocType;
+ BigStructAllocType bigStructAlloc;
+
+ try {
+ //Lets try to allocate almost 4096 Go (on most of the platforms) of memory:
+ BigStructAllocType::pointer pbigStruct = bigStructAlloc.allocate(1024 * 1024 * 1024);
+
+ //Allocation failed but no exception thrown
+ CPPUNIT_ASSERT( pbigStruct != 0 );
+
+ // Just it case it succeeds:
+ bigStructAlloc.deallocate(pbigStruct, 1024 * 1024 * 1024);
+ }
+ catch (bad_alloc const&) {
+ }
+ catch (...) {
+ //We shouldn't be there:
+ //Not bad_alloc exception thrown.
+ CPPUNIT_FAIL;
+ }
+}
+#endif
+
+#if defined (STLPORT) && defined (_STLP_THREADS) && defined (_STLP_USE_PERTHREAD_ALLOC)
+# include <pthread.h>
+
+class SharedDatas
+{
+public:
+ typedef vector<int, per_thread_allocator<int> > thread_vector;
+
+ SharedDatas(size_t nbElems) : threadVectors(nbElems, (thread_vector*)0) {
+ pthread_mutex_init(&mutex, 0);
+ pthread_cond_init(&condition, 0);
+ }
+
+ ~SharedDatas() {
+ for (size_t i = 0; i < threadVectors.size(); ++i) {
+ delete threadVectors[i];
+ }
+ }
+
+ size_t initThreadVector() {
+ size_t ret;
+
+ pthread_mutex_lock(&mutex);
+
+ for (size_t i = 0; i < threadVectors.size(); ++i) {
+ if (threadVectors[i] == 0) {
+ threadVectors[i] = new thread_vector();
+ ret = i;
+ break;
+ }
+ }
+
+ if (ret != threadVectors.size() - 1) {
+ //We wait for other thread(s) to call this method too:
+ printf("Thread %d wait\n", ret);
+ pthread_cond_wait(&condition, &mutex);
+ }
+ else {
+ //We are the last thread calling this method, we signal this
+ //to the other thread(s) that might be waiting:
+ printf("Thread %d signal\n", ret);
+ pthread_cond_signal(&condition);
+ }
+
+ pthread_mutex_unlock(&mutex);
+
+ return ret;
+ }
+
+ thread_vector& getThreadVector(size_t index) {
+ //We return other thread thread_vector instance:
+ return *threadVectors[(index + 1 == threadVectors.size()) ? 0 : index + 1];
+ }
+
+private:
+ pthread_mutex_t mutex;
+ pthread_cond_t condition;
+ vector<thread_vector*> threadVectors;
+};
+
+void* f(void* pdatas) {
+ SharedDatas *psharedDatas = (SharedDatas*)pdatas;
+
+ int threadIndex = psharedDatas->initThreadVector();
+
+ for (int i = 0; i < 100; ++i) {
+ psharedDatas->getThreadVector(threadIndex).push_back(i);
+ }
+
+ return 0;
+}
+
+void AllocatorTest::per_thread_alloc()
+{
+ const size_t nth = 2;
+ SharedDatas datas(nth);
+ pthread_t t[nth];
+
+ size_t i;
+ for (i = 0; i < nth; ++i) {
+ pthread_create(&t[i], 0, f, &datas);
+ }
+
+ for (i = 0; i < nth; ++i ) {
+ pthread_join(t[i], 0);
+ }
+}
+#endif
diff --git a/test/unit/assert_header_test.c b/test/unit/assert_header_test.c
new file mode 100644
index 0000000..a478877
--- /dev/null
+++ b/test/unit/assert_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <assert.h>
diff --git a/test/unit/bcompos_test.cpp b/test/unit/bcompos_test.cpp
new file mode 100644
index 0000000..d117fab
--- /dev/null
+++ b/test/unit/bcompos_test.cpp
@@ -0,0 +1,55 @@
+#include <algorithm>
+#include "unary.h"
+
+#include "cppunit/cppunit_proxy.h"
+
+#if defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class BcomposTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(BcomposTest);
+#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(bcompos1);
+ CPPUNIT_TEST(bcompos2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void bcompos1();
+ void bcompos2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(BcomposTest);
+
+//
+// tests implementation
+//
+void BcomposTest::bcompos1()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ int array [6] = { -2, -1, 0, 1, 2, 3 };
+
+ binary_compose<logical_and<bool>, odd, positive>
+ b = binary_compose<logical_and<bool>, odd, positive>(logical_and<bool>(), odd(), positive());
+
+ int* p = find_if((int*)array, (int*)array + 6, b);
+ CPPUNIT_ASSERT(p != array + 6);
+#endif
+}
+
+void BcomposTest::bcompos2()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ int array [6] = { -2, -1 , 0, 1, 2, 3 };
+
+ int* p = find_if((int*)array, (int*)array + 6,
+ compose2(logical_and<bool>(), odd(), positive()));
+ CPPUNIT_ASSERT(p != array + 6);
+#endif
+}
diff --git a/test/unit/bind_test.cpp b/test/unit/bind_test.cpp
new file mode 100644
index 0000000..8773baa
--- /dev/null
+++ b/test/unit/bind_test.cpp
@@ -0,0 +1,149 @@
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class BindTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(BindTest);
+ CPPUNIT_TEST(bind1st1);
+ CPPUNIT_TEST(bind2nd1);
+ CPPUNIT_TEST(bind2nd2);
+#if !defined (STLPORT) || \
+ defined (_STLP_NO_EXTENSIONS) || !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(bind2nd3);
+ CPPUNIT_TEST(bind_memfn);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void bind1st1();
+ void bind2nd1();
+ void bind2nd2();
+ void bind2nd3();
+ void bind_memfn();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(BindTest);
+
+class pre_increment : public binary_function<int, int, int> {
+public:
+ int operator()(int incr, int& val) const
+ { return val += incr; }
+};
+
+class post_increment : public binary_function<int, int, int> {
+public:
+ int operator()(int& val, int incr) const
+ { return val += incr; }
+};
+
+
+//
+// tests implementation
+//
+void BindTest::bind1st1()
+{
+ int array [3] = { 1, 2, 3 };
+ int* p = remove_if((int*)array, (int*)array + 3, bind1st(less<int>(), 2));
+
+ CPPUNIT_ASSERT(p == &array[2]);
+ CPPUNIT_ASSERT(array[0] == 1);
+ CPPUNIT_ASSERT(array[1] == 2);
+
+ for_each((int*)array, (int*)array + 3, bind1st(pre_increment(), 1));
+ CPPUNIT_ASSERT(array[0] == 2);
+ CPPUNIT_ASSERT(array[1] == 3);
+ CPPUNIT_ASSERT(array[2] == 4);
+
+ for_each((int*)array, (int*)array + 3, bind2nd(post_increment(), 1));
+ CPPUNIT_ASSERT(array[0] == 3);
+ CPPUNIT_ASSERT(array[1] == 4);
+ CPPUNIT_ASSERT(array[2] == 5);
+}
+
+void BindTest::bind2nd1()
+{
+ int array [3] = { 1, 2, 3 };
+ replace_if(array, array + 3, binder2nd<greater<int> >(greater<int>(), 2), 4);
+
+ CPPUNIT_ASSERT(array[0]==1);
+ CPPUNIT_ASSERT(array[1]==2);
+ CPPUNIT_ASSERT(array[2]==4);
+}
+void BindTest::bind2nd2()
+{
+ int array [3] = { 1, 2, 3 };
+ replace_if(array, array + 3, bind2nd(greater<int>(), 2), 4);
+ CPPUNIT_ASSERT(array[0]==1);
+ CPPUNIT_ASSERT(array[1]==2);
+ CPPUNIT_ASSERT(array[2]==4);
+}
+
+int test_func1 (const int ¶m1, const int ¶m2) {
+ return param1 + param2;
+}
+
+int test_func2 (int ¶m1, int param2) {
+ param1 += param2;
+ return param1 + param2;
+}
+
+void BindTest::bind2nd3()
+{
+#if defined (STLPORT) && \
+ !defined (_STLP_NO_EXTENSIONS) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ int array[3] = { 1, 2, 3 };
+ transform(array, array + 3, array, bind2nd(ptr_fun(test_func1), 1));
+ transform(array, array + 3, array, bind1st(ptr_fun(test_func1), -1));
+ CPPUNIT_ASSERT(array[0] == 1);
+ CPPUNIT_ASSERT(array[1] == 2);
+ CPPUNIT_ASSERT(array[2] == 3);
+
+ transform(array, array + 3, array, bind2nd(ptr_fun(test_func2), 10));
+ CPPUNIT_ASSERT(array[0] == 21);
+ CPPUNIT_ASSERT(array[1] == 22);
+ CPPUNIT_ASSERT(array[2] == 23);
+#endif
+}
+
+class A
+{
+ public:
+ A() : m_n( 0 )
+ {}
+
+ void f( int n ) const {
+#if defined (STLPORT)
+ _STLP_MUTABLE(A, m_n) = n;
+#else
+ m_n = n;
+#endif
+ }
+
+ int v() const
+ { return m_n; }
+
+ private:
+ mutable int m_n;
+};
+
+void BindTest::bind_memfn()
+{
+#if defined (STLPORT) && \
+ !defined (_STLP_NO_EXTENSIONS) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ A array[3];
+
+ for_each( array, array + 3, bind2nd( mem_fun_ref(&A::f), 12 ) );
+
+ CPPUNIT_CHECK( array[0].v() == 12 );
+#endif
+}
diff --git a/test/unit/binsert_test.cpp b/test/unit/binsert_test.cpp
new file mode 100644
index 0000000..e085a5c
--- /dev/null
+++ b/test/unit/binsert_test.cpp
@@ -0,0 +1,54 @@
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class BinsertTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(BinsertTest);
+ CPPUNIT_TEST(binsert1);
+ CPPUNIT_TEST(binsert2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void binsert1();
+ void binsert2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(BinsertTest);
+
+//
+// tests implementation
+//
+void BinsertTest::binsert1()
+{
+ const char* array [] = { "laurie", "jennifer", "leisa" };
+ vector<const char*> names;
+ back_insert_iterator<vector<const char*> > bit(names);
+ bit = copy(array, array + 3, bit);
+
+ CPPUNIT_ASSERT(!strcmp(names[0],array[0]));
+ CPPUNIT_ASSERT(!strcmp(names[1],array[1]));
+ CPPUNIT_ASSERT(!strcmp(names[2],array[2]));
+
+ copy(array, array + 3, bit);
+ CPPUNIT_ASSERT(!strcmp(names[3],array[0]));
+ CPPUNIT_ASSERT(!strcmp(names[4],array[1]));
+ CPPUNIT_ASSERT(!strcmp(names[5],array[2]));
+}
+void BinsertTest::binsert2()
+{
+ const char* array [] = { "laurie", "jennifer", "leisa" };
+ vector<const char*> names;
+ copy(array, array + 3, back_inserter(names));
+ CPPUNIT_ASSERT(!strcmp(names[0],array[0]));
+ CPPUNIT_ASSERT(!strcmp(names[1],array[1]));
+ CPPUNIT_ASSERT(!strcmp(names[2],array[2]));
+}
diff --git a/test/unit/bitset_header_test.cpp b/test/unit/bitset_header_test.cpp
new file mode 100644
index 0000000..dbd5cc2
--- /dev/null
+++ b/test/unit/bitset_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <bitset>
diff --git a/test/unit/bitset_test.cpp b/test/unit/bitset_test.cpp
new file mode 100644
index 0000000..141f646
--- /dev/null
+++ b/test/unit/bitset_test.cpp
@@ -0,0 +1,110 @@
+#include <bitset>
+#include <algorithm>
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <sstream>
+#endif
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class BitsetTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(BitsetTest);
+ CPPUNIT_TEST(bitset1);
+#if defined (STLPORT) && defined (_STLP_USE_NO_IOSTREAMS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(iostream);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void bitset1();
+ void iostream();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(BitsetTest);
+
+//
+// tests implementation
+//
+void BitsetTest::bitset1()
+{
+ bitset<13U> b1(0xFFFF);
+ bitset<13U> b2(0x1111);
+ CPPUNIT_ASSERT(b1.size() == 13);
+ CPPUNIT_ASSERT(b1 == 0x1FFF);
+ CPPUNIT_ASSERT(b2.size() == 13);
+ CPPUNIT_ASSERT(b2 == 0x1111);
+
+#if !defined (STLPORT) || !defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
+ b1 = b1 ^ (b2 << 2);
+ CPPUNIT_ASSERT(b1 == 0x1BBB);
+
+ CPPUNIT_ASSERT(b1.count() == 10);
+ CPPUNIT_ASSERT(b2.count() == 4);
+
+# if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ size_t __pos = b2._Find_first();
+ CPPUNIT_ASSERT( __pos == 0 );
+ __pos = b2._Find_next(__pos);
+ CPPUNIT_ASSERT( __pos == 4 );
+ __pos = b2._Find_next(__pos);
+ CPPUNIT_ASSERT( __pos == 8 );
+ __pos = b2._Find_next(__pos);
+ CPPUNIT_ASSERT( __pos == 12 );
+ __pos = b2._Find_next(__pos);
+ CPPUNIT_ASSERT( __pos == 13 );
+# endif
+#endif
+
+#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)
+ string representation = b2.to_string<char, char_traits<char>, allocator<char> >();
+ CPPUNIT_ASSERT( representation == "1000100010001" );
+# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+ wstring wrepresentation = b2.to_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >();
+ CPPUNIT_ASSERT( wrepresentation == L"1000100010001" );
+# endif
+#else
+ CPPUNIT_ASSERT( b2.to_string() == "1000100010001" );
+#endif
+}
+
+void BitsetTest::iostream()
+{
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+ {
+ stringstream sstr;
+ bitset<13U> b(0x1111);
+ sstr << b;
+ CPPUNIT_ASSERT( sstr.str() == "1000100010001" );
+
+ bitset<13U> b1;
+ sstr >> b1;
+ CPPUNIT_ASSERT( b1.test(0) );
+ CPPUNIT_ASSERT( b1.test(4) );
+ CPPUNIT_ASSERT( b1.test(8) );
+ CPPUNIT_ASSERT( b1.test(12) );
+ }
+# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+ {
+ wstringstream sstr;
+ bitset<13U> b(0x1111);
+ sstr << b;
+ CPPUNIT_ASSERT( sstr.str() == L"1000100010001" );
+
+ bitset<13U> b1;
+ sstr >> b1;
+ CPPUNIT_ASSERT( b1.test(0) );
+ CPPUNIT_ASSERT( b1.test(4) );
+ CPPUNIT_ASSERT( b1.test(8) );
+ CPPUNIT_ASSERT( b1.test(12) );
+ }
+# endif
+#endif
+}
diff --git a/test/unit/bnegate_test.cpp b/test/unit/bnegate_test.cpp
new file mode 100644
index 0000000..888b036
--- /dev/null
+++ b/test/unit/bnegate_test.cpp
@@ -0,0 +1,48 @@
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class BnegateTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(BnegateTest);
+ CPPUNIT_TEST(bnegate1);
+ CPPUNIT_TEST(bnegate2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void bnegate1();
+ void bnegate2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(BnegateTest);
+
+//
+// tests implementation
+//
+void BnegateTest::bnegate1()
+{
+ int array [4] = { 4, 9, 7, 1 };
+
+ sort(array, array + 4, binary_negate<greater<int> >(greater<int>()));
+ CPPUNIT_ASSERT(array[0]==1);
+ CPPUNIT_ASSERT(array[1]==4);
+ CPPUNIT_ASSERT(array[2]==7);
+ CPPUNIT_ASSERT(array[3]==9);
+}
+void BnegateTest::bnegate2()
+{
+ int array [4] = { 4, 9, 7, 1 };
+ sort(array, array + 4, not2(greater<int>()));
+ CPPUNIT_ASSERT(array[0]==1);
+ CPPUNIT_ASSERT(array[1]==4);
+ CPPUNIT_ASSERT(array[2]==7);
+ CPPUNIT_ASSERT(array[3]==9);
+}
diff --git a/test/unit/boost_check.cpp b/test/unit/boost_check.cpp
new file mode 100644
index 0000000..4bf7b95
--- /dev/null
+++ b/test/unit/boost_check.cpp
@@ -0,0 +1,49 @@
+#ifndef WITHOUT_STLPORT
+#include <stl/config/user_config.h>
+
+#ifdef _STLP_USE_BOOST_SUPPORT
+
+#include <boost/config.hpp>
+
+#endif // _STLP_USE_BOOST_SUPPORT
+
+#else
+
+#if 0 // Problem 1:
+/* *******************************
+../../../stlport/functional:63: error: 'boost::mem_fn' has not been declared
+../../../stlport/functional:64: error: 'boost::bind' has not been declared
+../../../stlport/functional:67: error: '::_1' has not been declared
+../../../stlport/functional:68: error: '::_2' has not been declared
+../../../stlport/functional:69: error: '::_3' has not been declared
+../../../stlport/functional:70: error: '::_4' has not been declared
+../../../stlport/functional:71: error: '::_5' has not been declared
+../../../stlport/functional:72: error: '::_6' has not been declared
+../../../stlport/functional:73: error: '::_7' has not been declared
+../../../stlport/functional:74: error: '::_8' has not been declared
+../../../stlport/functional:75: error: '::_9' has not been declared
+ ******************************* */
+
+#include <boost/bind.hpp>
+
+#endif // Problem 1
+
+#if 0 // Problem 2
+
+#include <boost/function.hpp>
+
+#endif // Problem 2
+
+#if 0 // Problem 3
+
+#include <boost/function/function_base.hpp>
+
+#endif // Problem 3
+
+#if 0 // Problem 4
+
+#include <boost/function/function1.hpp>
+
+#endif // Problem 4
+
+#endif
diff --git a/test/unit/bound_test.cpp b/test/unit/bound_test.cpp
new file mode 100644
index 0000000..f7cc6e2
--- /dev/null
+++ b/test/unit/bound_test.cpp
@@ -0,0 +1,80 @@
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class BoundTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(BoundTest);
+ CPPUNIT_TEST(lwrbnd1);
+ CPPUNIT_TEST(lwrbnd2);
+ CPPUNIT_TEST(uprbnd1);
+ CPPUNIT_TEST(uprbnd2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void lwrbnd1();
+ void lwrbnd2();
+ void uprbnd1();
+ void uprbnd2();
+
+ static bool char_str_less(const char* a_, const char* b_)
+ {
+ return strcmp(a_, b_) < 0 ? 1 : 0;
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(BoundTest);
+
+//
+// tests implementation
+//
+void BoundTest::uprbnd1()
+{
+ int arr[20];
+ for(int i = 0; i < 20; i++)
+ {
+ arr[i] = i/4;
+ }
+ int location = upper_bound((int*)arr, (int*)arr + 20, 3) - arr;
+ CPPUNIT_ASSERT(location==16);
+}
+
+void BoundTest::uprbnd2()
+{
+ char const* str [] = { "a", "a", "b", "b", "q", "w", "z" };
+
+ const unsigned strCt = sizeof(str)/sizeof(str[0]);
+
+ int location = (upper_bound((char const**)str, (char const**)str + strCt, (const char *)"d", char_str_less) - str);
+ CPPUNIT_ASSERT(location==4);
+}
+void BoundTest::lwrbnd1()
+{
+ vector <int> v1(20);
+ for (int i = 0; (size_t)i < v1.size(); ++i)
+ {
+ v1[i] = i/4;
+ }
+ // 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
+ vector<int>::iterator location = lower_bound(v1.begin(), v1.end(), 3);
+
+ CPPUNIT_ASSERT((location - v1.begin())==12);
+}
+
+void BoundTest::lwrbnd2()
+{
+ char const* str [] = { "a", "a", "b", "b", "q", "w", "z" };
+
+ const unsigned strCt = sizeof(str)/sizeof(str[0]);
+ char const** location = lower_bound((char const**)str, (char const**)str + strCt, (const char *)"d", char_str_less);
+
+ CPPUNIT_ASSERT((location - str) == 4);
+}
diff --git a/test/unit/bsearch_test.cpp b/test/unit/bsearch_test.cpp
new file mode 100644
index 0000000..27dcc02
--- /dev/null
+++ b/test/unit/bsearch_test.cpp
@@ -0,0 +1,49 @@
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class BsearchTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(BsearchTest);
+ CPPUNIT_TEST(bsearch1);
+ CPPUNIT_TEST(bsearch2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void bsearch1();
+ void bsearch2();
+ static bool str_compare(const char* a_, const char* b_);
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(BsearchTest);
+
+//
+// tests implementation
+//
+void BsearchTest::bsearch1()
+{
+ int vector[100];
+ for(int i = 0; i < 100; i++)
+ vector[i] = i;
+ CPPUNIT_ASSERT(binary_search(vector, vector + 100, 42));
+}
+
+void BsearchTest::bsearch2()
+{
+ char const* labels[] = { "aa", "dd", "ff", "jj", "ss", "zz" };
+ const unsigned count = sizeof(labels) / sizeof(labels[0]);
+ // DEC C++ generates incorrect template instatiation code
+ // for "ff" so must cast
+ CPPUNIT_ASSERT(binary_search(labels, labels + count, (const char *)"ff", str_compare));
+}
+bool BsearchTest::str_compare(const char* a_, const char* b_)
+{
+ return strcmp(a_, b_) < 0 ? 1 : 0;
+}
diff --git a/test/unit/bvector_test.cpp b/test/unit/bvector_test.cpp
new file mode 100644
index 0000000..b0c4912
--- /dev/null
+++ b/test/unit/bvector_test.cpp
@@ -0,0 +1,71 @@
+#include <vector>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class BvectorTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(BvectorTest);
+#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(bvec1);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void bvec1();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(BvectorTest);
+
+//
+// tests implementation
+//
+void BvectorTest::bvec1()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ bool ii[3]= {1,0,1};
+ bit_vector b(3);
+
+ CPPUNIT_ASSERT(b[0]==0);
+ CPPUNIT_ASSERT(b[1]==0);
+ CPPUNIT_ASSERT(b[2]==0);
+
+ b[0] = b[2] = 1;
+
+ CPPUNIT_ASSERT(b[0]==1);
+ CPPUNIT_ASSERT(b[1]==0);
+ CPPUNIT_ASSERT(b[2]==1);
+
+ b.insert(b.begin(),(bool*)ii, ii+2);
+
+ CPPUNIT_ASSERT(b[0]==1);
+ CPPUNIT_ASSERT(b[1]==0);
+ CPPUNIT_ASSERT(b[2]==1);
+ CPPUNIT_ASSERT(b[3]==0);
+ CPPUNIT_ASSERT(b[4]==1);
+
+ bit_vector bb = b;
+ if (bb != b)
+ exit(1);
+
+ b[0] |= 0;
+ b[1] |= 0;
+ b[2] |= 1;
+ b[3] |= 1;
+ CPPUNIT_ASSERT(!((b[0] != 1) || (b[1] != 0) || (b[2] != 1) || (b[3] != 1)));
+
+
+ bb[0] &= 0;
+ bb[1] &= 0;
+ bb[2] &= 1;
+ bb[3] &= 1;
+ CPPUNIT_ASSERT(!((bb[0] != 0) || (bb[1] != 0) || (bb[2] != 1) || (bb[3] != 0)));
+#endif
+}
diff --git a/test/unit/c_limits_header_test.c b/test/unit/c_limits_header_test.c
new file mode 100644
index 0000000..04b2bf2
--- /dev/null
+++ b/test/unit/c_limits_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <limits.h>
diff --git a/test/unit/c_locale_header_test.c b/test/unit/c_locale_header_test.c
new file mode 100644
index 0000000..8dbec46
--- /dev/null
+++ b/test/unit/c_locale_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <locale.h>
diff --git a/test/unit/cassert_header_test.cpp b/test/unit/cassert_header_test.cpp
new file mode 100644
index 0000000..bafdf32
--- /dev/null
+++ b/test/unit/cassert_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <cassert>
diff --git a/test/unit/cctype_header_test.cpp b/test/unit/cctype_header_test.cpp
new file mode 100644
index 0000000..8a67339
--- /dev/null
+++ b/test/unit/cctype_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <cctype>
diff --git a/test/unit/cerrno_header_test.cpp b/test/unit/cerrno_header_test.cpp
new file mode 100644
index 0000000..c0e1d5a
--- /dev/null
+++ b/test/unit/cerrno_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <cerrno>
diff --git a/test/unit/cfloat_header_test.cpp b/test/unit/cfloat_header_test.cpp
new file mode 100644
index 0000000..4579c73
--- /dev/null
+++ b/test/unit/cfloat_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <cfloat>
diff --git a/test/unit/ciso646_header_test.cpp b/test/unit/ciso646_header_test.cpp
new file mode 100644
index 0000000..4b7b257
--- /dev/null
+++ b/test/unit/ciso646_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <ciso646>
diff --git a/test/unit/climits_header_test.cpp b/test/unit/climits_header_test.cpp
new file mode 100644
index 0000000..cf71b9f
--- /dev/null
+++ b/test/unit/climits_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <climits>
diff --git a/test/unit/clocale_header_test.cpp b/test/unit/clocale_header_test.cpp
new file mode 100644
index 0000000..5d3b36a
--- /dev/null
+++ b/test/unit/clocale_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <clocale>
diff --git a/test/unit/cmath_header_test.cpp b/test/unit/cmath_header_test.cpp
new file mode 100644
index 0000000..5c9b7cb
--- /dev/null
+++ b/test/unit/cmath_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <cmath>
diff --git a/test/unit/cmath_test.cpp b/test/unit/cmath_test.cpp
new file mode 100644
index 0000000..07185e9
--- /dev/null
+++ b/test/unit/cmath_test.cpp
@@ -0,0 +1,170 @@
+#define _STLP_DO_IMPORT_CSTD_FUNCTIONS
+
+#include <limits>
+#include <cmath>
+//We also test math functions imported from stdlib.h or
+//defined in cstdlib
+#include <cstdlib>
+
+#include "math_aux.h"
+#include "cppunit/cppunit_proxy.h"
+
+//This test purpose is to check the right import of math.h C symbols
+//into the std namespace so we do not use the using namespace std
+//specification
+
+//
+// TestCase class
+//
+class CMathTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(CMathTest);
+#if defined (STLPORT) && !defined (_STLP_USE_NAMESPACES)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(import_checks);
+ CPPUNIT_TEST_SUITE_END();
+
+ protected:
+ void import_checks();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(CMathTest);
+
+//
+// tests implementation
+//
+void CMathTest::import_checks()
+{
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+ int int_val = -1;
+ long long_val = -1l;
+ float float_val = -1.0f;
+ double double_val = -1.0;
+# if !defined (_STLP_NO_LONG_DOUBLE)
+ long double long_double_val = -1.0l;
+# endif
+
+ CPPUNIT_CHECK( are_equals(std::abs(int_val), -int_val) );
+ CPPUNIT_CHECK( are_equals(std::abs(long_val), -long_val) );
+ CPPUNIT_CHECK( are_equals(std::labs(long_val), -long_val) );
+ CPPUNIT_CHECK( are_equals(std::abs(float_val), -float_val) );
+ CPPUNIT_CHECK( are_equals(std::abs(double_val), -double_val) );
+# if !defined (_STLP_NO_LONG_DOUBLE)
+ CPPUNIT_CHECK( are_equals(std::abs(long_double_val), -long_double_val) );
+# endif
+
+ CPPUNIT_CHECK( are_equals(std::fabs(float_val), -float_val) );
+ CPPUNIT_CHECK( are_equals(std::fabs(double_val), -double_val) );
+# if !defined (_STLP_NO_LONG_DOUBLE)
+ CPPUNIT_CHECK( are_equals(std::fabs(long_double_val), -long_double_val) );
+# endif
+
+ std::div_t div_res = std::div(3, 2);
+ CPPUNIT_CHECK( div_res.quot == 1 );
+ CPPUNIT_CHECK( div_res.rem == 1 );
+ std::ldiv_t ldiv_res = std::ldiv(3l, 2l);
+ CPPUNIT_CHECK( ldiv_res.quot == 1l );
+ CPPUNIT_CHECK( ldiv_res.rem == 1l );
+ ldiv_res = std::div(3l, 2l);
+ CPPUNIT_CHECK( ldiv_res.quot == 1l );
+ CPPUNIT_CHECK( ldiv_res.rem == 1l );
+
+ std::srand(2);
+ int rand_val = std::rand();
+ CPPUNIT_CHECK( rand_val >= 0 && rand_val <= RAND_MAX );
+
+ CPPUNIT_CHECK( are_equals(std::floor(1.5), 1.0) );
+ CPPUNIT_CHECK( are_equals(std::ceil(1.5), 2.0) );
+ CPPUNIT_CHECK( are_equals(std::fmod(1.5, 1.0), 0.5) );
+ CPPUNIT_CHECK( are_equals(std::sqrt(4.0), 2.0) );
+ CPPUNIT_CHECK( are_equals(std::pow(2.0, 2), 4.0) );
+ /*
+ * Uncomment the following to check that it generates an ambiguous call
+ * as there is no Standard pow(int, int) function only pow(double, int),
+ * pow(float, int) and some others...
+ * If it do not generate a compile time error it should at least give
+ * the good result.
+ */
+ //CPPUNIT_CHECK( are_equals(std::pow(10, -2), 0.01) );
+ CPPUNIT_CHECK( are_equals(std::pow(10.0, -2), 0.01) );
+ CPPUNIT_CHECK( are_equals(std::exp(0.0), 1.0) );
+ CPPUNIT_CHECK( are_equals(std::log(std::exp(1.0)), 1.0) );
+ CPPUNIT_CHECK( are_equals(std::log10(100.0), 2.0) );
+# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64)
+ CPPUNIT_CHECK( are_equals(std::modf(100.5, &double_val), 0.5) );
+ CPPUNIT_CHECK( are_equals(double_val, 100.0) );
+# endif
+ double_val = std::frexp(8.0, &int_val);
+ CPPUNIT_CHECK( are_equals(double_val * std::pow(2.0, int_val), 8.0) );
+ CPPUNIT_CHECK( are_equals(std::ldexp(1.0, 2), 4.0) );
+ CPPUNIT_CHECK( are_equals(std::cos(std::acos(1.0)), 1.0) );
+ CPPUNIT_CHECK( are_equals(std::sin(std::asin(1.0)), 1.0) );
+ CPPUNIT_CHECK( are_equals(std::tan(std::atan(1.0)), 1.0) );
+ CPPUNIT_CHECK( are_equals(std::tan(std::atan2(1.0, 1.0)), 1.0) );
+ CPPUNIT_CHECK( are_equals(std::cosh(0.0), 1.0) );
+ CPPUNIT_CHECK( are_equals(std::sinh(0.0), 0.0) );
+# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64)
+ CPPUNIT_CHECK( are_equals(std::tanh(0.0), 0.0) );
+# endif
+
+ CPPUNIT_CHECK( are_equals(std::floor(1.5f), 1.0f) );
+ CPPUNIT_CHECK( are_equals(std::ceil(1.5f), 2.0f) );
+ CPPUNIT_CHECK( are_equals(std::fmod(1.5f, 1.0f), 0.5f) );
+ CPPUNIT_CHECK( are_equals(std::sqrt(4.0f), 2.0f) );
+ CPPUNIT_CHECK( are_equals(std::pow(2.0f, 2), 4.0f) );
+ CPPUNIT_CHECK( are_equals(std::exp(0.0f), 1.0f) );
+ CPPUNIT_CHECK( are_equals(std::log(std::exp(1.0f)), 1.0f) );
+ CPPUNIT_CHECK( are_equals(std::log10(100.0f), 2.0f) );
+# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64)
+ CPPUNIT_CHECK( are_equals(std::modf(100.5f, &float_val), 0.5f) );
+ CPPUNIT_CHECK( are_equals(float_val, 100.0f) );
+# endif
+ float_val = std::frexp(8.0f, &int_val);
+ CPPUNIT_CHECK( are_equals(float_val * std::pow(2.0f, int_val), 8.0f) );
+ CPPUNIT_CHECK( are_equals(std::ldexp(1.0f, 2), 4.0f) );
+ CPPUNIT_CHECK( are_equals(std::cos(std::acos(1.0f)), 1.0f) );
+ CPPUNIT_CHECK( are_equals(std::sin(std::asin(1.0f)), 1.0f) );
+ CPPUNIT_CHECK( are_equals(std::tan(std::atan(1.0f)), 1.0f) );
+ CPPUNIT_CHECK( are_equals(std::tan(std::atan2(1.0f, 1.0f)), 1.0f) );
+ CPPUNIT_CHECK( are_equals(std::cosh(0.0f), 1.0f) );
+ CPPUNIT_CHECK( are_equals(std::sinh(0.0f), 0.0f) );
+# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64)
+ CPPUNIT_CHECK( are_equals(std::tanh(0.0f), 0.0f) );
+# endif
+
+# if !defined (_STLP_NO_LONG_DOUBLE)
+ CPPUNIT_CHECK( are_equals(std::floor(1.5l), 1.0l) );
+ CPPUNIT_CHECK( are_equals(std::ceil(1.5l), 2.0l) );
+ CPPUNIT_CHECK( are_equals(std::fmod(1.5l, 1.0l), 0.5l) );
+ CPPUNIT_CHECK( are_equals(std::sqrt(4.0l), 2.0l) );
+ CPPUNIT_CHECK( are_equals(std::pow(2.0l, 2), 4.0l) );
+ CPPUNIT_CHECK( are_equals(std::exp(0.0l), 1.0l) );
+ CPPUNIT_CHECK( are_equals(std::log(std::exp(1.0l)), 1.0l) );
+ CPPUNIT_CHECK( are_equals(std::log10(100.0l), 2.0l) );
+# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64)
+ CPPUNIT_CHECK( are_equals(std::modf(100.5l, &long_double_val), 0.5l) );
+ CPPUNIT_CHECK( are_equals(long_double_val, 100.0l) );
+# endif
+ long_double_val = std::frexp(8.0l, &int_val);
+ CPPUNIT_CHECK( are_equals(long_double_val * std::pow(2.0l, int_val), 8.0l) );
+ CPPUNIT_CHECK( are_equals(std::ldexp(1.0l, 2), 4.0l) );
+ CPPUNIT_CHECK( are_equals(std::cos(std::acos(1.0l)), 1.0l) );
+ CPPUNIT_CHECK( are_equals(std::sin(std::asin(1.0l)), 1.0l) );
+ CPPUNIT_CHECK( are_equals(std::tan(0.0l), 0.0l) );
+ CPPUNIT_CHECK( are_equals(std::atan(0.0l), 0.0l) );
+ CPPUNIT_CHECK( are_equals(std::atan2(0.0l, 1.0l), 0.0l) );
+ CPPUNIT_CHECK( are_equals(std::cosh(0.0l), 1.0l) );
+ CPPUNIT_CHECK( are_equals(std::sinh(0.0l), 0.0l) );
+# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64)
+ CPPUNIT_CHECK( are_equals(std::tanh(0.0l), 0.0l) );
+# endif
+# endif
+
+ CPPUNIT_CHECK( are_equals(std::sqrt(std::sqrt(std::sqrt(256.0))), 2.0) );
+ CPPUNIT_CHECK( are_equals(std::sqrt(std::sqrt(std::sqrt(256.0f))), 2.0f) );
+# if !defined (_STLP_NO_LONG_DOUBLE)
+ CPPUNIT_CHECK( are_equals(std::sqrt(std::sqrt(std::sqrt(256.0l))), 2.0l) );
+# endif
+#endif
+}
diff --git a/test/unit/codecvt_test.cpp b/test/unit/codecvt_test.cpp
new file mode 100644
index 0000000..c33fe15
--- /dev/null
+++ b/test/unit/codecvt_test.cpp
@@ -0,0 +1,654 @@
+#include <string>
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <fstream>
+# include <locale>
+# include <stdexcept>
+# include <cstdio> // for WEOF
+
+# include "cppunit/cppunit_proxy.h"
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+//
+// TestCase class
+//
+class CodecvtTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(CodecvtTest);
+#if defined (STLPORT) && defined (_STLP_NO_MEMBER_TEMPLATES)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(variable_encoding);
+ CPPUNIT_STOP_IGNORE;
+#if defined (STLPORT) && (defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS))
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(in_out_test);
+ CPPUNIT_TEST(length_test);
+ CPPUNIT_TEST(imbue_while_reading);
+ CPPUNIT_TEST(special_encodings);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void variable_encoding();
+ void in_out_test();
+ void length_test();
+ void imbue_while_reading();
+ void special_encodings();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(CodecvtTest);
+
+#if defined (STLPORT)
+# define __NO_THROW _STLP_NOTHROW
+#else
+# define __NO_THROW throw()
+#endif
+
+
+/* Codecvt facet eating some characters from the external buffer.
+ * Transform '01' in 'a'
+ */
+struct eater_codecvt : public codecvt<char, char, mbstate_t> {
+ typedef codecvt<char,char,mbstate_t> base;
+
+ explicit eater_codecvt(size_t refs = 0) : base(refs) {}
+
+ // primitive conversion
+ virtual base::result
+ do_in(mbstate_t& mb,
+ const char* ebegin, const char* eend, const char*& ecur,
+ char* ibegin, char* iend, char*& icur) const __NO_THROW {
+ char *state = (char*)&mb;
+ ecur = ebegin;
+ icur = ibegin;
+
+ while (ecur != eend) {
+ if (icur == iend)
+ return partial;
+ if (*ecur == '0' || *state == 1) {
+ if (*state != 1) {
+ ++ecur;
+ }
+ if (ecur == eend) {
+ *state = 1;
+ return ok;
+ }
+
+ if (*ecur == '1') {
+ *icur = 'a';
+ }
+ else {
+ *(icur++) = '0';
+ if (icur == iend) {
+ if (*state != 1) {
+ --ecur;
+ }
+ return partial;
+ }
+ *icur = *ecur;
+ }
+ }
+ else {
+ *icur = *ecur;
+ }
+
+ *state = 0;
+ ++icur;
+ ++ecur;
+ }
+
+ return ok;
+ }
+
+ // claim it's not a null-conversion
+ virtual bool do_always_noconv() const __NO_THROW
+ { return false; }
+
+ // claim it doesn't have a fixed-length encoding
+ virtual int do_encoding() const __NO_THROW
+ { return 0; }
+
+ // implemented for consistency with do_in overload
+ virtual int do_length(mbstate_t &state,
+ const char *efrom, const char *eend, size_t m) const {
+ char *ibegin = new char[m];
+ const char *ecur = efrom;
+ char *icur = ibegin;
+ mbstate_t tmp = state;
+ do_in(tmp, efrom, eend, ecur, ibegin, ibegin + m, icur);
+ delete[] ibegin;
+ return ecur - efrom;
+ }
+
+ virtual int do_max_length() const __NO_THROW
+ { return 2; }
+
+#ifdef __DMC__
+ static locale::id id;
+#endif
+};
+
+#ifdef __DMC__
+locale::id eater_codecvt::id;
+
+locale::id& _GetFacetId(const eater_codecvt*)
+{ return eater_codecvt::id; }
+#endif
+
+/* Codecvt facet generating more characters than the ones read from the
+ * external buffer, transform '01' in 'abc'
+ * This kind of facet do not allow systematical positionning in the external
+ * buffer (tellg -> -1), when you just read a 'a' you are at an undefined
+ * external buffer position.
+ */
+struct generator_codecvt : public codecvt<char, char, mbstate_t> {
+ typedef codecvt<char,char,mbstate_t> base;
+
+ explicit generator_codecvt(size_t refs = 0) : base(refs) {}
+
+ // primitive conversion
+ virtual base::result
+ do_in(mbstate_t& mb,
+ const char* ebegin, const char* eend, const char*& ecur,
+ char* ibegin, char* iend, char*& icur) const __NO_THROW {
+ //Access the mbstate information in a portable way:
+ char *state = (char*)&mb;
+ ecur = ebegin;
+ icur = ibegin;
+
+ if (icur == iend) return ok;
+
+ if (*state == 2) {
+ *(icur++) = 'b';
+ if (icur == iend) {
+ *state = 3;
+ return ok;
+ }
+ *(icur++) = 'c';
+ *state = 0;
+ }
+ else if (*state == 3) {
+ *(icur++) = 'c';
+ *state = 0;
+ }
+
+ while (ecur != eend) {
+ if (icur == iend)
+ return ok;
+ if (*ecur == '0' || *state == 1) {
+ if (*state != 1) {
+ ++ecur;
+ }
+ if (ecur == eend) {
+ *state = 1;
+ return partial;
+ }
+
+ if (*ecur == '1') {
+ *(icur++) = 'a';
+ if (icur == iend) {
+ *state = 2;
+ return ok;
+ }
+ *(icur++) = 'b';
+ if (icur == iend) {
+ *state = 3;
+ return ok;
+ }
+ *icur = 'c';
+ }
+ else {
+ *(icur++) = '0';
+ if (icur == iend) {
+ if (*state != 1) {
+ --ecur;
+ }
+ return ok;
+ }
+ *icur = *ecur;
+ }
+ }
+ else {
+ *icur = *ecur;
+ }
+
+ *state = 0;
+ ++icur;
+ ++ecur;
+ }
+
+ return ok;
+ }
+
+ // claim it's not a null-conversion
+ virtual bool do_always_noconv() const __NO_THROW
+ { return false; }
+
+ // claim it doesn't have a fixed-length encoding
+ virtual int do_encoding() const __NO_THROW
+ { return 0; }
+
+ // implemented for consistency with do_in overload
+ virtual int do_length(mbstate_t &mb,
+ const char *efrom, const char *eend, size_t m) const {
+ const char *state = (const char*)&mb;
+ int offset = 0;
+ if (*state == 2)
+ offset = 2;
+ else if (*state == 3)
+ offset = 1;
+
+ char *ibegin = new char[m + offset];
+ const char *ecur = efrom;
+ char *icur = ibegin;
+ mbstate_t tmpState = mb;
+ do_in(tmpState, efrom, eend, ecur, ibegin, ibegin + m + offset, icur);
+ /*
+ char *state = (char*)&tmpState;
+ if (*state != 0) {
+ if (*state == 1)
+ --ecur;
+ else if (*state == 2 || *state == 3) {
+ //Undefined position, we return -1:
+ ecur = efrom - 1;
+ }
+ }
+ else {
+ if (*((char*)&mb) != 0) {
+ //We take into account the character that hasn't been counted yet in
+ //the previous decoding step:
+ ecur++;
+ }
+ }
+ */
+ delete[] ibegin;
+ return (int)min((size_t)(ecur - efrom), m);
+ }
+
+ virtual int do_max_length() const __NO_THROW
+ { return 0; }
+#ifdef __DMC__
+ static locale::id id;
+#endif
+};
+
+#ifdef __DMC__
+locale::id generator_codecvt::id;
+
+locale::id& _GetFacetId(const generator_codecvt*)
+{ return generator_codecvt::id; }
+#endif
+
+//
+// tests implementation
+//
+void CodecvtTest::variable_encoding()
+{
+#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES)
+ //We first generate the file used for test:
+ const char* fileName = "test_file.txt";
+ {
+ ofstream ostr(fileName);
+ //Maybe we simply do not have write access to repository
+ CPPUNIT_ASSERT( ostr.good() );
+ for (int i = 0; i < 2048; ++i) {
+ ostr << "0123456789";
+ }
+ CPPUNIT_ASSERT( ostr.good() );
+ }
+
+ {
+ ifstream istr(fileName);
+ CPPUNIT_ASSERT( istr.good() );
+ CPPUNIT_ASSERT( !istr.eof() );
+
+ eater_codecvt codec(1);
+ locale loc(locale::classic(), &codec);
+
+ istr.imbue(loc);
+ CPPUNIT_ASSERT( istr.good() );
+ CPPUNIT_ASSERT( (int)istr.tellg() == 0 );
+
+ int theoricalPos = 0;
+ do {
+ int c = istr.get();
+ if (char_traits<char>::eq_int_type(c, char_traits<char>::eof())) {
+ break;
+ }
+ ++theoricalPos;
+ if (c == 'a') {
+ ++theoricalPos;
+ }
+
+ CPPUNIT_ASSERT( (int)istr.tellg() == theoricalPos );
+ }
+ while (!istr.eof());
+
+ CPPUNIT_ASSERT( istr.eof() );
+ }
+
+# if 0
+ /* This test is broken, not sure if it is really possible to get a position in
+ * a locale having a codecvt such as generator_codecvt. Maybe generator_codecvt
+ * is not a valid theorical example of codecvt implementation. */
+ {
+ ifstream istr(fileName);
+ CPPUNIT_ASSERT( istr.good() );
+ CPPUNIT_ASSERT( !istr.eof() );
+
+ generator_codecvt codec(1);
+ locale loc(locale::classic(), &codec);
+
+ istr.imbue(loc);
+ CPPUNIT_ASSERT( istr.good() );
+ CPPUNIT_ASSERT( (int)istr.tellg() == 0 );
+
+ int theoricalPos = 0;
+ int theoricalTellg;
+ do {
+ char c = istr.get();
+ if (c == char_traits<char>::eof()) {
+ break;
+ }
+ switch (c) {
+ case 'a':
+ case 'b':
+ theoricalTellg = -1;
+ break;
+ case 'c':
+ ++theoricalPos;
+ default:
+ ++theoricalPos;
+ theoricalTellg = theoricalPos;
+ break;
+ }
+
+ if ((int)istr.tellg() != theoricalTellg) {
+ CPPUNIT_ASSERT( (int)istr.tellg() == theoricalTellg );
+ }
+ }
+ while (!istr.eof());
+
+ CPPUNIT_ASSERT( istr.eof() );
+ }
+# endif
+#endif
+}
+
+void CodecvtTest::in_out_test()
+{
+#if !defined (STLPORT) || !(defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS))
+ try {
+ locale loc("");
+
+ typedef codecvt<wchar_t, char, mbstate_t> cdecvt_type;
+ if (has_facet<cdecvt_type>(loc)) {
+ cdecvt_type const& cdect = use_facet<cdecvt_type>(loc);
+ {
+ cdecvt_type::state_type state;
+ memset(&state, 0, sizeof(cdecvt_type::state_type));
+ string from("abcdef");
+ const char* next_from;
+ wchar_t to[1];
+ wchar_t *next_to;
+ cdecvt_type::result res = cdect.in(state, from.data(), from.data() + from.size(), next_from,
+ to, to + sizeof(to) / sizeof(wchar_t), next_to);
+ CPPUNIT_ASSERT( res == cdecvt_type::ok );
+ CPPUNIT_ASSERT( next_from == from.data() + 1 );
+ CPPUNIT_ASSERT( next_to == &to[0] + 1 );
+ CPPUNIT_ASSERT( to[0] == L'a');
+ }
+ {
+ cdecvt_type::state_type state;
+ memset(&state, 0, sizeof(cdecvt_type::state_type));
+ wstring from(L"abcdef");
+ const wchar_t* next_from;
+ char to[1];
+ char *next_to;
+ cdecvt_type::result res = cdect.out(state, from.data(), from.data() + from.size(), next_from,
+ to, to + sizeof(to) / sizeof(char), next_to);
+ CPPUNIT_ASSERT( res == cdecvt_type::ok );
+ CPPUNIT_ASSERT( next_from == from.data() + 1 );
+ CPPUNIT_ASSERT( next_to == &to[0] + 1 );
+ CPPUNIT_ASSERT( to[0] == 'a');
+ }
+ }
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+#endif
+}
+
+void CodecvtTest::length_test()
+{
+#if !defined (STLPORT) || !(defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS))
+ try {
+ locale loc("");
+
+ typedef codecvt<wchar_t, char, mbstate_t> cdecvt_type;
+ if (has_facet<cdecvt_type>(loc)) {
+ cdecvt_type const& cdect = use_facet<cdecvt_type>(loc);
+ {
+ cdecvt_type::state_type state;
+ memset(&state, 0, sizeof(cdecvt_type::state_type));
+ string from("abcdef");
+ int res = cdect.length(state, from.data(), from.data() + from.size(), from.size());
+ CPPUNIT_ASSERT( (size_t)res == from.size() );
+ }
+ }
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+#endif
+}
+
+#if !defined (STLPORT) || !(defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS))
+typedef std::codecvt<wchar_t, char, mbstate_t> my_codecvt_base;
+
+class my_codecvt : public my_codecvt_base {
+public:
+ explicit my_codecvt(size_t r = 0)
+ : my_codecvt_base(r) {}
+
+protected:
+ virtual result do_in(state_type& /*state*/, const extern_type* first1,
+ const extern_type* last1, const extern_type*& next1,
+ intern_type* first2, intern_type* last2,
+ intern_type*& next2) const {
+ for ( next1 = first1, next2 = first2; next1 < last1; next1 += 2 ) {
+ if ( (last1 - next1) < 2 || (last2 - next2) < 1 )
+ return partial;
+ *next2++ = (intern_type)((*(next1 + 1) << 8) | (*next1 & 255));
+ }
+ return ok;
+ }
+ virtual bool do_always_noconv() const __NO_THROW
+ { return false; }
+ virtual int do_max_length() const __NO_THROW
+ { return 2; }
+ virtual int do_encoding() const __NO_THROW
+ { return 2; }
+};
+#endif
+
+void CodecvtTest::imbue_while_reading()
+{
+#if !defined (STLPORT) || !(defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS))
+ {
+ wofstream ofs( "test.txt" );
+ const wchar_t buf[] = L" ";
+ for ( int i = 0; i < 4098; ++i ) {
+ ofs << buf[0];
+ }
+ }
+
+ wifstream ifs("test.txt"); // a file containing 4098 wchars
+
+ ifs.imbue( locale(locale(), new my_codecvt) );
+ ifs.get();
+ ifs.seekg(0);
+ ifs.imbue( locale() );
+ ifs.ignore(4096);
+ int ch = ifs.get();
+ CPPUNIT_CHECK( ch != (int)WEOF );
+#endif
+}
+
+void CodecvtTest::special_encodings()
+{
+#if !defined (STLPORT) || (!defined (_STLP_NO_WCHAR_T) && defined (_STLP_USE_EXCEPTIONS))
+ {
+ locale loc(locale::classic(), new codecvt_byname<wchar_t, char, mbstate_t>("C"));
+ codecvt<wchar_t, char, mbstate_t> const& cvt = use_facet<codecvt<wchar_t, char, mbstate_t> >(loc);
+ mbstate_t state;
+ memset(&state, 0, sizeof(mbstate_t));
+ char c = '0';
+ const char *from_next;
+ wchar_t wc;
+ wchar_t *to_next;
+ CPPUNIT_ASSERT( cvt.in(state, &c, &c + 1, from_next, &wc, &wc, to_next) == codecvt_base::ok );
+ CPPUNIT_ASSERT( to_next == &wc );
+ CPPUNIT_ASSERT( cvt.in(state, &c, &c + 1, from_next, &wc, &wc + 1, to_next) == codecvt_base::ok );
+ CPPUNIT_ASSERT( wc == L'0' );
+ CPPUNIT_ASSERT( to_next == &wc + 1 );
+ }
+ try
+ {
+ wstring cp936_wstr;
+ const string cp936_str = "\xd6\xd0\xb9\xfa\xc9\xe7\xbb\xe1\xbf\xc6\xd1\xa7\xd4\xba\xb7\xa2\xb2\xbc\x32\x30\x30\x38\xc4\xea\xa1\xb6\xbe\xad\xbc\xc3\xc0\xb6\xc6\xa4\xca\xe9\xa1\xb7\xd6\xb8\xb3\xf6\xa3\xac\x32\x30\x30\x37\xc4\xea\xd6\xd0\xb9\xfa\xbe\xad\xbc\xc3\xd4\xf6\xb3\xa4\xd3\xc9\xc6\xab\xbf\xec\xd7\xaa\xcf\xf2\xb9\xfd\xc8\xc8\xb5\xc4\xc7\xf7\xca\xc6\xc3\xf7\xcf\xd4\xd4\xa4\xbc\xc6\xc8\xab\xc4\xea\x47\x44\x50\xd4\xf6\xcb\xd9\xbd\xab\xb4\xef\x31\x31\x2e\x36\x25\xa1\xa3";
+ locale loc(locale::classic(), ".936", locale::ctype);
+ codecvt<wchar_t, char, mbstate_t> const& cvt = use_facet<codecvt<wchar_t, char, mbstate_t> >(loc);
+ mbstate_t state;
+ memset(&state, 0, sizeof(mbstate_t));
+
+ codecvt_base::result res;
+
+ {
+ wchar_t wbuf[4096];
+ // Check we will have enough room for the generated wide string generated from the whole char buffer:
+ int len = cvt.length(state, cp936_str.data(), cp936_str.data() + cp936_str.size(), sizeof(wbuf) / sizeof(wchar_t));
+ CPPUNIT_ASSERT( cp936_str.size() == (size_t)len );
+
+ const char *from_next;
+ wchar_t *to_next;
+ res = cvt.in(state, cp936_str.data(), cp936_str.data() + cp936_str.size(), from_next,
+ wbuf, wbuf + sizeof(wbuf) / sizeof(wchar_t), to_next);
+ CPPUNIT_ASSERT( res == codecvt_base::ok );
+ CPPUNIT_ASSERT( from_next == cp936_str.data() + cp936_str.size() );
+ cp936_wstr.assign(wbuf, to_next);
+ }
+
+ {
+ const wchar_t *from_next;
+ char buf[4096];
+ char *to_next;
+ res = cvt.out(state, cp936_wstr.data(), cp936_wstr.data() + cp936_wstr.size(), from_next,
+ buf, buf + sizeof(buf), to_next);
+ CPPUNIT_ASSERT( res == codecvt_base::ok );
+ CPPUNIT_CHECK( string(buf, to_next) == cp936_str );
+ }
+ }
+ catch (const runtime_error&)
+ {
+ CPPUNIT_MESSAGE("Not enough platform localization support to check 936 code page encoding.");
+ }
+ try
+ {
+ const string utf8_str = "\xe4\xb8\xad\xe5\x9b\xbd\xe7\xa4\xbe\xe4\xbc\x9a\xe7\xa7\x91\xe5\xad\xa6\xe9\x99\xa2\xe5\x8f\x91\xe5\xb8\x83\x32\x30\x30\x38\xe5\xb9\xb4\xe3\x80\x8a\xe7\xbb\x8f\xe6\xb5\x8e\xe8\x93\x9d\xe7\x9a\xae\xe4\xb9\xa6\xe3\x80\x8b\xe6\x8c\x87\xe5\x87\xba\xef\xbc\x8c\x32\x30\x30\x37\xe5\xb9\xb4\xe4\xb8\xad\xe5\x9b\xbd\xe7\xbb\x8f\xe6\xb5\x8e\xe5\xa2\x9e\xe9\x95\xbf\xe7\x94\xb1\xe5\x81\x8f\xe5\xbf\xab\xe8\xbd\xac\xe5\x90\x91\xe8\xbf\x87\xe7\x83\xad\xe7\x9a\x84\xe8\xb6\x8b\xe5\x8a\xbf\xe6\x98\x8e\xe6\x98\xbe\xe9\xa2\x84\xe8\xae\xa1\xe5\x85\xa8\xe5\xb9\xb4\x47\x44\x50\xe5\xa2\x9e\xe9\x80\x9f\xe5\xb0\x86\xe8\xbe\xbe\x31\x31\x2e\x36\x25\xe3\x80\x82";
+ wstring utf8_wstr;
+ locale loc(locale::classic(), new codecvt_byname<wchar_t, char, mbstate_t>(".utf8"));
+ codecvt<wchar_t, char, mbstate_t> const& cvt = use_facet<codecvt<wchar_t, char, mbstate_t> >(loc);
+ mbstate_t state;
+ memset(&state, 0, sizeof(mbstate_t));
+
+ codecvt_base::result res;
+
+ {
+ wchar_t wbuf[4096];
+ // Check we will have enough room for the wide string generated from the whole char buffer:
+ int len = cvt.length(state, utf8_str.data(), utf8_str.data() + utf8_str.size(), sizeof(wbuf) / sizeof(wchar_t));
+ CPPUNIT_ASSERT( utf8_str.size() == (size_t)len );
+
+ const char *from_next;
+ wchar_t *to_next;
+ res = cvt.in(state, utf8_str.data(), utf8_str.data() + utf8_str.size(), from_next,
+ wbuf, wbuf + sizeof(wbuf) / sizeof(wchar_t), to_next);
+ CPPUNIT_ASSERT( res == codecvt_base::ok );
+ CPPUNIT_ASSERT( from_next == utf8_str.data() + utf8_str.size() );
+ utf8_wstr.assign(wbuf, to_next);
+
+ // Try to read one char after the other:
+ wchar_t wc;
+ const char* from = utf8_str.data();
+ const char* from_end = from + utf8_str.size();
+ from_next = utf8_str.data();
+ size_t length = 1;
+ size_t windex = 0;
+ while (from + length <= from_end) {
+ res = cvt.in(state, from, from + length, from_next,
+ &wc, &wc + 1, to_next);
+ switch (res) {
+ case codecvt_base::ok:
+ // reset length:
+ from = from_next;
+ length = 1;
+ CPPUNIT_ASSERT( wc == utf8_wstr[windex++] );
+ wc = 0;
+ break;
+ case codecvt_base::partial:
+ if (from_next == from)
+ // from_next hasn't move so we have to pass more chars
+ ++length;
+ else
+ // char between from and from_next has been eaten, we simply restart
+ // conversion from from_next:
+ from = from_next;
+ continue;
+ case codecvt_base::error:
+ case codecvt_base::noconv:
+ CPPUNIT_FAIL;
+ //break;
+ }
+ }
+ CPPUNIT_ASSERT( windex == utf8_wstr.size() );
+ }
+
+ {
+ const wchar_t *from_next;
+ char buf[4096];
+ char *to_next;
+ res = cvt.out(state, utf8_wstr.data(), utf8_wstr.data() + utf8_wstr.size(), from_next,
+ buf, buf + sizeof(buf), to_next);
+ CPPUNIT_ASSERT( res == codecvt_base::ok );
+ CPPUNIT_CHECK( string(buf, to_next) == utf8_str );
+ }
+
+ {
+ // Check that an obviously wrong UTF8 encoded string is correctly detected:
+ const string bad_utf8_str("\xdf\xdf\xdf\xdf\xdf");
+ wchar_t wc;
+ const char *from_next;
+ wchar_t *to_next;
+ res = cvt.in(state, bad_utf8_str.data(), bad_utf8_str.data() + bad_utf8_str.size(), from_next,
+ &wc, &wc + 1, to_next);
+ CPPUNIT_ASSERT( res == codecvt_base::error );
+ }
+ }
+ catch (const runtime_error&)
+ {
+ CPPUNIT_MESSAGE("Not enough platform localization support to check UTF8 encoding.");
+ }
+#endif
+}
+
+#endif
diff --git a/test/unit/collate_facets_test.cpp b/test/unit/collate_facets_test.cpp
new file mode 100644
index 0000000..b6a1b14
--- /dev/null
+++ b/test/unit/collate_facets_test.cpp
@@ -0,0 +1,279 @@
+#include "locale_test.h"
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <locale>
+# include <stdexcept>
+# include <algorithm>
+# include <vector>
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+//
+// tests implementation
+//
+void LocaleTest::collate_facet()
+{
+ {
+ CPPUNIT_ASSERT( has_facet<collate<char> >(locale::classic()) );
+ collate<char> const& col = use_facet<collate<char> >(locale::classic());
+
+ char const str1[] = "abcdef1";
+ char const str2[] = "abcdef2";
+ const size_t size1 = sizeof(str1) / sizeof(str1[0]) - 1;
+ const size_t size2 = sizeof(str2) / sizeof(str2[0]) - 1;
+
+ CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) == 0 );
+ CPPUNIT_ASSERT( col.compare(str1, str1 + size1, str2, str2 + size2) == -1 );
+
+ //Smallest string should be before largest one:
+ CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) == -1 );
+ CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) == 1 );
+ }
+
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try {
+ locale loc("fr_FR");
+ {
+ CPPUNIT_ASSERT( has_facet<collate<char> >(loc) );
+ collate<char> const& col = use_facet<collate<char> >(loc);
+
+ char const str1[] = "abcdef1";
+ char const str2[] = "abcdef2";
+ const size_t size1 = sizeof(str1) / sizeof(str1[0]) - 1;
+ const size_t size2 = sizeof(str2) / sizeof(str2[0]) - 1;
+
+ CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) == 0 );
+ CPPUNIT_ASSERT( col.compare(str1, str1 + size1, str2, str2 + size2) == -1 );
+
+ //Smallest string should be before largest one:
+ CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) == -1 );
+ CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) == 1 );
+ }
+ {
+ CPPUNIT_ASSERT( has_facet<collate<char> >(loc) );
+ collate<char> const& col = use_facet<collate<char> >(loc);
+
+ string strs[] = {"abdd", "abçd", "abbd", "abcd"};
+
+ string transformed[4];
+ for (size_t i = 0; i < 4; ++i) {
+ transformed[i] = col.transform(strs[i].data(), strs[i].data() + strs[i].size());
+ }
+
+ sort(strs, strs + 4, loc);
+ CPPUNIT_ASSERT( strs[0] == "abbd" );
+ CPPUNIT_ASSERT( strs[1] == "abcd" );
+ CPPUNIT_ASSERT( strs[2] == "abçd" );
+ CPPUNIT_ASSERT( strs[3] == "abdd" );
+
+ sort(transformed, transformed + 4);
+
+ CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data() + strs[0].size()) == transformed[0] );
+ CPPUNIT_ASSERT( col.transform(strs[1].data(), strs[1].data() + strs[1].size()) == transformed[1] );
+ CPPUNIT_ASSERT( col.transform(strs[2].data(), strs[2].data() + strs[2].size()) == transformed[2] );
+ CPPUNIT_ASSERT( col.transform(strs[3].data(), strs[3].data() + strs[3].size()) == transformed[3] );
+
+ // Check empty string result in empty key.
+ CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data()).empty() );
+
+ // Check that only characters that matter are taken into accout to build the key.
+ CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data() + 2) == col.transform(strs[1].data(), strs[1].data() + 2) );
+ }
+# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+ {
+ CPPUNIT_ASSERT( has_facet<collate<wchar_t> >(loc) );
+ collate<wchar_t> const& col = use_facet<collate<wchar_t> >(loc);
+
+ wchar_t const str1[] = L"abcdef1";
+ wchar_t const str2[] = L"abcdef2";
+ const size_t size1 = sizeof(str1) / sizeof(str1[0]) - 1;
+ const size_t size2 = sizeof(str2) / sizeof(str2[0]) - 1;
+
+ CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) == 0 );
+ CPPUNIT_ASSERT( col.compare(str1, str1 + size1, str2, str2 + size2) == -1 );
+
+ //Smallest string should be before largest one:
+ CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) == -1 );
+ CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) == 1 );
+ }
+ {
+ size_t i;
+ CPPUNIT_ASSERT( has_facet<collate<wchar_t> >(loc) );
+ collate<wchar_t> const& col = use_facet<collate<wchar_t> >(loc);
+
+ // Here we would like to use L"abçd" but it looks like all compilers
+ // do not support storage of unicode characters in exe resulting in
+ // compilation error. We avoid this test for the moment.
+ wstring strs[] = {L"abdd", L"abcd", L"abbd", L"abcd"};
+
+ wstring transformed[4];
+ for (i = 0; i < 4; ++i) {
+ transformed[i] = col.transform(strs[i].data(), strs[i].data() + strs[i].size());
+ }
+
+ sort(strs, strs + 4, loc);
+ CPPUNIT_ASSERT( strs[0] == L"abbd" );
+ CPPUNIT_ASSERT( strs[1] == L"abcd" );
+ CPPUNIT_ASSERT( strs[2] == L"abcd" );
+ CPPUNIT_ASSERT( strs[3] == L"abdd" );
+
+ sort(transformed, transformed + 4);
+
+ CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data() + strs[0].size()) == transformed[0] );
+ CPPUNIT_ASSERT( col.transform(strs[1].data(), strs[1].data() + strs[1].size()) == transformed[1] );
+ CPPUNIT_ASSERT( col.transform(strs[2].data(), strs[2].data() + strs[2].size()) == transformed[2] );
+ CPPUNIT_ASSERT( col.transform(strs[3].data(), strs[3].data() + strs[3].size()) == transformed[3] );
+
+ CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data()).empty() );
+
+ CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data() + 2) == col.transform(strs[1].data(), strs[1].data() + 2) );
+ }
+# endif
+ }
+ catch (runtime_error const&) {
+ CPPUNIT_MESSAGE("No french locale to check collate facet");
+ }
+# endif
+}
+
+void LocaleTest::collate_by_name()
+{
+ /*
+ * Check of the 22.1.1.2.7 standard point. Construction of a locale
+ * instance from a null pointer or an unknown name should result in
+ * a runtime_error exception.
+ */
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+# if defined (STLPORT) || !defined (__GNUC__)
+ try {
+ locale loc(locale::classic(), new collate_byname<char>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new collate_byname<char>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ string veryLongFacetName("LC_COLLATE=");
+ veryLongFacetName.append(512, '?');
+ locale loc(locale::classic(), new collate_byname<char>(veryLongFacetName.c_str()));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), "C", locale::collate);
+ }
+ catch (runtime_error const& e) {
+ CPPUNIT_MESSAGE( e.what() );
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ // On platform without real localization support we should rely on the "C" facet.
+ locale loc(locale::classic(), "", locale::collate);
+ }
+ catch (runtime_error const& e) {
+ CPPUNIT_MESSAGE( e.what() );
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), new collate_byname<char>("C"));
+
+ //We check that the C locale gives a lexicographical comparison:
+ collate<char> const& cfacet_byname = use_facet<collate<char> >(loc);
+ collate<char> const& cfacet = use_facet<collate<char> >(locale::classic());
+
+ char const str1[] = "abcdef1";
+ char const str2[] = "abcdef2";
+ const size_t size1 = sizeof(str1) / sizeof(str1[0]) - 1;
+ const size_t size2 = sizeof(str2) / sizeof(str2[0]) - 1;
+
+ CPPUNIT_ASSERT( cfacet_byname.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) ==
+ cfacet.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) );
+ CPPUNIT_ASSERT( cfacet_byname.compare(str1, str1 + size1, str2, str2 + size2) ==
+ cfacet.compare(str1, str1 + size1, str2, str2 + size2) );
+
+ //Smallest string should be before largest one:
+ CPPUNIT_ASSERT( cfacet_byname.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) ==
+ cfacet.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) );
+ CPPUNIT_ASSERT( cfacet_byname.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) ==
+ cfacet.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) );
+
+ // We cannot play with 'ç' char here because doing so would make test result
+ // dependant on char being consider as signed or not...
+ string strs[] = {"abdd", /* "abçd",*/ "abbd", "abcd"};
+
+ vector<string> v1(strs, strs + sizeof(strs) / sizeof(strs[0]));
+ sort(v1.begin(), v1.end(), loc);
+ vector<string> v2(strs, strs + sizeof(strs) / sizeof(strs[0]));
+ sort(v2.begin(), v2.end(), locale::classic());
+ CPPUNIT_ASSERT( v1 == v2 );
+
+ CPPUNIT_ASSERT( (cfacet_byname.transform(v1[0].data(), v1[0].data() + v1[0].size()).compare(cfacet_byname.transform(v1[1].data(), v1[1].data() + v1[1].size())) ==
+ v1[0].compare(v1[1])) );
+ }
+ catch (runtime_error const& /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+# if defined (STLPORT) || !defined (__GNUC__)
+ try {
+ locale loc(locale::classic(), new collate_byname<wchar_t>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new collate_byname<wchar_t>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+# endif
+}
+
+#endif
diff --git a/test/unit/complete_digits.h b/test/unit/complete_digits.h
new file mode 100644
index 0000000..0a3d933
--- /dev/null
+++ b/test/unit/complete_digits.h
@@ -0,0 +1,19 @@
+#ifndef STLP_DIGITS_H
+#define STLP_DIGITS_H
+
+#include <string>
+
+inline void
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+complete_digits(std::string &digits)
+#else
+complete_digits(string &digits)
+#endif
+{
+ while (digits.size() < 2)
+ {
+ digits.insert(digits.begin(), '0');
+ }
+}
+
+#endif
diff --git a/test/unit/complex_header_test.cpp b/test/unit/complex_header_test.cpp
new file mode 100644
index 0000000..367f3d0
--- /dev/null
+++ b/test/unit/complex_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <complex>
diff --git a/test/unit/config_test.cpp b/test/unit/config_test.cpp
new file mode 100644
index 0000000..92846ba
--- /dev/null
+++ b/test/unit/config_test.cpp
@@ -0,0 +1,121 @@
+#include <new>
+#include <vector>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if defined (_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class ConfigTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(ConfigTest);
+#if !defined (STLPORT)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(placement_new_bug);
+ CPPUNIT_TEST(endianess);
+ CPPUNIT_TEST(template_function_partial_ordering);
+#if !defined (_STLP_USE_EXCEPTIONS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(new_throw_bad_alloc);
+ CPPUNIT_TEST_SUITE_END();
+
+ protected:
+ void placement_new_bug();
+ void endianess();
+ void template_function_partial_ordering();
+ void new_throw_bad_alloc();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ConfigTest);
+
+void ConfigTest::placement_new_bug()
+{
+#if defined (STLPORT)
+ int int_val = 1;
+ int *pint;
+ pint = new(&int_val) int();
+ CPPUNIT_ASSERT( pint == &int_val );
+# if defined (_STLP_DEF_CONST_PLCT_NEW_BUG)
+ CPPUNIT_ASSERT( int_val != 0 );
+# else
+ CPPUNIT_ASSERT( int_val == 0 );
+# endif
+#endif
+}
+
+void ConfigTest::endianess()
+{
+#if defined (STLPORT)
+ int val = 0x01020304;
+ char *ptr = (char*)(&val);
+# if defined (_STLP_BIG_ENDIAN)
+ //This test only work if sizeof(int) == 4, this is a known limitation
+ //that will be handle the day we find a compiler for which it is false.
+ CPPUNIT_ASSERT( *ptr == 0x01 ||
+ sizeof(int) > 4 && *ptr == 0x00 );
+# elif defined (_STLP_LITTLE_ENDIAN)
+ CPPUNIT_ASSERT( *ptr == 0x04 );
+# endif
+#endif
+}
+
+void ConfigTest::template_function_partial_ordering()
+{
+#if defined (STLPORT)
+ vector<int> vect1(10, 0);
+ int* pvect1Front = &vect1.front();
+ vector<int> vect2(10, 0);
+ int* pvect2Front = &vect2.front();
+
+ swap(vect1, vect2);
+
+# if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ CPPUNIT_ASSERT( pvect1Front == &vect2.front() );
+ CPPUNIT_ASSERT( pvect2Front == &vect1.front() );
+# else
+ CPPUNIT_ASSERT( pvect1Front != &vect2.front() );
+ CPPUNIT_ASSERT( pvect2Front != &vect1.front() );
+# endif
+#endif
+}
+
+void ConfigTest::new_throw_bad_alloc()
+{
+#if defined (STLPORT) && defined (_STLP_USE_EXCEPTIONS)
+ try
+ {
+ /* We try to exhaust heap memory. However, we don't actually use the
+ largest possible size_t value bus slightly less in order to avoid
+ triggering any overflows due to the allocator adding some more for
+ its internal data structures. */
+ size_t const huge_amount = size_t(-1) - 1024;
+ void* pvoid = operator new (huge_amount);
+#if !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+ // Allocation should have fail
+ CPPUNIT_ASSERT( pvoid != 0 );
+#endif
+ // Just in case it succeeds:
+ operator delete(pvoid);
+ }
+ catch (const bad_alloc&)
+ {
+#if defined (_STLP_NEW_DONT_THROW_BAD_ALLOC)
+ // Looks like your compiler new operator finally throw bad_alloc, you can fix
+ // configuration.
+ CPPUNIT_FAIL;
+#endif
+ }
+ catch (...)
+ {
+ //We shouldn't be there:
+ //Not bad_alloc exception thrown.
+ CPPUNIT_FAIL;
+ }
+#endif
+}
diff --git a/test/unit/copy_test.cpp b/test/unit/copy_test.cpp
new file mode 100644
index 0000000..852e687
--- /dev/null
+++ b/test/unit/copy_test.cpp
@@ -0,0 +1,129 @@
+#include <algorithm>
+#include <cstring>
+#include <vector>
+#include <iterator>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class CopyTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(CopyTest);
+ CPPUNIT_TEST(copy_array);
+ CPPUNIT_TEST(copy_volatile);
+ CPPUNIT_TEST(copy_vector);
+ CPPUNIT_TEST(copy_insert);
+ CPPUNIT_TEST(copy_back);
+ CPPUNIT_TEST(copy_back_array);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void copy_array();
+ void copy_volatile();
+ void copy_vector();
+ void copy_insert();
+ void copy_back();
+ void copy_back_array();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(CopyTest);
+
+//
+// tests implementation
+//
+void CopyTest::copy_array()
+{
+ char string[23] = "A string to be copied.";
+ char result[23];
+ copy(string, string + 23, result);
+ CPPUNIT_ASSERT(!strncmp(string, result, 23));
+}
+
+void CopyTest::copy_volatile()
+{
+ {
+ int a[] = {0, 1, 2, 3, 4, 5};
+ const size_t size = sizeof(a) / sizeof(a[0]);
+ volatile int va[size];
+ copy(a, a + size, va);
+ for (size_t i = 0; i != size; ++i) {
+ CPPUNIT_ASSERT( a[i] == va[i] );
+ }
+ }
+
+ {
+ const int a[] = {0, 1, 2, 3, 4, 5};
+ const size_t size = sizeof(a) / sizeof(a[0]);
+ volatile int va[size];
+ copy(a, a + size, va);
+ for (size_t i = 0; i != size; ++i) {
+ CPPUNIT_ASSERT( a[i] == va[i] );
+ }
+ }
+
+ // Following code can be activated to check that it doesn't compiled
+#if 0
+ {
+ int a[] = {0, 1, 2, 3, 4, 5};
+ const size_t size = sizeof(a) / sizeof(a[0]);
+ const volatile int va[size] = {5, 4, 3, 2, 1, 0};
+ copy(a, a + size, va);
+ for (size_t i = 0; i != size; ++i) {
+ CPPUNIT_ASSERT( a[i] == va[i] );
+ }
+ }
+#endif
+}
+
+void CopyTest::copy_vector()
+{
+ vector<int> v1(10);
+ for (int i = 0; (size_t)i < v1.size(); ++i)
+ v1[i] = i;
+
+ vector<int> v2(v1.size());
+ copy(v1.begin(), v1.end(), v2.begin());
+
+ CPPUNIT_ASSERT( v2 == v1 );
+}
+
+void CopyTest::copy_insert() {
+ vector<int> v1(10);
+ for (int loc = 0; (size_t)loc < v1.size(); ++loc)
+ v1[loc] = loc;
+ vector<int> v2;
+ insert_iterator<vector<int> > i(v2, v2.begin());
+ copy(v1.begin(), v1.end(), i);
+
+ CPPUNIT_ASSERT( v2 == v1 );
+}
+
+void CopyTest::copy_back()
+{
+ vector<int> v1(10);
+ for (int i = 0; (size_t)i < v1.size(); ++i)
+ v1[i] = i;
+ vector<int> v2(v1.size());
+ copy_backward(v1.begin(), v1.end(), v2.end());
+
+ CPPUNIT_ASSERT( v2 == v1 );
+}
+
+void CopyTest::copy_back_array()
+{
+ int numbers[5] = { 1, 2, 3, 4, 5 };
+
+ int result[5];
+ copy_backward(numbers, numbers + 5, (int*)result + 5);
+ CPPUNIT_ASSERT(result[0]==numbers[0]);
+ CPPUNIT_ASSERT(result[1]==numbers[1]);
+ CPPUNIT_ASSERT(result[2]==numbers[2]);
+ CPPUNIT_ASSERT(result[3]==numbers[3]);
+ CPPUNIT_ASSERT(result[4]==numbers[4]);
+}
diff --git a/test/unit/count_test.cpp b/test/unit/count_test.cpp
new file mode 100644
index 0000000..edf96e0
--- /dev/null
+++ b/test/unit/count_test.cpp
@@ -0,0 +1,73 @@
+#include <algorithm>
+#include <vector>
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class CountTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(CountTest);
+ CPPUNIT_TEST(count0);
+ CPPUNIT_TEST(count1);
+ CPPUNIT_TEST(countif1);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void count0();
+ void count1();
+ void countif1();
+ static int odd(int a_);
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(CountTest);
+
+//
+// tests implementation
+//
+void CountTest::count0()
+{
+ int numbers[10] = { 1, 2, 4, 1, 2, 4, 1, 2, 4, 1 };
+
+ int result = count(numbers, numbers + 10, 1);
+ CPPUNIT_ASSERT(result==4);
+#if defined (STLPORT) && !defined (_STLP_NO_ANACHRONISMS)
+ result = 0;
+ count(numbers, numbers + 10, 1, result);
+ CPPUNIT_ASSERT(result==4);
+#endif
+}
+void CountTest::count1()
+{
+ vector <int> numbers(100);
+ for(int i = 0; i < 100; i++)
+ numbers[i] = i % 3;
+ int elements = count(numbers.begin(), numbers.end(), 2);
+ CPPUNIT_ASSERT(elements==33);
+#if defined (STLPORT) && !defined (_STLP_NO_ANACHRONISMS)
+ elements = 0;
+ count(numbers.begin(), numbers.end(), 2, elements);
+ CPPUNIT_ASSERT(elements==33);
+#endif
+}
+void CountTest::countif1()
+{
+ vector <int> numbers(100);
+ for(int i = 0; i < 100; i++)
+ numbers[i] = i % 3;
+ int elements = count_if(numbers.begin(), numbers.end(), odd);
+ CPPUNIT_ASSERT(elements==33);
+#if defined (STLPORT) && !defined (_STLP_NO_ANACHRONISMS)
+ elements = 0;
+ count_if(numbers.begin(), numbers.end(), odd, elements);
+ CPPUNIT_ASSERT(elements==33);
+#endif
+}
+int CountTest::odd(int a_)
+{
+ return a_ % 2;
+}
diff --git a/test/unit/cppunit/cppunit_mini.h b/test/unit/cppunit/cppunit_mini.h
new file mode 100644
index 0000000..98b4a7a
--- /dev/null
+++ b/test/unit/cppunit/cppunit_mini.h
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2003, 2004
+ * Zdenek Nemec
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* $Id$ */
+
+#ifndef _CPPUNITMPFR_H_
+#define _CPPUNITMPFR_H_
+
+#if 0
+# define CPPUNIT_NS CppUnitMini
+#else
+# define CPPUNIT_NS
+#endif
+
+#include <string.h>
+
+#if 0
+namespace CPPUNIT_NS
+{
+#endif
+ class Reporter {
+ public:
+ virtual ~Reporter() {}
+ virtual void error(const char * /*macroName*/, const char * /*in_macro*/, const char * /*in_file*/, int /*in_line*/) {}
+ virtual void message( const char * /*msg*/ ) {}
+ virtual void progress( const char * /*in_className*/, const char * /*in_testName*/, bool /*ignored*/, bool /* explicit */) {}
+ virtual void end() {}
+ virtual void printSummary() {}
+ };
+
+ class TestFixture {
+ public:
+ virtual ~TestFixture() {}
+
+ //! \brief Set up context before running a test.
+ virtual void setUp() {}
+
+ //! Clean up after the test run.
+ virtual void tearDown() {}
+ };
+
+ class TestCase : public TestFixture {
+ public:
+ TestCase() { registerTestCase(this); }
+
+ void setUp() { m_failed = false; }
+ static int run(Reporter *in_reporter = 0, const char *in_testName = "", bool invert = false);
+ int numErrors() { return m_numErrors; }
+ static void registerTestCase(TestCase *in_testCase);
+
+ virtual void myRun(const char * /*in_name*/, bool /*invert*/ = false) {}
+
+ virtual void error(const char *in_macroName, const char *in_macro, const char *in_file, int in_line) {
+ m_failed = true;
+ if (m_reporter) {
+ m_reporter->error(in_macroName, in_macro, in_file, in_line);
+ }
+ }
+
+ static void message(const char *msg) {
+ if (m_reporter) {
+ m_reporter->message(msg);
+ }
+ }
+
+ bool equalDoubles(double in_expected, double in_real, double in_maxErr) {
+ double diff = in_expected - in_real;
+ if (diff < 0.) {
+ diff = -diff;
+ }
+ return diff < in_maxErr;
+ }
+
+ virtual void progress(const char *in_className, const char *in_functionName, bool ignored, bool explicitTest) {
+ ++m_numTests;
+ if (m_reporter) {
+ m_reporter->progress(in_className, in_functionName, ignored, explicitTest);
+ }
+ }
+
+ bool shouldRunThis(const char *in_desiredTest, const char *in_className, const char *in_functionName,
+ bool invert, bool explicit_test, bool &do_progress) {
+ if ((in_desiredTest) && (in_desiredTest[0] != '\0')) {
+ do_progress = false;
+ const char *ptr = strstr(in_desiredTest, "::");
+ if (ptr) {
+ bool match = (strncmp(in_desiredTest, in_className, strlen(in_className)) == 0) &&
+ (strncmp(ptr + 2, in_functionName, strlen(in_functionName)) == 0);
+ // Invert shall not make explicit test run:
+ return invert ? (match ? !match : !explicit_test)
+ : match;
+ }
+ bool match = (strcmp(in_desiredTest, in_className) == 0);
+ do_progress = match;
+ return !explicit_test && (match == !invert);
+ }
+ do_progress = true;
+ return !explicit_test;
+ }
+
+ void tearDown() {
+ if (m_failed)
+ ++m_numErrors;
+ m_reporter->end();
+ }
+
+ protected:
+ static int m_numErrors;
+ static int m_numTests;
+
+ private:
+ static TestCase *m_root;
+ TestCase *m_next;
+ bool m_failed;
+
+ static Reporter *m_reporter;
+ };
+#if 0
+}
+#endif
+
+#if !defined (CPPUNIT_MINI_HIDE_UNUSED_VARIABLE)
+# if defined (_MSC_VER)
+# define CPPUNIT_MINI_HIDE_UNUSED_VARIABLE(v) (v);
+# else
+# define CPPUNIT_MINI_HIDE_UNUSED_VARIABLE(v)
+# endif
+#endif
+
+#define CPPUNIT_TEST_SUITE(X) \
+ typedef CPPUNIT_NS::TestCase Base; \
+ virtual void myRun(const char *in_name, bool invert = false) { \
+ const char *className = #X; CPPUNIT_MINI_HIDE_UNUSED_VARIABLE(className) \
+ bool ignoring = false; CPPUNIT_MINI_HIDE_UNUSED_VARIABLE(ignoring)
+
+#if defined CPPUNIT_MINI_USE_EXCEPTIONS
+# define CPPUNIT_TEST_BASE(X, Y) \
+ { \
+ bool do_progress; \
+ bool shouldRun = shouldRunThis(in_name, className, #X, invert, Y, do_progress); \
+ if (shouldRun || do_progress) { \
+ setUp(); \
+ progress(className, #X, ignoring || !shouldRun, !ignoring && Y); \
+ if (shouldRun && !ignoring) { \
+ try { \
+ X(); \
+ } \
+ catch(...) { \
+ Base::error("Test Failed: An Exception was thrown.", #X, __FILE__, __LINE__); \
+ } \
+ } \
+ tearDown(); \
+ } \
+ }
+#else
+# define CPPUNIT_TEST_BASE(X, Y) \
+ { \
+ bool do_progress; \
+ bool shouldRun = shouldRunThis(in_name, className, #X, invert, Y, do_progress); \
+ if (shouldRun || do_progress) { \
+ setUp(); \
+ progress(className, #X, ignoring || !shouldRun, !ignoring && Y); \
+ if (shouldRun && !ignoring) \
+ X(); \
+ tearDown(); \
+ } \
+ }
+#endif
+
+#define CPPUNIT_TEST(X) CPPUNIT_TEST_BASE(X, false)
+#define CPPUNIT_EXPLICIT_TEST(X) CPPUNIT_TEST_BASE(X, true)
+
+#define CPPUNIT_IGNORE \
+ ignoring = true
+
+#define CPPUNIT_STOP_IGNORE \
+ ignoring = false
+
+#define CPPUNIT_TEST_SUITE_END() }
+
+#define CPPUNIT_TEST_SUITE_REGISTRATION(X) static X local
+
+#define CPPUNIT_CHECK(X) \
+ if (!(X)) { \
+ Base::error("CPPUNIT_CHECK", #X, __FILE__, __LINE__); \
+ }
+
+#define CPPUNIT_ASSERT(X) \
+ if (!(X)) { \
+ Base::error("CPPUNIT_ASSERT", #X, __FILE__, __LINE__); \
+ return; \
+ }
+
+#define CPPUNIT_FAIL { \
+ Base::error("CPPUNIT_FAIL", "", __FILE__, __LINE__); \
+ return; \
+ }
+
+#define CPPUNIT_ASSERT_EQUAL(X, Y) \
+ if ((X) != (Y)) { \
+ Base::error("CPPUNIT_ASSERT_EQUAL", #X","#Y, __FILE__, __LINE__); \
+ return; \
+ }
+
+#define CPPUNIT_ASSERT_DOUBLES_EQUAL(X, Y, Z) \
+ if (!equalDoubles((X), (Y), (Z))) { \
+ Base::error("CPPUNIT_ASSERT_DOUBLES_EQUAL", #X","#Y","#Z, __FILE__, __LINE__); \
+ return; \
+ }
+
+#define CPPUNIT_MESSAGE(m) CPPUNIT_NS::TestCase::message(m)
+
+#endif
diff --git a/test/unit/cppunit/cppunit_proxy.h b/test/unit/cppunit/cppunit_proxy.h
new file mode 100644
index 0000000..41cdc2a
--- /dev/null
+++ b/test/unit/cppunit/cppunit_proxy.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2003, 2004
+ * Zdenek Nemec
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* $Id$ */
+
+#ifndef _CPPUNITPROXYINTERFACE_H_
+#define _CPPUNITPROXYINTERFACE_H_
+
+/*
+ * STLport specific
+ */
+#if !defined (CPPUNIT_MINI_USE_EXCEPTIONS) && \
+ (!defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS))
+# define CPPUNIT_MINI_USE_EXCEPTIONS
+#endif
+
+#include "cppunit_mini.h"
+
+#endif
diff --git a/test/unit/cppunit/cppunit_timer.h b/test/unit/cppunit/cppunit_timer.h
new file mode 100644
index 0000000..61f9076
--- /dev/null
+++ b/test/unit/cppunit/cppunit_timer.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2006
+ * Francois Dumont
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#ifndef CPPUNIT_TIMER_H
+#define CPPUNIT_TIMER_H
+
+#if defined (_WIN32)
+# define CPPUNIT_WIN32_TIMER
+# include <windows.h>
+#endif
+
+class Timer {
+public:
+ Timer() {
+#if defined (CPPUNIT_WIN32_TIMER)
+ m_start.LowPart = m_restart.LowPart = m_stop.LowPart = 0;
+ m_start.HighPart = m_restart.HighPart = m_stop.HighPart = 0;
+ QueryPerformanceFrequency(&m_frequency);
+#endif
+ }
+
+ void start() {
+#if defined (CPPUNIT_WIN32_TIMER)
+ QueryPerformanceCounter(&m_start);
+#endif
+ }
+
+ void restart() {
+#if defined (CPPUNIT_WIN32_TIMER)
+ QueryPerformanceCounter(&m_restart);
+ if (m_start.HighPart == 0 && m_start.LowPart == 0) {
+ m_start = m_restart;
+ }
+#endif
+ }
+
+ void stop() {
+#if defined (CPPUNIT_WIN32_TIMER)
+ LARGE_INTEGER stop;
+ QueryPerformanceCounter(&stop);
+ if ((m_stop.HighPart != 0 || m_stop.LowPart != 0) &&
+ m_restart.HighPart != 0 && m_restart.LowPart != 0) {
+ m_stop.HighPart += (stop.HighPart - m_restart.HighPart);
+ if (stop.LowPart < m_restart.LowPart) {
+ if (m_restart.LowPart - stop.LowPart > m_stop.LowPart) {
+ m_stop.HighPart -= 1;
+ }
+ m_stop.LowPart -= m_restart.LowPart - stop.LowPart;
+ }
+ else {
+ if (stop.LowPart - m_restart.LowPart > 0xFFFFFFFF - m_stop.LowPart) {
+ m_stop.HighPart += 1;
+ }
+ m_stop.LowPart += stop.LowPart - m_restart.LowPart;
+ }
+ }
+ else {
+ m_stop = stop;
+ }
+#endif
+ }
+
+ double elapsedMilliseconds() const {
+#if defined (CPPUNIT_WIN32_TIMER)
+ LARGE_INTEGER elapsed;
+ elapsed.HighPart = m_stop.HighPart - m_start.HighPart;
+ elapsed.LowPart = m_stop.LowPart - m_start.LowPart;
+ return (double)elapsed.QuadPart / (double)m_frequency.QuadPart * 1000;
+#else
+ return 0;
+#endif
+ }
+
+ static bool supported() {
+#if defined (CPPUNIT_WIN32_TIMER)
+ return true;
+#else
+ return false;
+#endif
+ }
+
+private:
+#if defined (CPPUNIT_WIN32_TIMER)
+ LARGE_INTEGER m_frequency;
+ LARGE_INTEGER m_start, m_stop, m_restart;
+#endif
+};
+
+#endif
diff --git a/test/unit/cppunit/file_reporter.h b/test/unit/cppunit/file_reporter.h
new file mode 100644
index 0000000..2c7633b
--- /dev/null
+++ b/test/unit/cppunit/file_reporter.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2003, 2004
+ * Zdenek Nemec
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* $Id$ */
+
+#ifndef _CPPUNITMINIFILEREPORTERINTERFACE_H_
+#define _CPPUNITMINIFILEREPORTERINTERFACE_H_
+
+#include <stdio.h>
+
+#include "cppunit_timer.h"
+
+//
+// CppUnit mini file(stream) reporter
+//
+class FileReporter : public CPPUNIT_NS::Reporter {
+private:
+ FileReporter(const FileReporter&);
+ FileReporter& operator=(const FileReporter&);
+public:
+ // reporting to stderr
+ explicit FileReporter(bool doMonitor = false):
+ m_numErrors(0), m_numIgnored(0), m_numExplicit(0), m_numTests(0), _myStream(false),
+ m_failed(false), m_doMonitor(doMonitor)
+ { _file = stderr; }
+
+ // reporting to the file with the given name
+ explicit FileReporter(const char* file, bool doMonitor = false):
+ m_numErrors(0), m_numIgnored(0), m_numExplicit(0), m_numTests(0), _myStream(true),
+ m_failed(false), m_doMonitor(doMonitor)
+ {
+#ifndef _STLP_USE_SAFE_STRING_FUNCTIONS
+ _file = fopen(file, "w");
+#else
+ fopen_s(&_file, file, "w");
+#endif
+ }
+
+ // reporting to the given file
+ explicit FileReporter(FILE* stream, bool doMonitor = false):
+ m_numErrors(0), m_numIgnored(0), m_numExplicit(0), m_numTests(0), _myStream(false),
+ m_failed(false), m_doMonitor(doMonitor)
+ { _file = stream; }
+
+ virtual ~FileReporter() {
+ if (_myStream)
+ fclose(_file);
+ else
+ fflush(_file);
+ }
+
+ virtual void error(const char *in_macroName, const char *in_macro, const char *in_file, int in_line) {
+ // Error might be called several times between 2 progress calls, we shouldn't however consider
+ // that a test failed twice so we simply keep the info that test failed, number of failed tests
+ // is computed later in end method.
+ m_failed = true;
+ fprintf(_file, "\n\n%s(%d) : %s(%s);", in_file, in_line, in_macroName, in_macro);
+ }
+
+ virtual void message( const char *msg )
+ { fprintf(_file, "\n\t%s", msg ); }
+
+ virtual void progress(const char *in_className, const char *in_shortTestName, bool ignored, bool explicitTest) {
+ if (m_doMonitor) {
+ m_globalTimer.restart();
+ m_testTimer.start();
+ }
+ ++m_numTests;
+ m_failed = false;
+ if (ignored)
+ ++m_numIgnored;
+ fprintf(_file, "%s::%s", in_className, in_shortTestName);
+ if (ignored) {
+ const char *ignoredReason;
+ if (explicitTest) {
+ ++m_numExplicit;
+ ignoredReason = " EXPLICIT";
+ }
+ else
+ ignoredReason = " IGNORED";
+
+ fprintf(_file, "%s", ignoredReason);
+ }
+ }
+
+ virtual void end() {
+ if (m_doMonitor) {
+ m_globalTimer.stop();
+ m_testTimer.stop();
+ fprintf(_file, " %f msec", m_testTimer.elapsedMilliseconds());
+ }
+ if (m_failed) {
+ ++m_numErrors;
+ }
+ fprintf(_file, "\n");
+ }
+
+ virtual void printSummary() {
+ if (m_numErrors > 0) {
+ fprintf(_file, "\nThere were errors! %d of %d tests", m_numErrors, m_numTests);
+ }
+ else {
+ fprintf(_file, "\nOK %d tests", m_numTests);
+ }
+
+ if (m_numIgnored > 0) {
+ fprintf(_file, ", %d ignored", m_numIgnored);
+ }
+
+ if (m_numExplicit > 0) {
+ fprintf(_file, " (%d explicit)", m_numExplicit);
+ }
+
+ if (m_doMonitor) {
+ fprintf(_file, " %f msec", m_globalTimer.elapsedMilliseconds());
+ }
+
+ fprintf(_file, "\n\n");
+ }
+private:
+ int m_numErrors;
+ int m_numIgnored;
+ int m_numExplicit;
+ int m_numTests;
+ // flag whether we own '_file' and are thus responsible for releasing it in the destructor
+ bool _myStream;
+ bool m_failed;
+ bool m_doMonitor;
+ Timer m_globalTimer, m_testTimer;
+ FILE* _file;
+};
+
+#endif /*_CPPUNITMINIFILEREPORTERINTERFACE_H_*/
diff --git a/test/unit/cppunit/test_main.cpp b/test/unit/cppunit/test_main.cpp
new file mode 100644
index 0000000..8519d4f
--- /dev/null
+++ b/test/unit/cppunit/test_main.cpp
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2003, 2004
+ * Zdenek Nemec
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+#include "cppunit_proxy.h"
+#include "file_reporter.h"
+#include "cppunit_timer.h"
+
+#include "stdio.h"
+
+#if 0
+namespace CPPUNIT_NS
+{
+#endif
+ int TestCase::m_numErrors = 0;
+ int TestCase::m_numTests = 0;
+
+ TestCase *TestCase::m_root = 0;
+ Reporter *TestCase::m_reporter = 0;
+
+ void TestCase::registerTestCase(TestCase *in_testCase) {
+ in_testCase->m_next = m_root;
+ m_root = in_testCase;
+ }
+
+ int TestCase::run(Reporter *in_reporter, const char *in_testName, bool invert) {
+ TestCase::m_reporter = in_reporter;
+
+ m_numErrors = 0;
+ m_numTests = 0;
+
+ TestCase *tmp = m_root;
+ while (tmp != 0) {
+ tmp->myRun(in_testName, invert);
+ tmp = tmp->m_next;
+ }
+ return m_numErrors;
+ }
+#if 0
+}
+#endif
+
+static void usage(const char* name)
+{
+ printf("Usage : %s [-t=<class>[::<test>]] [-x=<class>[::<test>]] [-f=<file>]%s\n",
+ name, Timer::supported() ? " [-m]": "");
+ printf("\t[-t=<class>[::<test>]] : test class or class::test to execute;\n");
+ printf("\t[-x=<class>[::<test>]] : test class or class::test to exclude from execution;\n");
+ printf("\t[-f=<file>] : output file");
+ if (Timer::supported())
+ printf(";\n\t[-m] : monitor test execution, display time duration for each test\n");
+ else
+ printf("\n");
+}
+
+int main(int argc, char** argv) {
+
+ // CppUnit(mini) test launcher
+ // command line option syntax:
+ // test [OPTIONS]
+ // where OPTIONS are
+ // -t=CLASS[::TEST] run the test class CLASS or member test CLASS::TEST
+ // -x=CLASS[::TEST] run all except the test class CLASS or member test CLASS::TEST
+ // -f=FILE save output in file FILE instead of stdout
+ // -m monitor test(s) execution
+ const char *fileName = 0;
+ const char *testName = "";
+ const char *xtestName = "";
+ bool doMonitoring = false;
+
+ for (int i = 1; i < argc; ++i) {
+ if (argv[i][0] == '-') {
+ if (!strncmp(argv[i], "-t=", 3)) {
+ testName = argv[i]+3;
+ continue;
+ }
+ else if (!strncmp(argv[i], "-f=", 3)) {
+ fileName = argv[i]+3;
+ continue;
+ }
+ else if (!strncmp(argv[i], "-x=", 3)) {
+ xtestName = argv[i]+3;
+ continue;
+ }
+ else if (Timer::supported() && !strncmp(argv[i], "-m", 2)) {
+ doMonitoring = true;
+ continue;
+ }
+ }
+
+ // invalid option, we display normal usage.
+ usage(argv[0]);
+ return 1;
+ }
+
+ CPPUNIT_NS::Reporter* reporter;
+ if (fileName != 0)
+ reporter = new FileReporter(fileName, doMonitoring);
+ else
+ reporter = new FileReporter(stdout, doMonitoring);
+
+ int num_errors;
+ if (xtestName[0] != 0) {
+ num_errors = CPPUNIT_NS::TestCase::run(reporter, xtestName, true);
+ } else {
+ num_errors = CPPUNIT_NS::TestCase::run(reporter, testName);
+ }
+
+ reporter->printSummary();
+ delete reporter;
+
+ return num_errors;
+}
+
+// See doc/README.intel for explanation about this code
+#if defined (STLPORT) && defined (__ICL) && (__ICL >= 900) && \
+ (_STLP_MSVC_LIB < 1300) && defined (_STLP_USE_DYNAMIC_LIB)
+# include <exception>
+
+# undef std
+namespace std
+{
+ void _STLP_CALL unexpected() {
+ unexpected_handler hdl;
+ set_unexpected(hdl = set_unexpected((unexpected_handler)0));
+ hdl();
+ }
+}
+#endif
diff --git a/test/unit/csetjmp_header_test.cpp b/test/unit/csetjmp_header_test.cpp
new file mode 100644
index 0000000..b817862
--- /dev/null
+++ b/test/unit/csetjmp_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <csetjmp>
diff --git a/test/unit/csignal_header_test.cpp b/test/unit/csignal_header_test.cpp
new file mode 100644
index 0000000..9a9c6e0
--- /dev/null
+++ b/test/unit/csignal_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <csignal>
diff --git a/test/unit/cstdarg_header_test.cpp b/test/unit/cstdarg_header_test.cpp
new file mode 100644
index 0000000..06cf0a5
--- /dev/null
+++ b/test/unit/cstdarg_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <cstdarg>
diff --git a/test/unit/cstddef_header_test.cpp b/test/unit/cstddef_header_test.cpp
new file mode 100644
index 0000000..201d3f6
--- /dev/null
+++ b/test/unit/cstddef_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <cstddef>
diff --git a/test/unit/cstdio_header_test.cpp b/test/unit/cstdio_header_test.cpp
new file mode 100644
index 0000000..e38a5e9
--- /dev/null
+++ b/test/unit/cstdio_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <cstdio>
diff --git a/test/unit/cstdlib_header_test.cpp b/test/unit/cstdlib_header_test.cpp
new file mode 100644
index 0000000..f356079
--- /dev/null
+++ b/test/unit/cstdlib_header_test.cpp
@@ -0,0 +1,13 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <cstdlib>
+
+//Just an additionnal compilation test for Borland that used to fail here.
+#if defined (__BORLANDC__)
+# include <process.h>
+#endif
diff --git a/test/unit/cstring_header_test.cpp b/test/unit/cstring_header_test.cpp
new file mode 100644
index 0000000..dd5d2cf
--- /dev/null
+++ b/test/unit/cstring_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <cstring>
diff --git a/test/unit/cstring_test.cpp b/test/unit/cstring_test.cpp
new file mode 100644
index 0000000..b51da07
--- /dev/null
+++ b/test/unit/cstring_test.cpp
@@ -0,0 +1,75 @@
+#define _STLP_DO_IMPORT_CSTD_FUNCTIONS
+
+#include <cstring>
+
+#include "cppunit/cppunit_proxy.h"
+
+//This test purpose is to check the right import of math.h C symbols
+//into the std namespace so we do not use the using namespace std
+//specification
+
+//
+// TestCase class
+//
+class CStringTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(CStringTest);
+#if defined (STLPORT) && !defined (_STLP_USE_NAMESPACES)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(import_checks);
+ CPPUNIT_TEST_SUITE_END();
+
+ protected:
+ void import_checks();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(CStringTest);
+
+#if defined (_MSC_VER) && (_MSC_VER >= 1400)
+//For deprecated symbols like strcat, strtok...
+# pragma warning (disable : 4996)
+#endif
+
+//
+// tests implementation
+//
+void CStringTest::import_checks()
+{
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+ std::size_t bar = 0;
+ CPPUNIT_CHECK( bar == 0 );
+
+ CPPUNIT_CHECK( std::memchr("foo", 'o', 3) != NULL );
+ CPPUNIT_CHECK( std::memcmp("foo1", "foo2", 3) == 0 );
+ char buf1[1], buf2[1];
+ CPPUNIT_CHECK( std::memcpy(buf1, buf2, 0) != NULL );
+ CPPUNIT_CHECK( std::memmove(buf1, buf2, 0) != NULL );
+ CPPUNIT_CHECK( std::memset(buf1, 0, 1) != NULL );
+ char buf[16]; buf[0] = 0;
+ const char* foo = "foo";
+# if !defined(_WIN32_WCE)
+ CPPUNIT_CHECK( std::strcoll("foo", "foo") == 0 );
+ CPPUNIT_CHECK( std::strerror(0) != NULL );
+# endif
+ CPPUNIT_CHECK( std::strcat((char*)buf, foo) == (char*)buf ); // buf <- foo
+ CPPUNIT_CHECK( std::strchr(foo, 'o') != NULL );
+ CPPUNIT_CHECK( std::strcmp("foo1", "foo2") < 0 );
+ CPPUNIT_CHECK( std::strcpy((char*)buf, foo) == (char*)buf ); // buf <- foo
+ CPPUNIT_CHECK( std::strcspn("foo", "o") == 1 );
+ CPPUNIT_CHECK( std::strlen("foo") == 3 );
+ CPPUNIT_CHECK( std::strncat((char*)buf, foo, 2) == (char*)buf ); // buf <- foofo
+ CPPUNIT_CHECK( std::strncmp("foo1", "foo2", 3) == 0 );
+ CPPUNIT_CHECK( std::strncpy((char*)buf, foo, 3) == (char*)buf ); // buf <- foo
+ CPPUNIT_CHECK( std::strpbrk(foo, "abcdo") == foo + 1 );
+ const char* foofoo = "foofoo";
+ CPPUNIT_CHECK( std::strrchr(foofoo, 'f') == foofoo + 3 );
+ CPPUNIT_CHECK( std::strspn(foofoo, "aofz") == 6 );
+ CPPUNIT_CHECK( std::strstr(foo, "") == foo );
+ char foofoobuf[] = "foofoo";
+ CPPUNIT_CHECK( std::strtok(foofoobuf, "z") != NULL );
+# if !defined(_WIN32_WCE)
+ CPPUNIT_CHECK( std::strxfrm((char*)buf, foo, 3) != 0 );
+# endif
+#endif
+}
diff --git a/test/unit/ctime_header_test.cpp b/test/unit/ctime_header_test.cpp
new file mode 100644
index 0000000..4e71c18
--- /dev/null
+++ b/test/unit/ctime_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <ctime>
diff --git a/test/unit/ctype_facets_test.cpp b/test/unit/ctype_facets_test.cpp
new file mode 100644
index 0000000..9609e21
--- /dev/null
+++ b/test/unit/ctype_facets_test.cpp
@@ -0,0 +1,520 @@
+#include "locale_test.h"
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <locale>
+# include <stdexcept>
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+static const char* tested_locales[] = {
+//name,
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ // We need exception support to check support of the following localizations.
+ "fr_FR",
+ "ru_RU.koi8r",
+ "en_GB",
+ "en_US",
+# endif
+ "",
+ "C"
+};
+
+//
+// tests implementation
+//
+void LocaleTest::_ctype_facet( const locale& loc)
+{
+ CPPUNIT_ASSERT( has_facet<ctype<char> >(loc) );
+ ctype<char> const& ct = use_facet<ctype<char> >(loc);
+ //is
+ {
+ CPPUNIT_ASSERT( ct.is(ctype_base::digit, '0') );
+ CPPUNIT_ASSERT( ct.is(ctype_base::upper, 'A') );
+ CPPUNIT_ASSERT( ct.is(ctype_base::lower, 'a') );
+ CPPUNIT_ASSERT( ct.is(ctype_base::alpha, 'A') );
+ CPPUNIT_ASSERT( ct.is(ctype_base::space, ' ') );
+ CPPUNIT_ASSERT( !ct.is(ctype_base::space, '2') );
+ CPPUNIT_ASSERT( ct.is(ctype_base::punct, '.') );
+ CPPUNIT_ASSERT( ct.is(ctype_base::xdigit, 'a') );
+ }
+
+ //is range
+ {
+ char values[] = "0Aa .";
+ ctype_base::mask res[sizeof(values)];
+ ct.is(values, values + sizeof(values), res);
+ // '0'
+ CPPUNIT_ASSERT( (res[0] & ctype_base::print) != 0 );
+ CPPUNIT_ASSERT( (res[0] & ctype_base::digit) != 0 );
+ CPPUNIT_ASSERT( (res[0] & ctype_base::xdigit) != 0 );
+ // 'A'
+ CPPUNIT_ASSERT( (res[1] & ctype_base::print) != 0 );
+ CPPUNIT_ASSERT( (res[1] & ctype_base::alpha) != 0 );
+ CPPUNIT_ASSERT( (res[1] & ctype_base::xdigit) != 0 );
+ CPPUNIT_ASSERT( (res[1] & ctype_base::upper) != 0 );
+ // 'a'
+ CPPUNIT_ASSERT( (res[2] & ctype_base::print) != 0 );
+ CPPUNIT_ASSERT( (res[2] & ctype_base::alpha) != 0 );
+ CPPUNIT_ASSERT( (res[2] & ctype_base::xdigit) != 0 );
+ CPPUNIT_ASSERT( (res[2] & ctype_base::lower) != 0 );
+ CPPUNIT_ASSERT( (res[2] & ctype_base::space) == 0 );
+ // ' '
+ CPPUNIT_ASSERT( (res[3] & ctype_base::print) != 0 );
+ CPPUNIT_ASSERT( (res[3] & ctype_base::space) != 0 );
+ CPPUNIT_ASSERT( (res[3] & ctype_base::digit) == 0 );
+ // '.'
+ CPPUNIT_ASSERT( (res[4] & ctype_base::print) != 0 );
+ CPPUNIT_ASSERT( (res[4] & ctype_base::punct) != 0 );
+ CPPUNIT_ASSERT( (res[4] & ctype_base::digit) == 0 );
+ }
+
+ //scan_is
+ {
+ char range[] = "abAc123 .";
+ const char *rbeg = range;
+ const char *rend = range + sizeof(range);
+
+ const char *res;
+ res = ct.scan_is((ctype_base::mask)(ctype_base::alpha | ctype_base::lower), rbeg, rend);
+ CPPUNIT_ASSERT( res != rend );
+ CPPUNIT_ASSERT( *res == 'a' );
+
+ res = ct.scan_is(ctype_base::upper, rbeg, rend);
+ CPPUNIT_ASSERT( res != rend );
+ CPPUNIT_ASSERT( *res == 'A' );
+
+ res = ct.scan_is(ctype_base::punct, rbeg, rend);
+ CPPUNIT_ASSERT( res != rend );
+ CPPUNIT_ASSERT( *res == '.' );
+ }
+
+ //scan_not
+ {
+ char range[] = "abAc123 .";
+ const char *rbeg = range;
+ const char *rend = range + sizeof(range);
+
+ const char *res;
+ res = ct.scan_not((ctype_base::mask)(ctype_base::alpha | ctype_base::lower), rbeg, rend);
+ CPPUNIT_ASSERT( res != rend );
+ CPPUNIT_ASSERT( *res == '1' );
+
+ res = ct.scan_not(ctype_base::alpha, rbeg, rend);
+ CPPUNIT_ASSERT( res != rend );
+ CPPUNIT_ASSERT( *res == '1' );
+
+ res = ct.scan_not(ctype_base::punct, rbeg, rend);
+ CPPUNIT_ASSERT( res != rend );
+ CPPUNIT_ASSERT( *res == 'a' );
+ }
+
+ //toupper
+ {
+ CPPUNIT_ASSERT( ct.toupper('a') == 'A' );
+ CPPUNIT_ASSERT( ct.toupper('A') == 'A' );
+ CPPUNIT_ASSERT( ct.toupper('1') == '1' );
+ }
+
+ //toupper range
+ {
+ char range[] = "abAc1";
+ char expected_range[] = "ABAC1";
+ ct.toupper(range, range + sizeof(range));
+ CPPUNIT_ASSERT( equal(range, range + sizeof(range), expected_range) );
+ }
+
+ //tolower
+ {
+ CPPUNIT_ASSERT( ct.tolower('A') == 'a' );
+ CPPUNIT_ASSERT( ct.tolower('a') == 'a' );
+ CPPUNIT_ASSERT( ct.tolower('1') == '1' );
+ }
+
+ //tolower range
+ {
+ char range[] = "ABaC1";
+ char expected_range[] = "abac1";
+ ct.tolower(range, range + sizeof(range));
+ CPPUNIT_ASSERT( equal(range, range + sizeof(range), expected_range) );
+ }
+
+ //widen
+ {
+ CPPUNIT_ASSERT( ct.widen('a') == 'a' );
+ }
+
+ //widen range
+ {
+ char range[] = "ABaC1";
+ char res[sizeof(range)];
+ ct.widen(range, range + sizeof(range), res);
+ CPPUNIT_ASSERT( equal(range, range + sizeof(range), res) );
+ }
+
+ //narrow
+ {
+ CPPUNIT_ASSERT( ct.narrow('a', 'b') == 'a' );
+ }
+
+ //narrow range
+ {
+ char range[] = "ABaC1";
+ char res[sizeof(range)];
+ ct.narrow(range, range + sizeof(range), 'b', res);
+ CPPUNIT_ASSERT( equal(range, range + sizeof(range), res) );
+ }
+}
+
+void LocaleTest::_ctype_facet_w( const locale& loc )
+{
+# ifndef _STLP_NO_WCHAR_T
+ CPPUNIT_ASSERT( has_facet<ctype<wchar_t> >(loc) );
+ ctype<wchar_t> const& wct = use_facet<ctype<wchar_t> >(loc);
+ //is
+ {
+ CPPUNIT_CHECK( wct.is(ctype_base::digit, L'0') );
+ CPPUNIT_CHECK( wct.is(ctype_base::upper, L'A') );
+ CPPUNIT_CHECK( wct.is(ctype_base::lower, L'a') );
+ CPPUNIT_CHECK( wct.is(ctype_base::alpha, L'A') );
+ CPPUNIT_CHECK( wct.is(ctype_base::space, L' ') );
+ CPPUNIT_CHECK( !wct.is(ctype_base::space, L'2') );
+ CPPUNIT_CHECK( wct.is(ctype_base::punct, L'.') );
+ CPPUNIT_CHECK( wct.is(ctype_base::xdigit, L'a') );
+ }
+
+ //is range
+ {
+ wchar_t values[] = L"0Aa .";
+ ctype_base::mask res[sizeof(values) / sizeof(wchar_t)];
+ wct.is(values, values + (sizeof(values) / sizeof(wchar_t)), res);
+ // '0'
+ CPPUNIT_CHECK( (res[0] & ctype_base::print) != 0 );
+ CPPUNIT_CHECK( (res[0] & ctype_base::digit) != 0 );
+ CPPUNIT_CHECK( (res[0] & ctype_base::xdigit) != 0 );
+ // 'A'
+ CPPUNIT_CHECK( (res[1] & ctype_base::print) != 0 );
+ CPPUNIT_CHECK( (res[1] & ctype_base::alpha) != 0 );
+ CPPUNIT_CHECK( (res[1] & ctype_base::xdigit) != 0 );
+ CPPUNIT_CHECK( (res[1] & ctype_base::upper) != 0 );
+ // 'a'
+ CPPUNIT_CHECK( (res[2] & ctype_base::print) != 0 );
+ CPPUNIT_CHECK( (res[2] & ctype_base::alpha) != 0 );
+ CPPUNIT_CHECK( (res[2] & ctype_base::xdigit) != 0 );
+ CPPUNIT_CHECK( (res[2] & ctype_base::lower) != 0 );
+ CPPUNIT_CHECK( (res[2] & ctype_base::space) == 0 );
+ // ' '
+ CPPUNIT_CHECK( (res[3] & ctype_base::print) != 0 );
+ CPPUNIT_CHECK( (res[3] & ctype_base::space) != 0 );
+ CPPUNIT_CHECK( (res[3] & ctype_base::digit) == 0 );
+ // '.'
+ CPPUNIT_CHECK( (res[4] & ctype_base::print) != 0 );
+ CPPUNIT_CHECK( (res[4] & ctype_base::punct) != 0 );
+ CPPUNIT_CHECK( (res[4] & ctype_base::digit) == 0 );
+ }
+
+ //scan_is
+ {
+ wchar_t range[] = L"abAc123 .";
+ const wchar_t *rbeg = range;
+ const wchar_t *rend = range + (sizeof(range) / sizeof(wchar_t));
+
+ const wchar_t *res;
+ res = wct.scan_is((ctype_base::mask)(ctype_base::alpha | ctype_base::lower), rbeg, rend);
+ CPPUNIT_CHECK( res != rend );
+ CPPUNIT_CHECK( *res == L'a' );
+
+ res = wct.scan_is(ctype_base::upper, rbeg, rend);
+ CPPUNIT_CHECK( res != rend );
+ CPPUNIT_CHECK( *res == L'A' );
+
+ res = wct.scan_is(ctype_base::punct, rbeg, rend);
+ CPPUNIT_CHECK( res != rend );
+ CPPUNIT_CHECK( *res == L'.' );
+ }
+
+ //scan_not
+ {
+ wchar_t range[] = L"abAc123 .";
+ const wchar_t *rbeg = range;
+ const wchar_t *rend = range + (sizeof(range) / sizeof(wchar_t));
+
+ const wchar_t *res;
+ res = wct.scan_not((ctype_base::mask)(ctype_base::alpha | ctype_base::lower), rbeg, rend);
+ CPPUNIT_CHECK( res != rend );
+ CPPUNIT_CHECK( *res == L'1' );
+
+ res = wct.scan_not(ctype_base::alpha, rbeg, rend);
+ CPPUNIT_CHECK( res != rend );
+ CPPUNIT_CHECK( *res == L'1' );
+
+ res = wct.scan_not(ctype_base::punct, rbeg, rend);
+ CPPUNIT_CHECK( res != rend );
+ CPPUNIT_CHECK( *res == L'a' );
+ }
+
+ //toupper
+ {
+ CPPUNIT_CHECK( wct.toupper(L'a') == L'A' );
+ CPPUNIT_CHECK( wct.toupper(L'A') == L'A' );
+ CPPUNIT_CHECK( wct.toupper(L'1') == L'1' );
+ }
+
+ //toupper range
+ {
+ wchar_t range[] = L"abAc1";
+ wchar_t expected_range[] = L"ABAC1";
+ wct.toupper(range, range + sizeof(range) / sizeof(wchar_t));
+ CPPUNIT_CHECK( equal(range, range + sizeof(range) / sizeof(wchar_t), expected_range) );
+ }
+
+ //tolower
+ {
+ CPPUNIT_CHECK( wct.tolower(L'A') == L'a' );
+ CPPUNIT_CHECK( wct.tolower(L'a') == L'a' );
+ CPPUNIT_CHECK( wct.tolower(L'1') == L'1' );
+ }
+
+ //tolower range
+ {
+ wchar_t range[] = L"ABaC1";
+ wchar_t expected_range[] = L"abac1";
+ wct.tolower(range, range + sizeof(range) / sizeof(wchar_t));
+ CPPUNIT_CHECK( equal(range, range + sizeof(range) / sizeof(wchar_t), expected_range) );
+ }
+
+ //widen
+ {
+ CPPUNIT_CHECK( wct.widen('a') == L'a' );
+ }
+
+ //widen range
+ {
+ char range[] = "ABaC1";
+ wchar_t res[sizeof(range)];
+ wchar_t expected_res[] = L"ABaC1";
+ wct.widen(range, range + sizeof(range), res);
+ CPPUNIT_CHECK( equal(expected_res, expected_res + sizeof(range), res) );
+ }
+
+ //narrow
+ {
+ CPPUNIT_CHECK( wct.narrow(L'a', 'b') == L'a' );
+ }
+
+ //narrow range
+ {
+ wchar_t range[] = L"ABaC1";
+ char res[sizeof(range) / sizeof(wchar_t)];
+ char expected_res[] = "ABaC1";
+ wct.narrow(range, range + sizeof(range) / sizeof(wchar_t), 'b', res);
+ CPPUNIT_CHECK( equal(expected_res, expected_res + sizeof(range) / sizeof(wchar_t), res) );
+ }
+# endif
+}
+
+
+typedef void (LocaleTest::*_Test) (const locale&);
+static void test_supported_locale(LocaleTest& inst, _Test __test) {
+ size_t n = sizeof(tested_locales) / sizeof(tested_locales[0]);
+ for (size_t i = 0; i < n; ++i) {
+ locale loc;
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try
+# endif
+ {
+ locale tmp(tested_locales[i]);
+ loc = tmp;
+ }
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ catch (runtime_error const&) {
+ //This locale is not supported.
+ continue;
+ }
+# endif
+
+ CPPUNIT_MESSAGE( loc.name().c_str() );
+ (inst.*__test)(loc);
+
+ {
+ locale tmp(locale::classic(), tested_locales[i], locale::ctype);
+ loc = tmp;
+ }
+ (inst.*__test)(loc);
+
+ {
+ locale tmp(locale::classic(), new ctype_byname<char>(tested_locales[i]));
+#ifndef _STLP_NO_WCHAR_T
+ locale tmp0(tmp, new ctype_byname<wchar_t>(tested_locales[i]));
+ tmp = tmp0;
+#endif
+ loc = tmp;
+ }
+ (inst.*__test)(loc);
+ }
+}
+
+void LocaleTest::ctype_facet()
+{
+ test_supported_locale(*this, &LocaleTest::_ctype_facet);
+#ifndef _STLP_NO_WCHAR_T
+ test_supported_locale(*this, &LocaleTest::_ctype_facet_w);
+#endif
+}
+
+void LocaleTest::ctype_by_name()
+{
+ /*
+ * Check of the 22.1.1.2.7 standard point. Construction of a locale
+ * instance from a null pointer or an unknown name should result in
+ * a runtime_error exception.
+ */
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+# if defined (STLPORT) || (!defined(__GNUC__) && (!defined (_MSC_VER) || (_MSC_VER > 1400)))
+ // libstdc++ call freelocate on bad locale
+ try {
+ locale loc(locale::classic(), new ctype_byname<char>(static_cast<char const*>(0)));
+ CPPUNIT_ASSERT( false );
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_ASSERT( false );
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new ctype_byname<char>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+# if defined(STLPORT) || !defined(__GNUC__)
+ try {
+ locale loc(locale::classic(), new codecvt_byname<char, char, mbstate_t>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new codecvt_byname<char, char, mbstate_t>("yasli_language"));
+ //STLport implementation do not care about name pass to this facet.
+# if !defined (STLPORT)
+ CPPUNIT_FAIL;
+# endif
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), new ctype_byname<char>("fr_FR"));
+ CPPUNIT_ASSERT( has_facet<ctype<char> >(loc) );
+ ctype<char> const& ct = use_facet<ctype<char> >(loc);
+ CPPUNIT_ASSERT( ct.is(ctype_base::mask(ctype_base::print | ctype_base::lower | ctype_base::alpha), 'ç') );
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), new ctype_byname<char>("C"));
+ ctype<char> const& cfacet_byname = use_facet<ctype<char> >(loc);
+ ctype<char> const& cfacet = use_facet<ctype<char> >(locale::classic());
+
+ for (char c = 0;; ++c) {
+ CPPUNIT_CHECK(cfacet_byname.is(ctype_base::space, c) == cfacet.is(ctype_base::space, c));
+ if (cfacet_byname.is(ctype_base::print, c) != cfacet.is(ctype_base::print, c))
+ {
+ CPPUNIT_CHECK(cfacet_byname.is(ctype_base::print, c) == cfacet.is(ctype_base::print, c));
+ }
+ CPPUNIT_CHECK(cfacet_byname.is(ctype_base::cntrl, c) == cfacet.is(ctype_base::cntrl, c));
+ CPPUNIT_CHECK(cfacet_byname.is(ctype_base::upper, c) == cfacet.is(ctype_base::upper, c));
+ CPPUNIT_CHECK(cfacet_byname.is(ctype_base::lower, c) == cfacet.is(ctype_base::lower, c));
+ CPPUNIT_CHECK(cfacet_byname.is(ctype_base::alpha, c) == cfacet.is(ctype_base::alpha, c));
+ CPPUNIT_CHECK(cfacet_byname.is(ctype_base::digit, c) == cfacet.is(ctype_base::digit, c));
+ CPPUNIT_CHECK(cfacet_byname.is(ctype_base::punct, c) == cfacet.is(ctype_base::punct, c));
+ CPPUNIT_CHECK(cfacet_byname.is(ctype_base::xdigit, c) == cfacet.is(ctype_base::xdigit, c));
+ CPPUNIT_CHECK(cfacet_byname.is(ctype_base::alnum, c) == cfacet.is(ctype_base::alnum, c));
+ CPPUNIT_CHECK(cfacet_byname.is(ctype_base::graph, c) == cfacet.is(ctype_base::graph, c));
+ if (c == 127) break;
+ }
+ }
+ catch (runtime_error const& /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+# if defined(STLPORT) || !defined(__GNUC__)
+ try {
+ locale loc(locale::classic(), new ctype_byname<wchar_t>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new ctype_byname<wchar_t>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+# if defined(STLPORT) || !defined(__GNUC__)
+ try {
+ locale loc(locale::classic(), new codecvt_byname<wchar_t, char, mbstate_t>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new codecvt_byname<wchar_t, char, mbstate_t>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+# endif
+}
+
+#endif
diff --git a/test/unit/ctype_header_test.c b/test/unit/ctype_header_test.c
new file mode 100644
index 0000000..8bd9fa6
--- /dev/null
+++ b/test/unit/ctype_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <ctype.h>
diff --git a/test/unit/cwchar_header_test.cpp b/test/unit/cwchar_header_test.cpp
new file mode 100644
index 0000000..7a63390
--- /dev/null
+++ b/test/unit/cwchar_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <cwchar>
diff --git a/test/unit/cwctype_header_test.cpp b/test/unit/cwctype_header_test.cpp
new file mode 100644
index 0000000..0746b83
--- /dev/null
+++ b/test/unit/cwctype_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <cwctype>
diff --git a/test/unit/deque_header_test.cpp b/test/unit/deque_header_test.cpp
new file mode 100644
index 0000000..c945948
--- /dev/null
+++ b/test/unit/deque_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <deque>
diff --git a/test/unit/deque_test.cpp b/test/unit/deque_test.cpp
new file mode 100644
index 0000000..6be7e01
--- /dev/null
+++ b/test/unit/deque_test.cpp
@@ -0,0 +1,330 @@
+//Has to be first for StackAllocator swap overload to be taken
+//into account (at least using GCC 4.0.1)
+#include "stack_allocator.h"
+
+#include <deque>
+#include <algorithm>
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+# include <stdexcept>
+#endif
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class DequeTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(DequeTest);
+ CPPUNIT_TEST(deque1);
+ CPPUNIT_TEST(at);
+ CPPUNIT_TEST(insert);
+ CPPUNIT_TEST(erase);
+ CPPUNIT_TEST(auto_ref);
+ CPPUNIT_TEST(allocator_with_state);
+#if defined (STLPORT) && defined (_STLP_NO_MEMBER_TEMPLATES)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(optimizations_check);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void deque1();
+ void insert();
+ void erase();
+ void at();
+ void auto_ref();
+ void allocator_with_state();
+ void optimizations_check();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(DequeTest);
+
+//
+// tests implementation
+//
+void DequeTest::deque1()
+{
+ deque<int> d;
+ d.push_back(4);
+ d.push_back(9);
+ d.push_back(16);
+ d.push_front(1);
+
+ CPPUNIT_ASSERT( d[0] == 1 );
+ CPPUNIT_ASSERT( d[1] == 4 );
+ CPPUNIT_ASSERT( d[2] == 9 );
+ CPPUNIT_ASSERT( d[3] == 16 );
+
+ d.pop_front();
+ d[2] = 25;
+
+ CPPUNIT_ASSERT( d[0] == 4 );
+ CPPUNIT_ASSERT( d[1] == 9 );
+ CPPUNIT_ASSERT( d[2] == 25 );
+
+ //Some compile time tests:
+ deque<int>::iterator dit = d.begin();
+ deque<int>::const_iterator cdit(d.begin());
+ CPPUNIT_ASSERT( (dit - cdit) == 0 );
+ CPPUNIT_ASSERT( (cdit - dit) == 0 );
+ CPPUNIT_ASSERT( (dit - dit) == 0 );
+ CPPUNIT_ASSERT( (cdit - cdit) == 0 );
+ CPPUNIT_ASSERT(!((dit < cdit) || (dit > cdit) || (dit != cdit) || !(dit <= cdit) || !(dit >= cdit)));
+}
+
+void DequeTest::insert()
+{
+ deque<int> d;
+ d.push_back(0);
+ d.push_back(1);
+ d.push_back(2);
+ CPPUNIT_ASSERT( d.size() == 3 );
+
+ deque<int>::iterator dit;
+
+ //Insertion before begin:
+ dit = d.insert(d.begin(), 3);
+ CPPUNIT_ASSERT( dit != d.end() );
+ CPPUNIT_CHECK( *dit == 3 );
+ CPPUNIT_ASSERT( d.size() == 4 );
+ CPPUNIT_ASSERT( d[0] == 3 );
+
+ //Insertion after begin:
+ dit = d.insert(d.begin() + 1, 4);
+ CPPUNIT_ASSERT( dit != d.end() );
+ CPPUNIT_CHECK( *dit == 4 );
+ CPPUNIT_ASSERT( d.size() == 5 );
+ CPPUNIT_ASSERT( d[1] == 4 );
+
+ //Insertion at end:
+ dit = d.insert(d.end(), 5);
+ CPPUNIT_ASSERT( dit != d.end() );
+ CPPUNIT_CHECK( *dit == 5 );
+ CPPUNIT_ASSERT( d.size() == 6 );
+ CPPUNIT_ASSERT( d[5] == 5 );
+
+ //Insertion before last element:
+ dit = d.insert(d.end() - 1, 6);
+ CPPUNIT_ASSERT( dit != d.end() );
+ CPPUNIT_CHECK( *dit == 6 );
+ CPPUNIT_ASSERT( d.size() == 7 );
+ CPPUNIT_ASSERT( d[5] == 6 );
+
+ //Insertion of several elements before begin
+ d.insert(d.begin(), 2, 7);
+ CPPUNIT_ASSERT( d.size() == 9 );
+ CPPUNIT_ASSERT( d[0] == 7 );
+ CPPUNIT_ASSERT( d[1] == 7 );
+
+ //Insertion of several elements after begin
+ //There is more elements to insert than elements before insertion position
+ d.insert(d.begin() + 1, 2, 8);
+ CPPUNIT_ASSERT( d.size() == 11 );
+ CPPUNIT_ASSERT( d[1] == 8 );
+ CPPUNIT_ASSERT( d[2] == 8 );
+
+ //There is less elements to insert than elements before insertion position
+ d.insert(d.begin() + 3, 2, 9);
+ CPPUNIT_ASSERT( d.size() == 13 );
+ CPPUNIT_ASSERT( d[3] == 9 );
+ CPPUNIT_ASSERT( d[4] == 9 );
+
+ //Insertion of several elements at end:
+ d.insert(d.end(), 2, 10);
+ CPPUNIT_ASSERT( d.size() == 15 );
+ CPPUNIT_ASSERT( d[14] == 10 );
+ CPPUNIT_ASSERT( d[13] == 10 );
+
+ //Insertion of several elements before last:
+ //There is more elements to insert than elements after insertion position
+ d.insert(d.end() - 1, 2, 11);
+ CPPUNIT_ASSERT( d.size() == 17 );
+ CPPUNIT_ASSERT( d[15] == 11 );
+ CPPUNIT_ASSERT( d[14] == 11 );
+
+ //There is less elements to insert than elements after insertion position
+ d.insert(d.end() - 3, 2, 12);
+ CPPUNIT_ASSERT( d.size() == 19 );
+ CPPUNIT_ASSERT( d[15] == 12 );
+ CPPUNIT_ASSERT( d[14] == 12 );
+}
+
+void DequeTest::at() {
+ deque<int> d;
+ deque<int> const& cd = d;
+
+ d.push_back(10);
+ CPPUNIT_ASSERT( d.at(0) == 10 );
+ d.at(0) = 20;
+ CPPUNIT_ASSERT( cd.at(0) == 20 );
+
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ for (;;) {
+ try {
+ d.at(1) = 20;
+ CPPUNIT_ASSERT(false);
+ }
+ catch (out_of_range const&) {
+ return;
+ }
+ catch (...) {
+ CPPUNIT_ASSERT(false);
+ }
+ }
+#endif
+}
+
+void DequeTest::auto_ref()
+{
+ int i;
+ deque<int> ref;
+ for (i = 0; i < 5; ++i) {
+ ref.push_back(i);
+ }
+
+ deque<deque<int> > d_d_int(1, ref);
+ d_d_int.push_back(d_d_int[0]);
+ d_d_int.push_back(ref);
+ d_d_int.push_back(d_d_int[0]);
+ d_d_int.push_back(d_d_int[0]);
+ d_d_int.push_back(ref);
+
+ for (i = 0; i < 5; ++i) {
+ CPPUNIT_ASSERT( d_d_int[i] == ref );
+ }
+}
+
+void DequeTest::allocator_with_state()
+{
+ char buf1[1024];
+ StackAllocator<int> stack1(buf1, buf1 + sizeof(buf1));
+
+ char buf2[1024];
+ StackAllocator<int> stack2(buf2, buf2 + sizeof(buf2));
+
+ {
+ typedef deque<int, StackAllocator<int> > DequeInt;
+ DequeInt dint1(10, 0, stack1);
+ DequeInt dint1Cpy(dint1);
+
+ DequeInt dint2(10, 1, stack2);
+ DequeInt dint2Cpy(dint2);
+
+ dint1.swap(dint2);
+
+ CPPUNIT_ASSERT( dint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( dint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( dint1 == dint2Cpy );
+ CPPUNIT_ASSERT( dint2 == dint1Cpy );
+ CPPUNIT_ASSERT( dint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( dint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_ASSERT( stack1.ok() );
+ CPPUNIT_ASSERT( stack2.ok() );
+}
+
+struct Point {
+ int x, y;
+};
+
+struct PointEx : public Point {
+ PointEx() : builtFromBase(false) {}
+ PointEx(const Point&) : builtFromBase(true) {}
+
+ bool builtFromBase;
+};
+
+#if defined (STLPORT)
+# if defined (_STLP_USE_NAMESPACES)
+namespace std {
+# endif
+ _STLP_TEMPLATE_NULL
+ struct __type_traits<PointEx> {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __true_type is_POD_type;
+ };
+# if defined (_STLP_USE_NAMESPACES)
+}
+# endif
+#endif
+
+//This test check that deque implementation do not over optimize
+//operation as PointEx copy constructor is trivial
+void DequeTest::optimizations_check()
+{
+#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES)
+ deque<Point> d1(1);
+ CPPUNIT_ASSERT( d1.size() == 1 );
+
+ deque<PointEx> d2(d1.begin(), d1.end());
+ CPPUNIT_ASSERT( d2.size() == 1 );
+ CPPUNIT_ASSERT( d2[0].builtFromBase == true );
+
+ d2.insert(d2.end(), d1.begin(), d1.end());
+ CPPUNIT_ASSERT( d2.size() == 2 );
+ CPPUNIT_ASSERT( d2[1].builtFromBase == true );
+#endif
+}
+
+void DequeTest::erase()
+{
+ deque<int> dint;
+ dint.push_back(3);
+ dint.push_front(2);
+ dint.push_back(4);
+ dint.push_front(1);
+ dint.push_back(5);
+ dint.push_front(0);
+ dint.push_back(6);
+
+ deque<int>::iterator it(dint.begin() + 1);
+ CPPUNIT_ASSERT( *it == 1 );
+
+ dint.erase(dint.begin());
+ CPPUNIT_ASSERT( *it == 1 );
+
+ it = dint.end() - 2;
+ CPPUNIT_ASSERT( *it == 5 );
+
+ dint.erase(dint.end() - 1);
+ CPPUNIT_ASSERT( *it == 5 );
+
+ dint.push_back(6);
+ dint.push_front(0);
+
+ it = dint.begin() + 2;
+ CPPUNIT_ASSERT( *it == 2 );
+
+ dint.erase(dint.begin(), dint.begin() + 2);
+ CPPUNIT_ASSERT( *it == 2 );
+
+ it = dint.end() - 3;
+ CPPUNIT_ASSERT( *it == 4 );
+
+ dint.erase(dint.end() - 2, dint.end());
+ CPPUNIT_ASSERT( *it == 4 );
+}
+
+#if (!defined (STLPORT) || \
+ (!defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION))) && \
+ (!defined (_MSC_VER) || (_MSC_VER > 1400)) && \
+ (!defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC_MINOR__ < 3))
+/* Simple compilation test: Check that nested types like iterator
+ * can be access even if type used to instanciate container is not
+ * yet completely defined.
+ */
+class IncompleteClass
+{
+ deque<IncompleteClass> instances;
+ typedef deque<IncompleteClass>::size_type size;
+};
+#endif
diff --git a/test/unit/divides_test.cpp b/test/unit/divides_test.cpp
new file mode 100644
index 0000000..73e35cd
--- /dev/null
+++ b/test/unit/divides_test.cpp
@@ -0,0 +1,33 @@
+#include <numeric>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class DivideTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(DivideTest);
+ CPPUNIT_TEST(div);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void div();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(DivideTest);
+
+//
+// tests implementation
+//
+void DivideTest::div()
+{
+ int input [3] = { 2, 3, 4 };
+ int result = accumulate(input, input + 3, 48, divides<int>());
+ CPPUNIT_ASSERT(result==2);
+}
diff --git a/test/unit/epilog_test.cpp b/test/unit/epilog_test.cpp
new file mode 100644
index 0000000..07e28f3
--- /dev/null
+++ b/test/unit/epilog_test.cpp
@@ -0,0 +1,10 @@
+#include <time.h>
+#include <string>
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+
+struct some_struct {
+ std::string s; // if std not properly redefined, error will be here
+};
+
+#endif
diff --git a/test/unit/equal_test.cpp b/test/unit/equal_test.cpp
new file mode 100644
index 0000000..91c0ae2
--- /dev/null
+++ b/test/unit/equal_test.cpp
@@ -0,0 +1,178 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class EqualTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(EqualTest);
+ CPPUNIT_TEST(equal_range0);
+ CPPUNIT_TEST(equal_range1);
+ CPPUNIT_TEST(equal_range2);
+ CPPUNIT_TEST(equal0);
+ CPPUNIT_TEST(equal1);
+ CPPUNIT_TEST(equal2);
+ CPPUNIT_TEST(equalto);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void equal_range0();
+ void equal_range1();
+ void equal_range2();
+ void equal0();
+ void equal1();
+ void equal2();
+ void equalto();
+ static bool values_squared(int a_, int b_);
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(EqualTest);
+
+//
+// tests implementation
+//
+void EqualTest::equal_range0()
+{
+ int numbers[10] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3 };
+ pair<int*, int*> range = equal_range((int*)numbers, (int*)numbers + 10, 2);
+ CPPUNIT_ASSERT( (range.first - numbers) == 4 );
+ CPPUNIT_ASSERT( (range.second - numbers) == 8 );
+}
+
+void EqualTest::equal_range1()
+{
+ typedef vector <int> IntVec;
+ IntVec v(10);
+ for (int i = 0; (size_t)i < v.size(); ++i)
+ v[i] = i / 3;
+
+ pair<IntVec::iterator, IntVec::iterator> range = equal_range(v.begin(), v.end(), 2);
+ CPPUNIT_ASSERT( (range.first - v.begin()) == 6 );
+ CPPUNIT_ASSERT( (range.second - v.begin()) == 9 );
+ for (; range.first != range.second; ++range.first)
+ CPPUNIT_ASSERT( *range.first == 2 );
+
+ range = equal_range(v.begin(), v.end(), 4);
+ CPPUNIT_ASSERT( range.first == range.second );
+ CPPUNIT_ASSERT( range.first == v.end() );
+}
+
+struct Test {
+#if defined (__DMC__)
+ Test();
+#endif
+
+ Test(int val) : value(val) {}
+ int value;
+
+ bool operator == (int i) const
+ { return value == i; }
+};
+
+bool operator < (const Test& v1, int v2)
+{ return v1.value < v2; }
+
+bool operator < (int v1, const Test& v2)
+{ return v1 < v2.value; }
+
+#if defined (_MSC_VER) && !defined (STLPORT)
+bool operator < (const Test& v1, const Test& v2)
+{ return v1.value < v2.value; }
+#endif
+
+void EqualTest::equal_range2()
+{
+ char chars[] = "aabbccddggghhklllmqqqqssyyzz";
+
+ const unsigned count = sizeof(chars) - 1;
+ pair<char*, char*> range = equal_range((char*)chars, (char*)chars + count, 'q', less<char>());
+ CPPUNIT_ASSERT( (range.first - chars) == 18 );
+ CPPUNIT_ASSERT( (range.second - chars) == 22 );
+ for (; range.first != range.second; ++range.first)
+ CPPUNIT_ASSERT( *range.first == 'q' );
+
+ range = equal_range((char*)chars, (char*)chars + count, 'm', less<char>());
+ CPPUNIT_ASSERT( (range.second - range.first) == 1 );
+ CPPUNIT_ASSERT( *range.first == 'm' );
+
+ vector<Test> tv;
+ vector<Test>::iterator it;
+ pair<vector<Test>::iterator, vector<Test>::iterator> p;
+
+ for (int i = 0; i < 10; ++i) {
+ tv.push_back(i);
+ }
+
+ it = upper_bound(tv.begin(), tv.end(), 5);
+ CPPUNIT_ASSERT( it != tv.end() );
+ CPPUNIT_ASSERT( *it == 6 );
+
+ it = lower_bound(tv.begin(), tv.end(), 5);
+ CPPUNIT_ASSERT( it != tv.end() );
+ CPPUNIT_ASSERT( *it == 5 );
+
+ p = equal_range(tv.begin(), tv.end(), 5);
+ CPPUNIT_ASSERT( p.first != p.second );
+ CPPUNIT_ASSERT( p.first != tv.end() );
+ CPPUNIT_ASSERT( p.second != tv.end() );
+ CPPUNIT_ASSERT( *p.first == 5 );
+ CPPUNIT_ASSERT( *p.second == 6 );
+}
+
+void EqualTest::equal0()
+{
+ int numbers1[5] = { 1, 2, 3, 4, 5 };
+ int numbers2[5] = { 1, 2, 4, 8, 16 };
+ int numbers3[2] = { 1, 2 };
+
+ CPPUNIT_ASSERT( !equal(numbers1, numbers1 + 5, numbers2) );
+ CPPUNIT_ASSERT( equal(numbers3, numbers3 + 2, numbers1) );
+}
+
+void EqualTest::equal1()
+{
+ vector <int> v1(10);
+ for (int i = 0; (size_t)i < v1.size(); ++i)
+ v1[i] = i;
+ vector <int> v2(10);
+ CPPUNIT_ASSERT( !equal(v1.begin(), v1.end(), v2.begin()) );
+
+ copy(v1.begin(), v1.end(), v2.begin());
+ CPPUNIT_ASSERT( equal(v1.begin(), v1.end(), v2.begin()) )
+}
+
+void EqualTest::equal2()
+{
+ vector <int> v1(10);
+ vector <int> v2(10);
+ for (int i = 0; (size_t)i < v1.size(); ++i) {
+ v1[i] = i;
+ v2[i] = i * i;
+ }
+ CPPUNIT_ASSERT( equal(v1.begin(), v1.end(), v2.begin(), values_squared) );
+}
+
+void EqualTest::equalto()
+{
+ int input1 [4] = { 1, 7, 2, 2 };
+ int input2 [4] = { 1, 6, 2, 3 };
+
+ int output [4];
+ transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, equal_to<int>());
+ CPPUNIT_ASSERT( output[0] == 1 );
+ CPPUNIT_ASSERT( output[1] == 0 );
+ CPPUNIT_ASSERT( output[2] == 1 );
+ CPPUNIT_ASSERT( output[3] == 0 );
+}
+
+bool EqualTest::values_squared(int a_, int b_)
+{
+ return (a_ * a_ == b_);
+}
diff --git a/test/unit/errno_header_test.c b/test/unit/errno_header_test.c
new file mode 100644
index 0000000..0a0accb
--- /dev/null
+++ b/test/unit/errno_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <errno.h>
diff --git a/test/unit/exception_header_test.cpp b/test/unit/exception_header_test.cpp
new file mode 100644
index 0000000..d784ab9
--- /dev/null
+++ b/test/unit/exception_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <exception>
diff --git a/test/unit/exception_test.cpp b/test/unit/exception_test.cpp
new file mode 100644
index 0000000..1879945
--- /dev/null
+++ b/test/unit/exception_test.cpp
@@ -0,0 +1,193 @@
+#include <exception>
+#include <stdexcept>
+#include <string>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if defined (STLPORT) && defined (_STLP_USE_NAMESPACES)
+/*
+ * This test case purpose is to check that the exception handling
+ * functions are correctly imported to the STLport namespace only
+ * if they have a right behavior.
+ * Otherwise they are not imported to report the problem as a compile
+ * time error.
+ */
+
+//
+// TestCase class
+//
+class ExceptionTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(ExceptionTest);
+#if defined (STLPORT) && !defined (_STLP_USE_EXCEPTIONS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(what);
+#if defined (STLPORT) && defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(unexpected_except);
+#if defined (STLPORT) && defined (_STLP_USE_EXCEPTIONS)
+ CPPUNIT_STOP_IGNORE;
+#endif
+#if defined (STLPORT) && defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(uncaught_except);
+#if defined (STLPORT) && defined (_STLP_USE_EXCEPTIONS)
+ CPPUNIT_STOP_IGNORE;
+#endif
+ CPPUNIT_TEST(exception_emission);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void what();
+ void unexpected_except();
+ void uncaught_except();
+ void exception_emission();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ExceptionTest);
+
+#if !defined (STLPORT) || !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
+bool g_unexpected_called = false;
+void unexpected_hdl() {
+ g_unexpected_called = true;
+ throw std::bad_exception();
+}
+
+struct special_except {};
+void throw_func() {
+ throw special_except();
+}
+
+void throw_except_func() throw(std::exception) {
+ throw_func();
+}
+#endif
+
+void ExceptionTest::what()
+{
+ try {
+ throw std::runtime_error( std::string( "message" ) );
+ }
+ catch ( std::runtime_error& err ) {
+ CPPUNIT_CHECK( strcmp( err.what(), "message" ) == 0 );
+ }
+}
+
+void ExceptionTest::unexpected_except()
+{
+#if !defined (STLPORT) || !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
+ std::unexpected_handler hdl = &unexpected_hdl;
+ std::set_unexpected(hdl);
+
+ try {
+ throw_except_func();
+ }
+ catch (std::bad_exception const&) {
+ CPPUNIT_ASSERT( true );
+ }
+ catch (special_except) {
+ CPPUNIT_ASSERT( false );
+ }
+ CPPUNIT_ASSERT( g_unexpected_called );
+#endif
+}
+
+#if !defined (STLPORT) || !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
+struct UncaughtClassTest
+{
+ UncaughtClassTest(int &res) : _res(res)
+ {}
+
+ ~UncaughtClassTest() {
+ _res = std::uncaught_exception()?1:0;
+ }
+
+ int &_res;
+};
+#endif
+
+void ExceptionTest::uncaught_except()
+{
+#if !defined (STLPORT) || !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
+ int uncaught_result = -1;
+ {
+ UncaughtClassTest test_inst(uncaught_result);
+ CPPUNIT_ASSERT( uncaught_result == -1 );
+ }
+ CPPUNIT_ASSERT( uncaught_result == 0 );
+
+ {
+ try {
+ uncaught_result = -1;
+ UncaughtClassTest test_inst(uncaught_result);
+ throw "exception";
+ }
+ catch (...) {
+ }
+ }
+ CPPUNIT_ASSERT( uncaught_result == 1 );
+#endif
+}
+
+void ExceptionTest::exception_emission()
+{
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ std::string foo = "foo";
+ try {
+ throw std::runtime_error(foo);
+ }
+ catch (std::runtime_error const& e) {
+ CPPUNIT_ASSERT( foo == e.what() );
+ std::runtime_error clone("");
+ clone = e;
+ CPPUNIT_ASSERT(foo == clone.what() );
+ }
+ catch (...) {
+ CPPUNIT_ASSERT( false );
+ }
+
+ try {
+ throw std::runtime_error(foo);
+ }
+ catch (std::runtime_error e) {
+ CPPUNIT_ASSERT( foo == e.what() );
+ std::runtime_error clone("");
+ clone = e;
+ CPPUNIT_ASSERT(foo == clone.what() );
+ }
+ catch (...) {
+ CPPUNIT_ASSERT( false );
+ }
+
+ std::string msg(512, 'a');
+ try {
+ throw std::runtime_error(msg);
+ }
+ catch (std::runtime_error const& e) {
+ CPPUNIT_ASSERT(msg == e.what() );
+ std::runtime_error clone("");
+ clone = e;
+ CPPUNIT_ASSERT(msg == clone.what() );
+ }
+ catch (...) {
+ CPPUNIT_ASSERT( false );
+ }
+
+ try {
+ throw std::runtime_error(msg);
+ }
+ catch (std::runtime_error e) {
+ CPPUNIT_ASSERT(msg == e.what() );
+ std::runtime_error clone("");
+ clone = e;
+ CPPUNIT_ASSERT(msg == clone.what() );
+ }
+ catch (...) {
+ CPPUNIT_ASSERT( false );
+ }
+#endif
+}
+#endif
diff --git a/test/unit/fadapter.h b/test/unit/fadapter.h
new file mode 100644
index 0000000..b1cceaf
--- /dev/null
+++ b/test/unit/fadapter.h
@@ -0,0 +1,80 @@
+#ifndef _fadapter_h_
+#define _fadapter_h_
+
+#include <functional>
+
+// used as adaptor's return/argument type,
+// to allow binders/composers usage
+struct __void_tag {};
+
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+using std::unary_function;
+#endif
+
+template <class Result>
+class pointer_to_void_function {
+protected:
+ Result (*ptr)();
+public:
+ explicit pointer_to_void_function(Result (*x)()) : ptr(x) {}
+ Result operator()() const { return ptr(); }
+ Result operator()(__void_tag) const { return ptr(); }
+};
+
+// to feed composers
+template <class Arg1>
+struct projectvoid : public unary_function<Arg1,__void_tag> {
+ __void_tag operator()(const Arg1& x) const { return __void_tag(); }
+};
+
+#if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
+
+template <class Result>
+pointer_to_void_function<Result> ptr_fun(Result (*x)()) {
+ return pointer_to_void_function<Result>(x);
+}
+
+// alternate name
+template <class Result>
+pointer_to_void_function<Result> ptr_gen(Result (*x)()) {
+ return pointer_to_void_function<Result>(x);
+}
+
+#endif /* !defined (_STLP_MEMBER_POINTER_PARAM_BUG) */
+
+template <class Arg>
+class pointer_to_unary_procedure /* :public unary_function<Arg, __void_tag> */ {
+protected:
+ typedef void (*fun_type)(Arg);
+ fun_type ptr;
+public:
+ typedef Arg argument_type;
+ pointer_to_unary_procedure() {}
+ pointer_to_unary_procedure(fun_type x) : ptr(x) {}
+ void operator() (Arg x) const { ptr(x); }
+};
+
+template <class Arg>
+inline pointer_to_unary_procedure<Arg> ptr_proc(void (*x)(Arg)) {
+ return pointer_to_unary_procedure<Arg>(x);
+}
+
+template <class Arg1, class Arg2>
+class pointer_to_binary_procedure /* : public unary_function<Arg1, Arg2, __void_tag> */ {
+protected:
+ typedef void (*fun_type)(Arg1, Arg2);
+ fun_type ptr;
+public:
+ typedef Arg1 first_argument_type;
+ typedef Arg2 second_argument_type;
+ pointer_to_binary_procedure() {}
+ pointer_to_binary_procedure(fun_type x) : ptr(x) {}
+ void operator() (Arg1 x, Arg2 y) const { ptr(x, y); }
+};
+
+template <class Arg1, class Arg2>
+inline pointer_to_binary_procedure<Arg1, Arg2> ptr_proc(void (*x)(Arg1, Arg2)) {
+ return pointer_to_binary_procedure<Arg1, Arg2>(x);
+}
+
+#endif
diff --git a/test/unit/fib.h b/test/unit/fib.h
new file mode 100644
index 0000000..9c74038
--- /dev/null
+++ b/test/unit/fib.h
@@ -0,0 +1,21 @@
+#ifndef _fib_h
+#define _fib_h
+class Fibonacci
+{
+ public:
+ Fibonacci() : v1(0), v2(1) {}
+ inline int operator()();
+ private:
+ int v1;
+ int v2;
+};
+
+inline int
+Fibonacci::operator()()
+{
+ int r = v1 + v2;
+ v1 = v2;
+ v2 = r;
+ return v1;
+}
+#endif // _fib_h
diff --git a/test/unit/fill_test.cpp b/test/unit/fill_test.cpp
new file mode 100644
index 0000000..22d3fe9
--- /dev/null
+++ b/test/unit/fill_test.cpp
@@ -0,0 +1,61 @@
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class FillTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(FillTest);
+ CPPUNIT_TEST(fill1);
+ CPPUNIT_TEST(filln1);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void fill1();
+ void filln1();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(FillTest);
+
+//
+// tests implementation
+//
+void FillTest::fill1()
+{
+ vector <int> v(10);
+ fill(v.begin(), v.end(), 42);
+
+ CPPUNIT_ASSERT(v[0]==42);
+ CPPUNIT_ASSERT(v[1]==42);
+ CPPUNIT_ASSERT(v[2]==42);
+ CPPUNIT_ASSERT(v[3]==42);
+ CPPUNIT_ASSERT(v[4]==42);
+ CPPUNIT_ASSERT(v[5]==42);
+ CPPUNIT_ASSERT(v[6]==42);
+ CPPUNIT_ASSERT(v[7]==42);
+ CPPUNIT_ASSERT(v[8]==42);
+ CPPUNIT_ASSERT(v[9]==42);
+}
+void FillTest::filln1()
+{
+ vector <int> v(10);
+ fill_n(v.begin(), v.size(), 42);
+
+ CPPUNIT_ASSERT(v[0]==42);
+ CPPUNIT_ASSERT(v[1]==42);
+ CPPUNIT_ASSERT(v[2]==42);
+ CPPUNIT_ASSERT(v[3]==42);
+ CPPUNIT_ASSERT(v[4]==42);
+ CPPUNIT_ASSERT(v[5]==42);
+ CPPUNIT_ASSERT(v[6]==42);
+ CPPUNIT_ASSERT(v[7]==42);
+ CPPUNIT_ASSERT(v[8]==42);
+ CPPUNIT_ASSERT(v[9]==42);
+}
diff --git a/test/unit/find_test.cpp b/test/unit/find_test.cpp
new file mode 100644
index 0000000..d910f33
--- /dev/null
+++ b/test/unit/find_test.cpp
@@ -0,0 +1,135 @@
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class FindTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(FindTest);
+ CPPUNIT_TEST(find0);
+ CPPUNIT_TEST(find1);
+ CPPUNIT_TEST(findif0);
+ CPPUNIT_TEST(findif1);
+ CPPUNIT_TEST(find_char);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void find0();
+ void find1();
+ void findif0();
+ void findif1();
+ void find_char();
+ static bool odd(int a_);
+ static bool div_3(int a_);
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(FindTest);
+
+//
+// tests implementation
+//
+void FindTest::find0()
+{
+ int numbers[10] = { 0, 1, 4, 9, 16, 25, 36, 49, 64 };
+
+ int *location = find((int*)numbers, (int*)numbers + 10, 25);
+
+ CPPUNIT_ASSERT((location - numbers)==5);
+
+ int *out_range = find((int*)numbers, (int*)numbers + 10, 128);
+
+ CPPUNIT_ASSERT( out_range == (int *)(numbers + 10) );
+}
+
+struct Key
+{
+ int data;
+
+ /* This operator should rather be global and commutative
+ but implementing it this way show that STLport used to
+ ask too much from the user code. */
+ bool operator == (int d) const
+ {
+ return data == d;
+ }
+};
+
+void FindTest::find1()
+{
+ int years[] = { 1942, 1952, 1962, 1972, 1982, 1992 };
+
+ const unsigned yearCount = sizeof(years) / sizeof(years[0]);
+ int* location = find((int*)years, (int*)years + yearCount, 1972);
+
+ CPPUNIT_ASSERT((location - years)==3);
+}
+
+void FindTest::findif0()
+{
+ {
+ int numbers[6] = { 2, 4, 8, 15, 32, 64 };
+ int *location = find_if((int*)numbers, (int*)numbers + 6, odd);
+
+ CPPUNIT_ASSERT((location - numbers)==3);
+
+ int numbers_even[6] = { 2, 4, 8, 16, 32, 64 };
+
+ int *out_range = find_if((int*)numbers_even, (int*)numbers_even + 6, odd);
+
+ CPPUNIT_ASSERT( out_range == (int *)(numbers_even + 6) );
+ }
+
+ {
+ Key keys[10] = { {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} };
+ Key const* k = find(keys + 0, keys + 10, 5);
+ CPPUNIT_ASSERT( k == keys + 10 );
+ }
+}
+
+void FindTest::findif1()
+{
+ typedef vector <int> IntVec;
+ IntVec v(10);
+ for(int i = 0; (size_t)i < v.size(); ++i)
+ v[i] =(i + 1) *(i + 1);
+ IntVec::iterator iter;
+ iter = find_if(v.begin(), v.end(), div_3);
+ CPPUNIT_ASSERT((iter - v.begin())==2);
+}
+
+bool FindTest::odd(int a_)
+{
+ return (a_ % 2) != 0;
+}
+
+bool FindTest::div_3(int a_)
+{
+ return a_ % 3 ? 0 : 1;
+}
+
+void FindTest::find_char()
+{
+ char str[] = "abcdefghij";
+ char *pstr = (char*)str;
+ const char* cpstr = (const char*)str;
+ size_t str_size = sizeof(str) / sizeof(char);
+
+ char *d = find(pstr, pstr + str_size, 'd');
+ CPPUNIT_ASSERT( *d == 'd' );
+
+ const char *e = find(cpstr, cpstr + str_size, 'e');
+ CPPUNIT_ASSERT( *e == 'e' );
+
+ char *last = find(pstr, pstr + str_size, 'x');
+ CPPUNIT_ASSERT( last == pstr + str_size );
+
+ const char *clast = find(cpstr, cpstr + str_size, 'x');
+ CPPUNIT_ASSERT( clast == cpstr + str_size );
+}
diff --git a/test/unit/finsert_test.cpp b/test/unit/finsert_test.cpp
new file mode 100644
index 0000000..e45289e
--- /dev/null
+++ b/test/unit/finsert_test.cpp
@@ -0,0 +1,58 @@
+#include <vector>
+#include <algorithm>
+#include <deque>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class FinsertTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(FinsertTest);
+ CPPUNIT_TEST(finsert1);
+ CPPUNIT_TEST(finsert2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void finsert1();
+ void finsert2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(FinsertTest);
+
+//
+// tests implementation
+//
+void FinsertTest::finsert1()
+{
+ char const* array [] = { "laurie", "jennifer", "leisa" };
+ deque<char const*> names;
+ front_insert_iterator<deque<char const*> > fit(names);
+ fit = copy(array, array + 3, front_insert_iterator<deque <char const*> >(names));
+
+ CPPUNIT_ASSERT(names[0]==array[2]);
+ CPPUNIT_ASSERT(names[1]==array[1]);
+ CPPUNIT_ASSERT(names[2]==array[0]);
+
+ copy(array, array + 3, fit);
+ CPPUNIT_ASSERT(names[3]==array[2]);
+ CPPUNIT_ASSERT(names[4]==array[1]);
+ CPPUNIT_ASSERT(names[5]==array[0]);
+}
+
+void FinsertTest::finsert2()
+{
+ char const* array [] = { "laurie", "jennifer", "leisa" };
+
+ deque<char const*> names;
+ copy(array, array + 3, front_inserter(names));
+
+ CPPUNIT_ASSERT(names[0]==array[2]);
+ CPPUNIT_ASSERT(names[1]==array[1]);
+ CPPUNIT_ASSERT(names[2]==array[0]);
+}
diff --git a/test/unit/float_header_test.c b/test/unit/float_header_test.c
new file mode 100644
index 0000000..bb3f28d
--- /dev/null
+++ b/test/unit/float_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <float.h>
diff --git a/test/unit/foreach_test.cpp b/test/unit/foreach_test.cpp
new file mode 100644
index 0000000..76fd514
--- /dev/null
+++ b/test/unit/foreach_test.cpp
@@ -0,0 +1,73 @@
+#include <vector>
+#include <algorithm>
+#include "fadapter.h"
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class ForeachTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(ForeachTest);
+ CPPUNIT_TEST(foreach0);
+ CPPUNIT_TEST(foreach1);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void foreach0();
+ void foreach1();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ForeachTest);
+
+//
+// tests implementation
+//
+static void increase(int& a_)
+{
+ a_ += 1;
+}
+void ForeachTest::foreach0()
+{
+ int numbers[10] = { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 };
+
+ for_each(numbers, numbers + 10, ptr_fun(increase));
+
+ CPPUNIT_ASSERT(numbers[0]==2);
+ CPPUNIT_ASSERT(numbers[1]==2);
+ CPPUNIT_ASSERT(numbers[2]==3);
+ CPPUNIT_ASSERT(numbers[3]==4);
+ CPPUNIT_ASSERT(numbers[4]==6);
+ CPPUNIT_ASSERT(numbers[5]==9);
+ CPPUNIT_ASSERT(numbers[6]==14);
+ CPPUNIT_ASSERT(numbers[7]==22);
+ CPPUNIT_ASSERT(numbers[8]==35);
+ CPPUNIT_ASSERT(numbers[9]==56);
+}
+static void sqr(int& a_)
+{
+ a_ = a_ * a_;
+}
+void ForeachTest::foreach1()
+{
+ vector<int> v1(10);
+ for (int i = 0; (size_t)i < v1.size(); ++i)
+ v1[i] = i;
+ for_each(v1.begin(), v1.end(), ptr_fun(sqr) );
+
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==4);
+ CPPUNIT_ASSERT(v1[3]==9);
+ CPPUNIT_ASSERT(v1[4]==16);
+ CPPUNIT_ASSERT(v1[5]==25);
+ CPPUNIT_ASSERT(v1[6]==36);
+ CPPUNIT_ASSERT(v1[7]==49);
+ CPPUNIT_ASSERT(v1[8]==64);
+ CPPUNIT_ASSERT(v1[9]==81);
+}
diff --git a/test/unit/fstream_header_test.cpp b/test/unit/fstream_header_test.cpp
new file mode 100644
index 0000000..7fbe268
--- /dev/null
+++ b/test/unit/fstream_header_test.cpp
@@ -0,0 +1,10 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#if !defined (_STLP_NO_IOSTREAMS)
+# include <fstream>
+#endif
diff --git a/test/unit/fstream_test.cpp b/test/unit/fstream_test.cpp
new file mode 100644
index 0000000..bba41a2
--- /dev/null
+++ b/test/unit/fstream_test.cpp
@@ -0,0 +1,915 @@
+#include <string>
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <fstream>
+# include <iostream>
+# include <iomanip>
+# include <sstream>
+# include <vector>
+# include <stdexcept>
+
+#include <stdio.h>
+
+# include "full_streambuf.h"
+# include "cppunit/cppunit_proxy.h"
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+//The macro value gives approximately the generated file
+//size in Go
+//#define CHECK_BIG_FILE 4
+
+# if (!defined(STLPORT) && (defined (__GNUC__) && (__GNUC__ > 3))) || \
+ (defined (STLPORT) && !defined (_STLP_NO_CUSTOM_IO) && !defined (_STLP_NO_MEMBER_TEMPLATES) && \
+ !((defined (_STLP_MSVC) && (_STLP_MSVC < 1300)) || \
+ (defined (__GNUC__) && (__GNUC__ < 3)) || \
+ (defined (__SUNPRO_CC)) || \
+ (defined (__DMC__) && defined (_DLL))))
+# define DO_CUSTOM_FACET_TEST
+# endif
+
+//
+// TestCase class
+//
+class FstreamTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(FstreamTest);
+ CPPUNIT_TEST(output);
+ CPPUNIT_TEST(input);
+ CPPUNIT_TEST(input_char);
+ CPPUNIT_TEST(io);
+ CPPUNIT_TEST(err);
+ CPPUNIT_TEST(tellg);
+ CPPUNIT_TEST(tellp);
+ CPPUNIT_TEST(seek);
+ CPPUNIT_TEST(buf);
+ CPPUNIT_TEST(rdbuf);
+ CPPUNIT_TEST(streambuf_output);
+ CPPUNIT_TEST(win32_file_format);
+ CPPUNIT_TEST(null_stream);
+# if defined (STLPORT) && (defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS))
+ CPPUNIT_IGNORE;
+# endif
+ CPPUNIT_TEST(null_buf);
+# if !defined (STLPORT) || !defined (_STLP_WIN32)
+ CPPUNIT_TEST(offset);
+# endif
+# if defined (CHECK_BIG_FILE)
+ CPPUNIT_TEST(big_file);
+# endif
+# if !defined (DO_CUSTOM_FACET_TEST)
+ CPPUNIT_IGNORE;
+# endif
+ CPPUNIT_TEST(custom_facet);
+ CPPUNIT_TEST_SUITE_END();
+
+ protected:
+ void output();
+ void input();
+ void input_char();
+ void io();
+ void err();
+ void tellg();
+ void tellp();
+ void seek();
+ void buf();
+ void rdbuf();
+ void streambuf_output();
+ void win32_file_format();
+ void null_stream();
+ void null_buf();
+# if !defined (STLPORT) || !defined (_STLP_WIN32)
+ void offset();
+# endif
+ void custom_facet();
+# if defined (CHECK_BIG_FILE)
+ void big_file();
+# endif
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(FstreamTest);
+
+//
+// tests implementation
+//
+void FstreamTest::output()
+{
+ ofstream f( "test_file.txt" );
+
+ f << 1 << '\n' << 2.0 << '\n' << "abcd\n" << "ghk lm\n" << "abcd ef";
+ CPPUNIT_ASSERT (f.good());
+ // CPPUNIT_ASSERT( s.str() == "1\n2\nabcd\nghk lm\nabcd ef" );
+}
+
+void FstreamTest::input()
+{
+ {
+ ifstream f( "test_file.txt" );
+ int i = 0;
+ f >> i;
+ CPPUNIT_ASSERT( f.good() );
+ CPPUNIT_ASSERT( i == 1 );
+ double d = 0.0;
+ f >> d;
+ CPPUNIT_ASSERT( f.good() );
+ CPPUNIT_ASSERT( d == 2.0 );
+ string str;
+ f >> str;
+ CPPUNIT_ASSERT( f.good() );
+ CPPUNIT_ASSERT( str == "abcd" );
+ char c;
+ f.get(c); // extract newline, that not extracted by operator >>
+ CPPUNIT_ASSERT( f.good() );
+ CPPUNIT_ASSERT( c == '\n' );
+ getline( f, str );
+ CPPUNIT_ASSERT( f.good() );
+ CPPUNIT_ASSERT( str == "ghk lm" );
+ getline( f, str );
+ CPPUNIT_ASSERT( f.eof() );
+ CPPUNIT_ASSERT( str == "abcd ef" );
+ }
+#if defined (STLPORT) && !defined (_STLP_USE_WIN32_IO)
+ {
+ ifstream in("/tmp");
+ if (in.good()) {
+ string s;
+ getline(in, s);
+ CPPUNIT_ASSERT( in.fail() );
+ }
+ }
+#endif
+}
+
+void FstreamTest::input_char()
+{
+ char buf[16] = { 0, '1', '2', '3' };
+ ifstream s( "test_file.txt" );
+ s >> buf;
+
+ CPPUNIT_ASSERT( buf[0] == '1' );
+ CPPUNIT_ASSERT( buf[1] == 0 );
+ CPPUNIT_ASSERT( buf[2] == '2' );
+}
+
+void FstreamTest::io()
+{
+ basic_fstream<char,char_traits<char> > f( "test_file.txt", ios_base::in | ios_base::out | ios_base::trunc );
+
+ CPPUNIT_ASSERT( f.is_open() );
+
+ f << 1 << '\n' << 2.0 << '\n' << "abcd\n" << "ghk lm\n" << "abcd ef";
+
+ // f.flush();
+ f.seekg( 0, ios_base::beg );
+
+ int i = 0;
+ f >> i;
+ CPPUNIT_ASSERT( f.good() );
+ CPPUNIT_ASSERT( i == 1 );
+ double d = 0.0;
+ f >> d;
+ CPPUNIT_ASSERT( d == 2.0 );
+ string s;
+ f >> s;
+ CPPUNIT_ASSERT( f.good() );
+ CPPUNIT_ASSERT( s == "abcd" );
+ char c;
+ f.get(c); // extract newline, that not extracted by operator >>
+ CPPUNIT_ASSERT( f.good() );
+ CPPUNIT_ASSERT( c == '\n' );
+ getline( f, s );
+ CPPUNIT_ASSERT( f.good() );
+ CPPUNIT_ASSERT( s == "ghk lm" );
+ getline( f, s );
+ CPPUNIT_ASSERT( !f.fail() );
+ CPPUNIT_ASSERT( s == "abcd ef" );
+ CPPUNIT_ASSERT( f.eof() );
+}
+
+void FstreamTest::err()
+{
+ basic_fstream<char,char_traits<char> > f( "test_file.txt", ios_base::in | ios_base::out | ios_base::trunc );
+
+ CPPUNIT_ASSERT( f.is_open() );
+
+ int i = 9;
+ f << i;
+ CPPUNIT_ASSERT( f.good() );
+ i = 0;
+ f.seekg( 0, ios_base::beg );
+ f >> i;
+ CPPUNIT_ASSERT( !f.fail() );
+ CPPUNIT_ASSERT( i == 9 );
+ f >> i;
+ CPPUNIT_ASSERT( f.fail() );
+ CPPUNIT_ASSERT( f.eof() );
+ CPPUNIT_ASSERT( i == 9 );
+}
+
+void FstreamTest::tellg()
+{
+ {
+ // bogus ios_base::binary is for Wins
+ ofstream of("test_file.txt", ios_base::out | ios_base::binary | ios_base::trunc);
+ CPPUNIT_ASSERT( of.is_open() );
+
+ for (int i = 0; i < 50; ++i) {
+ of << "line " << setiosflags(ios_base::right) << setfill('0') << setw(2) << i << "\n";
+ CPPUNIT_ASSERT( !of.fail() );
+ }
+ of.close();
+ }
+
+ {
+ // bogus ios_base::binary is for Wins
+ ifstream is("test_file.txt", ios_base::in | ios_base::binary);
+ CPPUNIT_ASSERT( is.is_open() );
+ char buf[64];
+
+ // CPPUNIT_ASSERT( is.tellg() == 0 );
+ streampos p = 0;
+ for (int i = 0; i < 50; ++i) {
+ is.read(buf, 0);
+ CPPUNIT_ASSERT( is.gcount() == 0 );
+ CPPUNIT_ASSERT( is.tellg() == p );
+ is.read( buf, 8 );
+ CPPUNIT_ASSERT( !is.fail() );
+ CPPUNIT_ASSERT( is.gcount() == 8 );
+ p += 8;
+ }
+ }
+
+ {
+ // bogus ios_base::binary is for Wins
+ ifstream is("test_file.txt", ios_base::in | ios_base::binary);
+ CPPUNIT_ASSERT( is.is_open() );
+
+ streampos p = 0;
+ for (int i = 0; i < 50; ++i) {
+ CPPUNIT_ASSERT( !is.fail() );
+ is.tellg();
+ CPPUNIT_ASSERT( is.tellg() == p );
+ p += 8;
+ is.seekg( p, ios_base::beg );
+ CPPUNIT_ASSERT( !is.fail() );
+ }
+ }
+
+ {
+ // bogus ios_base::binary is for Wins
+ ifstream is("test_file.txt", ios_base::in | ios_base::binary);
+ CPPUNIT_ASSERT( is.is_open() );
+
+ streampos p = 0;
+ for (int i = 0; i < 50; ++i) {
+ CPPUNIT_ASSERT( is.tellg() == p );
+ p += 8;
+ is.seekg( 8, ios_base::cur );
+ CPPUNIT_ASSERT( !is.fail() );
+ }
+ }
+}
+
+void FstreamTest::tellp()
+{
+ {
+ ofstream o( "test_file.txt" );
+
+ o << "123456";
+
+ CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == ofstream::pos_type(6) );
+ CPPUNIT_CHECK( o.tellp() == ofstream::pos_type(6) );
+ }
+ {
+ ofstream o( "test_file.txt" );
+
+ o << "123456789";
+
+ CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == ofstream::pos_type(9) );
+ CPPUNIT_CHECK( o.tellp() == ofstream::pos_type(9) );
+ }
+ /* According to the standard
+ ofstream o( "test_file.txt", ios_base::app | ios_base::out )
+ should give the same effect as fopen( "test_file.txt", "a" ).
+ Problem is fopen( "test_file.txt", "a" ) has a bit different behaviour
+ on different platforms, and this difference is not covered by specification.
+ After fopen( "test_file.txt", "a" ) in this context ftell( f ) == 9 for
+ Linux and Mac OS X (I expect the same for others POSIX-like platforms too);
+ on Windows (independently from version?) ftell( f ) == 0, i.e. write pointer not
+ shifted to EOF (but shifted to EOF just before write, as described in the specs).
+
+ It isn't specifications violation, neither for Linux and Mac OS X nor for Windows.
+
+ The code below is intended to demonstrate ambiguity (dependance from fopen implementation).
+ */
+ {
+ #ifdef WIN32
+ //In Windows, stlport and fopen use kernel32.CreateFile for open.
+ //File position is at BOF after open, unless we open with ios_base::ate
+ long expected_pos = 0;
+ #else
+ //On UNIX flavours, stlport and fopen use unix's open
+ //File position is at EOF after open
+ //
+ //3rd possible scenario, "other platforms" - _STLP_USE_STDIO_IO
+ //stlport uses fopen here. This case may fail this test, since the file position after
+ //fopen is implementation-dependent
+ long expected_pos = 9;
+ #endif
+ ofstream o( "test_file.txt", ios_base::app | ios_base::out );
+ CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == ofstream::pos_type(expected_pos) );
+ CPPUNIT_CHECK( o.tellp() == ofstream::pos_type(expected_pos) );
+ }
+ { // for reference, to test fopen/ftell behaviour in append mode:
+ #ifdef WIN32
+ long expected_pos = 0;
+ #else
+ long expected_pos = 9;
+ #endif
+ FILE* f = fopen( "test_file.txt", "a" );
+ CPPUNIT_CHECK( ftell( f ) == expected_pos );
+ fclose( f );
+ }
+ {
+ //In append mode, file is positioned at EOF just before a write.
+ // After a write, file is at EOF. This is implementation-independent.
+ ofstream o( "test_file.txt", ios_base::app | ios_base::out );
+ o << "X";
+ CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == ofstream::pos_type(10) );
+ CPPUNIT_CHECK( o.tellp() == ofstream::pos_type(10) );
+ }
+}
+
+void FstreamTest::buf()
+{
+ fstream ss( "test_file.txt", ios_base::in | ios_base::out | ios_base::binary | ios_base::trunc );
+
+ ss << "1234567\n89\n";
+ ss.seekg( 0, ios_base::beg );
+ char buf[10];
+ buf[7] = 'x';
+ ss.get( buf, 10 );
+ CPPUNIT_ASSERT( !ss.fail() );
+ CPPUNIT_ASSERT( buf[0] == '1' );
+ CPPUNIT_ASSERT( buf[1] == '2' );
+ CPPUNIT_ASSERT( buf[2] == '3' );
+ CPPUNIT_ASSERT( buf[3] == '4' );
+ CPPUNIT_ASSERT( buf[4] == '5' );
+ CPPUNIT_ASSERT( buf[5] == '6' );
+ CPPUNIT_ASSERT( buf[6] == '7' ); // 27.6.1.3 paragraph 10, paragraph 7
+ CPPUNIT_ASSERT( buf[7] == 0 ); // 27.6.1.3 paragraph 8
+ char c;
+ ss.get(c);
+ CPPUNIT_ASSERT( !ss.fail() );
+ CPPUNIT_ASSERT( c == '\n' ); // 27.6.1.3 paragraph 10, paragraph 7
+ ss.get(c);
+ CPPUNIT_ASSERT( !ss.fail() );
+ CPPUNIT_ASSERT( c == '8' );
+}
+
+void FstreamTest::seek()
+{
+ {
+ // Test in binary mode:
+ {
+ fstream s( "test_file.txt", ios_base::in | ios_base::out | ios_base::binary | ios_base::trunc );
+ CPPUNIT_ASSERT( s );
+
+ s << "1234567890\n";
+ CPPUNIT_ASSERT( s );
+ }
+
+ char b1[] = { 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' };
+ fstream s( "test_file.txt", ios_base::in | ios_base::out | ios_base::binary );
+ CPPUNIT_ASSERT( s );
+
+ int chars_read = (int)s.rdbuf()->sgetn( b1, sizeof(b1) );
+ CPPUNIT_CHECK( chars_read == 11 );
+ CPPUNIT_CHECK( b1[9] == '0' );
+ CPPUNIT_ASSERT( s.rdbuf()->pubseekoff( 0, ios_base::cur ) == fstream::pos_type(chars_read) );
+ CPPUNIT_ASSERT( s.rdbuf()->pubseekoff( -chars_read, ios_base::cur ) == fstream::pos_type(0) );
+
+ char b2[10] = { 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y' };
+
+ CPPUNIT_ASSERT( s.rdbuf()->sgetn( b2, 10 ) == 10 );
+ CPPUNIT_CHECK( b2[9] == '0' );
+ }
+
+ {
+ // Test in text mode:
+ {
+ fstream s( "test_file.txt", ios_base::in | ios_base::out | ios_base::trunc );
+ CPPUNIT_ASSERT( s );
+
+ s << "1234567890\n";
+ CPPUNIT_ASSERT( s );
+ }
+
+ char b1[] = { 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' };
+ fstream s( "test_file.txt", ios_base::in | ios_base::out );
+ CPPUNIT_ASSERT( s );
+
+ int chars_read = (int)s.rdbuf()->sgetn( b1, sizeof(b1) );
+ CPPUNIT_CHECK( chars_read == 11 );
+ CPPUNIT_CHECK( b1[9] == '0' );
+
+ fstream::pos_type pos = s.rdbuf()->pubseekoff(0, ios_base::cur);
+ // Depending on how '\n' is written in file, file position can be greater or equal to the number of chars_read read.
+ streamoff offset = pos;
+ CPPUNIT_ASSERT( offset >= chars_read );
+ offset = s.rdbuf()->pubseekoff( -offset, ios_base::cur );
+ CPPUNIT_ASSERT( offset == 0 );
+
+ char b2[10] = { 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y' };
+
+ CPPUNIT_ASSERT( s.rdbuf()->sgetn( b2, 5 ) == 5 );
+ CPPUNIT_CHECK( b2[4] == '5' );
+
+ pos = s.rdbuf()->pubseekoff(0, ios_base::cur);
+ CPPUNIT_ASSERT( pos == fstream::pos_type(5) );
+ CPPUNIT_ASSERT( s.rdbuf()->pubseekoff(-5, ios_base::cur) == fstream::pos_type(0) );
+ }
+
+#if !defined (STLPORT) || \
+ (!defined (_STLP_NO_WCHAR_T) && defined (_STLP_USE_EXCEPTIONS))
+ {
+ // Test with a wariable encoding:
+ locale loc;
+ try
+ {
+ locale tmp(locale::classic(), new codecvt_byname<wchar_t, char, mbstate_t>(".UTF8"));
+ loc = tmp;
+ }
+ catch (const runtime_error&)
+ {
+ // Localization no supported so no test:
+ return;
+ }
+
+ {
+ wfstream s( "test_file.txt", ios_base::in | ios_base::out | ios_base::trunc );
+ CPPUNIT_ASSERT( s );
+ s.imbue(loc);
+ CPPUNIT_ASSERT( s );
+
+ s << L"1234567890\n";
+ CPPUNIT_ASSERT( s );
+ }
+
+ wchar_t b1[] = { L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x', L'x' };
+ wfstream s( "test_file.txt", ios_base::in | ios_base::out );
+ CPPUNIT_ASSERT( s );
+ s.imbue(loc);
+ CPPUNIT_ASSERT( s );
+
+ int chars_read = (int)s.rdbuf()->sgetn( b1, sizeof(b1) / sizeof(wchar_t) );
+ CPPUNIT_CHECK( chars_read == 11 );
+ CPPUNIT_CHECK( b1[9] == L'0' );
+
+ fstream::pos_type pos = s.rdbuf()->pubseekoff(0, ios_base::cur);
+ // Depending on how '\n' is written in file, file position can be greater or equal to the number of chars_read read.
+ streamoff off = pos;
+ CPPUNIT_ASSERT( off >= chars_read );
+ off = s.rdbuf()->pubseekoff(-off, ios_base::cur);
+ CPPUNIT_ASSERT( off == -1 );
+ off = s.rdbuf()->pubseekoff(0, ios_base::beg);
+ CPPUNIT_ASSERT( off == 0 );
+
+ wchar_t b2[10] = { L'y', L'y', L'y', L'y', L'y', L'y', L'y', L'y', L'y', L'y' };
+
+ CPPUNIT_ASSERT( s.rdbuf()->sgetn( b2, 5 ) == 5 );
+ CPPUNIT_CHECK( b2[4] == L'5' );
+
+ pos = s.rdbuf()->pubseekoff(0, ios_base::cur);
+ CPPUNIT_ASSERT( pos == fstream::pos_type(5) );
+ //CPPUNIT_ASSERT( s.rdbuf()->pubseekoff(-5, ios_base::cur) == fstream::pos_type(0) );
+ }
+#endif
+}
+
+void FstreamTest::rdbuf()
+{
+ fstream ss( "test_file.txt", ios_base::in | ios_base::out | ios_base::binary | ios_base::trunc );
+
+ ss << "1234567\n89\n";
+ ss.seekg( 0, ios_base::beg );
+
+ ostringstream os;
+ ss.get( *os.rdbuf(), '\n' );
+ CPPUNIT_ASSERT( !ss.fail() );
+ char c;
+ ss.get(c);
+ CPPUNIT_ASSERT( !ss.fail() );
+ CPPUNIT_ASSERT( c == '\n' ); // 27.6.1.3 paragraph 12
+ CPPUNIT_ASSERT( os.str() == "1234567" );
+}
+
+void FstreamTest::streambuf_output()
+{
+ {
+ ofstream ofstr("test_file.txt", ios_base::binary);
+ if (!ofstr)
+ //No test if we cannot create the file
+ return;
+ ofstr << "01234567890123456789";
+ CPPUNIT_ASSERT( ofstr );
+ }
+
+ {
+ ifstream in("test_file.txt", ios_base::binary);
+ CPPUNIT_ASSERT( in );
+
+ full_streambuf full_buf(10);
+ ostream out(&full_buf);
+ CPPUNIT_ASSERT( out );
+
+ out << in.rdbuf();
+ CPPUNIT_ASSERT( out );
+ CPPUNIT_ASSERT( in );
+ CPPUNIT_ASSERT( full_buf.str() == "0123456789" );
+
+ out << in.rdbuf();
+ CPPUNIT_ASSERT( out.fail() );
+ CPPUNIT_ASSERT( in );
+
+ ostringstream ostr;
+ ostr << in.rdbuf();
+ CPPUNIT_ASSERT( ostr );
+ CPPUNIT_ASSERT( in );
+ CPPUNIT_ASSERT( ostr.str() == "0123456789" );
+ }
+
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ {
+ //If the output stream buffer throws:
+ ifstream in("test_file.txt", ios_base::binary);
+ CPPUNIT_ASSERT( in );
+
+ full_streambuf full_buf(10, true);
+ ostream out(&full_buf);
+ CPPUNIT_ASSERT( out );
+
+ out << in.rdbuf();
+ CPPUNIT_ASSERT( out.bad() );
+ CPPUNIT_ASSERT( in );
+ //out is bad we have no guaranty on what has been extracted:
+ //CPPUNIT_ASSERT( full_buf.str() == "0123456789" );
+
+ out.clear();
+ out << in.rdbuf();
+ CPPUNIT_ASSERT( out.fail() && out.bad() );
+ CPPUNIT_ASSERT( in );
+
+ ostringstream ostr;
+ ostr << in.rdbuf();
+ CPPUNIT_ASSERT( ostr );
+ CPPUNIT_ASSERT( in );
+ CPPUNIT_ASSERT( ostr.str() == "0123456789" );
+ }
+# endif
+}
+
+void FstreamTest::win32_file_format()
+{
+ const char* file_name = "win32_file_format.tmp";
+ const size_t nb_lines = 2049;
+ {
+ ofstream out(file_name);
+ CPPUNIT_ASSERT( out.good() );
+ out << 'a';
+ for (size_t i = 0; i < nb_lines - 1; ++i) {
+ out << '\n';
+ }
+ out << '\r';
+ CPPUNIT_ASSERT( out.good() );
+ }
+ {
+ ifstream in(file_name);
+ CPPUNIT_ASSERT( in.good() );
+ string line, last_line;
+ size_t nb_read_lines = 0;
+ while (getline(in, line)) {
+ ++nb_read_lines;
+ last_line = line;
+ }
+ CPPUNIT_ASSERT( in.eof() );
+ CPPUNIT_ASSERT( nb_read_lines == nb_lines );
+ CPPUNIT_ASSERT( !last_line.empty() && (last_line[0] == '\r') );
+ }
+}
+
+#if defined (DO_CUSTOM_FACET_TEST)
+struct my_state {
+ char dummy;
+};
+
+struct my_traits : public char_traits<char> {
+ typedef my_state state_type;
+ typedef fpos<state_type> pos_type;
+};
+
+#if !defined (STLPORT)
+//STLport grant a default implementation, other Standard libs implementation
+//do not necessarily do the same:
+namespace std {
+ template <>
+ class codecvt<char, char, my_state>
+ : public locale::facet, public codecvt_base {
+ public:
+ typedef char intern_type;
+ typedef char extern_type;
+ typedef my_state state_type;
+
+ explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {}
+ result out(state_type&,
+ const intern_type* __from,
+ const intern_type*,
+ const intern_type*& __from_next,
+ extern_type* __to,
+ extern_type*,
+ extern_type*& __to_next) const
+ { __from_next = __from; __to_next = __to; return noconv; }
+
+ result in (state_type&,
+ const extern_type* __from,
+ const extern_type*,
+ const extern_type*& __from_next,
+ intern_type* __to,
+ intern_type*,
+ intern_type*& __to_next) const
+ { __from_next = __from; __to_next = __to; return noconv; }
+
+ result unshift(state_type&,
+ extern_type* __to,
+ extern_type*,
+ extern_type*& __to_next) const
+ { __to_next = __to; return noconv; }
+
+ int encoding() const throw()
+ { return 1; }
+
+ bool always_noconv() const throw()
+ { return true; }
+
+ int length(const state_type&,
+ const extern_type* __from,
+ const extern_type* __end,
+ size_t __max) const
+ { return (int)min(static_cast<size_t>(__end - __from), __max); }
+
+ int max_length() const throw()
+ { return 1; }
+
+ static locale::id id;
+ };
+
+ locale::id codecvt<char, char, my_state>::id;
+}
+# else
+# if defined (__BORLANDC__) && (__BORLANDC__ < 0x590)
+template <>
+locale::id codecvt<char, char, my_state>::id;
+# endif
+# endif
+#endif
+
+void FstreamTest::custom_facet()
+{
+#if defined (DO_CUSTOM_FACET_TEST)
+ const char* fileName = "test_file.txt";
+ //File preparation:
+ {
+ ofstream ofstr(fileName, ios_base::binary);
+ ofstr << "0123456789";
+ CPPUNIT_ASSERT( ofstr );
+ }
+
+ {
+ typedef basic_ifstream<char, my_traits> my_ifstream;
+ typedef basic_string<char, my_traits> my_string;
+
+ my_ifstream ifstr(fileName);
+ CPPUNIT_ASSERT( ifstr );
+
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ ifstr.imbue(locale::classic());
+ CPPUNIT_ASSERT( ifstr.fail() && !ifstr.bad() );
+ ifstr.clear();
+# endif
+ typedef codecvt<char, char, my_state> my_codecvt;
+ locale my_loc(locale::classic(), new my_codecvt());
+ // Check that my_codecvt has not replace default codecvt:
+ CPPUNIT_ASSERT( (has_facet<my_codecvt>(my_loc)) );
+ CPPUNIT_ASSERT( (has_facet<codecvt<char, char, mbstate_t> >(my_loc)) );
+# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+ CPPUNIT_ASSERT( (has_facet<codecvt<wchar_t, char, mbstate_t> >(my_loc)) );
+# endif
+ ifstr.imbue(my_loc);
+ CPPUNIT_ASSERT( ifstr.good() );
+ /*
+ my_string res;
+ ifstr >> res;
+ CPPUNIT_ASSERT( !ifstr.fail() );
+ CPPUNIT_ASSERT( !ifstr.bad() );
+ CPPUNIT_ASSERT( ifstr.eof() );
+ CPPUNIT_ASSERT( res == "0123456789" );
+ */
+ }
+#endif
+}
+
+# if defined (CHECK_BIG_FILE)
+void FstreamTest::big_file()
+{
+ vector<pair<streamsize, streamoff> > file_pos;
+
+ //Big file creation:
+ {
+ ofstream out("big_file.txt");
+ CPPUNIT_ASSERT( out );
+
+ //We are going to generate a file with the following schema for the content:
+ //0(1019 times)0000 //1023 characters + 1 charater for \n (for some platforms it will be a 1 ko line)
+ //0(1019 times)0001
+ //...
+ //0(1019 times)1234
+ //...
+
+ //Generation of the number of loop:
+ streamoff nb = 1;
+ for (int i = 0; i < 20; ++i) {
+ //This assertion check that the streamoff can at least represent the necessary integers values
+ //for this test:
+ CPPUNIT_ASSERT( (nb << 1) > nb );
+ nb <<= 1;
+ }
+ CPPUNIT_ASSERT( nb * CHECK_BIG_FILE >= nb );
+ nb *= CHECK_BIG_FILE;
+
+ //Preparation of the ouput stream state:
+ out << setiosflags(ios_base::right) << setfill('*');
+ for (streamoff index = 0; index < nb; ++index) {
+ if (index % 1024 == 0) {
+ file_pos.push_back(make_pair(out.tellp(), index));
+ CPPUNIT_ASSERT( file_pos.back().first != streamsize(-1) );
+ if (file_pos.size() > 1) {
+ CPPUNIT_ASSERT( file_pos[file_pos.size() - 1].first > file_pos[file_pos.size() - 2].first );
+ }
+ }
+ out << setw(1023) << index << '\n';
+ }
+ }
+
+ {
+ ifstream in("big_file.txt");
+ CPPUNIT_ASSERT( in );
+
+ string line;
+ vector<pair<streamsize, streamsize> >::const_iterator pit(file_pos.begin()),
+ pitEnd(file_pos.end());
+ for (; pit != pitEnd; ++pit) {
+ in.seekg((*pit).first);
+ CPPUNIT_ASSERT( in );
+ in >> line;
+ size_t lastStarPos = line.rfind('*');
+ CPPUNIT_ASSERT( atoi(line.substr(lastStarPos + 1).c_str()) == (*pit).second );
+ }
+ }
+
+ /*
+ The following test has been used to check that STLport do not generate
+ an infinite loop when the file size is larger than the streamsize and
+ streamoff representation (32 bits or 64 bits).
+ {
+ ifstream in("big_file.txt");
+ CPPUNIT_ASSERT( in );
+ char tmp[4096];
+ streamsize nb_reads = 0;
+ while ((!in.eof()) && in.good()){
+ in.read(tmp, 4096);
+ nb_reads += in.gcount();
+ }
+ }
+ */
+}
+# endif
+
+void FstreamTest::null_stream()
+{
+# if (defined (STLPORT) && defined (_STLP_USE_WIN32_IO)) || \
+ (!defined (STLPORT) && (defined (WIN32) || defined (_WIN32)))
+ const char* nullStreamName = "NUL";
+# else
+ const char* nullStreamName = "/dev/null";
+# endif
+ {
+ ofstream nullStream(nullStreamName);
+ CPPUNIT_CHECK( nullStream );
+ }
+
+ {
+ ofstream nullStream(nullStreamName, ios_base::ate);
+ CPPUNIT_CHECK( nullStream );
+ }
+
+ {
+ ofstream nullStream(nullStreamName, ios_base::trunc);
+ CPPUNIT_CHECK( nullStream );
+ }
+
+ {
+ ofstream nullStream(nullStreamName, ios_base::app);
+ CPPUNIT_CHECK( nullStream );
+ }
+
+ {
+ ifstream nullStream(nullStreamName);
+ CPPUNIT_CHECK( nullStream );
+ }
+
+ {
+ ifstream nullStream(nullStreamName, ios_base::ate);
+ CPPUNIT_CHECK( nullStream );
+ }
+
+ {
+ fstream nullStream(nullStreamName);
+ CPPUNIT_CHECK( nullStream );
+ }
+
+ {
+ fstream nullStream(nullStreamName, ios_base::in | ios_base::out | ios_base::ate);
+ CPPUNIT_CHECK( nullStream );
+ }
+
+ {
+ fstream nullStream(nullStreamName, ios_base::in | ios_base::out | ios_base::trunc);
+ CPPUNIT_CHECK( nullStream );
+ }
+}
+
+void FstreamTest::null_buf()
+{
+ /* **********************************************************************************
+
+ testcase for bug #1830513:
+ in _istream.c
+
+ template < class _CharT, class _Traits, class _Is_Delim>
+ streamsize _STLP_CALL __read_unbuffered(basic_istream<_CharT, _Traits>* __that,
+ basic_streambuf<_CharT, _Traits>* __buf,
+ streamsize _Num, _CharT* __s,
+ _Is_Delim __is_delim,
+ bool __extract_delim, bool __append_null,
+ bool __is_getline)
+
+ can't accept _Num == 0; this is legal case, and may happen from
+
+ template <class _CharT, class _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::getline(_CharT* __s, streamsize __n, _CharT __delim)
+
+ *********************************************************************************** */
+
+ fstream f( "test.txt", ios_base::in | ios_base::out | ios_base::trunc );
+ // string line;
+
+ for ( int i = 0; i < 0x200; ++i ) {
+ f.put( ' ' );
+ }
+
+ // const streambuf *b = f.rdbuf();
+
+ // string s;
+ char buf[1024];
+ buf[0] = 'a';
+ buf[1] = 'b';
+ buf[2] = 'c';
+
+ // getline( f, s );
+ // cerr << f.good() << endl;
+ f.seekg( 0, ios_base::beg );
+ // f.seekg( 0, ios_base::end );
+ // buf[0] = f.get();
+
+ // cerr << (void *)(b->_M_gptr()) << " " << (void *)(b->_M_egptr()) << endl;
+ // cerr << f.good() << endl;
+ // getline( f, s );
+ f.getline( buf, 1 ); // <-- key line
+ CPPUNIT_CHECK( buf[0] == 0 );
+ CPPUNIT_CHECK( f.fail() ); // due to delimiter not found while buffer was exhausted
+}
+
+# if !defined (STLPORT) || !defined (_STLP_WIN32)
+void FstreamTest::offset()
+{
+# if (defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE)) && !defined(_STLP_USE_DEFAULT_FILE_OFFSET)
+ CPPUNIT_CHECK( sizeof(streamoff) == 8 );
+# else
+ CPPUNIT_CHECK( sizeof(streamoff) == sizeof(off_t) );
+# endif
+}
+# endif
+
+#endif
diff --git a/test/unit/full_streambuf.h b/test/unit/full_streambuf.h
new file mode 100644
index 0000000..34766ac
--- /dev/null
+++ b/test/unit/full_streambuf.h
@@ -0,0 +1,46 @@
+#ifndef _FULL_STREAM_H
+#define _FULL_STREAM_H
+
+#include <streambuf>
+
+/*
+ * This full_streambuf purpose is to act like a full disk to check the right behavior
+ * of the STLport code in such a case.
+ */
+
+class full_streambuf : public std::streambuf {
+public:
+ typedef std::streambuf _Base;
+
+ typedef _Base::int_type int_type;
+ typedef _Base::traits_type traits_type;
+
+ full_streambuf(size_t nb_output, bool do_throw = false)
+ : _nb_output(nb_output), _do_throw(do_throw)
+ {}
+
+ std::string const& str() const
+ { return _buf; }
+
+protected:
+ int_type overflow(int_type c) {
+ if (_nb_output == 0) {
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ if (_do_throw) {
+ throw "streambuf full";
+ }
+#endif
+ return traits_type::eof();
+ }
+ --_nb_output;
+ _buf += traits_type::to_char_type(c);
+ return c;
+ }
+
+private:
+ size_t _nb_output;
+ bool _do_throw;
+ std::string _buf;
+};
+
+#endif //_FULL_STREAM_H
diff --git a/test/unit/func_test.cpp b/test/unit/func_test.cpp
new file mode 100644
index 0000000..91ad1ef
--- /dev/null
+++ b/test/unit/func_test.cpp
@@ -0,0 +1,76 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class FuncTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(FuncTest);
+ CPPUNIT_TEST(func1);
+ CPPUNIT_TEST(func2);
+ CPPUNIT_TEST(func3);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void func1();
+ void func2();
+ void func3();
+ static bool bigger(int i_);
+ static bool bigger_than(int x_, int y_);
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(FuncTest);
+
+//
+// tests implementation
+//
+bool FuncTest::bigger(int i_)
+{
+ return i_ > 3;
+}
+bool FuncTest::bigger_than(int x_, int y_)
+{
+ return x_ > y_;
+}
+void FuncTest::func1()
+{
+ vector<int>v;
+ v.push_back(4);
+ v.push_back(1);
+ v.push_back(5);
+ int n = count_if(v.begin(), v.end(), bigger);
+ CPPUNIT_ASSERT( n == 2 )
+}
+
+void FuncTest::func2()
+{
+ vector<int> v;
+ v.push_back(4);
+ v.push_back(1);
+ v.push_back(5);
+ sort(v.begin(), v.end(), bigger_than);
+
+ CPPUNIT_ASSERT( v[0] == 5 );
+ CPPUNIT_ASSERT( v[1] == 4 );
+ CPPUNIT_ASSERT( v[2] == 1 );
+}
+void FuncTest::func3()
+{
+ vector<int> v;
+ v.push_back(4);
+ v.push_back(1);
+ v.push_back(5);
+ sort(v.begin(), v.end(), greater<int>());
+
+ CPPUNIT_ASSERT( v[0] == 5 );
+ CPPUNIT_ASSERT( v[1] == 4 );
+ CPPUNIT_ASSERT( v[2] == 1 );
+}
diff --git a/test/unit/functional_header_test.cpp b/test/unit/functional_header_test.cpp
new file mode 100644
index 0000000..47bce72
--- /dev/null
+++ b/test/unit/functional_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <functional>
diff --git a/test/unit/generator_test.cpp b/test/unit/generator_test.cpp
new file mode 100644
index 0000000..70ac945
--- /dev/null
+++ b/test/unit/generator_test.cpp
@@ -0,0 +1,92 @@
+#include <vector>
+#include <algorithm>
+#include "fadapter.h"
+#include "fib.h"
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class GeneratorTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(GeneratorTest);
+ CPPUNIT_TEST(gener1);
+ CPPUNIT_TEST(gener2);
+ CPPUNIT_TEST(genern1);
+ CPPUNIT_TEST(genern2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void gener1();
+ void gener2();
+ void genern1();
+ void genern2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(GeneratorTest);
+
+//
+// tests implementation
+//
+
+static int cxxrand() { return rand();}
+
+void GeneratorTest::gener1()
+{
+ int numbers[10];
+#if defined(__MVS__)
+ generate(numbers, numbers + 10, ptr_gen(cxxrand));
+#else
+ generate(numbers, numbers + 10, cxxrand);
+#endif
+ // any suggestions?
+}
+void GeneratorTest::gener2()
+{
+ vector <int> v1(10);
+ Fibonacci generator;
+ generate(v1.begin(), v1.end(), generator);
+
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==2);
+ CPPUNIT_ASSERT(v1[3]==3);
+ CPPUNIT_ASSERT(v1[4]==5);
+ CPPUNIT_ASSERT(v1[5]==8);
+ CPPUNIT_ASSERT(v1[6]==13);
+ CPPUNIT_ASSERT(v1[7]==21);
+ CPPUNIT_ASSERT(v1[8]==34);
+ CPPUNIT_ASSERT(v1[9]==55);
+}
+void GeneratorTest::genern1()
+{
+#if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
+ //*TY 07/18/98 - added conditional
+ // since ptr_gen() is not defined under this condition
+ // (see xfunction.h)
+ vector <int> v1(10);
+ generate_n(v1.begin(), v1.size(), ptr_gen(cxxrand));
+#endif //_STLP_MEMBER_POINTER_PARAM_BUG //*TY 07/18/98 - added
+}
+void GeneratorTest::genern2()
+{
+ vector <int> v1(10);
+ Fibonacci generator;
+ generate_n(v1.begin(), v1.size(), generator);
+
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==2);
+ CPPUNIT_ASSERT(v1[3]==3);
+ CPPUNIT_ASSERT(v1[4]==5);
+ CPPUNIT_ASSERT(v1[5]==8);
+ CPPUNIT_ASSERT(v1[6]==13);
+ CPPUNIT_ASSERT(v1[7]==21);
+ CPPUNIT_ASSERT(v1[8]==34);
+ CPPUNIT_ASSERT(v1[9]==55);
+}
diff --git a/test/unit/greater_test.cpp b/test/unit/greater_test.cpp
new file mode 100644
index 0000000..a3b8585
--- /dev/null
+++ b/test/unit/greater_test.cpp
@@ -0,0 +1,49 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class GreaterTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(GreaterTest);
+ CPPUNIT_TEST(greatert);
+ CPPUNIT_TEST(greatereq);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void greatert();
+ void greatereq();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(GreaterTest);
+
+//
+// tests implementation
+//
+void GreaterTest::greatert()
+{
+ int array[4] = { 3, 1, 4, 2 };
+ sort(array, array + 4, greater<int>() );
+
+ CPPUNIT_ASSERT(array[0]==4);
+ CPPUNIT_ASSERT(array[1]==3);
+ CPPUNIT_ASSERT(array[2]==2);
+ CPPUNIT_ASSERT(array[3]==1);
+}
+void GreaterTest::greatereq()
+{
+ int array [4] = { 3, 1, 4, 2 };
+ sort(array, array + 4, greater_equal<int>());
+ CPPUNIT_ASSERT(array[0]==4);
+ CPPUNIT_ASSERT(array[1]==3);
+ CPPUNIT_ASSERT(array[2]==2);
+ CPPUNIT_ASSERT(array[3]==1);
+}
diff --git a/test/unit/hash_test.cpp b/test/unit/hash_test.cpp
new file mode 100644
index 0000000..4ea913e
--- /dev/null
+++ b/test/unit/hash_test.cpp
@@ -0,0 +1,434 @@
+//Has to be first for StackAllocator swap overload to be taken
+//into account (at least using GCC 4.0.1)
+#include "stack_allocator.h"
+
+#include <vector>
+#include <algorithm>
+#include <map>
+#include <set>
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+# include <hash_map>
+# include <hash_set>
+# include <rope>
+#endif
+
+#include <string>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if defined (__MVS__)
+const char star = 92;
+#else
+const char star = 42;
+#endif
+
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class HashTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(HashTest);
+#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(hmap1);
+ CPPUNIT_TEST(hmmap1);
+ CPPUNIT_TEST(hmmap2);
+ CPPUNIT_TEST(hmset1);
+ CPPUNIT_TEST(hset2);
+ CPPUNIT_TEST(insert_erase);
+ CPPUNIT_TEST(allocator_with_state);
+ //CPPUNIT_TEST(equality);
+ CPPUNIT_TEST_SUITE_END();
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ typedef hash_multiset<char, hash<char>, equal_to<char> > hmset;
+#endif
+
+protected:
+ void hmap1();
+ void hmmap1();
+ void hmmap2();
+ void hmset1();
+ void hset2();
+ void insert_erase();
+ //void equality();
+ void allocator_with_state();
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ typedef hash_multimap<int, int> hashType;
+ typedef multimap<int, int> mapType;
+
+ void check_keys( hashType& h, mapType& m );
+#endif
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(HashTest);
+
+//
+// tests implementation
+//
+void HashTest::hmap1()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ typedef hash_map<char, crope, hash<char>, equal_to<char> > maptype;
+ maptype m;
+ // Store mappings between roman numerals and decimals.
+ m['l'] = "50";
+ m['x'] = "20"; // Deliberate mistake.
+ m['v'] = "5";
+ m['i'] = "1";
+ CPPUNIT_ASSERT( !strcmp(m['x'].c_str(),"20") );
+ m['x'] = "10"; // Correct mistake.
+ CPPUNIT_ASSERT( !strcmp(m['x'].c_str(),"10") );
+
+ CPPUNIT_ASSERT( !strcmp(m['z'].c_str(),"") );
+
+ CPPUNIT_ASSERT( m.count('z')==1 );
+ pair<maptype::iterator, bool> p = m.insert(pair<const char, crope>('c', crope("100")));
+
+ CPPUNIT_ASSERT(p.second);
+
+ p = m.insert(pair<const char, crope>('c', crope("100")));
+ CPPUNIT_ASSERT(!p.second);
+
+ //Some iterators compare check, really compile time checks
+ maptype::iterator ite(m.begin());
+ maptype::const_iterator cite(m.begin());
+ cite = m.begin();
+ maptype const& cm = m;
+ cite = cm.begin();
+ CPPUNIT_ASSERT( ite == cite );
+ CPPUNIT_ASSERT( !(ite != cite) );
+ CPPUNIT_ASSERT( cite == ite );
+ CPPUNIT_ASSERT( !(cite != ite) );
+#endif
+}
+
+void HashTest::hmmap1()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ typedef hash_multimap<char, int, hash<char>,equal_to<char> > mmap;
+ mmap m;
+ CPPUNIT_ASSERT(m.count('X')==0);
+ m.insert(pair<const char,int>('X', 10)); // Standard way.
+ CPPUNIT_ASSERT(m.count('X')==1);
+// m.insert('X', 20); // Non-standard, but very convenient!
+ m.insert(pair<const char,int>('X', 20)); // jbuck: standard way
+ CPPUNIT_ASSERT(m.count('X')==2);
+// m.insert('Y', 32);
+ m.insert(pair<const char,int>('Y', 32)); // jbuck: standard way
+ mmap::iterator i = m.find('X'); // Find first match.
+
+ CPPUNIT_ASSERT((*i).first=='X');
+ CPPUNIT_ASSERT((*i).second==10);
+ i++;
+ CPPUNIT_ASSERT((*i).first=='X');
+ CPPUNIT_ASSERT((*i).second==20);
+ i++;
+ CPPUNIT_ASSERT((*i).first=='Y');
+ CPPUNIT_ASSERT((*i).second==32);
+ i++;
+ CPPUNIT_ASSERT(i==m.end());
+
+ size_t count = m.erase('X');
+ CPPUNIT_ASSERT(count==2);
+
+ //Some iterators compare check, really compile time checks
+ mmap::iterator ite(m.begin());
+ mmap::const_iterator cite(m.begin());
+ CPPUNIT_ASSERT( ite == cite );
+ CPPUNIT_ASSERT( !(ite != cite) );
+ CPPUNIT_ASSERT( cite == ite );
+ CPPUNIT_ASSERT( !(cite != ite) );
+
+ typedef hash_multimap<size_t, size_t> HMapType;
+ HMapType hmap;
+
+ //We fill the map to implicitely start a rehash.
+ for (size_t counter = 0; counter < 3077; ++counter)
+ hmap.insert(HMapType::value_type(1, counter));
+
+ hmap.insert(HMapType::value_type(12325, 1));
+ hmap.insert(HMapType::value_type(12325, 2));
+
+ CPPUNIT_ASSERT( hmap.count(12325) == 2 );
+
+ //At this point 23 goes to the same bucket as 12325, it used to reveal a bug.
+ hmap.insert(HMapType::value_type(23, 0));
+
+ CPPUNIT_ASSERT( hmap.count(12325) == 2 );
+#endif
+}
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+// Short demonstrator that helps reproducing a bug in the hash-table implementation
+// of STLPort 5.0.1/5.0.2.
+//
+// Problem: Fill a hash_multimap with entries of which many have the same key
+// Internally, entries with the same key are kept as one block within the same bucket.
+// Thus, when calling equal_range(key) the begin/end of that block is returned.
+// However, this code shows that for key =3, that block is destroyed after inserting the 194th element.
+// According to _hashtable.c we will have a rehash from size 193 to size 389 in that situation.
+// After that rehash, equal_range only returns 2 elements with key = 3 whereas there are 65 in it.
+// Reproduction:
+// In the main()-method we fill a hash_multimap as well as a multi_map with the same <key, data> pairs
+// After each insertion we call check_keys(...) to assure validity of these two containers.
+// This works fine up to the 193th insertion. Insertion 194 generates the bug.
+//
+// check_keys() works as follows:
+// (a) we check whether both containers contain the same number of elements.
+// (b) Assuming that the multi_map works correctly, we iterate over all its elements and check
+// whether we can find that key also in the hash_multimap. We collect all data for that specific
+// key in in a set ("collection"). Notice that data is unique by construction in main(), thus the
+// number of elements in the set must equal the number of entries in the hash_multimap and in the multimap
+// (c) We check if we have seen as many data elements in collection as we have seen in the multimap.
+// if so, we print "OK", otherwise we print a detailed key/data overview and assert.
+// Caution:
+// There are several configurations of the program that will NOT fail. (see comment in code below)
+// E.g. it seems that whenever the keys are more or less sorted, the problem does not occur.
+// Also, using numbers from 200 downto 1 or from 300 downto 1 cannot generate the problem,
+// whereas using 400 downto 1 will fail.
+// Finally, if we use key 1 (rather than key 3) we cannot generate a problem.
+
+void HashTest::check_keys( HashTest::hashType& h, HashTest::mapType& m )
+{
+ set<int> collection;
+
+ // (a) check sizes
+ CPPUNIT_CHECK( h.size() == m.size() );
+
+ // (b) iterate over multi_map
+ for ( mapType::iterator i = m.begin(); i != m.end(); ++i ) {
+ // look up that key in hash-table and keep all data in the set
+ pair<hashType::iterator,hashType::iterator> range = h.equal_range( i->first );
+ for ( hashType::iterator j = range.first; j != range.second; ++j ) {
+ collection.insert( j->second );
+ }
+ }
+ // (c) we should have seen as many elements as there are in the hash-table
+#if 0
+ if (collection.size() == h.size()) cout << " OK" << endl;
+ else {
+ // if not, please report
+ cout << " FAILED: " << endl;
+ int lastKey = -1;
+ // iterate over all elements in multi_map
+ for (mapType::iterator mIter = m.begin(); mIter != m.end(); mIter++) {
+ // new key? print a new status line
+ if (mIter->first != lastKey) {
+ cout << endl << "Key : " << mIter->first << endl;
+ lastKey = mIter->first;
+
+ // print all hashed values for that key
+ cout << " data in hash: ";
+ pair<hashType::iterator,hashType::iterator> range = h.equal_range(mIter->first);
+
+ for (hashType::iterator h = range.first; h != range.second; h++) {
+ assert (h->first == lastKey);
+ cerr << h->second << ", "; // print all data for that key in Hash-Table
+ }
+ cout << endl << " data in map: ";
+ }
+ // and print all member in multi-map until the next key occurs
+ cout << mIter->second << ", " ; // print all data for that key in Map
+ }
+ }
+#endif
+ CPPUNIT_CHECK( collection.size() == h.size() );
+}
+
+#endif
+
+void HashTest::hmmap2()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ hashType h;
+ mapType m;
+
+ // CAUTION the following configurations WORKS in our setting
+ // for (int id = 1; id != 400; id ++) and int key = (id %3 == 0 ? 3 : id)
+ // for (int id = 200; id != 1; id --) and int key = (id %3 == 0 ? 3 : id)
+ // for (int id = 300; id != 1; id --) and int key = (id %3 == 0 ? 3 : id)
+ // for (int id = 400; id != 1; id --) and int key = (id %3 == 0 ? 1 : id)
+ // for (int id = 4000; id != 1; id --) and int key = (id %3 == 0 ? 1 : id)
+ //
+ // whereas these will FAIL
+ // for (int id = 400; id != 1; id --) and int key = (id %3 == 0 ? 3 : id)
+ // for (int id = 4000; id != 1; id --) and int key = (id %3 == 0 ? 3 : id)
+ //
+
+ for ( int id = 400; id != 1; id-- ) {
+ // generate many entries with key 3, fill up with unique keys. Data is unique (needed in check_keys())
+ int key = (id % 3 == 0 ? 3 : id);
+
+ // keep hash_multi_map and multimap in sync
+ h.insert(make_pair(key, id));
+ m.insert(make_pair(key, id));
+
+ // check whether both contain the same elements
+ check_keys( h, m );
+ }
+#endif
+}
+
+void HashTest::hmset1()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ hmset s;
+ CPPUNIT_ASSERT( s.count(star) == 0 );
+ s.insert(star);
+ CPPUNIT_ASSERT( s.count(star) == 1 );
+ s.insert(star);
+ CPPUNIT_ASSERT( s.count(star) == 2 );
+ hmset::iterator i = s.find(char(40));
+ CPPUNIT_ASSERT( i == s.end() );
+
+ i = s.find(star);
+ CPPUNIT_ASSERT( i != s.end() )
+ CPPUNIT_ASSERT( *i == '*' );
+ CPPUNIT_ASSERT( s.erase(star) == 2 );
+#endif
+}
+void HashTest::hset2()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ hash_set<int, hash<int>, equal_to<int> > s;
+ pair<hash_set<int, hash<int>, equal_to<int> >::iterator, bool> p = s.insert(42);
+ CPPUNIT_ASSERT( p.second );
+ CPPUNIT_ASSERT( *(p.first) == 42 );
+
+ p = s.insert(42);
+ CPPUNIT_ASSERT( !p.second );
+#endif
+}
+
+void HashTest::insert_erase()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ typedef hash_map<string, size_t, hash<string>, equal_to<string> > hmap;
+ typedef hmap::value_type val_type;
+ {
+ hmap values;
+# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x564)
+ CPPUNIT_ASSERT( values.insert(val_type("foo", 0)).second );
+ CPPUNIT_ASSERT( values.insert(val_type("bar", 0)).second );
+ CPPUNIT_ASSERT( values.insert(val_type("abc", 0)).second );
+# else
+ CPPUNIT_ASSERT( values.insert(hmap::value_type("foo", 0)).second );
+ CPPUNIT_ASSERT( values.insert(hmap::value_type("bar", 0)).second );
+ CPPUNIT_ASSERT( values.insert(hmap::value_type("abc", 0)).second );
+# endif
+
+ CPPUNIT_ASSERT( values.erase("foo") == 1 );
+ CPPUNIT_ASSERT( values.erase("bar") == 1 );
+ CPPUNIT_ASSERT( values.erase("abc") == 1 );
+ }
+
+ {
+ hmap values;
+# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x564)
+ CPPUNIT_ASSERT( values.insert(val_type("foo", 0)).second );
+ CPPUNIT_ASSERT( values.insert(val_type("bar", 0)).second );
+ CPPUNIT_ASSERT( values.insert(val_type("abc", 0)).second );
+# else
+ CPPUNIT_ASSERT( values.insert(hmap::value_type("foo", 0)).second );
+ CPPUNIT_ASSERT( values.insert(hmap::value_type("bar", 0)).second );
+ CPPUNIT_ASSERT( values.insert(hmap::value_type("abc", 0)).second );
+# endif
+
+ CPPUNIT_ASSERT( values.erase("abc") == 1 );
+ CPPUNIT_ASSERT( values.erase("bar") == 1 );
+ CPPUNIT_ASSERT( values.erase("foo") == 1 );
+ }
+#endif
+}
+
+/*
+ * Here is the test showing why equality operator on hash containers
+ * has no meaning:
+
+struct equality_hash_func {
+ size_t operator () (size_t val) const {
+ return val % 10;
+ }
+};
+
+void HashTest::equality()
+{
+ hash_set<size_t, equality_hash_func, equal_to<size_t> > s1, s2;
+
+ s1.insert(10);
+ s1.insert(20);
+
+ s2.insert(20);
+ s2.insert(10);
+
+ //s1 and s2 contains both 10 and 20:
+ CPPUNIT_ASSERT( s1 == s2 );
+}
+*/
+
+void HashTest::allocator_with_state()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ char buf1[2048];
+ StackAllocator<int> stack1(buf1, buf1 + sizeof(buf1));
+
+ char buf2[2048];
+ StackAllocator<int> stack2(buf2, buf2 + sizeof(buf2));
+
+ {
+ typedef hash_set<int, hash<int>, equal_to<int>, StackAllocator<int> > HashSetInt;
+ HashSetInt hint1(10, hash<int>(), equal_to<int>(), stack1);
+
+ int i;
+ for (i = 0; i < 5; ++i)
+ hint1.insert(i);
+ HashSetInt hint1Cpy(hint1);
+
+ HashSetInt hint2(10, hash<int>(), equal_to<int>(), stack2);
+ for (; i < 10; ++i)
+ hint2.insert(i);
+ HashSetInt hint2Cpy(hint2);
+
+ hint1.swap(hint2);
+
+ CPPUNIT_ASSERT( hint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( hint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( hint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( hint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_ASSERT( stack1.ok() );
+ CPPUNIT_ASSERT( stack2.ok() );
+#endif
+}
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) && \
+ (!defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION))
+# if !defined (__DMC__)
+
+/* Simple compilation test: Check that nested types like iterator
+ * can be access even if type used to instanciate container is not
+ * yet completely defined.
+ */
+class IncompleteClass
+{
+ hash_set<IncompleteClass> hsinstances;
+ typedef hash_set<IncompleteClass>::iterator hsit;
+ hash_multiset<IncompleteClass> hsminstances;
+ typedef hash_multiset<IncompleteClass>::iterator hsmit;
+
+ hash_map<IncompleteClass, IncompleteClass> hminstances;
+ typedef hash_map<IncompleteClass, IncompleteClass>::iterator hmit;
+ hash_multimap<IncompleteClass, IncompleteClass> hmminstances;
+ typedef hash_multimap<IncompleteClass, IncompleteClass>::iterator hmmit;
+};
+# endif
+#endif
diff --git a/test/unit/heap_test.cpp b/test/unit/heap_test.cpp
new file mode 100644
index 0000000..87eb75d
--- /dev/null
+++ b/test/unit/heap_test.cpp
@@ -0,0 +1,108 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class HeapTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(HeapTest);
+ CPPUNIT_TEST(mkheap0);
+ CPPUNIT_TEST(mkheap1);
+ CPPUNIT_TEST(pheap1);
+ CPPUNIT_TEST(pheap2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void mkheap0();
+ void mkheap1();
+ void pheap1();
+ void pheap2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(HeapTest);
+
+//
+// tests implementation
+//
+void HeapTest::mkheap0()
+{
+ int numbers[6] = { 5, 10, 4, 13, 11, 19 };
+
+ make_heap(numbers, numbers + 6);
+ CPPUNIT_ASSERT(numbers[0]==19)
+ pop_heap(numbers, numbers + 6);
+ CPPUNIT_ASSERT(numbers[0]==13)
+ pop_heap(numbers, numbers + 5);
+ CPPUNIT_ASSERT(numbers[0]==11)
+ pop_heap(numbers, numbers + 4);
+ CPPUNIT_ASSERT(numbers[0]==10)
+ pop_heap(numbers, numbers + 3);
+ CPPUNIT_ASSERT(numbers[0]==5)
+ pop_heap(numbers, numbers + 2);
+ CPPUNIT_ASSERT(numbers[0]==4)
+ pop_heap(numbers, numbers + 1);
+}
+void HeapTest::mkheap1()
+{
+ int numbers[6] = { 5, 10, 4, 13, 11, 19 };
+
+ make_heap(numbers, numbers + 6, greater<int>());
+
+ CPPUNIT_ASSERT(numbers[0]==4)
+ pop_heap(numbers, numbers + 6, greater<int>());
+ CPPUNIT_ASSERT(numbers[0]==5)
+ pop_heap(numbers, numbers + 5, greater<int>());
+ CPPUNIT_ASSERT(numbers[0]==10)
+ pop_heap(numbers, numbers + 4, greater<int>());
+ CPPUNIT_ASSERT(numbers[0]==11)
+ pop_heap(numbers, numbers + 3, greater<int>());
+ CPPUNIT_ASSERT(numbers[0]==13)
+ pop_heap(numbers, numbers + 2, greater<int>());
+ CPPUNIT_ASSERT(numbers[0]==19)
+}
+void HeapTest::pheap1()
+{
+ vector<int> v;
+
+ v.push_back(1);
+ v.push_back(20);
+ v.push_back(4);
+ make_heap(v.begin(), v.end());
+
+ v.push_back(7);
+ push_heap(v.begin(), v.end());
+
+ sort_heap(v.begin(), v.end());
+
+ CPPUNIT_ASSERT(v[0]==1);
+ CPPUNIT_ASSERT(v[1]==4);
+ CPPUNIT_ASSERT(v[2]==7);
+ CPPUNIT_ASSERT(v[3]==20);
+}
+void HeapTest::pheap2()
+{
+ vector<int> v;
+
+ v.push_back(1);
+ v.push_back(20);
+ v.push_back(4);
+ make_heap(v.begin(), v.end(), greater<int>());
+
+ v.push_back(7);
+ push_heap(v.begin(), v.end(), greater<int>());
+
+ sort_heap(v.begin(), v.end(), greater<int>());
+
+ CPPUNIT_ASSERT(v[0]==20);
+ CPPUNIT_ASSERT(v[1]==7);
+ CPPUNIT_ASSERT(v[2]==4);
+ CPPUNIT_ASSERT(v[3]==1);
+}
diff --git a/test/unit/includes_test.cpp b/test/unit/includes_test.cpp
new file mode 100644
index 0000000..d641797
--- /dev/null
+++ b/test/unit/includes_test.cpp
@@ -0,0 +1,87 @@
+#include <cstring>
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class IncludesTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(IncludesTest);
+ CPPUNIT_TEST(incl0);
+ CPPUNIT_TEST(incl1);
+ CPPUNIT_TEST(incl2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void incl0();
+ void incl1();
+ void incl2();
+
+ static bool compare_strings(const char* s1_, const char* s2_)
+ {
+ return strcmp(s1_, s2_) < 0 ? 1 : 0;
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(IncludesTest);
+
+//
+// tests implementation
+//
+void IncludesTest::incl0()
+{
+ int numbers1[5] = { 1, 2, 3, 4, 5 };
+ //int numbers2[5] = { 1, 2, 4, 8, 16 };
+ int numbers3[2] = { 4, 8 };
+ bool r1=includes(numbers1, numbers1 + 5, numbers3, numbers3 + 2);
+ CPPUNIT_ASSERT(!r1);
+}
+void IncludesTest::incl1()
+{
+ vector<int> v1(10);
+ vector<int> v2(3);
+ int i;
+ for (i = 0; (size_t)i < v1.size(); ++i) {
+ v1[i] = i;
+ }
+
+ bool r1=includes(v1.begin(), v1.end(), v2.begin(), v2.end());
+ CPPUNIT_ASSERT(!r1);
+
+ for (i = 0; (size_t)i < v2.size(); ++i)
+ v2[i] = i + 3;
+
+ bool r2=includes(v1.begin(), v1.end(), v2.begin(), v2.end());
+ CPPUNIT_ASSERT(r2);
+}
+void IncludesTest::incl2()
+{
+ char const* names[] = { "Todd", "Mike", "Graham", "Jack", "Brett"};
+
+ const unsigned nameSize = sizeof(names)/sizeof(names[0]);
+ vector <char const*> v1(nameSize);
+ for (int i = 0; (size_t)i < v1.size(); ++i) {
+ v1[i] = names[i];
+ }
+ vector <char const*> v2(2);
+
+ v2[0] = "foo";
+ v2[1] = "bar";
+ sort(v1.begin(), v1.end(), compare_strings);
+ sort(v2.begin(), v2.end(), compare_strings);
+
+ bool r1 = includes(v1.begin(), v1.end(), v2.begin(), v2.end(), compare_strings);
+ CPPUNIT_ASSERT(!r1);
+
+ v2[0] = "Brett";
+ v2[1] = "Todd";
+ bool r2 = includes(v1.begin(), v1.end(), v2.begin(), v2.end(), compare_strings);
+ CPPUNIT_ASSERT(r2);
+}
diff --git a/test/unit/innerprod_test.cpp b/test/unit/innerprod_test.cpp
new file mode 100644
index 0000000..3d77f5d
--- /dev/null
+++ b/test/unit/innerprod_test.cpp
@@ -0,0 +1,72 @@
+#include <vector>
+#include <algorithm>
+#include <numeric>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class InnerprodTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(InnerprodTest);
+ CPPUNIT_TEST(inprod0);
+ CPPUNIT_TEST(inprod1);
+ CPPUNIT_TEST(inprod2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void inprod0();
+ void inprod1();
+ void inprod2();
+
+ static size_t add(size_t a_, size_t b_) {
+ return a_ + b_;
+ }
+
+ static size_t mult(size_t a_, size_t b_) {
+ return a_ * b_;
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(InnerprodTest);
+
+//
+// tests implementation
+//
+void InnerprodTest::inprod0()
+{
+ int vector1[5] = { 1, 2, 3, 4, 5 };
+ int vector2[5] = { 1, 2, 3, 4, 5 };
+
+ int result;
+ result = inner_product(vector1, vector1 + 5, vector2, 0);
+ CPPUNIT_ASSERT(result==55);
+}
+void InnerprodTest::inprod1()
+{
+ vector<size_t> v1(3);
+ vector<size_t> v2(v1.size());
+ for (size_t i = 0; i < v1.size(); ++i) {
+ v1[i] = i + 1;
+ v2[i] = v1.size() - i;
+ }
+ size_t result = inner_product(v1.begin(), v1.end(), v2.begin(), (size_t)0);
+ CPPUNIT_ASSERT(result == 10);
+}
+void InnerprodTest::inprod2()
+{
+ vector<size_t> v1(3);
+ vector<size_t> v2(v1.size());
+ for(size_t i = 0; i < v1.size(); ++i) {
+ v1[i] = i + 1;
+ v2[i] = v1.size() - i;
+ }
+ size_t result=inner_product(v1.begin(), v1.end(), v2.begin(), (size_t)1, mult, add);
+
+ CPPUNIT_ASSERT(result == 64);
+}
diff --git a/test/unit/inplace_test.cpp b/test/unit/inplace_test.cpp
new file mode 100644
index 0000000..2c9bd99
--- /dev/null
+++ b/test/unit/inplace_test.cpp
@@ -0,0 +1,61 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class InplaceTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(InplaceTest);
+ CPPUNIT_TEST(inplmrg1);
+ CPPUNIT_TEST(inplmrg2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void inplmrg1();
+ void inplmrg2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(InplaceTest);
+
+//
+// tests implementation
+//
+void InplaceTest::inplmrg1()
+{
+ int numbers[6] = { 1, 10, 42, 3, 16, 32 };
+ inplace_merge(numbers, numbers + 3, numbers + 6);
+
+ CPPUNIT_ASSERT(numbers[0]==1);
+ CPPUNIT_ASSERT(numbers[1]==3);
+ CPPUNIT_ASSERT(numbers[2]==10);
+ CPPUNIT_ASSERT(numbers[3]==16);
+ CPPUNIT_ASSERT(numbers[4]==32);
+ CPPUNIT_ASSERT(numbers[5]==42);
+}
+void InplaceTest::inplmrg2()
+{
+ vector<size_t> v1(10);
+ for(size_t i = 0; i < v1.size(); ++i)
+ v1[i] =(v1.size() - i - 1) % 5;
+
+ inplace_merge(v1.begin(), v1.begin() + 5, v1.end(), greater<size_t>());
+
+ CPPUNIT_ASSERT(v1[0]==4);
+ CPPUNIT_ASSERT(v1[1]==4);
+ CPPUNIT_ASSERT(v1[2]==3);
+ CPPUNIT_ASSERT(v1[3]==3);
+ CPPUNIT_ASSERT(v1[4]==2);
+ CPPUNIT_ASSERT(v1[5]==2);
+ CPPUNIT_ASSERT(v1[6]==1);
+ CPPUNIT_ASSERT(v1[7]==1);
+ CPPUNIT_ASSERT(v1[8]==0);
+ CPPUNIT_ASSERT(v1[9]==0);
+}
diff --git a/test/unit/insert_test.cpp b/test/unit/insert_test.cpp
new file mode 100644
index 0000000..e0ec1a2
--- /dev/null
+++ b/test/unit/insert_test.cpp
@@ -0,0 +1,70 @@
+#include <deque>
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class InsertTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(InsertTest);
+ CPPUNIT_TEST(insert1);
+ CPPUNIT_TEST(insert2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void insert1();
+ void insert2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(InsertTest);
+
+//
+// tests implementation
+//
+void InsertTest::insert1()
+{
+ char const* array1 [] = { "laurie", "jennifer", "leisa" };
+ char const* array2 [] = { "amanda", "saskia", "carrie" };
+
+ deque<char const*> names(array1, array1 + 3);
+ deque<char const*>::iterator i = names.begin() + 2;
+
+ insert_iterator<deque <char const*> > itd(names, i);
+ itd = copy(array2, array2 + 3, insert_iterator<deque <char const*> >(names, i));
+
+ CPPUNIT_ASSERT( !strcmp(names[0], "laurie") );
+ CPPUNIT_ASSERT( !strcmp(names[1], "jennifer") );
+ CPPUNIT_ASSERT( !strcmp(names[2], "amanda") );
+ CPPUNIT_ASSERT( !strcmp(names[3], "saskia") );
+ CPPUNIT_ASSERT( !strcmp(names[4], "carrie") );
+ CPPUNIT_ASSERT( !strcmp(names[5], "leisa") );
+
+ copy(array1, array1 + 3, itd);
+ CPPUNIT_ASSERT( !strcmp(names[5], "laurie") );
+ CPPUNIT_ASSERT( !strcmp(names[6], "jennifer") );
+ CPPUNIT_ASSERT( !strcmp(names[7], "leisa") );
+ CPPUNIT_ASSERT( !strcmp(names[8], "leisa") );
+}
+void InsertTest::insert2()
+{
+ char const* array1 [] = { "laurie", "jennifer", "leisa" };
+ char const* array2 [] = { "amanda", "saskia", "carrie" };
+
+ deque<char const*> names(array1, array1 + 3);
+ deque<char const*>::iterator i = names.begin() + 2;
+ copy(array2, array2 + 3, inserter(names, i));
+
+ CPPUNIT_ASSERT( !strcmp(names[0], "laurie") );
+ CPPUNIT_ASSERT( !strcmp(names[1], "jennifer") );
+ CPPUNIT_ASSERT( !strcmp(names[2], "amanda") );
+ CPPUNIT_ASSERT( !strcmp(names[3], "saskia") );
+ CPPUNIT_ASSERT( !strcmp(names[4], "carrie") );
+ CPPUNIT_ASSERT( !strcmp(names[5], "leisa") );
+}
diff --git a/test/unit/ioiter_test.cpp b/test/unit/ioiter_test.cpp
new file mode 100644
index 0000000..6f0aeb9
--- /dev/null
+++ b/test/unit/ioiter_test.cpp
@@ -0,0 +1,110 @@
+#include <string>
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+#include <sstream>
+#include <vector>
+#include <iterator>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+class IoiterTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(IoiterTest);
+ CPPUNIT_TEST(ioiter_test);
+ CPPUNIT_TEST(assign_test);
+ CPPUNIT_TEST(assign2_test);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void ioiter_test();
+ void assign_test();
+ void assign2_test();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(IoiterTest);
+
+void IoiterTest::ioiter_test()
+{
+
+ char c;
+ const char *pc;
+ const char *strorg = "abcd";
+ string tmp;
+
+ string objStr(strorg);
+
+ istringstream objIStrStrm1(objStr);
+ istringstream objIStrStrm2(objStr);
+ istringstream objIStrStrm3(objStr);
+
+ pc = strorg;
+ string::size_type sz = strlen(strorg);
+ string::size_type i;
+ for ( i = 0; i < sz; ++i ) {
+ c = *pc++;
+ tmp += c;
+ }
+ CPPUNIT_ASSERT( tmp == "abcd" );
+
+ istreambuf_iterator<char, char_traits<char> > objIStrmbIt1( objIStrStrm1.rdbuf() );
+ istreambuf_iterator<char, char_traits<char> > end;
+
+ tmp.clear();
+
+ for ( i = 0; i < sz /* objIStrmbIt1 != end */; ++i ) {
+ c = *objIStrmbIt1++;
+ tmp += c;
+ }
+ CPPUNIT_ASSERT( tmp == "abcd" );
+
+ tmp.clear();
+
+ istreambuf_iterator<char, char_traits<char> > objIStrmbIt2( objIStrStrm2.rdbuf() );
+ for ( i = 0; i < sz; ++i ) {
+ c = *objIStrmbIt2;
+ tmp += c;
+ objIStrmbIt2++;
+ }
+ CPPUNIT_ASSERT( tmp == "abcd" );
+
+ tmp.clear();
+
+ istreambuf_iterator<char, char_traits<char> > objIStrmbIt3( objIStrStrm3.rdbuf() );
+
+ while ( objIStrmbIt3 != end ) {
+ c = *objIStrmbIt3++;
+ tmp += c;
+ }
+ CPPUNIT_ASSERT( tmp == "abcd" );
+}
+
+void IoiterTest::assign_test()
+{
+ stringstream s( "1234567890" );
+ vector<char> v;
+
+ v.assign( istreambuf_iterator<char>(s), istreambuf_iterator<char>() );
+ CPPUNIT_CHECK( v.size() == 10 );
+ if ( v.size() == 10 ) {
+ CPPUNIT_CHECK( v[0] == '1' );
+ CPPUNIT_CHECK( v[9] == '0' );
+ }
+}
+
+void IoiterTest::assign2_test()
+{
+ stringstream s( "1234567890" );
+ vector<char> v;
+
+ v.assign( istreambuf_iterator<char>(s.rdbuf()), istreambuf_iterator<char>() );
+ CPPUNIT_CHECK( v.size() == 10 );
+ if ( v.size() == 10 ) {
+ CPPUNIT_CHECK( v[0] == '1' );
+ CPPUNIT_CHECK( v[9] == '0' );
+ }
+}
+
+#endif
diff --git a/test/unit/iomanip_header_test.cpp b/test/unit/iomanip_header_test.cpp
new file mode 100644
index 0000000..fa0ab0f
--- /dev/null
+++ b/test/unit/iomanip_header_test.cpp
@@ -0,0 +1,10 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#if !defined (_STLP_NO_IOSTREAMS)
+# include <iomanip>
+#endif
diff --git a/test/unit/ios_header_test.cpp b/test/unit/ios_header_test.cpp
new file mode 100644
index 0000000..c239643
--- /dev/null
+++ b/test/unit/ios_header_test.cpp
@@ -0,0 +1,10 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#if !defined (_STLP_NO_IOSTREAMS)
+# include <ios>
+#endif
diff --git a/test/unit/iosfwd_header_test.cpp b/test/unit/iosfwd_header_test.cpp
new file mode 100644
index 0000000..8c3adcc
--- /dev/null
+++ b/test/unit/iosfwd_header_test.cpp
@@ -0,0 +1,10 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#ifndef _STLP_NO_IOSTREAMS
+# include <iosfwd>
+#endif
diff --git a/test/unit/iostream_header_test.cpp b/test/unit/iostream_header_test.cpp
new file mode 100644
index 0000000..51e6df6
--- /dev/null
+++ b/test/unit/iostream_header_test.cpp
@@ -0,0 +1,10 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#if !defined (_STLP_NO_IOSTREAMS)
+# include <iostream>
+#endif
diff --git a/test/unit/iostream_test.cpp b/test/unit/iostream_test.cpp
new file mode 100644
index 0000000..a4db5d8
--- /dev/null
+++ b/test/unit/iostream_test.cpp
@@ -0,0 +1,116 @@
+#include <string>
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <sstream>
+//# include <locale>
+# include <iostream>
+//# include <stdexcept>
+
+# include "cppunit/cppunit_proxy.h"
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+//
+// TestCase class
+//
+class IOStreamTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(IOStreamTest);
+ CPPUNIT_TEST(manipulators);
+ CPPUNIT_TEST(in_avail);
+//#if defined (STLPORT) && defined (_STLP_NO_WCHAR_T)
+ //CPPUNIT_IGNORE;
+//#endif
+ //CPPUNIT_TEST(wimbue);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ void manipulators();
+ void in_avail();
+ //void wimbue();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(IOStreamTest);
+
+//
+// tests implementation
+//
+void IOStreamTest::manipulators()
+{
+ {
+ istringstream istr;
+ istr.str("bar");
+
+ istr >> ws;
+ CPPUNIT_ASSERT( istr.good() );
+
+ string foo;
+ istr >> foo;
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( !istr.fail() );
+ CPPUNIT_ASSERT( foo == "bar" );
+
+ istr >> ws;
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( !istr.fail() );
+ istr.clear();
+ }
+
+ {
+ istringstream istr;
+ istr.str(" bar ");
+
+ istr >> ws;
+ CPPUNIT_ASSERT( istr.good() );
+
+ string foo;
+ istr >> foo;
+ CPPUNIT_ASSERT( !istr.eof() );
+ CPPUNIT_ASSERT( !istr.fail() );
+ CPPUNIT_ASSERT( foo == "bar" );
+
+ istr >> ws;
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( !istr.fail() );
+ istr.clear();
+ }
+}
+
+
+void IOStreamTest::in_avail()
+{
+ CPPUNIT_CHECK( cin.rdbuf()->in_avail() == 0 );
+ CPPUNIT_CHECK( cout.rdbuf()->in_avail() == -1 );
+ CPPUNIT_CHECK( clog.rdbuf()->in_avail() == -1 );
+ CPPUNIT_CHECK( cerr.rdbuf()->in_avail() == -1 );
+
+#if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+ CPPUNIT_CHECK( wcin.rdbuf()->in_avail() == 0 );
+ CPPUNIT_CHECK( wcout.rdbuf()->in_avail() == 0 );
+ CPPUNIT_CHECK( wclog.rdbuf()->in_avail() == 0 );
+ CPPUNIT_CHECK( wcerr.rdbuf()->in_avail() == 0 );
+#endif
+}
+
+//void IOStreamTest::wimbue()
+//{
+//#if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+// locale loc;
+// try {
+// locale tmp(".866");
+// loc = tmp;
+// }
+// catch (const runtime_error&) {
+// return;
+// }
+//
+// wcout.imbue(loc);
+// wcout << L"Hello world" << endl;
+// wcout.imbue(loc);
+// wcout << L"Hello world" << endl;
+//#endif
+//}
+
+#endif
diff --git a/test/unit/iota.h b/test/unit/iota.h
new file mode 100644
index 0000000..1cffefb
--- /dev/null
+++ b/test/unit/iota.h
@@ -0,0 +1,18 @@
+#ifndef IOTA_H
+#define IOTA_H
+
+#include <numeric>
+
+//iota definition used in unit test
+template <typename _It, typename _Tp>
+void __iota(_It __first, _It __last, _Tp __val) {
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ iota(__first, __last, __val);
+#else
+ while (__first != __last) {
+ *__first++ = __val++;
+ }
+#endif
+}
+
+#endif
diff --git a/test/unit/iota_test.cpp b/test/unit/iota_test.cpp
new file mode 100644
index 0000000..24339b2
--- /dev/null
+++ b/test/unit/iota_test.cpp
@@ -0,0 +1,47 @@
+#include <vector>
+#include <numeric>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class IotaTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(IotaTest);
+#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(iota1);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void iota1();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(IotaTest);
+
+//
+// tests implementation
+//
+void IotaTest::iota1()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ int numbers[10];
+ iota(numbers, numbers + 10, 42);
+ CPPUNIT_ASSERT(numbers[0]==42);
+ CPPUNIT_ASSERT(numbers[1]==43);
+ CPPUNIT_ASSERT(numbers[2]==44);
+ CPPUNIT_ASSERT(numbers[3]==45);
+ CPPUNIT_ASSERT(numbers[4]==46);
+ CPPUNIT_ASSERT(numbers[5]==47);
+ CPPUNIT_ASSERT(numbers[6]==48);
+ CPPUNIT_ASSERT(numbers[7]==49);
+ CPPUNIT_ASSERT(numbers[8]==50);
+ CPPUNIT_ASSERT(numbers[9]==51);
+#endif
+}
diff --git a/test/unit/iso646_header_test.c b/test/unit/iso646_header_test.c
new file mode 100644
index 0000000..41d7432
--- /dev/null
+++ b/test/unit/iso646_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <iso646.h>
diff --git a/test/unit/istmit_test.cpp b/test/unit/istmit_test.cpp
new file mode 100644
index 0000000..c1e2d17
--- /dev/null
+++ b/test/unit/istmit_test.cpp
@@ -0,0 +1,159 @@
+#include <algorithm>
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <sstream>
+# include <functional>
+# include <iterator>
+# include <vector>
+# include <string>
+#endif
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class IStreamIteratorTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(IStreamIteratorTest);
+#if defined (STLPORT) && defined (_STLP_USE_NO_IOSTREAMS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(istmit1);
+#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(copy_n_test);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void istmit1();
+ void copy_n_test();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(IStreamIteratorTest);
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# if !defined (STLPORT) || !defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
+typedef istream_iterator<char> istream_char_ite;
+typedef istream_iterator<int> istream_int_ite;
+typedef istream_iterator<string> istream_string_ite;
+# else
+typedef istream_iterator<char, ptrdiff_t> istream_char_ite;
+typedef istream_iterator<int, ptrdiff_t> istream_int_ite;
+typedef istream_iterator<string, ptrdiff_t> istream_string_ite;
+# endif
+#endif
+
+//
+// tests implementation
+//
+void IStreamIteratorTest::istmit1()
+{
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+ const char* buff = "MyString";
+ istringstream istr(buff);
+
+ char buffer[100];
+ size_t i = 0;
+ istr.unsetf(ios::skipws); // Disable white-space skipping.
+ istream_char_ite s(istr), meos;
+ while (!(s == meos) &&
+ //*TY 01/10/1999 - added end of stream check
+ // NOTE operator!= should not be used here ifndef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
+ (*s != '\n') &&
+ (i < sizeof(buffer) / sizeof(buffer[0]))) { //*TY 07/28/98 - added index check
+ buffer[i++] = *s++;
+ }
+ buffer[i] = '\0'; // Null terminate buffer.
+
+ CPPUNIT_ASSERT(!strcmp(buffer, buff));
+
+ {
+ istringstream empty_istr;
+ CPPUNIT_ASSERT( istream_char_ite(empty_istr) == istream_char_ite() );
+ }
+#endif
+}
+
+void IStreamIteratorTest::copy_n_test()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) && !defined (_STLP_USE_NO_IOSTREAMS)
+ //This test check that no character is lost while reading the istream
+ //through a istream_iterator.
+ {
+ istringstream istr("aabbcd");
+ string chars;
+ istream_char_ite ite = copy_n(copy_n(istream_char_ite(istr),
+ 2, back_inserter(chars)).first,
+ 2, back_inserter(chars)).first;
+ CPPUNIT_ASSERT( chars == "aabb" );
+ copy_n(ite, 2, back_inserter(chars));
+ CPPUNIT_ASSERT( chars == "aabbcd" );
+ }
+
+ {
+ istringstream istr("11 22 AA BB 33 44 CC DD");
+ vector<int> ints;
+ vector<string> strings;
+
+ copy_n(istream_int_ite(istr), 2, back_inserter(ints));
+ CPPUNIT_ASSERT( ints.size() == 2 );
+ CPPUNIT_ASSERT( ints[0] == 11 );
+ CPPUNIT_ASSERT( ints[1] == 22 );
+ ints.clear();
+ istr.clear();
+ copy_n(istream_string_ite(istr), 2, back_inserter(strings));
+ CPPUNIT_ASSERT( strings.size() == 2 );
+ CPPUNIT_ASSERT( strings[0] == "AA" );
+ CPPUNIT_ASSERT( strings[1] == "BB" );
+ strings.clear();
+ istr.clear();
+ /* The following code cannot work, '33' is extracted as a string
+ * in the previous copy_n call, this value is returned in the pair
+ * returned by copy_n but is lost as this istream_iterator is not used.
+ * copy_n and istream_iterator can only be combined safely if:
+ * - you always extract the same type of istream_iterator and you always reuse
+ * the istream_iterator returned by copy_n (see previous test with "aabbcd")
+ * - you extract different type of object and no object is convertible to an other
+ * as in this current test when you extract int and string (when you extract ints
+ * again it fails as int can be converted to strings.
+ *
+ copy_n(istream_int_ite(istr), 2, back_inserter(ints));
+ CPPUNIT_ASSERT( ints.size() == 2 );
+ CPPUNIT_ASSERT( ints[0] == 33 );
+ CPPUNIT_ASSERT( ints[1] == 44 );
+ istr.clear();
+ copy_n(istream_string_ite(istr), 2, back_inserter(strings));
+ CPPUNIT_ASSERT( strings.size() == 2 );
+ CPPUNIT_ASSERT( strings[0] == "CC" );
+ CPPUNIT_ASSERT( strings[1] == "DD" );
+ */
+ }
+
+ {
+ istringstream is("1 2 3 4 5 6 7 8 9 10");
+ vector<int> ints;
+ istream_iterator<int> itr(is);
+ itr = copy_n(itr, 0, back_inserter(ints)).first;
+ CPPUNIT_ASSERT( ints.empty() );
+ itr = copy_n(itr, -1, back_inserter(ints)).first;
+ CPPUNIT_ASSERT( ints.empty() );
+ itr = copy_n(itr, 2, back_inserter(ints)).first;
+ CPPUNIT_ASSERT( ints.size() == 2 );
+ CPPUNIT_ASSERT( ints[0] == 1 );
+ CPPUNIT_ASSERT( ints[1] == 2 );
+ itr = copy_n(itr, 2, back_inserter(ints)).first;
+ CPPUNIT_ASSERT( ints.size() == 4 );
+ CPPUNIT_ASSERT( ints[2] == 3 );
+ CPPUNIT_ASSERT( ints[3] == 4 );
+ itr = copy_n(itr, 2, back_inserter(ints)).first;
+ CPPUNIT_ASSERT( ints.size() == 6 );
+ CPPUNIT_ASSERT( ints[4] == 5 );
+ CPPUNIT_ASSERT( ints[5] == 6 );
+ }
+#endif
+}
diff --git a/test/unit/istream_header_test.cpp b/test/unit/istream_header_test.cpp
new file mode 100644
index 0000000..7c83854
--- /dev/null
+++ b/test/unit/istream_header_test.cpp
@@ -0,0 +1,10 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#if !defined (_STLP_NO_IOSTREAMS)
+# include <istream>
+#endif
diff --git a/test/unit/iter_test.cpp b/test/unit/iter_test.cpp
new file mode 100644
index 0000000..52e4348
--- /dev/null
+++ b/test/unit/iter_test.cpp
@@ -0,0 +1,169 @@
+#include <vector>
+#include <list>
+#include <algorithm>
+#include <numeric>
+
+#include "iota.h"
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class IterTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(IterTest);
+ CPPUNIT_TEST(iter1);
+ CPPUNIT_TEST(iter3);
+ CPPUNIT_TEST(iter4);
+ CPPUNIT_TEST(iterswp0);
+ CPPUNIT_TEST(iterswp1);
+ CPPUNIT_TEST(iterswp2);
+ CPPUNIT_TEST(iterswp3);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void iter1();
+ void iter3();
+ void iter4();
+ void iterswp0();
+ void iterswp1();
+ void iterswp2();
+ void iterswp3();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(IterTest);
+
+//
+// tests implementation
+//
+void IterTest::iter1()
+{
+ vector<const char*> v; // Vector of character strings.
+ v.push_back("zippy"); // First element.
+ v.push_back("motorboy"); // Second element.
+ typedef vector<const char*> vec;
+ unsigned counter = 0;
+ for (vec::iterator i = v.begin(); i != v.end(); ++i, ++counter) {
+ switch (counter) {
+ case 0:
+ CPPUNIT_ASSERT(!strcmp(*i, "zippy"));
+ break;
+ case 1:
+ CPPUNIT_ASSERT(!strcmp(*i, "motorboy"));
+ break;
+ default:
+ CPPUNIT_FAIL;
+ }
+ }
+}
+void IterTest::iter3()
+{
+ typedef vector<const char*> Vec;
+ Vec v; // Vector of character strings.
+ v.push_back("zippy"); // First element.
+ v.push_back("motorboy"); // Second element.
+ Vec::reverse_iterator it;
+ unsigned counter = 0;
+ for (it = v.rbegin(); it != v.rend(); ++it, ++counter) {
+ switch (counter) {
+ case 1:
+ CPPUNIT_ASSERT(!strcmp(*it, "zippy"));
+ break;
+ case 0:
+ CPPUNIT_ASSERT(!strcmp(*it, "motorboy"));
+ break;
+ default:
+ CPPUNIT_FAIL;
+ }
+ }
+}
+void IterTest::iter4()
+{
+ vector<int> v; // Empty vector of integers.
+ v.push_back(1);
+ v.push_back(2);
+ v.push_back(3);
+ // Position immediately after last item.
+ vector<int>::iterator i = v.end();
+ // Move back one and then access.
+ CPPUNIT_ASSERT((*--i)==3);
+ i -= 2; // Jump back two items.
+ CPPUNIT_ASSERT((*i)==1);
+}
+void IterTest::iterswp0()
+{
+ int numbers[6] = { 0, 1, 2, 3, 4, 5 };
+
+ iter_swap(numbers, numbers + 3);
+
+ CPPUNIT_ASSERT(numbers[0]==3);
+ CPPUNIT_ASSERT(numbers[1]==1);
+ CPPUNIT_ASSERT(numbers[2]==2);
+ CPPUNIT_ASSERT(numbers[3]==0);
+ CPPUNIT_ASSERT(numbers[4]==4);
+ CPPUNIT_ASSERT(numbers[5]==5);
+
+}
+void IterTest::iterswp1()
+{
+ vector<int> v1(6);
+ __iota(v1.begin(), v1.end(), 0);
+ iter_swap( v1.begin(), v1.begin() + 3 );
+
+ CPPUNIT_ASSERT(v1[0]==3);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==2);
+ CPPUNIT_ASSERT(v1[3]==0);
+ CPPUNIT_ASSERT(v1[4]==4);
+ CPPUNIT_ASSERT(v1[5]==5);
+}
+void IterTest::iterswp2()
+{
+ vector<bool> boolVector;
+
+ boolVector.push_back( true );
+ boolVector.push_back( false );
+
+ vector<bool>::iterator i1 = boolVector.begin();
+ vector<bool>::iterator i2 = boolVector.begin();
+ ++i2;
+
+ bool v0 = *i1;
+ bool v1 = *i2;
+
+ iter_swap( i1, i2 );
+
+ CPPUNIT_ASSERT(( *i1 == v1 && *i2 == v0 ));
+}
+
+
+void IterTest::iterswp3()
+{
+ vector<int> vvref(10, 10);
+ vector<int> lvref(10, 20);
+
+ vector<vector<int> > vvints(4, vvref);
+ list<vector<int> > lvints(4, lvref);
+
+ iter_swap(vvints.begin(), lvints.begin());
+ CPPUNIT_CHECK( vvints.front() == lvref );
+ CPPUNIT_CHECK( lvints.front() == vvref );
+
+ //const vector<vector<int> > &cvvints = vvints;
+ //iter_swap(cvvints.begin(), lvints.begin());
+ //iter_swap(lvints.begin(), cvvints.begin());
+
+#if defined (STLPORT) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ int *pvvint = &vvints.front().front();
+ int *plvint = &lvints.front().front();
+
+ iter_swap(vvints.begin(), lvints.begin());
+ //Check that elements have been swaped:
+ CPPUNIT_CHECK( pvvint == &lvints.front().front() );
+ CPPUNIT_CHECK( plvint == &vvints.front().front() );
+#endif
+}
diff --git a/test/unit/iterator_header_test.cpp b/test/unit/iterator_header_test.cpp
new file mode 100644
index 0000000..cb7ed29
--- /dev/null
+++ b/test/unit/iterator_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <iterator>
diff --git a/test/unit/less_test.cpp b/test/unit/less_test.cpp
new file mode 100644
index 0000000..a87eae8
--- /dev/null
+++ b/test/unit/less_test.cpp
@@ -0,0 +1,50 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class LessTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(LessTest);
+ CPPUNIT_TEST(lesst);
+ CPPUNIT_TEST(lesseqt);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void lesst();
+ void lesseqt();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(LessTest);
+
+//
+// tests implementation
+//
+void LessTest::lesst()
+{
+ int array [4] = { 3, 1, 4, 2 };
+ sort(array, array + 4, less<int>());
+
+ CPPUNIT_ASSERT(array[0]==1);
+ CPPUNIT_ASSERT(array[1]==2);
+ CPPUNIT_ASSERT(array[2]==3);
+ CPPUNIT_ASSERT(array[3]==4);
+}
+void LessTest::lesseqt()
+{
+ int array [4] = { 3, 1, 4, 2 };
+ sort(array, array + 4, less_equal<int>());
+
+ CPPUNIT_ASSERT(array[0]==1);
+ CPPUNIT_ASSERT(array[1]==2);
+ CPPUNIT_ASSERT(array[2]==3);
+ CPPUNIT_ASSERT(array[3]==4);
+}
diff --git a/test/unit/lexcmp_test.cpp b/test/unit/lexcmp_test.cpp
new file mode 100644
index 0000000..f913f41
--- /dev/null
+++ b/test/unit/lexcmp_test.cpp
@@ -0,0 +1,48 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class LexcmpTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(LexcmpTest);
+ CPPUNIT_TEST(lexcmp1);
+ CPPUNIT_TEST(lexcmp2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void lexcmp1();
+ void lexcmp2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(LexcmpTest);
+
+//
+// tests implementation
+//
+void LexcmpTest::lexcmp1()
+{
+ const unsigned size = 6;
+ char n1[size] = "shoe";
+ char n2[size] = "shine";
+
+ bool before = lexicographical_compare(n1, n1 + size, n2, n2 + size);
+ CPPUNIT_ASSERT(!before);
+}
+void LexcmpTest::lexcmp2()
+{
+ const unsigned size = 6;
+ char n1[size] = "shoe";
+ char n2[size] = "shine";
+
+ bool before = lexicographical_compare(n1, n1 + size, n2, n2 + size, greater<char>());
+ CPPUNIT_ASSERT(before);
+}
diff --git a/test/unit/limits_header_test.cpp b/test/unit/limits_header_test.cpp
new file mode 100644
index 0000000..5954a04
--- /dev/null
+++ b/test/unit/limits_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <limits>
diff --git a/test/unit/limits_test.cpp b/test/unit/limits_test.cpp
new file mode 100644
index 0000000..d8102ee
--- /dev/null
+++ b/test/unit/limits_test.cpp
@@ -0,0 +1,317 @@
+/* boost limits_test.cpp test your <limits> file for important
+ *
+ * Copyright Jens Maurer 2000
+ * Permission to use, copy, modify, sell, and distribute this software
+ * is hereby granted without fee provided that the above copyright notice
+ * appears in all copies and that both that copyright notice and this
+ * permission notice appear in supporting documentation,
+ *
+ * Jens Maurer makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ */
+
+#include <limits>
+//#include <sstream>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class LimitTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(LimitTest);
+# if defined (__BORLANDC__)
+ /* Ignore FPU exceptions, set FPU precision to 64 bits */
+ unsigned int _float_control_word = _control87(0, 0);
+ _control87(PC_64|MCW_EM|IC_AFFINE, MCW_PC|MCW_EM|MCW_IC);
+# endif
+ CPPUNIT_TEST(test);
+ CPPUNIT_TEST(qnan_test);
+# if defined (__BORLANDC__)
+ /* Reset floating point control word */
+ _clear87();
+ _control87(_float_control_word, MCW_PC|MCW_EM|MCW_IC);
+# endif
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void test();
+ void qnan_test();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(LimitTest);
+
+#if defined (STLPORT) && defined (_STLP_STATIC_CONST_INIT_BUG)
+# define CHECK_COND(X) if (!(X)) { CPPUNIT_MESSAGE(#X); return false; }
+#else
+//This version force to have external linkage on static constant which might
+//reveal that _STLP_NO_STATIC_CONST_DEFINITION should be commented.
+bool check_cond(const bool& cond) { return cond; }
+# define CHECK_COND(X) if (!check_cond(X)) { CPPUNIT_MESSAGE(#X); return false; }
+#endif
+
+bool valid_sign_info(bool, bool)
+{ return true; }
+
+template <class _Tp>
+bool valid_sign_info(bool limit_is_signed, const _Tp &) {
+ return (limit_is_signed && _Tp(-1) < 0) ||
+ (!limit_is_signed && _Tp(-1) > 0);
+}
+
+template <class _Tp>
+bool test_integral_limits_base(const _Tp &, bool unknown_sign = true, bool is_signed = true) {
+ typedef numeric_limits<_Tp> lim;
+
+ CHECK_COND(lim::is_specialized);
+ CHECK_COND(lim::is_exact);
+ CHECK_COND(lim::is_integer);
+ CHECK_COND(!lim::is_iec559);
+ CHECK_COND(lim::min() < lim::max());
+ CHECK_COND((unknown_sign && ((lim::is_signed && (lim::min() != 0)) || (!lim::is_signed && (lim::min() == 0)))) ||
+ (!unknown_sign && ((lim::is_signed && is_signed) || (!lim::is_signed && !is_signed))));
+
+ if (unknown_sign) {
+ CHECK_COND(valid_sign_info(lim::is_signed, _Tp()));
+ }
+ return true;
+}
+
+template <class _Tp>
+bool test_integral_limits(const _Tp &val, bool unknown_sign = true, bool is_signed = true) {
+ if (!test_integral_limits_base(val, unknown_sign, is_signed))
+ return false;
+
+ typedef numeric_limits<_Tp> lim;
+
+ CHECK_COND(lim::is_modulo);
+
+ if (lim::is_bounded ||
+ (!lim::is_bounded && !lim::is_signed)) {
+ _Tp tmp = lim::min();
+ CHECK_COND( --tmp > lim::min() );
+ }
+
+ if (lim::is_bounded) {
+ _Tp tmp = lim::max();
+ CHECK_COND( ++tmp < lim::max() );
+ }
+
+ return true;
+}
+
+template <class _Tp>
+bool test_signed_integral_limits(const _Tp &__val) {
+ return test_integral_limits(__val, false, true);
+}
+template <class _Tp>
+bool test_unsigned_integral_limits(const _Tp &__val) {
+ return test_integral_limits(__val, false, false);
+}
+
+template <class _Tp>
+bool test_float_values(_Tp lhs, _Tp rhs)
+{ return lhs == rhs; }
+
+template <class _Tp>
+bool test_float_limits(const _Tp &) {
+ typedef numeric_limits<_Tp> lim;
+ CHECK_COND(lim::is_specialized);
+ CHECK_COND(!lim::is_modulo);
+ CHECK_COND(!lim::is_integer);
+ CHECK_COND(lim::is_signed);
+
+ CHECK_COND(lim::max() > 1000);
+ CHECK_COND(lim::min() > 0);
+ CHECK_COND(lim::min() < 0.001);
+ CHECK_COND(lim::epsilon() > 0);
+
+ if (lim::is_iec559) {
+ CHECK_COND(lim::has_infinity);
+ CHECK_COND(lim::has_quiet_NaN);
+ CHECK_COND(lim::has_signaling_NaN);
+ CHECK_COND(lim::has_denorm == denorm_present);
+ }
+
+ if (lim::has_denorm == denorm_absent) {
+ CHECK_COND(lim::denorm_min() == lim::min());
+ _Tp tmp = lim::min();
+ tmp /= 2;
+ if (tmp > 0 && tmp < lim::min()) {
+ // has_denorm could be denorm_present
+ CPPUNIT_MESSAGE("It looks like your compiler/platform supports denormalized floating point representation.");
+ }
+ }
+ else if (lim::has_denorm == denorm_present) {
+ CHECK_COND(lim::denorm_min() > 0);
+ CHECK_COND(lim::denorm_min() < lim::min());
+
+ _Tp tmp = lim::min();
+ while (tmp != 0) {
+ _Tp old_tmp = tmp;
+ tmp /= 2;
+ CHECK_COND(tmp < old_tmp);
+ CHECK_COND(tmp >= lim::denorm_min() || tmp == (_Tp)0);
+ //ostringstream str;
+ //str << "denorm_min = " << lim::denorm_min() << ", tmp = " << tmp;
+ //CPPUNIT_MESSAGE(str.str().c_str());
+ }
+ }
+
+ if (lim::has_infinity) {
+ const _Tp infinity = lim::infinity();
+ /* Make sure those values are not 0 or similar nonsense.
+ * Infinity must compare as if larger than the maximum representable value. */
+
+ _Tp val = lim::max();
+ val *= 2;
+
+ /* We use test_float_values because without it some compilers (gcc) perform weird
+ * optimization on the test giving unexpected result. */
+ CHECK_COND(test_float_values(val, infinity));
+
+ /*
+ ostringstream str;
+ str << "lim::max() = " << lim::max() << ", val = " << val << ", infinity = " << infinity;
+ CPPUNIT_MESSAGE( str.str().c_str() );
+ str.str(string());
+ str << "sizeof(_Tp) = " << sizeof(_Tp);
+ CPPUNIT_MESSAGE( str.str().c_str() );
+ if (sizeof(_Tp) == 4) {
+ str.str(string());
+ str << "val in hexa: " << showbase << hex << *((const unsigned int*)&val);
+ str << ", infinity in hexa: " << showbase << hex << *((const unsigned int*)&infinity);
+ }
+#if defined (_STLP_LONG_LONG)
+ else if (sizeof(_Tp) == sizeof(_STLP_LONG_LONG)) {
+ str.str(string());
+ str << "val in hexa: " << showbase << hex << *((const unsigned _STLP_LONG_LONG*)&val);
+ str << ", infinity in hexa: " << showbase << hex << *((const unsigned _STLP_LONG_LONG*)&infinity);
+ }
+#endif
+ else {
+ str.str(string());
+ str << "val: ";
+ for (int i = 0; i != sizeof(_Tp) / sizeof(unsigned short); ++i) {
+ if (i != 0) str << ' ';
+ str << showbase << hex << setw(4) << setfill('0') << *((const unsigned short*)&val + i);
+ }
+ str << ", infinity: ";
+ for (int i = 0; i != sizeof(_Tp) / sizeof(unsigned short); ++i) {
+ if (i != 0) str << ' ';
+ str << showbase << hex << setw(4) << setfill('0') << *((const unsigned short*)&infinity + i);
+ }
+ }
+ CPPUNIT_MESSAGE( str.str().c_str() );
+ str.str(string());
+ str << dec;
+ str << "lim::digits = " << lim::digits << ", lim::digits10 = " << lim::digits10 << endl;
+ str << "lim::min_exponent = " << lim::min_exponent << ", lim::min_exponent10 = " << lim::min_exponent10 << endl;
+ str << "lim::max_exponent = " << lim::max_exponent << ", lim::max_exponent10 = " << lim::max_exponent10 << endl;
+ CPPUNIT_MESSAGE( str.str().c_str() );
+ */
+
+ CHECK_COND(infinity == infinity);
+ CHECK_COND(infinity > lim::max());
+ CHECK_COND(-infinity < -lim::max());
+ }
+
+ return true;
+}
+
+//float generate_nan(float f) {
+// return 0.0f / f;
+//}
+template <class _Tp>
+bool test_qnan(const _Tp &) {
+ typedef numeric_limits<_Tp> lim;
+ if (lim::has_quiet_NaN) {
+ const _Tp qnan = lim::quiet_NaN();
+
+ //if (sizeof(_Tp) == 4) {
+ // ostringstream str;
+ // str << "qnan " << qnan << ", in hexa: " << showbase << hex << *((unsigned int*)&qnan);
+ // CPPUNIT_MESSAGE( str.str().c_str() );
+ // str.str("");
+ // float val = generate_nan(0.0f);
+ // str << "val " << val << ", in hexa: " << showbase << hex << *((unsigned int*)&val);
+ // CPPUNIT_MESSAGE( str.str().c_str() );
+ // str.str("");
+ // val = -qnan;
+ // str << "-qnan " << val << ", in hexa: " << showbase << hex << *((unsigned int*)&val);
+ // CPPUNIT_MESSAGE( str.str().c_str() );
+ //}
+ /* NaNs shall always compare "false" when compared for equality
+ * If one of these fail, your compiler may be optimizing incorrectly,
+ * or the STLport is incorrectly configured.
+ */
+ CHECK_COND(! (qnan == 42));
+ CHECK_COND(! (qnan == qnan));
+ CHECK_COND(qnan != 42);
+ CHECK_COND(qnan != qnan);
+
+ /* The following tests may cause arithmetic traps.
+ * CHECK_COND(! (qnan < 42));
+ * CHECK_COND(! (qnan > 42));
+ * CHECK_COND(! (qnan <= 42));
+ * CHECK_COND(! (qnan >= 42));
+ */
+ }
+ return true;
+}
+
+
+class ArbitraryType
+{};
+
+void LimitTest::test() {
+ CPPUNIT_CHECK(test_integral_limits_base(bool()));
+ CPPUNIT_CHECK(test_integral_limits(char()));
+ typedef signed char signed_char;
+ CPPUNIT_CHECK(test_signed_integral_limits(signed_char()));
+ typedef unsigned char unsigned_char;
+ CPPUNIT_CHECK(test_unsigned_integral_limits(unsigned_char()));
+# if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_WCHAR_T_IS_USHORT)
+ CPPUNIT_CHECK(test_integral_limits(wchar_t()));
+# endif
+ CPPUNIT_CHECK(test_signed_integral_limits(short()));
+ typedef unsigned short unsigned_short;
+ CPPUNIT_CHECK(test_unsigned_integral_limits(unsigned_short()));
+ CPPUNIT_CHECK(test_signed_integral_limits(int()));
+ typedef unsigned int unsigned_int;
+ CPPUNIT_CHECK(test_unsigned_integral_limits(unsigned_int()));
+ CPPUNIT_CHECK(test_signed_integral_limits(long()));
+ typedef unsigned long unsigned_long;
+ CPPUNIT_CHECK(test_unsigned_integral_limits(unsigned_long()));
+# if defined (_STLP_LONG_LONG)
+ typedef _STLP_LONG_LONG long_long;
+ CPPUNIT_CHECK(test_signed_integral_limits(long_long()));
+ typedef unsigned _STLP_LONG_LONG unsigned_long_long;
+ CPPUNIT_CHECK(test_unsigned_integral_limits(unsigned_long_long()));
+#endif
+
+ CPPUNIT_CHECK(test_float_limits(float()));
+ CPPUNIT_CHECK(test_float_limits(double()));
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+ typedef long double long_double;
+ CPPUNIT_CHECK(test_float_limits(long_double()));
+# endif
+
+ CPPUNIT_ASSERT( !numeric_limits<ArbitraryType>::is_specialized );
+}
+
+void LimitTest::qnan_test() {
+ CPPUNIT_CHECK(test_qnan(float()));
+ CPPUNIT_CHECK(test_qnan(double()));
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+ typedef long double long_double;
+ CPPUNIT_CHECK(test_qnan(long_double()));
+# endif
+}
diff --git a/test/unit/list_header_test.cpp b/test/unit/list_header_test.cpp
new file mode 100644
index 0000000..36cb6c4
--- /dev/null
+++ b/test/unit/list_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <list>
diff --git a/test/unit/list_test.cpp b/test/unit/list_test.cpp
new file mode 100644
index 0000000..7345d40
--- /dev/null
+++ b/test/unit/list_test.cpp
@@ -0,0 +1,468 @@
+//Has to be first for StackAllocator swap overload to be taken
+//into account (at least using GCC 4.0.1)
+#include "stack_allocator.h"
+
+#include <list>
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class ListTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(ListTest);
+ CPPUNIT_TEST(list1);
+ CPPUNIT_TEST(list2);
+ CPPUNIT_TEST(list3);
+ CPPUNIT_TEST(list4);
+ CPPUNIT_TEST(erase);
+ CPPUNIT_TEST(resize);
+ CPPUNIT_TEST(push_back);
+ CPPUNIT_TEST(push_front);
+ CPPUNIT_TEST(allocator_with_state);
+ CPPUNIT_TEST(swap);
+ CPPUNIT_TEST(adl);
+ //CPPUNIT_TEST(const_list);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void list1();
+ void list2();
+ void list3();
+ void list4();
+ void erase();
+ void resize();
+ void push_back();
+ void push_front();
+ void allocator_with_state();
+ void swap();
+ void adl();
+ //void const_list();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ListTest);
+
+//
+// tests implementation
+//
+void ListTest::list1()
+{
+ int array1 [] = { 9, 16, 36 };
+ int array2 [] = { 1, 4 };
+
+ list<int> l1(array1, array1 + 3);
+ list<int> l2(array2, array2 + 2);
+ list<int>::iterator i1 = l1.begin();
+ list<int>::iterator i2 = l2.begin();
+ list<int>::const_iterator ci(i1);
+ list<int>::const_iterator ci1(ci);
+ l1.splice(i1, l2);
+ i1 = l1.begin();
+ CPPUNIT_ASSERT( *i1++ == 1 );
+ CPPUNIT_ASSERT( *i1++ == 4 );
+ CPPUNIT_ASSERT( *i1++ == 9 );
+ CPPUNIT_ASSERT( *i1++ == 16 );
+ CPPUNIT_ASSERT( *i1++ == 36 );
+
+#if defined (STLPORT) && \
+ (!defined (_STLP_DEBUG) || (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL))
+ CPPUNIT_ASSERT( i2 == l1.begin() );
+#endif
+
+ //Default construct check (_STLP_DEF_CONST_PLCT_NEW_BUG)
+ list<int> l(2);
+ i1 = l.begin();
+ CPPUNIT_ASSERT( *(i1++) == 0 );
+ CPPUNIT_ASSERT( *i1 == 0 );
+#if 0
+ //A small compilation time check to be activated from time to time,
+ //compilation should fail.
+ {
+ list<char>::iterator l_char_ite;
+ list<int>::iterator l_int_ite;
+ CPPUNIT_ASSERT( l_char_ite != l_int_ite );
+ }
+#endif
+}
+
+void ListTest::list2()
+{
+ int array1 [] = { 1, 16 };
+ int array2 [] = { 4, 9 };
+
+ list<int> l1(array1, array1 + 2);
+ list<int> l2(array2, array2 + 2);
+ list<int>::iterator i = l1.begin();
+ i++;
+ l1.splice(i, l2, l2.begin(), l2.end());
+ i = l1.begin();
+ CPPUNIT_ASSERT(*i++==1);
+ CPPUNIT_ASSERT(*i++==4);
+ CPPUNIT_ASSERT(*i++==9);
+ CPPUNIT_ASSERT(*i++==16);
+}
+
+void ListTest::list3()
+{
+ char array [] = { 'x', 'l', 'x', 't', 's', 's' };
+
+ list<char> str(array, array + 6);
+ list<char>::iterator i;
+
+ str.reverse();
+ i = str.begin();
+ CPPUNIT_ASSERT(*i++=='s');
+ CPPUNIT_ASSERT(*i++=='s');
+ CPPUNIT_ASSERT(*i++=='t');
+ CPPUNIT_ASSERT(*i++=='x');
+ CPPUNIT_ASSERT(*i++=='l');
+ CPPUNIT_ASSERT(*i++=='x');
+
+ str.remove('x');
+ i = str.begin();
+ CPPUNIT_ASSERT(*i++=='s');
+ CPPUNIT_ASSERT(*i++=='s');
+ CPPUNIT_ASSERT(*i++=='t');
+ CPPUNIT_ASSERT(*i++=='l');
+
+ str.unique();
+ i = str.begin();
+ CPPUNIT_ASSERT(*i++=='s');
+ CPPUNIT_ASSERT(*i++=='t');
+ CPPUNIT_ASSERT(*i++=='l');
+
+ str.sort();
+ i = str.begin();
+ CPPUNIT_ASSERT(*i++=='l');
+ CPPUNIT_ASSERT(*i++=='s');
+ CPPUNIT_ASSERT(*i++=='t');
+}
+
+void ListTest::list4()
+{
+ int array1 [] = { 1, 3, 6, 7 };
+ int array2 [] = { 2, 4 };
+
+ list<int> l1(array1, array1 + 4);
+ list<int> l2(array2, array2 + 2);
+ l1.merge(l2);
+ list<int>::iterator i = l1.begin();
+ CPPUNIT_ASSERT(*i++==1);
+ CPPUNIT_ASSERT(*i++==2);
+ CPPUNIT_ASSERT(*i++==3);
+ CPPUNIT_ASSERT(*i++==4);
+ CPPUNIT_ASSERT(*i++==6);
+ CPPUNIT_ASSERT(*i++==7);
+
+ //We use distance to avoid a simple call to an internal counter
+ CPPUNIT_ASSERT(distance(l1.begin(), l1.end()) == 6);
+ CPPUNIT_ASSERT(distance(l2.begin(), l2.end()) == 0);
+
+ l1.swap(l2);
+
+ CPPUNIT_ASSERT(distance(l1.begin(), l1.end()) == 0);
+ CPPUNIT_ASSERT(distance(l2.begin(), l2.end()) == 6);
+}
+
+void ListTest::erase()
+{
+ list<int> l;
+ l.push_back( 1 );
+ l.erase(l.begin());
+ CPPUNIT_ASSERT( l.empty() );
+
+ int array[] = { 0, 1, 2, 3 };
+ l.assign(array, array + 4);
+ list<int>::iterator lit;
+ lit = l.erase(l.begin());
+ CPPUNIT_ASSERT( *lit == 1 );
+
+ lit = l.erase(l.begin(), --l.end());
+ CPPUNIT_ASSERT( *lit == 3 );
+
+ l.clear();
+ CPPUNIT_ASSERT( l.empty() );
+}
+
+
+void ListTest::resize()
+{
+ {
+ list<int> l;
+ l.resize(5, 1);
+
+ size_t i;
+ list<int>::iterator lit(l.begin());
+ for (i = 0; i < 5; ++i) {
+ CPPUNIT_ASSERT( lit != l.end() );
+ CPPUNIT_ASSERT( *(lit++) == 1 );
+ }
+ CPPUNIT_ASSERT( lit == l.end() );
+
+ l.resize(3);
+ lit = l.begin();
+ for (i = 0; i < 3; ++i) {
+ CPPUNIT_ASSERT( lit != l.end() );
+ CPPUNIT_ASSERT( *(lit++) == 1 );
+ }
+ CPPUNIT_ASSERT( lit == l.end() );
+ }
+
+ {
+ list<int> l;
+ l.resize(5);
+
+ size_t i;
+ list<int>::iterator lit(l.begin());
+ for (i = 0; i < 5; ++i) {
+ CPPUNIT_ASSERT( lit != l.end() );
+ CPPUNIT_ASSERT( *(lit++) == 0 );
+ }
+ CPPUNIT_ASSERT( lit == l.end() );
+ }
+}
+
+void ListTest::push_back()
+{
+ list<int> l;
+ l.push_back( 1 );
+ l.push_back( 2 );
+ l.push_back( 3 );
+
+ list<int>::reverse_iterator r = l.rbegin();
+
+ CPPUNIT_ASSERT( *r == 3 );
+ l.push_back( 4 );
+ /*
+ * Following lines are commented, because ones show standard contradiction
+ * (24.4.1 and 23.2.2.3); but present behaviour is valid, 24.4.1, paragraphs 1 and 2,
+ * 24.4.1.3.3 and 23.1 paragraph 9 (Table 66). The 24.4.1 is more common rule,
+ * so it has preference under 23.2.2.3, by my opinion.
+ *
+ * - ptr
+ */
+ // CPPUNIT_ASSERT( *r == 3 );
+ // ++r;
+ // CPPUNIT_ASSERT( *r == 2 );
+}
+
+void ListTest::push_front()
+{
+ list<int> l;
+ l.push_back( 1 );
+ l.push_back( 2 );
+ l.push_back( 3 );
+
+ list<int>::iterator i = l.begin();
+
+ CPPUNIT_ASSERT( *i == 1 );
+ l.push_front( 0 );
+ CPPUNIT_ASSERT( *i == 1 );
+ ++i;
+ CPPUNIT_ASSERT( *i == 2 );
+}
+
+void ListTest::allocator_with_state()
+{
+ char buf1[1024];
+ StackAllocator<int> stack1(buf1, buf1 + sizeof(buf1));
+
+ char buf2[1024];
+ StackAllocator<int> stack2(buf2, buf2 + sizeof(buf2));
+
+ typedef list<int, StackAllocator<int> > ListInt;
+ {
+ //Swap with both list non empty
+ ListInt lint1(10, 0, stack1);
+ ListInt lint1Cpy(lint1);
+
+ ListInt lint2(10, 1, stack2);
+ ListInt lint2Cpy(lint2);
+
+ lint1.swap(lint2);
+
+ CPPUNIT_ASSERT( lint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( lint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( lint1 == lint2Cpy );
+ CPPUNIT_ASSERT( lint2 == lint1Cpy );
+ CPPUNIT_ASSERT( lint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( lint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ {
+ //Swap with empty calle list
+ ListInt lint1(10, 0, stack1);
+ ListInt lint1Cpy(lint1);
+
+ ListInt lint2(stack2);
+ ListInt lint2Cpy(lint2);
+
+ lint1.swap(lint2);
+
+ CPPUNIT_ASSERT( lint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( lint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( lint1 == lint2Cpy );
+ CPPUNIT_ASSERT( lint2 == lint1Cpy );
+ CPPUNIT_ASSERT( lint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( lint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ {
+ //Swap with empty caller list
+ ListInt lint1(stack1);
+ ListInt lint1Cpy(lint1);
+
+ ListInt lint2(10, 0, stack2);
+ ListInt lint2Cpy(lint2);
+
+ lint1.swap(lint2);
+
+ CPPUNIT_ASSERT( lint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( lint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( lint1 == lint2Cpy );
+ CPPUNIT_ASSERT( lint2 == lint1Cpy );
+ CPPUNIT_ASSERT( lint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( lint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ {
+ ListInt lint1(10, 0, stack1);
+ ListInt lint2(10, 1, stack2);
+
+ lint1.splice(lint1.begin(), lint2);
+ CPPUNIT_ASSERT( lint1.size() == 20 );
+ CPPUNIT_ASSERT( lint2.empty() );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ {
+ ListInt lint1(10, 0, stack1);
+ ListInt lint2(10, 1, stack2);
+
+ lint1.splice(lint1.begin(), lint2, lint2.begin());
+ CPPUNIT_ASSERT( lint1.size() == 11 );
+ CPPUNIT_ASSERT( lint2.size() == 9 );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ {
+ ListInt lint1(10, 0, stack1);
+ ListInt lint2(10, 1, stack2);
+
+ ListInt::iterator lit(lint2.begin());
+ advance(lit, 5);
+ lint1.splice(lint1.begin(), lint2, lint2.begin(), lit);
+ CPPUNIT_ASSERT( lint1.size() == 15 );
+ CPPUNIT_ASSERT( lint2.size() == 5 );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ {
+ ListInt lint1(10, 0, stack1);
+ ListInt lint2(10, 1, stack2);
+
+ ListInt lintref(stack2);
+ lintref.insert(lintref.begin(), 10, 1);
+ lintref.insert(lintref.begin(), 10, 0);
+
+ lint1.merge(lint2);
+ CPPUNIT_ASSERT( lint1.size() == 20 );
+ CPPUNIT_ASSERT( lint1 == lintref );
+ CPPUNIT_ASSERT( lint2.empty() );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+
+#if defined (STLPORT) && !defined (_STLP_NO_MEMBER_TEMPLATES) && \
+ (!defined (_MSC_VER) || (_MSC_VER >= 1300))
+ {
+ //This is a compile time test.
+ //We check that sort implementation is correct when list is instanciated
+ //with an allocator that do not have a default constructor.
+ ListInt lint1(10, 0, stack1);
+ lint1.sort();
+ lint1.sort(greater<int>());
+ }
+#endif
+}
+
+/*
+void ListTest::const_list()
+{
+ list<const int> cint_list;
+ cint_list.push_back(1);
+ cint_list.push_front(2);
+}
+*/
+void ListTest::swap()
+{
+ list<int> lst1;
+ list<int> lst2;
+
+ lst1.push_back(1);
+ lst2.push_back(2);
+
+ lst1.swap( lst2 );
+
+ CPPUNIT_CHECK( lst1.front() == 2 );
+ CPPUNIT_CHECK( lst2.front() == 1 );
+ CPPUNIT_CHECK( lst1.size() == 1 );
+ CPPUNIT_CHECK( lst2.size() == 1 );
+
+ lst1.pop_front();
+ lst2.pop_front();
+
+ CPPUNIT_CHECK( lst1.empty() );
+ CPPUNIT_CHECK( lst2.empty() );
+}
+
+namespace foo {
+ class bar {};
+
+ template <class _It>
+ size_t distance(_It, _It);
+}
+
+void ListTest::adl()
+{
+ list<foo::bar> lbar;
+ CPPUNIT_ASSERT( lbar.size() == 0);
+}
+
+#if !defined (STLPORT) || \
+ !defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/* Simple compilation test: Check that nested types like iterator
+ * can be access even if type used to instanciate container is not
+ * yet completely defined.
+ */
+class IncompleteClass
+{
+ list<IncompleteClass> instances;
+ typedef list<IncompleteClass>::iterator it;
+};
+#endif
diff --git a/test/unit/locale_header_test.cpp b/test/unit/locale_header_test.cpp
new file mode 100644
index 0000000..bb2dec1
--- /dev/null
+++ b/test/unit/locale_header_test.cpp
@@ -0,0 +1,10 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#if !defined (_STLP_NO_IOSTREAMS)
+# include <locale>
+#endif
diff --git a/test/unit/locale_test.cpp b/test/unit/locale_test.cpp
new file mode 100644
index 0000000..71d3da9
--- /dev/null
+++ b/test/unit/locale_test.cpp
@@ -0,0 +1,337 @@
+#include "locale_test.h"
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <sstream>
+# include <locale>
+# include <stdexcept>
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+static const char* tested_locales[] = {
+//name,
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ "fr_FR",
+ "ru_RU.koi8r",
+ "en_GB",
+ "en_US",
+# endif
+ "",
+ "C"
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(LocaleTest);
+
+//
+// tests implementation
+//
+typedef void (LocaleTest::*_Test) (const locale&);
+static void test_supported_locale(LocaleTest &inst, _Test __test) {
+ size_t n = sizeof(tested_locales) / sizeof(tested_locales[0]);
+ for (size_t i = 0; i < n; ++i) {
+ locale loc;
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try {
+# endif
+ locale tmp(tested_locales[i]);
+ loc = tmp;
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ }
+ catch (runtime_error const&) {
+ //This locale is not supported.
+ continue;
+ }
+# endif
+ CPPUNIT_MESSAGE( loc.name().c_str() );
+ (inst.*__test)(loc);
+ }
+}
+
+void LocaleTest::locale_by_name() {
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ /*
+ * Check of the 22.1.1.2.7 standard point. Construction of a locale
+ * instance from a null pointer or an unknown name should result in
+ * a runtime_error exception.
+ */
+ try {
+ locale loc(static_cast<char const*>(0));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc("yasli_language");
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ string very_large_locale_name(1024, '?');
+ locale loc(very_large_locale_name.c_str());
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+#if defined (STLPORT) || !defined (_MSC_VER) || (_MSC_VER > 1400)
+ try {
+ string very_large_locale_name("LC_CTYPE=");
+ very_large_locale_name.append(1024, '?');
+ locale loc(very_large_locale_name.c_str());
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ string very_large_locale_name("LC_ALL=");
+ very_large_locale_name.append(1024, '?');
+ locale loc(very_large_locale_name.c_str());
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+#endif
+
+ try {
+ locale loc("C");
+ }
+ catch (runtime_error const& /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ // On platform without real localization support we should rely on the "C" locale facet.
+ locale loc("");
+ }
+ catch (runtime_error const& /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+# endif
+}
+
+void LocaleTest::loc_has_facet() {
+ locale loc("C");
+ typedef numpunct<char> implemented_facet;
+ CPPUNIT_ASSERT( has_facet<implemented_facet>(loc) );
+ /*
+ typedef num_put<char, back_insert_iterator<string> > not_implemented_facet;
+ CPPUNIT_ASSERT( !has_facet<not_implemented_facet>(loc) );
+ */
+}
+
+void LocaleTest::locale_init_problem() {
+# if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES)
+ test_supported_locale(*this, &LocaleTest::_locale_init_problem);
+# endif
+}
+
+/*
+ * Creation of a locale instance imply initialization of some STLport internal
+ * static objects first. We use a static instance of locale to check that this
+ * initialization is done correctly.
+ */
+static locale global_loc;
+static locale other_loc("");
+
+# if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES)
+void LocaleTest::_locale_init_problem( const locale& loc)
+{
+# if !defined (__APPLE__) && !defined (__FreeBSD__) || \
+ !defined(__GNUC__) || ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__> 3)))
+ typedef codecvt<char,char,mbstate_t> my_facet;
+# else
+// std::mbstate_t required for gcc 3.3.2 on FreeBSD...
+// I am not sure what key here---FreeBSD or 3.3.2...
+// - ptr 2005-04-04
+ typedef codecvt<char,char,std::mbstate_t> my_facet;
+# endif
+
+ locale loc_ref(global_loc);
+ {
+ locale gloc( loc_ref, new my_facet() );
+ CPPUNIT_ASSERT( has_facet<my_facet>( gloc ) );
+ //The following code is just here to try to confuse the reference counting underlying mecanism:
+ locale::global( locale::classic() );
+ locale::global( gloc );
+ }
+
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try {
+# endif
+ ostringstream os("test") ;
+ locale loc2( loc, new my_facet() );
+ CPPUNIT_ASSERT( has_facet<my_facet>( loc2 ) );
+ os.imbue( loc2 );
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ }
+ catch ( runtime_error& ) {
+ CPPUNIT_FAIL;
+ }
+ catch ( ... ) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try {
+# endif
+ ostringstream os2("test2");
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ }
+ catch ( runtime_error& ) {
+ CPPUNIT_FAIL;
+ }
+ catch ( ... ) {
+ CPPUNIT_FAIL;
+ }
+# endif
+}
+#endif
+
+void LocaleTest::default_locale()
+{
+ locale loc( "" );
+}
+
+class dummy_facet : public locale::facet {
+public:
+ static locale::id id;
+};
+
+locale::id dummy_facet::id;
+
+void LocaleTest::combine()
+{
+# if (!defined (STLPORT) || \
+ (defined (_STLP_USE_EXCEPTIONS) && !defined (_STLP_NO_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)))
+ {
+ try {
+ locale loc("");
+ if (!has_facet<messages<char> >(loc)) {
+ loc.combine<messages<char> >(loc);
+ CPPUNIT_FAIL;
+ }
+ }
+ catch (const runtime_error & /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ }
+
+ try {
+ locale loc;
+ if (!has_facet<dummy_facet>(loc)) {
+ loc.combine<dummy_facet>(loc);
+ CPPUNIT_FAIL;
+ }
+ }
+ catch (const runtime_error & /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ }
+ }
+
+ locale loc1(locale::classic()), loc2;
+ size_t loc1_index = 0;
+ for (size_t i = 0; _get_ref_monetary(i) != 0; ++i) {
+ try {
+ {
+ locale loc(_get_ref_monetary_name(_get_ref_monetary(i)));
+ if (loc1 == locale::classic())
+ {
+ loc1 = loc;
+ loc1_index = i;
+ continue;
+ }
+ else
+ {
+ loc2 = loc;
+ }
+ }
+
+ //We can start the test
+ ostringstream ostr;
+ ostr << "combining '" << loc2.name() << "' money facets with '" << loc1.name() << "'";
+ CPPUNIT_MESSAGE( ostr.str().c_str() );
+
+ //We are going to combine money facets as all formats are different.
+ {
+ //We check that resulting locale has correctly acquire loc2 facets.
+ locale loc = loc1.combine<moneypunct<char, true> >(loc2);
+ loc = loc.combine<moneypunct<char, false> >(loc2);
+ loc = loc.combine<money_put<char> >(loc2);
+ loc = loc.combine<money_get<char> >(loc2);
+
+ //Check loc has the correct facets:
+ _money_put_get2(loc2, loc, _get_ref_monetary(i));
+
+ //Check loc1 has not been impacted:
+ _money_put_get2(loc1, loc1, _get_ref_monetary(loc1_index));
+
+ //Check loc2 has not been impacted:
+ _money_put_get2(loc2, loc2, _get_ref_monetary(i));
+ }
+ {
+ //We check that resulting locale has not wrongly acquire loc1 facets that hasn't been combine:
+ locale loc = loc2.combine<numpunct<char> >(loc1);
+ loc = loc.combine<time_put<char> >(loc1);
+ loc = loc.combine<time_get<char> >(loc1);
+
+ //Check loc has the correct facets:
+ _money_put_get2(loc2, loc, _get_ref_monetary(i));
+
+ //Check loc1 has not been impacted:
+ _money_put_get2(loc1, loc1, _get_ref_monetary(loc1_index));
+
+ //Check loc2 has not been impacted:
+ _money_put_get2(loc2, loc2, _get_ref_monetary(i));
+ }
+
+ {
+ // Check auto combination do not result in weird reference counting behavior
+ // (might generate a crash).
+ loc1.combine<numpunct<char> >(loc1);
+ }
+
+ loc1 = loc2;
+ loc1_index = i;
+ }
+ catch (runtime_error const&) {
+ //This locale is not supported.
+ continue;
+ }
+ }
+# endif
+}
+
+#endif
diff --git a/test/unit/locale_test.h b/test/unit/locale_test.h
new file mode 100644
index 0000000..ab97ac4
--- /dev/null
+++ b/test/unit/locale_test.h
@@ -0,0 +1,94 @@
+#include <string>
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <iosfwd>
+
+# include "cppunit/cppunit_proxy.h"
+# include <locale>
+
+struct ref_monetary;
+struct ref_locale;
+
+# if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+# define STD std::
+# else
+# define STD
+# endif
+
+//
+// TestCase class
+//
+class LocaleTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(LocaleTest);
+# if defined (STLPORT) && !defined (_STLP_USE_EXCEPTIONS)
+ CPPUNIT_IGNORE;
+# endif
+ CPPUNIT_TEST(locale_by_name);
+ CPPUNIT_TEST(moneypunct_by_name);
+ CPPUNIT_TEST(time_by_name);
+ CPPUNIT_TEST(numpunct_by_name);
+ CPPUNIT_TEST(ctype_by_name);
+ CPPUNIT_TEST(collate_by_name);
+ CPPUNIT_TEST(messages_by_name);
+ CPPUNIT_STOP_IGNORE;
+ CPPUNIT_TEST(loc_has_facet);
+ CPPUNIT_TEST(num_put_get);
+ CPPUNIT_TEST(money_put_get);
+ CPPUNIT_TEST(money_put_X_bug);
+ CPPUNIT_TEST(time_put_get);
+ CPPUNIT_TEST(collate_facet);
+ CPPUNIT_TEST(ctype_facet);
+# if defined (STLPORT) && defined (_STLP_NO_MEMBER_TEMPLATES)
+ CPPUNIT_IGNORE;
+# endif
+ CPPUNIT_TEST(locale_init_problem);
+ CPPUNIT_STOP_IGNORE;
+ CPPUNIT_TEST(default_locale);
+# if !defined (STLPORT)
+ CPPUNIT_IGNORE;
+# endif
+ CPPUNIT_STOP_IGNORE;
+#if (defined (STLPORT) && \
+ (!defined (_STLP_USE_EXCEPTIONS) || defined (_STLP_NO_MEMBER_TEMPLATES) || defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)))
+ CPPUNIT_IGNORE;
+# endif
+ CPPUNIT_TEST(combine);
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ void locale_by_name();
+ void loc_has_facet();
+ void num_put_get();
+ void numpunct_by_name();
+ void time_put_get();
+ void time_by_name();
+ void collate_facet();
+ void collate_by_name();
+ void ctype_facet();
+ void ctype_by_name();
+ void locale_init_problem();
+ void money_put_get();
+ void money_put_X_bug();
+ void moneypunct_by_name();
+ void default_locale();
+ void combine();
+ void messages_by_name();
+private:
+ void _loc_has_facet( const STD locale& );
+ void _num_put_get( const STD locale&, const ref_locale* );
+ void _time_put_get( const STD locale& );
+ void _ctype_facet( const STD locale& );
+ void _ctype_facet_w( const STD locale& );
+ void _locale_init_problem( const STD locale& );
+
+ static const ref_monetary* _get_ref_monetary(size_t);
+ static const char* _get_ref_monetary_name(const ref_monetary*);
+
+ void _money_put_get( const STD locale&, const ref_monetary* );
+ void _money_put_get2( const STD locale& loc, const STD locale& streamLoc, const ref_monetary* );
+ void _money_put_X_bug( const STD locale&, const ref_monetary* );
+};
+
+# undef STD
+#endif
+
diff --git a/test/unit/logic_test.cpp b/test/unit/logic_test.cpp
new file mode 100644
index 0000000..69ceea1
--- /dev/null
+++ b/test/unit/logic_test.cpp
@@ -0,0 +1,65 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class LogicTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(LogicTest);
+ CPPUNIT_TEST(logicand);
+ CPPUNIT_TEST(logicnot);
+ CPPUNIT_TEST(logicor);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void logicand();
+ void logicnot();
+ void logicor();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(LogicTest);
+
+//
+// tests implementation
+//
+void LogicTest::logicand()
+{
+ bool input1 [4] = { true, true, false, true };
+ bool input2 [4] = { false, true, false, false };
+
+ bool output [4];
+ transform((bool*)input1, (bool*)input1 + 4, (bool*)input2, (bool*)output, logical_and<bool>());
+
+ CPPUNIT_ASSERT(output[0]==false);
+ CPPUNIT_ASSERT(output[1]==true);
+ CPPUNIT_ASSERT(output[2]==false);
+ CPPUNIT_ASSERT(output[3]==false);
+}
+void LogicTest::logicnot()
+{
+ bool input [7] = { 1, 0, 0, 1, 1, 1, 1 };
+
+ int n = count_if(input, input + 7, logical_not<bool>());
+ CPPUNIT_ASSERT( n == 2 );
+}
+void LogicTest::logicor()
+{
+ bool input1 [4] = { true, true, false, true };
+ bool input2 [4] = { false, true, false, false };
+
+ bool output [4];
+ transform((bool*)input1, (bool*)input1 + 4, (bool*)input2, (bool*)output, logical_or<bool>());
+
+ CPPUNIT_ASSERT(output[0]==true);
+ CPPUNIT_ASSERT(output[1]==true);
+ CPPUNIT_ASSERT(output[2]==false);
+ CPPUNIT_ASSERT(output[3]==true);
+}
diff --git a/test/unit/macro_checks.cpp b/test/unit/macro_checks.cpp
new file mode 100644
index 0000000..171a9fa
--- /dev/null
+++ b/test/unit/macro_checks.cpp
@@ -0,0 +1,115 @@
+#include <cstdio>
+#include <cwchar>
+#include <climits>
+
+#if !defined (CHAR_BIT)
+# error Missing CHAR_BIT definition.
+#endif
+
+#if (CHAR_BIT < 0)
+# error Weird WCHAR_BIT value.
+#endif
+
+#if !defined (CHAR_MAX)
+# error Missing CHAR_MAX definition.
+#endif
+
+#if !defined (CHAR_MIN)
+# error Missing CHAR_MIN definition.
+#endif
+
+#if !(CHAR_MIN < CHAR_MAX)
+# error Weird CHAR_MIN or CHAR_MAX macro values.
+#endif
+
+#if !defined (INT_MAX)
+# error Missing INT_MAX definition.
+#endif
+
+#if !defined (INT_MIN)
+# error Missing INT_MIN definition.
+#endif
+
+#if !(INT_MIN < INT_MAX)
+# error Weird INT_MIN or INT_MAX macro values.
+#endif
+
+#if !defined (LONG_MAX)
+# error Missing LONG_MAX definition.
+#endif
+
+#if !defined (LONG_MIN)
+# error Missing LONG_MIN definition.
+#endif
+
+#if !(LONG_MIN < LONG_MAX)
+# error Weird LONG_MIN or LONG_MAX macro values.
+#endif
+
+#if !defined (SCHAR_MAX)
+# error Missing SCHAR_MAX definition.
+#endif
+
+#if !defined (SCHAR_MIN)
+# error Missing SCHAR_MIN definition.
+#endif
+
+#if !(SCHAR_MIN < SCHAR_MAX)
+# error Weird SCHAR_MIN or SCHAR_MAX macro values.
+#endif
+
+#if !defined (SHRT_MAX)
+# error Missing SHRT_MAX definition.
+#endif
+
+#if !defined (SHRT_MIN)
+# error Missing SHRT_MIN definition.
+#endif
+
+#if !(SHRT_MIN < SHRT_MAX)
+# error Weird SHRT_MIN or SHRT_MAX macro values.
+#endif
+
+#if !defined (WCHAR_MIN)
+# error Missing WCHAR_MIN definition.
+#endif
+
+#if !defined (WCHAR_MAX)
+# error Missing WCHAR_MAX definition.
+#endif
+
+#if !(WCHAR_MIN < WCHAR_MAX)
+# error Weird WCHAR_MIN or WCHAR_MAX macro value.
+#endif
+
+#if !defined (UCHAR_MAX)
+# error Missing UCHAR_MAX definition.
+#endif
+
+#if (UCHAR_MAX < 0)
+# error Weird UCHAR_MAX macro value.
+#endif
+
+#if !defined (UINT_MAX)
+# error Missing UINT_MAX definition.
+#endif
+
+#if (UINT_MAX < 0)
+# error Weird UINT_MAX macro value.
+#endif
+
+#if !defined (ULONG_MAX)
+# error Missing ULONG_MAX definition.
+#endif
+
+#if (ULONG_MAX < 0)
+# error Weird ULONG_MAX macro value.
+#endif
+
+#if !defined (USHRT_MAX)
+# error Missing USHRT_MAX definition.
+#endif
+
+#if (USHRT_MAX < 0)
+# error Weird USHRT_MAX macro value.
+#endif
diff --git a/test/unit/map_header_test.cpp b/test/unit/map_header_test.cpp
new file mode 100644
index 0000000..84cf154
--- /dev/null
+++ b/test/unit/map_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <map>
diff --git a/test/unit/map_test.cpp b/test/unit/map_test.cpp
new file mode 100644
index 0000000..46256a9
--- /dev/null
+++ b/test/unit/map_test.cpp
@@ -0,0 +1,454 @@
+//Has to be first for StackAllocator swap overload to be taken
+//into account (at least using GCC 4.0.1)
+#include "stack_allocator.h"
+
+#include <map>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class MapTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(MapTest);
+ CPPUNIT_TEST(map1);
+ CPPUNIT_TEST(mmap1);
+ CPPUNIT_TEST(mmap2);
+ CPPUNIT_TEST(iterators);
+ CPPUNIT_TEST(equal_range);
+ CPPUNIT_TEST(allocator_with_state);
+#if !defined (STLPORT) || !defined (_STLP_USE_CONTAINERS_EXTENSION)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(template_methods);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void map1();
+ void mmap1();
+ void mmap2();
+ void iterators();
+ void equal_range();
+ void allocator_with_state();
+ void template_methods();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(MapTest);
+
+//
+// tests implementation
+//
+void MapTest::map1()
+{
+ typedef map<char, int, less<char> > maptype;
+ maptype m;
+ // Store mappings between roman numerals and decimals.
+ m['l'] = 50;
+ m['x'] = 20; // Deliberate mistake.
+ m['v'] = 5;
+ m['i'] = 1;
+// cout << "m['x'] = " << m['x'] << endl;
+ CPPUNIT_ASSERT( m['x']== 20 );
+ m['x'] = 10; // Correct mistake.
+ CPPUNIT_ASSERT( m['x']== 10 );
+ CPPUNIT_ASSERT( m['z']== 0 );
+ //cout << "m['z'] = " << m['z'] << endl; // Note default value is added.
+ CPPUNIT_ASSERT( m.count('z') == 1 );
+ //cout << "m.count('z') = " << m.count('z') << endl;
+ pair<maptype::iterator, bool> p = m.insert(pair<const char, int>('c', 100));
+ CPPUNIT_ASSERT( p.second );
+ CPPUNIT_ASSERT( p.first != m.end() );
+ CPPUNIT_ASSERT( (*p.first).first == 'c' );
+ CPPUNIT_ASSERT( (*p.first).second == 100 );
+
+ p = m.insert(pair<const char, int>('c', 100));
+ CPPUNIT_ASSERT( !p.second ); // already existing pair
+ CPPUNIT_ASSERT( p.first != m.end() );
+ CPPUNIT_ASSERT( (*p.first).first == 'c' );
+ CPPUNIT_ASSERT( (*p.first).second == 100 );
+}
+
+void MapTest::mmap1()
+{
+ typedef multimap<char, int, less<char> > mmap;
+ mmap m;
+ CPPUNIT_ASSERT(m.count('X')==0);
+
+ m.insert(pair<const char, int>('X', 10)); // Standard way.
+ CPPUNIT_ASSERT(m.count('X')==1);
+
+ m.insert(pair<const char, int>('X', 20)); // jbuck: standard way
+ CPPUNIT_ASSERT(m.count('X')==2);
+
+ m.insert(pair<const char, int>('Y', 32)); // jbuck: standard way
+ mmap::iterator i = m.find('X'); // Find first match.
+#ifndef _STLP_CONST
+# define _STLP_CONST const
+#endif
+ pair<_STLP_CONST char, int> p('X', 10);
+ CPPUNIT_ASSERT(*i == p);
+ CPPUNIT_ASSERT((*i).first == 'X');
+ CPPUNIT_ASSERT((*i).second == 10);
+ i++;
+ CPPUNIT_ASSERT((*i).first == 'X');
+ CPPUNIT_ASSERT((*i).second == 20);
+ i++;
+ CPPUNIT_ASSERT((*i).first == 'Y');
+ CPPUNIT_ASSERT((*i).second == 32);
+ i++;
+ CPPUNIT_ASSERT(i == m.end());
+
+ size_t count = m.erase('X');
+ CPPUNIT_ASSERT(count==2);
+}
+void MapTest::mmap2()
+{
+ typedef pair<const int, char> pair_type;
+
+ pair_type p1(3, 'c');
+ pair_type p2(6, 'f');
+ pair_type p3(1, 'a');
+ pair_type p4(2, 'b');
+ pair_type p5(3, 'x');
+ pair_type p6(6, 'f');
+
+ typedef multimap<int, char, less<int> > mmap;
+
+ pair_type array [] = {
+ p1,
+ p2,
+ p3,
+ p4,
+ p5,
+ p6
+ };
+
+ mmap m(array + 0, array + 6);
+ mmap::iterator i;
+ i = m.lower_bound(3);
+ CPPUNIT_ASSERT((*i).first==3);
+ CPPUNIT_ASSERT((*i).second=='c');
+
+ i = m.upper_bound(3);
+ CPPUNIT_ASSERT((*i).first==6);
+ CPPUNIT_ASSERT((*i).second=='f');
+}
+
+
+void MapTest::iterators()
+{
+ typedef map<int, char, less<int> > int_map;
+ int_map imap;
+ {
+ int_map::iterator ite(imap.begin());
+ int_map::const_iterator cite(imap.begin());
+ CPPUNIT_ASSERT( ite == cite );
+ CPPUNIT_ASSERT( !(ite != cite) );
+ CPPUNIT_ASSERT( cite == ite );
+ CPPUNIT_ASSERT( !(cite != ite) );
+ }
+
+ typedef multimap<int, char, less<int> > mmap;
+ typedef mmap::value_type pair_type;
+
+ pair_type p1(3, 'c');
+ pair_type p2(6, 'f');
+ pair_type p3(1, 'a');
+ pair_type p4(2, 'b');
+ pair_type p5(3, 'x');
+ pair_type p6(6, 'f');
+
+ pair_type array [] = {
+ p1,
+ p2,
+ p3,
+ p4,
+ p5,
+ p6
+ };
+
+ mmap m(array+0, array + 6);
+
+ {
+ mmap::iterator ite(m.begin());
+ mmap::const_iterator cite(m.begin());
+ //test compare between const_iterator and iterator
+ CPPUNIT_ASSERT( ite == cite );
+ CPPUNIT_ASSERT( !(ite != cite) );
+ CPPUNIT_ASSERT( cite == ite );
+ CPPUNIT_ASSERT( !(cite != ite) );
+ }
+
+#if 0
+ /*
+ * A check that map and multimap iterators are NOT comparable
+ * the following code should generate a compile time error
+ */
+ {
+ int_map::iterator mite(imap.begin());
+ int_map::const_iterator mcite(imap.begin());
+ mmap::iterator mmite(m.begin());
+ mmap::const_iterator mmcite(m.begin());
+ CPPUNIT_ASSERT( !(mite == mmite) );
+ CPPUNIT_ASSERT( !(mcite == mmcite) );
+ CPPUNIT_ASSERT( mite != mmite );
+ CPPUNIT_ASSERT( mcite != mmcite );
+ CPPUNIT_ASSERT( !(mite == mmcite) );
+ CPPUNIT_ASSERT( !(mite == mmcite) );
+ CPPUNIT_ASSERT( mite != mmcite );
+ CPPUNIT_ASSERT( mite != mmcite );
+ }
+
+#endif
+
+ mmap::reverse_iterator ri = m.rbegin();
+ CPPUNIT_ASSERT( ri != m.rend() );
+ CPPUNIT_ASSERT( ri == m.rbegin() );
+ CPPUNIT_ASSERT( (*ri).first == 6 );
+ CPPUNIT_ASSERT( (*ri++).second == 'f' );
+ CPPUNIT_ASSERT( (*ri).first == 6 );
+ CPPUNIT_ASSERT( (*ri).second == 'f' );
+
+ mmap const& cm = m;
+ mmap::const_reverse_iterator rci = cm.rbegin();
+ CPPUNIT_ASSERT( rci != cm.rend() );
+ CPPUNIT_ASSERT( (*rci).first == 6 );
+ CPPUNIT_ASSERT( (*rci++).second == 'f' );
+ CPPUNIT_ASSERT( (*rci).first == 6 );
+ CPPUNIT_ASSERT( (*rci).second == 'f' );
+}
+
+void MapTest::equal_range()
+{
+ typedef map<char, int, less<char> > maptype;
+ {
+ maptype m;
+ m['x'] = 10;
+
+ pair<maptype::iterator, maptype::iterator> ret;
+ ret = m.equal_range('x');
+ CPPUNIT_ASSERT( ret.first != ret.second );
+ CPPUNIT_ASSERT( (*(ret.first)).first == 'x' );
+ CPPUNIT_ASSERT( (*(ret.first)).second == 10 );
+ CPPUNIT_ASSERT( ++(ret.first) == ret.second );
+ }
+ {
+ {
+ maptype m;
+
+ maptype::iterator i = m.lower_bound( 'x' );
+ CPPUNIT_ASSERT( i == m.end() );
+
+ i = m.upper_bound( 'x' );
+ CPPUNIT_ASSERT( i == m.end() );
+
+ pair<maptype::iterator, maptype::iterator> ret;
+ ret = m.equal_range('x');
+ CPPUNIT_ASSERT( ret.first == ret.second );
+ CPPUNIT_ASSERT( ret.first == m.end() );
+ }
+
+ {
+ const maptype m;
+ pair<maptype::const_iterator, maptype::const_iterator> ret;
+ ret = m.equal_range('x');
+ CPPUNIT_ASSERT( ret.first == ret.second );
+ CPPUNIT_ASSERT( ret.first == m.end() );
+ }
+ }
+}
+
+void MapTest::allocator_with_state()
+{
+ char buf1[1024];
+ StackAllocator<pair<const int, int> > stack1(buf1, buf1 + sizeof(buf1));
+
+ char buf2[1024];
+ StackAllocator<pair<const int, int> > stack2(buf2, buf2 + sizeof(buf2));
+
+ {
+ typedef map<int, int, less<int>, StackAllocator<pair<const int, int> > > MapInt;
+ less<int> intLess;
+ MapInt mint1(intLess, stack1);
+ int i;
+ for (i = 0; i < 5; ++i)
+ mint1.insert(MapInt::value_type(i, i));
+ MapInt mint1Cpy(mint1);
+
+ MapInt mint2(intLess, stack2);
+ for (; i < 10; ++i)
+ mint2.insert(MapInt::value_type(i, i));
+ MapInt mint2Cpy(mint2);
+
+ mint1.swap(mint2);
+
+ CPPUNIT_ASSERT( mint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( mint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( mint1 == mint2Cpy );
+ CPPUNIT_ASSERT( mint2 == mint1Cpy );
+ CPPUNIT_ASSERT( mint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( mint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_ASSERT( stack1.ok() );
+ CPPUNIT_ASSERT( stack2.ok() );
+}
+
+struct Key
+{
+ Key() : m_data(0) {}
+ explicit Key(int data) : m_data(data) {}
+
+ int m_data;
+};
+
+struct KeyCmp
+{
+ bool operator () (Key lhs, Key rhs) const
+ { return lhs.m_data < rhs.m_data; }
+
+ bool operator () (Key lhs, int rhs) const
+ { return lhs.m_data < rhs; }
+
+ bool operator () (int lhs, Key rhs) const
+ { return lhs < rhs.m_data; }
+};
+
+struct KeyCmpPtr
+{
+ bool operator () (Key const volatile *lhs, Key const volatile *rhs) const
+ { return (*lhs).m_data < (*rhs).m_data; }
+
+ bool operator () (Key const volatile *lhs, int rhs) const
+ { return (*lhs).m_data < rhs; }
+
+ bool operator () (int lhs, Key const volatile *rhs) const
+ { return lhs < (*rhs).m_data; }
+};
+
+void MapTest::template_methods()
+{
+#if defined (STLPORT) && defined (_STLP_USE_CONTAINERS_EXTENSION)
+ {
+ typedef map<Key, int, KeyCmp> Container;
+ typedef Container::value_type value;
+ Container cont;
+ cont.insert(value(Key(1), 1));
+ cont.insert(value(Key(2), 2));
+ cont.insert(value(Key(3), 3));
+ cont.insert(value(Key(4), 4));
+
+ CPPUNIT_ASSERT( cont.count(Key(1)) == 1 );
+ CPPUNIT_ASSERT( cont.count(1) == 1 );
+ CPPUNIT_ASSERT( cont.count(5) == 0 );
+
+ CPPUNIT_ASSERT( cont.find(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.lower_bound(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.upper_bound(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) );
+
+ Container const& ccont = cont;
+ CPPUNIT_ASSERT( ccont.find(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.lower_bound(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.upper_bound(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.end(), ccont.end()) );
+ }
+
+ {
+ typedef map<Key*, int, KeyCmpPtr> Container;
+ typedef Container::value_type value;
+ Container cont;
+ Key key1(1), key2(2), key3(3), key4(4);
+ cont.insert(value(&key1, 1));
+ cont.insert(value(&key2, 2));
+ cont.insert(value(&key3, 3));
+ cont.insert(value(&key4, 4));
+
+ CPPUNIT_ASSERT( cont.count(1) == 1 );
+ CPPUNIT_ASSERT( cont.count(5) == 0 );
+
+ CPPUNIT_ASSERT( cont.find(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.lower_bound(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.upper_bound(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) );
+
+ Container const& ccont = cont;
+ CPPUNIT_ASSERT( ccont.find(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.lower_bound(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.upper_bound(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.begin(), ccont.end()) );
+ }
+ {
+ typedef multimap<Key, int, KeyCmp> Container;
+ typedef Container::value_type value;
+ Container cont;
+ cont.insert(value(Key(1), 1));
+ cont.insert(value(Key(2), 2));
+ cont.insert(value(Key(3), 3));
+ cont.insert(value(Key(4), 4));
+
+ CPPUNIT_ASSERT( cont.count(Key(1)) == 1 );
+ CPPUNIT_ASSERT( cont.count(1) == 1 );
+ CPPUNIT_ASSERT( cont.count(5) == 0 );
+
+ CPPUNIT_ASSERT( cont.find(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.lower_bound(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.upper_bound(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) );
+
+ Container const& ccont = cont;
+ CPPUNIT_ASSERT( ccont.find(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.lower_bound(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.upper_bound(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.end(), ccont.end()) );
+ }
+
+ {
+ typedef multimap<Key const volatile*, int, KeyCmpPtr> Container;
+ typedef Container::value_type value;
+ Container cont;
+ Key key1(1), key2(2), key3(3), key4(4);
+ cont.insert(value(&key1, 1));
+ cont.insert(value(&key2, 2));
+ cont.insert(value(&key3, 3));
+ cont.insert(value(&key4, 4));
+
+ CPPUNIT_ASSERT( cont.count(1) == 1 );
+ CPPUNIT_ASSERT( cont.count(5) == 0 );
+
+ CPPUNIT_ASSERT( cont.find(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.lower_bound(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.upper_bound(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) );
+
+ Container const& ccont = cont;
+ CPPUNIT_ASSERT( ccont.find(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.lower_bound(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.upper_bound(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.begin(), ccont.end()) );
+ }
+#endif
+}
+
+#if !defined (STLPORT) || \
+ !defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (__DMC__)
+/* Simple compilation test: Check that nested types like iterator
+ * can be access even if type used to instanciate container is not
+ * yet completely defined.
+ */
+class IncompleteClass
+{
+ map<IncompleteClass, IncompleteClass> instances;
+ typedef map<IncompleteClass, IncompleteClass>::iterator it;
+ multimap<IncompleteClass, IncompleteClass> minstances;
+ typedef multimap<IncompleteClass, IncompleteClass>::iterator mit;
+};
+# endif
+#endif
diff --git a/test/unit/math_aux.h b/test/unit/math_aux.h
new file mode 100644
index 0000000..c1291af
--- /dev/null
+++ b/test/unit/math_aux.h
@@ -0,0 +1,30 @@
+#ifndef __MATH_AUX_H
+#define __MATH_AUX_H
+
+#include <limits>
+
+#undef __STD
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+# define __STD std::
+#else
+# define __STD
+#endif
+
+/*
+ * This function is not only used to compare floating point values with a tolerance,
+ * it also leads to ambiguity problems if the called functions do not have the
+ * right prototype.
+ */
+template <class _Tp>
+bool are_equals(_Tp val, _Tp ref) {
+ if (val < ref) {
+ return (ref - val) <= __STD numeric_limits<_Tp>::epsilon();
+ }
+ else {
+ return (val - ref) <= __STD numeric_limits<_Tp>::epsilon();
+ }
+}
+
+#undef __STD
+
+#endif // __MATH_AUX_H
diff --git a/test/unit/math_header_test.c b/test/unit/math_header_test.c
new file mode 100644
index 0000000..9557496
--- /dev/null
+++ b/test/unit/math_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <math.h>
diff --git a/test/unit/max_test.cpp b/test/unit/max_test.cpp
new file mode 100644
index 0000000..d8ab006
--- /dev/null
+++ b/test/unit/max_test.cpp
@@ -0,0 +1,64 @@
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class MaxTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(MaxTest);
+ CPPUNIT_TEST(max1);
+ CPPUNIT_TEST(max2);
+ CPPUNIT_TEST(maxelem1);
+ CPPUNIT_TEST(maxelem2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void max1();
+ void max2();
+ void maxelem1();
+ void maxelem2();
+
+ static bool str_compare(const char* a_, const char* b_)
+ { return strcmp(a_, b_) < 0 ? 1 : 0; }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(MaxTest);
+
+//
+// tests implementation
+//
+void MaxTest::max1()
+{
+ int r = max(42, 100);
+ CPPUNIT_ASSERT( r == 100 );
+
+ int t = max(++r, 0);
+ CPPUNIT_ASSERT( t == 101 );
+}
+void MaxTest::max2()
+{
+ const char* r = max((const char*)"shoe", (const char*)"shine", str_compare);
+ CPPUNIT_ASSERT(!strcmp(r, "shoe"));
+}
+void MaxTest::maxelem1()
+{
+ int numbers[6] = { 4, 10, 56, 11, -42, 19 };
+
+ int* r = max_element((int*)numbers, (int*)numbers + 6);
+ CPPUNIT_ASSERT(*r==56);
+}
+void MaxTest::maxelem2()
+{
+ const char* names[] = { "Brett", "Graham", "Jack", "Mike", "Todd" };
+
+ const unsigned namesCt = sizeof(names) / sizeof(names[0]);
+ const char** r = max_element((const char**)names, (const char**)names + namesCt, str_compare);
+ CPPUNIT_ASSERT(!strcmp(*r, "Todd"));
+}
diff --git a/test/unit/memory_header_test.cpp b/test/unit/memory_header_test.cpp
new file mode 100644
index 0000000..afd9f05
--- /dev/null
+++ b/test/unit/memory_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <memory>
diff --git a/test/unit/memory_test.cpp b/test/unit/memory_test.cpp
new file mode 100644
index 0000000..a117109
--- /dev/null
+++ b/test/unit/memory_test.cpp
@@ -0,0 +1,67 @@
+#include <memory>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class MemoryTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(MemoryTest);
+#if defined (_STLP_MSVC) && (_STLP_MSVC < 1310)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(auto_ptr_test);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void auto_ptr_test();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(MemoryTest);
+
+#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1310)
+auto_ptr<int> CreateAutoPtr(int val)
+{ return auto_ptr<int>(new int(val)); }
+
+bool CheckEquality(auto_ptr<int> pint, int val)
+{ return *pint == val; }
+#endif
+
+//
+// tests implementation
+//
+void MemoryTest::auto_ptr_test()
+{
+#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1310)
+ {
+ auto_ptr<int> pint(new int(1));
+ CPPUNIT_ASSERT( *pint == 1 );
+ *pint = 2;
+ CPPUNIT_ASSERT( *pint == 2 );
+ }
+
+ {
+ auto_ptr<int> pint(CreateAutoPtr(3));
+ CPPUNIT_ASSERT( *pint == 3 );
+ CPPUNIT_ASSERT( CheckEquality(pint, 3) );
+ }
+
+ {
+ auto_ptr<const int> pint(new int(2));
+ CPPUNIT_ASSERT( *pint == 2 );
+ }
+ {
+ auto_ptr<volatile int> pint(new int(2));
+ CPPUNIT_ASSERT( *pint == 2 );
+ }
+ {
+ auto_ptr<const volatile int> pint(new int(2));
+ CPPUNIT_ASSERT( *pint == 2 );
+ }
+#endif
+}
diff --git a/test/unit/merge_test.cpp b/test/unit/merge_test.cpp
new file mode 100644
index 0000000..7435b8f
--- /dev/null
+++ b/test/unit/merge_test.cpp
@@ -0,0 +1,97 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+#include <numeric>
+
+#include "iota.h"
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class MergeTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(MergeTest);
+ CPPUNIT_TEST(merge0);
+ CPPUNIT_TEST(merge1);
+ CPPUNIT_TEST(merge2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void merge0();
+ void merge1();
+ void merge2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(MergeTest);
+
+//
+// tests implementation
+//
+void MergeTest::merge0()
+{
+ int numbers1[5] = { 1, 6, 13, 25, 101 };
+ int numbers2[5] = {-5, 26, 36, 46, 99 };
+
+ int result[10];
+ merge((int*)numbers1, (int*)numbers1 + 5, (int*)numbers2, (int*)numbers2 + 5, (int*)result);
+
+ CPPUNIT_ASSERT(result[0]==-5);
+ CPPUNIT_ASSERT(result[1]==1);
+ CPPUNIT_ASSERT(result[2]==6);
+ CPPUNIT_ASSERT(result[3]==13);
+ CPPUNIT_ASSERT(result[4]==25);
+ CPPUNIT_ASSERT(result[5]==26);
+ CPPUNIT_ASSERT(result[6]==36);
+ CPPUNIT_ASSERT(result[7]==46);
+ CPPUNIT_ASSERT(result[8]==99);
+ CPPUNIT_ASSERT(result[9]==101);
+}
+void MergeTest::merge1()
+{
+ vector<int> v1(5);
+ vector<int> v2(v1.size());
+ __iota(v1.begin(), v1.end(), 0);
+ __iota(v2.begin(), v2.end(), 3);
+
+ vector <int> result(v1.size() + v2.size());
+ merge(v1.begin(), v1.end(), v2.begin(), v2.end(), result.begin());
+
+ CPPUNIT_ASSERT(result[0]==0);
+ CPPUNIT_ASSERT(result[1]==1);
+ CPPUNIT_ASSERT(result[2]==2);
+ CPPUNIT_ASSERT(result[3]==3);
+ CPPUNIT_ASSERT(result[4]==3);
+ CPPUNIT_ASSERT(result[5]==4);
+ CPPUNIT_ASSERT(result[6]==4);
+ CPPUNIT_ASSERT(result[7]==5);
+ CPPUNIT_ASSERT(result[8]==6);
+ CPPUNIT_ASSERT(result[9]==7);
+
+}
+void MergeTest::merge2()
+{
+ vector <int> v1(5);
+ vector <int> v2(v1.size());
+ for (int i = 0; (size_t)i < v1.size(); ++i) {
+ v1[i] = 10 - i;
+ v2[i] = 7 - i;
+ }
+ vector<int> result(v1.size() + v2.size());
+ merge(v1.begin(), v1.end(), v2.begin(), v2.end(), result.begin(), greater<int>() );
+
+ CPPUNIT_ASSERT(result[0]==10);
+ CPPUNIT_ASSERT(result[1]==9);
+ CPPUNIT_ASSERT(result[2]==8);
+ CPPUNIT_ASSERT(result[3]==7);
+ CPPUNIT_ASSERT(result[4]==7);
+ CPPUNIT_ASSERT(result[5]==6);
+ CPPUNIT_ASSERT(result[6]==6);
+ CPPUNIT_ASSERT(result[7]==5);
+ CPPUNIT_ASSERT(result[8]==4);
+ CPPUNIT_ASSERT(result[9]==3);
+}
diff --git a/test/unit/messages_facets_test.cpp b/test/unit/messages_facets_test.cpp
new file mode 100644
index 0000000..610bbaa
--- /dev/null
+++ b/test/unit/messages_facets_test.cpp
@@ -0,0 +1,85 @@
+#include "locale_test.h"
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <locale>
+# include <stdexcept>
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+//
+// tests implementation
+//
+void LocaleTest::messages_by_name()
+{
+ /*
+ * Check of the 22.1.1.2.7 standard point. Construction of a locale
+ * instance from a null pointer or an unknown name should result in
+ * a runtime_error exception.
+ */
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+# if defined (STLPORT) || !defined (__GNUC__)
+ try {
+ locale loc(locale::classic(), new messages_byname<char>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new messages_byname<char>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ /*
+ try {
+ locale loc(locale::classic(), new messages_byname<char>(""));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& e) {
+ CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+ */
+
+# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+# if defined (STLPORT) || !defined (__GNUC__)
+ try {
+ locale loc(locale::classic(), new messages_byname<wchar_t>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new messages_byname<wchar_t>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+# endif
+}
+
+#endif
diff --git a/test/unit/mfunptr_test.cpp b/test/unit/mfunptr_test.cpp
new file mode 100644
index 0000000..d29d598
--- /dev/null
+++ b/test/unit/mfunptr_test.cpp
@@ -0,0 +1,230 @@
+#include <functional>
+#include <memory>
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class MemFunPtrTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(MemFunPtrTest);
+ CPPUNIT_TEST(mem_ptr_fun);
+#if defined (STLPORT) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ //This test require partial template specialization feature to avoid the
+ //reference to reference problem. No workaround yet for limited compilers.
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(find);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ // compile test not neccessary to run but...
+ void mem_ptr_fun();
+ void find();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(MemFunPtrTest);
+
+#if defined(_STLP_DONT_RETURN_VOID) && (defined(_STLP_NO_MEMBER_TEMPLATE_CLASSES) && defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION))
+# define _STLP_DONT_TEST_RETURN_VOID
+#endif
+//else there is no workaround for the return void bug
+
+struct S1 { } s1;
+struct S2 { } s2;
+
+int f1(S1&);
+int f2(S1&, S2&);
+int f1c(const S1&);
+int f2c(const S1&, const S2&);
+
+void vf1(S1&);
+void vf2(S1&, S2&);
+void vf1c(const S1&);
+void vf2c(const S1&, const S2&);
+
+class Class {
+public:
+ int f0();
+ int f1(const S1&);
+
+ void vf0();
+ void vf1(const S1&);
+
+ int f0c() const;
+ int f1c(const S1&) const;
+
+ void vf0c() const;
+ void vf1c(const S1&) const;
+};
+
+//
+// tests implementation
+//
+void MemFunPtrTest::mem_ptr_fun()
+{
+ Class obj;
+ const Class& objc = obj;
+
+ // ptr_fun
+
+ ptr_fun(f1)(s1);
+ ptr_fun(f2)(s1, s2);
+
+ ptr_fun(f1c)(s1);
+ ptr_fun(f2c)(s1, s2);
+
+#ifndef _STLP_DONT_TEST_RETURN_VOID
+ ptr_fun(vf1)(s1);
+ ptr_fun(vf2)(s1, s2);
+
+ ptr_fun(vf1c)(s1);
+ ptr_fun(vf2c)(s1, s2);
+#endif /* _STLP_DONT_TEST_RETURN_VOID */
+
+ // mem_fun
+
+ mem_fun(&Class::f0)(&obj);
+ mem_fun(&Class::f1)(&obj, s1);
+
+#ifndef _STLP_DONT_TEST_RETURN_VOID
+ mem_fun(&Class::vf0)(&obj);
+ mem_fun(&Class::vf1)(&obj, s1);
+#endif /* _STLP_DONT_TEST_RETURN_VOID */
+
+ // mem_fun (const)
+
+ mem_fun(&Class::f0c)(&objc);
+ mem_fun(&Class::f1c)(&objc, s1);
+
+#ifndef _STLP_DONT_TEST_RETURN_VOID
+ mem_fun(&Class::vf0c)(&objc);
+ mem_fun(&Class::vf1c)(&objc, s1);
+#endif /* _STLP_DONT_TEST_RETURN_VOID */
+
+ // mem_fun_ref
+
+ mem_fun_ref(&Class::f0)(obj);
+ mem_fun_ref(&Class::f1)(obj, s1);
+
+#ifndef _STLP_DONT_TEST_RETURN_VOID
+ mem_fun_ref(&Class::vf0)(obj);
+ mem_fun_ref(&Class::vf1)(obj, s1);
+#endif /* _STLP_DONT_TEST_RETURN_VOID */
+
+ // mem_fun_ref (const)
+ mem_fun_ref(&Class::f0c)(objc);
+ mem_fun_ref(&Class::f1c)(objc, s1);
+
+#ifndef _STLP_DONT_TEST_RETURN_VOID
+ mem_fun_ref(&Class::vf0c)(objc);
+ mem_fun_ref(&Class::vf1c)(objc, s1);
+#endif /* _STLP_DONT_TEST_RETURN_VOID */
+}
+int f1(S1&)
+{return 1;}
+
+int f2(S1&, S2&)
+{return 2;}
+
+int f1c(const S1&)
+{return 1;}
+
+int f2c(const S1&, const S2&)
+{return 2;}
+
+void vf1(S1&)
+{}
+
+void vf2(S1&, S2&)
+{}
+
+void vf1c(const S1&)
+{}
+
+void vf2c(const S1&, const S2&)
+{}
+
+int Class::f0()
+{return 0;}
+
+int Class::f1(const S1&)
+{return 1;}
+
+void Class::vf0()
+{}
+
+void Class::vf1(const S1&)
+{}
+
+int Class::f0c() const
+{return 0;}
+
+int Class::f1c(const S1&) const
+{return 1;}
+
+void Class::vf0c() const
+{}
+
+void Class::vf1c(const S1&) const
+{}
+
+struct V {
+ public:
+ V(int _v) :
+ v(_v)
+ { }
+
+ bool f( int _v ) const { return (v == _v); }
+
+ int v;
+#if defined (__DMC__)
+ V(){}
+#endif
+};
+
+void MemFunPtrTest::find()
+{
+#if !defined (STLPORT) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ vector<V> v;
+
+ v.push_back( V(1) );
+ v.push_back( V(2) );
+ v.push_back( V(3) );
+
+ // step-by-step complication of work for compiler:
+
+ // step 1:
+ const_mem_fun1_ref_t<bool,V,int> pmf = mem_fun_ref( &V::f );
+ binder2nd<const_mem_fun1_ref_t<bool,V,int> > b(pmf, 2);
+ vector<V>::iterator i = find_if( v.begin(), v.end(), b );
+ CPPUNIT_ASSERT(i != v.end());
+ CPPUNIT_ASSERT(i->v == 2);
+
+ // step 2, just check that compiler understand what pass to bind2nd:
+ binder2nd<const_mem_fun1_ref_t<bool,V,int> > b2 = bind2nd( pmf, 2 );
+
+ // step 3, the same as step 1, but more intellect from compiler required:
+ binder2nd<const_mem_fun1_ref_t<bool,V,int> > b3 = bind2nd( mem_fun_ref( &V::f ), 2 );
+
+ vector<V>::iterator j = find_if( v.begin(), v.end(), b3 );
+ CPPUNIT_ASSERT(j != v.end());
+ CPPUNIT_ASSERT(j->v == 2);
+
+ // step 4, more brief, more complex:
+ vector<V>::iterator k = find_if( v.begin(), v.end(), bind2nd( mem_fun_ref( &V::f ), 2 ) );
+ CPPUNIT_ASSERT(k != v.end());
+ CPPUNIT_ASSERT(k->v == 2);
+#endif
+}
+
+#ifdef _STLP_DONT_TEST_RETURN_VOID
+# undef _STLP_DONT_TEST_RETURN_VOID
+#endif
diff --git a/test/unit/min_test.cpp b/test/unit/min_test.cpp
new file mode 100644
index 0000000..2f45ade
--- /dev/null
+++ b/test/unit/min_test.cpp
@@ -0,0 +1,62 @@
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class MinTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(MinTest);
+ CPPUNIT_TEST(min1);
+ CPPUNIT_TEST(min2);
+ CPPUNIT_TEST(minelem1);
+ CPPUNIT_TEST(minelem2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void min1();
+ void min2();
+ void minelem1();
+ void minelem2();
+ static bool str_compare(const char* a_, const char* b_)
+ { return strcmp(a_, b_) < 0 ? 1 : 0; }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(MinTest);
+
+//
+// tests implementation
+//
+void MinTest::min1()
+{
+ int r = min(42, 100);
+ CPPUNIT_ASSERT( r == 42 );
+
+ r = min(--r, r);
+ CPPUNIT_ASSERT( r == 41 );
+}
+void MinTest::min2()
+{
+ const char* r = min((const char*)"shoe", (const char*)"shine", str_compare);
+ CPPUNIT_ASSERT(!strcmp(r, "shine"));
+}
+void MinTest::minelem1()
+{
+ int numbers[6] = { -10, 15, -100, 36, -242, 42 };
+ int* r = min_element((int*)numbers, (int*)numbers + 6);
+ CPPUNIT_ASSERT(*r==-242);
+}
+void MinTest::minelem2()
+{
+ const char* names[] = { "Brett", "Graham", "Jack", "Mike", "Todd" };
+
+ const unsigned namesCt = sizeof(names) / sizeof(names[0]);
+ const char** r = min_element((const char**)names, (const char**)names + namesCt, str_compare);
+ CPPUNIT_ASSERT(!strcmp(*r, "Brett"));
+}
diff --git a/test/unit/mismatch_test.cpp b/test/unit/mismatch_test.cpp
new file mode 100644
index 0000000..13f7cd0
--- /dev/null
+++ b/test/unit/mismatch_test.cpp
@@ -0,0 +1,82 @@
+#include <numeric>
+#include <vector>
+#include <algorithm>
+
+#include "iota.h"
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class MismatchTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(MismatchTest);
+ CPPUNIT_TEST(mismatch0);
+ CPPUNIT_TEST(mismatch1);
+ CPPUNIT_TEST(mismatch2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void mismatch0();
+ void mismatch1();
+ void mismatch2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(MismatchTest);
+
+//
+// tests implementation
+//
+bool str_equal(const char* a_, const char* b_)
+{
+ return strcmp(a_, b_) == 0 ? 1 : 0;
+}
+void MismatchTest::mismatch0()
+{
+ int n1[5] = { 1, 2, 3, 4, 5 };
+ int n2[5] = { 1, 2, 3, 4, 5 };
+ int n3[5] = { 1, 2, 3, 2, 1 };
+
+ pair <int*, int*> result = mismatch((int*)n1, (int*)n1 + 5, (int*)n2);
+ CPPUNIT_ASSERT(result.first ==(n1 + 5) && result.second ==(n2 + 5));
+
+ result = mismatch((int*)n1, (int*)n1 + 5, (int*)n3);
+ CPPUNIT_ASSERT(!(result.first ==(n1 + 5) && result.second ==(n3 + 5)));
+ CPPUNIT_ASSERT((result.first - n1)==3);
+}
+void MismatchTest::mismatch1()
+{
+ typedef vector<int> IntVec;
+ IntVec v1(10);
+ __iota(v1.begin(), v1.end(), 0);
+ IntVec v2(v1);
+
+ pair <IntVec::iterator, IntVec::iterator> result = mismatch(v1.begin(), v1.end(), v2.begin());
+
+ CPPUNIT_ASSERT(result.first == v1.end() && result.second == v2.end());
+
+ v2[v2.size()/2] = 42;
+ result = mismatch(v1.begin(), v1.end(), v2.begin());
+ CPPUNIT_ASSERT(!(result.first == v1.end() && result.second == v2.end()));
+ CPPUNIT_ASSERT((result.first - v1.begin())==5);
+}
+void MismatchTest::mismatch2()
+{
+ const unsigned size = 5;
+ char const* n1[size] = { "Brett", "Graham", "Jack", "Mike", "Todd" };
+
+ char const* n2[size];
+ copy(n1, n1 + 5, (char const**)n2);
+ pair <char const**, char const**> result = mismatch((char const**)n1, (char const**)n1 + size, (char const**)n2, str_equal);
+
+ CPPUNIT_ASSERT(result.first == n1 + size && result.second == n2 + size);
+
+ n2[2] = "QED";
+ result = mismatch((char const**)n1, (char const**)n1 + size, (char const**)n2, str_equal);
+ CPPUNIT_ASSERT(!(result.first == n2 + size && result.second == n2 + size));
+ CPPUNIT_ASSERT((result.first - n1)==2);
+}
diff --git a/test/unit/modulus_test.cpp b/test/unit/modulus_test.cpp
new file mode 100644
index 0000000..2fab979
--- /dev/null
+++ b/test/unit/modulus_test.cpp
@@ -0,0 +1,40 @@
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class ModulusTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(ModulusTest);
+ CPPUNIT_TEST(modulus0);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void modulus0();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ModulusTest);
+
+//
+// tests implementation
+//
+void ModulusTest::modulus0()
+{
+ int input1 [4] = { 6, 8, 10, 2 };
+ int input2 [4] = { 4, 2, 11, 3 };
+
+ int output [4];
+
+ transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, modulus<int>());
+ CPPUNIT_ASSERT(output[0]==2);
+ CPPUNIT_ASSERT(output[1]==0);
+ CPPUNIT_ASSERT(output[2]==10);
+ CPPUNIT_ASSERT(output[3]==2);
+}
diff --git a/test/unit/money_facets_test.cpp b/test/unit/money_facets_test.cpp
new file mode 100644
index 0000000..5ace770
--- /dev/null
+++ b/test/unit/money_facets_test.cpp
@@ -0,0 +1,655 @@
+#include "locale_test.h"
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <locale>
+# include <sstream>
+# include <stdexcept>
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+struct ref_monetary {
+ const char *name;
+ const char *money_int_prefix;
+ const char *money_int_prefix_old;
+ const char *money_prefix;
+ const char *money_suffix;
+ const char *money_decimal_point;
+ const char *money_thousands_sep;
+};
+
+static const ref_monetary tested_locales[] = {
+//{ name, money_int_prefix, money_int_prefix_old, money_prefix, money_suffix, money_decimal_point, money_thousands_sep},
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ { "fr_FR", "EUR ", "FRF ", "", "", ",",
+# if defined (WIN32) || defined (_WIN32)
+ "\xa0" },
+# else
+ " " },
+# endif
+ { "ru_RU.koi8r", "RUB ", "RUR ", "", "\xd2\xd5\xc2", ".", " " },
+ { "en_GB", "GBP ", "", "\xa3", "", ".", "," },
+ { "en_US", "USD ", "", "$", "", ".", "," },
+# endif
+ { "C", "", "", "", "", " ", " " },
+};
+
+
+const ref_monetary* LocaleTest::_get_ref_monetary(size_t i)
+{
+ if (i < sizeof(tested_locales) / sizeof(tested_locales[0])) {
+ return tested_locales + i;
+ }
+ return 0;
+}
+
+const char* LocaleTest::_get_ref_monetary_name(const ref_monetary* _ref)
+{
+ return _ref->name;
+}
+
+void LocaleTest::_money_put_get( const locale& loc, const ref_monetary* rl )
+{
+ _money_put_get2(loc, loc, rl);
+}
+
+void LocaleTest::_money_put_get2( const locale& loc, const locale& streamLoc, const ref_monetary* prl )
+{
+ const ref_monetary &rl = *prl;
+ CPPUNIT_ASSERT( has_facet<money_put<char> >(loc) );
+ money_put<char> const& fmp = use_facet<money_put<char> >(loc);
+ CPPUNIT_ASSERT( has_facet<money_get<char> >(loc) );
+ money_get<char> const& fmg = use_facet<money_get<char> >(loc);
+
+ ostringstream ostr;
+ ostr.imbue(streamLoc);
+ ostr << showbase;
+
+ //Check a positive value (international format)
+ {
+ string str_res;
+ //money_put
+ {
+ CPPUNIT_ASSERT( (has_facet<moneypunct<char, true> >(loc)) );
+ moneypunct<char, true> const& intl_fmp = use_facet<moneypunct<char, true> >(loc);
+
+ ostreambuf_iterator<char, char_traits<char> > res = fmp.put(ostr, true, ostr, ' ', 123456);
+
+ CPPUNIT_ASSERT( !res.failed() );
+ str_res = ostr.str();
+ //CPPUNIT_MESSAGE(str_res.c_str());
+
+ size_t fieldIndex = 0;
+ size_t index = 0;
+
+ //On a positive value we skip the sign field if exists:
+ if (intl_fmp.pos_format().field[fieldIndex] == money_base::sign) {
+ ++fieldIndex;
+ }
+ // international currency abbreviation, if it is before value
+
+ /*
+ * int_curr_symbol
+ *
+ * The international currency symbol. The operand is a four-character
+ * string, with the first three characters containing the alphabetic
+ * international currency symbol in accordance with those specified
+ * in the ISO 4217 specification. The fourth character is the character used
+ * to separate the international currency symbol from the monetary quantity.
+ *
+ * (http://www.opengroup.org/onlinepubs/7990989775/xbd/locale.html)
+ */
+ string::size_type p = strlen( rl.money_int_prefix );
+ if (p != 0) {
+ CPPUNIT_ASSERT( intl_fmp.pos_format().field[fieldIndex] == money_base::symbol );
+ string::size_type p_old = strlen( rl.money_int_prefix_old );
+ CPPUNIT_ASSERT( (str_res.substr(index, p) == rl.money_int_prefix) ||
+ ((p_old != 0) &&
+ (str_res.substr(index, p_old) == rl.money_int_prefix_old)) );
+ if ( str_res.substr(index, p) == rl.money_int_prefix ) {
+ index += p;
+ } else {
+ index += p_old;
+ }
+ ++fieldIndex;
+ }
+
+ // space after currency
+ if (intl_fmp.pos_format().field[fieldIndex] == money_base::space ||
+ intl_fmp.pos_format().field[fieldIndex] == money_base::none) {
+ // iternational currency symobol has four chars, one of these chars
+ // is separator, so if format has space on this place, it should
+ // be skipped.
+ ++fieldIndex;
+ }
+
+ // sign
+ if (intl_fmp.pos_format().field[fieldIndex] == money_base::sign) {
+ ++fieldIndex;
+ }
+
+ // value
+ CPPUNIT_ASSERT( str_res[index++] == '1' );
+ if (!intl_fmp.grouping().empty()) {
+ CPPUNIT_ASSERT( str_res[index++] == /* intl_fmp.thousands_sep() */ *rl.money_thousands_sep );
+ }
+ CPPUNIT_ASSERT( str_res[index++] == '2' );
+ CPPUNIT_ASSERT( str_res[index++] == '3' );
+ CPPUNIT_ASSERT( str_res[index++] == '4' );
+ if (intl_fmp.frac_digits() != 0) {
+ CPPUNIT_ASSERT( str_res[index++] == /* intl_fmp.decimal_point() */ *rl.money_decimal_point );
+ }
+ CPPUNIT_ASSERT( str_res[index++] == '5' );
+ CPPUNIT_ASSERT( str_res[index++] == '6' );
+ ++fieldIndex;
+
+ // sign
+ if (intl_fmp.pos_format().field[fieldIndex] == money_base::sign) {
+ ++fieldIndex;
+ }
+
+ // space
+ if (intl_fmp.pos_format().field[fieldIndex] == money_base::space ) {
+ CPPUNIT_ASSERT( str_res[index++] == ' ' );
+ ++fieldIndex;
+ }
+
+ // sign
+ if (intl_fmp.pos_format().field[fieldIndex] == money_base::sign) {
+ ++fieldIndex;
+ }
+
+ //as space cannot be last the only left format can be none:
+ while ( fieldIndex < 3 ) {
+ CPPUNIT_ASSERT( intl_fmp.pos_format().field[fieldIndex] == money_base::none );
+ ++fieldIndex;
+ }
+ }
+
+ //money_get
+ {
+ ios_base::iostate err = ios_base::goodbit;
+ string digits;
+
+ istringstream istr(str_res);
+ ostr.str( "" );
+ ostr.clear();
+ fmg.get(istr, istreambuf_iterator<char, char_traits<char> >(), true, ostr, err, digits);
+ CPPUNIT_ASSERT( (err & (ios_base::failbit | ios_base::badbit)) == 0 );
+ CPPUNIT_ASSERT( digits == "123456" );
+ }
+ }
+
+ ostr.str("");
+ //Check a negative value (national format)
+ {
+ CPPUNIT_ASSERT( (has_facet<moneypunct<char, false> >(loc)) );
+ moneypunct<char, false> const& dom_fmp = use_facet<moneypunct<char, false> >(loc);
+ string str_res;
+ //Check money_put
+ {
+ ostreambuf_iterator<char, char_traits<char> > res = fmp.put(ostr, false, ostr, ' ', -123456);
+
+ CPPUNIT_ASSERT( !res.failed() );
+ str_res = ostr.str();
+ //CPPUNIT_MESSAGE(str_res.c_str());
+
+ size_t fieldIndex = 0;
+ size_t index = 0;
+
+ if (dom_fmp.neg_format().field[fieldIndex] == money_base::sign) {
+ CPPUNIT_ASSERT( str_res.substr(index, dom_fmp.negative_sign().size()) == dom_fmp.negative_sign() );
+ index += dom_fmp.negative_sign().size();
+ ++fieldIndex;
+ }
+
+ string::size_type p = strlen( rl.money_prefix );
+ if (p != 0) {
+ CPPUNIT_ASSERT( str_res.substr(index, p) == rl.money_prefix );
+ index += p;
+ ++fieldIndex;
+ }
+ if (dom_fmp.neg_format().field[fieldIndex] == money_base::space ||
+ dom_fmp.neg_format().field[fieldIndex] == money_base::none) {
+ CPPUNIT_ASSERT( str_res[index++] == ' ' );
+ ++fieldIndex;
+ }
+
+ CPPUNIT_ASSERT( str_res[index++] == '1' );
+ if (!dom_fmp.grouping().empty()) {
+ CPPUNIT_ASSERT( str_res[index++] == dom_fmp.thousands_sep() );
+ }
+ CPPUNIT_ASSERT( str_res[index++] == '2' );
+ CPPUNIT_ASSERT( str_res[index++] == '3' );
+ CPPUNIT_ASSERT( str_res[index++] == '4' );
+ if (dom_fmp.frac_digits() != 0) {
+ CPPUNIT_ASSERT( str_res[index++] == dom_fmp.decimal_point() );
+ }
+ CPPUNIT_ASSERT( str_res[index++] == '5' );
+ CPPUNIT_ASSERT( str_res[index++] == '6' );
+ ++fieldIndex;
+
+ //space cannot be last:
+ if ((fieldIndex < 3) &&
+ dom_fmp.neg_format().field[fieldIndex] == money_base::space) {
+ CPPUNIT_ASSERT( str_res[index++] == ' ' );
+ ++fieldIndex;
+ }
+
+ if (fieldIndex == 3) {
+ //If none is last we should not add anything to the resulting string:
+ if (dom_fmp.neg_format().field[fieldIndex] == money_base::none) {
+ CPPUNIT_ASSERT( index == str_res.size() );
+ } else {
+ CPPUNIT_ASSERT( dom_fmp.neg_format().field[fieldIndex] == money_base::symbol );
+ CPPUNIT_ASSERT( str_res.substr(index, strlen(rl.money_suffix)) == rl.money_suffix );
+ }
+ }
+ }
+
+ //money_get
+ {
+ ios_base::iostate err = ios_base::goodbit;
+# if defined (STLPORT)
+ _STLP_LONGEST_FLOAT_TYPE val;
+# else
+ long double val;
+# endif
+
+ istringstream istr(str_res);
+ fmg.get(istr, istreambuf_iterator<char, char_traits<char> >(), false, ostr, err, val);
+ CPPUNIT_ASSERT( (err & (ios_base::failbit | ios_base::badbit)) == 0 );
+ if (dom_fmp.negative_sign().empty()) {
+ //Without negative sign there is no way to guess the resulting amount sign ("C" locale):
+ CPPUNIT_ASSERT( val == 123456 );
+ }
+ else {
+ CPPUNIT_ASSERT( val == -123456 );
+ }
+ }
+ }
+}
+
+
+// Test for bug in case when number of digits in value less then number
+// of digits in fraction. I.e. '9' should be printed as '0.09',
+// if x.frac_digits() == 2.
+
+void LocaleTest::_money_put_X_bug( const locale& loc, const ref_monetary* prl )
+{
+ const ref_monetary &rl = *prl;
+ CPPUNIT_ASSERT( has_facet<money_put<char> >(loc) );
+ money_put<char> const& fmp = use_facet<money_put<char> >(loc);
+
+ ostringstream ostr;
+ ostr.imbue(loc);
+ ostr << showbase;
+
+ // ostr.str("");
+ // Check value with one decimal digit:
+ {
+ CPPUNIT_ASSERT( (has_facet<moneypunct<char, false> >(loc)) );
+ moneypunct<char, false> const& dom_fmp = use_facet<moneypunct<char, false> >(loc);
+ string str_res;
+ // Check money_put
+ {
+ ostreambuf_iterator<char, char_traits<char> > res = fmp.put(ostr, false, ostr, ' ', 9);
+
+ CPPUNIT_ASSERT( !res.failed() );
+ str_res = ostr.str();
+
+ size_t fieldIndex = 0;
+ size_t index = 0;
+
+ if (dom_fmp.pos_format().field[fieldIndex] == money_base::sign) {
+ CPPUNIT_ASSERT( str_res.substr(index, dom_fmp.positive_sign().size()) == dom_fmp.positive_sign() );
+ index += dom_fmp.positive_sign().size();
+ ++fieldIndex;
+ }
+
+ string::size_type p = strlen( rl.money_prefix );
+ if (p != 0) {
+ CPPUNIT_ASSERT( str_res.substr(index, p) == rl.money_prefix );
+ index += p;
+ ++fieldIndex;
+ }
+ if (dom_fmp.neg_format().field[fieldIndex] == money_base::space ||
+ dom_fmp.neg_format().field[fieldIndex] == money_base::none) {
+ CPPUNIT_ASSERT( str_res[index++] == ' ' );
+ ++fieldIndex;
+ }
+ if (dom_fmp.frac_digits() != 0) {
+ CPPUNIT_ASSERT( str_res[index++] == '0' );
+ CPPUNIT_ASSERT( str_res[index++] == dom_fmp.decimal_point() );
+ for ( int fd = 1; fd < dom_fmp.frac_digits(); ++fd ) {
+ CPPUNIT_ASSERT( str_res[index++] == '0' );
+ }
+ }
+ CPPUNIT_ASSERT( str_res[index++] == '9' );
+ ++fieldIndex;
+
+ //space cannot be last:
+ if ((fieldIndex < 3) &&
+ dom_fmp.neg_format().field[fieldIndex] == money_base::space) {
+ CPPUNIT_ASSERT( str_res[index++] == ' ' );
+ ++fieldIndex;
+ }
+
+ if (fieldIndex == 3) {
+ //If none is last we should not add anything to the resulting string:
+ if (dom_fmp.neg_format().field[fieldIndex] == money_base::none) {
+ CPPUNIT_ASSERT( index == str_res.size() );
+ } else {
+ CPPUNIT_ASSERT( dom_fmp.neg_format().field[fieldIndex] == money_base::symbol );
+ CPPUNIT_ASSERT( str_res.substr(index, strlen(rl.money_suffix)) == rl.money_suffix );
+ }
+ }
+ }
+ }
+
+ ostr.str("");
+ // Check value with two decimal digit:
+ {
+ CPPUNIT_ASSERT( (has_facet<moneypunct<char, false> >(loc)) );
+ moneypunct<char, false> const& dom_fmp = use_facet<moneypunct<char, false> >(loc);
+ string str_res;
+ // Check money_put
+ {
+ ostreambuf_iterator<char, char_traits<char> > res = fmp.put(ostr, false, ostr, ' ', 90);
+
+ CPPUNIT_ASSERT( !res.failed() );
+ str_res = ostr.str();
+
+ size_t fieldIndex = 0;
+ size_t index = 0;
+
+ if (dom_fmp.pos_format().field[fieldIndex] == money_base::sign) {
+ CPPUNIT_ASSERT( str_res.substr(index, dom_fmp.positive_sign().size()) == dom_fmp.positive_sign() );
+ index += dom_fmp.positive_sign().size();
+ ++fieldIndex;
+ }
+
+ string::size_type p = strlen( rl.money_prefix );
+ if (p != 0) {
+ CPPUNIT_ASSERT( str_res.substr(index, p) == rl.money_prefix );
+ index += p;
+ ++fieldIndex;
+ }
+ if (dom_fmp.neg_format().field[fieldIndex] == money_base::space ||
+ dom_fmp.neg_format().field[fieldIndex] == money_base::none) {
+ CPPUNIT_ASSERT( str_res[index++] == ' ' );
+ ++fieldIndex;
+ }
+ if (dom_fmp.frac_digits() != 0) {
+ CPPUNIT_ASSERT( str_res[index++] == '0' );
+ CPPUNIT_ASSERT( str_res[index++] == dom_fmp.decimal_point() );
+ for ( int fd = 1; fd < dom_fmp.frac_digits() - 1; ++fd ) {
+ CPPUNIT_ASSERT( str_res[index++] == '0' );
+ }
+ }
+ CPPUNIT_ASSERT( str_res[index++] == '9' );
+ if (dom_fmp.frac_digits() != 0) {
+ CPPUNIT_ASSERT( str_res[index++] == '0' );
+ }
+ ++fieldIndex;
+
+ //space cannot be last:
+ if ((fieldIndex < 3) &&
+ dom_fmp.neg_format().field[fieldIndex] == money_base::space) {
+ CPPUNIT_ASSERT( str_res[index++] == ' ' );
+ ++fieldIndex;
+ }
+
+ if (fieldIndex == 3) {
+ //If none is last we should not add anything to the resulting string:
+ if (dom_fmp.neg_format().field[fieldIndex] == money_base::none) {
+ CPPUNIT_ASSERT( index == str_res.size() );
+ } else {
+ CPPUNIT_ASSERT( dom_fmp.neg_format().field[fieldIndex] == money_base::symbol );
+ CPPUNIT_ASSERT( str_res.substr(index, strlen(rl.money_suffix)) == rl.money_suffix );
+ }
+ }
+ }
+ }
+}
+
+typedef void (LocaleTest::*_Test) (const locale&, const ref_monetary*);
+static void test_supported_locale(LocaleTest& inst, _Test __test) {
+ size_t n = sizeof(tested_locales) / sizeof(tested_locales[0]);
+ for (size_t i = 0; i < n; ++i) {
+ locale loc;
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try
+# endif
+ {
+ locale tmp(tested_locales[i].name);
+ loc = tmp;
+ }
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ catch (runtime_error const&) {
+ //This locale is not supported.
+ continue;
+ }
+# endif
+ CPPUNIT_MESSAGE( loc.name().c_str() );
+ (inst.*__test)(loc, tested_locales + i);
+
+ {
+ locale tmp(locale::classic(), tested_locales[i].name, locale::monetary);
+ loc = tmp;
+ }
+ (inst.*__test)(loc, tested_locales + i);
+
+ {
+ locale tmp0(locale::classic(), new moneypunct_byname<char, true>(tested_locales[i].name));
+ locale tmp1(tmp0, new moneypunct_byname<char, false>(tested_locales[i].name));
+ loc = tmp1;
+ }
+ (inst.*__test)(loc, tested_locales + i);
+ }
+}
+
+void LocaleTest::money_put_get()
+{ test_supported_locale(*this, &LocaleTest::_money_put_get); }
+
+void LocaleTest::money_put_X_bug()
+{ test_supported_locale(*this, &LocaleTest::_money_put_X_bug); }
+
+void LocaleTest::moneypunct_by_name()
+{
+ /*
+ * Check of the 22.1.1.2.7 standard point. Construction of a locale
+ * instance from a null pointer or an unknown name should result in
+ * a runtime_error exception.
+ */
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+# if defined (STLPORT) || !defined (__GNUC__)
+ try {
+ locale loc(locale::classic(), new moneypunct_byname<char, true>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new moneypunct_byname<char, true>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ string veryLongFacetName("LC_MONETARY=");
+ veryLongFacetName.append(512, '?');
+ locale loc(locale::classic(), new moneypunct_byname<char, true>(veryLongFacetName.c_str()));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+# if defined (STLPORT) || !defined (__GNUC__)
+ try {
+ locale loc(locale::classic(), new moneypunct_byname<char, false>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new moneypunct_byname<char, false>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ string veryLongFacetName("LC_MONETARY=");
+ veryLongFacetName.append(512, '?');
+ locale loc(locale::classic(), new moneypunct_byname<char, false>(veryLongFacetName.c_str()));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), new moneypunct_byname<char, false>("C"));
+ moneypunct<char, false> const& cfacet_byname = use_facet<moneypunct<char, false> >(loc);
+ moneypunct<char, false> const& cfacet = use_facet<moneypunct<char, false> >(locale::classic());
+
+ money_base::pattern cp = cfacet.pos_format();
+ money_base::pattern cp_bn = cfacet_byname.pos_format();
+ CPPUNIT_CHECK( cp_bn.field[0] == cp.field[0] );
+ CPPUNIT_CHECK( cp_bn.field[1] == cp.field[1] );
+ CPPUNIT_CHECK( cp_bn.field[2] == cp.field[2] );
+ CPPUNIT_CHECK( cp_bn.field[3] == cp.field[3] );
+
+ CPPUNIT_CHECK( cfacet_byname.frac_digits() == cfacet.frac_digits() );
+ if (cfacet_byname.frac_digits() != 0)
+ CPPUNIT_CHECK( cfacet_byname.decimal_point() == cfacet.decimal_point() );
+ CPPUNIT_CHECK( cfacet_byname.grouping() == cfacet.grouping() );
+ if (!cfacet_byname.grouping().empty())
+ CPPUNIT_CHECK( cfacet_byname.thousands_sep() == cfacet.thousands_sep() );
+ CPPUNIT_CHECK( cfacet_byname.positive_sign() == cfacet.positive_sign() );
+ CPPUNIT_CHECK( cfacet_byname.negative_sign() == cfacet.negative_sign() );
+ }
+ catch (runtime_error const& /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), new moneypunct_byname<char, true>("C"));
+ moneypunct<char, true> const& cfacet_byname = use_facet<moneypunct<char, true> >(loc);
+ moneypunct<char, true> const& cfacet = use_facet<moneypunct<char, true> >(locale::classic());
+
+ money_base::pattern cp = cfacet.pos_format();
+ money_base::pattern cp_bn = cfacet_byname.pos_format();
+ CPPUNIT_CHECK( cp_bn.field[0] == cp.field[0] );
+ CPPUNIT_CHECK( cp_bn.field[1] == cp.field[1] );
+ CPPUNIT_CHECK( cp_bn.field[2] == cp.field[2] );
+ CPPUNIT_CHECK( cp_bn.field[3] == cp.field[3] );
+
+ CPPUNIT_CHECK( cfacet_byname.frac_digits() == cfacet.frac_digits() );
+ if (cfacet_byname.frac_digits() != 0)
+ CPPUNIT_CHECK( cfacet_byname.decimal_point() == cfacet.decimal_point() );
+ CPPUNIT_CHECK( cfacet_byname.grouping() == cfacet.grouping() );
+ if (!cfacet_byname.grouping().empty())
+ CPPUNIT_CHECK( cfacet_byname.thousands_sep() == cfacet.thousands_sep() );
+ CPPUNIT_CHECK( cfacet_byname.positive_sign() == cfacet.positive_sign() );
+ CPPUNIT_CHECK( cfacet_byname.negative_sign() == cfacet.negative_sign() );
+ }
+ catch (runtime_error const& /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ // On platform without real localization support we should rely on the "C" locale facet.
+ locale loc(locale::classic(), new moneypunct_byname<char, false>(""));
+ }
+ catch (runtime_error const& /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+# if defined (STLPORT) || !defined (__GNUC__)
+ try {
+ locale loc(locale::classic(), new moneypunct_byname<wchar_t, true>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new moneypunct_byname<wchar_t, true>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+# if defined (STLPORT) || !defined (__GNUC__)
+ try {
+ locale loc(locale::classic(), new moneypunct_byname<wchar_t, false>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new moneypunct_byname<wchar_t, false>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+# endif
+}
+
+#endif
diff --git a/test/unit/multiset_test.cpp b/test/unit/multiset_test.cpp
new file mode 100644
index 0000000..3e30917
--- /dev/null
+++ b/test/unit/multiset_test.cpp
@@ -0,0 +1,127 @@
+#include <set>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class MultisetTest : public CPPUNIT_NS::TestCase
+{
+ typedef multiset<int, less<int> > mset;
+
+ CPPUNIT_TEST_SUITE(MultisetTest);
+ CPPUNIT_TEST(mset1);
+ CPPUNIT_TEST(mset3);
+ CPPUNIT_TEST(mset5);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void mset1();
+ void mset3();
+ void mset5();
+
+ static bool less_than(int a_, int b_)
+ {
+ return a_ < b_;
+ }
+
+ static bool greater_than(int a_, int b_)
+ {
+ return a_ > b_;
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(MultisetTest);
+
+//
+// tests implementation
+//
+void MultisetTest::mset1()
+{
+ mset s;
+ CPPUNIT_ASSERT(s.count(42) == 0);
+ s.insert(42);
+ CPPUNIT_ASSERT(s.count(42) == 1);
+ s.insert(42);
+ CPPUNIT_ASSERT(s.count(42) == 2);
+
+ mset::iterator i = s.find(40);
+ CPPUNIT_ASSERT(i == s.end());
+
+ i = s.find(42);
+ CPPUNIT_ASSERT(i != s.end());
+ size_t count = s.erase(42);
+ CPPUNIT_ASSERT(count == 2);
+}
+void MultisetTest::mset3()
+{
+ int array [] = { 3, 6, 1, 2, 3, 2, 6, 7, 9 };
+
+ //Check iterator on a mutable set
+ mset s(array, array + 9);
+ mset::iterator i;
+ i = s.lower_bound(3);
+ CPPUNIT_ASSERT(*i == 3);
+ i = s.upper_bound(3);
+ CPPUNIT_ASSERT(*i == 6);
+ pair<mset::iterator, mset::iterator> p = s.equal_range(5);
+ CPPUNIT_ASSERT(*(p.first) == 6);
+ CPPUNIT_ASSERT(*(p.second) == 6);
+
+ //Check const_iterator on a mutable multiset
+ mset::const_iterator ci;
+ ci = s.lower_bound(3);
+ CPPUNIT_ASSERT(*ci == 3);
+ ci = s.upper_bound(3);
+ CPPUNIT_ASSERT(*ci == 6);
+ pair<mset::const_iterator, mset::const_iterator> cp;
+#ifdef _STLP_MEMBER_TEMPLATES
+ cp = s.equal_range(5);
+ CPPUNIT_ASSERT(*(cp.first) == 6);
+ CPPUNIT_ASSERT(*(cp.second) == 6);
+#endif
+
+ //Check const_iterator on a const multiset
+ mset const& crs = s;
+ ci = crs.lower_bound(3);
+ CPPUNIT_ASSERT(*ci == 3);
+ ci = crs.upper_bound(3);
+ CPPUNIT_ASSERT(*ci == 6);
+ cp = crs.equal_range(5);
+ CPPUNIT_ASSERT(*(cp.first) == 6);
+ CPPUNIT_ASSERT(*(cp.second) == 6);
+}
+void MultisetTest::mset5()
+{
+ int array [] = { 3, 6, 1, 9 };
+ int j;
+
+ typedef pointer_to_binary_function<int, int, bool> fn_type;
+ typedef multiset<int, fn_type, allocator<int> > fn_mset;
+
+ fn_type f(less_than);
+ fn_mset s1(array+0, array + 4 , f );
+ fn_mset::const_iterator i = s1.begin();
+ for (j = 0; i != s1.end(); ++i, ++j) {
+ CPPUNIT_ASSERT(j != 0 || *i == 1);
+ CPPUNIT_ASSERT(j != 1 || *i == 3);
+ CPPUNIT_ASSERT(j != 2 || *i == 6);
+ CPPUNIT_ASSERT(j != 3 || *i == 9);
+ }
+
+ fn_type g(greater_than);
+ fn_mset s2(array, array + 4, g);
+ i = s2.begin();
+ for (j = 0; i != s2.end(); ++i, ++j) {
+ CPPUNIT_ASSERT(j != 0 || *i == 9);
+ CPPUNIT_ASSERT(j != 1 || *i == 6);
+ CPPUNIT_ASSERT(j != 2 || *i == 3);
+ CPPUNIT_ASSERT(j != 3 || *i == 1);
+ }
+
+}
diff --git a/test/unit/mvctor_declaration_test.cpp b/test/unit/mvctor_declaration_test.cpp
new file mode 100644
index 0000000..cb6f8a3
--- /dev/null
+++ b/test/unit/mvctor_declaration_test.cpp
@@ -0,0 +1,369 @@
+#include <vector>
+#include <algorithm>
+#include <string>
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+# include <rope>
+#endif
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+# include <slist>
+#endif
+#include <list>
+#include <deque>
+#include <set>
+#include <map>
+#if defined (STLPORT)
+# include <unordered_set>
+# include <unordered_map>
+#endif
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+# include <hash_set>
+# include <hash_map>
+#endif
+#include <queue>
+#include <stack>
+
+#include "mvctor_test.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# if defined (STLPORT)
+using namespace std::tr1;
+# endif
+#endif
+
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+
+# if defined (__GNUC__) && defined (_STLP_USE_NAMESPACES)
+// libstdc++ sometimes exposed its own __true_type in
+// global namespace resulting in an ambiguity.
+# define __true_type std::__true_type
+# define __false_type std::__false_type
+# endif
+
+static bool type_to_bool(__true_type)
+{ return true; }
+static bool type_to_bool(__false_type)
+{ return false; }
+
+template <class _Tp>
+static bool is_movable(const _Tp&) {
+ typedef typename __move_traits<_Tp>::implemented _MovableTp;
+ return type_to_bool(_MovableTp());
+}
+
+template <class _Tp>
+static bool is_move_complete(const _Tp&) {
+ typedef __move_traits<_Tp> _TpMoveTraits;
+ typedef typename _TpMoveTraits::complete _TpMoveComplete;
+ return type_to_bool(_TpMoveComplete());
+}
+
+struct specially_allocated_struct {
+ bool operator < (const specially_allocated_struct&) const;
+# if defined (__DMC__) // slist<_Tp,_Alloc>::remove error
+ bool operator==(const specially_allocated_struct&) const;
+# endif
+};
+
+#if defined (__DMC__)
+bool specially_allocated_struct::operator < (const specially_allocated_struct&) const
+{ return false; }
+#endif
+
+struct struct_with_specialized_less {};
+
+# if defined (_STLP_USE_NAMESPACES)
+namespace std {
+# endif
+ _STLP_TEMPLATE_NULL
+ class allocator<specially_allocated_struct> {
+ //This allocator just represent what a STLport could do and in this
+ //case the STL containers implemented with it should still be movable
+ //but not completely as we cannot do any hypothesis on what is in this
+ //allocator.
+ public:
+ typedef specially_allocated_struct value_type;
+ typedef value_type * pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Tp1> struct rebind {
+ typedef allocator<_Tp1> other;
+ };
+# endif
+ allocator() _STLP_NOTHROW {}
+# if defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Tp1> allocator(const allocator<_Tp1>&) _STLP_NOTHROW {}
+# endif
+ allocator(const allocator&) _STLP_NOTHROW {}
+ ~allocator() _STLP_NOTHROW {}
+ pointer address(reference __x) const { return &__x; }
+ const_pointer address(const_reference __x) const { return &__x; }
+ pointer allocate(size_type, const void* = 0) { return 0; }
+ void deallocate(pointer, size_type) {}
+ size_type max_size() const _STLP_NOTHROW { return 0; }
+ void construct(pointer, const_reference) {}
+ void destroy(pointer) {}
+ };
+
+ _STLP_TEMPLATE_NULL
+ struct less<struct_with_specialized_less> {
+ bool operator() (struct_with_specialized_less const&,
+ struct_with_specialized_less const&) const;
+ };
+
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x564)
+ _STLP_TEMPLATE_NULL
+ struct __move_traits<vector<specially_allocated_struct> > {
+ typedef __true_type implemented;
+ typedef __false_type complete;
+ };
+ _STLP_TEMPLATE_NULL
+ struct __move_traits<deque<specially_allocated_struct> > {
+ typedef __true_type implemented;
+ typedef __false_type complete;
+ };
+ _STLP_TEMPLATE_NULL
+ struct __move_traits<list<specially_allocated_struct> > {
+ typedef __true_type implemented;
+ typedef __false_type complete;
+ };
+ _STLP_TEMPLATE_NULL
+ struct __move_traits<slist<specially_allocated_struct> > {
+ typedef __true_type implemented;
+ typedef __false_type complete;
+ };
+ _STLP_TEMPLATE_NULL
+ struct __move_traits<less<struct_with_specialized_less> > {
+ typedef __true_type implemented;
+ typedef __false_type complete;
+ };
+ _STLP_TEMPLATE_NULL
+ struct __move_traits<set<specially_allocated_struct> > {
+ typedef __true_type implemented;
+ typedef __false_type complete;
+ };
+ _STLP_TEMPLATE_NULL
+ struct __move_traits<multiset<specially_allocated_struct> > {
+ typedef __true_type implemented;
+ typedef __false_type complete;
+ };
+# endif
+# endif
+# endif
+
+# if defined (_STLP_USE_NAMESPACES)
+}
+# endif
+#endif
+
+void MoveConstructorTest::movable_declaration()
+{
+#if defined (STLPORT) && !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && \
+ !defined (_STLP_NO_MOVE_SEMANTIC)
+ //This test purpose is to check correct detection of the STL movable
+ //traits declaration
+ {
+ //string, wstring:
+ CPPUNIT_ASSERT( is_movable(string()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(string()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(string()) );
+# endif
+# if defined (_STLP_HAS_WCHAR_T)
+ CPPUNIT_ASSERT( is_movable(wstring()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(wstring()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(wstring()) );
+# endif
+# endif
+ }
+
+# if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ {
+ //crope, wrope:
+ CPPUNIT_ASSERT( is_movable(crope()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(crope()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(crope()) );
+# endif
+# if defined (_STLP_HAS_WCHAR_T)
+ CPPUNIT_ASSERT( is_movable(wrope()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(wrope()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(wrope()) );
+# endif
+# endif
+ }
+# endif
+
+ {
+ //vector:
+ CPPUNIT_ASSERT( is_movable(vector<char>()) );
+ CPPUNIT_ASSERT( is_movable(vector<specially_allocated_struct>()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(vector<char>()) );
+ CPPUNIT_ASSERT( !is_move_complete(vector<specially_allocated_struct>()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(vector<char>()) );
+# endif
+ }
+
+ {
+ //deque:
+ CPPUNIT_ASSERT( is_movable(deque<char>()) );
+ CPPUNIT_ASSERT( is_movable(deque<specially_allocated_struct>()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(deque<char>()) );
+ CPPUNIT_ASSERT( !is_move_complete(deque<specially_allocated_struct>()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(deque<char>()) );
+# endif
+ }
+
+ {
+ //list:
+ CPPUNIT_ASSERT( is_movable(list<char>()) );
+ CPPUNIT_ASSERT( is_movable(list<specially_allocated_struct>()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(list<char>()) );
+ CPPUNIT_ASSERT( !is_move_complete(list<specially_allocated_struct>()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(list<char>()) );
+# endif
+ }
+
+# if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ {
+ //slist:
+ CPPUNIT_ASSERT( is_movable(slist<char>()) );
+ CPPUNIT_ASSERT( is_movable(slist<specially_allocated_struct>()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(slist<char>()) );
+ CPPUNIT_ASSERT( !is_move_complete(slist<specially_allocated_struct>()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(slist<char>()) );
+# endif
+ }
+# endif
+
+ {
+ //queue:
+ CPPUNIT_ASSERT( is_movable(queue<char>()) );
+ CPPUNIT_ASSERT( is_movable(queue<specially_allocated_struct>()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(queue<char>()) );
+ CPPUNIT_ASSERT( !is_move_complete(queue<specially_allocated_struct>()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(queue<char>()) );
+# endif
+ }
+
+ {
+ //stack:
+ CPPUNIT_ASSERT( is_movable(stack<char>()) );
+ CPPUNIT_ASSERT( is_movable(stack<specially_allocated_struct>()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(stack<char>()) );
+ CPPUNIT_ASSERT( !is_move_complete(stack<specially_allocated_struct>()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(stack<char>()) );
+# endif
+ }
+
+#endif
+}
+
+void MoveConstructorTest::movable_declaration_assoc()
+{
+#if defined (STLPORT) && !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && \
+ !defined (_STLP_NO_MOVE_SEMANTIC)
+ {
+ //associative containers, set multiset, map, multimap:
+
+ //For associative containers it is important that less is correctly recognize as
+ //the STLport less or a user specialized less:
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(less<char>()) );
+# endif
+ CPPUNIT_ASSERT( !is_move_complete(less<struct_with_specialized_less>()) );
+
+ //set
+ CPPUNIT_ASSERT( is_movable(set<char>()) );
+ CPPUNIT_ASSERT( is_movable(set<specially_allocated_struct>()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(set<char>()) );
+ CPPUNIT_ASSERT( !is_move_complete(set<specially_allocated_struct>()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(set<char>()) );
+# endif
+
+ //multiset
+ CPPUNIT_ASSERT( is_movable(multiset<char>()) );
+ CPPUNIT_ASSERT( is_movable(multiset<specially_allocated_struct>()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(multiset<char>()) );
+ CPPUNIT_ASSERT( !is_move_complete(multiset<specially_allocated_struct>()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(multiset<char>()) );
+# endif
+
+ //map
+ CPPUNIT_ASSERT( is_movable(map<char, char>()) );
+ CPPUNIT_ASSERT( is_movable(map<specially_allocated_struct, char>()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(map<char, char>()) );
+ //Here even if allocator has been specialized for specially_allocated_struct
+ //this pecialization won't be used in default map instanciation as the default
+ //allocator is allocator<pair<specially_allocated_struct, char> >
+ CPPUNIT_ASSERT( is_move_complete(map<specially_allocated_struct, char>()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(map<char, char>()) );
+# endif
+
+ //multimap
+ CPPUNIT_ASSERT( is_movable(multimap<char, char>()) );
+ CPPUNIT_ASSERT( is_movable(multimap<specially_allocated_struct, char>()) );
+# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( is_move_complete(multimap<char, char>()) );
+ //Idem map remark
+ CPPUNIT_ASSERT( is_move_complete(multimap<specially_allocated_struct, char>()) );
+# else
+ CPPUNIT_ASSERT( !is_move_complete(multimap<char, char>()) );
+# endif
+ }
+#endif
+}
+
+void MoveConstructorTest::movable_declaration_hash()
+{
+#if defined (STLPORT) && !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && \
+ !defined (_STLP_NO_MOVE_SEMANTIC)
+ {
+ //hashed containers, unordered_set unordered_multiset, unordered_map, unordered_multimap,
+ // hash_set, hash_multiset, hash_map, hash_multimap:
+
+ //We only check that they are movable, completness is not yet supported
+ CPPUNIT_ASSERT( is_movable(unordered_set<char>()) );
+ CPPUNIT_ASSERT( is_movable(unordered_multiset<char>()) );
+ CPPUNIT_ASSERT( is_movable(unordered_map<char, char>()) );
+ CPPUNIT_ASSERT( is_movable(unordered_multimap<char, char>()) );
+# if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ CPPUNIT_ASSERT( is_movable(hash_set<char>()) );
+ CPPUNIT_ASSERT( is_movable(hash_multiset<char>()) );
+ CPPUNIT_ASSERT( is_movable(hash_map<char, char>()) );
+ CPPUNIT_ASSERT( is_movable(hash_multimap<char, char>()) );
+# endif
+ }
+#endif
+}
+
diff --git a/test/unit/mvctor_test.cpp b/test/unit/mvctor_test.cpp
new file mode 100644
index 0000000..ddac32f
--- /dev/null
+++ b/test/unit/mvctor_test.cpp
@@ -0,0 +1,816 @@
+#include <vector>
+#include <algorithm>
+#include <string>
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+# include <slist>
+#endif
+#include <list>
+#include <deque>
+#include <set>
+#if defined (STLPORT)
+# include <unordered_set>
+#endif
+
+#include "mvctor_test.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# if defined (STLPORT)
+using namespace std::tr1;
+# endif
+#endif
+
+CPPUNIT_TEST_SUITE_REGISTRATION(MoveConstructorTest);
+
+//
+// tests implementation
+//
+void MoveConstructorTest::move_construct_test()
+{
+ //cout << "vector<vector<int>>";
+ vector<int> const ref_vec(10, 0);
+ vector<vector<int> > v_v_ints(1, ref_vec);
+
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ int *pint = &(v_v_ints.front().front());
+#endif
+
+ size_t cur_capacity = v_v_ints.capacity();
+ while (v_v_ints.capacity() <= cur_capacity) {
+ v_v_ints.push_back(ref_vec);
+ }
+
+ //v_v_ints has been resized
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT((pint == &v_v_ints.front().front()));
+#endif
+
+ //cout << "vector<vector<int>>::erase";
+ //We need at least 3 elements:
+ while (v_v_ints.size() < 3) {
+ v_v_ints.push_back(ref_vec);
+ }
+
+ //We erase the 2nd
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ pint = &v_v_ints[2].front();
+#endif
+ v_v_ints.erase(v_v_ints.begin() + 1);
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT((pint == &v_v_ints[1].front()));
+#endif
+
+ //cout << "vector<string>";
+ string const ref_str("ref string, big enough to be a dynamic one");
+ vector<string> vec_strs(1, ref_str);
+
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ char const* pstr = vec_strs.front().c_str();
+#endif
+ cur_capacity = vec_strs.capacity();
+ while (vec_strs.capacity() <= cur_capacity) {
+ vec_strs.push_back(ref_str);
+ }
+
+ //vec_str has been resized
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT((pstr == vec_strs.front().c_str()));
+#endif
+
+ //cout << "vector<string>::erase";
+ //We need at least 3 elements:
+ while (vec_strs.size() < 3) {
+ vec_strs.push_back(ref_str);
+ }
+
+ //We erase the 2nd
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ pstr = vec_strs[2].c_str();
+#endif
+ vec_strs.erase(vec_strs.begin() + 1);
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT((pstr == vec_strs[1].c_str()));
+#endif
+
+ //cout << "swap(vector<int>, vector<int>)";
+ vector<int> elem1(10, 0), elem2(10, 0);
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ int *p1 = &elem1.front();
+ int *p2 = &elem2.front();
+#endif
+ swap(elem1, elem2);
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT(((p1 == &elem2.front()) && (p2 == &elem1.front())));
+#endif
+
+ {
+ vector<bool> bit_vec(5, true);
+ bit_vec.insert(bit_vec.end(), 5, false);
+ vector<vector<bool> > v_v_bits(1, bit_vec);
+
+ /*
+ * This is a STLport specific test as we are using internal implementation
+ * details to check that the move has been correctly handled. For other
+ * STL implementation it is only a compile check.
+ */
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+# if defined (_STLP_DEBUG)
+ unsigned int *punit = v_v_bits.front().begin()._M_iterator._M_p;
+# else
+ unsigned int *punit = v_v_bits.front().begin()._M_p;
+# endif
+#endif
+
+ cur_capacity = v_v_bits.capacity();
+ while (v_v_bits.capacity() <= cur_capacity) {
+ v_v_bits.push_back(bit_vec);
+ }
+
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ //v_v_bits has been resized
+# if defined (_STLP_DEBUG)
+ CPPUNIT_ASSERT( punit == v_v_bits.front().begin()._M_iterator._M_p );
+# else
+ CPPUNIT_ASSERT( punit == v_v_bits.front().begin()._M_p );
+# endif
+#endif
+ }
+
+ // zero: don't like this kind of tests
+ // because of template test function
+ // we should find another way to provide
+ // move constructor testing...
+
+/*
+ standard_test1(list<int>(10));
+
+
+ standard_test1(slist<int>(10));
+
+ standard_test1(deque<int>(10));
+*/
+
+ /*
+ int int_values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+
+ set<int> int_set(int_values, int_values + sizeof(in_values) / sizeof(int));
+ standard_test1(int_set);
+
+ multiset<int> int_multiset(int_values, int_values + sizeof(in_values) / sizeof(int));
+ standard_test1(int_multiset);
+ */
+
+ /*
+ CheckFullMoveSupport(string());
+ CheckFullMoveSupport(vector<int>());
+ CheckFullMoveSupport(deque<int>());
+ CheckFullMoveSupport(list<int>());
+ CheckFullMoveSupport(slist<int>());
+ */
+}
+
+void MoveConstructorTest::deque_test()
+{
+ //Check the insert range method.
+ //To the front:
+ {
+# if !defined (STLPORT) || !defined (_STLP_DEBUG) || !defined (_STLP_NO_MEMBER_TEMPLATES)
+ deque<vector<int> > vect_deque;
+ vector<int*> bufs;
+ vect_deque.assign(3, vector<int>(10));
+ bufs.push_back(&vect_deque[0].front());
+ bufs.push_back(&vect_deque[1].front());
+ bufs.push_back(&vect_deque[2].front());
+
+ int nb_insert = 5;
+ //Initialize to 1 to generate a front insertion:
+ int pos = 1;
+ while (nb_insert--) {
+ vector<vector<int> > vect_vect(2, vector<int>(10));
+ vect_deque.insert(vect_deque.begin() + pos, vect_vect.begin(), vect_vect.end());
+ bufs.insert(bufs.begin() + pos, &vect_deque[pos].front());
+ bufs.insert(bufs.begin() + pos + 1, &vect_deque[pos + 1].front());
+ ++pos;
+ }
+ CPPUNIT_ASSERT( vect_deque.size() == 13 );
+# if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ for (int i = 0; i < 5; ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &vect_deque[i].front() );
+ CPPUNIT_ASSERT( bufs[11 - i] == &vect_deque[11 - i].front() );
+ }
+# endif
+# endif
+ }
+
+ //To the back
+ {
+# if !defined (STLPORT) || !defined (_STLP_DEBUG) || !defined (_STLP_NO_MEMBER_TEMPLATES)
+ deque<vector<int> > vect_deque;
+ vector<int*> bufs;
+ vect_deque.assign(3, vector<int>(10));
+ bufs.push_back(&vect_deque[0].front());
+ bufs.push_back(&vect_deque[1].front());
+ bufs.push_back(&vect_deque[2].front());
+
+ int nb_insert = 5;
+ //Initialize to 2 to generate a back insertion:
+ int pos = 2;
+ while (nb_insert--) {
+ vector<vector<int> > vect_vect(2, vector<int>(10));
+ vect_deque.insert(vect_deque.begin() + pos, vect_vect.begin(), vect_vect.end());
+ bufs.insert(bufs.begin() + pos, &vect_deque[pos].front());
+ bufs.insert(bufs.begin() + pos + 1, &vect_deque[pos + 1].front());
+ ++pos;
+ }
+ CPPUNIT_ASSERT( vect_deque.size() == 13 );
+# if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ for (int i = 0; i < 5; ++i) {
+ CPPUNIT_ASSERT( bufs[i + 1] == &vect_deque[i + 1].front() );
+ CPPUNIT_ASSERT( bufs[12 - i] == &vect_deque[12 - i].front() );
+ }
+# endif
+# endif
+ }
+
+ //Check the different erase methods.
+ {
+ deque<vector<int> > vect_deque;
+ vect_deque.assign(20, vector<int>(10));
+ deque<vector<int> >::iterator vdit(vect_deque.begin()), vditEnd(vect_deque.end());
+ vector<int*> bufs;
+ for (; vdit != vditEnd; ++vdit) {
+ bufs.push_back(&vdit->front());
+ }
+
+ {
+ // This check, repeated after each operation, check the deque consistency:
+ deque<vector<int> >::iterator it = vect_deque.end() - 5;
+ int nb_incr = 0;
+ for (; it != vect_deque.end() && nb_incr <= 6; ++nb_incr, ++it) {}
+ CPPUNIT_ASSERT( nb_incr == 5 );
+ }
+
+ {
+ //erase in front:
+ vect_deque.erase(vect_deque.begin() + 2);
+ bufs.erase(bufs.begin() + 2);
+ CPPUNIT_ASSERT( vect_deque.size() == 19 );
+ deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end());
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+
+ {
+ deque<vector<int> >::iterator it = vect_deque.end() - 5;
+ int nb_incr = 0;
+ for (; it != vect_deque.end() && nb_incr <= 6; ++nb_incr, ++it) {}
+ CPPUNIT_ASSERT( nb_incr == 5 );
+ }
+
+ {
+ //erase in the back:
+ vect_deque.erase(vect_deque.end() - 2);
+ bufs.erase(bufs.end() - 2);
+ CPPUNIT_ASSERT( vect_deque.size() == 18 );
+ deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end());
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+
+ {
+ deque<vector<int> >::iterator it = vect_deque.end() - 5;
+ int nb_incr = 0;
+ for (; it != vect_deque.end() && nb_incr < 6; ++nb_incr, ++it) {}
+ CPPUNIT_ASSERT( nb_incr == 5 );
+ }
+
+ {
+ //range erase in front
+ vect_deque.erase(vect_deque.begin() + 3, vect_deque.begin() + 5);
+ bufs.erase(bufs.begin() + 3, bufs.begin() + 5);
+ CPPUNIT_ASSERT( vect_deque.size() == 16 );
+ deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end());
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+
+ {
+ deque<vector<int> >::iterator it = vect_deque.end() - 5;
+ int nb_incr = 0;
+ for (; it != vect_deque.end() && nb_incr <= 6; ++nb_incr, ++it) {}
+ CPPUNIT_ASSERT( nb_incr == 5 );
+ }
+
+ {
+ //range erase in back
+ vect_deque.erase(vect_deque.end() - 5, vect_deque.end() - 3);
+ bufs.erase(bufs.end() - 5, bufs.end() - 3);
+ CPPUNIT_ASSERT( vect_deque.size() == 14 );
+ deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end());
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+ }
+
+ //Check the insert value(s)
+ {
+ deque<vector<int> > vect_deque;
+ vect_deque.assign(20, vector<int>(10));
+ deque<vector<int> >::iterator vdit(vect_deque.begin()), vditEnd(vect_deque.end());
+ vector<int*> bufs;
+ for (; vdit != vditEnd; ++vdit) {
+ bufs.push_back(&vdit->front());
+ }
+
+ {
+ //2 values in front:
+ vect_deque.insert(vect_deque.begin() + 2, 2, vector<int>(10));
+ bufs.insert(bufs.begin() + 2, &vect_deque[2].front());
+ bufs.insert(bufs.begin() + 3, &vect_deque[3].front());
+ CPPUNIT_ASSERT( vect_deque.size() == 22 );
+ deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end());
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+
+ {
+ //2 values in back:
+ vect_deque.insert(vect_deque.end() - 2, 2, vector<int>(10));
+ bufs.insert(bufs.end() - 2, &vect_deque[20].front());
+ bufs.insert(bufs.end() - 2, &vect_deque[21].front());
+ CPPUNIT_ASSERT( vect_deque.size() == 24 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end());
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+
+ {
+ //1 value in front:
+ deque<vector<int> >::iterator ret;
+ ret = vect_deque.insert(vect_deque.begin() + 2, vector<int>(10));
+ bufs.insert(bufs.begin() + 2, &vect_deque[2].front());
+ CPPUNIT_ASSERT( vect_deque.size() == 25 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( &ret->front() == bufs[2] );
+ deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end());
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+
+ {
+ //1 value in back:
+ deque<vector<int> >::iterator ret;
+ ret = vect_deque.insert(vect_deque.end() - 2, vector<int>(10));
+ bufs.insert(bufs.end() - 2, &vect_deque[23].front());
+ CPPUNIT_ASSERT( vect_deque.size() == 26 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( &ret->front() == bufs[23] );
+ deque<vector<int> >::iterator dit(vect_deque.begin()), ditEnd(vect_deque.end());
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+ }
+}
+
+void MoveConstructorTest::vector_test()
+{
+ //Check the insert range method.
+ //To the front:
+ {
+ vector<vector<int> > vect_vector;
+ vector<int*> bufs;
+ vect_vector.assign(3, vector<int>(10));
+ bufs.push_back(&vect_vector[0].front());
+ bufs.push_back(&vect_vector[1].front());
+ bufs.push_back(&vect_vector[2].front());
+
+ int nb_insert = 5;
+ int pos = 1;
+ while (nb_insert--) {
+ vector<vector<int> > vect_vect(2, vector<int>(10));
+ vect_vector.insert(vect_vector.begin() + pos, vect_vect.begin(), vect_vect.end());
+ bufs.insert(bufs.begin() + pos, &vect_vector[pos].front());
+ bufs.insert(bufs.begin() + pos + 1, &vect_vector[pos + 1].front());
+ ++pos;
+ }
+ CPPUNIT_ASSERT( vect_vector.size() == 13 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ for (int i = 0; i < 5; ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &vect_vector[i].front() );
+ CPPUNIT_ASSERT( bufs[11 - i] == &vect_vector[11 - i].front() );
+ }
+#endif
+ }
+
+ //To the back
+ {
+ vector<vector<int> > vect_vector;
+ vector<int*> bufs;
+ vect_vector.assign(3, vector<int>(10));
+ bufs.push_back(&vect_vector[0].front());
+ bufs.push_back(&vect_vector[1].front());
+ bufs.push_back(&vect_vector[2].front());
+
+ int nb_insert = 5;
+ //Initialize to 2 to generate a back insertion:
+ int pos = 2;
+ while (nb_insert--) {
+ vector<vector<int> > vect_vect(2, vector<int>(10));
+ vect_vector.insert(vect_vector.begin() + pos, vect_vect.begin(), vect_vect.end());
+ bufs.insert(bufs.begin() + pos, &vect_vector[pos].front());
+ bufs.insert(bufs.begin() + pos + 1, &vect_vector[pos + 1].front());
+ ++pos;
+ }
+ CPPUNIT_ASSERT( vect_vector.size() == 13 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ for (int i = 0; i < 5; ++i) {
+ CPPUNIT_ASSERT( bufs[i + 1] == &vect_vector[i + 1].front() );
+ CPPUNIT_ASSERT( bufs[12 - i] == &vect_vector[12 - i].front() );
+ }
+#endif
+ }
+
+ //Check the different erase methods.
+ {
+ vector<vector<int> > vect_vector;
+ vect_vector.assign(20, vector<int>(10));
+ vector<vector<int> >::iterator vdit(vect_vector.begin()), vditEnd(vect_vector.end());
+ vector<int*> bufs;
+ for (; vdit != vditEnd; ++vdit) {
+ bufs.push_back(&vdit->front());
+ }
+
+ {
+ // This check, repeated after each operation, check the vector consistency:
+ vector<vector<int> >::iterator it = vect_vector.end() - 5;
+ int nb_incr = 0;
+ for (; it != vect_vector.end() && nb_incr <= 6; ++nb_incr, ++it) {}
+ CPPUNIT_ASSERT( nb_incr == 5 );
+ }
+
+ {
+ //erase in front:
+ vect_vector.erase(vect_vector.begin() + 2);
+ bufs.erase(bufs.begin() + 2);
+ CPPUNIT_ASSERT( vect_vector.size() == 19 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end());
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+
+ {
+ vector<vector<int> >::iterator it = vect_vector.end() - 5;
+ int nb_incr = 0;
+ for (; it != vect_vector.end() && nb_incr <= 6; ++nb_incr, ++it) {}
+ CPPUNIT_ASSERT( nb_incr == 5 );
+ }
+
+ {
+ //erase in the back:
+ vect_vector.erase(vect_vector.end() - 2);
+ bufs.erase(bufs.end() - 2);
+ CPPUNIT_ASSERT( vect_vector.size() == 18 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end());
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+
+ {
+ vector<vector<int> >::iterator it = vect_vector.end() - 5;
+ int nb_incr = 0;
+ for (; it != vect_vector.end() && nb_incr < 6; ++nb_incr, ++it) {}
+ CPPUNIT_ASSERT( nb_incr == 5 );
+ }
+
+ {
+ //range erase in front
+ vect_vector.erase(vect_vector.begin() + 3, vect_vector.begin() + 5);
+ bufs.erase(bufs.begin() + 3, bufs.begin() + 5);
+ CPPUNIT_ASSERT( vect_vector.size() == 16 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end());
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+
+ {
+ vector<vector<int> >::iterator it = vect_vector.end() - 5;
+ int nb_incr = 0;
+ for (; it != vect_vector.end() && nb_incr <= 6; ++nb_incr, ++it) {}
+ CPPUNIT_ASSERT( nb_incr == 5 );
+ }
+
+ {
+ //range erase in back
+ vect_vector.erase(vect_vector.end() - 5, vect_vector.end() - 3);
+ bufs.erase(bufs.end() - 5, bufs.end() - 3);
+ CPPUNIT_ASSERT( vect_vector.size() == 14 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end());
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+ }
+
+ //Check the insert value(s)
+ {
+ vector<vector<int> > vect_vector;
+ vect_vector.assign(20, vector<int>(10));
+ vector<vector<int> >::iterator vdit(vect_vector.begin()), vditEnd(vect_vector.end());
+ vector<int*> bufs;
+ for (; vdit != vditEnd; ++vdit) {
+ bufs.push_back(&vdit->front());
+ }
+
+ {
+ //2 values in front:
+ vect_vector.insert(vect_vector.begin() + 2, 2, vector<int>(10));
+ bufs.insert(bufs.begin() + 2, &vect_vector[2].front());
+ bufs.insert(bufs.begin() + 3, &vect_vector[3].front());
+ CPPUNIT_ASSERT( vect_vector.size() == 22 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end());
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+
+ {
+ //2 values in back:
+ vect_vector.insert(vect_vector.end() - 2, 2, vector<int>(10));
+ bufs.insert(bufs.end() - 2, &vect_vector[20].front());
+ bufs.insert(bufs.end() - 2, &vect_vector[21].front());
+ CPPUNIT_ASSERT( vect_vector.size() == 24 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end());
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+
+ {
+ //1 value in front:
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ vector<vector<int> >::iterator ret =
+#endif
+ vect_vector.insert(vect_vector.begin() + 2, vector<int>(10));
+ bufs.insert(bufs.begin() + 2, &vect_vector[2].front());
+ CPPUNIT_ASSERT( vect_vector.size() == 25 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( &ret->front() == bufs[2] );
+ vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end());
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+
+ {
+ //1 value in back:
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ vector<vector<int> >::iterator ret =
+#endif
+ vect_vector.insert(vect_vector.end() - 2, vector<int>(10));
+ bufs.insert(bufs.end() - 2, &vect_vector[23].front());
+ CPPUNIT_ASSERT( vect_vector.size() == 26 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( &ret->front() == bufs[23] );
+ vector<vector<int> >::iterator dit(vect_vector.begin()), ditEnd(vect_vector.end());
+ for (size_t i = 0; dit != ditEnd; ++dit, ++i) {
+ CPPUNIT_ASSERT( bufs[i] == &dit->front() );
+ }
+#endif
+ }
+ }
+
+ //The following tests are checking move contructor implementations:
+ const string long_str("long enough string to force dynamic allocation");
+ {
+ //vector move contructor:
+ vector<vector<string> > vect(10, vector<string>(10, long_str));
+ vector<string> strs;
+ size_t index = 0;
+ for (;;) {
+ vector<vector<string> >::iterator it(vect.begin());
+ advance(it, index % vect.size());
+ strs.push_back(it->front());
+ it->erase(it->begin());
+ if (it->empty()) {
+ vect.erase(it);
+ if (vect.empty())
+ break;
+ }
+ index += 3;
+ }
+ CPPUNIT_ASSERT( strs.size() == 10 * 10 );
+ vector<string>::iterator it(strs.begin()), itEnd(strs.end());
+ for (; it != itEnd; ++it) {
+ CPPUNIT_ASSERT( *it == long_str );
+ }
+ }
+
+ {
+ //deque move contructor:
+# if !defined (__DMC__)
+ vector<deque<string> > vect(10, deque<string>(10, long_str));
+# else
+ deque<string> deq_str = deque<string>(10, long_str);
+ vector<deque<string> > vect(10, deq_str);
+# endif
+ vector<string> strs;
+ size_t index = 0;
+ for (;;) {
+ vector<deque<string> >::iterator it(vect.begin());
+ advance(it, index % vect.size());
+ strs.push_back(it->front());
+ it->pop_front();
+ if (it->empty()) {
+ vect.erase(it);
+ if (vect.empty())
+ break;
+ }
+ index += 3;
+ }
+ CPPUNIT_ASSERT( strs.size() == 10 * 10 );
+ vector<string>::iterator it(strs.begin()), itEnd(strs.end());
+ for (; it != itEnd; ++it) {
+ CPPUNIT_ASSERT( *it == long_str );
+ }
+ }
+
+ {
+ //list move contructor:
+ vector<list<string> > vect(10, list<string>(10, long_str));
+ vector<string> strs;
+ size_t index = 0;
+ for (;;) {
+ vector<list<string> >::iterator it(vect.begin());
+ advance(it, index % vect.size());
+ strs.push_back(it->front());
+ it->pop_front();
+ if (it->empty()) {
+ vect.erase(it);
+ if (vect.empty())
+ break;
+ }
+ index += 3;
+ }
+ CPPUNIT_ASSERT( strs.size() == 10 * 10 );
+ vector<string>::iterator it(strs.begin()), itEnd(strs.end());
+ for (; it != itEnd; ++it) {
+ CPPUNIT_ASSERT( *it == long_str );
+ }
+ }
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ {
+ //slist move contructor:
+ vector<slist<string> > vect(10, slist<string>(10, long_str));
+ vector<string> strs;
+ size_t index = 0;
+ while (true) {
+ vector<slist<string> >::iterator it(vect.begin());
+ advance(it, index % vect.size());
+ strs.push_back(it->front());
+ it->pop_front();
+ if (it->empty()) {
+ vect.erase(it);
+ if (vect.empty())
+ break;
+ }
+ index += 3;
+ }
+ CPPUNIT_ASSERT( strs.size() == 10 * 10 );
+ vector<string>::iterator it(strs.begin()), itEnd(strs.end());
+ for (; it != itEnd; ++it) {
+ CPPUNIT_ASSERT( *it == long_str );
+ }
+ }
+#endif
+
+ {
+ //binary tree move contructor:
+ multiset<string> ref;
+ for (size_t i = 0; i < 10; ++i) {
+ ref.insert(long_str);
+ }
+ vector<multiset<string> > vect(10, ref);
+ vector<string> strs;
+ size_t index = 0;
+ for (;;) {
+ vector<multiset<string> >::iterator it(vect.begin());
+ advance(it, index % vect.size());
+ strs.push_back(*it->begin());
+ it->erase(it->begin());
+ if (it->empty()) {
+ vect.erase(it);
+ if (vect.empty())
+ break;
+ }
+ index += 3;
+ }
+ CPPUNIT_ASSERT( strs.size() == 10 * 10 );
+ vector<string>::iterator it(strs.begin()), itEnd(strs.end());
+ for (; it != itEnd; ++it) {
+ CPPUNIT_ASSERT( *it == long_str );
+ }
+ }
+
+#if defined (STLPORT)
+# if !defined (__DMC__)
+ {
+ //hash container move contructor:
+ unordered_multiset<string> ref;
+ for (size_t i = 0; i < 10; ++i) {
+ ref.insert(long_str);
+ }
+ vector<unordered_multiset<string> > vect(10, ref);
+ vector<string> strs;
+ size_t index = 0;
+ while (true) {
+ vector<unordered_multiset<string> >::iterator it(vect.begin());
+ advance(it, index % vect.size());
+ strs.push_back(*it->begin());
+ it->erase(it->begin());
+ if (it->empty()) {
+ vect.erase(it);
+ if (vect.empty())
+ break;
+ }
+ index += 3;
+ }
+ CPPUNIT_ASSERT( strs.size() == 10 * 10 );
+ vector<string>::iterator it(strs.begin()), itEnd(strs.end());
+ for (; it != itEnd; ++it) {
+ CPPUNIT_ASSERT( *it == long_str );
+ }
+ }
+# endif
+#endif
+}
+
+#if defined (__BORLANDC__)
+/* Specific Borland test case to show a really weird compiler behavior.
+ */
+class Standalone
+{
+public:
+ //Uncomment following to pass the test
+ //Standalone() {}
+ ~Standalone() {}
+
+ MovableStruct movableStruct;
+ vector<int> intVector;
+};
+
+void MoveConstructorTest::nb_destructor_calls()
+{
+ MovableStruct::reset();
+
+ try
+ {
+ Standalone standalone;
+ throw "some exception";
+ MovableStruct movableStruct;
+ }
+ catch (const char*)
+ {
+ CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 1 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 1 );
+ }
+}
+#endif
diff --git a/test/unit/mvctor_test.h b/test/unit/mvctor_test.h
new file mode 100644
index 0000000..8314db6
--- /dev/null
+++ b/test/unit/mvctor_test.h
@@ -0,0 +1,97 @@
+#include <cstdio> //size_t and STLport macros
+
+#include "cppunit/cppunit_proxy.h"
+
+//
+// TestCase class
+//
+class MoveConstructorTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(MoveConstructorTest);
+ CPPUNIT_TEST(move_construct_test);
+ CPPUNIT_TEST(deque_test);
+ CPPUNIT_TEST(vector_test);
+ CPPUNIT_TEST(move_traits);
+#if !defined (STLPORT) || defined (_STLP_NO_MOVE_SEMANTIC) || \
+ defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) || \
+ (defined (__BORLANDC__) && (__BORLANDC__ < 0x564))
+ CPPUNIT_IGNORE;
+# endif
+ CPPUNIT_TEST(movable_declaration)
+ CPPUNIT_TEST(movable_declaration_assoc)
+ CPPUNIT_TEST(movable_declaration_hash)
+#if defined (__BORLANDC__)
+ CPPUNIT_STOP_IGNORE;
+ CPPUNIT_TEST(nb_destructor_calls);
+#endif
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void move_construct_test();
+ void deque_test();
+ void vector_test();
+ void move_traits();
+ void movable_declaration();
+ void movable_declaration_assoc();
+ void movable_declaration_hash();
+ void nb_destructor_calls();
+
+ /*
+ template <class _Container>
+ void standard_test1(_Container const& ref_cont) {
+ vector<_Container> vec_cont(1, ref_cont);
+ typedef typename _Container::value_type value_type;
+ value_type *pvalue = &(*vec_cont.front().begin());
+ size_t cur_capacity= vec_cont.capacity();
+ //force reallocation
+ while (cur_capacity == vec_cont.capacity()) {
+ vec_cont.push_back(ref_cont);
+ }
+ bool b=( (pvalue==(&(*vec_cont.front().begin()))) );
+ CPPUNIT_ASSERT(b);
+ }
+ */
+
+private:
+ void move_traits_vec();
+ void move_traits_vec_complete();
+ void move_traits_deq();
+ void move_traits_deq_complete();
+};
+
+struct MovableStruct {
+ MovableStruct() { ++nb_dft_construct_call; }
+ MovableStruct(MovableStruct const&) { ++nb_cpy_construct_call; }
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+# if defined (_STLP_USE_NAMESPACES)
+ MovableStruct(std::__move_source<MovableStruct>)
+# else
+ MovableStruct(__move_source<MovableStruct>)
+# endif
+ { ++nb_mv_construct_call; }
+#endif
+ ~MovableStruct() { ++nb_destruct_call; }
+
+ MovableStruct& operator = (const MovableStruct&) {
+ ++nb_assignment_call;
+ return *this;
+ }
+
+ static void reset() {
+ nb_dft_construct_call = nb_cpy_construct_call = nb_mv_construct_call = 0;
+ nb_assignment_call = 0;
+ nb_destruct_call = 0;
+ }
+
+ static size_t nb_dft_construct_call;
+ static size_t nb_cpy_construct_call;
+ static size_t nb_mv_construct_call;
+ static size_t nb_assignment_call;
+ static size_t nb_destruct_call;
+
+ //Dummy data just to control struct sizeof
+ //As node allocator implementation align memory blocks on 2 * sizeof(void*)
+ //we give MovableStruct the same size in order to have expected allocation
+ //and not more
+ void* dummy_data[2];
+};
diff --git a/test/unit/mvctor_traits_test.cpp b/test/unit/mvctor_traits_test.cpp
new file mode 100644
index 0000000..7cea98f
--- /dev/null
+++ b/test/unit/mvctor_traits_test.cpp
@@ -0,0 +1,460 @@
+#include <vector>
+#include <deque>
+
+#include "mvctor_test.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+size_t MovableStruct::nb_dft_construct_call = 0;
+size_t MovableStruct::nb_cpy_construct_call = 0;
+size_t MovableStruct::nb_mv_construct_call = 0;
+size_t MovableStruct::nb_assignment_call = 0;
+size_t MovableStruct::nb_destruct_call = 0;
+
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+# if defined (_STLP_USE_NAMESPACES)
+namespace std {
+# endif
+ _STLP_TEMPLATE_NULL
+ struct __move_traits<MovableStruct> {
+ typedef __true_type implemented;
+ typedef __false_type complete;
+ };
+# if defined (_STLP_USE_NAMESPACES)
+}
+# endif
+#endif
+
+struct CompleteMovableStruct {
+ CompleteMovableStruct() { ++nb_dft_construct_call; }
+ CompleteMovableStruct(CompleteMovableStruct const&) { ++nb_cpy_construct_call; }
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CompleteMovableStruct(__move_source<CompleteMovableStruct>) { ++nb_mv_construct_call; }
+#endif
+ ~CompleteMovableStruct() { ++nb_destruct_call; }
+
+ CompleteMovableStruct& operator = (const CompleteMovableStruct&) {
+ ++nb_assignment_call;
+ return *this;
+ }
+ static void reset() {
+ nb_dft_construct_call = nb_cpy_construct_call = nb_mv_construct_call = 0;
+ nb_assignment_call = 0;
+ nb_destruct_call = 0;
+ }
+
+ static size_t nb_dft_construct_call;
+ static size_t nb_cpy_construct_call;
+ static size_t nb_mv_construct_call;
+ static size_t nb_assignment_call;
+ static size_t nb_destruct_call;
+
+ //See MovableStruct
+ void* dummy_data[2];
+};
+
+size_t CompleteMovableStruct::nb_dft_construct_call = 0;
+size_t CompleteMovableStruct::nb_cpy_construct_call = 0;
+size_t CompleteMovableStruct::nb_mv_construct_call = 0;
+size_t CompleteMovableStruct::nb_assignment_call = 0;
+size_t CompleteMovableStruct::nb_destruct_call = 0;
+
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+# if defined (_STLP_USE_NAMESPACES)
+namespace std {
+# endif
+ _STLP_TEMPLATE_NULL
+ struct __move_traits<CompleteMovableStruct> {
+ typedef __true_type implemented;
+ typedef __true_type complete;
+ };
+# if defined (_STLP_USE_NAMESPACES)
+}
+# endif
+#endif
+
+void MoveConstructorTest::move_traits()
+{
+ move_traits_vec();
+ move_traits_vec_complete();
+ move_traits_deq();
+ move_traits_deq_complete();
+}
+
+void MoveConstructorTest::move_traits_vec()
+{
+ {
+ {
+ vector<MovableStruct> vect;
+ vect.push_back(MovableStruct());
+ vect.push_back(MovableStruct());
+ vect.push_back(MovableStruct());
+ vect.push_back(MovableStruct());
+
+ // vect contains 4 elements
+ CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 4 );
+#if defined (STLPORT)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 4 );
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 3 );
+# else
+ CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 7 );
+# endif
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 7 );
+#elif !defined (_MSC_VER)
+ CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 7 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 7 );
+#else
+ CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 14 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 14 );
+#endif
+ CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 0 );
+
+ // Following test violate requirements to sequiences (23.1.1 Table 67)
+ /*
+ vect.insert(vect.begin() + 2, vect.begin(), vect.end());
+ // vect contains 8 elements
+ CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 4 );
+ CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 8 );
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 7 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 11 );
+ */
+
+ MovableStruct::reset();
+ vector<MovableStruct> v2 = vect;
+ CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 0 );
+ CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 4 );
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 0 );
+ CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 0 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 0 );
+
+ MovableStruct::reset();
+ vect.insert(vect.begin() + 2, v2.begin(), v2.end() );
+
+ // vect contains 8 elements
+ CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 0 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 4 );
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 4 );
+#else
+ CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 8 );
+#endif
+ CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 0 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 4 );
+
+ MovableStruct::reset();
+ vect.erase(vect.begin(), vect.begin() + 2 );
+
+ // vect contains 6 elements
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 6 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 8 );
+#else
+ CPPUNIT_ASSERT_EQUAL( MovableStruct::nb_assignment_call, 6 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 2 );
+#endif
+
+ MovableStruct::reset();
+ vect.erase(vect.end() - 2, vect.end());
+
+ // vect contains 4 elements
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 0 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 2 );
+
+ MovableStruct::reset();
+ vect.erase(vect.begin());
+
+ // vect contains 3 elements
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 3 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 4 );
+#else
+ CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 3 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 1 );
+#endif
+
+ MovableStruct::reset();
+ }
+ //vect with 3 elements and v2 with 4 elements are now out of scope
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 3 + 4 );
+ }
+}
+
+void MoveConstructorTest::move_traits_vec_complete()
+{
+ {
+ {
+ vector<CompleteMovableStruct> vect;
+ vect.push_back(CompleteMovableStruct());
+ vect.push_back(CompleteMovableStruct());
+ vect.push_back(CompleteMovableStruct());
+ vect.push_back(CompleteMovableStruct());
+
+ // vect contains 4 elements
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 4 );
+#if defined (STLPORT)
+# if !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 4 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 3 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 4 );
+# else
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 7 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 7 );
+# endif
+#elif !defined (_MSC_VER)
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 7 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 7 );
+#else
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 14 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 14 );
+#endif
+
+ // Following test violate requirements to sequiences (23.1.1 Table 67)
+ /*
+ vect.insert(vect.begin() + 2, vect.begin(), vect.end());
+
+ // vect contains 8 elements
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 4 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 8 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 7 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 4 );
+ */
+
+ CompleteMovableStruct::reset();
+ vector<CompleteMovableStruct> v2 = vect;
+
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 0 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 4 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 0 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 0 );
+
+ CompleteMovableStruct::reset();
+ vect.insert(vect.begin() + 2, v2.begin(), v2.end());
+
+ // vect contains 8 elements
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 0 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 4 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 4 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 0 );
+#else
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 8 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 4 );
+#endif
+
+ CompleteMovableStruct::reset();
+ vect.erase(vect.begin(), vect.begin() + 2);
+
+ // vect contains 6 elements
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 6 );
+#else
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_assignment_call == 6 );
+#endif
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 2 );
+
+ CompleteMovableStruct::reset();
+ vect.erase(vect.end() - 2, vect.end());
+
+ // vect contains 4 elements
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 0 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 2 );
+
+ CompleteMovableStruct::reset();
+ vect.erase(vect.begin());
+
+ // vect contains 3 elements
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 3 );
+#else
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_assignment_call == 3 );
+#endif
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 1 );
+
+ CompleteMovableStruct::reset();
+ }
+ //vect with 3 elements and v2 with 4 elements are now out of scope
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 3 + 4 );
+ }
+}
+
+void MoveConstructorTest::move_traits_deq()
+{
+ {
+ MovableStruct::reset();
+ {
+ deque<MovableStruct> deq;
+ deq.push_back(MovableStruct());
+ deq.push_back(MovableStruct());
+ deq.push_back(MovableStruct());
+ deq.push_back(MovableStruct());
+
+ // deq contains 4 elements
+ CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 4 );
+ CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 4 );
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 0 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 4 );
+
+ // Following test violate requirements to sequiences (23.1.1 Table 67)
+ /*
+ deq.insert(deq.begin() + 2, deq.begin(), deq.end());
+ // deq contains 8 elements
+ CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 4 );
+ CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 8 );
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 7 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 11 );
+ */
+
+ MovableStruct::reset();
+ deque<MovableStruct> d2 = deq;
+
+ CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 0 );
+ CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 4 );
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 0 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 0 );
+
+ MovableStruct::reset();
+ deq.insert(deq.begin() + 2, d2.begin(), d2.end() );
+
+ // deq contains 8 elements
+ CPPUNIT_ASSERT( MovableStruct::nb_dft_construct_call == 0 );
+ CPPUNIT_ASSERT( MovableStruct::nb_cpy_construct_call == 4 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 2 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 2 );
+#else
+ CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 2 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 0 );
+#endif
+
+ MovableStruct::reset();
+ deq.erase(deq.begin() + 1, deq.begin() + 3 );
+
+ // deq contains 6 elements
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 1 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 3 );
+#else
+ //Following check is highly deque implementation dependant so
+ //it might not always work...
+ CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 1 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 2 );
+#endif
+
+ MovableStruct::reset();
+ deq.erase(deq.end() - 3, deq.end() - 1);
+
+ // deq contains 4 elements
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 1 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 3 );
+#else
+ CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 1 );
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 2 );
+#endif
+
+ MovableStruct::reset();
+ deq.erase(deq.begin());
+
+ // deq contains 3 elements
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( MovableStruct::nb_mv_construct_call == 0 );
+#else
+ CPPUNIT_ASSERT( MovableStruct::nb_assignment_call == 0 );
+#endif
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 1 );
+
+ MovableStruct::reset();
+ }
+ //deq with 3 elements and d2 with 4 elements are now out of scope
+ CPPUNIT_ASSERT( MovableStruct::nb_destruct_call == 3 + 4 );
+ }
+}
+
+void MoveConstructorTest::move_traits_deq_complete()
+{
+ {
+ CompleteMovableStruct::reset();
+ {
+ deque<CompleteMovableStruct> deq;
+ deq.push_back(CompleteMovableStruct());
+ deq.push_back(CompleteMovableStruct());
+ deq.push_back(CompleteMovableStruct());
+ deq.push_back(CompleteMovableStruct());
+
+ // deq contains 4 elements
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 4 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 4 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 0 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 4 );
+
+ // Following test violate requirements to sequiences (23.1.1 Table 67)
+ /*
+ deq.insert(deq.begin() + 2, deq.begin(), deq.end());
+
+ // deq contains 8 elements
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 4 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 8 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 7 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 4 );
+ */
+
+ CompleteMovableStruct::reset();
+ deque<CompleteMovableStruct> d2 = deq;
+
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 0 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 4 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 0 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 0 );
+
+ CompleteMovableStruct::reset();
+ deq.insert(deq.begin() + 2, d2.begin(), d2.end());
+
+ // deq contains 8 elements
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_dft_construct_call == 0 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_cpy_construct_call == 4 );
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 2 );
+#else
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_assignment_call == 2 );
+#endif
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 0 );
+
+ CompleteMovableStruct::reset();
+ deq.erase(deq.begin() + 1, deq.begin() + 3);
+
+ // deq contains 6 elements
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 1 );
+#else
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_assignment_call == 1 );
+#endif
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 2 );
+
+ CompleteMovableStruct::reset();
+ deq.erase(deq.end() - 3, deq.end() - 1);
+
+ // deq contains 4 elements
+#if defined (STLPORT) && !defined (_STLP_NO_MOVE_SEMANTIC)
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 1 );
+#else
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_assignment_call == 1 );
+#endif
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 2 );
+
+ CompleteMovableStruct::reset();
+ deq.erase(deq.begin());
+
+ // deq contains 3 elements
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_mv_construct_call == 0 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_assignment_call == 0 );
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 1 );
+
+ CompleteMovableStruct::reset();
+ }
+ //deq with 3 elements and v2 with 4 elements are now out of scope
+ CPPUNIT_ASSERT( CompleteMovableStruct::nb_destruct_call == 3 + 4 );
+ }
+}
diff --git a/test/unit/neq_test.cpp b/test/unit/neq_test.cpp
new file mode 100644
index 0000000..7769e42
--- /dev/null
+++ b/test/unit/neq_test.cpp
@@ -0,0 +1,54 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class NeqTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(NeqTest);
+ CPPUNIT_TEST(negate0);
+ CPPUNIT_TEST(nequal0);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void negate0();
+ void nequal0();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(NeqTest);
+
+//
+// tests implementation
+//
+void NeqTest::negate0()
+{
+ int input [3] = { 1, 2, 3 };
+
+ int output[3];
+ transform((int*)input, (int*)input + 3, (int*)output, negate<int>());
+
+ CPPUNIT_ASSERT(output[0]==-1);
+ CPPUNIT_ASSERT(output[1]==-2);
+ CPPUNIT_ASSERT(output[2]==-3);
+}
+void NeqTest::nequal0()
+{
+ int input1 [4] = { 1, 7, 2, 2 };
+ int input2 [4] = { 1, 6, 2, 3 };
+
+ int output [4];
+ transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, not_equal_to<int>());
+
+ CPPUNIT_ASSERT(output[0]==0);
+ CPPUNIT_ASSERT(output[1]==1);
+ CPPUNIT_ASSERT(output[2]==0);
+ CPPUNIT_ASSERT(output[3]==1);
+}
diff --git a/test/unit/new_header_test.cpp b/test/unit/new_header_test.cpp
new file mode 100644
index 0000000..1884299
--- /dev/null
+++ b/test/unit/new_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <new>
diff --git a/test/unit/nthelm_test.cpp b/test/unit/nthelm_test.cpp
new file mode 100644
index 0000000..75c26d1
--- /dev/null
+++ b/test/unit/nthelm_test.cpp
@@ -0,0 +1,84 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class NthElemTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(NthElemTest);
+ CPPUNIT_TEST(nthelem0);
+ CPPUNIT_TEST(nthelem1);
+ CPPUNIT_TEST(nthelem2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void nthelem0();
+ void nthelem1();
+ void nthelem2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(NthElemTest);
+
+//
+// tests implementation
+//
+void NthElemTest::nthelem0()
+{
+ int numbers[7] = { 5, 2, 4, 1, 0, 3 ,77};
+ nth_element(numbers, numbers + 3, numbers + 6);
+
+ CPPUNIT_ASSERT(numbers[0]==1);
+ CPPUNIT_ASSERT(numbers[1]==0);
+ CPPUNIT_ASSERT(numbers[2]==2);
+ CPPUNIT_ASSERT(numbers[3]==3);
+ CPPUNIT_ASSERT(numbers[4]==4);
+ CPPUNIT_ASSERT(numbers[5]==5);
+}
+void NthElemTest::nthelem1()
+{
+ //6 8 5 1 7 4 1 5 2 6
+ //1 1 4 2 5 5 6 7 8 6
+ int numbers[10] = { 6, 8, 5, 1, 7, 4, 1, 5, 2, 6 };
+
+ vector <int> v1(numbers, numbers+10);
+ nth_element(v1.begin(), v1.begin() + v1.size() / 2, v1.end());
+
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==4);
+ CPPUNIT_ASSERT(v1[3]==2);
+ CPPUNIT_ASSERT(v1[4]==5);
+ CPPUNIT_ASSERT(v1[5]==5);
+ CPPUNIT_ASSERT(v1[6]==6);
+ CPPUNIT_ASSERT(v1[7]==7);
+ CPPUNIT_ASSERT(v1[8]==8);
+ CPPUNIT_ASSERT(v1[9]==6);
+}
+void NthElemTest::nthelem2()
+{
+ //4 5 4 2 1 7 4 3 1 6
+ //6 7 4 4 5 4 3 2 1 1
+
+ int numbers[10] = { 4, 5, 4, 2, 1, 7, 4, 3, 1, 6 };
+ vector <int> v1(numbers, numbers+10);
+ nth_element(v1.begin(), v1.begin() + v1.size() / 2, v1.end(), greater<int>());
+
+ CPPUNIT_ASSERT(v1[0]==6);
+ CPPUNIT_ASSERT(v1[1]==7);
+ CPPUNIT_ASSERT(v1[2]==4);
+ CPPUNIT_ASSERT(v1[3]==4);
+ CPPUNIT_ASSERT(v1[4]==5);
+ CPPUNIT_ASSERT(v1[5]==4);
+ CPPUNIT_ASSERT(v1[6]==3);
+ CPPUNIT_ASSERT(v1[7]==2);
+ CPPUNIT_ASSERT(v1[8]==1);
+ CPPUNIT_ASSERT(v1[9]==1);
+}
diff --git a/test/unit/num_facets_test.cpp b/test/unit/num_facets_test.cpp
new file mode 100644
index 0000000..bc5195f
--- /dev/null
+++ b/test/unit/num_facets_test.cpp
@@ -0,0 +1,297 @@
+#include "locale_test.h"
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <locale>
+# include <sstream>
+# include <stdexcept>
+
+# include "complete_digits.h"
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+struct ref_locale {
+ const char *name;
+ const char *decimal_point;
+ const char *thousands_sep;
+};
+
+static const ref_locale tested_locales[] = {
+//{ name, decimal_point, thousands_sepy_thousands_sep},
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ { "fr_FR", ",", "\xa0"},
+ { "ru_RU.koi8r", ",", "."},
+ { "en_GB", ".", ","},
+ { "en_US", ".", ","},
+# endif
+ { "C", ".", ","},
+};
+
+//
+// tests implementation
+//
+void LocaleTest::_num_put_get( const locale& loc, const ref_locale* prl ) {
+ const ref_locale& rl = *prl;
+ CPPUNIT_ASSERT( has_facet<numpunct<char> >(loc) );
+ numpunct<char> const& npct = use_facet<numpunct<char> >(loc);
+ CPPUNIT_ASSERT( npct.decimal_point() == *rl.decimal_point );
+
+ float val = 1234.56f;
+ ostringstream fostr;
+ fostr.imbue(loc);
+ fostr << val;
+
+ string ref = "1";
+ if (!npct.grouping().empty()) {
+ ref += npct.thousands_sep();
+ }
+ ref += "234";
+ ref += npct.decimal_point();
+ ref += "56";
+ //cout << "In " << loc.name() << " 1234.56 is written: " << fostr.str() << endl;
+ CPPUNIT_ASSERT( fostr.str() == ref );
+
+ val = 12345678.9f;
+ ref = "1";
+ ref += npct.decimal_point();
+ ref += "23457e+";
+ string digits = "7";
+ complete_digits(digits);
+ ref += digits;
+ fostr.str("");
+ fostr << val;
+ CPPUNIT_ASSERT( fostr.str() == ref );
+
+ val = 1000000000.0f;
+ fostr.str("");
+ fostr << val;
+ digits = "9";
+ complete_digits(digits);
+ CPPUNIT_ASSERT( fostr.str() == string("1e+") + digits );
+
+ val = 1234.0f;
+ ref = "1";
+ if (!npct.grouping().empty()) {
+ ref += npct.thousands_sep();
+ }
+ ref += "234";
+ fostr.str("");
+ fostr << val;
+ CPPUNIT_ASSERT( fostr.str() == ref );
+
+ val = 10000001.0f;
+ fostr.str("");
+ fostr << val;
+ digits = "7";
+ complete_digits(digits);
+ CPPUNIT_ASSERT( fostr.str() == string("1e+") + digits );
+
+ if (npct.grouping().size() == 1 && npct.grouping()[0] == 3) {
+ int ival = 1234567890;
+ fostr.str("");
+ fostr << ival;
+ ref = "1";
+ ref += npct.thousands_sep();
+ ref += "234";
+ ref += npct.thousands_sep();
+ ref += "567";
+ ref += npct.thousands_sep();
+ ref += "890";
+ CPPUNIT_ASSERT( fostr.str() == ref );
+ }
+
+#if defined (__BORLANDC__)
+ num_put<char> const& nput = use_facet<num_put<char> >(loc);
+ typedef numeric_limits<double> limd;
+ fostr.setf(ios_base::uppercase | ios_base::showpos);
+
+ if (limd::has_infinity) {
+ double infinity = limd::infinity();
+ fostr.str("");
+ nput.put(fostr, fostr, ' ', infinity);
+ CPPUNIT_ASSERT( fostr.str() == string("+Inf") );
+ }
+
+ if (limd::has_quiet_NaN) {
+ /* Ignore FPU exceptions */
+ unsigned int _float_control_word = _control87(0, 0);
+ _control87(EM_INVALID|EM_INEXACT, MCW_EM);
+ double qnan = limd::quiet_NaN();
+ /* Reset floating point control word */
+ _clear87();
+ _control87(_float_control_word, MCW_EM);
+ fostr.str("");
+ nput.put(fostr, fostr, ' ', qnan);
+ CPPUNIT_ASSERT( fostr.str() == string("+NaN") );
+ }
+#endif
+}
+
+typedef void (LocaleTest::*_Test) (const locale&, const ref_locale*);
+static void test_supported_locale(LocaleTest& inst, _Test __test) {
+ size_t n = sizeof(tested_locales) / sizeof(tested_locales[0]);
+ for (size_t i = 0; i < n; ++i) {
+ locale loc;
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try
+# endif
+ {
+ locale tmp(tested_locales[i].name);
+ loc = tmp;
+ }
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ catch (runtime_error const&) {
+ //This locale is not supported.
+ continue;
+ }
+# endif
+ CPPUNIT_MESSAGE( loc.name().c_str() );
+ (inst.*__test)(loc, tested_locales + i);
+
+ {
+ locale tmp(locale::classic(), tested_locales[i].name, locale::numeric);
+ loc = tmp;
+ }
+ (inst.*__test)(loc, tested_locales + i);
+
+ {
+ locale tmp(locale::classic(), new numpunct_byname<char>(tested_locales[i].name));
+ loc = tmp;
+ }
+ (inst.*__test)(loc, tested_locales + i);
+ }
+}
+
+void LocaleTest::num_put_get()
+{ test_supported_locale(*this, &LocaleTest::_num_put_get); }
+
+void LocaleTest::numpunct_by_name()
+{
+ /*
+ * Check of the 22.1.1.2.7 standard point. Construction of a locale
+ * instance from a null pointer or an unknown name should result in
+ * a runtime_error exception.
+ */
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+# if defined (STLPORT) || !defined (__GNUC__)
+ try {
+ locale loc(locale::classic(), new numpunct_byname<char>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new numpunct_byname<char>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ string veryLongFacetName("LC_NUMERIC=");
+ veryLongFacetName.append(512, '?');
+ locale loc(locale::classic(), new numpunct_byname<char>(veryLongFacetName.c_str()));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), "C", locale::numeric);
+ }
+ catch (runtime_error const& e) {
+ CPPUNIT_MESSAGE( e.what() );
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ // On platform without real localization support we should rely on the "C" facet.
+ locale loc(locale::classic(), "", locale::numeric);
+ }
+ catch (runtime_error const& e) {
+ CPPUNIT_MESSAGE( e.what() );
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), new numpunct_byname<char>("C"));
+ numpunct<char> const& cfacet_byname = use_facet<numpunct<char> >(loc);
+ numpunct<char> const& cfacet = use_facet<numpunct<char> >(locale::classic());
+
+ CPPUNIT_CHECK( cfacet_byname.decimal_point() == cfacet.decimal_point() );
+ CPPUNIT_CHECK( cfacet_byname.grouping() == cfacet.grouping() );
+ if (!cfacet.grouping().empty())
+ CPPUNIT_CHECK( cfacet_byname.thousands_sep() == cfacet.thousands_sep() );
+# if !defined (STLPORT) || !defined (__GLIBC__)
+ CPPUNIT_CHECK( cfacet_byname.truename() == cfacet.truename() );
+ CPPUNIT_CHECK( cfacet_byname.falsename() == cfacet.falsename() );
+# endif
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ // On platform without real localization support we should rely on the "C" locale facet.
+ locale loc(locale::classic(), new numpunct_byname<char>(""));
+ }
+ catch (runtime_error const& e) {
+ CPPUNIT_MESSAGE( e.what() );
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+# if defined (STLPORT) || !defined (__GNUC__)
+ try {
+ locale loc(locale::classic(), new numpunct_byname<wchar_t>(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new numpunct_byname<wchar_t>("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+# endif
+}
+
+#endif
diff --git a/test/unit/num_put_get_test.cpp b/test/unit/num_put_get_test.cpp
new file mode 100644
index 0000000..13b250f
--- /dev/null
+++ b/test/unit/num_put_get_test.cpp
@@ -0,0 +1,1266 @@
+#include <limits>
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <iomanip>
+# include <string>
+# include <sstream>
+# include <cstdio>
+/*
+# include <iostream>
+# include <ieee754.h>
+*/
+
+# include "complete_digits.h"
+# include "cppunit/cppunit_proxy.h"
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+//
+// TestCase class
+//
+class NumPutGetTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(NumPutGetTest);
+# if defined (__BORLANDC__)
+ /* Ignore FPU exceptions, set FPU precision to 64 bits */
+ unsigned int _float_control_word = _control87(0, 0);
+ _control87(PC_64|MCW_EM|IC_AFFINE, MCW_PC|MCW_EM|MCW_IC);
+# endif
+ CPPUNIT_TEST(num_put_float);
+ CPPUNIT_TEST(num_put_integer);
+ CPPUNIT_TEST(num_get_float);
+ CPPUNIT_TEST(num_get_integer);
+ CPPUNIT_TEST(inhex);
+ CPPUNIT_TEST(pointer);
+ CPPUNIT_TEST(fix_float_long);
+ CPPUNIT_TEST(custom_numpunct);
+# if defined (__BORLANDC__)
+ /* Reset floating point control word */
+ _clear87();
+ _control87(_float_control_word, MCW_PC|MCW_EM|MCW_IC);
+# endif
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ void num_put_float();
+ void num_put_integer();
+ void num_get_float();
+ void num_get_integer();
+ void inhex();
+ void pointer();
+ void fix_float_long();
+ void custom_numpunct();
+
+ static bool check_float(float val, float ref)
+ {
+ float epsilon = numeric_limits<float>::epsilon();
+ return val <= ref + epsilon && val >= ref - epsilon;
+ }
+
+ static bool check_double(double val, double ref)
+ {
+ double epsilon = numeric_limits<double>::epsilon();
+ return val <= ref + epsilon && val >= ref - epsilon;
+ }
+
+ static string reset_stream(ostringstream &ostr)
+ {
+ string tmp = ostr.str();
+ ostr.str("");
+ return tmp;
+ }
+
+#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES)
+ template <class F>
+ void check_get_float( F v )
+ {
+ F in_val_d = v;
+ typedef numeric_limits<F> limits;
+ {
+ stringstream str;
+
+ str << "1E+" << limits::max_exponent10;
+
+ str >> in_val_d;
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_CHECK( in_val_d == in_val_d );
+ CPPUNIT_CHECK( in_val_d != limits::infinity() );
+ }
+ {
+ stringstream str;
+
+ str << "-1E+" << limits::max_exponent10;
+
+ str >> in_val_d;
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_CHECK( in_val_d == in_val_d );
+ CPPUNIT_CHECK( in_val_d != -limits::infinity() );
+ }
+ {
+ stringstream str;
+
+ str << "1E" << limits::min_exponent10;
+
+ str >> in_val_d;
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_CHECK( in_val_d == in_val_d );
+ CPPUNIT_CHECK( in_val_d != F(0.0) );
+ }
+ {
+ stringstream str;
+
+ str << "1E+" << (limits::max_exponent10 + 1);
+
+ str >> in_val_d;
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_CHECK( in_val_d == in_val_d );
+ CPPUNIT_CHECK( in_val_d == limits::infinity() );
+ }
+ {
+ stringstream str;
+
+ str << "-1E+" << (limits::max_exponent10 + 1);
+
+ str >> in_val_d;
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_CHECK( in_val_d == in_val_d );
+ CPPUNIT_CHECK( in_val_d == -limits::infinity() );
+ }
+ {
+ stringstream str;
+
+ str << "1E" << (limits::min_exponent10 - 1);
+
+ str >> in_val_d;
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_CHECK( in_val_d == in_val_d );
+ CPPUNIT_CHECK( in_val_d >= F(0.0) && in_val_d <= limits::min() );
+ }
+#if !defined (__MINGW32__)
+ {
+ stringstream str;
+
+ str << limits::max();
+
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_CHECK( str.str() != "inf" );
+ CPPUNIT_CHECK( str.str() != "-inf" );
+ CPPUNIT_CHECK( str.str() != "nan" );
+ CPPUNIT_CHECK( str.str() != "-nan" );
+ //CPPUNIT_MESSAGE( str.str().c_str() );
+
+ //str.str("");
+ //str << limits::max_exponent10;
+ //CPPUNIT_MESSAGE( str.str().c_str() );
+
+ str >> in_val_d;
+
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_CHECK( in_val_d == in_val_d );
+ CPPUNIT_CHECK( in_val_d != limits::infinity() );
+ }
+ {
+ stringstream str;
+
+ str << fixed << limits::max();
+
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_CHECK( str.str() != "inf" );
+ CPPUNIT_CHECK( str.str() != "-inf" );
+ CPPUNIT_CHECK( str.str() != "nan" );
+ CPPUNIT_CHECK( str.str() != "-nan" );
+ //CPPUNIT_MESSAGE( str.str().c_str() );
+
+ //str.str("");
+ //str << limits::max_exponent10;
+ //CPPUNIT_MESSAGE( str.str().c_str() );
+
+ str >> in_val_d;
+
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_CHECK( in_val_d == in_val_d );
+ CPPUNIT_CHECK( in_val_d != limits::infinity() );
+ }
+ {
+ stringstream str;
+
+ str << scientific << setprecision(50) << limits::max();
+
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_CHECK( str.str() != "inf" );
+ CPPUNIT_CHECK( str.str() != "-inf" );
+ CPPUNIT_CHECK( str.str() != "nan" );
+ CPPUNIT_CHECK( str.str() != "-nan" );
+ //CPPUNIT_MESSAGE( str.str().c_str() );
+
+ //str.str("");
+ //str << limits::max_exponent10;
+ //CPPUNIT_MESSAGE( str.str().c_str() );
+
+ str >> in_val_d;
+
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_CHECK( in_val_d == in_val_d );
+ CPPUNIT_CHECK( in_val_d != limits::infinity() );
+ }
+#endif
+ {
+ stringstream str;
+
+ str << limits::infinity();
+
+ CPPUNIT_ASSERT( !str.fail() );
+ CPPUNIT_ASSERT( !limits::has_infinity || str.str() == "inf" );
+ }
+ {
+ stringstream str;
+
+ str << -limits::infinity();
+
+ CPPUNIT_ASSERT( !str.fail() );
+ CPPUNIT_ASSERT( !limits::has_infinity || str.str() == "-inf" );
+ }
+ {
+ stringstream str;
+
+ str << limits::quiet_NaN();
+
+ CPPUNIT_ASSERT( !str.fail() );
+ CPPUNIT_ASSERT( !limits::has_quiet_NaN || str.str() == "nan" );
+ }
+ {
+ stringstream str;
+
+ str << -limits::quiet_NaN();
+
+ CPPUNIT_ASSERT( !str.fail() );
+ CPPUNIT_ASSERT( !limits::has_quiet_NaN || str.str() == "-nan" );
+ }
+ {
+ stringstream str;
+
+ str << "0." << string(limits::max_exponent10, '0') << "1e" << (limits::max_exponent10 + 1);
+ CPPUNIT_ASSERT( !str.fail() );
+
+ str >> in_val_d;
+ CPPUNIT_ASSERT( !str.fail() );
+ CPPUNIT_ASSERT( str.eof() );
+ CPPUNIT_CHECK( in_val_d == 1 );
+ }
+ {
+ stringstream str;
+
+ str << "1" << string(-(limits::min_exponent10 - 1), '0') << "e" << (limits::min_exponent10 - 1);
+ CPPUNIT_ASSERT( !str.fail() );
+
+ str >> in_val_d;
+ CPPUNIT_ASSERT( !str.fail() );
+ CPPUNIT_ASSERT( str.eof() );
+ CPPUNIT_CHECK( in_val_d == 1 );
+ }
+# if defined (_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x530)
+ // The following tests are showing that simply changing stream
+ // precision lead to different result. Do not seems to be a real
+ // problem, simply rounding approximation but additional study should
+ // be done after 5.2 release.
+ {
+ stringstream str;
+ str << setprecision(limits::digits10 + 2) << limits::max();
+
+ CPPUNIT_MESSAGE(str.str().c_str());
+ CPPUNIT_ASSERT( !str.fail() );
+
+ F val;
+ str >> val;
+
+ CPPUNIT_ASSERT( !str.fail() );
+ CPPUNIT_ASSERT( limits::infinity() > val );
+ }
+ {
+ stringstream str;
+ str << setprecision(limits::digits10 + 1) << limits::max();
+
+ CPPUNIT_MESSAGE(str.str().c_str());
+ CPPUNIT_ASSERT( !str.fail() );
+
+ F val;
+ str >> val;
+
+ CPPUNIT_ASSERT( !str.fail() );
+ CPPUNIT_ASSERT( limits::infinity() > val );
+ }
+# endif
+ }
+#else
+# define __check_get_float( F ) \
+ void check_get_float( F v ) \
+ { \
+ F in_val_d = v; \
+ { \
+ stringstream str; \
+ \
+ str << "1E+" << numeric_limits<F>::max_exponent10; \
+ \
+ str >> in_val_d; \
+ CPPUNIT_ASSERT(!str.fail()); \
+ CPPUNIT_ASSERT(str.eof()); \
+ CPPUNIT_CHECK( in_val_d == in_val_d ); \
+ CPPUNIT_CHECK( in_val_d != numeric_limits<F>::infinity() ); \
+ } \
+ { \
+ stringstream str; \
+ \
+ str << "-1E+" << numeric_limits<F>::max_exponent10; \
+ \
+ str >> in_val_d; \
+ CPPUNIT_ASSERT(!str.fail()); \
+ CPPUNIT_ASSERT(str.eof()); \
+ CPPUNIT_CHECK( in_val_d == in_val_d ); \
+ CPPUNIT_CHECK( in_val_d != -numeric_limits<F>::infinity() ); \
+ } \
+ { \
+ stringstream str; \
+ \
+ str << "1E" << numeric_limits<F>::min_exponent10; \
+ \
+ str >> in_val_d; \
+ CPPUNIT_ASSERT(!str.fail()); \
+ CPPUNIT_ASSERT(str.eof()); \
+ CPPUNIT_CHECK( in_val_d == in_val_d ); \
+ CPPUNIT_CHECK( in_val_d != F(0.0) ); \
+ } \
+ { \
+ stringstream str; \
+ \
+ str << "1E+" << (numeric_limits<F>::max_exponent10 + 1); \
+ \
+ str >> in_val_d; \
+ CPPUNIT_ASSERT(!str.fail()); \
+ CPPUNIT_ASSERT(str.eof()); \
+ CPPUNIT_CHECK( in_val_d == in_val_d ); \
+ CPPUNIT_CHECK( in_val_d == numeric_limits<F>::infinity() ); \
+ } \
+ { \
+ stringstream str; \
+ \
+ str << "-1E+" << (numeric_limits<F>::max_exponent10 + 1); \
+ \
+ str >> in_val_d; \
+ CPPUNIT_ASSERT(!str.fail()); \
+ CPPUNIT_ASSERT(str.eof()); \
+ CPPUNIT_CHECK( in_val_d == in_val_d ); \
+ CPPUNIT_CHECK( in_val_d == -numeric_limits<F>::infinity() ); \
+ } \
+ { \
+ stringstream str; \
+ \
+ str << "1E" << (numeric_limits<F>::min_exponent10 - 1); \
+ \
+ str >> in_val_d; \
+ CPPUNIT_ASSERT(!str.fail()); \
+ CPPUNIT_ASSERT(str.eof()); \
+ CPPUNIT_CHECK( in_val_d == in_val_d ); \
+ CPPUNIT_CHECK( in_val_d >= F(0.0) && in_val_d <= numeric_limits<F>::min() ); \
+ } \
+ }
+
+ __check_get_float( float )
+ __check_get_float( double )
+# if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
+ __check_get_float( long double )
+# endif
+# undef __check_get_float
+#endif // _STLP_NO_MEMBER_TEMPLATES
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(NumPutGetTest);
+
+#if defined (_MSC_VER)
+# pragma warning (disable : 4056)
+# pragma warning (disable : 4756)
+#endif
+
+//
+// tests implementation
+//
+void NumPutGetTest::num_put_float()
+{
+ {
+ string output, digits;
+
+ {
+ ostringstream ostr;
+ ostr << 1.23457e+17f;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ digits = "17";
+ complete_digits(digits);
+ CPPUNIT_CHECK(output == string("1.23457e+") + digits );
+ }
+
+ {
+ ostringstream ostr;
+ ostr << setprecision(200) << 1.23457e+17f;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ CPPUNIT_CHECK( output.size() < 200 );
+ }
+
+ {
+ ostringstream ostr;
+ ostr << setprecision(200) << numeric_limits<float>::min();
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ CPPUNIT_CHECK( output.size() < 200 );
+ }
+
+ {
+ ostringstream ostr;
+ ostr << fixed << 1.23457e+17f;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ CPPUNIT_CHECK(output.size() == 25);
+ CPPUNIT_CHECK(output.substr(0, 5) == "12345");
+ CPPUNIT_CHECK(output.substr(18) == ".000000");
+ }
+
+ {
+ ostringstream ostr;
+ ostr << fixed << showpos << 1.23457e+17f;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ CPPUNIT_CHECK(output.size() == 26);
+ CPPUNIT_CHECK(output.substr(0, 6) == "+12345");
+ CPPUNIT_CHECK(output.substr(19) == ".000000");
+ }
+
+ {
+ ostringstream ostr;
+ ostr << fixed << showpos << setprecision(100) << 1.23457e+17f;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ CPPUNIT_CHECK(output.size() == 120);
+ CPPUNIT_CHECK(output.substr(0, 6) == "+12345");
+ CPPUNIT_CHECK(output.substr(19) == ".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" );
+ }
+
+ {
+ ostringstream ostr;
+ ostr << scientific << setprecision(8) << 0.12345678f;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ digits = "1";
+ complete_digits(digits);
+ CPPUNIT_CHECK(output == string("1.23456780e-") + digits );
+ }
+
+ {
+ ostringstream ostr;
+ ostr << fixed << setprecision(8) << setw(30) << setfill('0') << 0.12345678f;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ CPPUNIT_CHECK(output == "000000000000000000000.12345678");
+ }
+
+ {
+ ostringstream ostr;
+ ostr << fixed << showpos << setprecision(8) << setw(30) << setfill('0') << 0.12345678f;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ CPPUNIT_CHECK(output == "0000000000000000000+0.12345678");
+ }
+
+ {
+ ostringstream ostr;
+ ostr << fixed << showpos << setprecision(8) << setw(30) << left << setfill('0') << 0.12345678f;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ CPPUNIT_CHECK(output == "+0.123456780000000000000000000");
+ }
+
+ {
+ ostringstream ostr;
+ ostr << fixed << showpos << setprecision(8) << setw(30) << internal << setfill('0') << 0.12345678f;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ CPPUNIT_CHECK(output == "+00000000000000000000.12345678");
+ }
+
+ {
+ ostringstream ostr;
+ ostr << fixed << showpos << setprecision(100) << 1.234567e+17;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ CPPUNIT_CHECK(output.size() == 120);
+ CPPUNIT_CHECK(output.substr(0, 6) == "+12345");
+ CPPUNIT_CHECK(output.substr(19) == ".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" );
+ }
+
+#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
+ {
+ ostringstream ostr;
+ ostr << fixed << showpos << setprecision(100) << 1.234567e+17l;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ CPPUNIT_CHECK(output.size() == 120);
+ CPPUNIT_CHECK(output.substr(0, 6) == "+12345");
+ CPPUNIT_CHECK(output.substr(19) == ".0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" );
+ }
+#endif
+
+ {
+ ostringstream ostr;
+ ostr << scientific << setprecision(50) << 0.0;
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ CPPUNIT_CHECK( output == "0.00000000000000000000000000000000000000000000000000e+00" );
+ }
+ {
+ ostringstream ostr;
+ ostr << fixed << setprecision(100) << numeric_limits<float>::max();
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ //CPPUNIT_MESSAGE( output.c_str() );
+ }
+
+ {
+ ostringstream ostr;
+ ostr << setprecision(100) << numeric_limits<double>::max();
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ //CPPUNIT_MESSAGE( output.c_str() );
+ }
+
+#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
+ {
+ ostringstream ostr;
+ ostr << setprecision(100) << numeric_limits<long double>::max();
+ CPPUNIT_ASSERT(ostr.good());
+ output = reset_stream(ostr);
+ //CPPUNIT_MESSAGE( output.c_str() );
+ }
+#endif
+
+ //{
+ // ostringstream ostr;
+ // ostr << setprecision(-numeric_limits<float>::min_exponent10 + numeric_limits<float>::digits10 + 9) << numeric_limits<float>::min();
+ // CPPUNIT_ASSERT(ostr.good());
+ // output = reset_stream(ostr);
+ // //CPPUNIT_MESSAGE( output.c_str() );
+ //}
+
+ //{
+ // ostringstream ostr;
+ // ostr << setprecision(-numeric_limits<double>::min_exponent10 + numeric_limits<double>::digits10) << numeric_limits<double>::min();
+ // CPPUNIT_ASSERT(ostr.good());
+ // output = reset_stream(ostr);
+ // //CPPUNIT_MESSAGE( output.c_str() );
+ //}
+
+//#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
+// {
+// ostringstream ostr;
+// ostr << setprecision(-numeric_limits<long double>::min_exponent10 + numeric_limits<long double>::digits10) << numeric_limits<long double>::min();
+// CPPUNIT_ASSERT(ostr.good());
+// output = reset_stream(ostr);
+// CPPUNIT_MESSAGE( output.c_str() );
+// }
+//#endif
+ }
+
+ {
+ ostringstream str;
+
+ str.setf(ios::fixed, ios::floatfield);
+ str << 1.0e+5;
+ // cerr << str.str() << endl;
+ CPPUNIT_CHECK( str.str() == "100000.000000" );
+
+ reset_stream(str);
+ str.precision(0);
+ str << 1.0e+5;
+ CPPUNIT_CHECK( str.str() == "100000" );
+
+ reset_stream(str);
+ str.precision(4);
+ str << 1.0e+5;
+ CPPUNIT_CHECK( str.str() == "100000.0000" );
+
+ reset_stream(str);
+ str.precision(0);
+ str << 1.0e+83;
+ CPPUNIT_CHECK( str.str().size() == 84 );
+ //printf("\nC result: %.0f\n", 1.0e+83);
+ //CPPUNIT_MESSAGE( str.str().c_str() );
+ //CPPUNIT_CHECK( str.str() == "100000000000000000000000000000000000000000000000000000000000000000000000000000000000" );
+
+ // cerr.setf(ios::fixed, ios::floatfield);
+ // cerr << DBL_MAX << endl;
+ // cerr << 1.0e+37 << endl;
+ }
+}
+
+#define CHECK_COMPLETE(type, val, base, showbase, showpos, casing, width, adjust, expected) \
+{ \
+ type tmp = val; \
+ ostringstream ostr; \
+ ostr << base << showbase << showpos << casing << setw(width) << adjust << tmp; \
+ CPPUNIT_CHECK( ostr.str() == expected ); \
+}
+
+#define CHECK(type, val, base, expected) \
+ CHECK_COMPLETE(type, val, base, noshowbase, noshowpos, nouppercase, 0, right, expected)
+
+void NumPutGetTest::num_put_integer()
+{
+ //octal outputs
+ {
+ CHECK(short, 0, oct, "0")
+ CHECK(short, 1, oct, "1")
+ CHECK(short, 12345, oct, "30071")
+ if (sizeof(short) == 2) {
+ CHECK(short, -1, oct, "177777")
+ CHECK(short, -12345, oct, "147707")
+ }
+
+ CHECK(unsigned short, 0, oct, "0")
+ CHECK(unsigned short, 12345, oct, "30071")
+
+ CHECK(int, 0, oct, "0")
+ CHECK(int, 12345678, oct, "57060516")
+ if (sizeof(int) == 4) {
+ CHECK(int, -1, oct, "37777777777")
+ CHECK(int, -12345678, oct, "37720717262")
+ }
+
+ CHECK(unsigned int, 0, oct, "0")
+ CHECK(unsigned int, 12345678, oct, "57060516")
+
+ CHECK(long, 0, oct, "0")
+ CHECK(long, 12345678, oct, "57060516")
+ if (sizeof(long) == 4) {
+ CHECK(long, -1, oct, "37777777777")
+ CHECK(long, -12345678, oct, "37720717262")
+ }
+
+ CHECK(unsigned long, 0, oct, "0")
+ CHECK(unsigned long, 12345678, oct, "57060516")
+
+#if defined (STLPORT) && defined (_STLP_LONG_LONG)
+ CHECK(_STLP_LONG_LONG, 0, oct, "0")
+ CHECK(_STLP_LONG_LONG, 12345678, oct, "57060516")
+ if (sizeof(_STLP_LONG_LONG) == 8) {
+ CHECK(_STLP_LONG_LONG, -1, oct, "1777777777777777777777")
+ CHECK(_STLP_LONG_LONG, -12345678, oct, "1777777777777720717262")
+ }
+
+ CHECK(unsigned _STLP_LONG_LONG, 0, oct, "0")
+ CHECK(unsigned _STLP_LONG_LONG, 12345678, oct, "57060516")
+#endif
+
+ //Even with showbase, 0 value gives "0" (see printf documentation)
+ CHECK_COMPLETE(short, 0, oct, showbase, noshowpos, nouppercase, 0, right, "0")
+ CHECK_COMPLETE(short, 0, oct, showbase, showpos, nouppercase, 6, right, " 0")
+
+ CHECK_COMPLETE(short, 1, oct, showbase, noshowpos, nouppercase, 6, right, " 01")
+ CHECK_COMPLETE(short, 1, oct, showbase, noshowpos, nouppercase, 6, left, "01 ")
+ CHECK_COMPLETE(short, 1, oct, showbase, showpos, nouppercase, 6, internal, " 01")
+ }
+
+ //decimal outputs
+ {
+ CHECK(short, 0, dec, "0")
+ CHECK(short, -1, dec, "-1")
+ CHECK(short, 12345, dec, "12345")
+ CHECK(short, -12345, dec, "-12345")
+
+ CHECK(unsigned short, 0, dec, "0")
+ CHECK(unsigned short, 12345, dec, "12345")
+
+ CHECK(int, 0, dec, "0")
+ CHECK(int, -1, dec, "-1")
+ CHECK(int, 12345678, dec, "12345678")
+ CHECK(int, -12345678, dec, "-12345678")
+
+ CHECK(unsigned int, 0, dec, "0")
+ CHECK(unsigned int, 12345678, dec, "12345678")
+
+ CHECK(long, 0, dec, "0")
+ CHECK(long, -1, dec, "-1")
+ CHECK(long, 12345678, dec, "12345678")
+ CHECK(long, -12345678, dec, "-12345678")
+
+ CHECK(unsigned long, 0, dec, "0")
+ CHECK(unsigned long, 12345678, dec, "12345678")
+#if defined (STLPORT) && defined (_STLP_LONG_LONG)
+ CHECK(_STLP_LONG_LONG, 0, dec, "0")
+ CHECK(_STLP_LONG_LONG, -1, dec, "-1")
+ CHECK(_STLP_LONG_LONG, 12345678, dec, "12345678")
+ CHECK(_STLP_LONG_LONG, -12345678, dec, "-12345678")
+
+ CHECK(unsigned _STLP_LONG_LONG, 0, dec, "0")
+ CHECK(unsigned _STLP_LONG_LONG, 12345678, dec, "12345678")
+#endif
+
+ CHECK_COMPLETE(short, 0, dec, showbase, showpos, nouppercase, 0, right, "+0")
+ CHECK_COMPLETE(short, 0, dec, showbase, showpos, nouppercase, 6, right, " +0")
+ CHECK_COMPLETE(short, 1, dec, showbase, showpos, nouppercase, 6, right, " +1")
+ CHECK_COMPLETE(short, 1, dec, showbase, showpos, nouppercase, 6, left, "+1 ")
+ CHECK_COMPLETE(short, 1, dec, showbase, showpos, nouppercase, 6, internal, "+ 1")
+ }
+
+ //hexadecimal outputs
+ {
+ CHECK(short, 0, hex, "0")
+ CHECK(short, 12345, hex, "3039")
+ if (sizeof(short) == 2) {
+ CHECK(short, -1, hex, "ffff")
+ CHECK(short, -12345, hex, "cfc7")
+ }
+
+ CHECK(unsigned short, 0, hex, "0")
+ CHECK(unsigned short, 12345, hex, "3039")
+
+ CHECK(int, 0, hex, "0")
+ CHECK(int, 12345678, hex, "bc614e")
+ if (sizeof(int) == 4) {
+ CHECK(int, -1, hex, "ffffffff")
+ CHECK(int, -12345678, hex, "ff439eb2")
+ }
+
+ CHECK(unsigned int, 0, hex, "0")
+ CHECK(unsigned int, 12345678, hex, "bc614e")
+
+ CHECK(long, 0, hex, "0")
+ CHECK(long, 12345678, hex, "bc614e")
+ if (sizeof(long) == 4) {
+ CHECK(long, -1, hex, "ffffffff")
+ CHECK(long, -12345678, hex, "ff439eb2")
+ }
+
+ CHECK(unsigned long, 0, hex, "0")
+ CHECK(unsigned long, 12345678, hex, "bc614e")
+#if defined (STLPORT) && defined (_STLP_LONG_LONG)
+ CHECK(_STLP_LONG_LONG, 0, hex, "0")
+ CHECK(_STLP_LONG_LONG, 12345678, hex, "bc614e")
+ if (sizeof(_STLP_LONG_LONG) == 8) {
+ CHECK(_STLP_LONG_LONG, -1, hex, "ffffffffffffffff")
+ CHECK(_STLP_LONG_LONG, -12345678, hex, "ffffffffff439eb2")
+ }
+
+ CHECK(unsigned _STLP_LONG_LONG, 0, hex, "0")
+ CHECK(unsigned _STLP_LONG_LONG, 12345678, hex, "bc614e")
+#endif
+
+ //Even with showbase, 0 value gives "0" output (see printf documentation)
+ CHECK_COMPLETE(short, 0, hex, showbase, showpos, nouppercase, 0, right, "0")
+ CHECK_COMPLETE(short, 0, hex, showbase, noshowpos, nouppercase, 6, right, " 0")
+ CHECK_COMPLETE(short, 0, hex, showbase, noshowpos, nouppercase, 6, internal, " 0")
+
+ CHECK_COMPLETE(short, 1, hex, showbase, noshowpos, nouppercase, 6, right, " 0x1")
+ CHECK_COMPLETE(short, 1, hex, showbase, noshowpos, nouppercase, 6, left, "0x1 ")
+ CHECK_COMPLETE(short, 1, hex, showbase, noshowpos, nouppercase, 6, internal, "0x 1")
+ CHECK_COMPLETE(short, 1, hex, showbase, noshowpos, uppercase, 6, left, "0X1 ")
+ CHECK_COMPLETE(short, 1, hex, showbase, showpos, uppercase, 6, internal, "0X 1")
+ }
+}
+
+void NumPutGetTest::num_get_float()
+{
+ float in_val;
+
+ istringstream istr;
+
+ istr.str("1.2345");
+ istr >> in_val;
+ CPPUNIT_ASSERT(!istr.fail());
+ CPPUNIT_ASSERT(istr.eof());
+ CPPUNIT_ASSERT(check_float(in_val, 1.2345f));
+ istr.clear();
+
+ istr.str("-1.2345");
+ istr >> in_val;
+ CPPUNIT_ASSERT(!istr.fail());
+ CPPUNIT_ASSERT(istr.eof());
+ CPPUNIT_ASSERT(check_float(in_val, -1.2345f));
+ istr.clear();
+
+ istr.str("+1.2345");
+ istr >> in_val;
+ CPPUNIT_ASSERT(!istr.fail());
+ CPPUNIT_ASSERT(check_float(in_val, 1.2345f));
+ istr.clear();
+
+ istr.str("000000000000001.234500000000");
+ istr >> in_val;
+ CPPUNIT_ASSERT(!istr.fail());
+ CPPUNIT_ASSERT(istr.eof());
+ CPPUNIT_ASSERT(check_float(in_val, 1.2345f));
+ istr.clear();
+
+ istr.str("1.2345e+04");
+ istr >> in_val;
+ CPPUNIT_ASSERT(!istr.fail());
+ CPPUNIT_ASSERT(istr.eof());
+ CPPUNIT_ASSERT(check_float(in_val, 12345.0f));
+ istr.clear();
+
+ CPPUNIT_MESSAGE( "float" );
+ check_get_float( 0.0F );
+ CPPUNIT_MESSAGE( "double" );
+ check_get_float( 0.0 );
+#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
+ CPPUNIT_MESSAGE( "long double" );
+ check_get_float( 0.0L );
+#endif
+ {
+ stringstream str;
+
+ str << "1e" << numeric_limits<double>::max_exponent10;
+ CPPUNIT_ASSERT(!str.fail());
+
+ float val;
+ str >> val;
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_ASSERT( numeric_limits<double>::max_exponent10 <= numeric_limits<float>::max_exponent10 ||
+ val == numeric_limits<float>::infinity() );
+ }
+ {
+ stringstream str;
+
+ str << "1e" << numeric_limits<double>::min_exponent10;
+ CPPUNIT_ASSERT(!str.fail());
+
+ float val;
+ str >> val;
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_ASSERT( numeric_limits<double>::min_exponent10 >= numeric_limits<float>::min_exponent10 ||
+ val == 0.0f );
+ }
+#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
+ {
+ stringstream str;
+
+ str << "1e" << numeric_limits<long double>::max_exponent10;
+ CPPUNIT_ASSERT(!str.fail());
+
+ double val;
+ str >> val;
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_ASSERT( numeric_limits<long double>::max_exponent10 <= numeric_limits<double>::max_exponent10 ||
+ val == numeric_limits<double>::infinity() );
+ }
+ {
+ stringstream str;
+
+ str << "1e" << numeric_limits<long double>::min_exponent10;
+ CPPUNIT_ASSERT(!str.fail());
+
+ double val;
+ str >> val;
+ CPPUNIT_ASSERT(!str.fail());
+ CPPUNIT_ASSERT(str.eof());
+ CPPUNIT_ASSERT( numeric_limits<long double>::min_exponent10 >= numeric_limits<double>::min_exponent10 ||
+ val == 0.0 );
+ }
+ {
+ const char* p = "2.718281828459045235360287471352662497757247093e0";
+ std::stringstream s;
+ s << p;
+ long double x;
+ s >> x;
+ CPPUNIT_ASSERT( x > 2.70l && x < 2.72l );
+ }
+#endif
+}
+
+void NumPutGetTest::num_get_integer()
+{
+ //octal input
+ {
+ istringstream istr;
+ istr.str("30071");
+ short val;
+ istr >> oct >> val;
+ CPPUNIT_ASSERT( !istr.fail() );
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( val == 12345 );
+ istr.clear();
+
+ if (sizeof(short) == 2) {
+ istr.str("177777");
+ istr >> oct >> val;
+ CPPUNIT_ASSERT( !istr.fail() );
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( val == -1 );
+ istr.clear();
+ }
+ }
+
+ //decimal input
+ {
+ istringstream istr;
+ istr.str("10000");
+ short val = -1;
+ istr >> val;
+ CPPUNIT_ASSERT( !istr.fail() );
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( val == 10000 );
+ istr.clear();
+
+ istr.str("+10000");
+ val = -1;
+ istr >> val;
+ CPPUNIT_ASSERT( !istr.fail() );
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( val == 10000 );
+ istr.clear();
+
+ if (sizeof(short) == 2) {
+ val = -1;
+ istr.str("10000000");
+ istr >> val;
+ CPPUNIT_ASSERT( istr.fail() );
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( val == -1 );
+ istr.clear();
+ }
+
+ val = -1;
+ istr.str("0x0");
+ istr >> val;
+ CPPUNIT_ASSERT( !istr.fail() );
+ CPPUNIT_ASSERT( !istr.eof() );
+ CPPUNIT_ASSERT( val == 0 );
+ istr.clear();
+
+ val = -1;
+ istr.str("000001");
+ istr >> val;
+ CPPUNIT_ASSERT( !istr.fail() );
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( val == 1 );
+ istr.clear();
+ }
+
+ //hexadecimal input
+ {
+ istringstream istr;
+ istr.str("3039");
+ short val = -1;
+ istr >> hex >> val;
+ CPPUNIT_ASSERT( !istr.fail() );
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( val == 12345 );
+ istr.clear();
+
+ istr.str("x3039");
+ val = -1;
+ istr >> hex >> val;
+ CPPUNIT_ASSERT( istr.fail() );
+ CPPUNIT_ASSERT( !istr.eof() );
+ CPPUNIT_ASSERT( val == -1 );
+ istr.clear();
+
+ istr.str("03039");
+ val = -1;
+ istr >> hex >> val;
+ CPPUNIT_ASSERT( !istr.fail() );
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( val == 12345 );
+ istr.clear();
+
+ istr.str("0x3039");
+ istr >> hex >> val;
+ CPPUNIT_ASSERT( !istr.fail() );
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( val == 12345 );
+ istr.clear();
+
+ if (sizeof(short) == 2) {
+ val = -1;
+ istr.str("cfc7");
+ istr >> hex >> val;
+ CPPUNIT_ASSERT( !istr.fail() );
+ CPPUNIT_ASSERT( istr.eof() );
+ CPPUNIT_ASSERT( val == -12345 );
+ istr.clear();
+ }
+ }
+}
+
+void NumPutGetTest::inhex()
+{
+ {
+ ostringstream s;
+ s << hex << 0;
+ CPPUNIT_CHECK( s.str() == "0" );
+ }
+ {
+ ostringstream s;
+ s << hex << 0xff;
+ CPPUNIT_CHECK( s.str() == "ff" );
+ }
+ {
+ ostringstream s;
+ s << hex << setw( 4 ) << 0xff;
+ CPPUNIT_CHECK( s.str() == " ff" );
+ }
+ {
+ ostringstream s;
+ s << hex << setw( 4 ) << 0;
+ CPPUNIT_CHECK( s.str() == " 0" );
+ }
+ {
+ ostringstream s;
+ s << hex << showbase << 0;
+ CPPUNIT_CHECK( s.str() == "0" );
+ }
+ {
+ ostringstream s;
+ s << hex << showbase << 0xff;
+ CPPUNIT_CHECK( s.str() == "0xff" );
+ }
+ {
+ ostringstream s;
+ s << hex << showbase << setw( 4 ) << 0xff;
+ CPPUNIT_CHECK( s.str() == "0xff" );
+ }
+ { // special case for regression (partially duplicate CHECK_COMPLETE above):
+ ostringstream s;
+ s.setf( ios_base::internal, ios_base::adjustfield );
+ s << hex << showbase << setw(8+2) << 0;
+ CPPUNIT_CHECK( s.str() == " 0" );
+ }
+}
+
+void NumPutGetTest::pointer()
+{
+ // Problem with printing pointer to null
+
+ /*
+ * Really C's formatting not help here, due to:
+ *
+ * p The argument shall be a pointer to void. The value of
+ * the pointer is converted to a sequence of printable characters,
+ * in an implementation-defined manner.
+ */
+ {
+ /*
+ char buf[128];
+ void *p = (void *)0xff00;
+ sprintf( buf, "%p", p );
+ // cerr << buf << endl;
+ // Hmmm, I see 0xff00 on box with 32-bits address; pointer like 'unsigned hex'?
+ if ( sizeof( p ) == 2 ) {
+ CPPUNIT_ASSERT( strcmp( buf, "0xff00" ) == 0 );
+ } else if ( sizeof( p ) == 4 ) {
+ CPPUNIT_ASSERT( strcmp( buf, "0x0000ff00" ) == 0 );
+ } else if ( sizeof( p ) == 8 ) {
+ CPPUNIT_ASSERT( strcmp( buf, "0x000000000000ff00" ) == 0 );
+ } else {
+ CPPUNIT_CHECK( sizeof( p ) == 2 || sizeof( p ) == 4 || sizeof( p ) == 8 );
+ }
+ */
+ }
+ {
+ /*
+ char buf[128];
+ void *p = 0;
+ */
+ // sprintf( buf, "%p", p );
+ /* Cool. "%p" print '(nil)'; "%#x" print '0' */
+ // sprintf( buf, "%#x", (unsigned)p );
+ // cerr << buf << endl;
+ }
+ {
+ ostringstream s;
+ void *p = (void *)0xff00;
+ s << p;
+ CPPUNIT_ASSERT( s.good() );
+ if ( sizeof( p ) == 2 ) {
+ CPPUNIT_ASSERT( s.str() == "0xff00" );
+ } else if ( sizeof( p ) == 4 ) {
+ CPPUNIT_ASSERT( s.str() == "0x0000ff00" ); // this pass
+ } else if ( sizeof( p ) == 8 ) {
+ CPPUNIT_ASSERT( s.str() == "0x000000000000ff00" );
+ } else {
+ CPPUNIT_CHECK( sizeof( p ) == 2 || sizeof( p ) == 4 || sizeof( p ) == 8 );
+ }
+ }
+ {
+ ostringstream s;
+ void *p = 0;
+ s << p;
+ CPPUNIT_ASSERT( s.good() );
+ if ( sizeof( p ) == 2 ) {
+ CPPUNIT_ASSERT( s.str() == "0x0000" );
+ } else if ( sizeof( p ) == 4 ) {
+ CPPUNIT_ASSERT( s.str() == "0x00000000" ); // but this will fail, if follow %p
+ } else if ( sizeof( p ) == 8 ) {
+ CPPUNIT_ASSERT( s.str() == "0x0000000000000000" );
+ } else {
+ CPPUNIT_CHECK( sizeof( p ) == 2 || sizeof( p ) == 4 || sizeof( p ) == 8 );
+ }
+ }
+}
+
+void NumPutGetTest::fix_float_long()
+{
+ ostringstream str;
+
+ str.setf(ios::fixed, ios::floatfield);
+ str << 1.0e+5;
+ CPPUNIT_CHECK( str.str() == "100000.000000" );
+
+ reset_stream(str);
+ str.precision(0);
+ str << 1.0e+5;
+ CPPUNIT_CHECK( str.str() == "100000" );
+
+ reset_stream(str);
+ str.precision(4);
+ str << 1.0e+5;
+ CPPUNIT_CHECK( str.str() == "100000.0000" );
+
+ reset_stream(str);
+ str.precision(0);
+ str << 1.0e+83;
+ {
+ istringstream istr( str.str() );
+ double f;
+ istr >> f;
+ CPPUNIT_CHECK( !istr.fail() );
+ if ( int(numeric_limits<double>::digits10) < 83 ) {
+ double delta = 1.0;
+ for ( int ee = 83 - int(numeric_limits<double>::digits10); ee > 0; --ee ) {
+ delta *= 10.0;
+ }
+ // we may loss some digits here, but not more than mantissa:
+ CPPUNIT_CHECK( (f > (1.0e+83 - delta)) && (f < (1.0e+83 + delta)) );
+ } else {
+ CPPUNIT_CHECK( check_double(f, 1.0e+83) );
+ }
+ }
+
+#if 0 // #ifndef _STLP_NO_LONG_DOUBLE
+ reset_stream(str);
+ str.precision(0);
+ str << 1.0e+83l;
+ {
+ istringstream istr( str.str() );
+ long double f;
+ istr >> f;
+ CPPUNIT_CHECK( !istr.fail() );
+ if ( int(numeric_limits<long double>::digits10) < 83 ) {
+ long double delta = 1.0l;
+ for ( int ee = 83 - int(numeric_limits<long double>::digits10); ee > 0; --ee ) {
+ delta *= 10.0l;
+ }
+ // we may loss some digits here, but not more than mantissa:
+ cerr << "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" << endl;
+ cerr << str.str() << endl;
+ cerr << delta << endl;
+ cerr << f << endl;
+ CPPUNIT_CHECK( (f > (1.0e+83l - delta)) && (f < (1.0e+83l + delta)) );
+ } else {
+ CPPUNIT_CHECK( check_double(f, 1.0e+83l) );
+ }
+ }
+#endif
+
+ reset_stream(str);
+ str.precision(0);
+ str << numeric_limits<double>::max();
+ {
+ istringstream istr( str.str() );
+ double f;
+ istr >> f;
+ CPPUNIT_CHECK( !istr.fail() );
+ if ( int(numeric_limits<double>::digits10) < int(numeric_limits<double>::max_exponent10) ) {
+ double delta = 9.0;
+ for ( int ee = int(numeric_limits<double>::max_exponent10) - int(numeric_limits<double>::digits10); ee > 0; --ee ) {
+ delta *= 10.0;
+ }
+ // we may loss some digits here, but not more than mantissa:
+ CPPUNIT_CHECK( (f > (numeric_limits<double>::max() - delta)) );
+ }
+ }
+
+#if 0 // #ifndef _STLP_NO_LONG_DOUBLE
+ reset_stream(str);
+ str.precision(0);
+ str << numeric_limits<long double>::max();
+ {
+ istringstream istr( str.str() );
+ long double f;
+ istr >> f;
+ CPPUNIT_CHECK( !istr.fail() );
+ if ( int(numeric_limits<long double>::digits10) < int(numeric_limits<long double>::max_exponent10) ) {
+ long double delta = 1.0l;
+ for ( int ee = int(numeric_limits<long double>::max_exponent10) - int(numeric_limits<long double>::digits10); ee > 0; --ee ) {
+ delta *= 10.0l;
+ }
+ // we may loss some digits here, but not more than mantissa:
+ CPPUNIT_CHECK( (f > (numeric_limits<long double>::max() - delta)) );
+ }
+ }
+#endif
+}
+
+class CommaSepNumPunct : public numpunct<char> {
+ char do_thousands_sep() const { return ','; }
+ string do_grouping() const { return string("\1\2\3") + (char)CHAR_MAX; }
+};
+
+#define CHECK2(val, expected) \
+ os.str(""); os << fixed << setprecision(3) << showpos << val; \
+ CPPUNIT_ASSERT( os.str() == expected )
+
+void NumPutGetTest::custom_numpunct()
+{
+ ostringstream os;
+ locale loc(os.getloc(), new CommaSepNumPunct());
+ os.imbue(loc);
+
+ CHECK2(1, "+1");
+ CHECK2(10, "+1,0");
+ CHECK2(100, "+10,0");
+ CHECK2(1000, "+1,00,0");
+
+ CHECK2(1.234, "+1.234");
+ CHECK2(123.456, "+12,3.456");
+ CHECK2(1234.567, "+1,23,4.567");
+ CHECK2(12345.678, "+12,34,5.678");
+ CHECK2(123456.789, "+123,45,6.789");
+ CHECK2(1234567.891, "+1,234,56,7.891");
+ CHECK2(123456789.123, "+123,456,78,9.123");
+ //CHECK2(100000000000000000000000000000.0, "+100000000000000000000000,000,00,0.000");
+ CHECK2(numeric_limits<double>::infinity(), "+inf");
+
+ CHECK2(-1.234, "-1.234");
+ CHECK2(-123.456, "-12,3.456");
+ CHECK2(-1234.567, "-1,23,4.567");
+ CHECK2(-12345.678, "-12,34,5.678");
+ CHECK2(-123456.789, "-123,45,6.789");
+ CHECK2(-1234567.891, "-1,234,56,7.891");
+ CHECK2(-123456789.123, "-123,456,78,9.123");
+ //CHECK2(-100000000000000000000000000000.0, "-100000000000000000000000,000,00,0.000");
+ CHECK2(-numeric_limits<double>::infinity(), "-inf");
+}
+
+#endif
diff --git a/test/unit/numeric_header_test.cpp b/test/unit/numeric_header_test.cpp
new file mode 100644
index 0000000..38d23dd
--- /dev/null
+++ b/test/unit/numeric_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <numeric>
diff --git a/test/unit/ostmit_test.cpp b/test/unit/ostmit_test.cpp
new file mode 100644
index 0000000..f94353e
--- /dev/null
+++ b/test/unit/ostmit_test.cpp
@@ -0,0 +1,52 @@
+#include <iterator>
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+#include <string>
+#include <sstream>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class OstreamIteratorTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(OstreamIteratorTest);
+ CPPUNIT_TEST(ostmit0);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void ostmit0();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(OstreamIteratorTest);
+
+//
+// tests implementation
+//
+void OstreamIteratorTest::ostmit0()
+{
+ // not necessary, tested in copy_test
+ int array [] = { 1, 5, 2, 4 };
+
+ const char* text = "hello";
+
+ ostringstream os;
+
+ ostream_iterator<char> iter(os);
+ copy(text, text + 5, iter);
+ CPPUNIT_ASSERT(os.good());
+ os << ' ';
+ CPPUNIT_ASSERT(os.good());
+
+ ostream_iterator<int> iter2(os);
+ copy(array, array + 4, iter2);
+ CPPUNIT_ASSERT(os.good());
+ CPPUNIT_ASSERT(os.str() == "hello 1524");
+}
+
+#endif
diff --git a/test/unit/ostream_header_test.cpp b/test/unit/ostream_header_test.cpp
new file mode 100644
index 0000000..9c9ccb4
--- /dev/null
+++ b/test/unit/ostream_header_test.cpp
@@ -0,0 +1,10 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#if !defined (_STLP_NO_IOSTREAMS)
+# include <ostream>
+#endif
diff --git a/test/unit/pair_test.cpp b/test/unit/pair_test.cpp
new file mode 100644
index 0000000..6fc5172
--- /dev/null
+++ b/test/unit/pair_test.cpp
@@ -0,0 +1,46 @@
+#include <utility>
+#include <vector>
+#include <algorithm>
+#include <string>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+class PairTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(PairTest);
+ CPPUNIT_TEST(pair0);
+ CPPUNIT_TEST(init);
+ CPPUNIT_TEST_SUITE_END();
+
+ protected:
+ void pair0();
+ void init();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PairTest);
+
+void PairTest::pair0()
+{
+ pair<int, int> p = make_pair(1, 10);
+
+ CPPUNIT_ASSERT(p.first==1);
+ CPPUNIT_ASSERT(p.second==10);
+}
+
+void PairTest::init()
+{
+ pair<int, string> PAIR_ARRAY[] = { pair<int, string>(0, "0") };
+
+ int PAIR_ARRAY_SIZE = sizeof(PAIR_ARRAY) > 0 ? sizeof(PAIR_ARRAY) / sizeof(PAIR_ARRAY[0]) : 0;
+
+
+ for ( int i = 0; i < PAIR_ARRAY_SIZE; i++ ) {
+ CPPUNIT_CHECK( PAIR_ARRAY[i].first == 0 );
+ CPPUNIT_CHECK( PAIR_ARRAY[i].second == "0" );
+ PAIR_ARRAY[i].second = "1";
+ }
+}
diff --git a/test/unit/partial_test.cpp b/test/unit/partial_test.cpp
new file mode 100644
index 0000000..b7650fd
--- /dev/null
+++ b/test/unit/partial_test.cpp
@@ -0,0 +1,248 @@
+#include <numeric>
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#if defined (STLPORT) && defined (_STLP_DEBUG) && defined (_STLP_DEBUG_MODE_THROWS)
+# define _STLP_DO_CHECK_BAD_PREDICATE
+# include <stdexcept>
+#endif
+
+#include "iota.h"
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class PartialTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(PartialTest);
+ CPPUNIT_TEST(parsrt0);
+ CPPUNIT_TEST(parsrt1);
+ CPPUNIT_TEST(parsrt2);
+ CPPUNIT_TEST(parsrtc0);
+ CPPUNIT_TEST(parsrtc1);
+ CPPUNIT_TEST(parsrtc2);
+#if defined (_STLP_DO_CHECK_BAD_PREDICATE)
+ CPPUNIT_TEST(bad_predicate_detected);
+#endif
+ CPPUNIT_TEST(partsum0);
+ CPPUNIT_TEST(partsum1);
+ CPPUNIT_TEST(partsum2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void parsrt0();
+ void parsrt1();
+ void parsrt2();
+ void parsrtc0();
+ void parsrtc1();
+ void parsrtc2();
+ void partsum0();
+ void partsum1();
+ void partsum2();
+ void bad_predicate_detected();
+
+ static bool str_compare(const char* a_, const char* b_)
+ {
+ return strcmp(a_, b_) < 0 ? 1 : 0;
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PartialTest);
+
+//
+// tests implementation
+//
+void PartialTest::parsrt0()
+{
+ int numbers[6] = { 5, 2, 4, 3, 1, 6 };
+
+ partial_sort((int*)numbers, (int*)numbers + 3, (int*)numbers + 6);
+
+ // 1 2 3 5 4 6
+ CPPUNIT_ASSERT(numbers[0]==1);
+ CPPUNIT_ASSERT(numbers[1]==2);
+ CPPUNIT_ASSERT(numbers[2]==3);
+ CPPUNIT_ASSERT(numbers[3]==5);
+ CPPUNIT_ASSERT(numbers[4]==4);
+ CPPUNIT_ASSERT(numbers[5]==6);
+}
+
+void PartialTest::parsrt1()
+{
+ // 8 8 5 3 7 6 5 3 2 4
+ // 2 3 3 4 5 8 8 7 6 5
+ int numbers[10] ={ 8, 8, 5, 3, 7, 6, 5, 3, 2, 4 };
+
+ vector <int> v1(numbers, numbers+10);
+ partial_sort(v1.begin(), v1.begin() + v1.size() / 2, v1.end());
+
+ CPPUNIT_ASSERT(v1[0]==2);
+ CPPUNIT_ASSERT(v1[1]==3);
+ CPPUNIT_ASSERT(v1[2]==3);
+ CPPUNIT_ASSERT(v1[3]==4);
+ CPPUNIT_ASSERT(v1[4]==5);
+ CPPUNIT_ASSERT(v1[5]==8);
+ CPPUNIT_ASSERT(v1[6]==8);
+ CPPUNIT_ASSERT(v1[7]==7);
+ CPPUNIT_ASSERT(v1[8]==6);
+ CPPUNIT_ASSERT(v1[9]==5);
+}
+
+void PartialTest::parsrt2()
+{
+ char const* names[] = { "aa", "ff", "dd", "ee", "cc", "bb" };
+
+ const unsigned nameSize = sizeof(names) / sizeof(names[0]);
+ vector <char const*> v1(nameSize);
+ for(size_t i = 0; i < v1.size(); i++)
+ v1[i] = names[i];
+
+ partial_sort(v1.begin(), v1.begin() + nameSize / 2, v1.end(), str_compare);
+
+ // aa bb cc ff ee dd
+ CPPUNIT_ASSERT( strcmp(v1[0], "aa") == 0 );
+ CPPUNIT_ASSERT( v1[0] == names[0] );
+ CPPUNIT_ASSERT( strcmp(v1[1], "bb") == 0 );
+ CPPUNIT_ASSERT( v1[1] == names[5] );
+ CPPUNIT_ASSERT( strcmp(v1[2], "cc") == 0 );
+ CPPUNIT_ASSERT( v1[2] == names[4] );
+ CPPUNIT_ASSERT( strcmp(v1[3], "ff") == 0 );
+ CPPUNIT_ASSERT( v1[3] == names[1] );
+ CPPUNIT_ASSERT( strcmp(v1[4], "ee") == 0 );
+ CPPUNIT_ASSERT( v1[4] == names[3] );
+ CPPUNIT_ASSERT( strcmp(v1[5], "dd") == 0 );
+ CPPUNIT_ASSERT( v1[5] == names[2] );
+}
+
+void PartialTest::parsrtc0()
+{
+ int numbers[6] = { 5, 2, 4, 3, 1, 6 };
+
+ int result[3];
+ partial_sort_copy((int*)numbers, (int*)numbers + 6, (int*)result, (int*)result + 3);
+ //1 2 3
+ CPPUNIT_ASSERT(result[0]==1);
+ CPPUNIT_ASSERT(result[1]==2);
+ CPPUNIT_ASSERT(result[2]==3);
+}
+
+void PartialTest::parsrtc1()
+{
+ int numbers[10] ={ 3, 0, 4, 3, 2, 8, 2, 7, 7, 5 };
+
+ //3 0 4 3 2 8 2 7 7 5
+ //0 2 2 3 3
+
+ vector <int> v1(numbers, numbers+10);
+ vector <int> result(5);
+
+ partial_sort_copy(v1.begin(), v1.end(), result.begin(), result.end());
+ CPPUNIT_ASSERT(result[0]==0);
+ CPPUNIT_ASSERT(result[1]==2);
+ CPPUNIT_ASSERT(result[2]==2);
+ CPPUNIT_ASSERT(result[3]==3);
+ CPPUNIT_ASSERT(result[4]==3);
+}
+
+void PartialTest::parsrtc2()
+{
+ char const* names[] = { "aa", "ff", "dd", "ee", "cc", "bb" };
+
+ const unsigned nameSize = sizeof(names) / sizeof(names[0]);
+ vector <char const*> v1(nameSize);
+ for(size_t i = 0; i < v1.size(); i++)
+ v1[i] = names[i];
+ vector <char const*> result(3);
+ partial_sort_copy(v1.begin(), v1.end(), result.begin(), result.end(), str_compare);
+
+ // aa bb cc
+ CPPUNIT_ASSERT( strcmp( result[0], "aa" ) == 0 );
+ CPPUNIT_ASSERT( result[0] == names[0] );
+ CPPUNIT_ASSERT( strcmp( result[1], "bb" ) == 0 );
+ CPPUNIT_ASSERT( result[1] == names[5] );
+ CPPUNIT_ASSERT( strcmp( result[2], "cc" ) == 0 );
+ CPPUNIT_ASSERT( result[2] == names[4] );
+}
+
+#if defined (_STLP_DO_CHECK_BAD_PREDICATE)
+void PartialTest::bad_predicate_detected()
+{
+ int numbers[] = { 0, 0, 1, 0, 0, 1, 0, 0 };
+ const size_t s = sizeof(numbers) / sizeof(numbers[0]);
+
+ try {
+ partial_sort(numbers, numbers + s / 2, numbers + s, less_equal<int>());
+
+ //Here is means that no exception has been raised
+ CPPUNIT_ASSERT( false );
+ }
+ catch (runtime_error const&)
+ { /*OK bad predicate has been detected.*/ }
+
+ try {
+ vector<int> result(s);
+ partial_sort_copy(numbers, numbers + s, result.begin(), result.end(), less_equal<int>());
+
+ //Here is means that no exception has been raised
+ CPPUNIT_ASSERT( false );
+ }
+ catch (runtime_error const&)
+ { /*OK bad predicate has been detected.*/ }
+}
+#endif
+
+void PartialTest::partsum0()
+{
+ int numbers[6] = { 1, 2, 3, 4, 5, 6 };
+
+ int result[6];
+ partial_sum((int*)numbers, (int*)numbers + 6, (int*)result);
+
+ // 1 3 6 10 15 21
+ CPPUNIT_ASSERT(result[0]==1);
+ CPPUNIT_ASSERT(result[1]==3);
+ CPPUNIT_ASSERT(result[2]==6);
+ CPPUNIT_ASSERT(result[3]==10);
+ CPPUNIT_ASSERT(result[4]==15);
+ CPPUNIT_ASSERT(result[5]==21);
+}
+
+void PartialTest::partsum1()
+{
+ vector <int> v1(10);
+ __iota(v1.begin(), v1.end(), 0);
+ vector <int> v2(v1.size());
+ partial_sum(v1.begin(), v1.end(), v2.begin());
+
+ // 0 1 3 6 10 15 21 28 36 45
+ CPPUNIT_ASSERT(v2[0]==0);
+ CPPUNIT_ASSERT(v2[1]==1);
+ CPPUNIT_ASSERT(v2[2]==3);
+ CPPUNIT_ASSERT(v2[3]==6);
+ CPPUNIT_ASSERT(v2[4]==10);
+ CPPUNIT_ASSERT(v2[5]==15);
+ CPPUNIT_ASSERT(v2[6]==21);
+ CPPUNIT_ASSERT(v2[7]==28);
+ CPPUNIT_ASSERT(v2[8]==36);
+ CPPUNIT_ASSERT(v2[9]==45);
+}
+
+void PartialTest::partsum2()
+{
+ vector <int> v1(5);
+ __iota(v1.begin(), v1.end(), 1);
+ vector <int> v2(v1.size());
+ partial_sum(v1.begin(), v1.end(), v2.begin(), multiplies<int>());
+ // 1 2 6 24 120
+ CPPUNIT_ASSERT(v2[0]==1);
+ CPPUNIT_ASSERT(v2[1]==2);
+ CPPUNIT_ASSERT(v2[2]==6);
+ CPPUNIT_ASSERT(v2[3]==24);
+ CPPUNIT_ASSERT(v2[4]==120);
+}
diff --git a/test/unit/partition_test.cpp b/test/unit/partition_test.cpp
new file mode 100644
index 0000000..cc5c91b
--- /dev/null
+++ b/test/unit/partition_test.cpp
@@ -0,0 +1,130 @@
+#include <algorithm>
+#include <vector>
+#include <cstdlib>
+#include <iterator>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class PartitionTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(PartitionTest);
+ CPPUNIT_TEST(ptition0);
+ CPPUNIT_TEST(ptition1);
+ CPPUNIT_TEST(stblptn0);
+ CPPUNIT_TEST(stblptn1);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void ptition0();
+ void ptition1();
+ void stblptn0();
+ void stblptn1();
+
+ struct less_n {
+ less_n(int limit, size_t &nb_calls)
+ : _limit(limit), _nb_calls(nb_calls) {}
+
+ bool operator() (int a_) const {
+ ++_nb_calls;
+ return a_ < _limit;
+ }
+
+ int _limit;
+ size_t &_nb_calls;
+
+ private:
+ //explicitely defined as private to avoid warnings:
+ less_n& operator = (less_n const&);
+ };
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PartitionTest);
+
+//
+// tests implementation
+//
+void PartitionTest::stblptn0()
+{
+ int numbers[6] = { 10, 5, 11, 20, 6, -2 };
+
+ size_t nb_pred_calls = 0;
+ stable_partition((int*)numbers, (int*)numbers + 6, less_n(10, nb_pred_calls));
+ // 5 6 -2 10 11 20
+ CPPUNIT_ASSERT(numbers[0]==5);
+ CPPUNIT_ASSERT(numbers[1]==6);
+ CPPUNIT_ASSERT(numbers[2]==-2);
+ CPPUNIT_ASSERT(numbers[3]==10);
+ CPPUNIT_ASSERT(numbers[4]==11);
+ CPPUNIT_ASSERT(numbers[5]==20);
+
+ //Complexity check:
+ CPPUNIT_ASSERT( nb_pred_calls == sizeof(numbers) / sizeof(numbers[0]) );
+}
+void PartitionTest::stblptn1()
+{
+ //5 5 2 10 0 12 5 0 0 19
+ //5 5 2 10 0 5 0 0 12 19
+ int numbers[] = { 5, 5, 2, 10, 0, 12, 5, 0, 0, 19 };
+ vector <int> v1(numbers, numbers+10);
+
+ size_t nb_pred_calls = 0;
+ stable_partition(v1.begin(), v1.end(), less_n(11, nb_pred_calls));
+
+ CPPUNIT_ASSERT(v1[0]==5);
+ CPPUNIT_ASSERT(v1[1]==5);
+ CPPUNIT_ASSERT(v1[2]==2);
+ CPPUNIT_ASSERT(v1[3]==10);
+ CPPUNIT_ASSERT(v1[4]==0);
+ CPPUNIT_ASSERT(v1[5]==5);
+ CPPUNIT_ASSERT(v1[6]==0);
+ CPPUNIT_ASSERT(v1[7]==0);
+ CPPUNIT_ASSERT(v1[8]==12);
+ CPPUNIT_ASSERT(v1[9]==19);
+ CPPUNIT_ASSERT( nb_pred_calls == v1.size() );
+}
+void PartitionTest::ptition0()
+{
+ int numbers[6] = { 6, 12, 3, 10, 1, 20 };
+ size_t nb_pred_calls = 0;
+ // 6 1 3 10 12 20
+ partition((int*)numbers, (int*)numbers + 6, less_n(10, nb_pred_calls));
+ CPPUNIT_ASSERT(numbers[0]==6);
+ CPPUNIT_ASSERT(numbers[1]==1);
+ CPPUNIT_ASSERT(numbers[2]==3);
+ CPPUNIT_ASSERT(numbers[3]==10);
+ CPPUNIT_ASSERT(numbers[4]==12);
+ CPPUNIT_ASSERT(numbers[5]==20);
+
+ CPPUNIT_ASSERT( nb_pred_calls == sizeof(numbers) / sizeof(numbers[0]) );
+}
+void PartitionTest::ptition1()
+{
+ // 19 3 11 14 10 19 8 17 9 6
+ // 6 3 9 8 10 19 14 17 11 19
+
+ int numbers[10] ={ 19, 3, 11, 14, 10, 19, 8, 17, 9, 6 };
+
+ vector <int> v1(numbers, numbers+10);
+ size_t nb_pred_calls = 0;
+ partition(v1.begin(), v1.end(), less_n(11, nb_pred_calls));
+
+ CPPUNIT_ASSERT(v1[0]==6);
+ CPPUNIT_ASSERT(v1[1]==3);
+ CPPUNIT_ASSERT(v1[2]==9);
+ CPPUNIT_ASSERT(v1[3]==8);
+ CPPUNIT_ASSERT(v1[4]==10);
+ CPPUNIT_ASSERT(v1[5]==19);
+ CPPUNIT_ASSERT(v1[6]==14);
+ CPPUNIT_ASSERT(v1[7]==17);
+ CPPUNIT_ASSERT(v1[8]==11);
+ CPPUNIT_ASSERT(v1[9]==19);
+ CPPUNIT_ASSERT( nb_pred_calls == v1.size() );
+}
diff --git a/test/unit/perm_test.cpp b/test/unit/perm_test.cpp
new file mode 100644
index 0000000..5be6ea0
--- /dev/null
+++ b/test/unit/perm_test.cpp
@@ -0,0 +1,228 @@
+#include <vector>
+#include <algorithm>
+#include <numeric>
+#include <iterator>
+#include <functional>
+
+#include "iota.h"
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class PermTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(PermTest);
+ CPPUNIT_TEST(nextprm0);
+ CPPUNIT_TEST(nextprm1);
+ CPPUNIT_TEST(nextprm2);
+ CPPUNIT_TEST(prevprm0);
+ CPPUNIT_TEST(prevprm1);
+ CPPUNIT_TEST(prevprm2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void nextprm0();
+ void nextprm1();
+ void nextprm2();
+ void prevprm0();
+ void prevprm1();
+ void prevprm2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PermTest);
+
+//
+// tests implementation
+//
+void PermTest::prevprm0()
+{
+ int v1[3] = { 0, 1, 2 };
+ prev_permutation(v1, v1 + 3);
+
+ CPPUNIT_ASSERT(v1[0]==2);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==0);
+}
+void PermTest::prevprm1()
+{
+ vector <int> v1(3);
+ __iota(v1.begin(), v1.end(), 0);
+
+ prev_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==2);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==0);
+ prev_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==2);
+ CPPUNIT_ASSERT(v1[1]==0);
+ CPPUNIT_ASSERT(v1[2]==1);
+ prev_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==2);
+ CPPUNIT_ASSERT(v1[2]==0);
+ prev_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==0);
+ CPPUNIT_ASSERT(v1[2]==2);
+ prev_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==2);//
+ CPPUNIT_ASSERT(v1[2]==1);
+ prev_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==2);
+ prev_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==2);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==0);
+ prev_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==2);
+ CPPUNIT_ASSERT(v1[1]==0);
+ CPPUNIT_ASSERT(v1[2]==1);
+ prev_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==2);
+ CPPUNIT_ASSERT(v1[2]==0);
+}
+void PermTest::prevprm2()
+{
+ vector <int> v1(3);
+ __iota(v1.begin(), v1.end(), 0);
+
+ prev_permutation(v1.begin(), v1.end(), greater<int>());
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==2);
+ CPPUNIT_ASSERT(v1[2]==1);
+ prev_permutation(v1.begin(), v1.end(), greater<int>());
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==0);
+ CPPUNIT_ASSERT(v1[2]==2);
+ prev_permutation(v1.begin(), v1.end(), greater<int>());
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==2);
+ CPPUNIT_ASSERT(v1[2]==0);
+ prev_permutation(v1.begin(), v1.end(), greater<int>());
+ CPPUNIT_ASSERT(v1[0]==2);
+ CPPUNIT_ASSERT(v1[1]==0);
+ CPPUNIT_ASSERT(v1[2]==1);
+ prev_permutation(v1.begin(), v1.end(), greater<int>());
+ CPPUNIT_ASSERT(v1[0]==2);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==0);
+ prev_permutation(v1.begin(), v1.end(), greater<int>());
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==2);
+ prev_permutation(v1.begin(), v1.end(), greater<int>());
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==2);
+ CPPUNIT_ASSERT(v1[2]==1);
+ prev_permutation(v1.begin(), v1.end(), greater<int>());
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==0);
+ CPPUNIT_ASSERT(v1[2]==2);
+ prev_permutation(v1.begin(), v1.end(), greater<int>());
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==2);
+ CPPUNIT_ASSERT(v1[2]==0);
+}
+void PermTest::nextprm0()
+{
+ int v1[3] = { 0, 1, 2 };
+ next_permutation(v1, v1 + 3);
+
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==2);
+ CPPUNIT_ASSERT(v1[2]==1);
+}
+void PermTest::nextprm1()
+{
+ vector <int> v1(3);
+ __iota(v1.begin(), v1.end(), 0);
+
+ next_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==2);
+ CPPUNIT_ASSERT(v1[2]==1);
+ next_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==0);
+ CPPUNIT_ASSERT(v1[2]==2);
+ next_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==2);
+ CPPUNIT_ASSERT(v1[2]==0);
+ next_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==2);
+ CPPUNIT_ASSERT(v1[1]==0);
+ CPPUNIT_ASSERT(v1[2]==1);
+ next_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==2);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==0);
+ next_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==2);
+ next_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==2);
+ CPPUNIT_ASSERT(v1[2]==1);
+ next_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==0);
+ CPPUNIT_ASSERT(v1[2]==2);
+ next_permutation(v1.begin(), v1.end());
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==2);
+ CPPUNIT_ASSERT(v1[2]==0);
+}
+void PermTest::nextprm2()
+{
+ vector <char> v1(3);
+ __iota(v1.begin(), v1.end(), 'A');
+
+ next_permutation(v1.begin(), v1.end(), less<char>());
+ CPPUNIT_ASSERT(v1[0]=='A');
+ CPPUNIT_ASSERT(v1[1]=='C');
+ CPPUNIT_ASSERT(v1[2]=='B');
+ next_permutation(v1.begin(), v1.end(), less<char>());
+ CPPUNIT_ASSERT(v1[0]=='B');
+ CPPUNIT_ASSERT(v1[1]=='A');
+ CPPUNIT_ASSERT(v1[2]=='C');
+ next_permutation(v1.begin(), v1.end(), less<char>());
+ CPPUNIT_ASSERT(v1[0]=='B');
+ CPPUNIT_ASSERT(v1[1]=='C');
+ CPPUNIT_ASSERT(v1[2]=='A');
+ next_permutation(v1.begin(), v1.end(), less<char>());
+ CPPUNIT_ASSERT(v1[0]=='C');
+ CPPUNIT_ASSERT(v1[1]=='A');
+ CPPUNIT_ASSERT(v1[2]=='B');
+ next_permutation(v1.begin(), v1.end(), less<char>());
+ CPPUNIT_ASSERT(v1[0]=='C');
+ CPPUNIT_ASSERT(v1[1]=='B');
+ CPPUNIT_ASSERT(v1[2]=='A');
+ next_permutation(v1.begin(), v1.end(), less<char>());
+ CPPUNIT_ASSERT(v1[0]=='A');
+ CPPUNIT_ASSERT(v1[1]=='B');
+ CPPUNIT_ASSERT(v1[2]=='C');
+ next_permutation(v1.begin(), v1.end(), less<char>());
+ CPPUNIT_ASSERT(v1[0]=='A');
+ CPPUNIT_ASSERT(v1[1]=='C');
+ CPPUNIT_ASSERT(v1[2]=='B');
+ next_permutation(v1.begin(), v1.end(), less<char>());
+ CPPUNIT_ASSERT(v1[0]=='B');
+ CPPUNIT_ASSERT(v1[1]=='A');
+ CPPUNIT_ASSERT(v1[2]=='C');
+ next_permutation(v1.begin(), v1.end(), less<char>());
+ CPPUNIT_ASSERT(v1[0]=='B');
+ CPPUNIT_ASSERT(v1[1]=='C');
+ CPPUNIT_ASSERT(v1[2]=='A');
+
+}
diff --git a/test/unit/plusminus_test.cpp b/test/unit/plusminus_test.cpp
new file mode 100644
index 0000000..ee6f5c6
--- /dev/null
+++ b/test/unit/plusminus_test.cpp
@@ -0,0 +1,52 @@
+#include <numeric>
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class PlusMinusTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(PlusMinusTest);
+ CPPUNIT_TEST(plus0);
+ CPPUNIT_TEST(minus0);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void plus0();
+ void minus0();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PlusMinusTest);
+
+//
+// tests implementation
+//
+void PlusMinusTest::plus0()
+{
+ int input1 [4] = { 1, 6, 11, 8 };
+ int input2 [4] = { 1, 5, 2, 3 };
+
+ int total = inner_product(input1, input1 + 4, input2, 0, plus<int>(), multiplies <int>());
+
+ CPPUNIT_ASSERT(total==77);
+}
+void PlusMinusTest::minus0()
+{
+ int input1 [4] = { 1, 5, 7, 8 };
+ int input2 [4] = { 1, 4, 8, 3 };
+
+ int output [4];
+
+ transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, minus<int>());
+ CPPUNIT_ASSERT(output[0]==0);
+ CPPUNIT_ASSERT(output[1]==1);
+ CPPUNIT_ASSERT(output[2]==-1);
+ CPPUNIT_ASSERT(output[3]==5);
+}
diff --git a/test/unit/ptr2_test.cpp b/test/unit/ptr2_test.cpp
new file mode 100644
index 0000000..9a1155c
--- /dev/null
+++ b/test/unit/ptr2_test.cpp
@@ -0,0 +1,84 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class Ptr2Test : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(Ptr2Test);
+ CPPUNIT_TEST(ptrbin1);
+ CPPUNIT_TEST(ptrbin2);
+ CPPUNIT_TEST(ptrun1);
+ CPPUNIT_TEST(ptrun2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void ptrbin1();
+ void ptrbin2();
+ void ptrun1();
+ void ptrun2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Ptr2Test);
+
+//
+// tests implementation
+//
+static int sum(int x_, int y_)
+{
+ return x_ + y_;
+}
+bool even(int n_)
+{
+ return(n_ % 2) == 0;
+}
+void Ptr2Test::ptrbin1()
+{
+ int input1 [4] = { 7, 2, 3, 5 };
+ int input2 [4] = { 1, 5, 5, 8 };
+
+ int output [4];
+ transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, pointer_to_binary_function<int, int, int>(sum));
+
+ CPPUNIT_ASSERT(output[0]==8);
+ CPPUNIT_ASSERT(output[1]==7);
+ CPPUNIT_ASSERT(output[2]==8);
+ CPPUNIT_ASSERT(output[3]==13);
+}
+void Ptr2Test::ptrbin2()
+{
+ int input1 [4] = { 7, 2, 3, 5 };
+ int input2 [4] = { 1, 5, 5, 8 };
+
+ int output [4];
+ transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, ptr_fun(sum));
+
+ CPPUNIT_ASSERT(output[0]==8);
+ CPPUNIT_ASSERT(output[1]==7);
+ CPPUNIT_ASSERT(output[2]==8);
+ CPPUNIT_ASSERT(output[3]==13);
+}
+void Ptr2Test::ptrun1()
+{
+ int array [3] = { 1, 2, 3 };
+
+ int* p = find_if((int*)array, (int*)array + 3, pointer_to_unary_function<int, bool>(even));
+ CPPUNIT_ASSERT(p != array+3);
+ CPPUNIT_ASSERT(*p==2);
+}
+void Ptr2Test::ptrun2()
+{
+ int array [3] = { 1, 2, 3 };
+
+ int* p = find_if((int*)array, (int*)array + 3, ptr_fun(even));
+ CPPUNIT_ASSERT(p != array+3);
+ CPPUNIT_ASSERT(*p==2);
+}
diff --git a/test/unit/ptrspec_test.cpp b/test/unit/ptrspec_test.cpp
new file mode 100644
index 0000000..6d0fcf5
--- /dev/null
+++ b/test/unit/ptrspec_test.cpp
@@ -0,0 +1,232 @@
+#include <vector>
+#include <list>
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+# include <slist>
+#endif
+#include <deque>
+#include <set>
+#include <iterator>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class PtrSpecTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(PtrSpecTest);
+ CPPUNIT_TEST(ptr_specialization_test);
+ CPPUNIT_TEST(function_pointer);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ /// this seems to be compile only test but...
+ void ptr_specialization_test();
+ void function_pointer();
+
+ template <class _Tp>
+ struct unary_pred {
+ bool operator () (_Tp *__ptr) const {
+ return *__ptr == 0;
+ }
+ };
+
+ template <class _Tp>
+ struct binary_pred {
+ bool operator () (_Tp *__first, _Tp *__second) const {
+ return *__first < *__second;
+ }
+ };
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PtrSpecTest);
+
+#define TEST_INSTANCIATE_CONTAINER(cont) \
+ template class cont<int*>; \
+ template class cont<int const*>; \
+ template class cont<int volatile*>; \
+ template class cont<int const volatile*>
+
+#if !defined(_MSC_VER) || (_MSC_VER > 1200) // excluding MSVC 6.0
+TEST_INSTANCIATE_CONTAINER(vector);
+TEST_INSTANCIATE_CONTAINER(list);
+# if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+TEST_INSTANCIATE_CONTAINER(slist);
+# endif
+TEST_INSTANCIATE_CONTAINER(deque);
+TEST_INSTANCIATE_CONTAINER(set);
+TEST_INSTANCIATE_CONTAINER(multiset);
+#endif
+
+//Function to test pointer to function support:
+void FTypeInstance() {}
+
+//Class to test pointer to member method support:
+class AClass {
+public:
+ void func() {}
+};
+
+//
+// tests implementation
+//
+void PtrSpecTest::ptr_specialization_test()
+{
+ int *int_array[] = {0, 0, 0};
+ int const* cint_array[] = {0, 0, 0};
+
+ {
+ vector<void*> void_vect;
+ deque<void*> void_deque;
+ list<void*> void_list;
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ slist<void*> void_slist;
+#endif
+ }
+
+ {
+ typedef void (*FType)();
+ vector<FType> func_vector;
+ func_vector.push_back(&FTypeInstance);
+ }
+
+#if !defined(__GNUC__) || (__GNUC__ > 2)
+ {
+ typedef void (AClass::*MFType)();
+ vector<MFType> mem_func_vector;
+ mem_func_vector.push_back(&AClass::func);
+ }
+#endif
+
+ vector<int*> pint_vect;
+ vector<int*> pint_vect2;
+ vector<int const*> pcint_vect;
+ list<int*> pint_list;
+ list<int*> pint_list2;
+ list<int const*> pcint_list;
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ slist<int*> pint_slist;
+ slist<int*> pint_slist2;
+ slist<int const*> pcint_slist;
+#endif
+ deque<int*> pint_deque;
+ deque<int*> pint_deque2;
+ deque<int const*> pcint_deque;
+
+#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES)
+ vector<int*> pint_vect_from_list(pint_list.begin(), pint_list.end());
+#endif
+ pint_vect.insert(pint_vect.end(), pint_vect2.begin(), pint_vect2.end());
+ pint_vect.insert(pint_vect.end(), int_array, int_array + 3);
+ pint_vect2.insert(pint_vect2.end(), int_array, int_array + 3);
+ pcint_vect.insert(pcint_vect.end(), int_array, int_array + 3);
+ pcint_vect.insert(pcint_vect.end(), cint_array, cint_array + 3);
+#if !defined (STLPORT) || !defined(_STLP_DEBUG) || defined(_STLP_MEMBER_TEMPLATES)
+ pcint_vect.insert(pcint_vect.end(), pint_vect2.begin(), pint_vect2.end());
+#endif
+ pcint_vect.insert(pcint_vect.end(), int_array, int_array + 3);
+#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES)
+ pint_vect.insert(pint_vect.end(), pint_list.begin(), pint_list.end());
+ pcint_vect.insert(pcint_vect.end(), pint_list.begin(), pint_list.end());
+ pcint_vect.insert(pcint_vect.end(), pcint_list.begin(), pcint_list.end());
+ pint_vect.assign(pint_list.begin(), pint_list.end());
+ pcint_vect.assign(pint_list.begin(), pint_list.end());
+#endif
+ pint_vect.assign(int_array, int_array + 3);
+ pcint_vect.assign(int_array, int_array + 3);
+ pcint_vect.assign(cint_array, cint_array + 3);
+ copy(int_array, int_array + 3, back_inserter(pint_vect));
+
+#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES)
+ pint_list.sort(binary_pred<int>());
+ pcint_list.sort(binary_pred<int const>());
+ pint_list.unique(binary_pred<int>());
+ pcint_list.unique(binary_pred<int const>());
+ pint_list.merge(pint_list, binary_pred<int>());
+ pcint_list.merge(pcint_list, binary_pred<int const>());
+ pint_list.remove_if(unary_pred<int>());
+ pcint_list.remove_if(unary_pred<int const>());
+#endif
+
+ copy(int_array, int_array + 3, back_inserter(pint_list));
+ copy(int_array, int_array + 3, back_inserter(pint_list2));
+ pint_list.insert(pint_list.end(), pint_list2.begin(), pint_list2.end());
+#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES)
+ pcint_list.insert(pcint_list.end(), pint_list.begin(), pint_list.end());
+#endif
+#if !defined (STLPORT) || !defined(_STLP_DEBUG) || defined(_STLP_MEMBER_TEMPLATES)
+ pint_list.insert(pint_list.end(), pint_vect.begin(), pint_vect.end());
+ pcint_list.insert(pcint_list.end(), pint_vect.begin(), pint_vect.end());
+ pcint_list.insert(pcint_list.end(), pcint_vect.begin(), pcint_vect.end());
+ list<int*> pint_list_from_vect(pint_vect.begin(), pint_vect.end());
+ pint_list.assign(pint_vect.begin(), pint_vect.end());
+ pcint_list.assign(pint_vect.begin(), pint_vect.end());
+#endif
+ pint_list.insert(pint_list.begin(), int_array, int_array + 3);
+ pint_list.insert(pint_list.end(), int_array, int_array + 3);
+ pcint_list.insert(pcint_list.end(), int_array, int_array + 3);
+ pcint_list.insert(pcint_list.end(), cint_array, cint_array + 3);
+ pint_list.assign(int_array, int_array + 3);
+ pcint_list.assign(int_array, int_array + 3);
+ pcint_list.assign(cint_array, cint_array + 3);
+ //pint_list.assign(pcint_vect.begin(), pcint_vect.end());
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ copy(int_array, int_array + 3, front_inserter(pint_slist));
+ copy(int_array, int_array + 3, front_inserter(pint_slist2));
+ pint_slist.insert(pint_slist.end(), pint_slist2.begin(), pint_slist2.end());
+# if defined (_STLP_MEMBER_TEMPLATES)
+ pcint_slist.insert(pcint_slist.end(), pint_slist.begin(), pint_slist.end());
+# endif
+# if !defined (_STLP_DEBUG) || defined (_STLP_MEMBER_TEMPLATES)
+ pint_slist.insert(pint_slist.end(), pint_vect.begin(), pint_vect.end());
+ pcint_slist.insert(pcint_slist.end(), pint_vect.begin(), pint_vect.end());
+ pcint_slist.insert(pcint_slist.end(), pcint_vect.begin(), pcint_vect.end());
+ slist<int*> pint_slist_from_vect(pint_vect.begin(), pint_vect.end());
+ pint_slist.assign(pint_vect.begin(), pint_vect.end());
+ pcint_slist.assign(pint_vect.begin(), pint_vect.end());
+# endif
+ pint_slist.insert(pint_slist.end(), int_array, int_array + 3);
+ pcint_slist.insert(pcint_slist.end(), int_array, int_array + 3);
+ pcint_slist.insert(pcint_slist.end(), cint_array, cint_array + 3);
+ pint_slist.assign(int_array, int_array + 3);
+ pcint_slist.assign(int_array, int_array + 3);
+ pcint_slist.assign(cint_array, cint_array + 3);
+ //pint_slist.assign(pcint_vect.begin(), pcint_vect.end());
+#endif
+
+ copy(int_array, int_array + 3, back_inserter(pint_deque));
+ copy(int_array, int_array + 3, back_inserter(pint_deque2));
+ pint_deque.insert(pint_deque.end(), pint_deque2.begin(), pint_deque2.end());
+#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES)
+ pcint_deque.insert(pcint_deque.end(), pint_deque.begin(), pint_deque.end());
+#endif
+#if !defined (STLPORT) || !defined(_STLP_DEBUG) || defined(_STLP_MEMBER_TEMPLATES)
+ pint_deque.insert(pint_deque.end(), pint_vect.begin(), pint_vect.end());
+ pcint_deque.insert(pcint_deque.end(), pint_vect.begin(), pint_vect.end());
+ pcint_deque.insert(pcint_deque.end(), pcint_vect.begin(), pcint_vect.end());
+ deque<int*> pint_deque_from_vect(pint_vect.begin(), pint_vect.end());
+ pint_deque.assign(pint_vect.begin(), pint_vect.end());
+ pcint_deque.assign(pint_vect.begin(), pint_vect.end());
+#endif
+ pint_deque.insert(pint_deque.end(), int_array, int_array + 3);
+ pcint_deque.insert(pcint_deque.end(), int_array, int_array + 3);
+ pcint_deque.insert(pcint_deque.end(), cint_array, cint_array + 3);
+ pint_deque.assign(int_array, int_array + 3);
+ pcint_deque.assign(int_array, int_array + 3);
+ pcint_deque.assign(cint_array, cint_array + 3);
+}
+
+typedef void (*Func)(int);
+void f1(int) {}
+
+void PtrSpecTest::function_pointer()
+{
+ vector<Func> fs;
+ fs.push_back(&f1);
+ CPPUNIT_ASSERT( !fs.empty() );
+}
diff --git a/test/unit/queue_header_test.cpp b/test/unit/queue_header_test.cpp
new file mode 100644
index 0000000..4149c22
--- /dev/null
+++ b/test/unit/queue_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <queue>
diff --git a/test/unit/queue_test.cpp b/test/unit/queue_test.cpp
new file mode 100644
index 0000000..2e6add3
--- /dev/null
+++ b/test/unit/queue_test.cpp
@@ -0,0 +1,64 @@
+#include <vector>
+#include <algorithm>
+#include <list>
+#include <deque>
+#include <queue>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class QueueTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(QueueTest);
+ CPPUNIT_TEST(pqueue1);
+ CPPUNIT_TEST(queue1);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void pqueue1();
+ void queue1();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(QueueTest);
+
+//
+// tests implementation
+//
+void QueueTest::pqueue1()
+{
+ priority_queue<int, deque<int>, less<int> > q;
+ q.push(42);
+ q.push(101);
+ q.push(69);
+
+ CPPUNIT_ASSERT( q.top()==101 );
+ q.pop();
+ CPPUNIT_ASSERT( q.top()==69 );
+ q.pop();
+ CPPUNIT_ASSERT( q.top()==42 );
+ q.pop();
+
+ CPPUNIT_ASSERT(q.empty());
+}
+void QueueTest::queue1()
+{
+ queue<int, list<int> > q;
+ q.push(42);
+ q.push(101);
+ q.push(69);
+
+ CPPUNIT_ASSERT( q.front()==42 );
+ q.pop();
+ CPPUNIT_ASSERT( q.front()==101 );
+ q.pop();
+ CPPUNIT_ASSERT( q.front()==69 );
+ q.pop();
+
+ CPPUNIT_ASSERT(q.empty());
+}
diff --git a/test/unit/rawriter_test.cpp b/test/unit/rawriter_test.cpp
new file mode 100644
index 0000000..0c8438a
--- /dev/null
+++ b/test/unit/rawriter_test.cpp
@@ -0,0 +1,66 @@
+#include <algorithm>
+#include <iterator>
+#include <memory>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+class X
+{
+ public:
+ X(int i_ = 0) : i(i_) {}
+ ~X() {}
+ operator int() const { return i; }
+
+ private:
+ int i;
+};
+
+
+//
+// TestCase class
+//
+class RawriterTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(RawriterTest);
+ CPPUNIT_TEST(rawiter1);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void rawiter1();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(RawriterTest);
+
+//
+// tests implementation
+//
+void RawriterTest::rawiter1()
+{
+ allocator<X> a;
+ typedef X* x_pointer;
+ x_pointer save_p, p;
+ p = a.allocate(5);
+ save_p=p;
+ raw_storage_iterator<X*, X> r(p);
+ int i;
+ for(i = 0; i < 5; i++)
+ *r++ = X(i);
+
+ CPPUNIT_ASSERT(*p++ == 0);
+ CPPUNIT_ASSERT(*p++ == 1);
+ CPPUNIT_ASSERT(*p++ == 2);
+ CPPUNIT_ASSERT(*p++ == 3);
+ CPPUNIT_ASSERT(*p++ == 4);
+
+//#if defined (STLPORT) || defined (__GNUC__)
+ a.deallocate(save_p, 5);
+/*
+#else
+ a.deallocate(save_p);
+#endif
+*/
+}
diff --git a/test/unit/reference_wrapper_test.cpp b/test/unit/reference_wrapper_test.cpp
new file mode 100644
index 0000000..4e3fb41
--- /dev/null
+++ b/test/unit/reference_wrapper_test.cpp
@@ -0,0 +1,85 @@
+#include <functional>
+
+#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
+
+#include <typeinfo>
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+class RefWrapperTest :
+ public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(RefWrapperTest);
+ CPPUNIT_TEST(ref);
+ CPPUNIT_TEST(cref);
+ CPPUNIT_TEST_SUITE_END();
+
+ protected:
+ void ref();
+ void cref();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(RefWrapperTest);
+
+void RefWrapperTest::ref()
+{
+ typedef std::tr1::reference_wrapper<int> rr_type;
+
+ CPPUNIT_CHECK( (::boost::is_convertible<rr_type, int&>::value) );
+ CPPUNIT_CHECK( (::boost::is_same<rr_type::type, int>::value) );
+
+ int i = 1;
+ int j = 2;
+
+ rr_type r1 = std::tr1::ref(i);
+
+ CPPUNIT_CHECK( r1.get() == 1 );
+
+ r1 = std::tr1::ref(j);
+
+ CPPUNIT_CHECK( r1.get() == 2 );
+
+ i = 3;
+
+ CPPUNIT_CHECK( r1.get() == 2 );
+
+ j = 4;
+
+ CPPUNIT_CHECK( r1.get() == 4 );
+
+ r1.get() = 5;
+
+ CPPUNIT_CHECK( j == 5 );
+}
+
+void RefWrapperTest::cref()
+{
+ typedef std::tr1::reference_wrapper<const int> crr_type;
+
+ CPPUNIT_CHECK( (::boost::is_convertible<crr_type, const int&>::value) );
+ CPPUNIT_CHECK( (::boost::is_same<crr_type::type, const int>::value) );
+
+ int i = 1;
+ int j = 2;
+
+ crr_type r1 = std::tr1::cref(i);
+
+ CPPUNIT_CHECK( r1.get() == 1 );
+
+ r1 = std::tr1::cref(j);
+
+ CPPUNIT_CHECK( r1.get() == 2 );
+
+ i = 3;
+
+ CPPUNIT_CHECK( r1.get() == 2 );
+
+ j = 4;
+
+ CPPUNIT_CHECK( r1.get() == 4 );
+}
+
+#endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */
diff --git a/test/unit/resolve_name.cpp b/test/unit/resolve_name.cpp
new file mode 100644
index 0000000..dc7c123
--- /dev/null
+++ b/test/unit/resolve_name.cpp
@@ -0,0 +1,83 @@
+#define _STLP_DO_IMPORT_CSTD_FUNCTIONS
+#include <cmath>
+
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+
+namespace NS1 {
+
+bool f()
+{
+ double d( 1.0 );
+
+ d = sqrt( d );
+ d = ::sqrt( d );
+ d = std::sqrt( d );
+ return d == 1.0;
+}
+
+}
+
+namespace {
+
+bool g()
+{
+ double d( 1.0 );
+
+ d = sqrt( d );
+ d = ::sqrt( d );
+ d = std::sqrt( d );
+ return d == 1.0;
+}
+
+}
+
+// VC6 consider call to sqrt ambiguous as soon as using namespace std has
+// been invoked.
+#if !defined (STLPORT) || !defined (_STLP_MSVC) || (_STLP_MSVC >= 1300)
+using namespace std;
+#endif
+
+bool h()
+{
+ double d( 1.0 );
+
+ d = sqrt( d );
+ d = ::sqrt( d );
+ d = std::sqrt( d );
+ return d == 1.0;
+}
+
+struct sq
+{
+ sq() {}
+
+ double sqroot( double x ) {
+ using std::sqrt;
+ return sqrt(x);
+ }
+};
+
+#endif
+
+
+#if 0 // Do nothing, this should be compiled only
+
+#include "cppunit/cppunit_proxy.h"
+
+class ResolveNameTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(ResolveNameTest);
+ CPPUNIT_TEST(cstyle);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void cstyle();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ResolveNameTest);
+
+void ResolveNameTest::cstyle()
+{
+}
+
+#endif
diff --git a/test/unit/reviter_test.cpp b/test/unit/reviter_test.cpp
new file mode 100644
index 0000000..15a3c34
--- /dev/null
+++ b/test/unit/reviter_test.cpp
@@ -0,0 +1,72 @@
+#include <vector>
+#include <list>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class ReviterTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(ReviterTest);
+ CPPUNIT_TEST(reviter1);
+ CPPUNIT_TEST(reviter2);
+ CPPUNIT_TEST(revbit1);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void reviter1();
+ void reviter2();
+ void revbit1();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ReviterTest);
+
+//
+// tests implementation
+//
+void ReviterTest::reviter1()
+{
+ int array [] = { 1, 5, 2, 3 };
+
+ vector<int> v(array, array + 4);
+ typedef vector<int>::reverse_iterator reviter;
+ reviter r(v.rend());
+ r--;
+
+ CPPUNIT_ASSERT(*r-- == 1);
+ CPPUNIT_ASSERT(*r-- == 5);
+ CPPUNIT_ASSERT(*r-- == 2);
+ CPPUNIT_ASSERT(*r == 3);
+ CPPUNIT_ASSERT(r==v.rbegin());
+}
+void ReviterTest::reviter2()
+{
+ int array [] = { 1, 5, 2, 3 };
+
+ vector<int> v(array, array + 4);
+ vector<int>::reverse_iterator r;
+ r = v.rbegin();
+ CPPUNIT_ASSERT(*r++ == 3);
+ CPPUNIT_ASSERT(*r++ == 2);
+ CPPUNIT_ASSERT(*r++ == 5);
+ CPPUNIT_ASSERT(*r++ == 1);
+ CPPUNIT_ASSERT(r==v.rend());
+}
+void ReviterTest::revbit1()
+{
+ int array [] = { 1, 5, 2, 3 };
+
+ list<int> v(array, array + 4);
+ list<int>::reverse_iterator r(v.rbegin());
+ CPPUNIT_ASSERT(*r++ == 3);
+ CPPUNIT_ASSERT(*r++ == 2);
+ CPPUNIT_ASSERT(*r++ == 5);
+ CPPUNIT_ASSERT(*r++ == 1);
+ CPPUNIT_ASSERT(r==v.rend());
+}
diff --git a/test/unit/rm_cp_test.cpp b/test/unit/rm_cp_test.cpp
new file mode 100644
index 0000000..3e3a4d6
--- /dev/null
+++ b/test/unit/rm_cp_test.cpp
@@ -0,0 +1,245 @@
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class RmCpTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(RmCpTest);
+ CPPUNIT_TEST(remcopy1);
+ CPPUNIT_TEST(remcpif1);
+ CPPUNIT_TEST(remif1);
+ CPPUNIT_TEST(remove1);
+ CPPUNIT_TEST(repcpif1);
+ CPPUNIT_TEST(replace0);
+ CPPUNIT_TEST(replace1);
+ CPPUNIT_TEST(replcpy1);
+ CPPUNIT_TEST(replif1);
+ CPPUNIT_TEST(revcopy1);
+ CPPUNIT_TEST(reverse1);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void remcopy1();
+ void remcpif1();
+ void remif1();
+ void remove1();
+ void repcpif1();
+ void replace0();
+ void replace1();
+ void replcpy1();
+ void replif1();
+ void revcopy1();
+ void reverse1();
+
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(RmCpTest);
+
+static bool odd(int a_)
+{
+ return (a_ % 2) != 0;
+}
+//
+// tests implementation
+//
+
+void RmCpTest::reverse1()
+{
+ int numbers[6] = { 0, 1, 2, 3, 4, 5 };
+
+ reverse(numbers, numbers + 6);
+ CPPUNIT_ASSERT(numbers[0]==5);
+ CPPUNIT_ASSERT(numbers[1]==4);
+ CPPUNIT_ASSERT(numbers[2]==3);
+ CPPUNIT_ASSERT(numbers[3]==2);
+ CPPUNIT_ASSERT(numbers[4]==1);
+ CPPUNIT_ASSERT(numbers[5]==0);
+}
+
+void RmCpTest::revcopy1()
+{
+ int numbers[6] = { 0, 1, 2, 3, 4, 5 };
+
+ int result[6];
+ reverse_copy((int*)numbers, (int*)numbers + 6, (int*)result);
+ // 5 4 3 2 1 0
+ CPPUNIT_ASSERT(result[0]==5);
+ CPPUNIT_ASSERT(result[1]==4);
+ CPPUNIT_ASSERT(result[2]==3);
+ CPPUNIT_ASSERT(result[3]==2);
+ CPPUNIT_ASSERT(result[4]==1);
+ CPPUNIT_ASSERT(result[5]==0);
+}
+
+void RmCpTest::replif1()
+{
+ vector <int> v1(10);
+ for (int i = 0; (size_t)i < v1.size(); ++i)
+ v1[i] = i % 5;
+
+ replace_if(v1.begin(), v1.end(), odd, 42);
+
+ // 0 42 2 42 4 0 42 2 42 4
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==42);
+ CPPUNIT_ASSERT(v1[2]==2);
+ CPPUNIT_ASSERT(v1[3]==42);
+ CPPUNIT_ASSERT(v1[4]==4);
+ CPPUNIT_ASSERT(v1[5]==0);
+ CPPUNIT_ASSERT(v1[6]==42);
+ CPPUNIT_ASSERT(v1[7]==2);
+ CPPUNIT_ASSERT(v1[8]==42);
+ CPPUNIT_ASSERT(v1[9]==4);
+}
+
+void RmCpTest::replcpy1()
+{
+ int numbers[6] = { 0, 1, 2, 0, 1, 2 };
+ int result[6] = { 0, 0, 0, 0, 0, 0 };
+
+ replace_copy((int*)numbers, (int*)numbers + 6, (int*)result, 2, 42);
+ CPPUNIT_ASSERT(result[0]==0);
+ CPPUNIT_ASSERT(result[1]==1);
+ CPPUNIT_ASSERT(result[2]==42);
+ CPPUNIT_ASSERT(result[3]==0);
+ CPPUNIT_ASSERT(result[4]==1);
+ CPPUNIT_ASSERT(result[5]==42);
+}
+
+void RmCpTest::replace0()
+{
+ int numbers[6] = { 0, 1, 2, 0, 1, 2 };
+
+ replace(numbers, numbers + 6, 2, 42);
+
+ // 0 1 42 0 1 42
+ CPPUNIT_ASSERT(numbers[0]==0);
+ CPPUNIT_ASSERT(numbers[1]==1);
+ CPPUNIT_ASSERT(numbers[2]==42);
+ CPPUNIT_ASSERT(numbers[3]==0);
+ CPPUNIT_ASSERT(numbers[4]==1);
+ CPPUNIT_ASSERT(numbers[5]==42);
+}
+
+void RmCpTest::replace1()
+{
+ vector <int> v1(10);
+ for (int i = 0; (size_t)i < v1.size(); ++i)
+ v1[i] = i % 5;
+ replace(v1.begin(), v1.end(), 2, 42);
+
+ // 0 1 2 3 4 0 1 2 3 4
+ // 0 1 42 3 4 0 1 42 3 4
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==42);
+ CPPUNIT_ASSERT(v1[3]==3);
+ CPPUNIT_ASSERT(v1[4]==4);
+ CPPUNIT_ASSERT(v1[5]==0);
+ CPPUNIT_ASSERT(v1[6]==1);
+ CPPUNIT_ASSERT(v1[7]==42);
+ CPPUNIT_ASSERT(v1[8]==3);
+ CPPUNIT_ASSERT(v1[9]==4);
+}
+
+void RmCpTest::repcpif1()
+{
+ vector <int> v1(10);
+ for (int i = 0; (size_t)i < v1.size(); ++i)
+ v1[i] = i % 5;
+ vector <int> v2(v1.size());
+
+ // 0 1 2 3 4 0 1 2 3 4
+ // 0 1 2 3 4 0 1 2 3 4
+ // 0 42 2 42 4 0 42 2 42 4
+ replace_copy_if(v1.begin(), v1.end(), v2.begin(), odd, 42);
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==2);
+ CPPUNIT_ASSERT(v1[3]==3);
+ CPPUNIT_ASSERT(v1[4]==4);
+ CPPUNIT_ASSERT(v1[5]==0);
+ CPPUNIT_ASSERT(v1[6]==1);
+ CPPUNIT_ASSERT(v1[7]==2);
+ CPPUNIT_ASSERT(v1[8]==3);
+ CPPUNIT_ASSERT(v1[9]==4);
+
+ CPPUNIT_ASSERT(v2[0]==0);
+ CPPUNIT_ASSERT(v2[1]==42);
+ CPPUNIT_ASSERT(v2[2]==2);
+ CPPUNIT_ASSERT(v2[3]==42);
+ CPPUNIT_ASSERT(v2[4]==4);
+ CPPUNIT_ASSERT(v2[5]==0);
+ CPPUNIT_ASSERT(v2[6]==42);
+ CPPUNIT_ASSERT(v2[7]==2);
+ CPPUNIT_ASSERT(v2[8]==42);
+ CPPUNIT_ASSERT(v2[9]==4);
+}
+
+void RmCpTest::remove1()
+{
+ int numbers[6] = { 1, 2, 3, 1, 2, 3 };
+ remove((int*)numbers, (int*)numbers + 6, 1);
+
+ // 2 3 2 3 2 3
+ CPPUNIT_ASSERT(numbers[0]==2);
+ CPPUNIT_ASSERT(numbers[1]==3);
+ CPPUNIT_ASSERT(numbers[2]==2);
+ CPPUNIT_ASSERT(numbers[3]==3);
+ CPPUNIT_ASSERT(numbers[4]==2);
+ CPPUNIT_ASSERT(numbers[5]==3);
+}
+
+void RmCpTest::remif1()
+{
+ int numbers[6] = { 0, 0, 1, 1, 2, 2 };
+
+ remove_if((int*)numbers, (int*)numbers + 6, odd);
+
+ // 0 0 2 2 2 2
+ CPPUNIT_ASSERT(numbers[0]==0);
+ CPPUNIT_ASSERT(numbers[1]==0);
+ CPPUNIT_ASSERT(numbers[2]==2);
+ CPPUNIT_ASSERT(numbers[3]==2);
+ CPPUNIT_ASSERT(numbers[4]==2);
+ CPPUNIT_ASSERT(numbers[5]==2);
+}
+
+void RmCpTest::remcopy1()
+{
+ int numbers[6] = { 1, 2, 3, 1, 2, 3 };
+ int result[6] = { 0, 0, 0, 0, 0, 0 };
+
+ remove_copy((int*)numbers, (int*)numbers + 6, (int*)result, 2);
+
+ CPPUNIT_ASSERT(result[0]==1);
+ CPPUNIT_ASSERT(result[1]==3);
+ CPPUNIT_ASSERT(result[2]==1);
+ CPPUNIT_ASSERT(result[3]==3);
+ CPPUNIT_ASSERT(result[4]==0);
+ CPPUNIT_ASSERT(result[5]==0);
+}
+
+void RmCpTest::remcpif1()
+{
+ int numbers[6] = { 1, 2, 3, 1, 2, 3 };
+ int result[6] = { 0, 0, 0, 0, 0, 0 };
+
+ remove_copy_if((int*)numbers, (int*)numbers + 6, (int*)result, odd);
+
+ // 2 2 0 0 0 0
+ CPPUNIT_ASSERT(result[0]==2);
+ CPPUNIT_ASSERT(result[1]==2);
+ CPPUNIT_ASSERT(result[2]==0);
+ CPPUNIT_ASSERT(result[3]==0);
+ CPPUNIT_ASSERT(result[4]==0);
+ CPPUNIT_ASSERT(result[5]==0);
+}
diff --git a/test/unit/rndshf_test.cpp b/test/unit/rndshf_test.cpp
new file mode 100644
index 0000000..ad57a53
--- /dev/null
+++ b/test/unit/rndshf_test.cpp
@@ -0,0 +1,73 @@
+#include <numeric>
+#include <vector>
+#include <algorithm>
+
+#include "iota.h"
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class RndShuffleTest : public CPPUNIT_NS::TestCase
+{
+ class MyRandomGenerator
+ {
+ public:
+ unsigned long operator()(unsigned long n_)
+ {
+ return rand() % n_;
+ }
+ };
+ CPPUNIT_TEST_SUITE(RndShuffleTest);
+ CPPUNIT_TEST(rndshuf0);
+ CPPUNIT_TEST(rndshuf2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void rndshuf0();
+ void rndshuf2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(RndShuffleTest);
+
+//
+// tests implementation
+//
+void RndShuffleTest::rndshuf0()
+{
+ int numbers[6] = { 1, 2, 3, 4, 5, 6 };
+
+ random_shuffle(numbers, numbers + 6);
+
+ CPPUNIT_ASSERT(count(numbers, numbers+6, 1)==1);
+ CPPUNIT_ASSERT(count(numbers, numbers+6, 2)==1);
+ CPPUNIT_ASSERT(count(numbers, numbers+6, 3)==1);
+ CPPUNIT_ASSERT(count(numbers, numbers+6, 4)==1);
+ CPPUNIT_ASSERT(count(numbers, numbers+6, 5)==1);
+ CPPUNIT_ASSERT(count(numbers, numbers+6, 6)==1);
+}
+void RndShuffleTest::rndshuf2()
+{
+ vector <int> v1(10);
+ __iota(v1.begin(), v1.end(), 0);
+
+ MyRandomGenerator r;
+ for(int i = 0; i < 3; i++)
+ {
+ random_shuffle(v1.begin(), v1.end(), r);
+ CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 0)==1);
+ CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 1)==1);
+ CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 2)==1);
+ CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 3)==1);
+ CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 4)==1);
+ CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 5)==1);
+ CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 6)==1);
+ CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 7)==1);
+ CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 8)==1);
+ CPPUNIT_ASSERT(count(v1.begin(), v1.end(), 9)==1);
+ }
+}
diff --git a/test/unit/rope_test.cpp b/test/unit/rope_test.cpp
new file mode 100644
index 0000000..c12fec8
--- /dev/null
+++ b/test/unit/rope_test.cpp
@@ -0,0 +1,189 @@
+//Small header to get STLport numerous defines:
+#include <utility>
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+# include <rope>
+
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+# include <sstream>
+# endif
+#endif
+
+#include "cppunit/cppunit_proxy.h"
+
+// #include <stdlib.h> // for rand etc
+
+#if defined (_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class RopeTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(RopeTest);
+#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) || defined (_STLP_USE_NO_IOSTREAMS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(io);
+#if defined (_STLP_USE_NO_IOSTREAMS)
+ CPPUNIT_STOP_IGNORE;
+#endif
+ CPPUNIT_TEST(find1);
+ CPPUNIT_TEST(find2);
+ CPPUNIT_TEST(construct_from_char);
+ CPPUNIT_TEST(bug_report);
+#if !defined (_STLP_MEMBER_TEMPLATES)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(test_saved_rope_iterators);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void io();
+ void find1();
+ void find2();
+ void construct_from_char();
+ void bug_report();
+ void test_saved_rope_iterators();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(RopeTest);
+
+//
+// tests implementation
+//
+void RopeTest::io()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) && !defined (_STLP_USE_NO_IOSTREAMS)
+ char const* cstr = "rope test string";
+ crope rstr(cstr);
+
+ {
+ ostringstream ostr;
+ ostr << rstr;
+
+ CPPUNIT_ASSERT( ostr );
+ CPPUNIT_ASSERT( ostr.str() == cstr );
+ }
+#endif
+}
+
+void RopeTest::find1()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ crope r("Fuzzy Wuzzy was a bear");
+ crope::size_type n = r.find( "hair" );
+ CPPUNIT_ASSERT( n == crope::npos );
+
+ n = r.find("ear");
+
+ CPPUNIT_ASSERT( n == (r.size() - 3) );
+#endif
+}
+
+void RopeTest::find2()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ crope r("Fuzzy Wuzzy was a bear");
+ crope::size_type n = r.find( 'e' );
+ CPPUNIT_ASSERT( n == (r.size() - 3) );
+#endif
+}
+
+void RopeTest::construct_from_char()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ crope r('1');
+ char const* s = r.c_str();
+ CPPUNIT_ASSERT( '1' == s[0] && '\0' == s[1] );
+#endif
+}
+
+// Test used for a bug report from Peter Hercek
+void RopeTest::bug_report()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ //first create a rope bigger than crope::_S_copy_max = 23
+ // so that any string addition is added to a new leaf
+ crope evilRope("12345678901234567890123_");
+ //crope* pSevenCharRope( new TRope("1234567") );
+ crope sevenCharRope0("12345678");
+ crope sevenCharRope1("1234567");
+ // add _Rope_RopeRep<c,a>::_S_alloc_granularity-1 = 7 characters
+ evilRope += "1234567"; // creates a new leaf
+ crope sevenCharRope2("1234567");
+ // add one more character to the leaf
+ evilRope += '8'; // here is the write beyond the allocated memory
+ CPPUNIT_ASSERT( strcmp(sevenCharRope2.c_str(), "1234567") == 0 );
+#endif
+}
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+const char str[] = "ilcpsklryvmcpjnbpbwllsrehfmxrkecwitrsglrexvtjmxypu\
+nbqfgxmuvgfajclfvenhyuhuorjosamibdnjdbeyhkbsomblto\
+uujdrbwcrrcgbflqpottpegrwvgajcrgwdlpgitydvhedtusip\
+pyvxsuvbvfenodqasajoyomgsqcpjlhbmdahyviuemkssdslde\
+besnnngpesdntrrvysuipywatpfoelthrowhfexlwdysvspwlk\
+fblfdf";
+
+crope create_rope( int len )
+{
+ int l = len/2;
+ crope result;
+ if(l <= 2)
+ {
+ static int j = 0;
+ for(int i = 0; i < len; ++i)
+ {
+ // char c = 'a' + rand() % ('z' - 'a');
+ result.append(1, /* c */ str[j++] );
+ j %= sizeof(str);
+ }
+ }
+ else
+ {
+ result = create_rope(len/2);
+ result.append(create_rope(len/2));
+ }
+ return result;
+}
+
+#endif
+
+void RopeTest::test_saved_rope_iterators()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) && \
+ defined (_STLP_MEMBER_TEMPLATES)
+ //
+ // Try and create a rope with a complex tree structure:
+ //
+ // srand(0);
+ crope r = create_rope(300);
+ string expected(r.begin(), r.end());
+ CPPUNIT_ASSERT(expected.size() == r.size());
+ CPPUNIT_ASSERT(equal(expected.begin(), expected.end(), r.begin()));
+ crope::const_iterator i(r.begin()), j(r.end());
+ int pos = 0;
+ while(i != j)
+ {
+ crope::const_iterator k;
+ // This initial read triggers the bug:
+ CPPUNIT_ASSERT(*i);
+ k = i;
+ int newpos = pos;
+ // Now make sure that i is incremented into the next leaf:
+ while(i != j)
+ {
+ CPPUNIT_ASSERT(*i == expected[newpos]);
+ ++i;
+ ++newpos;
+ }
+ // Back up from stored value and continue:
+ i = k;
+ ++i;
+ ++pos;
+ }
+#endif
+}
diff --git a/test/unit/rotate_test.cpp b/test/unit/rotate_test.cpp
new file mode 100644
index 0000000..730bf28
--- /dev/null
+++ b/test/unit/rotate_test.cpp
@@ -0,0 +1,133 @@
+#include <numeric>
+#include <vector>
+#include <algorithm>
+
+#include "iota.h"
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class RotateTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(RotateTest);
+ CPPUNIT_TEST(rotate0);
+ CPPUNIT_TEST(rotate1);
+ CPPUNIT_TEST(rotcopy0);
+ CPPUNIT_TEST(rotcopy1);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void rotate0();
+ void rotate1();
+ void rotcopy0();
+ void rotcopy1();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(RotateTest);
+
+//
+// tests implementation
+//
+void RotateTest::rotate0()
+{
+ int numbers[6] = { 0, 1, 2, 3, 4, 5 };
+ // 3 4 5 0 1 2
+ rotate((int*)numbers, numbers + 3, numbers + 6);
+ CPPUNIT_ASSERT(numbers[0]==3);
+ CPPUNIT_ASSERT(numbers[1]==4);
+ CPPUNIT_ASSERT(numbers[2]==5);
+ CPPUNIT_ASSERT(numbers[3]==0);
+ CPPUNIT_ASSERT(numbers[4]==1);
+ CPPUNIT_ASSERT(numbers[5]==2);
+}
+void RotateTest::rotate1()
+{
+ vector <int> v1(10);
+ __iota(v1.begin(), v1.end(), 0);
+
+ rotate(v1.begin(), v1.begin()+1, v1.end());
+ CPPUNIT_ASSERT(v1[0]==1);
+ CPPUNIT_ASSERT(v1[1]==2);
+ CPPUNIT_ASSERT(v1[2]==3);
+ CPPUNIT_ASSERT(v1[3]==4);
+ CPPUNIT_ASSERT(v1[4]==5);
+ CPPUNIT_ASSERT(v1[5]==6);
+ CPPUNIT_ASSERT(v1[6]==7);
+ CPPUNIT_ASSERT(v1[7]==8);
+ CPPUNIT_ASSERT(v1[8]==9);
+ CPPUNIT_ASSERT(v1[9]==0);
+
+ rotate(v1.begin(), v1.begin()+2, v1.end());
+ CPPUNIT_ASSERT(v1[0]==3);
+ CPPUNIT_ASSERT(v1[1]==4);
+ CPPUNIT_ASSERT(v1[2]==5);
+ CPPUNIT_ASSERT(v1[3]==6);
+ CPPUNIT_ASSERT(v1[4]==7);
+ CPPUNIT_ASSERT(v1[5]==8);
+ CPPUNIT_ASSERT(v1[6]==9);
+ CPPUNIT_ASSERT(v1[7]==0);
+ CPPUNIT_ASSERT(v1[8]==1);
+ CPPUNIT_ASSERT(v1[9]==2);
+
+ rotate(v1.begin(), v1.begin()+7, v1.end());
+ CPPUNIT_ASSERT(v1[0]==0);
+ CPPUNIT_ASSERT(v1[1]==1);
+ CPPUNIT_ASSERT(v1[2]==2);
+ CPPUNIT_ASSERT(v1[3]==3);
+ CPPUNIT_ASSERT(v1[4]==4);
+ CPPUNIT_ASSERT(v1[5]==5);
+ CPPUNIT_ASSERT(v1[6]==6);
+ CPPUNIT_ASSERT(v1[7]==7);
+ CPPUNIT_ASSERT(v1[8]==8);
+ CPPUNIT_ASSERT(v1[9]==9);
+
+}
+void RotateTest::rotcopy0()
+{
+ int numbers[6] = { 0, 1, 2, 3, 4, 5 };
+
+ int result[6];
+ rotate_copy((int*)numbers, (int*)numbers + 3, (int*)numbers + 6, (int*)result);
+ // 3 4 5 0 1 2
+ CPPUNIT_ASSERT(result[0]==3);
+ CPPUNIT_ASSERT(result[1]==4);
+ CPPUNIT_ASSERT(result[2]==5);
+ CPPUNIT_ASSERT(result[3]==0);
+ CPPUNIT_ASSERT(result[4]==1);
+ CPPUNIT_ASSERT(result[5]==2);
+}
+void RotateTest::rotcopy1()
+{
+ vector <int> v1(10);
+ __iota(v1.begin(), v1.end(), 0);
+ vector <int> v2(v1.size());
+
+ rotate_copy(v1.begin(), v1.begin()+1, v1.end(), v2.begin());
+ CPPUNIT_ASSERT(v2[0]==1);
+ CPPUNIT_ASSERT(v2[1]==2);
+ CPPUNIT_ASSERT(v2[2]==3);
+ CPPUNIT_ASSERT(v2[3]==4);
+ CPPUNIT_ASSERT(v2[4]==5);
+ CPPUNIT_ASSERT(v2[5]==6);
+ CPPUNIT_ASSERT(v2[6]==7);
+ CPPUNIT_ASSERT(v2[7]==8);
+ CPPUNIT_ASSERT(v2[8]==9);
+ CPPUNIT_ASSERT(v2[9]==0);
+
+ rotate_copy(v1.begin(), v1.begin()+3, v1.end(), v2.begin());
+ CPPUNIT_ASSERT(v2[0]==3);
+ CPPUNIT_ASSERT(v2[1]==4);
+ CPPUNIT_ASSERT(v2[2]==5);
+ CPPUNIT_ASSERT(v2[3]==6);
+ CPPUNIT_ASSERT(v2[4]==7);
+ CPPUNIT_ASSERT(v2[5]==8);
+ CPPUNIT_ASSERT(v2[6]==9);
+ CPPUNIT_ASSERT(v2[7]==0);
+ CPPUNIT_ASSERT(v2[8]==1);
+ CPPUNIT_ASSERT(v2[9]==2);
+}
diff --git a/test/unit/search_test.cpp b/test/unit/search_test.cpp
new file mode 100644
index 0000000..f7dd33d
--- /dev/null
+++ b/test/unit/search_test.cpp
@@ -0,0 +1,89 @@
+#include <vector>
+#include <numeric>
+#include <algorithm>
+
+#include "iota.h"
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class SearchTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(SearchTest);
+ CPPUNIT_TEST(search0);
+ CPPUNIT_TEST(search1);
+ CPPUNIT_TEST(search2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void search0();
+ void search1();
+ void search2();
+
+ static bool str_equal(const char* a_, const char* b_)
+ {
+ return strcmp(a_, b_) == 0 ? 1 : 0;
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SearchTest);
+
+//
+// tests implementation
+//
+void SearchTest::search0()
+{
+ int v1[6] = { 1, 1, 2, 3, 5, 8 };
+ int v2[6] = { 0, 1, 2, 3, 4, 5 };
+ int v3[2] = { 3, 4 };
+
+ int* location;
+ location = search((int*)v1, (int*)v1 + 6, (int*)v3, (int*)v3 + 2);
+ CPPUNIT_ASSERT(location == v1 + 6);
+
+ location = search((int*)v2, (int*)v2 + 6, (int*)v3, (int*)v3 + 2);
+ CPPUNIT_ASSERT(location != v2 + 6);
+ CPPUNIT_ASSERT(location - v2 == 3);
+}
+void SearchTest::search1()
+{
+ typedef vector <int> IntVec;
+ IntVec v1(10);
+ __iota(v1.begin(), v1.end(), 0);
+ IntVec v2(3);
+ __iota(v2.begin(), v2.end(), 50);
+
+ IntVec::iterator location;
+ location = search(v1.begin(), v1.end(), v2.begin(), v2.end());
+
+ CPPUNIT_ASSERT(location == v1.end());
+
+ __iota(v2.begin(), v2.end(), 4);
+
+ location = search(v1.begin(), v1.end(), v2.begin(), v2.end());
+
+ CPPUNIT_ASSERT(location != v1.end());
+ CPPUNIT_ASSERT(location - v1.begin() == 4);
+}
+void SearchTest::search2()
+{
+ char const* grades[] = { "A", "B", "C", "D", "F" };
+ char const* letters[] = { "Q", "E", "D" };
+ const unsigned gradeCount = sizeof(grades) / sizeof(grades[0]);
+ const unsigned letterCount = sizeof(letters) / sizeof(letters[0]);
+ char const** location = search((char const**)grades, (char const**)grades + gradeCount, (char const**)letters, (char const**)letters + letterCount, str_equal);
+
+ CPPUNIT_ASSERT(location == grades + gradeCount);
+
+ copy((char const**)grades + 1, (char const**)grades + 1 + letterCount, (char const**)letters);
+ location = search((char const**)grades, (char const**)grades + gradeCount, (char const**)letters, (char const**)letters + letterCount, str_equal);
+
+ CPPUNIT_ASSERT(location != grades + gradeCount);
+ CPPUNIT_ASSERT(location - grades == 1);
+
+}
diff --git a/test/unit/set_header_test.cpp b/test/unit/set_header_test.cpp
new file mode 100644
index 0000000..8335e13
--- /dev/null
+++ b/test/unit/set_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <set>
diff --git a/test/unit/set_test.cpp b/test/unit/set_test.cpp
new file mode 100644
index 0000000..9070b2f
--- /dev/null
+++ b/test/unit/set_test.cpp
@@ -0,0 +1,507 @@
+//Has to be first for StackAllocator swap overload to be taken
+//into account (at least using GCC 4.0.1)
+#include "stack_allocator.h"
+
+#include <set>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class SetTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(SetTest);
+ CPPUNIT_TEST(set1);
+ CPPUNIT_TEST(set2);
+ CPPUNIT_TEST(erase);
+ CPPUNIT_TEST(insert);
+ CPPUNIT_TEST(find);
+ CPPUNIT_TEST(bounds);
+ CPPUNIT_TEST(specialized_less);
+ CPPUNIT_TEST(implementation_check);
+ CPPUNIT_TEST(allocator_with_state);
+ CPPUNIT_TEST(reverse_iterator_test);
+#if !defined (STLPORT) || !defined (_STLP_USE_CONTAINERS_EXTENSION)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(template_methods);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void set1();
+ void set2();
+ void erase();
+ void insert();
+ void find();
+ void bounds();
+ void specialized_less();
+ void implementation_check();
+ void allocator_with_state();
+ void reverse_iterator_test();
+ void template_methods();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SetTest);
+
+
+//
+// tests implementation
+//
+void SetTest::set1()
+{
+ set<int, less<int> > s;
+ CPPUNIT_ASSERT (s.count(42) == 0);
+ s.insert(42);
+ CPPUNIT_ASSERT (s.count(42) == 1);
+ s.insert(42);
+ CPPUNIT_ASSERT (s.count(42) == 1);
+ size_t count = s.erase(42);
+ CPPUNIT_ASSERT (count == 1);
+}
+
+void SetTest::set2()
+{
+ typedef set<int, less<int> > int_set;
+ int_set s;
+ pair<int_set::iterator, bool> p = s.insert(42);
+ CPPUNIT_ASSERT (p.second == true);
+ p = s.insert(42);
+ CPPUNIT_ASSERT (p.second == false);
+
+ int array1 [] = { 1, 3, 6, 7 };
+ s.insert(array1, array1 + 4);
+ CPPUNIT_ASSERT (distance(s.begin(), s.end()) == 5);
+
+ int_set s2;
+ s2.swap(s);
+ CPPUNIT_ASSERT (distance(s2.begin(), s2.end()) == 5);
+ CPPUNIT_ASSERT (distance(s.begin(), s.end()) == 0);
+
+ int_set s3;
+ s3.swap(s);
+ s3.swap(s2);
+ CPPUNIT_ASSERT (distance(s.begin(), s.end()) == 0);
+ CPPUNIT_ASSERT (distance(s2.begin(), s2.end()) == 0);
+ CPPUNIT_ASSERT (distance(s3.begin(), s3.end()) == 5);
+}
+
+void SetTest::erase()
+{
+ set<int, less<int> > s;
+ s.insert(1);
+ s.erase(s.begin());
+ CPPUNIT_ASSERT( s.empty() );
+
+ size_t nb = s.erase(1);
+ CPPUNIT_ASSERT(nb == 0);
+}
+
+void SetTest::insert()
+{
+ set<int> s;
+ set<int>::iterator i = s.insert( s.end(), 0 );
+ CPPUNIT_ASSERT( *i == 0 );
+}
+
+void SetTest::find()
+{
+ set<int> s;
+
+ CPPUNIT_ASSERT( s.find(0) == s.end() );
+
+ set<int> const& crs = s;
+
+ CPPUNIT_ASSERT( crs.find(0) == crs.end() );
+}
+
+void SetTest::bounds()
+{
+ int array1 [] = { 1, 3, 6, 7 };
+ set<int> s(array1, array1 + sizeof(array1) / sizeof(array1[0]));
+ set<int> const& crs = s;
+
+ set<int>::iterator sit;
+ set<int>::const_iterator scit;
+ pair<set<int>::iterator, set<int>::iterator> pit;
+ pair<set<int>::const_iterator, set<int>::const_iterator> pcit;
+
+ //Check iterator on mutable set
+ sit = s.lower_bound(2);
+ CPPUNIT_ASSERT( sit != s.end() );
+ CPPUNIT_ASSERT( *sit == 3 );
+
+ sit = s.upper_bound(5);
+ CPPUNIT_ASSERT( sit != s.end() );
+ CPPUNIT_ASSERT( *sit == 6 );
+
+ pit = s.equal_range(6);
+ CPPUNIT_ASSERT( pit.first != pit.second );
+ CPPUNIT_ASSERT( pit.first != s.end() );
+ CPPUNIT_ASSERT( *pit.first == 6 );
+ CPPUNIT_ASSERT( pit.second != s.end() );
+ CPPUNIT_ASSERT( *pit.second == 7 );
+
+ pit = s.equal_range(4);
+ CPPUNIT_ASSERT( pit.first == pit.second );
+ CPPUNIT_ASSERT( pit.first != s.end() );
+ CPPUNIT_ASSERT( *pit.first == 6 );
+ CPPUNIT_ASSERT( pit.second != s.end() );
+ CPPUNIT_ASSERT( *pit.second == 6 );
+
+ //Check const_iterator on mutable set
+ scit = s.lower_bound(2);
+ CPPUNIT_ASSERT( scit != s.end() );
+ CPPUNIT_ASSERT( *scit == 3 );
+
+ scit = s.upper_bound(5);
+ CPPUNIT_ASSERT( scit != s.end() );
+ CPPUNIT_ASSERT( *scit == 6 );
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ pcit = s.equal_range(6);
+ CPPUNIT_ASSERT( pcit.first != pcit.second );
+ CPPUNIT_ASSERT( pcit.first != s.end() );
+ CPPUNIT_ASSERT( *pcit.first == 6 );
+ CPPUNIT_ASSERT( pcit.second != s.end() );
+ CPPUNIT_ASSERT( *pcit.second == 7 );
+#endif
+
+ //Check const_iterator on const set
+ scit = crs.lower_bound(2);
+ CPPUNIT_ASSERT( scit != crs.end() );
+ CPPUNIT_ASSERT( *scit == 3 );
+
+ scit = crs.upper_bound(5);
+ CPPUNIT_ASSERT( scit != crs.end() );
+ CPPUNIT_ASSERT( *scit == 6 );
+
+ pcit = crs.equal_range(6);
+ CPPUNIT_ASSERT( pcit.first != pcit.second );
+ CPPUNIT_ASSERT( pcit.first != crs.end() );
+ CPPUNIT_ASSERT( *pcit.first == 6 );
+ CPPUNIT_ASSERT( pcit.second != crs.end() );
+ CPPUNIT_ASSERT( *pcit.second == 7 );
+}
+
+
+class SetTestClass {
+public:
+ SetTestClass (int data) : _data(data)
+ {}
+
+ int data() const {
+ return _data;
+ }
+
+private:
+ int _data;
+};
+
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+namespace std {
+#endif
+#if defined (STLPORT)
+ _STLP_TEMPLATE_NULL
+#else
+ template <>
+#endif
+ struct less<SetTestClass> {
+ bool operator () (SetTestClass const& lhs, SetTestClass const& rhs) const {
+ return lhs.data() < rhs.data();
+ }
+ };
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+}
+#endif
+
+void SetTest::specialized_less()
+{
+ set<SetTestClass> s;
+ s.insert(SetTestClass(1));
+ s.insert(SetTestClass(3));
+ s.insert(SetTestClass(2));
+ s.insert(SetTestClass(0));
+
+ set<SetTestClass>::iterator sit(s.begin()), sitEnd(s.end());
+ int i = 0;
+ for (; sit != sitEnd; ++sit, ++i) {
+ CPPUNIT_ASSERT( sit->data() == i );
+ }
+}
+
+void SetTest::implementation_check()
+{
+ set<int> tree;
+ tree.insert(1);
+ set<int>::iterator it = tree.begin();
+ int const& int_ref = *it++;
+ CPPUNIT_ASSERT( int_ref == 1 );
+
+ CPPUNIT_ASSERT( it == tree.end() );
+ CPPUNIT_ASSERT( it != tree.begin() );
+
+ set<int>::const_iterator cit = tree.begin();
+ int const& int_cref = *cit++;
+ CPPUNIT_ASSERT( int_cref == 1 );
+}
+
+void SetTest::reverse_iterator_test()
+{
+ set<int> tree;
+ tree.insert(1);
+ tree.insert(2);
+
+ {
+ set<int>::reverse_iterator rit(tree.rbegin());
+ CPPUNIT_ASSERT( *(rit++) == 2 );
+ CPPUNIT_ASSERT( *(rit++) == 1 );
+ CPPUNIT_ASSERT( rit == tree.rend() );
+ }
+
+ {
+ set<int> const& ctree = tree;
+ set<int>::const_reverse_iterator rit(ctree.rbegin());
+ CPPUNIT_ASSERT( *(rit++) == 2 );
+ CPPUNIT_ASSERT( *(rit++) == 1 );
+ CPPUNIT_ASSERT( rit == ctree.rend() );
+ }
+}
+
+void SetTest::allocator_with_state()
+{
+ char buf1[1024];
+ StackAllocator<int> stack1(buf1, buf1 + sizeof(buf1));
+
+ char buf2[1024];
+ StackAllocator<int> stack2(buf2, buf2 + sizeof(buf2));
+
+ int i;
+ typedef set<int, less<int>, StackAllocator<int> > SetInt;
+ less<int> intLess;
+
+ {
+ SetInt sint1(intLess, stack1);
+ for (i = 0; i < 5; ++i)
+ sint1.insert(i);
+ SetInt sint1Cpy(sint1);
+
+ SetInt sint2(intLess, stack2);
+ for (; i < 10; ++i)
+ sint2.insert(i);
+ SetInt sint2Cpy(sint2);
+
+ sint1.swap(sint2);
+
+ CPPUNIT_ASSERT( sint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( sint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( sint1 == sint2Cpy );
+ CPPUNIT_ASSERT( sint2 == sint1Cpy );
+ CPPUNIT_ASSERT( sint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( sint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_ASSERT( stack1.ok() );
+ CPPUNIT_ASSERT( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ {
+ SetInt sint1(intLess, stack1);
+ SetInt sint1Cpy(sint1);
+
+ SetInt sint2(intLess, stack2);
+ for (i = 0; i < 10; ++i)
+ sint2.insert(i);
+ SetInt sint2Cpy(sint2);
+
+ sint1.swap(sint2);
+
+ CPPUNIT_ASSERT( sint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( sint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( sint1 == sint2Cpy );
+ CPPUNIT_ASSERT( sint2 == sint1Cpy );
+ CPPUNIT_ASSERT( sint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( sint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_ASSERT( stack1.ok() );
+ CPPUNIT_ASSERT( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ {
+ SetInt sint1(intLess, stack1);
+ for (i = 0; i < 10; ++i)
+ sint1.insert(i);
+ SetInt sint1Cpy(sint1);
+
+ SetInt sint2(intLess, stack2);
+ SetInt sint2Cpy(sint2);
+
+ sint1.swap(sint2);
+
+ CPPUNIT_ASSERT( sint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( sint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( sint1 == sint2Cpy );
+ CPPUNIT_ASSERT( sint2 == sint1Cpy );
+ CPPUNIT_ASSERT( sint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( sint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_ASSERT( stack1.ok() );
+ CPPUNIT_ASSERT( stack2.ok() );
+ stack1.reset(); stack2.reset();
+}
+
+struct Key
+{
+ Key() : m_data(0) {}
+ explicit Key(int data) : m_data(data) {}
+
+ int m_data;
+};
+
+struct KeyCmp
+{
+ bool operator () (Key lhs, Key rhs) const
+ { return lhs.m_data < rhs.m_data; }
+
+ bool operator () (Key lhs, int rhs) const
+ { return lhs.m_data < rhs; }
+
+ bool operator () (int lhs, Key rhs) const
+ { return lhs < rhs.m_data; }
+};
+
+struct KeyCmpPtr
+{
+ bool operator () (Key const volatile *lhs, Key const volatile *rhs) const
+ { return (*lhs).m_data < (*rhs).m_data; }
+
+ bool operator () (Key const volatile *lhs, int rhs) const
+ { return (*lhs).m_data < rhs; }
+
+ bool operator () (int lhs, Key const volatile *rhs) const
+ { return lhs < (*rhs).m_data; }
+};
+
+void SetTest::template_methods()
+{
+#if defined (STLPORT) && defined (_STLP_USE_CONTAINERS_EXTENSION)
+ {
+ typedef set<Key, KeyCmp> KeySet;
+ KeySet keySet;
+ keySet.insert(Key(1));
+ keySet.insert(Key(2));
+ keySet.insert(Key(3));
+ keySet.insert(Key(4));
+
+ CPPUNIT_ASSERT( keySet.count(Key(1)) == 1 );
+ CPPUNIT_ASSERT( keySet.count(1) == 1 );
+ CPPUNIT_ASSERT( keySet.count(5) == 0 );
+
+ CPPUNIT_ASSERT( keySet.find(2) != keySet.end() );
+ CPPUNIT_ASSERT( keySet.lower_bound(2) != keySet.end() );
+ CPPUNIT_ASSERT( keySet.upper_bound(2) != keySet.end() );
+ CPPUNIT_ASSERT( keySet.equal_range(2) != make_pair(keySet.begin(), keySet.end()) );
+
+ KeySet const& ckeySet = keySet;
+ CPPUNIT_ASSERT( ckeySet.find(2) != ckeySet.end() );
+ CPPUNIT_ASSERT( ckeySet.lower_bound(2) != ckeySet.end() );
+ CPPUNIT_ASSERT( ckeySet.upper_bound(2) != ckeySet.end() );
+ CPPUNIT_ASSERT( ckeySet.equal_range(2) != make_pair(ckeySet.begin(), ckeySet.end()) );
+ }
+
+ {
+ typedef set<Key*, KeyCmpPtr> KeySet;
+ KeySet keySet;
+ Key key1(1), key2(2), key3(3), key4(4);
+ keySet.insert(&key1);
+ keySet.insert(&key2);
+ keySet.insert(&key3);
+ keySet.insert(&key4);
+
+ CPPUNIT_ASSERT( keySet.count(1) == 1 );
+ CPPUNIT_ASSERT( keySet.count(5) == 0 );
+
+ CPPUNIT_ASSERT( keySet.find(2) != keySet.end() );
+ CPPUNIT_ASSERT( keySet.lower_bound(2) != keySet.end() );
+ CPPUNIT_ASSERT( keySet.upper_bound(2) != keySet.end() );
+ CPPUNIT_ASSERT( keySet.equal_range(2) != make_pair(keySet.begin(), keySet.end()) );
+
+ KeySet const& ckeySet = keySet;
+ CPPUNIT_ASSERT( ckeySet.find(2) != ckeySet.end() );
+ CPPUNIT_ASSERT( ckeySet.lower_bound(2) != ckeySet.end() );
+ CPPUNIT_ASSERT( ckeySet.upper_bound(2) != ckeySet.end() );
+ CPPUNIT_ASSERT( ckeySet.equal_range(2) != make_pair(ckeySet.begin(), ckeySet.end()) );
+ }
+ {
+ typedef multiset<Key, KeyCmp> KeySet;
+ KeySet keySet;
+ keySet.insert(Key(1));
+ keySet.insert(Key(2));
+ keySet.insert(Key(3));
+ keySet.insert(Key(4));
+
+ CPPUNIT_ASSERT( keySet.count(Key(1)) == 1 );
+ CPPUNIT_ASSERT( keySet.count(1) == 1 );
+ CPPUNIT_ASSERT( keySet.count(5) == 0 );
+
+ CPPUNIT_ASSERT( keySet.find(2) != keySet.end() );
+ CPPUNIT_ASSERT( keySet.lower_bound(2) != keySet.end() );
+ CPPUNIT_ASSERT( keySet.upper_bound(2) != keySet.end() );
+ CPPUNIT_ASSERT( keySet.equal_range(2) != make_pair(keySet.begin(), keySet.end()) );
+
+ KeySet const& ckeySet = keySet;
+ CPPUNIT_ASSERT( ckeySet.find(2) != ckeySet.end() );
+ CPPUNIT_ASSERT( ckeySet.lower_bound(2) != ckeySet.end() );
+ CPPUNIT_ASSERT( ckeySet.upper_bound(2) != ckeySet.end() );
+ CPPUNIT_ASSERT( ckeySet.equal_range(2) != make_pair(ckeySet.begin(), ckeySet.end()) );
+ }
+
+ {
+ typedef multiset<Key const volatile*, KeyCmpPtr> KeySet;
+ KeySet keySet;
+ Key key1(1), key2(2), key3(3), key4(4);
+ keySet.insert(&key1);
+ keySet.insert(&key2);
+ keySet.insert(&key3);
+ keySet.insert(&key4);
+
+ CPPUNIT_ASSERT( keySet.count(1) == 1 );
+ CPPUNIT_ASSERT( keySet.count(5) == 0 );
+
+ CPPUNIT_ASSERT( keySet.find(2) != keySet.end() );
+ CPPUNIT_ASSERT( keySet.lower_bound(2) != keySet.end() );
+ CPPUNIT_ASSERT( keySet.upper_bound(2) != keySet.end() );
+ CPPUNIT_ASSERT( keySet.equal_range(2) != make_pair(keySet.begin(), keySet.end()) );
+
+ KeySet const& ckeySet = keySet;
+ CPPUNIT_ASSERT( ckeySet.find(2) != ckeySet.end() );
+ CPPUNIT_ASSERT( ckeySet.lower_bound(2) != ckeySet.end() );
+ CPPUNIT_ASSERT( ckeySet.upper_bound(2) != ckeySet.end() );
+ CPPUNIT_ASSERT( ckeySet.equal_range(2) != make_pair(ckeySet.begin(), ckeySet.end()) );
+ }
+#endif
+}
+
+#if !defined (STLPORT) || \
+ !defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+# if !defined (__DMC__)
+/* Simple compilation test: Check that nested types like iterator
+ * can be access even if type used to instanciate container is not
+ * yet completely defined.
+ */
+class IncompleteClass
+{
+ set<IncompleteClass> instances;
+ typedef set<IncompleteClass>::iterator it;
+ multiset<IncompleteClass> minstances;
+ typedef multiset<IncompleteClass>::iterator mit;
+};
+# endif
+#endif
diff --git a/test/unit/setdiff_test.cpp b/test/unit/setdiff_test.cpp
new file mode 100644
index 0000000..8fa2dda
--- /dev/null
+++ b/test/unit/setdiff_test.cpp
@@ -0,0 +1,134 @@
+#include <numeric>
+#include <string>
+#include <iterator>
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "iota.h"
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class SetDifferenceTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(SetDifferenceTest);
+ CPPUNIT_TEST(setdiff0);
+ CPPUNIT_TEST(setdiff1);
+ CPPUNIT_TEST(setdiff2);
+ CPPUNIT_TEST(setsymd0);
+ CPPUNIT_TEST(setsymd1);
+ CPPUNIT_TEST(setsymd2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void setdiff0();
+ void setdiff1();
+ void setdiff2();
+ void setsymd0();
+ void setsymd1();
+ void setsymd2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SetDifferenceTest);
+
+//
+// tests implementation
+//
+void SetDifferenceTest::setsymd0()
+{
+ int v1[3] = { 13, 18, 23 };
+ int v2[4] = { 10, 13, 17, 23 };
+ int result[4] = { 0, 0, 0, 0 };
+
+ set_symmetric_difference((int*)v1, (int*)v1 + 3, (int*)v2, (int*)v2 + 4, (int*)result);
+ CPPUNIT_ASSERT(result[0]==10);
+ CPPUNIT_ASSERT(result[1]==17);
+ CPPUNIT_ASSERT(result[2]==18);
+ CPPUNIT_ASSERT(result[3]==0);
+}
+
+void SetDifferenceTest::setsymd1()
+{
+ vector<int> v1(10);
+ __iota(v1.begin(), v1.end(), 0);
+ vector<int> v2(10);
+ __iota(v2.begin(), v2.end(), 7);
+
+ vector<int> diff;
+ set_symmetric_difference(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(diff));
+ CPPUNIT_ASSERT( diff.size() == 14 );
+ int int_res[] = {0, 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16};
+ for (int i = 0; i < 14; ++i) {
+ CPPUNIT_ASSERT( diff[i] == int_res[i] );
+ }
+}
+
+void SetDifferenceTest::setsymd2()
+{
+ const char* word1 = "ABCDEFGHIJKLMNO";
+ const char* word2 = "LMNOPQRSTUVWXYZ";
+
+ string diff;
+ set_symmetric_difference(word1, word1 + ::strlen(word1), word2, word2 + ::strlen(word2),
+ back_inserter(diff), less<char>());
+ CPPUNIT_ASSERT( diff.size() == 22 );
+ char char_res[] = "ABCDEFGHIJKPQRSTUVWXYZ";
+ for (int i = 0; i < 22; ++i) {
+ CPPUNIT_ASSERT( diff[i] == char_res[i] );
+ }
+}
+
+void SetDifferenceTest::setdiff0()
+{
+ int v1[3] = { 13, 18, 23 };
+ int v2[4] = { 10, 13, 17, 23 };
+ int result[4] = { 0, 0, 0, 0 };
+ //18 0 0 0
+ //10 17 23 0
+
+ set_difference((int*)v1, (int*)v1 + 3, (int*)v2, (int*)v2 + 4, (int*)result);
+ CPPUNIT_ASSERT( result[0] == 18 );
+ CPPUNIT_ASSERT( result[1] == 0 );
+ CPPUNIT_ASSERT( result[2] == 0 );
+ CPPUNIT_ASSERT( result[3] == 0 );
+
+ set_difference((int*)v2, (int*)v2 + 4, (int*)v1, (int*)v1 + 2, (int*)result);
+ CPPUNIT_ASSERT( result[0] == 10 );
+ CPPUNIT_ASSERT( result[1] == 17 );
+ CPPUNIT_ASSERT( result[2] == 23 );
+ CPPUNIT_ASSERT( result[3] == 0 );
+}
+
+void SetDifferenceTest::setdiff1()
+{
+ vector<int> v1(10);
+ __iota(v1.begin(), v1.end(), 0);
+ vector<int> v2(10);
+ __iota(v2.begin(), v2.end(), 7);
+
+ vector<int> diff;
+ set_difference(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(diff));
+ CPPUNIT_ASSERT( diff.size() == 7 );
+ for (int i = 0; i < 7; ++i) {
+ CPPUNIT_ASSERT( diff[i] == i );
+ }
+}
+
+void SetDifferenceTest::setdiff2()
+{
+ const char* word1 = "ABCDEFGHIJKLMNO";
+ const char* word2 = "LMNOPQRSTUVWXYZ";
+
+ string diff;
+ set_difference(word1, word1 + ::strlen(word1), word2, word2 + ::strlen(word2), back_inserter(diff), less<char>());
+ CPPUNIT_ASSERT( diff.size() == 11 );
+ for (int i = 0; i < 11; ++i) {
+ CPPUNIT_ASSERT( diff[i] == ('A' + i) );
+ }
+}
diff --git a/test/unit/setinter_test.cpp b/test/unit/setinter_test.cpp
new file mode 100644
index 0000000..ffcfd78
--- /dev/null
+++ b/test/unit/setinter_test.cpp
@@ -0,0 +1,79 @@
+#include <numeric>
+#include <string>
+#include <iterator>
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "iota.h"
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class SetIntersectionTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(SetIntersectionTest);
+ CPPUNIT_TEST(setintr0);
+ CPPUNIT_TEST(setintr1);
+ CPPUNIT_TEST(setintr2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void setintr0();
+ void setintr1();
+ void setintr2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SetIntersectionTest);
+
+//
+// tests implementation
+//
+void SetIntersectionTest::setintr0()
+{
+ int v1[3] = { 13, 18, 23 };
+ int v2[4] = { 10, 13, 17, 23 };
+ int result[4] = { 0, 0, 0, 0 };
+
+ set_intersection((int*)v1, (int*)v1 + 3, (int*)v2, (int*)v2 + 4, (int*)result);
+
+ CPPUNIT_ASSERT(result[0]==13);
+ CPPUNIT_ASSERT(result[1]==23);
+ CPPUNIT_ASSERT(result[2]==0);
+ CPPUNIT_ASSERT(result[3]==0);
+}
+
+void SetIntersectionTest::setintr1()
+{
+ vector <int> v1(10);
+ __iota(v1.begin(), v1.end(), 0);
+ vector <int> v2(10);
+ __iota(v2.begin(), v2.end(), 7);
+
+ vector<int> inter;
+ set_intersection(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(inter));
+ CPPUNIT_ASSERT( inter.size() == 3 );
+ CPPUNIT_ASSERT( inter[0] == 7 );
+ CPPUNIT_ASSERT( inter[1] == 8 );
+ CPPUNIT_ASSERT( inter[2] == 9 );
+}
+
+void SetIntersectionTest::setintr2()
+{
+ const char* word1 = "ABCDEFGHIJKLMNO";
+ const char* word2 = "LMNOPQRSTUVWXYZ";
+
+ string inter;
+ set_intersection(word1, word1 + ::strlen(word1), word2, word2 + ::strlen(word2),
+ back_inserter(inter), less<char>());
+ CPPUNIT_ASSERT( inter.size() == 4 );
+ CPPUNIT_ASSERT( inter[0] == 'L' );
+ CPPUNIT_ASSERT( inter[1] == 'M' );
+ CPPUNIT_ASSERT( inter[2] == 'N' );
+ CPPUNIT_ASSERT( inter[3] == 'O' );
+}
diff --git a/test/unit/setjmp_header_test.c b/test/unit/setjmp_header_test.c
new file mode 100644
index 0000000..9496289
--- /dev/null
+++ b/test/unit/setjmp_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <setjmp.h>
diff --git a/test/unit/setjmp_header_test2.cpp b/test/unit/setjmp_header_test2.cpp
new file mode 100644
index 0000000..00e4e4a
--- /dev/null
+++ b/test/unit/setjmp_header_test2.cpp
@@ -0,0 +1,15 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+
+/*
+ * Sometimes, if native setjmp.h was included first, the setjmp functions
+ * situated in global namespace, not in vendor's std. This may confuse
+ * following csetjmp
+ */
+#include <setjmp.h>
+#include <csetjmp>
diff --git a/test/unit/setunion_test.cpp b/test/unit/setunion_test.cpp
new file mode 100644
index 0000000..577953e
--- /dev/null
+++ b/test/unit/setunion_test.cpp
@@ -0,0 +1,81 @@
+#include <numeric>
+#include <string>
+#include <iterator>
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include "iota.h"
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class SetUnionTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(SetUnionTest);
+ CPPUNIT_TEST(setunon0);
+ CPPUNIT_TEST(setunon1);
+ CPPUNIT_TEST(setunon2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void setunon0();
+ void setunon1();
+ void setunon2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SetUnionTest);
+
+//
+// tests implementation
+//
+void SetUnionTest::setunon0()
+{
+ int v1[3] = { 13, 18, 23 };
+ int v2[4] = { 10, 13, 17, 23 };
+ int result[7] = { 0, 0, 0, 0, 0, 0, 0 };
+
+ set_union((int*)v1, (int*)v1 + 3, (int*)v2, (int*)v2 + 4, (int*)result);
+
+ CPPUNIT_ASSERT(result[0]==10);
+ CPPUNIT_ASSERT(result[1]==13);
+ CPPUNIT_ASSERT(result[2]==17);
+ CPPUNIT_ASSERT(result[3]==18);
+ CPPUNIT_ASSERT(result[4]==23);
+ CPPUNIT_ASSERT(result[5]==0);
+ CPPUNIT_ASSERT(result[6]==0);
+}
+
+void SetUnionTest::setunon1()
+{
+ vector <int> v1(10);
+ __iota(v1.begin(), v1.end(), 0);
+ vector <int> v2(10);
+ __iota(v2.begin(), v2.end(), 7);
+
+ vector<int> diff;
+ set_union(v1.begin(), v1.end(), v2.begin(), v2.end(), back_inserter(diff));
+ CPPUNIT_ASSERT( diff.size() == 17 );
+ for (int i = 0; i < 17; ++i) {
+ CPPUNIT_ASSERT( diff[i] == i );
+ }
+}
+
+void SetUnionTest::setunon2()
+{
+ const char* word1 = "ABCDEFGHIJKLMNO";
+ const char* word2 = "LMNOPQRSTUVWXYZ";
+
+ string diff;
+ set_union(word1, word1 + ::strlen(word1), word2, word2 + ::strlen(word2),
+ back_inserter(diff), less<char>());
+ CPPUNIT_ASSERT( diff.size() == 26 );
+ for (int i = 0; i < 26; ++i) {
+ CPPUNIT_ASSERT( diff[i] == ('A' + i) );
+ }
+}
diff --git a/test/unit/shared_ptr_test.cpp b/test/unit/shared_ptr_test.cpp
new file mode 100644
index 0000000..a5393de
--- /dev/null
+++ b/test/unit/shared_ptr_test.cpp
@@ -0,0 +1,41 @@
+#include <memory>
+
+#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
+
+// #include <typeinfo>
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+class SharedPtrTest :
+ public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(SharedPtrTest);
+ CPPUNIT_TEST(shared_from_this);
+ CPPUNIT_TEST_SUITE_END();
+
+ protected:
+ void shared_from_this();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SharedPtrTest);
+
+struct X;
+
+struct X :
+ public std::tr1::enable_shared_from_this<X>
+{
+};
+
+void SharedPtrTest::shared_from_this()
+{
+ std::tr1::shared_ptr<X> p( new X );
+ std::tr1::shared_ptr<X> q = p->shared_from_this();
+
+ CPPUNIT_CHECK( p == q );
+ CPPUNIT_CHECK( !(p < q) && !(q < p) ); // p and q share ownership
+}
+
+#endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */
diff --git a/test/unit/signal_header_test.c b/test/unit/signal_header_test.c
new file mode 100644
index 0000000..e179eb2
--- /dev/null
+++ b/test/unit/signal_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <signal.h>
diff --git a/test/unit/slist_test.cpp b/test/unit/slist_test.cpp
new file mode 100644
index 0000000..383ece2
--- /dev/null
+++ b/test/unit/slist_test.cpp
@@ -0,0 +1,554 @@
+//Has to be first for StackAllocator swap overload to be taken
+//into account (at least using GCC 4.0.1)
+#include "stack_allocator.h"
+
+#include <algorithm>
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+# include <slist>
+# if !defined (_STLP_USE_NO_IOSTREAMS)
+# include <sstream>
+# endif
+# include <iterator>
+# include <functional>
+#endif
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+#if !defined (STLPORT) && defined(__GNUC__)
+using namespace __gnu_cxx;
+#endif
+
+//
+// TestCase class
+//
+class SlistTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(SlistTest);
+#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) || defined (_STLP_USE_NO_IOSTREAMS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(slist1);
+#if defined (STLPORT) && defined (_STLP_USE_NO_IOSTREAMS)
+ CPPUNIT_STOP_IGNORE;
+#endif
+ CPPUNIT_TEST(erase);
+ CPPUNIT_TEST(insert);
+ CPPUNIT_TEST(splice);
+ CPPUNIT_TEST(allocator_with_state);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void slist1();
+ void erase();
+ void insert();
+ void splice();
+ void allocator_with_state();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SlistTest);
+
+//
+// tests implementation
+//
+void SlistTest::slist1()
+{
+#if defined (STLPORT) && !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_NO_EXTENSIONS)
+/*
+original: xlxtss
+reversed: sstxlx
+removed: sstl
+uniqued: stl
+sorted: lst
+*/
+
+ char array [] = { 'x', 'l', 'x', 't', 's', 's' };
+ ostringstream os;
+ ostream_iterator<char> o(os,"");
+ slist<char> str(array+0, array + 6);
+ slist<char>::iterator i;
+ //Check const_iterator construction from iterator
+ slist<char>::const_iterator ci(i);
+ slist<char>::const_iterator ci2(ci);
+// cout << "reversed: ";
+ str.reverse();
+ for(i = str.begin(); i != str.end(); i++)
+ os << *i;
+ stringbuf* buff=os.rdbuf();
+ string result=buff->str();
+ CPPUNIT_ASSERT(!strcmp(result.c_str(),"sstxlx"));
+
+ //cout << "removed: ";
+ str.remove('x');
+ ostringstream os2;
+ for(i = str.begin(); i != str.end(); i++)
+ os2 << *i;
+ buff=os2.rdbuf();
+ result=buff->str();
+ CPPUNIT_ASSERT(!strcmp(result.c_str(),"sstl"));
+
+
+ //cout << "uniqued: ";
+ str.unique();
+ ostringstream os3;
+ for(i = str.begin(); i != str.end(); i++)
+ os3 << *i;
+ buff=os3.rdbuf();
+ result=buff->str();
+ CPPUNIT_ASSERT(!strcmp(result.c_str(),"stl"));
+
+ //cout << "sorted: ";
+ str.sort();
+ ostringstream os4;
+ for(i = str.begin(); i != str.end(); i++)
+ os4 << *i;
+ buff = os4.rdbuf();
+ result = buff->str();
+ CPPUNIT_ASSERT(!strcmp(result.c_str(),"lst"));
+
+ //A small compilation time check to be activated from time to time:
+# if 0
+ {
+ slist<char>::iterator sl_char_ite;
+ slist<int>::iterator sl_int_ite;
+ CPPUNIT_ASSERT( sl_char_ite != sl_int_ite );
+ }
+# endif
+#endif
+}
+
+void SlistTest::erase()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ int array[] = { 0, 1, 2, 3, 4 };
+ slist<int> sl(array, array + 5);
+ slist<int>::iterator slit;
+
+ slit = sl.erase(sl.begin());
+ CPPUNIT_ASSERT( *slit == 1);
+
+ ++slit++; ++slit;
+ slit = sl.erase(sl.begin(), slit);
+ CPPUNIT_ASSERT( *slit == 3 );
+
+ sl.assign(array, array + 5);
+
+ slit = sl.erase_after(sl.begin());
+ CPPUNIT_ASSERT( *slit == 2 );
+
+ slit = sl.begin(); ++slit; ++slit;
+ slit = sl.erase_after(sl.begin(), slit);
+ CPPUNIT_ASSERT( *slit == 3 );
+
+ sl.erase_after(sl.before_begin());
+ CPPUNIT_ASSERT( sl.front() == 3 );
+#endif
+}
+
+void SlistTest::insert()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ int array[] = { 0, 1, 2, 3, 4 };
+
+ //insert
+ {
+ slist<int> sl;
+
+ sl.insert(sl.begin(), 5);
+ CPPUNIT_ASSERT( sl.front() == 5 );
+ CPPUNIT_ASSERT( sl.size() == 1 );
+
+ //debug mode check:
+ //sl.insert(sl.before_begin(), array, array + 5);
+
+ sl.insert(sl.begin(), array, array + 5);
+ CPPUNIT_ASSERT( sl.size() == 6 );
+ int i;
+ slist<int>::iterator slit(sl.begin());
+ for (i = 0; slit != sl.end(); ++slit, ++i) {
+ CPPUNIT_ASSERT( *slit == i );
+ }
+ }
+
+ //insert_after
+ {
+ slist<int> sl;
+
+ //debug check:
+ //sl.insert_after(sl.begin(), 5);
+
+ sl.insert_after(sl.before_begin(), 5);
+ CPPUNIT_ASSERT( sl.front() == 5 );
+ CPPUNIT_ASSERT( sl.size() == 1 );
+
+ sl.insert_after(sl.before_begin(), array, array + 5);
+ CPPUNIT_ASSERT( sl.size() == 6 );
+ int i;
+ slist<int>::iterator slit(sl.begin());
+ for (i = 0; slit != sl.end(); ++slit, ++i) {
+ CPPUNIT_ASSERT( *slit == i );
+ }
+ }
+#endif
+}
+
+void SlistTest::splice()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ int array[] = { 0, 1, 2, 3, 4 };
+
+ //splice
+ {
+ slist<int> sl1(array, array + 5);
+ slist<int> sl2(array, array + 5);
+ slist<int>::iterator slit;
+
+ //a no op:
+ sl1.splice(sl1.begin(), sl1, sl1.begin());
+ CPPUNIT_ASSERT( sl1 == sl2 );
+
+ slit = sl1.begin(); ++slit;
+ //a no op:
+ sl1.splice(slit, sl1, sl1.begin());
+ CPPUNIT_ASSERT( sl1 == sl2 );
+
+ sl1.splice(sl1.end(), sl1, sl1.begin());
+ slit = sl1.begin();
+ CPPUNIT_ASSERT( *(slit++) == 1 );
+ CPPUNIT_ASSERT( *(slit++) == 2 );
+ CPPUNIT_ASSERT( *(slit++) == 3 );
+ CPPUNIT_ASSERT( *(slit++) == 4 );
+ CPPUNIT_ASSERT( *slit == 0 );
+ sl1.splice(sl1.begin(), sl1, slit);
+ CPPUNIT_ASSERT( sl1 == sl2 );
+
+ sl1.splice(sl1.begin(), sl2);
+ size_t i;
+ for (i = 0, slit = sl1.begin(); slit != sl1.end(); ++slit, ++i) {
+ if (i == 5) i = 0;
+ CPPUNIT_ASSERT( *slit == array[i] );
+ }
+
+ slit = sl1.begin();
+ advance(slit, 5);
+ CPPUNIT_ASSERT( *slit == 0 );
+ sl2.splice(sl2.begin(), sl1, sl1.begin(), slit);
+ CPPUNIT_ASSERT( sl1 == sl2 );
+
+ slit = sl1.begin(); ++slit;
+ sl1.splice(sl1.begin(), sl1, slit, sl1.end());
+ slit = sl1.begin();
+ CPPUNIT_ASSERT( *(slit++) == 1 );
+ CPPUNIT_ASSERT( *(slit++) == 2 );
+ CPPUNIT_ASSERT( *(slit++) == 3 );
+ CPPUNIT_ASSERT( *(slit++) == 4 );
+ CPPUNIT_ASSERT( *slit == 0 );
+
+ // a no op
+ sl2.splice(sl2.end(), sl2, sl2.begin(), sl2.end());
+ for (i = 0, slit = sl2.begin(); slit != sl2.end(); ++slit, ++i) {
+ CPPUNIT_ASSERT( i < 5 );
+ CPPUNIT_ASSERT( *slit == array[i] );
+ }
+
+ slit = sl2.begin();
+ advance(slit, 3);
+ sl2.splice(sl2.end(), sl2, sl2.begin(), slit);
+ slit = sl2.begin();
+ CPPUNIT_ASSERT( *(slit++) == 3 );
+ CPPUNIT_ASSERT( *(slit++) == 4 );
+ CPPUNIT_ASSERT( *(slit++) == 0 );
+ CPPUNIT_ASSERT( *(slit++) == 1 );
+ CPPUNIT_ASSERT( *slit == 2 );
+ }
+
+ //splice_after
+ {
+ slist<int> sl1(array, array + 5);
+ slist<int> sl2(array, array + 5);
+ slist<int>::iterator slit;
+
+ //a no op:
+ sl1.splice_after(sl1.begin(), sl1, sl1.begin());
+ CPPUNIT_ASSERT( sl1 == sl2 );
+
+ sl1.splice_after(sl1.before_begin(), sl1, sl1.begin());
+ slit = sl1.begin();
+ CPPUNIT_ASSERT( *(slit++) == 1 );
+ CPPUNIT_ASSERT( *(slit++) == 0 );
+ CPPUNIT_ASSERT( *(slit++) == 2 );
+ CPPUNIT_ASSERT( *(slit++) == 3 );
+ CPPUNIT_ASSERT( *slit == 4 );
+ sl1.splice_after(sl1.before_begin(), sl1, sl1.begin());
+ CPPUNIT_ASSERT( sl1 == sl2 );
+
+ sl1.splice_after(sl1.before_begin(), sl2);
+ size_t i;
+ for (i = 0, slit = sl1.begin(); slit != sl1.end(); ++slit, ++i) {
+ if (i == 5) i = 0;
+ CPPUNIT_ASSERT( *slit == array[i] );
+ }
+
+ slit = sl1.begin();
+ advance(slit, 4);
+ CPPUNIT_ASSERT( *slit == 4 );
+ sl2.splice_after(sl2.before_begin(), sl1, sl1.before_begin(), slit);
+ CPPUNIT_ASSERT( sl1 == sl2 );
+
+ sl1.splice_after(sl1.before_begin(), sl1, sl1.begin(), sl1.previous(sl1.end()));
+ slit = sl1.begin();
+ CPPUNIT_ASSERT( *(slit++) == 1 );
+ CPPUNIT_ASSERT( *(slit++) == 2 );
+ CPPUNIT_ASSERT( *(slit++) == 3 );
+ CPPUNIT_ASSERT( *(slit++) == 4 );
+ CPPUNIT_ASSERT( *slit == 0 );
+
+ // a no op
+ sl2.splice_after(sl2.before_begin(), sl2, sl2.before_begin(), sl2.previous(sl2.end()));
+ for (i = 0, slit = sl2.begin(); slit != sl2.end(); ++slit, ++i) {
+ CPPUNIT_ASSERT( i < 5 );
+ CPPUNIT_ASSERT( *slit == array[i] );
+ }
+
+ slit = sl2.begin();
+ advance(slit, 2);
+ sl2.splice_after(sl2.previous(sl2.end()), sl2, sl2.before_begin(), slit);
+ slit = sl2.begin();
+ CPPUNIT_ASSERT( *(slit++) == 3 );
+ CPPUNIT_ASSERT( *(slit++) == 4 );
+ CPPUNIT_ASSERT( *(slit++) == 0 );
+ CPPUNIT_ASSERT( *(slit++) == 1 );
+ CPPUNIT_ASSERT( *slit == 2 );
+ }
+#endif
+}
+
+
+void SlistTest::allocator_with_state()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ char buf1[1024];
+ StackAllocator<int> stack1(buf1, buf1 + sizeof(buf1));
+
+ char buf2[1024];
+ StackAllocator<int> stack2(buf2, buf2 + sizeof(buf2));
+
+ typedef slist<int, StackAllocator<int> > SlistInt;
+ {
+ SlistInt slint1(10, 0, stack1);
+ SlistInt slint1Cpy(slint1);
+
+ SlistInt slint2(10, 1, stack2);
+ SlistInt slint2Cpy(slint2);
+
+ slint1.swap(slint2);
+
+ CPPUNIT_ASSERT( slint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( slint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( slint1 == slint2Cpy );
+ CPPUNIT_ASSERT( slint2 == slint1Cpy );
+ CPPUNIT_ASSERT( slint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( slint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ {
+ SlistInt slint1(stack1);
+ SlistInt slint1Cpy(slint1);
+
+ SlistInt slint2(10, 1, stack2);
+ SlistInt slint2Cpy(slint2);
+
+ slint1.swap(slint2);
+
+ CPPUNIT_ASSERT( slint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( slint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( slint1 == slint2Cpy );
+ CPPUNIT_ASSERT( slint2 == slint1Cpy );
+ CPPUNIT_ASSERT( slint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( slint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ {
+ SlistInt slint1(10, 0, stack1);
+ SlistInt slint1Cpy(slint1);
+
+ SlistInt slint2(stack2);
+ SlistInt slint2Cpy(slint2);
+
+ slint1.swap(slint2);
+
+ CPPUNIT_ASSERT( slint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( slint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( slint1 == slint2Cpy );
+ CPPUNIT_ASSERT( slint2 == slint1Cpy );
+ CPPUNIT_ASSERT( slint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( slint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ //splice(iterator, slist)
+ {
+ SlistInt slint1(10, 0, stack1);
+ SlistInt slint2(10, 1, stack2);
+
+ slint1.splice(slint1.begin(), slint2);
+ CPPUNIT_ASSERT( slint1.size() == 20 );
+ CPPUNIT_ASSERT( slint2.empty() );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ //splice(iterator, slist, iterator)
+ {
+ SlistInt slint1(10, 0, stack1);
+ SlistInt slint2(10, 1, stack2);
+
+ slint1.splice(slint1.begin(), slint2, slint2.begin());
+ CPPUNIT_ASSERT( slint1.size() == 11 );
+ CPPUNIT_ASSERT( slint2.size() == 9 );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ //splice(iterator, slist, iterator, iterator)
+ {
+ SlistInt slint1(10, 0, stack1);
+ SlistInt slint2(10, 1, stack2);
+
+ SlistInt::iterator lit(slint2.begin());
+ advance(lit, 5);
+ slint1.splice(slint1.begin(), slint2, slint2.begin(), lit);
+ CPPUNIT_ASSERT( slint1.size() == 15 );
+ CPPUNIT_ASSERT( slint2.size() == 5 );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ //splice_after(iterator, slist)
+ {
+ SlistInt slint1(10, 0, stack1);
+ SlistInt slint2(10, 1, stack2);
+
+ slint1.splice_after(slint1.before_begin(), slint2);
+ CPPUNIT_ASSERT( slint1.size() == 20 );
+ CPPUNIT_ASSERT( slint2.empty() );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ //splice_after(iterator, slist, iterator)
+ {
+ SlistInt slint1(10, 0, stack1);
+ SlistInt slint2(10, 1, stack2);
+
+ slint1.splice_after(slint1.before_begin(), slint2, slint2.before_begin());
+ CPPUNIT_ASSERT( slint1.size() == 11 );
+ CPPUNIT_ASSERT( slint2.size() == 9 );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ //splice_after(iterator, slist, iterator, iterator)
+ {
+ SlistInt slint1(10, 0, stack1);
+ SlistInt slint2(10, 1, stack2);
+
+ SlistInt::iterator lit(slint2.begin());
+ advance(lit, 4);
+ slint1.splice_after(slint1.before_begin(), slint2, slint2.before_begin(), lit);
+ CPPUNIT_ASSERT( slint1.size() == 15 );
+ CPPUNIT_ASSERT( slint2.size() == 5 );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ //merge(slist)
+ {
+ SlistInt slint1(10, 0, stack1);
+ SlistInt slint2(10, 1, stack2);
+
+ SlistInt slintref(stack2);
+ slintref.insert_after(slintref.before_begin(), 10, 1);
+ slintref.insert_after(slintref.before_begin(), 10, 0);
+
+ slint1.merge(slint2);
+ CPPUNIT_ASSERT( slint1.size() == 20 );
+ CPPUNIT_ASSERT( slint1 == slintref );
+ CPPUNIT_ASSERT( slint2.empty() );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+
+ //merge(slist, predicate)
+# if (!defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES)) && \
+ (!defined (_MSC_VER) || (_MSC_VER >= 1300))
+ {
+ SlistInt slint1(10, 0, stack1);
+ SlistInt slint2(10, 1, stack2);
+
+ SlistInt slintref(stack2);
+ slintref.insert_after(slintref.before_begin(), 10, 0);
+ slintref.insert_after(slintref.before_begin(), 10, 1);
+
+ slint1.merge(slint2, greater<int>());
+ CPPUNIT_ASSERT( slint1.size() == 20 );
+ CPPUNIT_ASSERT( slint1 == slintref );
+ CPPUNIT_ASSERT( slint2.empty() );
+ }
+ CPPUNIT_CHECK( stack1.ok() );
+ CPPUNIT_CHECK( stack2.ok() );
+
+ //sort
+ {
+ //This is rather a compile time test.
+ //We check that sort implementation is correct when list is instanciated
+ //with an allocator that do not have a default constructor.
+ SlistInt slint1(stack1);
+ slint1.push_front(1);
+ slint1.insert_after(slint1.before_begin(), 10, 0);
+ greater<int> gt;
+ slint1.sort(gt);
+ CPPUNIT_ASSERT( slint1.front() == 1 );
+ slint1.sort();
+ SlistInt::iterator slit(slint1.begin());
+ advance(slit, 10);
+ CPPUNIT_ASSERT( *slit == 1 );
+ }
+# endif
+#endif
+}
+
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS) && \
+ (!defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION))
+# if !defined (__DMC__)
+/* Simple compilation test: Check that nested types like iterator
+ * can be access even if type used to instanciate container is not
+ * yet completely defined.
+ */
+class IncompleteClass
+{
+ slist<IncompleteClass> instances;
+ typedef slist<IncompleteClass>::iterator it;
+};
+# endif
+#endif
diff --git a/test/unit/sort_test.cpp b/test/unit/sort_test.cpp
new file mode 100644
index 0000000..49bc946
--- /dev/null
+++ b/test/unit/sort_test.cpp
@@ -0,0 +1,217 @@
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#if defined (STLPORT) && defined (_STLP_DEBUG) && defined (_STLP_DEBUG_MODE_THROWS)
+# define _STLP_DO_CHECK_BAD_PREDICATE
+# include <stdexcept>
+#endif
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class SortTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(SortTest);
+ CPPUNIT_TEST(sort1);
+ CPPUNIT_TEST(sort2);
+ CPPUNIT_TEST(sort3);
+ CPPUNIT_TEST(sort4);
+ CPPUNIT_TEST(stblsrt1);
+ CPPUNIT_TEST(stblsrt2);
+#if defined (_STLP_DO_CHECK_BAD_PREDICATE)
+ CPPUNIT_TEST(bad_predicate_detected);
+#endif
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void sort1();
+ void sort2();
+ void sort3();
+ void sort4();
+ void stblsrt1();
+ void stblsrt2();
+ void bad_predicate_detected();
+
+ static bool string_less(const char* a_, const char* b_)
+ {
+ return strcmp(a_, b_) < 0 ? 1 : 0;
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SortTest);
+
+//
+// tests implementation
+//
+void SortTest::stblsrt1()
+{
+ //Check that stable_sort do sort
+ int numbers[6] = { 1, 50, -10, 11, 42, 19 };
+ stable_sort(numbers, numbers + 6);
+ //-10 1 11 19 42 50
+ CPPUNIT_ASSERT(numbers[0]==-10);
+ CPPUNIT_ASSERT(numbers[1]==1);
+ CPPUNIT_ASSERT(numbers[2]==11);
+ CPPUNIT_ASSERT(numbers[3]==19);
+ CPPUNIT_ASSERT(numbers[4]==42);
+ CPPUNIT_ASSERT(numbers[5]==50);
+
+ char const* letters[6] = {"bb", "aa", "ll", "dd", "qq", "cc" };
+ stable_sort(letters, letters + 6, string_less);
+ // aa bb cc dd ll qq
+ CPPUNIT_ASSERT( strcmp(letters[0], "aa") == 0 );
+ CPPUNIT_ASSERT( strcmp(letters[1], "bb") == 0 );
+ CPPUNIT_ASSERT( strcmp(letters[2], "cc") == 0 );
+ CPPUNIT_ASSERT( strcmp(letters[3], "dd") == 0 );
+ CPPUNIT_ASSERT( strcmp(letters[4], "ll") == 0 );
+ CPPUNIT_ASSERT( strcmp(letters[5], "qq") == 0 );
+}
+
+struct Data {
+ Data(int index, int value)
+ : m_index(index), m_value(value) {}
+
+ bool operator == (const Data& other) const
+ { return m_index == other.m_index && m_value == other.m_value; }
+ bool operator < (const Data& other) const
+ { return m_value < other.m_value; }
+
+private:
+ int m_index, m_value;
+};
+
+void SortTest::stblsrt2()
+{
+ //Check that stable_sort is stable:
+ Data datas[] = {
+ Data(0, 10),
+ Data(1, 8),
+ Data(2, 6),
+ Data(3, 6),
+ Data(4, 6),
+ Data(5, 4),
+ Data(6, 9)
+ };
+ stable_sort(datas, datas + 7);
+
+ CPPUNIT_ASSERT( datas[0] == Data(5, 4) );
+ CPPUNIT_ASSERT( datas[1] == Data(2, 6) );
+ CPPUNIT_ASSERT( datas[2] == Data(3, 6) );
+ CPPUNIT_ASSERT( datas[3] == Data(4, 6) );
+ CPPUNIT_ASSERT( datas[4] == Data(1, 8) );
+ CPPUNIT_ASSERT( datas[5] == Data(6, 9) );
+ CPPUNIT_ASSERT( datas[6] == Data(0, 10) );
+}
+
+void SortTest::sort1()
+{
+ int numbers[6] = { 1, 50, -10, 11, 42, 19 };
+
+ sort(numbers, numbers + 6);
+ // -10 1 11 19 42 50
+ CPPUNIT_ASSERT(numbers[0]==-10);
+ CPPUNIT_ASSERT(numbers[1]==1);
+ CPPUNIT_ASSERT(numbers[2]==11);
+ CPPUNIT_ASSERT(numbers[3]==19);
+ CPPUNIT_ASSERT(numbers[4]==42);
+ CPPUNIT_ASSERT(numbers[5]==50);
+}
+
+void SortTest::sort2()
+{
+ int numbers[] = { 1, 50, -10, 11, 42, 19 };
+
+ int count = sizeof(numbers) / sizeof(numbers[0]);
+ sort(numbers, numbers + count, greater<int>());
+
+ // 50 42 19 11 1 -10
+ CPPUNIT_ASSERT(numbers[5]==-10);
+ CPPUNIT_ASSERT(numbers[4]==1);
+ CPPUNIT_ASSERT(numbers[3]==11);
+ CPPUNIT_ASSERT(numbers[2]==19);
+ CPPUNIT_ASSERT(numbers[1]==42);
+ CPPUNIT_ASSERT(numbers[0]==50);
+}
+
+void SortTest::sort3()
+{
+ vector<bool> boolVector;
+
+ boolVector.push_back( true );
+ boolVector.push_back( false );
+
+ sort( boolVector.begin(), boolVector.end() );
+
+ CPPUNIT_ASSERT(boolVector[0]==false);
+ CPPUNIT_ASSERT(boolVector[1]==true);
+}
+
+/*
+ * A small utility class to check a potential compiler bug
+ * that can result in a bad sort algorithm behavior. The type
+ * _Tp of the SortTestFunc has to be SortTestAux without any
+ * reference qualifier.
+ */
+struct SortTestAux {
+ SortTestAux (bool &b) : _b(b)
+ {}
+
+ SortTestAux (SortTestAux const&other) : _b(other._b) {
+ _b = true;
+ }
+
+ bool &_b;
+
+private:
+ //explicitely defined as private to avoid warnings:
+ SortTestAux& operator = (SortTestAux const&);
+};
+
+template <class _Tp>
+void SortTestFunc (_Tp) {
+}
+
+void SortTest::sort4()
+{
+ bool copy_constructor_called = false;
+ SortTestAux instance(copy_constructor_called);
+ SortTestAux &r_instance = instance;
+ SortTestAux const& rc_instance = instance;
+
+ SortTestFunc(r_instance);
+ CPPUNIT_ASSERT(copy_constructor_called);
+ copy_constructor_called = false;
+ SortTestFunc(rc_instance);
+ CPPUNIT_ASSERT(copy_constructor_called);
+}
+
+#if defined (_STLP_DO_CHECK_BAD_PREDICATE)
+void SortTest::bad_predicate_detected()
+{
+ int numbers[] = { 0, 0, 1, 0, 0, 1, 0, 0 };
+ try {
+ sort(numbers, numbers + sizeof(numbers) / sizeof(numbers[0]), less_equal<int>());
+
+ //Here is means that no exception has been raised
+ CPPUNIT_ASSERT( false );
+ }
+ catch (runtime_error const&)
+ { /*OK bad predicate has been detected.*/ }
+
+ try {
+ stable_sort(numbers, numbers + sizeof(numbers) / sizeof(numbers[0]), less_equal<int>());
+
+ //Here is means that no exception has been raised
+ CPPUNIT_ASSERT( false );
+ }
+ catch (runtime_error const&)
+ { /*OK bad predicate has been detected.*/ }
+}
+#endif
diff --git a/test/unit/sstream_header_test.cpp b/test/unit/sstream_header_test.cpp
new file mode 100644
index 0000000..784f79a
--- /dev/null
+++ b/test/unit/sstream_header_test.cpp
@@ -0,0 +1,10 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#if !defined (_STLP_NO_IOSTREAMS)
+# include <sstream>
+#endif
diff --git a/test/unit/sstream_test.cpp b/test/unit/sstream_test.cpp
new file mode 100644
index 0000000..c22066d
--- /dev/null
+++ b/test/unit/sstream_test.cpp
@@ -0,0 +1,487 @@
+#include <string>
+#include "math_aux.h"
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <sstream>
+# include <memory>
+
+# include "full_streambuf.h"
+
+# include "cppunit/cppunit_proxy.h"
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+//
+// TestCase class
+//
+class SstreamTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(SstreamTest);
+ CPPUNIT_TEST(output);
+ CPPUNIT_TEST(input);
+ CPPUNIT_TEST(input_char);
+ CPPUNIT_TEST(io);
+ CPPUNIT_TEST(err);
+ CPPUNIT_TEST(err_long);
+ CPPUNIT_TEST(maxint);
+ CPPUNIT_TEST(init_in);
+ CPPUNIT_TEST(init_out);
+ CPPUNIT_TEST(buf);
+ CPPUNIT_TEST(rdbuf);
+ CPPUNIT_TEST(streambuf_output);
+ CPPUNIT_TEST(seek);
+ CPPUNIT_TEST(seekp);
+ CPPUNIT_TEST(seek_gp);
+ CPPUNIT_TEST(tellp);
+ CPPUNIT_TEST(negative);
+ CPPUNIT_TEST_SUITE_END();
+
+ protected:
+ void output();
+ void input();
+ void input_char();
+ void io();
+ void err();
+ void err_long();
+ void maxint();
+ void init_in();
+ void init_out();
+ void buf();
+ void rdbuf();
+ void streambuf_output();
+ void seek();
+ void seekp();
+ void seek_gp();
+ void tellp();
+ void negative();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SstreamTest);
+
+//
+// tests implementation
+//
+void SstreamTest::output()
+{
+ {
+ ostringstream s;
+
+ s << 1 << '\n' << 2.0 << '\n' << "abcd\n" << "ghk lm\n" << "abcd ef";
+ CPPUNIT_ASSERT( s.good() );
+ CPPUNIT_ASSERT( s.str() == "1\n2\nabcd\nghk lm\nabcd ef" );
+ }
+
+ //Following tests are mostly used to reveal problem with the MSVC /Wp64 option
+ //used to track 64 bits portability issue:
+ {
+ ostringstream s;
+ size_t i = 0;
+ s << i;
+ CPPUNIT_ASSERT( s.good() );
+ CPPUNIT_ASSERT( s.str() == "0" );
+ }
+ {
+ ostringstream s;
+ ptrdiff_t i = 0;
+ s << i;
+ CPPUNIT_ASSERT( s.good() );
+ CPPUNIT_ASSERT( s.str() == "0" );
+ }
+}
+
+void SstreamTest::input()
+{
+ {
+ istringstream s( "1\n2\nabcd\nghk lm\nabcd ef" );
+ int i = 0;
+ s >> i;
+ CPPUNIT_ASSERT( s.good() );
+ CPPUNIT_ASSERT( i == 1 );
+ double d = 0.0;
+ s >> d;
+ CPPUNIT_ASSERT( s.good() );
+ CPPUNIT_ASSERT( d == 2.0 );
+ string str;
+ s >> str;
+ CPPUNIT_ASSERT( s.good() );
+ CPPUNIT_ASSERT( str == "abcd" );
+ char c;
+ s.get(c); // extract newline, that not extracted by operator >>
+ CPPUNIT_ASSERT( s.good() );
+ CPPUNIT_ASSERT( c == '\n' );
+ getline( s, str );
+ CPPUNIT_ASSERT( s.good() );
+ CPPUNIT_ASSERT( str == "ghk lm" );
+ getline( s, str );
+ CPPUNIT_ASSERT( s.eof() );
+ CPPUNIT_ASSERT( str == "abcd ef" );
+ }
+ {
+ istringstream s("0");
+ size_t i = 1;
+ s >> i;
+ CPPUNIT_ASSERT( !s.fail() );
+ CPPUNIT_ASSERT( s.eof() );
+ CPPUNIT_ASSERT( i == 0 );
+ }
+}
+
+void SstreamTest::input_char()
+{
+ char buf[16] = { 0, '1', '2', '3' };
+ istringstream s( "0" );
+ s >> buf;
+
+ CPPUNIT_ASSERT( buf[0] == '0' );
+ CPPUNIT_ASSERT( buf[1] == 0 );
+ CPPUNIT_ASSERT( buf[2] == '2' );
+}
+
+
+void SstreamTest::io()
+{
+ stringstream s;
+ s << 1 << '\n' << 2.0 << '\n' << "abcd\n" << "ghk lm\n" << "abcd ef";
+ CPPUNIT_ASSERT( s.good() );
+
+ int i = 0;
+ s >> i;
+ CPPUNIT_ASSERT( i == 1 );
+ CPPUNIT_ASSERT( s.good() );
+ double d = 0.0;
+ s >> d;
+ CPPUNIT_ASSERT( d == 2.0 );
+ CPPUNIT_ASSERT( s.good() );
+ string str;
+ s >> str;
+ CPPUNIT_ASSERT( str == "abcd" );
+ CPPUNIT_ASSERT( s.good() );
+ char c;
+ s.get(c); // extract newline, that not extracted by operator >>
+ CPPUNIT_ASSERT( s.good() );
+ CPPUNIT_ASSERT( c == '\n' );
+ getline( s, str );
+ CPPUNIT_ASSERT( s.good() );
+ CPPUNIT_ASSERT( str == "ghk lm" );
+ getline( s, str );
+ CPPUNIT_ASSERT( str == "abcd ef" );
+ CPPUNIT_ASSERT( s.eof() );
+}
+
+void SstreamTest::err()
+{
+ stringstream s( "9" );
+
+ int i = 0;
+ s >> i;
+ CPPUNIT_ASSERT( !s.fail() );
+ CPPUNIT_ASSERT( i == 9 );
+ s >> i;
+ CPPUNIT_ASSERT( s.fail() );
+ CPPUNIT_ASSERT( s.eof() );
+ CPPUNIT_ASSERT( i == 9 );
+}
+
+void SstreamTest::err_long()
+{
+ stringstream s( "9" );
+
+ long i = 0;
+ s >> i;
+ CPPUNIT_ASSERT( !s.fail() );
+ CPPUNIT_ASSERT( i == 9 );
+ s >> i;
+ CPPUNIT_ASSERT( s.fail() );
+ CPPUNIT_ASSERT( s.eof() );
+ CPPUNIT_ASSERT( i == 9 );
+}
+
+void SstreamTest::maxint()
+{
+ stringstream s;
+
+ s << INT_MAX << " " << UINT_MAX << " " << LONG_MAX << " " << ULONG_MAX << " "
+ << INT_MIN << " " << LONG_MIN;
+ CPPUNIT_ASSERT( s.good() );
+
+ int i = 0;
+ unsigned int u = 0;
+ long l = 0;
+ unsigned long ul = 0;
+
+ s >> i >> u >> l >> ul;
+ CPPUNIT_ASSERT( s.good() );
+ CPPUNIT_ASSERT( i == INT_MAX );
+ CPPUNIT_ASSERT( u == UINT_MAX );
+ CPPUNIT_ASSERT( l == LONG_MAX );
+ CPPUNIT_ASSERT( ul == ULONG_MAX );
+
+ s >> i >> l;
+ CPPUNIT_ASSERT( !s.fail() );
+ CPPUNIT_ASSERT( i == INT_MIN );
+ CPPUNIT_ASSERT( l == LONG_MIN );
+}
+
+void SstreamTest::init_in()
+{
+ istringstream is( "12345" );
+ int n;
+
+ is >> n;
+ CPPUNIT_ASSERT( !is.fail() );
+ CPPUNIT_ASSERT( n == 12345 );
+
+ istringstream dis( "1.2345" );
+ double d;
+
+ dis >> d;
+ CPPUNIT_ASSERT( !dis.fail() );
+ CPPUNIT_ASSERT( are_equals(d, 1.2345) );
+
+ istringstream fis( "1.2345" );
+ float f;
+
+ fis >> f;
+ CPPUNIT_ASSERT( !fis.fail() );
+ CPPUNIT_ASSERT( are_equals(f, 1.2345f) );
+}
+
+void SstreamTest::init_out()
+{
+ ostringstream os( "12345" );
+ CPPUNIT_ASSERT( os.str() == "12345" );
+
+ os << 67;
+ CPPUNIT_ASSERT( os.good() );
+
+ // This satisfy to the Standard:
+ // CPPUNIT_ASSERT( os.str() == "67345" );
+ // But we don't know the reason, why standard state that.
+
+ /*
+ * 27.7.1.1: ... then copies the content of str into the basic_sringbuf
+ * underlying character sequence and initializes the input and output
+ * sequences according to which. If which & ios_base::out is true, initializes
+ * the output sequence with underlying sequence. ...
+ *
+ * I can treat this as 'like output was performed', and then I should bump
+ * put pointer... Looks like more useful then my previous treatment.
+ *
+ * - ptr
+ */
+
+ CPPUNIT_ASSERT( os.str() == "1234567" );
+
+
+ os.str( "89ab" );
+ CPPUNIT_ASSERT( os.str() == "89ab" );
+
+ os << 10;
+ CPPUNIT_ASSERT( os.good() );
+ // CPPUNIT_ASSERT( os.str() == "10ab" );
+ CPPUNIT_ASSERT( os.str() == "89ab10" );
+}
+
+void SstreamTest::buf()
+{
+ stringstream ss;
+
+ ss << "1234567\n89\n";
+ char buf[10];
+ buf[7] = 'x';
+ ss.get( buf, 10 );
+ CPPUNIT_ASSERT( !ss.fail() );
+ CPPUNIT_ASSERT( buf[0] == '1' );
+ CPPUNIT_ASSERT( buf[1] == '2' );
+ CPPUNIT_ASSERT( buf[2] == '3' );
+ CPPUNIT_ASSERT( buf[3] == '4' );
+ CPPUNIT_ASSERT( buf[4] == '5' );
+ CPPUNIT_ASSERT( buf[5] == '6' );
+ CPPUNIT_ASSERT( buf[6] == '7' ); // 27.6.1.3 paragraph 10, paragraph 7
+ CPPUNIT_ASSERT( buf[7] == 0 ); // 27.6.1.3 paragraph 8
+ char c;
+ ss.get(c);
+ CPPUNIT_ASSERT( !ss.fail() );
+ CPPUNIT_ASSERT( c == '\n' ); // 27.6.1.3 paragraph 10, paragraph 7
+ ss.get(c);
+ CPPUNIT_ASSERT( !ss.fail() );
+ CPPUNIT_ASSERT( c == '8' );
+}
+
+void SstreamTest::rdbuf()
+{
+ stringstream ss;
+
+ ss << "1234567\n89\n";
+
+ ostringstream os;
+ ss.get( *os.rdbuf(), '\n' );
+ CPPUNIT_ASSERT( !ss.fail() );
+ char c;
+ ss.get(c);
+ CPPUNIT_ASSERT( !ss.fail() );
+ CPPUNIT_ASSERT( c == '\n' ); // 27.6.1.3 paragraph 12
+ CPPUNIT_ASSERT( os.str() == "1234567" );
+}
+
+void SstreamTest::streambuf_output()
+{
+ {
+ istringstream in("01234567890123456789");
+ CPPUNIT_ASSERT( in );
+
+ full_streambuf full_buf(10);
+ ostream out(&full_buf);
+ CPPUNIT_ASSERT( out );
+
+ out << in.rdbuf();
+ CPPUNIT_ASSERT( out );
+ CPPUNIT_ASSERT( in );
+ //out is good we can check what has been extracted:
+ CPPUNIT_ASSERT( full_buf.str() == "0123456789" );
+
+ out << in.rdbuf();
+ CPPUNIT_ASSERT( out.fail() );
+ CPPUNIT_ASSERT( in );
+
+ ostringstream ostr;
+ ostr << in.rdbuf();
+ CPPUNIT_ASSERT( ostr );
+ CPPUNIT_ASSERT( in );
+ CPPUNIT_ASSERT( ostr.str() == "0123456789" );
+ }
+
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ {
+ //If the output stream buffer throws:
+ istringstream in("01234567890123456789");
+ CPPUNIT_ASSERT( in );
+
+ full_streambuf full_buf(10, true);
+ ostream out(&full_buf);
+ CPPUNIT_ASSERT( out );
+
+ out << in.rdbuf();
+ CPPUNIT_ASSERT( out.bad() );
+ CPPUNIT_ASSERT( in );
+ //out is bad we have no guaranty on what has been extracted:
+ //CPPUNIT_ASSERT( full_buf.str() == "0123456789" );
+
+ out.clear();
+ out << in.rdbuf();
+ CPPUNIT_ASSERT( out.fail() && out.bad() );
+ CPPUNIT_ASSERT( in );
+
+ ostringstream ostr;
+ ostr << in.rdbuf();
+ CPPUNIT_ASSERT( ostr );
+ CPPUNIT_ASSERT( in );
+ CPPUNIT_ASSERT( ostr.str() == "01234567890123456789" );
+ }
+# endif
+}
+
+void SstreamTest::seek()
+{
+ stringstream s( "0123456789" );
+
+ CPPUNIT_ASSERT( s.tellg() == stringstream::pos_type(0) );
+ s.seekg( 6, ios::beg );
+ CPPUNIT_ASSERT( s.tellg() == stringstream::pos_type(6) );
+ s.seekg( -3, ios::cur );
+ CPPUNIT_ASSERT( s.tellg() == stringstream::pos_type(3) );
+
+ istringstream is( "0123456789" );
+ CPPUNIT_ASSERT( is.tellg() == stringstream::pos_type(0) );
+ is.seekg( 6, ios::beg );
+ CPPUNIT_ASSERT( is.tellg() == stringstream::pos_type(6) );
+ is.seekg( -3, ios::cur );
+ CPPUNIT_ASSERT( is.tellg() == stringstream::pos_type(3) );
+}
+
+void SstreamTest::seekp()
+{
+ ostringstream s;
+
+ s << "1234567";
+ CPPUNIT_CHECK( s.tellp() == stringstream::pos_type(7) );
+ CPPUNIT_CHECK( s.str() == "1234567" );
+ s.seekp( 0 );
+ s << "X";
+ CPPUNIT_CHECK( s.str() == "X234567" );
+ s.seekp( 0, ios::beg );
+ s << "Y";
+ CPPUNIT_CHECK( s.str() == "Y234567" );
+}
+
+void SstreamTest::seek_gp()
+{
+ stringstream ss( "1" );
+
+ /* ISO/IEC 14882 2003 (and 1998 too) assume change as get as put positions
+ with seekg and seekp (27.6.1.3, par 38; 27.6.2.4 par 2),
+ but this contradict to common practice and proposed draft N2588
+ (27.6.1.3, par 41; 27.6.2.5, par 4)
+
+ Now STLport implement (i.e. change behaviour ) the draft's point of view.
+ */
+
+ ss.seekg( 0, ios::beg );
+ ss.seekp( 0, ios::end );
+
+ ss << "2";
+
+ string str;
+
+ ss >> str;
+
+ /* CPPUNIT_CHECK( str == "2" ); --- according ISO/IEC 14882 2003 */
+ CPPUNIT_CHECK( str == "12" );
+}
+
+void SstreamTest::tellp()
+{
+ {
+ ostringstream o( "1" );
+
+ o << "23456";
+
+ CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == stringstream::pos_type(6) );
+ CPPUNIT_CHECK( o.tellp() == stringstream::pos_type(6) );
+ }
+ {
+ ostringstream o;
+
+ o << "123456";
+
+ CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == stringstream::pos_type(6) );
+ CPPUNIT_CHECK( o.tellp() == stringstream::pos_type(6) );
+ }
+ {
+ ostringstream o( "1" );
+
+ o << "23456789";
+
+ CPPUNIT_CHECK( o.rdbuf()->pubseekoff( 0, ios_base::cur, ios_base::out ) == stringstream::pos_type(9) );
+ CPPUNIT_CHECK( o.tellp() == stringstream::pos_type(9) );
+ }
+}
+
+
+template < class T >
+string to_string( const T& v )
+{
+ ostringstream oss;
+ oss << v;
+ return oss.str();
+}
+
+void SstreamTest::negative()
+{
+ CPPUNIT_CHECK( to_string<int>(-1) == "-1" );
+ CPPUNIT_CHECK( to_string<long>(-1) == "-1" );
+}
+
+#endif
diff --git a/test/unit/stack_allocator.h b/test/unit/stack_allocator.h
new file mode 100644
index 0000000..93db960
--- /dev/null
+++ b/test/unit/stack_allocator.h
@@ -0,0 +1,206 @@
+#ifndef STLPORT_UNIT_TEST_STACK_ALLOCATOR_H
+#define STLPORT_UNIT_TEST_STACK_ALLOCATOR_H
+
+#include <algorithm>
+
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+//For bad_alloc:
+# include <new>
+#endif
+
+#undef __STD
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+# define __STD std::
+#else
+# define __STD
+#endif
+
+struct State {
+ char *m_beg, *m_end, *m_cur;
+ bool m_isOk, m_swaped;
+ int m_nbAlloc;
+
+ //The following members are shared among all StackAllocator instance created from
+ //a reference StackAllocator instance:
+ char **m_sharedCur;
+ bool *m_sharedOk;
+ int *m_sharedNbAlloc;
+
+#if defined (__DMC__)
+ State(){}
+#endif
+
+ State(char *beg, char *end)
+ : m_beg(beg), m_end(end), m_cur(m_beg), m_isOk(true), m_swaped(false), m_nbAlloc(0),
+ m_sharedCur(&m_cur), m_sharedOk(&m_isOk), m_sharedNbAlloc(&m_nbAlloc) {}
+
+ State(const State& other)
+ : m_beg(other.m_beg), m_end(other.m_end), m_cur(0),
+ m_isOk(true), m_swaped(other.m_swaped), m_nbAlloc(0),
+ m_sharedCur(other.m_sharedCur), m_sharedOk(other.m_sharedOk),
+ m_sharedNbAlloc(other.m_sharedNbAlloc) {}
+};
+
+/* This allocator is not thread safe:
+ */
+template <class _Tp>
+struct StackAllocator
+#if defined (STLPORT) && \
+ defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ //Special Borland workaround that have problem with function
+ //overloading when one of the overloaded version is a template
+ //one. This is the case for the std::swap function.
+ : public __STD __stlport_class<StackAllocator<_Tp> >
+#endif
+{
+ typedef _Tp value_type;
+ typedef value_type * pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+#if defined (__DMC__)
+ StackAllocator(){}
+#endif
+
+ StackAllocator(char *beg, char *end)
+ : m_state(beg, end) {}
+
+ const State& getState() const { return m_state; }
+#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES)
+ template <class _OtherTp>
+ StackAllocator(StackAllocator<_OtherTp> const& other)
+ : m_state(other.getState()) {}
+#else
+ StackAllocator(const State& state)
+ : m_state(state) {}
+#endif
+
+#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Other>
+ struct rebind {
+ typedef StackAllocator<_Other> other;
+ };
+#endif
+
+ _Tp* allocate(size_type n, void* = 0) {
+ if (n == 0)
+ return 0;
+
+ ++(*m_state.m_sharedNbAlloc);
+
+ if (*m_state.m_sharedCur + (n * sizeof(_Tp)) < m_state.m_end) {
+ char *ret = *m_state.m_sharedCur;
+ *m_state.m_sharedCur += n * sizeof(_Tp);
+ return reinterpret_cast<_Tp*>(ret);
+ }
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ throw __STD bad_alloc();
+# if defined (__DMC__)
+ return 0;
+# endif
+#else
+ return 0;
+#endif
+ }
+
+#if defined (STLPORT) && \
+ defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ //Necessary extension to make StackAllocator a real STLport allocator
+ //implementation:
+ _Tp* _M_allocate(size_type n, size_type &new_n) {
+ new_n = n;
+ return allocate(n);
+ }
+#endif
+
+ void deallocate(pointer p, size_type n) {
+ if (p == 0)
+ return;
+
+ --(*m_state.m_sharedNbAlloc);
+
+ if ((char*)p == (*m_state.m_sharedCur - n * sizeof(_Tp))) {
+ *m_state.m_sharedCur -= n * sizeof(_Tp);
+ }
+
+ if ((char*)p < m_state.m_beg || (char*)p >= m_state.m_end) {
+ //An object has been returned to the bad allocator instance:
+ *m_state.m_sharedOk = false;
+ }
+ }
+
+ pointer address(reference __x) const {return &__x;}
+ const_pointer address(const_reference __x) const { return &__x; }
+ size_type max_size() const { return m_state.m_end - *m_state.m_sharedCur; }
+ void construct(pointer __p, const_reference __val) { new(__p) _Tp(__val); }
+ void destroy(pointer __p) { __p->~_Tp(); }
+
+ bool ok() const { return m_state.m_isOk && (m_state.m_nbAlloc == 0); }
+ void reset () {
+ m_state.m_cur = m_state.m_beg;
+ m_state.m_isOk = true;
+ m_state.m_swaped = false;
+ }
+ bool swaped() const { return m_state.m_swaped; }
+ void swap(StackAllocator &other) {
+ __STD swap(m_state, other.m_state);
+ m_state.m_swaped = true;
+ other.m_state.m_swaped = true;
+ }
+#if defined (STLPORT) && \
+ defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ void _M_swap_workaround(StackAllocator& __x) { swap(__x); }
+#endif
+
+ //2 StackAllocator instance are identical if they are built on top
+ //of the same buffer.
+ bool operator == (StackAllocator const& other) const
+ { return m_state.m_beg == other.m_state.m_beg; }
+
+ bool operator != (StackAllocator const& other) const
+ { return !(*this == other); }
+
+private:
+ State m_state;
+};
+
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+namespace std {
+#endif
+
+# if defined (STLPORT) && (defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) || !defined (_STLP_MEMBER_TEMPLATES))
+template <class _Tp1, class _Tp2>
+inline StackAllocator<_Tp2>&
+__stl_alloc_rebind(StackAllocator<_Tp1>& __a, const _Tp2*) { return (StackAllocator<_Tp2>&)(__a); }
+template <class _Tp1, class _Tp2>
+inline StackAllocator<_Tp2>
+__stl_alloc_create(const StackAllocator<_Tp1>& __a, const _Tp2*) { return StackAllocator<_Tp2>(__a.getState()); }
+# endif
+
+# if !defined (STLPORT) || defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
+ template <class _Tp>
+ inline void swap(StackAllocator<_Tp>& __a, StackAllocator<_Tp>& __b)
+ { __a.swap(__b); }
+# elif !defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+//The following overloads depends on instanciation, if new unit tests are written
+//with new StackAllocator instanciations associated swap overload should also be
+//written
+inline void swap(StackAllocator<int>& __a, StackAllocator<int>& __b)
+{ __a.swap(__b); }
+inline void swap(StackAllocator<char>& __a, StackAllocator<char>& __b)
+{ __a.swap(__b); }
+inline void swap(StackAllocator<pair<const int, int> >& __a,
+ StackAllocator<pair<const int, int> >& __b)
+{ __a.swap(__b); }
+# endif
+
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+}
+#endif
+
+#undef __STD
+
+#endif //STLPORT_UNIT_TEST_STACK_ALLOCATOR_H
diff --git a/test/unit/stack_header_test.cpp b/test/unit/stack_header_test.cpp
new file mode 100644
index 0000000..39946ea
--- /dev/null
+++ b/test/unit/stack_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <stack>
diff --git a/test/unit/stack_test.cpp b/test/unit/stack_test.cpp
new file mode 100644
index 0000000..5ff2aaa
--- /dev/null
+++ b/test/unit/stack_test.cpp
@@ -0,0 +1,60 @@
+#include <algorithm>
+#include <list>
+#include <queue>
+#include <deque>
+#include <stack>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class StackTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(StackTest);
+ CPPUNIT_TEST(stack1);
+ CPPUNIT_TEST(stack2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void stack1();
+ void stack2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(StackTest);
+
+//
+// tests implementation
+//
+void StackTest::stack1()
+{
+ stack<int, deque<int> > s;
+ s.push(42);
+ s.push(101);
+ s.push(69);
+ CPPUNIT_ASSERT(s.top()==69);
+ s.pop();
+ CPPUNIT_ASSERT(s.top()==101);
+ s.pop();
+ CPPUNIT_ASSERT(s.top()==42);
+ s.pop();
+ CPPUNIT_ASSERT(s.empty());
+}
+void StackTest::stack2()
+{
+ stack<int, list<int> > s;
+ s.push(42);
+ s.push(101);
+ s.push(69);
+ CPPUNIT_ASSERT(s.top()==69);
+ s.pop();
+ CPPUNIT_ASSERT(s.top()==101);
+ s.pop();
+ CPPUNIT_ASSERT(s.top()==42);
+ s.pop();
+ CPPUNIT_ASSERT(s.empty());
+}
diff --git a/test/unit/stdarg_header_test.c b/test/unit/stdarg_header_test.c
new file mode 100644
index 0000000..9901cba
--- /dev/null
+++ b/test/unit/stdarg_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <stdarg.h>
diff --git a/test/unit/stddef_header_test.c b/test/unit/stddef_header_test.c
new file mode 100644
index 0000000..eb00372
--- /dev/null
+++ b/test/unit/stddef_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <stddef.h>
diff --git a/test/unit/stdexcept_header_test.cpp b/test/unit/stdexcept_header_test.cpp
new file mode 100644
index 0000000..d8114e6
--- /dev/null
+++ b/test/unit/stdexcept_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <stdexcept>
diff --git a/test/unit/stdio_header_test.c b/test/unit/stdio_header_test.c
new file mode 100644
index 0000000..d8f42c1
--- /dev/null
+++ b/test/unit/stdio_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <stdio.h>
diff --git a/test/unit/stdlib_header_test.c b/test/unit/stdlib_header_test.c
new file mode 100644
index 0000000..a43f906
--- /dev/null
+++ b/test/unit/stdlib_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <stdlib.h>
diff --git a/test/unit/stldbg_include.cpp b/test/unit/stldbg_include.cpp
new file mode 100644
index 0000000..ab2c9a8
--- /dev/null
+++ b/test/unit/stldbg_include.cpp
@@ -0,0 +1,40 @@
+/*
+ * This is compile-time test for situation below not happen.
+ * STLport use many defines and auxilary structures, namespaces and templates
+ * that included via _prolog.h. After preprocessor phase we may see:
+ *
+ * extern "C" {
+ *
+ * namespace std { }
+ *
+ *
+ * This is bad, but acceptable. But in STLPORT_DEBUG mode we can see
+ *
+ * extern "C" {
+ *
+ * namespace std {
+ * namespace private {
+ *
+ * template <class _Dummy>
+ * class __stl_debug_engine {
+ *
+ *
+ * This lead to compile-time error.
+ * [This due to sys/types.h contains
+ *
+ * __BEGIN_DECLS
+ * #include <bits/types.h>
+ *
+ *
+ * i.e. include other headers within extern "C" { scope. Bad, but this is fact.]
+ *
+ * Origin of problem: STLport provide proxy-headers as for C++ headers, as for C
+ * headers. For C headers, we shouldn't expose C++ constructions, because system
+ * headers may include each other by unexpected way (from STLport point of view).
+ *
+ * - ptr, 2007-04-05
+ */
+
+#ifdef __unix
+# include <sys/types.h>
+#endif
diff --git a/test/unit/streambuf_header_test.cpp b/test/unit/streambuf_header_test.cpp
new file mode 100644
index 0000000..935f909
--- /dev/null
+++ b/test/unit/streambuf_header_test.cpp
@@ -0,0 +1,10 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#if !defined (_STLP_NO_IOSTREAMS)
+# include <streambuf>
+#endif
diff --git a/test/unit/string_header_test.c b/test/unit/string_header_test.c
new file mode 100644
index 0000000..a242eeb
--- /dev/null
+++ b/test/unit/string_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <string.h>
diff --git a/test/unit/string_header_test.cpp b/test/unit/string_header_test.cpp
new file mode 100644
index 0000000..4f36b27
--- /dev/null
+++ b/test/unit/string_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <string>
diff --git a/test/unit/string_test.cpp b/test/unit/string_test.cpp
new file mode 100644
index 0000000..987d68e
--- /dev/null
+++ b/test/unit/string_test.cpp
@@ -0,0 +1,1427 @@
+//To make GLib C++ closer to STLport behavior we need this macro:
+//Only mandatory when building unit tests without STLport, do not change
+//anything when building with STLport
+#define _GLIBCXX_FULLY_DYNAMIC_STRING
+
+//Has to be first for StackAllocator swap overload to be taken
+//into account (at least using GCC 4.0.1)
+#include "stack_allocator.h"
+
+#include <vector>
+#include <deque>
+#include <string>
+#include <algorithm>
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <sstream>
+#endif
+
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+# include <stdexcept>
+#endif
+
+#if !defined (STLPORT) || defined (_STLP_THREADS)
+# if defined (STLPORT) && defined (_STLP_PTHREADS) || \
+ defined (__GNUC__) && !defined (__MINGW32__)
+# define USE_PTHREAD_API
+# include <pthread.h>
+# endif
+
+# if defined (STLPORT) && defined (_STLP_WIN32THREADS) || \
+ defined (__GNUC__) && defined (__MINGW32__) || \
+ defined (_MSC_VER)
+# define USE_WINDOWS_API
+# include <windows.h>
+# endif
+#endif
+
+#include "stack_allocator.h"
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class StringTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(StringTest);
+ CPPUNIT_TEST(constructor);
+ CPPUNIT_TEST(trivial_char_compare);
+ CPPUNIT_TEST(reserve);
+ CPPUNIT_TEST(assign);
+ CPPUNIT_TEST(erase);
+ CPPUNIT_TEST(data);
+ CPPUNIT_TEST(c_str);
+ CPPUNIT_TEST(null_char);
+ CPPUNIT_TEST(insert);
+ CPPUNIT_TEST(replace);
+ CPPUNIT_TEST(resize);
+ CPPUNIT_TEST(short_string);
+ CPPUNIT_TEST(find);
+ CPPUNIT_TEST(bogus_edge_find);
+ CPPUNIT_TEST(rfind);
+ CPPUNIT_TEST(find_last_of);
+ CPPUNIT_TEST(find_last_not_of);
+ CPPUNIT_TEST(copy);
+#if !defined (USE_PTHREAD_API) && !defined (USE_WINDOWS_API)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(mt);
+ CPPUNIT_STOP_IGNORE;
+ CPPUNIT_TEST(short_string_optim_bug);
+ CPPUNIT_TEST(compare);
+ CPPUNIT_TEST(template_expression);
+#if defined (STLPORT) && ((defined (_STLP_MSVC) && (_STLP_MSVC < 1300)) || \
+ (defined(__GNUC__) && defined(_STLP_USE_TEMPLATE_EXPRESSION) && \
+ ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)) ) )
+# define TE_TMP_TEST_IGNORED
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(te_tmp);
+#if defined (TE_TMP_TEST_IGNORED)
+ CPPUNIT_STOP_IGNORE;
+#endif
+ CPPUNIT_TEST(oper_tmp);
+#if defined (STLPORT) && defined (_STLP_NO_WCHAR_T)
+ CPPUNIT_IGNORE;
+#endif
+#if defined (__CYGWIN__) && !defined (STLPORT)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(template_wexpression);
+ CPPUNIT_STOP_IGNORE;
+#if defined (STLPORT) && defined (_STLP_USE_NO_IOSTREAMS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(io);
+ CPPUNIT_STOP_IGNORE;
+#if defined (STLPORT) && defined (_STLP_NO_CUSTOM_IO)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(allocator_with_state);
+ CPPUNIT_STOP_IGNORE;
+ CPPUNIT_TEST(capacity);
+ CPPUNIT_TEST(concat24);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void constructor();
+ void trivial_char_compare();
+ void reserve();
+ void erase();
+ void data();
+ void c_str();
+ void null_char();
+ void insert();
+ void replace();
+ void resize();
+ void short_string();
+ void find();
+ void bogus_edge_find();
+ void rfind();
+ void find_last_of();
+ void find_last_not_of();
+ void copy();
+ void assign();
+ void mt();
+ void short_string_optim_bug();
+ void compare();
+ void template_expression();
+ void te_tmp();
+ void oper_tmp();
+ void template_wexpression();
+ void io();
+ void allocator_with_state();
+ void capacity();
+ void concat24();
+
+ static string func(const string& par) {
+ string tmp( par );
+ return tmp;
+ }
+
+#if defined (USE_PTHREAD_API) || defined (USE_WINDOWS_API)
+# if defined (USE_PTHREAD_API)
+ static void* f(void*)
+# else
+ static DWORD __stdcall f(void*)
+# endif
+ {
+ string s( "qyweyuewunfkHBUKGYUGL,wehbYGUW^(@T@H!BALWD:h^&@#*@(#:JKHWJ:CND" );
+
+ for ( int i = 0; i < 2000000; ++i ) {
+ string sx = func( s );
+ }
+
+ return 0;
+ }
+#endif
+
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(StringTest);
+
+//
+// tests implementation
+//
+void StringTest::constructor()
+{
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try {
+ string s((size_t)-1, 'a');
+ CPPUNIT_FAIL;
+ }
+ catch (length_error const&) {
+ }
+ catch (...) {
+ //Expected exception is length_error:
+ CPPUNIT_FAIL;
+ }
+#endif
+}
+
+void StringTest::trivial_char_compare()
+{
+ string s( "message" );
+
+ CPPUNIT_CHECK( s == "message" );
+ CPPUNIT_CHECK( "message" == s );
+}
+
+void StringTest::reserve()
+{
+ string s;
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try {
+ s.reserve(s.max_size() + 1);
+ CPPUNIT_FAIL;
+ }
+ catch (length_error const&) {
+ }
+ catch (...) {
+ //Expected exception is length_error:
+ CPPUNIT_FAIL;
+ }
+#endif
+}
+
+void StringTest::mt()
+{
+#if defined (USE_PTHREAD_API) || defined (USE_WINDOWS_API)
+ const int nth = 2;
+# if defined (USE_PTHREAD_API)
+ pthread_t t[nth];
+
+ for ( int i = 0; i < nth; ++i ) {
+ pthread_create( &t[i], 0, f, 0 );
+ }
+
+ for ( int i = 0; i < nth; ++i ) {
+ pthread_join( t[i], 0 );
+ }
+# endif // PTHREAD
+
+# if defined (USE_WINDOWS_API)
+ //DWORD start = GetTickCount();
+
+ HANDLE t[nth];
+
+ int i; // VC6 not support in-loop scope of cycle var
+ for ( i = 0; i < nth; ++i ) {
+ t[i] = CreateThread(NULL, 0, f, 0, 0, NULL);
+ }
+
+ if (WaitForMultipleObjects(nth, t, TRUE, INFINITE) == WAIT_FAILED) {
+ // On some platforms (evc3/evc4) WaitForMultipleObjects() with fWaitAll == TRUE
+ // is not supported. We then wait with a loop on each thread:
+ for ( i = 0; i < nth; ++i ) {
+ WaitForSingleObject(t[i], INFINITE);
+ }
+ }
+
+ /*
+ DWORD duration = GetTickCount() - start;
+ ostringstream ostr;
+ ostr << "Duration: " << duration << endl;
+ CPPUNIT_MESSAGE(ostr.str().c_str());
+ */
+# endif
+#endif
+}
+
+void StringTest::short_string()
+{
+ string const ref_short_str1("str1"), ref_short_str2("str2");
+ string short_str1(ref_short_str1), short_str2(ref_short_str2);
+ string const ref_long_str1("str 1");
+ string const ref_long_str2("str 2");
+ string long_str1(ref_long_str1), long_str2(ref_long_str2);
+
+ CPPUNIT_ASSERT(short_str1 == ref_short_str1);
+ CPPUNIT_ASSERT(long_str1 == ref_long_str1);
+
+ {
+ string str1(short_str1);
+ str1 = long_str1;
+ CPPUNIT_ASSERT(str1 == ref_long_str1);
+ }
+
+ {
+ string str1(long_str1);
+ str1 = short_str1;
+ CPPUNIT_ASSERT(str1 == ref_short_str1);
+ }
+
+ {
+ short_str1.swap(short_str2);
+ CPPUNIT_ASSERT((short_str1 == ref_short_str2) && (short_str2 == ref_short_str1));
+ short_str1.swap(short_str2);
+ }
+
+ {
+ long_str1.swap(long_str2);
+ CPPUNIT_ASSERT((long_str1 == ref_long_str2) && (long_str2 == ref_long_str1));
+ long_str1.swap(long_str2);
+ }
+
+ {
+ short_str1.swap(long_str1);
+ CPPUNIT_ASSERT((short_str1 == ref_long_str1) && (long_str1 == ref_short_str1));
+ short_str1.swap(long_str1);
+ }
+
+ {
+ long_str1.swap(short_str1);
+ CPPUNIT_ASSERT((short_str1 == ref_long_str1) && (long_str1 == ref_short_str1));
+ long_str1.swap(short_str1);
+ }
+
+ {
+ string a(256, 'a');
+ string b(256, 'b');
+ const char* as = a.c_str();
+ const char* bs = b.c_str();
+ swap(a, b);
+ CPPUNIT_ASSERT( a.c_str() == bs );
+ CPPUNIT_ASSERT( b.c_str() == as );
+ }
+
+ {
+ //This is to test move constructor
+ vector<string> str_vect;
+ str_vect.push_back(short_str1);
+ str_vect.push_back(long_str1);
+ str_vect.push_back(short_str2);
+ str_vect.push_back(long_str2);
+ CPPUNIT_ASSERT((str_vect[0] == ref_short_str1) &&
+ (str_vect[1] == ref_long_str1) &&
+ (str_vect[2] == ref_short_str2) &&
+ (str_vect[3] == ref_long_str2));
+ }
+}
+
+void StringTest::erase()
+{
+ char const* c_str = "Hello, World!";
+ string str(c_str);
+ CPPUNIT_ASSERT( str == c_str );
+
+ str.erase(str.begin() + 1, str.end() - 1); // Erase all but first and last.
+
+ size_t i;
+ for (i = 0; i < str.size(); ++i) {
+ switch ( i ) {
+ case 0:
+ CPPUNIT_ASSERT( str[i] == 'H' );
+ break;
+ case 1:
+ CPPUNIT_ASSERT( str[i] == '!' );
+ break;
+ default:
+ CPPUNIT_FAIL;
+ }
+ }
+
+ str.insert(1, c_str);
+ str.erase(str.begin()); // Erase first element.
+ str.erase(str.end() - 1); // Erase last element.
+ CPPUNIT_ASSERT( str == c_str );
+ str.clear(); // Erase all.
+ CPPUNIT_ASSERT( str.empty() );
+
+ str = c_str;
+ CPPUNIT_ASSERT( str == c_str );
+
+ str.erase(1, str.size() - 1); // Erase all but first and last.
+ for (i = 0; i < str.size(); i++) {
+ switch ( i ) {
+ case 0:
+ CPPUNIT_ASSERT( str[i] == 'H' );
+ break;
+ case 1:
+ CPPUNIT_ASSERT( str[i] == '!' );
+ break;
+ default:
+ CPPUNIT_FAIL;
+ }
+ }
+
+ str.erase(1);
+ CPPUNIT_ASSERT( str == "H" );
+}
+
+void StringTest::data()
+{
+ string xx;
+
+ CPPUNIT_ASSERT( xx.data() != 0 ); // ISO-IEC-14882:1998(E), 21.3.6, paragraph 3
+#if 0
+ /* This test really not required: in ISO-IEC-14882:1998(E) paragraph 3 stated:
+ * '... and can have zero added to it', again: 'CAN', but not 'MUST'.
+ * That's why I am comment this test. But I don't remove it due to I had
+ * unevident problem with misinterpretation of data() return (i.e. data()
+ * and c_str() provide different functionality!) and expect that this is
+ * more-or-less common pitfall.
+ * - ptr
+ */
+ string low( "2004-01-01" );
+ // Blocks A and B should follow each other.
+ // Block A:
+ xx = "123456";
+ xx += low;
+ if ( strcmp( xx.data(), "1234562004-01-01" ) != 0 ) {
+ return -1;
+ }
+ // End of block A
+
+ // Block B:
+ xx = "1234";
+ xx += ";";
+
+ if ( strcmp( xx.data(), "1234;" ) != 0 ) {
+ return -1;
+ }
+ // End of block B
+#endif
+}
+
+void StringTest::c_str()
+{
+ string low( "2004-01-01" );
+ string xx;
+ string yy;
+
+ CPPUNIT_ASSERT( *(yy.c_str()) == '\0' ); // ISO-IEC-14882:1998(E), 21.3.6, paragraph 1
+
+ // Blocks A and B should follow each other.
+ // Block A:
+ xx = "123456";
+ xx += low;
+ CPPUNIT_ASSERT( strcmp( xx.c_str(), "1234562004-01-01" ) == 0 );
+ // End of block A
+
+ // Block B:
+ xx = "1234";
+ xx += ";";
+ CPPUNIT_ASSERT( strcmp( xx.c_str(), "1234;" ) == 0 );
+ // End of block B
+}
+
+void StringTest::null_char()
+{
+ // ISO/IEC 14882:1998(E), ISO/IEC 14882:2003(E), 21.3.4 ('... the const version')
+ const string s( "123456" );
+
+ CPPUNIT_CHECK( s[s.size()] == '\0' );
+
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try {
+ //Check is only here to avoid warning about value of expression not used
+ CPPUNIT_CHECK( s.at(s.size()) == '\0' );
+ CPPUNIT_FAIL;
+ }
+ catch (out_of_range const&) {
+ CPPUNIT_ASSERT( true );
+ }
+ catch ( ... ) {
+ CPPUNIT_FAIL;
+ }
+#endif
+}
+
+void StringTest::insert()
+{
+ string strorg = "This is test string for string calls";
+ string str;
+ /*
+ * In case of reallocation there is no auto reference problem
+ * so we reserve a big enough string to be sure to test this
+ * particular point.
+ */
+ str.reserve(100);
+ str = strorg;
+
+ //test self insertion:
+ str.insert(10, str.c_str() + 5, 15);
+ CPPUNIT_ASSERT( str == "This is teis test string st string for string calls" );
+
+ str = strorg;
+ str.insert(15, str.c_str() + 5, 25);
+ CPPUNIT_ASSERT( str == "This is test stis test string for stringring for string calls" );
+
+ str = strorg;
+ str.insert(0, str.c_str() + str.size() - 4, 4);
+ CPPUNIT_ASSERT( str == "allsThis is test string for string calls" );
+
+ str = strorg;
+ str.insert(0, str.c_str() + str.size() / 2 - 1, str.size() / 2 + 1);
+ CPPUNIT_ASSERT( str == "ng for string callsThis is test string for string calls" );
+
+ str = strorg;
+ string::iterator b = str.begin();
+ string::const_iterator s = str.begin() + str.size() / 2 - 1;
+ string::const_iterator e = str.end();
+ str.insert( b, s, e );
+ CPPUNIT_ASSERT( str == "ng for string callsThis is test string for string calls" );
+
+ str = strorg;
+ str.insert(str.begin(), str.begin() + str.size() / 2 - 1, str.end());
+ CPPUNIT_ASSERT( str == "ng for string callsThis is test string for string calls" );
+
+#ifdef _STLP_MEMBER_TEMPLATES
+ vector<int> int_vect;
+ //Just a compile time test:
+ str.insert(str.end(), int_vect.begin(), int_vect.end());
+#endif
+
+ string str0;
+ str0.insert(str0.begin(), 5, '0');
+ CPPUNIT_ASSERT( str0 == "00000" );
+
+ string str1;
+ {
+ string::size_type pos = 0, nb = 2;
+ str1.insert(pos, nb, '1');
+ }
+ CPPUNIT_ASSERT( str1 == "11" );
+
+ str0.insert(0, str1);
+ CPPUNIT_ASSERT( str0 == "1100000" );
+
+ string str2("2345");
+ str0.insert(str0.size(), str2, 1, 2);
+ CPPUNIT_ASSERT( str0 == "110000034" );
+
+ str1.insert(str1.begin() + 1, 2, '2');
+ CPPUNIT_ASSERT( str1 == "1221" );
+
+ str1.insert(2, "333333", 3);
+ CPPUNIT_ASSERT( str1 == "1233321" );
+
+ str1.insert(4, "4444");
+ CPPUNIT_ASSERT( str1 == "12334444321" );
+
+ str1.insert(str1.begin() + 6, '5');
+ CPPUNIT_ASSERT( str1 == "123344544321" );
+}
+
+void StringTest::replace()
+{
+ /*
+ * This test case is for the non template basic_string::replace method,
+ * this is why we play with the const iterators and reference to guaranty
+ * that the right method is called.
+ */
+ const string v( "78" );
+ string s( "123456" );
+ string const& cs = s;
+
+ string::iterator i = s.begin() + 1;
+ s.replace(i, i + 3, v.begin(), v.end());
+ CPPUNIT_ASSERT( s == "17856" );
+
+ s = "123456";
+ i = s.begin() + 1;
+ s.replace(i, i + 1, v.begin(), v.end());
+ CPPUNIT_ASSERT( s == "1783456" );
+
+ s = "123456";
+ i = s.begin() + 1;
+ string::const_iterator ci = s.begin() + 1;
+ s.replace(i, i + 3, ci + 3, cs.end());
+ CPPUNIT_ASSERT( s == "15656" );
+
+ s = "123456";
+ i = s.begin() + 1;
+ ci = s.begin() + 1;
+ s.replace(i, i + 3, ci, ci + 2);
+ CPPUNIT_ASSERT( s == "12356" );
+
+ s = "123456";
+ i = s.begin() + 1;
+ ci = s.begin() + 1;
+ s.replace(i, i + 3, ci + 1, cs.end());
+ CPPUNIT_ASSERT( s == "1345656" );
+
+ s = "123456";
+ i = s.begin();
+ ci = s.begin() + 1;
+ s.replace(i, i, ci, ci + 1);
+ CPPUNIT_CHECK( s == "2123456" );
+
+ s = "123456";
+ s.replace(s.begin() + 4, s.end(), cs.begin(), cs.end());
+ CPPUNIT_ASSERT( s == "1234123456" );
+
+ /*
+ * This is the test for the template replace method.
+ */
+ s = "123456";
+ string::iterator b = s.begin() + 4;
+ string::iterator e = s.end();
+ string::const_iterator rb = s.begin();
+ string::const_iterator re = s.end();
+ s.replace(b, e, rb, re);
+ CPPUNIT_ASSERT( s == "1234123456" );
+
+ s = "123456";
+ s.replace(s.begin() + 4, s.end(), s.begin(), s.end());
+ CPPUNIT_ASSERT( s == "1234123456" );
+
+ string strorg("This is test string for string calls");
+ string str = strorg;
+ str.replace(5, 15, str.c_str(), 10);
+ CPPUNIT_ASSERT( str == "This This is tefor string calls" );
+
+ str = strorg;
+ str.replace(5, 5, str.c_str(), 10);
+ CPPUNIT_ASSERT( str == "This This is test string for string calls" );
+
+#if (defined (STLPORT) && defined(_STLP_MEMBER_TEMPLATES)) || ( !defined (STLPORT) && !defined(__GNUC__) )
+ deque<char> cdeque;
+ cdeque.push_back('I');
+ str.replace(str.begin(), str.begin() + 11, cdeque.begin(), cdeque.end());
+ CPPUNIT_ASSERT( str == "Is test string for string calls" );
+#endif
+}
+
+void StringTest::resize()
+{
+ string s;
+
+ s.resize(0);
+
+ CPPUNIT_ASSERT( *s.c_str() == 0 );
+
+ s = "1234567";
+
+ s.resize(0);
+ CPPUNIT_ASSERT( *s.c_str() == 0 );
+
+ s = "1234567";
+ s.resize(1);
+ CPPUNIT_ASSERT( s.size() == 1 );
+ CPPUNIT_ASSERT( *s.c_str() == '1' );
+ CPPUNIT_ASSERT( *(s.c_str() + 1) == 0 );
+
+ s = "1234567";
+ s.resize(10);
+ CPPUNIT_ASSERT( s.size() == 10 );
+ CPPUNIT_ASSERT( s[6] == '7' );
+ CPPUNIT_ASSERT( s[7] == 0 );
+ CPPUNIT_ASSERT( s[8] == 0 );
+ CPPUNIT_ASSERT( s[9] == 0 );
+}
+
+void StringTest::find()
+{
+ string s("one two three one two three");
+ CPPUNIT_ASSERT( s.find("one") == 0 );
+ CPPUNIT_ASSERT( s.find('t') == 4 );
+ CPPUNIT_ASSERT( s.find('t', 5) == 8 );
+ //We are trying to get a const reference to the npos string static member to
+ //force the compiler to allocate memory for this variable. It is used to reveal
+ //a bug of STLport which was simply declaring npos without instanciating it.
+#if defined (STLPORT) && defined (_STLP_STATIC_CONST_INIT_BUG)
+ string::size_type const& npos_local = string::npos;
+#else
+# define npos_local string::npos
+#endif
+ CPPUNIT_ASSERT( s.find("four") == npos_local );
+ CPPUNIT_ASSERT( s.find("one", string::npos) == npos_local );
+
+ CPPUNIT_ASSERT( s.find_first_of("abcde") == 2 );
+
+ CPPUNIT_ASSERT( s.find_first_not_of("enotw ") == 9 );
+
+ string empty;
+ CPPUNIT_ASSERT( s.substr(s.find(empty), empty.size()) == empty );
+}
+
+void StringTest::bogus_edge_find()
+{
+ /* ISO/IEC 14882 2003, 21.3.6.1 basic_string::find [lib.string::find]
+ *
+ * size_type find(const basic_string<charT,traits,Allocator>& str,
+ * size_type pos = 0) const;
+ * Effects: Determines the lowest position xpos, if possible, such that
+ * both of the following conditions obtain:
+ * pos <= xpos and xpos + str.size() <= size();
+ * at(xpos+I) == str.at(I) for all elements I of the string controlled by str.
+ * Returns: xpos if the function can determine such a value for xpos. Otherwise,
+ * returns npos.
+ * Notes: Uses traits::eq().
+ *
+ * ===
+ * So, from formal point of view
+ * string s; string::size_type p = s.find( "", 0, 0 );
+ * should return 0 in p, i.e. position out-of-bound of string, so
+ * code like following is bad:
+ * string s;
+ *
+ * string::size_type p = s.find( "", 0, 0 );
+ *
+ * ...
+ *
+ * if ( p != string::npos ) { // normal
+ * char ch = s[p]; // Arghhhhhhhhhh
+ * }
+ *
+ * People near Standard commete has opinion opposite to my. Even if it looks
+ * like bogus behaviour for me, it should be fixed.
+ */
+
+ {
+ string s;
+ string::size_type p = s.find( "", 0, 0 );
+
+ /* CPPUNIT_CHECK( p == string::npos ); */
+ CPPUNIT_CHECK( p == 0 ); // bogus result, isn't it?
+ }
+ {
+ string s( "123" );
+ string::size_type p = s.find( "", 0, 0 );
+
+ CPPUNIT_CHECK( p == 0 );
+ }
+ {
+ string s( "123" );
+ string::size_type p = s.find( "", 1, 0 );
+
+ CPPUNIT_CHECK( p == 1 );
+ }
+ {
+ string s( "" );
+ string::size_type p = s.find( "", 1, 0 );
+
+ CPPUNIT_CHECK( p == string::npos );
+ }
+ {
+ string s( "123" );
+ string::size_type p = s.find( "", 3, 0 );
+
+ CPPUNIT_CHECK( p == 3 ); // bogus result, isn't it?
+ }
+ {
+ string s;
+ string::size_type p = s.rfind( "", 0, 0 );
+
+ /* CPPUNIT_CHECK( p == string::npos ); */
+ CPPUNIT_CHECK( p == 0 ); // bogus result, isn't it?
+ }
+ {
+ string s( "123" );
+ string::size_type p = s.rfind( "", 0, 0 );
+
+ CPPUNIT_CHECK( p == 0 );
+ }
+ {
+ string s( "123" );
+ string::size_type p = s.rfind( "", 1, 0 );
+
+ CPPUNIT_CHECK( p == 1 );
+ }
+ {
+ string s( "" );
+ string::size_type p = s.rfind( "", 1, 0 );
+
+ CPPUNIT_CHECK( p == 0 ); // bogus result, isn't it?
+ }
+ {
+ string s( "123" );
+ string::size_type p = s.rfind( "", 3, 0 );
+
+ CPPUNIT_CHECK( p == 3 ); // bogus result, isn't it?
+ }
+}
+
+void StringTest::rfind()
+{
+ // 21.3.6.2
+ string s("one two three one two three");
+
+ CPPUNIT_ASSERT( s.rfind("two") == 18 );
+ CPPUNIT_ASSERT( s.rfind("two", 0) == string::npos );
+ CPPUNIT_ASSERT( s.rfind("two", 11) == 4 );
+ CPPUNIT_ASSERT( s.rfind('w') == 19 );
+
+ string test( "aba" );
+
+ CPPUNIT_CHECK( test.rfind( "a", 2, 1 ) == 2 );
+ CPPUNIT_CHECK( test.rfind( "a", 1, 1 ) == 0 );
+ CPPUNIT_CHECK( test.rfind( "a", 0, 1 ) == 0 );
+
+ CPPUNIT_CHECK( test.rfind( 'a', 2 ) == 2 );
+ CPPUNIT_CHECK( test.rfind( 'a', 1 ) == 0 );
+ CPPUNIT_CHECK( test.rfind( 'a', 0 ) == 0 );
+}
+
+void StringTest::find_last_of()
+{
+ // 21.3.6.4
+ string s("one two three one two three");
+
+ CPPUNIT_ASSERT( s.find_last_of("abcde") == 26 );
+
+ string test( "aba" );
+
+ CPPUNIT_CHECK( test.find_last_of( "a", 2, 1 ) == 2 );
+ CPPUNIT_CHECK( test.find_last_of( "a", 1, 1 ) == 0 );
+ CPPUNIT_CHECK( test.find_last_of( "a", 0, 1 ) == 0 );
+
+ CPPUNIT_CHECK( test.find_last_of( 'a', 2 ) == 2 );
+ CPPUNIT_CHECK( test.find_last_of( 'a', 1 ) == 0 );
+ CPPUNIT_CHECK( test.find_last_of( 'a', 0 ) == 0 );
+}
+
+void StringTest::find_last_not_of()
+{
+ // 21.3.6.6
+ string s("one two three one two three");
+
+ CPPUNIT_ASSERT( s.find_last_not_of("ehortw ") == 15 );
+
+ string test( "aba" );
+
+ CPPUNIT_CHECK( test.find_last_not_of( "a", 2, 1 ) == 1 );
+ CPPUNIT_CHECK( test.find_last_not_of( "b", 2, 1 ) == 2 );
+ CPPUNIT_CHECK( test.find_last_not_of( "a", 1, 1 ) == 1 );
+ CPPUNIT_CHECK( test.find_last_not_of( "b", 1, 1 ) == 0 );
+ CPPUNIT_CHECK( test.find_last_not_of( "a", 0, 1 ) == string::npos );
+ CPPUNIT_CHECK( test.find_last_not_of( "b", 0, 1 ) == 0 );
+
+ CPPUNIT_CHECK( test.find_last_not_of( 'a', 2 ) == 1 );
+ CPPUNIT_CHECK( test.find_last_not_of( 'b', 2 ) == 2 );
+ CPPUNIT_CHECK( test.find_last_not_of( 'a', 1 ) == 1 );
+ CPPUNIT_CHECK( test.find_last_not_of( 'b', 1 ) == 0 );
+ CPPUNIT_CHECK( test.find_last_not_of( 'a', 0 ) == string::npos );
+ CPPUNIT_CHECK( test.find_last_not_of( 'b', 0 ) == 0 );
+}
+
+void StringTest::copy()
+{
+ string s("foo");
+ char dest[4];
+ dest[0] = dest[1] = dest[2] = dest[3] = 1;
+ s.copy(dest, 4);
+ int pos = 0;
+ CPPUNIT_ASSERT( dest[pos++] == 'f' );
+ CPPUNIT_ASSERT( dest[pos++] == 'o' );
+ CPPUNIT_ASSERT( dest[pos++] == 'o' );
+ CPPUNIT_ASSERT( dest[pos++] == 1 );
+
+ dest[0] = dest[1] = dest[2] = dest[3] = 1;
+ s.copy(dest, 4, 2);
+ pos = 0;
+ CPPUNIT_ASSERT( dest[pos++] == 'o' );
+ CPPUNIT_ASSERT( dest[pos++] == 1 );
+
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try {
+ s.copy(dest, 4, 5);
+ CPPUNIT_FAIL;
+ }
+ catch (out_of_range const&) {
+ }
+ catch ( ... ) {
+ CPPUNIT_FAIL;
+ }
+#endif
+}
+
+void StringTest::assign()
+{
+ string s;
+ char const* cstr = "test string for assign";
+
+ s.assign(cstr, cstr + 22);
+ CPPUNIT_ASSERT( s == "test string for assign" );
+
+ string s2("other test string");
+ s.assign(s2);
+ CPPUNIT_ASSERT( s == s2 );
+
+ static string str1;
+ static string str2;
+
+ // short string optim:
+ str1 = "123456";
+ // longer than short string:
+ str2 = "1234567890123456789012345678901234567890";
+
+ CPPUNIT_ASSERT(str1[5] == '6');
+ CPPUNIT_ASSERT(str2[29] == '0');
+}
+
+/* This test is to check if string properly supports the short string
+ * optimization. It has been found out that eMbedded Visual C++ 3.0 and .NET
+ * compilers for the ARM platform fail to pass structs and classes of certain
+ * size per value. This seems to be a known compiler bug. For other processors
+ * (e.g. x86) the error doesn't occur.
+ * (The ARM compiler creates a temporary object from teststr on the stack, to
+ * pass it to the helper function. It uses the copy constructor for this.
+ * After this the temporary object is copied to another place on the stack.
+ * The result is that the _M_finish pointer then points to the wrong buffer
+ * end and the size of the short string is incorrectly calculated.)
+ */
+void StringTest::short_string_optim_bug()
+{
+ string teststr("shortest");
+
+ bool short_string_optim_bug_helper(string teststr);
+
+ CPPUNIT_ASSERT(true == short_string_optim_bug_helper(teststr));
+}
+
+bool short_string_optim_bug_helper(string teststr)
+{
+ size_t ss = teststr.size();
+ return (ss == 8);
+}
+
+void StringTest::compare()
+{
+ string str1("abcdef");
+ string str2;
+
+ str2 = "abcdef";
+ CPPUNIT_ASSERT( str1.compare(str2) == 0 );
+ str2 = "abcde";
+ CPPUNIT_ASSERT( str1.compare(str2) > 0 );
+ str2 = "abcdefg";
+ CPPUNIT_ASSERT( str1.compare(str2) < 0 );
+
+ CPPUNIT_ASSERT( str1.compare("abcdef") == 0 );
+ CPPUNIT_ASSERT( str1.compare("abcde") > 0 );
+ CPPUNIT_ASSERT( str1.compare("abcdefg") < 0 );
+
+ str2 = "cde";
+ CPPUNIT_ASSERT( str1.compare(2, 3, str2) == 0 );
+ str2 = "cd";
+ CPPUNIT_ASSERT( str1.compare(2, 3, str2) > 0 );
+ str2 = "cdef";
+ CPPUNIT_ASSERT( str1.compare(2, 3, str2) < 0 );
+
+ str2 = "abcdef";
+ CPPUNIT_ASSERT( str1.compare(2, 3, str2, 2, 3) == 0 );
+ CPPUNIT_ASSERT( str1.compare(2, 3, str2, 2, 2) > 0 );
+ CPPUNIT_ASSERT( str1.compare(2, 3, str2, 2, 4) < 0 );
+
+ CPPUNIT_ASSERT( str1.compare(2, 3, "cdefgh", 3) == 0 );
+ CPPUNIT_ASSERT( str1.compare(2, 3, "cdefgh", 2) > 0 );
+ CPPUNIT_ASSERT( str1.compare(2, 3, "cdefgh", 4) < 0 );
+}
+
+/*
+class mystring : public string {
+public:
+ mystring() {}
+ mystring(string const& s) : string(s) {}
+
+ mystring& operator = (string const& s) {
+ string::operator = (s);
+ return *this;
+ };
+};
+*/
+
+void StringTest::template_expression()
+{
+ string one("one"), two("two"), three("three");
+ string space(1, ' ');
+
+ // check availability of [un]equality operators
+ {
+ // string-string
+ one == two;
+ one != two;
+ // string-literal
+ one == "two";
+ one != "two";
+ // literal-string
+ "one" == two;
+ "one" != two;
+ // strsum-string
+ (one + two) == three;
+ (one + two) != three;
+ // string-strsum
+ one == (two + three);
+ one != (two + three);
+ // strsum-literal
+ (one + two) == "three";
+ (one + two) != "three";
+ // literal-strsum
+ "one" == (two + three);
+ "one" != (two + three);
+ // strsum-strsum
+ (one + two) == (two + three);
+ (one + two) != (two + three);
+ }
+
+ {
+ string result(one + ' ' + two + ' ' + three);
+ CPPUNIT_CHECK( result == "one two three" );
+ }
+
+ {
+ string result(one + ' ' + two + ' ' + three, 4);
+ CPPUNIT_CHECK( result == "two three" );
+ }
+
+ {
+ string result(one + ' ' + two + ' ' + three, 4, 3);
+ CPPUNIT_CHECK( result == "two" );
+ }
+
+ //2 members expressions:
+ CPPUNIT_CHECK( (' ' + one) == " one" );
+ CPPUNIT_CHECK( (one + ' ') == "one " );
+ CPPUNIT_CHECK( (one + " two") == "one two" );
+ CPPUNIT_CHECK( ("one " + two) == "one two" );
+ CPPUNIT_CHECK( (one + space) == "one " );
+
+ //3 members expressions:
+ CPPUNIT_CHECK( ((one + space) + "two") == "one two" );
+ CPPUNIT_CHECK( ("one" + (space + two)) == "one two" );
+ CPPUNIT_CHECK( ((one + space) + two) == "one two" );
+ CPPUNIT_CHECK( (one + (space + two)) == "one two" );
+ CPPUNIT_CHECK( ((one + space) + 't') == "one t" );
+ CPPUNIT_CHECK( ('o' + (space + two)) == "o two" );
+
+ //4 members expressions:
+ CPPUNIT_CHECK( ((one + space) + (two + space)) == "one two " );
+
+ //special operators
+ {
+ string result;
+ result = one + space + two;
+ CPPUNIT_CHECK( result == "one two" );
+
+ result += space + three;
+ CPPUNIT_CHECK( result == "one two three" );
+ }
+
+ //special append method
+ {
+ string result;
+ //Use reserve to avoid reallocation and really test auto-referencing problems:
+ result.reserve(64);
+
+ result.append(one + space + two);
+ CPPUNIT_CHECK( result == "one two" );
+
+ result.append(space + result + space + three);
+ CPPUNIT_CHECK( result == "one two one two three" );
+
+ result = "one two";
+ result.append(space + three, 1, 2);
+ CPPUNIT_ASSERT( result == "one twoth" );
+
+ result.append(space + result);
+ CPPUNIT_CHECK( result == "one twoth one twoth" );
+ }
+
+ //special assign method
+ {
+ string result;
+ //Use reserve to avoid reallocation and really test auto-referencing problems:
+ result.reserve(64);
+
+ result.assign(one + space + two + space + three);
+ CPPUNIT_CHECK( result == "one two three" );
+
+ result.assign(one + space + two + space + three, 3, 5);
+ CPPUNIT_CHECK( result == " two " );
+
+ result.assign(one + result + three);
+ CPPUNIT_CHECK( result == "one two three" );
+ }
+
+ {
+ CPPUNIT_CHECK( !(one + ' ' + two).empty() );
+
+ char result = (one + ' ' + two)[3];
+ CPPUNIT_CHECK( result == ' ' );
+
+ result = (one + ' ' + two).at(3);
+ CPPUNIT_CHECK( result == ' ' );
+
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try {
+ result = (one + ' ' + two).at(10);
+ CPPUNIT_FAIL;
+ }
+ catch (out_of_range const&) {
+ CPPUNIT_ASSERT( result == ' ' );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+#endif
+ }
+
+ /*
+ mystring a("ing");
+ //gcc failed to compile following expression when template expressions are activated.
+ //MSVC sees no problem. gcc limitation or MSVC is too cool ??
+ mystring b = "str" + a;
+ */
+}
+
+#if !defined (TE_TMP_TEST_IGNORED)
+class superstring
+{
+ public:
+ superstring() :
+ s("super")
+ {}
+
+ superstring( const string& str ) :
+ s( str )
+ {}
+
+ superstring operator / (const string& str )
+ { return superstring( s + "/" + str ); }
+
+ superstring operator / (const char* str )
+ { return superstring( s + "/" + str ); }
+
+ private:
+ string s;
+};
+#endif
+
+void StringTest::te_tmp()
+{
+#if !defined (TE_TMP_TEST_IGNORED)
+ superstring s;
+ string more( "more" );
+ string less( "less" );
+
+ superstring r = s / (more + less);
+#endif
+}
+
+class mypath
+{
+ public:
+ mypath( const string& s ) :
+ p( s )
+ { }
+
+ const mypath& operator / ( const string& );
+ const string& str() const
+ { return p; }
+
+ private:
+ string p;
+};
+
+const mypath& mypath::operator /( const string& s )
+{
+ p += '/';
+ p += s;
+ return *this;
+}
+
+void StringTest::oper_tmp()
+{
+ string s1( "path1" );
+ string s2( ".ext" );
+
+ string& rs1 = s1;
+ string& rs2 = s2;
+
+ CPPUNIT_CHECK( (mypath( string( "/root" ) ) / (rs1 + rs2)).str() == "/root/path1.ext" );
+}
+
+void StringTest::template_wexpression()
+{
+#if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+# if !defined (__CYGWIN__) || defined (STLPORT)
+ wstring one(L"one"), two(L"two"), three(L"three");
+ wstring space(L" ");
+
+ {
+ wstring result(one + L' ' + two + L' ' + three);
+ CPPUNIT_CHECK( result == L"one two three" );
+ }
+
+ {
+ wstring result(one + L' ' + two + L' ' + three, 4);
+ CPPUNIT_CHECK( result == L"two three" );
+ }
+
+ {
+ wstring result(one + L' ' + two + L' ' + three, 4, 3);
+ CPPUNIT_CHECK( result == L"two" );
+ }
+
+ //2 members expressions:
+ CPPUNIT_CHECK( (L' ' + one) == L" one" );
+ CPPUNIT_CHECK( (one + L' ') == L"one " );
+ CPPUNIT_CHECK( (one + L" two") == L"one two" );
+ CPPUNIT_CHECK( (L"one " + two) == L"one two" );
+ CPPUNIT_CHECK( (one + space) == L"one " );
+
+ //3 members expressions:
+ CPPUNIT_CHECK( ((one + space) + L"two") == L"one two" );
+ CPPUNIT_CHECK( (L"one" + (space + two)) == L"one two" );
+ CPPUNIT_CHECK( ((one + space) + two) == L"one two" );
+ CPPUNIT_CHECK( (one + (space + two)) == L"one two" );
+ CPPUNIT_CHECK( ((one + space) + L't') == L"one t" );
+ CPPUNIT_CHECK( (L'o' + (space + two)) == L"o two" );
+
+ //4 members expressions:
+ CPPUNIT_CHECK( ((one + space) + (two + space)) == L"one two " );
+
+ //special operators
+ {
+ wstring result;
+ result = one + space + two;
+ CPPUNIT_CHECK( result == L"one two" );
+
+ result += space + three;
+ CPPUNIT_CHECK( result == L"one two three" );
+ }
+
+ //special append method
+ {
+ wstring result;
+ //Use reserve to avoid reallocation and really test auto-referencing problems:
+ result.reserve(64);
+
+ result.append(one + space + two);
+ CPPUNIT_CHECK( result == L"one two" );
+
+ result.append(space + result + space + three);
+ CPPUNIT_CHECK( result == L"one two one two three" );
+
+ result = L"one two";
+ result.append(space + three, 1, 2);
+ CPPUNIT_ASSERT( result == L"one twoth" );
+
+ result.append(space + result);
+ CPPUNIT_CHECK( result == L"one twoth one twoth" );
+ }
+
+ //special assign method
+ {
+ wstring result;
+ //Use reserve to avoid reallocation and really test auto-referencing problems:
+ result.reserve(64);
+
+ result.assign(one + space + two + space + three);
+ CPPUNIT_CHECK( result == L"one two three" );
+
+ result.assign(one + space + two + space + three, 3, 5);
+ CPPUNIT_CHECK( result == L" two " );
+
+ result.assign(one + result + three);
+ CPPUNIT_CHECK( result == L"one two three" );
+ }
+
+ {
+ CPPUNIT_CHECK( !(one + L' ' + two).empty() );
+
+ wchar_t result = (one + L' ' + two)[3];
+ CPPUNIT_CHECK( result == L' ' );
+
+ result = (one + L' ' + two).at(3);
+ CPPUNIT_CHECK( result == L' ' );
+
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try {
+ result = (one + L' ' + two).at(10);
+ CPPUNIT_FAIL;
+ }
+ catch (out_of_range const&) {
+ CPPUNIT_ASSERT( result == L' ' );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+ }
+# endif
+#endif
+}
+
+void StringTest::io()
+{
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+ string str("STLport");
+ {
+ ostringstream ostr;
+ ostr << str;
+ CPPUNIT_ASSERT( ostr.good() );
+ CPPUNIT_ASSERT( ostr.str() == str );
+ }
+ {
+ istringstream istr(str);
+ string istr_content;
+ istr >> istr_content;
+ CPPUNIT_ASSERT( !istr.fail() && istr.eof() );
+ CPPUNIT_ASSERT( istr_content == str );
+ }
+ {
+ istringstream istr(str);
+ istr.width(3);
+ string istr_content;
+ istr >> istr_content;
+ CPPUNIT_ASSERT( !istr.fail() && !istr.eof() );
+ CPPUNIT_ASSERT( istr_content == "STL" );
+ }
+#endif
+}
+
+void StringTest::allocator_with_state()
+{
+#if !(defined (STLPORT) && defined (_STLP_NO_CUSTOM_IO))
+
+ char buf1[1024];
+ StackAllocator<char> stack1(buf1, buf1 + sizeof(buf1));
+
+ char buf2[1024];
+ StackAllocator<char> stack2(buf2, buf2 + sizeof(buf2));
+
+ typedef basic_string<char, char_traits<char>, StackAllocator<char> > StackString;
+ {
+ StackString str1("string stack1", stack1);
+ StackString str1Cpy(str1);
+
+ StackString str2("string stack2", stack2);
+ StackString str2Cpy(str2);
+
+ str1.swap(str2);
+
+ CPPUNIT_ASSERT( str1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( str2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( str1 == str2Cpy );
+ CPPUNIT_ASSERT( str2 == str1Cpy );
+ CPPUNIT_ASSERT( str1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( str2.get_allocator() == stack1 );
+ }
+ CPPUNIT_ASSERT( stack1.ok() );
+ CPPUNIT_ASSERT( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+ {
+ StackString str1("longer string from stack1 allocator instance for dynamic allocation", stack1);
+ StackString str1Cpy(str1);
+
+ StackString str2("longer string from stack2 allocator instance for dynamic allocation", stack2);
+ StackString str2Cpy(str2);
+
+ str1.swap(str2);
+
+ CPPUNIT_ASSERT( str1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( str2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( str1 == str2Cpy );
+ CPPUNIT_ASSERT( str2 == str1Cpy );
+ CPPUNIT_ASSERT( str1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( str2.get_allocator() == stack1 );
+ }
+ CPPUNIT_ASSERT( stack1.ok() );
+ CPPUNIT_ASSERT( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+
+ {
+ StackString str1("string stack1", stack1);
+ StackString str1Cpy(str1);
+
+ StackString str2("longer string from stack2 allocator instance for dynamic allocation", stack2);
+ StackString str2Cpy(str2);
+
+ str1.swap(str2);
+
+ CPPUNIT_ASSERT( str1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( str2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( str1 == str2Cpy );
+ CPPUNIT_ASSERT( str2 == str1Cpy );
+ CPPUNIT_ASSERT( str1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( str2.get_allocator() == stack1 );
+ }
+ CPPUNIT_ASSERT( stack1.ok() );
+ CPPUNIT_ASSERT( stack2.ok() );
+ stack1.reset(); stack2.reset();
+
+
+ {
+ StackString str1("longer string from stack1 allocator instance for dynamic allocation", stack1);
+ StackString str1Cpy(str1);
+
+ StackString str2("string stack2", stack2);
+ StackString str2Cpy(str2);
+
+ str1.swap(str2);
+
+ CPPUNIT_ASSERT( str1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( str2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( str1 == str2Cpy );
+ CPPUNIT_ASSERT( str2 == str1Cpy );
+ CPPUNIT_ASSERT( str1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( str2.get_allocator() == stack1 );
+ }
+ CPPUNIT_ASSERT( stack1.ok() );
+ CPPUNIT_ASSERT( stack2.ok() );
+ stack1.reset(); stack2.reset();
+#endif
+}
+
+void StringTest::capacity()
+{
+ string s;
+
+ CPPUNIT_CHECK( s.capacity() > 0 );
+ CPPUNIT_CHECK( s.capacity() < s.max_size() );
+ CPPUNIT_CHECK( s.capacity() >= s.size() );
+
+#ifndef _STLP_SHORT_STRING_SZ
+# define _STLP_SHORT_STRING_SZ 16 // see stlport/stl/_string_base.h
+#endif
+
+ for ( int i = 0; i < _STLP_SHORT_STRING_SZ + 2; ++i ) {
+ s += ' ';
+ CPPUNIT_CHECK( s.capacity() > 0 );
+ CPPUNIT_CHECK( s.capacity() < s.max_size() );
+ CPPUNIT_CHECK( s.capacity() >= s.size() );
+ }
+}
+
+void StringTest::concat24()
+{
+ string s = string( "123456789012345678901234" ) + string( "123456789012345678901234" );
+
+ CPPUNIT_CHECK( s.length() == 48 );
+ CPPUNIT_CHECK( s[23] == '4' );
+ CPPUNIT_CHECK( s[24] == '1' );
+ CPPUNIT_CHECK( s[47] == '4' );
+}
diff --git a/test/unit/strstream_buffer_read_test.cpp b/test/unit/strstream_buffer_read_test.cpp
new file mode 100644
index 0000000..978ac0c
--- /dev/null
+++ b/test/unit/strstream_buffer_read_test.cpp
@@ -0,0 +1,35 @@
+/*
+ * Note: Strstreams are really broken in STLport. But strstreams are
+ * obsolete, and even if ones was mentioned in D7.1--D7.4 of
+ * Standard, we have no wish to spent time with repair ones.
+ */
+#if !defined (_STLP_NO_IOSTREAMS)
+# include <strstream>
+
+# include "cppunit/cppunit_proxy.h"
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+class StrstreamBufferTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(StrstreamBufferTest);
+ CPPUNIT_TEST(read_from_buffer);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void read_from_buffer();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(StrstreamBufferTest);
+
+void StrstreamBufferTest::read_from_buffer()
+{
+ char hello[] = "Hello";
+ strstream stream(hello, sizeof(hello), ios_base::in);
+ char cur;
+ stream >> cur;
+ CPPUNIT_ASSERT(cur == 'H');
+}
+#endif
diff --git a/test/unit/strstream_header_test.cpp b/test/unit/strstream_header_test.cpp
new file mode 100644
index 0000000..3d7504a
--- /dev/null
+++ b/test/unit/strstream_header_test.cpp
@@ -0,0 +1,10 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#if !defined (_STLP_NO_IOSTREAMS)
+# include <strstream>
+#endif
diff --git a/test/unit/strstream_test.cpp b/test/unit/strstream_test.cpp
new file mode 100644
index 0000000..195570c
--- /dev/null
+++ b/test/unit/strstream_test.cpp
@@ -0,0 +1,49 @@
+#include <string>
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <strstream>
+# include <limits>
+
+# include "cppunit/cppunit_proxy.h"
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+//
+// TestCase class
+//
+class StrstreamTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(StrstreamTest);
+ CPPUNIT_TEST(input);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ void input();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(StrstreamTest);
+
+//
+// tests implementation
+//
+void StrstreamTest::input()
+{
+# if defined (STLPORT) && defined (_STLP_LONG_LONG)
+ {
+ istrstream is("652208307");
+ _STLP_LONG_LONG rval = 0;
+ is >> rval;
+ CPPUNIT_ASSERT( rval == 652208307 );
+ }
+ {
+ istrstream is("-652208307");
+ _STLP_LONG_LONG rval = 0;
+ is >> rval;
+ CPPUNIT_ASSERT( rval == -652208307 );
+ }
+}
+# endif
+
+#endif
diff --git a/test/unit/swap_test.cpp b/test/unit/swap_test.cpp
new file mode 100644
index 0000000..056cabf
--- /dev/null
+++ b/test/unit/swap_test.cpp
@@ -0,0 +1,165 @@
+#include <vector>
+#include <algorithm>
+#include <vector>
+#include <queue>
+
+#if 0 /* temporary: investigation of problem with swap */
+#include <iostream>
+#include <typeinfo>
+#endif
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class SwapTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(SwapTest);
+ CPPUNIT_TEST(swap1);
+ CPPUNIT_TEST(swprnge1);
+ CPPUNIT_TEST(swap_container_non_spec);
+#if defined (STLPORT) && \
+ !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(swap_container_spec);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void swap1();
+ void swprnge1();
+ void swap_container_non_spec();
+ void swap_container_spec();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwapTest);
+
+//
+// tests implementation
+//
+void SwapTest::swap1()
+{
+ int a = 42;
+ int b = 19;
+ swap(a, b);
+
+ CPPUNIT_ASSERT(a==19);
+ CPPUNIT_ASSERT(b==42);
+}
+
+void SwapTest::swprnge1()
+{
+ char word1[] = "World";
+ char word2[] = "Hello";
+ swap_ranges((char*)word1, (char*)word1 + ::strlen(word1), (char*)word2);
+ CPPUNIT_ASSERT(!strcmp(word1, "Hello"));
+ CPPUNIT_ASSERT(!strcmp(word2, "World"));
+}
+
+class Obj
+{
+ public:
+ Obj() :
+ v( 0 )
+ { }
+ Obj( const Obj& ) :
+ v( 1 )
+ { }
+
+ Obj& operator =( const Obj& )
+ { v = 2; return *this; }
+
+ int v;
+};
+
+/*
+ * Following two tests check the corectness of specialization of swap():
+ * for containers with container::swap method swap( a, b ) should
+ * use a.swap( b ), but don't try to do this substitution for container
+ * without swap method (in this case swap should be made via explicit members
+ * exchange; this assume usage of temporary object)
+ *
+ */
+void SwapTest::swap_container_non_spec()
+{
+ queue<Obj> v1;
+ queue<Obj> v2;
+
+ v1.push( Obj() );
+ v1.back().v = -1;
+ v1.push( Obj() );
+ v1.back().v = -2;
+
+ v2.push( Obj() );
+ v2.back().v = 10;
+ v2.push( Obj() );
+ v2.back().v = 11;
+ v2.push( Obj() );
+ v2.back().v = 12;
+
+ CPPUNIT_CHECK( v1.size() == 2 );
+ CPPUNIT_CHECK( v2.size() == 3 );
+
+ swap( v1, v2 ); // this shouldn't try make it as v1.swap( v2 ), no queue::swap method!
+
+ CPPUNIT_CHECK( v1.size() == 3 );
+ CPPUNIT_CHECK( v2.size() == 2 );
+
+ // either copy constructor or assignment operator
+ CPPUNIT_CHECK( v1.front().v == 1 || v1.front().v == 2 );
+ CPPUNIT_CHECK( v1.back().v == 1 || v1.back().v == 2 );
+ CPPUNIT_CHECK( v2.front().v == 1 || v2.front().v == 2 );
+ CPPUNIT_CHECK( v2.back().v == 1 || v2.back().v == 2 );
+}
+
+void SwapTest::swap_container_spec()
+{
+#if 0 /* temporary: investigation of problem with swap */
+ if ( typeid(/* _STLP_PRIV */ _SwapImplemented<vector<Obj> >::_Ret) == typeid(_STLP_PRIV __false_type) ) {
+ cerr << "false type" << endl;
+ } else if ( typeid(/* _STLP_PRIV */ _SwapImplemented<vector<Obj> >::_Ret) == typeid(_STLP_PRIV __true_type) ) {
+ cerr << "true type" << endl;
+ } else {
+ cerr << "unknown type" << endl;
+ }
+#endif /* end of temporary */
+#if !defined (STLPORT) || \
+ defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ vector<Obj> v1;
+ vector<Obj> v2;
+
+ v1.push_back( Obj() );
+ v1.push_back( Obj() );
+
+ v1[0].v = -1;
+ v1[1].v = -2;
+
+ v2.push_back( Obj() );
+ v2.push_back( Obj() );
+ v2.push_back( Obj() );
+
+ v2[0].v = 10;
+ v2[1].v = 11;
+ v2[2].v = 12;
+
+ CPPUNIT_CHECK( v1.size() == 2 );
+ CPPUNIT_CHECK( v2.size() == 3 );
+
+ swap( v1, v2 ); // this should has effect v1.swap( v2 )
+
+ CPPUNIT_CHECK( v1.size() == 3 );
+ CPPUNIT_CHECK( v2.size() == 2 );
+
+ CPPUNIT_CHECK( v1[0].v == 10 );
+ CPPUNIT_CHECK( v1[1].v == 11 );
+ CPPUNIT_CHECK( v1[2].v == 12 );
+
+ CPPUNIT_CHECK( v2[0].v == -1 );
+ CPPUNIT_CHECK( v2[1].v == -2 );
+#endif
+}
diff --git a/test/unit/test_errno.cpp b/test/unit/test_errno.cpp
new file mode 100644
index 0000000..ad77d3a
--- /dev/null
+++ b/test/unit/test_errno.cpp
@@ -0,0 +1,56 @@
+//We are including stdlib.h and stddef.h first because under MSVC
+//those headers contains a errno macro definition without the underlying value
+//definition.
+#include <stdlib.h>
+#include <stddef.h>
+
+#include <errno.h>
+#include <errno.h> // not typo, check errno def/undef/redef
+
+#ifndef _STLP_WCE
+
+#include "cppunit/cppunit_proxy.h"
+
+//
+// TestCase class
+//
+class ErrnoTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(ErrnoTest);
+ CPPUNIT_TEST(check);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void check();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ErrnoTest);
+
+void ErrnoTest::check()
+{
+ //We are using ERANGE as it is part of the C++ ISO (see Table 26 in section 19.3)
+ //Using ERANGE improve the test as it means that the native errno.h file has really
+ //been included.
+ errno = ERANGE;
+
+ CPPUNIT_ASSERT( errno == ERANGE );
+ errno = 0;
+
+/* Note: in common, you can't write ::errno or std::errno,
+ * due to errno in most cases is just a macro, that frequently
+ * (in MT environment errno is a per-thread value) expand to something like
+ * (*__errno_location()). I don't know way how masquerade such
+ * things: name of macro can't include ::.
+ *
+ * - ptr, 2005-03-30
+ */
+# if 0
+ if ( ::errno != 0 ) {
+ return 1;
+ }
+ if ( std::errno != 0 ) {
+ return 1;
+ }
+# endif
+}
+#endif // _STLP_WCE
diff --git a/test/unit/time_facets_test.cpp b/test/unit/time_facets_test.cpp
new file mode 100644
index 0000000..19a7a3a
--- /dev/null
+++ b/test/unit/time_facets_test.cpp
@@ -0,0 +1,402 @@
+#include "locale_test.h"
+
+#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
+# include <locale>
+# include <sstream>
+# include <memory>
+# include <stdexcept>
+
+# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# endif
+
+static const char* tested_locales[] = {
+// name,
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ "fr_FR",
+ "ru_RU.koi8r",
+ "en_GB",
+ "en_US",
+# endif
+ "",
+ "C"
+};
+
+void LocaleTest::_time_put_get( const locale& loc )
+{
+ {
+ typedef time_put<char, ostreambuf_iterator<char, char_traits<char> > > time_put_facet;
+ CPPUNIT_ASSERT( has_facet<time_put_facet>(loc) );
+ const time_put_facet& tmp = use_facet<time_put_facet>(loc);
+
+ struct tm xmas = { 0, 0, 12, 25, 11, 93 };
+ ostringstream ostr;
+ ostr.imbue(loc);
+ string format = "%B %d %Y";
+
+ time_put_facet::iter_type ret = tmp.put(ostr, ostr, ' ', &xmas, format.data(), format.data() + format.size());
+ CPPUNIT_ASSERT( !ret.failed() );
+
+ /*
+ * In other words, user conformation is required for reliable parsing
+ * of user-entered dates and times, but machine-generated formats can be
+ * parsed reliably. This allows parsers to be aggressive about interpreting
+ * user variations on standard format.
+ *
+ * ISO/IEC 14882, 22.2.5.1
+ */
+ typedef time_get<char, istreambuf_iterator<char, char_traits<char> > > time_get_facet;
+ CPPUNIT_ASSERT( has_facet<time_get_facet>(loc) );
+ const time_get_facet& tmg = use_facet<time_get_facet>(loc);
+ basic_ios<char> io(0);
+ io.imbue(loc);
+
+ istringstream istr( ostr.str() );
+ istreambuf_iterator<char, char_traits<char> > i( istr );
+ istreambuf_iterator<char, char_traits<char> > e;
+ ios_base::iostate err = ios_base::goodbit;
+ struct tm other = { 15, 20, 9, 14, 7, 105 };
+
+ i = tmg.get_monthname( i, e, io, err, &other );
+ CPPUNIT_ASSERT( err == ios_base::goodbit );
+ CPPUNIT_ASSERT( other.tm_mon == xmas.tm_mon );
+
+ ++i; ++i; ++i; ++i; // skip day of month and spaces around it
+ i = tmg.get_year( i, e, io, err, &other );
+
+ CPPUNIT_ASSERT( err == ios_base::eofbit );
+ CPPUNIT_ASSERT( other.tm_year == xmas.tm_year );
+
+ ostringstream ostrX;
+ ostrX.imbue(loc);
+ format = "%x %X";
+
+ ret = tmp.put(ostrX, ostrX, ' ', &xmas, format.data(), format.data() + format.size());
+ CPPUNIT_ASSERT( !ret.failed() );
+
+ istringstream istrX( ostrX.str() );
+ istreambuf_iterator<char, char_traits<char> > j( istrX );
+
+ err = ios_base::goodbit;
+
+ struct tm yet_more = { 15, 20, 9, 14, 7, 105 };
+
+ j = tmg.get_date( j, e, io, err, &yet_more );
+
+ CPPUNIT_ASSERT( err == ios_base::goodbit );
+
+ CPPUNIT_ASSERT( yet_more.tm_sec != xmas.tm_sec );
+ CPPUNIT_ASSERT( yet_more.tm_min != xmas.tm_min );
+ CPPUNIT_ASSERT( yet_more.tm_hour != xmas.tm_hour );
+ CPPUNIT_ASSERT( yet_more.tm_mday == xmas.tm_mday );
+ CPPUNIT_ASSERT( yet_more.tm_mon == xmas.tm_mon );
+ CPPUNIT_ASSERT( yet_more.tm_year == xmas.tm_year );
+
+ ++j; // skip space
+
+ j = tmg.get_time( j, e, io, err, &yet_more );
+
+ CPPUNIT_ASSERT( err == ios_base::eofbit || err == ios_base::goodbit );
+
+ CPPUNIT_ASSERT( yet_more.tm_sec == xmas.tm_sec );
+ CPPUNIT_ASSERT( yet_more.tm_min == xmas.tm_min );
+ CPPUNIT_ASSERT( yet_more.tm_hour == xmas.tm_hour );
+ CPPUNIT_ASSERT( yet_more.tm_mday == xmas.tm_mday );
+ CPPUNIT_ASSERT( yet_more.tm_mon == xmas.tm_mon );
+ CPPUNIT_ASSERT( yet_more.tm_year == xmas.tm_year );
+ }
+# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+ {
+ typedef time_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > time_put_facet;
+ CPPUNIT_ASSERT( has_facet<time_put_facet>(loc) );
+ const time_put_facet& tmp = use_facet<time_put_facet>(loc);
+
+ struct tm xmas = { 0, 0, 12, 25, 11, 93 };
+ wostringstream ostr;
+ ostr.imbue(loc);
+ wstring format = L"%B %d %Y";
+
+ time_put_facet::iter_type ret = tmp.put(ostr, ostr, ' ', &xmas, format.data(), format.data() + format.size());
+ CPPUNIT_ASSERT( !ret.failed() );
+
+ /*
+ * In other words, user conformation is required for reliable parsing
+ * of user-entered dates and times, but machine-generated formats can be
+ * parsed reliably. This allows parsers to be aggressive about interpreting
+ * user variations on standard format.
+ *
+ * ISO/IEC 14882, 22.2.5.1
+ */
+ typedef time_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > time_get_facet;
+ CPPUNIT_ASSERT( has_facet<time_get_facet>(loc) );
+ const time_get_facet& tmg = use_facet<time_get_facet>(loc);
+ // Intentional instantiation with char to show a bug in a previous STLport version.
+ basic_ios<char> io(0);
+ io.imbue(loc);
+
+ wistringstream istr( ostr.str() );
+ istreambuf_iterator<wchar_t, char_traits<wchar_t> > i( istr );
+ istreambuf_iterator<wchar_t, char_traits<wchar_t> > e;
+ ios_base::iostate err = ios_base::goodbit;
+ struct tm other = { 15, 20, 9, 14, 7, 105 };
+
+ i = tmg.get_monthname( i, e, io, err, &other );
+ CPPUNIT_ASSERT( err == ios_base::goodbit );
+ CPPUNIT_ASSERT( other.tm_mon == xmas.tm_mon );
+
+ ++i; ++i; ++i; ++i; // skip day of month and spaces around it
+ i = tmg.get_year( i, e, io, err, &other );
+
+ CPPUNIT_ASSERT( err == ios_base::eofbit );
+ CPPUNIT_ASSERT( other.tm_year == xmas.tm_year );
+
+ wostringstream ostrX;
+ ostrX.imbue(loc);
+ format = L"%x %X";
+
+ ret = tmp.put(ostrX, ostrX, ' ', &xmas, format.data(), format.data() + format.size());
+ CPPUNIT_ASSERT( !ret.failed() );
+
+ wistringstream istrX( ostrX.str() );
+ istreambuf_iterator<wchar_t, char_traits<wchar_t> > j( istrX );
+
+ err = ios_base::goodbit;
+
+ struct tm yet_more = { 15, 20, 9, 14, 7, 105 };
+
+ j = tmg.get_date( j, e, io, err, &yet_more );
+
+ CPPUNIT_ASSERT( err == ios_base::goodbit );
+
+ CPPUNIT_ASSERT( yet_more.tm_sec != xmas.tm_sec );
+ CPPUNIT_ASSERT( yet_more.tm_min != xmas.tm_min );
+ CPPUNIT_ASSERT( yet_more.tm_hour != xmas.tm_hour );
+ CPPUNIT_ASSERT( yet_more.tm_mday == xmas.tm_mday );
+ CPPUNIT_ASSERT( yet_more.tm_mon == xmas.tm_mon );
+ CPPUNIT_ASSERT( yet_more.tm_year == xmas.tm_year );
+
+ ++j; // skip space
+
+ j = tmg.get_time( j, e, io, err, &yet_more );
+
+ CPPUNIT_ASSERT( err == ios_base::eofbit || err == ios_base::goodbit );
+
+ CPPUNIT_ASSERT( yet_more.tm_sec == xmas.tm_sec );
+ CPPUNIT_ASSERT( yet_more.tm_min == xmas.tm_min );
+ CPPUNIT_ASSERT( yet_more.tm_hour == xmas.tm_hour );
+ CPPUNIT_ASSERT( yet_more.tm_mday == xmas.tm_mday );
+ CPPUNIT_ASSERT( yet_more.tm_mon == xmas.tm_mon );
+ CPPUNIT_ASSERT( yet_more.tm_year == xmas.tm_year );
+ }
+# endif
+}
+
+typedef void (LocaleTest::*_Test) (const locale&);
+static void test_supported_locale(LocaleTest& inst, _Test __test) {
+ size_t n = sizeof(tested_locales) / sizeof(tested_locales[0]);
+ for (size_t i = 0; i < n; ++i) {
+ locale loc;
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try
+# endif
+ {
+ locale tmp(tested_locales[i]);
+ loc = tmp;
+ }
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ catch (runtime_error const&) {
+ //This locale is not supported.
+ continue;
+ }
+# endif
+ CPPUNIT_MESSAGE( loc.name().c_str() );
+ (inst.*__test)(loc);
+
+ {
+ locale tmp(locale::classic(), tested_locales[i], locale::time);
+ loc = tmp;
+ }
+ (inst.*__test)(loc);
+
+ {
+ typedef time_put_byname<char, ostreambuf_iterator<char, char_traits<char> > > time_put_facet;
+ locale tmp0(locale::classic(), new time_put_facet(tested_locales[i]));
+ typedef time_get_byname<char, istreambuf_iterator<char, char_traits<char> > > time_get_facet;
+ locale tmp1(tmp0, new time_get_facet(tested_locales[i]));
+ loc = tmp1;
+ }
+ (inst.*__test)(loc);
+ }
+}
+
+void LocaleTest::time_put_get()
+{ test_supported_locale(*this, &LocaleTest::_time_put_get); }
+
+void LocaleTest::time_by_name()
+{
+# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ /*
+ * Check of the 22.1.1.2.7 standard point. Construction of a locale
+ * instance from a null pointer or an unknown name should result in
+ * a runtime_error exception.
+ */
+# if defined (STLPORT) || !defined (_MSC_VER) || (_MSC_VER > 1400)
+ try {
+ locale loc(locale::classic(), new time_put_byname<char, ostreambuf_iterator<char, char_traits<char> > >(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+# endif
+
+ try {
+ locale loc(locale::classic(), new time_put_byname<char, ostreambuf_iterator<char, char_traits<char> > >("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ string veryLongFacetName("LC_TIME=");
+ veryLongFacetName.append(512, '?');
+ locale loc(locale::classic(), new time_put_byname<char, ostreambuf_iterator<char, char_traits<char> > >(veryLongFacetName.c_str()));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), new time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), new time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ string veryLongFacetName("LC_TIME=");
+ veryLongFacetName.append(512, '?');
+ locale loc(locale::classic(), new time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >(veryLongFacetName.c_str()));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const& /* e */) {
+ //CPPUNIT_MESSAGE( e.what() );
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), "C", locale::time);
+ }
+ catch (runtime_error const& /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ // On platform without real localization support we should rely on the "C" facet.
+ locale loc(locale::classic(), "", locale::time);
+ }
+ catch (runtime_error const& /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), new time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >("C"));
+ }
+ catch (runtime_error const& /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ // On platform without real localization support we should rely on the "C" locale facet.
+ locale loc(locale::classic(), new time_get_byname<char, istreambuf_iterator<char, char_traits<char> > >(""));
+ }
+ catch (runtime_error const& /* e */) {
+ /* CPPUNIT_MESSAGE( e.what() ); */
+ CPPUNIT_FAIL;
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
+ try {
+ locale loc(locale::classic(), new time_put_byname<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), new time_put_byname<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), new time_get_byname<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >(static_cast<char const*>(0)));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+ try {
+ locale loc(locale::classic(), new time_get_byname<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >("yasli_language"));
+ CPPUNIT_FAIL;
+ }
+ catch (runtime_error const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+
+# endif
+# endif
+}
+
+#endif
diff --git a/test/unit/time_header_test.c b/test/unit/time_header_test.c
new file mode 100644
index 0000000..dbfe64b
--- /dev/null
+++ b/test/unit/time_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <time.h>
diff --git a/test/unit/times_test.cpp b/test/unit/times_test.cpp
new file mode 100644
index 0000000..aa13925
--- /dev/null
+++ b/test/unit/times_test.cpp
@@ -0,0 +1,34 @@
+#include <algorithm>
+#include <numeric>
+#include <functional>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class TimesTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(TimesTest);
+ CPPUNIT_TEST(times);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void times();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(TimesTest);
+
+//
+// tests implementation
+//
+void TimesTest::times()
+{
+ int input [4] = { 1, 5, 7, 2 };
+ int total = accumulate(input, input + 4, 1, multiplies<int>());
+ CPPUNIT_ASSERT(total==70);
+}
diff --git a/test/unit/transform_test.cpp b/test/unit/transform_test.cpp
new file mode 100644
index 0000000..81649e1
--- /dev/null
+++ b/test/unit/transform_test.cpp
@@ -0,0 +1,80 @@
+#include <string>
+#include <iterator>
+#include <vector>
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class TransformTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(TransformTest);
+ CPPUNIT_TEST(trnsfrm1);
+ CPPUNIT_TEST(trnsfrm2);
+ CPPUNIT_TEST(self_str);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void trnsfrm1();
+ void trnsfrm2();
+ void self_str();
+
+ static int negate_int(int a_) {
+ return -a_;
+ }
+ static char map_char(char a_, int b_) {
+ return char(a_ + b_);
+ }
+ static char shift( char c ) {
+ return char(((int)c + 1) % 256);
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(TransformTest);
+
+//
+// tests implementation
+//
+void TransformTest::trnsfrm1()
+{
+ int numbers[6] = { -5, -1, 0, 1, 6, 11 };
+
+ int result[6];
+ transform((int*)numbers, (int*)numbers + 6, (int*)result, negate_int);
+
+ CPPUNIT_ASSERT(result[0]==5);
+ CPPUNIT_ASSERT(result[1]==1);
+ CPPUNIT_ASSERT(result[2]==0);
+ CPPUNIT_ASSERT(result[3]==-1);
+ CPPUNIT_ASSERT(result[4]==-6);
+ CPPUNIT_ASSERT(result[5]==-11);
+}
+void TransformTest::trnsfrm2()
+{
+#if defined (__MVS__)
+ int trans[] = {-11, 4, -6, -6, -18, 0, 18, -14, 6, 0, -1, -59};
+#else
+ int trans[] = {-4, 4, -6, -6, -10, 0, 10, -6, 6, 0, -1, -77};
+#endif
+ char n[] = "Larry Mullen";
+ const size_t count = ::strlen(n);
+
+ string res;
+ transform(n, n + count, trans, back_inserter(res), map_char);
+ CPPUNIT_ASSERT( res == "Hello World!" )
+}
+
+void TransformTest::self_str()
+{
+ string s( "0123456789abcdefg" );
+ string r( "123456789:bcdefgh" );
+ transform( s.begin(), s.end(), s.begin(), shift );
+ CPPUNIT_ASSERT( s == r );
+}
+
diff --git a/test/unit/type_traits_test.cpp b/test/unit/type_traits_test.cpp
new file mode 100644
index 0000000..d881451
--- /dev/null
+++ b/test/unit/type_traits_test.cpp
@@ -0,0 +1,593 @@
+#include <algorithm>
+#include <vector>
+#include <string>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if defined (_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class TypeTraitsTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(TypeTraitsTest);
+#if !defined (STLPORT)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(manips);
+ CPPUNIT_TEST(integer);
+ CPPUNIT_TEST(rational);
+ CPPUNIT_TEST(pointer_type);
+#if defined (STLPORT) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(reference_type);
+#if defined (STLPORT)
+ CPPUNIT_STOP_IGNORE;
+#endif
+ CPPUNIT_TEST(both_pointer_type);
+ CPPUNIT_TEST(ok_to_use_memcpy);
+ CPPUNIT_TEST(ok_to_use_memmove);
+ CPPUNIT_TEST(trivial_destructor);
+ CPPUNIT_TEST(is_POD);
+ CPPUNIT_TEST(stlport_class);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void manips();
+ void integer();
+ void rational();
+ void pointer_type();
+ void reference_type();
+ void both_pointer_type();
+ void ok_to_use_memcpy();
+ void ok_to_use_memmove();
+ void trivial_destructor();
+ void is_POD();
+ void stlport_class();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(TypeTraitsTest);
+
+#if defined (STLPORT)
+
+# if defined (__GNUC__) && defined (_STLP_USE_NAMESPACES)
+// libstdc++ sometimes exposed its own __true_type type in global
+// namespace resulting in an ambiguity.
+# define __true_type std::__true_type
+# define __false_type std::__false_type
+# endif
+
+int type_to_value(__true_type)
+{ return 1; }
+int type_to_value(__false_type)
+{ return 0; }
+
+int* int_pointer;
+int const* int_const_pointer;
+int volatile* int_volatile_pointer;
+int const volatile* int_const_volatile_pointer;
+int int_val = 0;
+int const int_const_val = 0;
+int volatile int_volatile_val = 0;
+int & int_ref = int_val;
+int const& int_const_ref = int_val;
+int const volatile& int_const_volatile_ref = int_val;
+
+//A type that represent any type:
+struct any_type
+{
+ //Dummy operations to forbid to compilers with intrinsic
+ //type traits support to consider this type as a POD.
+ any_type() : m_data(1) {}
+ any_type(const any_type&) : m_data(2) {}
+ any_type& operator = (const any_type&)
+ { m_data = 3; return *this; }
+ ~any_type() { m_data = 0; }
+
+ size_t m_data;
+};
+
+any_type any;
+any_type* any_pointer;
+any_type const* any_const_pointer;
+any_type volatile* any_volatile_pointer;
+any_type const volatile* any_const_volatile_pointer;
+
+//A type that represent any pod type
+struct any_pod_type
+{};
+
+# if defined (_STLP_USE_BOOST_SUPPORT)
+//Mandatory for compilers without without partial template specialization.
+BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(any_pod_type)
+# endif
+
+any_pod_type any_pod;
+any_pod_type* any_pod_pointer;
+any_pod_type const* any_pod_const_pointer;
+any_pod_type volatile* any_pod_volatile_pointer;
+any_pod_type const volatile* any_pod_const_volatile_pointer;
+
+# if defined (_STLP_USE_NAMESPACES)
+namespace std {
+# endif
+ _STLP_TEMPLATE_NULL
+ struct __type_traits<any_pod_type> {
+ typedef __true_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __true_type is_POD_type;
+ };
+# if defined (_STLP_USE_NAMESPACES)
+}
+# endif
+
+struct base
+{};
+struct derived : public base
+{};
+
+//
+// tests implementation
+//
+template <typename _Src, typename _Dst>
+int is_convertible(_Src, _Dst) {
+# if !defined(__BORLANDC__)
+ typedef typename _IsConvertible<_Src, _Dst>::_Ret _Ret;
+# else
+ enum { _Is = _IsConvertible<_Src, _Dst>::value };
+ typedef typename __bool2type<_Is>::_Ret _Ret;
+# endif
+ return type_to_value(_Ret());
+}
+
+template <typename _Src, typename _Dst>
+int is_cv_convertible(_Src, _Dst) {
+# if !defined(__BORLANDC__)
+ typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret;
+# else
+ enum { _Is = _IsCVConvertible<_Src, _Dst>::value };
+ typedef typename __bool2type<_Is>::_Ret _Ret;
+# endif
+ return type_to_value(_Ret());
+}
+#endif
+
+void TypeTraitsTest::manips()
+{
+#if defined (STLPORT)
+ {
+ typedef __bool2type<0>::_Ret _ZeroRet;
+ CPPUNIT_ASSERT( type_to_value(_ZeroRet()) == 0 );
+ typedef __bool2type<1>::_Ret _OneRet;
+ CPPUNIT_ASSERT( type_to_value(_OneRet()) == 1 );
+ typedef __bool2type<65456873>::_Ret _AnyRet;
+ CPPUNIT_ASSERT( type_to_value(_AnyRet()) == 1 );
+ }
+
+ {
+ CPPUNIT_ASSERT( __type2bool<__true_type>::_Ret == 1 );
+ CPPUNIT_ASSERT( __type2bool<__false_type>::_Ret == 0 );
+ CPPUNIT_ASSERT( __type2bool<any_type>::_Ret == 1 );
+ }
+
+ {
+ typedef _Not<__true_type>::_Ret _NotTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_NotTrueRet()) == 0 );
+ typedef _Not<__false_type>::_Ret _NotFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_NotFalseRet()) == 1 );
+ }
+
+ {
+ typedef _Land2<__true_type, __true_type>::_Ret _TrueTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_TrueTrueRet()) == 1 );
+ typedef _Land2<__true_type, __false_type>::_Ret _TrueFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_TrueFalseRet()) == 0 );
+ typedef _Land2<__false_type, __true_type>::_Ret _FalseTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_FalseTrueRet()) == 0 );
+ typedef _Land2<__false_type, __false_type>::_Ret _FalseFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_FalseFalseRet()) == 0 );
+ }
+
+ {
+ typedef _Land3<__true_type, __true_type, __true_type>::_Ret _TrueTrueTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_TrueTrueTrueRet()) == 1 );
+ typedef _Land3<__true_type, __true_type, __false_type>::_Ret _TrueTrueFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_TrueTrueFalseRet()) == 0 );
+ typedef _Land3<__true_type, __false_type, __true_type>::_Ret _TrueFalseTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_TrueFalseTrueRet()) == 0 );
+ typedef _Land3<__true_type, __false_type, __false_type>::_Ret _TrueFalseFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_TrueFalseFalseRet()) == 0 );
+ typedef _Land3<__false_type, __true_type, __true_type>::_Ret _FalseTrueTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_FalseTrueTrueRet()) == 0 );
+ typedef _Land3<__false_type, __true_type, __false_type>::_Ret _FalseTrueFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_FalseTrueFalseRet()) == 0 );
+ typedef _Land3<__false_type, __false_type, __true_type>::_Ret _FalseFalseTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_FalseFalseTrueRet()) == 0 );
+ typedef _Land3<__false_type, __false_type, __false_type>::_Ret _FalseFalseFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_FalseFalseFalseRet()) == 0 );
+ }
+
+ {
+ typedef _Lor2<__true_type, __true_type>::_Ret _TrueTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_TrueTrueRet()) == 1 );
+ typedef _Lor2<__true_type, __false_type>::_Ret _TrueFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_TrueFalseRet()) == 1 );
+ typedef _Lor2<__false_type, __true_type>::_Ret _FalseTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_FalseTrueRet()) == 1 );
+ typedef _Lor2<__false_type, __false_type>::_Ret _FalseFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_FalseFalseRet()) == 0 );
+ }
+
+ {
+ typedef _Lor3<__true_type, __true_type, __true_type>::_Ret _TrueTrueTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_TrueTrueTrueRet()) == 1 );
+ typedef _Lor3<__true_type, __true_type, __false_type>::_Ret _TrueTrueFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_TrueTrueFalseRet()) == 1 );
+ typedef _Lor3<__true_type, __false_type, __true_type>::_Ret _TrueFalseTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_TrueFalseTrueRet()) == 1 );
+ typedef _Lor3<__true_type, __false_type, __false_type>::_Ret _TrueFalseFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_TrueFalseFalseRet()) == 1 );
+ typedef _Lor3<__false_type, __true_type, __true_type>::_Ret _FalseTrueTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_FalseTrueTrueRet()) == 1 );
+ typedef _Lor3<__false_type, __true_type, __false_type>::_Ret _FalseTrueFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_FalseTrueFalseRet()) == 1 );
+ typedef _Lor3<__false_type, __false_type, __true_type>::_Ret _FalseFalseTrueRet;
+ CPPUNIT_ASSERT( type_to_value(_FalseFalseTrueRet()) == 1 );
+ typedef _Lor3<__false_type, __false_type, __false_type>::_Ret _FalseFalseFalseRet;
+ CPPUNIT_ASSERT( type_to_value(_FalseFalseFalseRet()) == 0 );
+ }
+
+ {
+ typedef __select<1, __true_type, __false_type>::_Ret _SelectFirstRet;
+ CPPUNIT_ASSERT( type_to_value(_SelectFirstRet()) == 1 );
+ typedef __select<0, __true_type, __false_type>::_Ret _SelectSecondRet;
+ CPPUNIT_ASSERT( type_to_value(_SelectSecondRet()) == 0 );
+# if defined (__BORLANDC__)
+ typedef __selectT<__true_type, __true_type, __false_type>::_Ret _SelectFirstRet;
+ CPPUNIT_ASSERT( type_to_value(_SelectFirstRet()) == 1 );
+ typedef __selectT<__false_type, __true_type, __false_type>::_Ret _SelectSecondRet;
+ CPPUNIT_ASSERT( type_to_value(_SelectSecondRet()) == 0 );
+# endif
+ }
+
+ {
+ base b;
+ derived d;
+ const derived cd = d;
+ base *pb = &b;
+ derived *pd = &d;
+ derived const *pcd = pd;
+ CPPUNIT_CHECK( is_convertible(any, b) == 0 );
+ CPPUNIT_CHECK( is_convertible(d, b) == 1 );
+ CPPUNIT_CHECK( is_convertible(cd, b) == 1 );
+ // _IsCVConvertible only needs to work for pointer type:
+ //CPPUNIT_CHECK( is_cv_convertible(d, b) == 1 );
+ //CPPUNIT_CHECK( is_cv_convertible(cd, b) == 0 );
+
+ //_IsConvertible do not need to work for pointers:
+ //CPPUNIT_CHECK( is_convertible(pd, pb) == 1 );
+ //CPPUNIT_CHECK( is_convertible(pcd, pb) == 1 );
+
+ CPPUNIT_CHECK( is_cv_convertible(pd, pb) == 1 );
+ CPPUNIT_CHECK( is_cv_convertible(pcd, pb) == 0 );
+ }
+#endif
+}
+
+#if defined (STLPORT)
+template <typename _Type>
+int is_integer(_Type) {
+ typedef typename _IsIntegral<_Type>::_Ret _Ret;
+ return type_to_value(_Ret());
+}
+#endif
+
+void TypeTraitsTest::integer()
+{
+#if defined (STLPORT)
+ CPPUNIT_ASSERT( is_integer(bool()) == 1 );
+ CPPUNIT_ASSERT( is_integer(char()) == 1 );
+ typedef signed char signed_char;
+ CPPUNIT_ASSERT( is_integer(signed_char()) == 1 );
+ typedef unsigned char unsigned_char;
+ CPPUNIT_ASSERT( is_integer(unsigned_char()) == 1 );
+# if defined (_STLP_HAS_WCHAR_T)
+ CPPUNIT_ASSERT( is_integer(wchar_t()) == 1 );
+# endif
+ CPPUNIT_ASSERT( is_integer(short()) == 1 );
+ typedef unsigned short unsigned_short;
+ CPPUNIT_ASSERT( is_integer(unsigned_short()) == 1 );
+ CPPUNIT_ASSERT( is_integer(int()) == 1 );
+ typedef unsigned int unsigned_int;
+ CPPUNIT_ASSERT( is_integer(unsigned_int()) == 1 );
+ CPPUNIT_ASSERT( is_integer(long()) == 1 );
+ typedef unsigned long unsigned_long;
+ CPPUNIT_ASSERT( is_integer(unsigned_long()) == 1 );
+# if defined (_STLP_LONG_LONG)
+ typedef _STLP_LONG_LONG long_long;
+ CPPUNIT_ASSERT( is_integer(long_long()) == 1 );
+ typedef unsigned _STLP_LONG_LONG unsigned_long_long;
+ CPPUNIT_ASSERT( is_integer(unsigned_long_long()) == 1 );
+# endif
+ CPPUNIT_ASSERT( is_integer(float()) == 0 );
+ CPPUNIT_ASSERT( is_integer(double()) == 0 );
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+ typedef long double long_double;
+ CPPUNIT_ASSERT( is_integer(long_double()) == 0 );
+# endif
+ CPPUNIT_ASSERT( is_integer(any) == 0 );
+ CPPUNIT_ASSERT( is_integer(any_pointer) == 0 );
+#endif
+}
+
+#if defined (STLPORT)
+template <typename _Type>
+int is_rational(_Type) {
+ typedef typename _IsRational<_Type>::_Ret _Ret;
+ return type_to_value(_Ret());
+}
+#endif
+
+void TypeTraitsTest::rational()
+{
+#if defined (STLPORT)
+ CPPUNIT_ASSERT( is_rational(bool()) == 0 );
+ CPPUNIT_ASSERT( is_rational(char()) == 0 );
+ typedef signed char signed_char;
+ CPPUNIT_ASSERT( is_rational(signed_char()) == 0 );
+ typedef unsigned char unsigned_char;
+ CPPUNIT_ASSERT( is_rational(unsigned_char()) == 0 );
+# if defined (_STLP_HAS_WCHAR_T)
+ CPPUNIT_ASSERT( is_rational(wchar_t()) == 0 );
+# endif
+ CPPUNIT_ASSERT( is_rational(short()) == 0 );
+ typedef unsigned short unsigned_short;
+ CPPUNIT_ASSERT( is_rational(unsigned_short()) == 0 );
+ CPPUNIT_ASSERT( is_rational(int()) == 0 );
+ typedef unsigned int unsigned_int;
+ CPPUNIT_ASSERT( is_rational(unsigned_int()) == 0 );
+ CPPUNIT_ASSERT( is_rational(long()) == 0 );
+ typedef unsigned long unsigned_long;
+ CPPUNIT_ASSERT( is_rational(unsigned_long()) == 0 );
+# if defined (_STLP_LONG_LONG)
+ typedef _STLP_LONG_LONG long_long;
+ CPPUNIT_ASSERT( is_rational(long_long()) == 0 );
+ typedef unsigned _STLP_LONG_LONG unsigned_long_long;
+ CPPUNIT_ASSERT( is_rational(unsigned_long_long()) == 0 );
+# endif
+ CPPUNIT_ASSERT( is_rational(float()) == 1 );
+ CPPUNIT_ASSERT( is_rational(double()) == 1 );
+# if !defined ( _STLP_NO_LONG_DOUBLE )
+ typedef long double long_double;
+ CPPUNIT_ASSERT( is_rational(long_double()) == 1 );
+# endif
+ CPPUNIT_ASSERT( is_rational(any) == 0 );
+ CPPUNIT_ASSERT( is_rational(any_pointer) == 0 );
+#endif
+}
+
+#if defined (STLPORT)
+template <typename _Type>
+int is_pointer_type(_Type) {
+ return type_to_value(_IsPtrType<_Type>::_Ret());
+}
+#endif
+
+void TypeTraitsTest::pointer_type()
+{
+#if defined (STLPORT)
+ CPPUNIT_ASSERT( is_pointer_type(int_val) == 0 );
+ CPPUNIT_ASSERT( is_pointer_type(int_pointer) == 1 );
+ CPPUNIT_ASSERT( is_pointer_type(int_const_pointer) == 1 );
+ CPPUNIT_ASSERT( is_pointer_type(int_volatile_pointer) == 1 );
+ CPPUNIT_ASSERT( is_pointer_type(int_const_volatile_pointer) == 1 );
+ CPPUNIT_ASSERT( is_pointer_type(int_ref) == 0 );
+ CPPUNIT_ASSERT( is_pointer_type(int_const_ref) == 0 );
+ CPPUNIT_ASSERT( is_pointer_type(any) == 0 );
+ CPPUNIT_ASSERT( is_pointer_type(any_pointer) == 1 );
+#endif
+}
+
+void TypeTraitsTest::reference_type()
+{
+#if defined (STLPORT) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_ASSERT( type_to_value(_IsRefType<int>::_Ret()) == 0 );
+ CPPUNIT_ASSERT( type_to_value(_IsRefType<int*>::_Ret()) == 0 );
+ CPPUNIT_ASSERT( type_to_value(_IsRefType<int&>::_Ret()) == 1 );
+ CPPUNIT_ASSERT( type_to_value(_IsRefType<int const&>::_Ret()) == 1 );
+ CPPUNIT_ASSERT( type_to_value(_IsRefType<int const volatile&>::_Ret()) == 1 );
+
+ CPPUNIT_ASSERT( type_to_value(_IsOKToSwap(int_pointer, int_pointer, __true_type(), __true_type())._Answer()) == 1 );
+ CPPUNIT_ASSERT( type_to_value(_IsOKToSwap(int_pointer, int_pointer, __false_type(), __false_type())._Answer()) == 0 );
+#endif
+}
+
+#if defined (STLPORT)
+template <typename _Tp1, typename _Tp2>
+int are_both_pointer_type (_Tp1, _Tp2) {
+ return type_to_value(_BothPtrType<_Tp1, _Tp2>::_Answer());
+}
+#endif
+
+void TypeTraitsTest::both_pointer_type()
+{
+#if defined (STLPORT)
+ CPPUNIT_CHECK( are_both_pointer_type(int_val, int_val) == 0 );
+ CPPUNIT_CHECK( are_both_pointer_type(int_pointer, int_pointer) == 1 );
+ CPPUNIT_CHECK( are_both_pointer_type(int_const_pointer, int_const_pointer) == 1 );
+ CPPUNIT_CHECK( are_both_pointer_type(int_volatile_pointer, int_volatile_pointer) == 1 );
+ CPPUNIT_CHECK( are_both_pointer_type(int_const_volatile_pointer, int_const_volatile_pointer) == 1 );
+ CPPUNIT_CHECK( are_both_pointer_type(int_ref, int_ref) == 0 );
+ CPPUNIT_CHECK( are_both_pointer_type(int_const_ref, int_const_ref) == 0 );
+ CPPUNIT_CHECK( are_both_pointer_type(any, any) == 0 );
+ CPPUNIT_CHECK( are_both_pointer_type(any_pointer, any_pointer) == 1 );
+#endif
+}
+
+#if defined (STLPORT)
+template <typename _Tp1, typename _Tp2>
+int is_ok_to_use_memcpy(_Tp1 val1, _Tp2 val2) {
+ return type_to_value(_UseTrivialCopy(val1, val2)._Answer());
+}
+#endif
+
+void TypeTraitsTest::ok_to_use_memcpy()
+{
+#if defined (STLPORT) && !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(int_pointer, int_pointer) == 1 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(int_const_pointer, int_pointer) == 1 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(int_pointer, int_volatile_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(int_pointer, int_const_volatile_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(int_const_pointer, int_const_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(int_const_pointer, int_volatile_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(int_const_pointer, int_const_volatile_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(int_const_volatile_pointer, int_const_volatile_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(int_pointer, any_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(any_pointer, int_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(any_pointer, any_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(any_pointer, any_const_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(any_pod_pointer, int_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(any_pod_pointer, any_pod_pointer) == 1 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(any_pod_pointer, any_pod_const_pointer) == 0 );
+ vector<float> **pvf = 0;
+ vector<int> **pvi = 0;
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(pvf, pvi) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memcpy(pvi, pvf) == 0 );
+#endif
+}
+
+#if defined (STLPORT)
+template <typename _Tp1, typename _Tp2>
+int is_ok_to_use_memmove(_Tp1 val1, _Tp2 val2) {
+ return type_to_value(_UseTrivialUCopy(val1, val2)._Answer());
+}
+#endif
+
+void TypeTraitsTest::ok_to_use_memmove()
+{
+#if defined (STLPORT) && !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
+ CPPUNIT_CHECK( is_ok_to_use_memmove(int_pointer, int_pointer) == 1 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(int_const_pointer, int_pointer) == 1 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(int_pointer, int_volatile_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(int_pointer, int_const_volatile_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(int_const_pointer, int_const_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(int_const_pointer, int_volatile_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(int_const_pointer, int_const_volatile_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(int_const_volatile_pointer, int_const_volatile_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(int_pointer, any_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(any_pointer, int_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(any_pointer, any_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(any_pointer, any_const_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(any_pod_pointer, int_pointer) == 0 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(any_pod_pointer, any_pod_pointer) == 1 );
+ CPPUNIT_CHECK( is_ok_to_use_memmove(any_pod_pointer, any_pod_const_pointer) == 0 );
+#endif
+}
+
+#if defined (STLPORT)
+template <typename _Tp>
+int has_trivial_destructor(_Tp) {
+ typedef typename __type_traits<_Tp>::has_trivial_destructor _TrivialDestructor;
+ return type_to_value(_TrivialDestructor());
+}
+
+struct DestructorMonitor
+{
+ ~DestructorMonitor()
+ { ++nb_destructor_call; }
+
+ static size_t nb_destructor_call;
+};
+
+size_t DestructorMonitor::nb_destructor_call = 0;
+
+# if defined (_STLP_USE_NAMESPACES)
+namespace std {
+# endif
+ _STLP_TEMPLATE_NULL
+ struct __type_traits<DestructorMonitor> {
+ typedef __true_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __true_type is_POD_type;
+ };
+# if defined (_STLP_USE_NAMESPACES)
+}
+# endif
+#endif
+
+void TypeTraitsTest::trivial_destructor()
+{
+#if defined (STLPORT)
+ CPPUNIT_CHECK( has_trivial_destructor(int_pointer) == 1 );
+ CPPUNIT_CHECK( has_trivial_destructor(int_const_pointer) == 1 );
+ CPPUNIT_CHECK( has_trivial_destructor(int_volatile_pointer) == 1 );
+ CPPUNIT_CHECK( has_trivial_destructor(int_const_volatile_pointer) == 1 );
+ CPPUNIT_CHECK( has_trivial_destructor(any_pointer) == 1 );
+ CPPUNIT_CHECK( has_trivial_destructor(any) == 0 );
+ CPPUNIT_CHECK( has_trivial_destructor(any_pointer) == 1 );
+ CPPUNIT_CHECK( has_trivial_destructor(any_pod) == 1 );
+ CPPUNIT_CHECK( has_trivial_destructor(string()) == 0 );
+
+ //Check of the meta information impact in a container implementation
+ {
+ vector<DestructorMonitor> v(10);
+ DestructorMonitor::nb_destructor_call = 0;
+ }
+ CPPUNIT_CHECK( DestructorMonitor::nb_destructor_call == 0 );
+#endif
+}
+
+#if defined (STLPORT)
+template <typename _Tp>
+int is_POD_type(_Tp) {
+ typedef typename __type_traits<_Tp>::is_POD_type _IsPODType;
+ return type_to_value(_IsPODType());
+}
+#endif
+
+void TypeTraitsTest::is_POD()
+{
+#if defined (STLPORT)
+ CPPUNIT_CHECK( is_POD_type(int_pointer) == 1 );
+ CPPUNIT_CHECK( is_POD_type(int_const_pointer) == 1 );
+ CPPUNIT_CHECK( is_POD_type(int_volatile_pointer) == 1 );
+ CPPUNIT_CHECK( is_POD_type(int_const_volatile_pointer) == 1 );
+ CPPUNIT_CHECK( is_POD_type(any_pointer) == 1 );
+ CPPUNIT_CHECK( is_POD_type(any) == 0 );
+ CPPUNIT_CHECK( is_POD_type(any_pointer) == 1 );
+ CPPUNIT_CHECK( is_POD_type(any_pod) == 1 );
+ CPPUNIT_CHECK( is_POD_type(string()) == 0 );
+#endif
+}
+
+#if defined (STLPORT)
+template <typename _Tp>
+int is_stlport_class(_Tp) {
+ typedef _IsSTLportClass<_Tp> _STLportClass;
+# if !defined (__BORLANDC__)
+ typedef typename _STLportClass::_Ret _Is;
+# else
+ typedef typename __bool2type<_STLportClass::_Is>::_Ret _Is;
+# endif
+ return type_to_value(_Is());
+}
+#endif
+
+void TypeTraitsTest::stlport_class()
+{
+#if defined (STLPORT)
+ CPPUNIT_CHECK( is_stlport_class(allocator<char>()) == 1 );
+# if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
+ CPPUNIT_CHECK( is_stlport_class(string()) == 1 );
+# endif
+ CPPUNIT_CHECK( is_stlport_class(any) == 0 );
+#endif
+}
diff --git a/test/unit/typeinfo_header_test.cpp b/test/unit/typeinfo_header_test.cpp
new file mode 100644
index 0000000..7e3f5eb
--- /dev/null
+++ b/test/unit/typeinfo_header_test.cpp
@@ -0,0 +1,20 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <typeinfo>
+
+#if 0 /* !defined (_STLP_NO_RTTI) && !defined (_STLP_NO_TYPEINFO) */
+/* SourceForge: STLport bug report 1721844
+ * type_info is not a member of stlp_std
+ */
+class A {};
+
+void type_info_header_test()
+{
+ const std::type_info& ti = typeid(A);
+}
+#endif
diff --git a/test/unit/unary.h b/test/unit/unary.h
new file mode 100644
index 0000000..8c9ef43
--- /dev/null
+++ b/test/unit/unary.h
@@ -0,0 +1,23 @@
+#ifndef _unary_h
+#define _unary_h
+#include <cmath>
+#include <cfloat>
+#include <functional> //*TY 12/26/1998 - added to get unary_function
+
+#if !defined (STLPORT) || defined (_STLP_USE_NAMESPACES)
+using std::unary_function;
+#endif
+
+struct odd : public unary_function<int, bool> {
+ bool operator()(int n_) const { return(n_ % 2) == 1; }
+};
+
+struct positive : public unary_function<int, bool> {
+ bool operator()(int n_) const { return n_ >= 0; }
+};
+
+struct square_root : public unary_function<double, double> {
+ double operator()(double x_) const
+ { return ::sqrt(x_); }
+};
+#endif // _unary_h
diff --git a/test/unit/unary_test.cpp b/test/unit/unary_test.cpp
new file mode 100644
index 0000000..ee480b7
--- /dev/null
+++ b/test/unit/unary_test.cpp
@@ -0,0 +1,98 @@
+#include <vector>
+#include "unary.h"
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class UnaryTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(UnaryTest);
+#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(ucompos1);
+ CPPUNIT_TEST(ucompos2);
+ CPPUNIT_STOP_IGNORE;
+ CPPUNIT_TEST(unegate1);
+ CPPUNIT_TEST(unegate2);
+#if defined (STLPORT) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(unegate3);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void ucompos1();
+ void ucompos2();
+ void unegate1();
+ void unegate2();
+ void unegate3();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(UnaryTest);
+
+//
+// tests implementation
+//
+void UnaryTest::unegate1()
+{
+ int array [3] = { 1, 2, 3 };
+ //unary_negate<odd>::argument_type arg_val = 0;
+ int* p = find_if((int*)array, (int*)array + 3, unary_negate<odd>(odd()));
+ CPPUNIT_ASSERT((p != array + 3));
+ CPPUNIT_ASSERT(*p==2);
+}
+void UnaryTest::unegate2()
+{
+ int array [3] = { 1, 2, 3 };
+ int* p = find_if((int*)array, (int*)array + 3, not1(odd()));
+ CPPUNIT_ASSERT(p != array + 3);
+ CPPUNIT_ASSERT(*p==2);
+}
+
+bool test_func(int param) {
+ return param < 3;
+}
+void UnaryTest::unegate3()
+{
+#if !defined (STLPORT) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+ int array [3] = { 1, 2, 3 };
+ int* p = find_if((int*)array, (int*)array + 3, not1(ptr_fun(test_func)));
+ CPPUNIT_ASSERT(p != array + 3);
+ CPPUNIT_ASSERT(*p==3);
+#endif
+}
+
+void UnaryTest::ucompos1()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ int input [3] = { -1, -4, -16 };
+
+ double output[3];
+ transform((int*)input, (int*)input + 3, output, unary_compose<square_root, negate<int> >(square_root(), negate<int>()));
+
+ CPPUNIT_ASSERT(output[0]==1);
+ CPPUNIT_ASSERT(output[1]==2);
+ CPPUNIT_ASSERT(output[2]==4);
+#endif
+}
+void UnaryTest::ucompos2()
+{
+#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
+ int input [3] = { -1, -4, -16 };
+
+ double output [3];
+ transform((int*)input, (int*)input + 3, output, compose1(square_root(), negate<int>()));
+
+ CPPUNIT_ASSERT(output[0]==1);
+ CPPUNIT_ASSERT(output[1]==2);
+ CPPUNIT_ASSERT(output[2]==4);
+#endif
+}
diff --git a/test/unit/uninitialized_test.cpp b/test/unit/uninitialized_test.cpp
new file mode 100644
index 0000000..37884f7
--- /dev/null
+++ b/test/unit/uninitialized_test.cpp
@@ -0,0 +1,245 @@
+#include <memory>
+#include <vector>
+#include <list>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class UninitializedTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(UninitializedTest);
+ CPPUNIT_TEST(copy_test);
+ //CPPUNIT_TEST(fill_test);
+ //CPPUNIT_TEST(fill_n_test);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void copy_test();
+ void fill_test();
+ void fill_n_test();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(UninitializedTest);
+
+struct NotTrivialCopyStruct {
+ NotTrivialCopyStruct() : member(0) {}
+ NotTrivialCopyStruct(NotTrivialCopyStruct const&) : member(1) {}
+
+ int member;
+};
+
+struct TrivialCopyStruct {
+ TrivialCopyStruct() : member(0) {}
+ TrivialCopyStruct(TrivialCopyStruct const&) : member(1) {}
+
+ int member;
+};
+
+struct TrivialInitStruct {
+ TrivialInitStruct()
+ { ++nbConstructorCalls; }
+
+ static size_t nbConstructorCalls;
+};
+
+size_t TrivialInitStruct::nbConstructorCalls = 0;
+
+#if defined (STLPORT)
+# if defined (_STLP_USE_NAMESPACES)
+namespace std {
+# endif
+ _STLP_TEMPLATE_NULL
+ struct __type_traits<TrivialCopyStruct> {
+ typedef __false_type has_trivial_default_constructor;
+ //This is a wrong declaration just to check that internaly a simple memcpy is called:
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+ };
+
+ _STLP_TEMPLATE_NULL
+ struct __type_traits<TrivialInitStruct> {
+ //This is a wrong declaration just to check that internaly no initialization is done:
+ typedef __true_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __false_type is_POD_type;
+ };
+# if defined (_STLP_USE_NAMESPACES)
+}
+# endif
+#endif
+
+struct base {};
+struct derived : public base {};
+
+//
+// tests implementation
+//
+void UninitializedTest::copy_test()
+{
+ {
+ //Random iterators
+ {
+ vector<NotTrivialCopyStruct> src(10);
+ vector<NotTrivialCopyStruct> dst(10);
+ uninitialized_copy(src.begin(), src.end(), dst.begin());
+ vector<NotTrivialCopyStruct>::const_iterator it(dst.begin()), end(dst.end());
+ for (; it != end; ++it) {
+ CPPUNIT_ASSERT( (*it).member == 1 );
+ }
+ }
+ {
+ /** Note: we use static arrays here so the iterators are always
+ pointers, even in debug mode. */
+ size_t const count = 10;
+ TrivialCopyStruct src[count];
+ TrivialCopyStruct dst[count];
+
+ TrivialCopyStruct* it = src + 0;
+ TrivialCopyStruct* end = src + count;
+ for (; it != end; ++it) {
+ (*it).member = 0;
+ }
+
+ uninitialized_copy(src+0, src+count, dst+0);
+ for (it = dst+0, end = dst+count; it != end; ++it) {
+#if defined (STLPORT)
+ /* If the member is 1, it means that library has not found any
+ optimization oportunity and called the regular copy-ctor instead. */
+ CPPUNIT_ASSERT( (*it).member == 0 );
+#else
+ CPPUNIT_ASSERT( (*it).member == 1 );
+#endif
+ }
+ }
+ }
+
+ {
+ //Bidirectional iterator
+ {
+ vector<NotTrivialCopyStruct> src(10);
+ list<NotTrivialCopyStruct> dst(10);
+
+ list<NotTrivialCopyStruct>::iterator it(dst.begin()), end(dst.end());
+ for (; it != end; ++it) {
+ (*it).member = -1;
+ }
+
+ uninitialized_copy(src.begin(), src.end(), dst.begin());
+
+ for (it = dst.begin(); it != end; ++it) {
+ CPPUNIT_ASSERT( (*it).member == 1 );
+ }
+ }
+
+ {
+ list<NotTrivialCopyStruct> src(10);
+ vector<NotTrivialCopyStruct> dst(10);
+
+ vector<NotTrivialCopyStruct>::iterator it(dst.begin()), end(dst.end());
+ for (; it != end; ++it) {
+ (*it).member = -1;
+ }
+
+ uninitialized_copy(src.begin(), src.end(), dst.begin());
+
+ for (it = dst.begin(); it != end; ++it) {
+ CPPUNIT_ASSERT( (*it).member == 1 );
+ }
+ }
+ }
+
+ {
+ //Using containers of native types:
+#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES)
+ {
+ vector<int> src;
+ int i;
+ for (i = -5; i < 6; ++i) {
+ src.push_back(i);
+ }
+
+ //Building a vector result in a uninitialized_copy call internally
+ vector<unsigned int> dst(src.begin(), src.end());
+ vector<unsigned int>::const_iterator it(dst.begin());
+ for (i = -5; i < 6; ++i, ++it) {
+ CPPUNIT_ASSERT( *it == (unsigned int)i );
+ }
+ }
+
+ {
+ vector<char> src;
+ char i;
+ for (i = -5; i < 6; ++i) {
+ src.push_back(i);
+ }
+
+ //Building a vector result in a uninitialized_copy call internally
+ vector<unsigned int> dst(src.begin(), src.end());
+ vector<unsigned int>::const_iterator it(dst.begin());
+ for (i = -5; i < 6; ++i, ++it) {
+ CPPUNIT_ASSERT( *it == (unsigned int)i );
+ }
+ }
+
+ {
+ vector<int> src;
+ int i;
+ for (i = -5; i < 6; ++i) {
+ src.push_back(i);
+ }
+
+ //Building a vector result in a uninitialized_copy call internally
+ vector<float> dst(src.begin(), src.end());
+ vector<float>::const_iterator it(dst.begin());
+ for (i = -5; i < 6; ++i, ++it) {
+ CPPUNIT_ASSERT( *it == (float)i );
+ }
+ }
+
+ {
+ vector<vector<float>*> src(10);
+ vector<vector<float>*> dst(src.begin(), src.end());
+ }
+
+ {
+ derived d;
+ //base *pb = &d;
+ derived *pd = &d;
+ //base **ppb = &pd;
+ vector<derived*> src(10, pd);
+ vector<base*> dst(src.begin(), src.end());
+ vector<base*>::iterator it(dst.begin()), end(dst.end());
+ for (; it != end; ++it) {
+ CPPUNIT_ASSERT( (*it) == pd );
+ }
+ }
+#endif
+ }
+
+ {
+ //Vector initialization:
+ vector<TrivialInitStruct> vect(10);
+ //Just 1 constructor call for the default value:
+ CPPUNIT_ASSERT( TrivialInitStruct::nbConstructorCalls == 1 );
+ }
+}
+
+/*
+void UninitializedTest::fill_test()
+{
+}
+
+void UninitializedTest::fill_n_test()
+{
+}
+*/
diff --git a/test/unit/unique_test.cpp b/test/unit/unique_test.cpp
new file mode 100644
index 0000000..b080b7b
--- /dev/null
+++ b/test/unit/unique_test.cpp
@@ -0,0 +1,105 @@
+#include <algorithm>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class UniqueTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(UniqueTest);
+ CPPUNIT_TEST(uniqcpy1);
+ CPPUNIT_TEST(uniqcpy2);
+ CPPUNIT_TEST(unique1);
+ CPPUNIT_TEST(unique2);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void uniqcpy1();
+ void uniqcpy2();
+ void unique1();
+ void unique2();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(UniqueTest);
+
+static bool str_equal(const char* a_, const char* b_)
+{ return *a_ == *b_; }
+//
+// tests implementation
+//
+void UniqueTest::unique1()
+{
+ int numbers[8] = { 0, 1, 1, 2, 2, 2, 3, 4 };
+ unique((int*)numbers, (int*)numbers + 8);
+ // 0 1 2 3 4 2 3 4
+ CPPUNIT_ASSERT(numbers[0]==0);
+ CPPUNIT_ASSERT(numbers[1]==1);
+ CPPUNIT_ASSERT(numbers[2]==2);
+ CPPUNIT_ASSERT(numbers[3]==3);
+ CPPUNIT_ASSERT(numbers[4]==4);
+ CPPUNIT_ASSERT(numbers[5]==2);
+ CPPUNIT_ASSERT(numbers[6]==3);
+ CPPUNIT_ASSERT(numbers[7]==4);
+}
+
+void UniqueTest::unique2()
+{
+ const char* labels[] = {"Q", "Q", "W", "W", "E", "E", "R", "T", "T", "Y", "Y"};
+
+ const unsigned count = sizeof(labels) / sizeof(labels[0]);
+
+ unique((const char**)labels, (const char**)labels + count, str_equal);
+
+ // QWERTY
+ CPPUNIT_ASSERT(*labels[0] == 'Q');
+ CPPUNIT_ASSERT(*labels[1] == 'W');
+ CPPUNIT_ASSERT(*labels[2] == 'E');
+ CPPUNIT_ASSERT(*labels[3] == 'R');
+ CPPUNIT_ASSERT(*labels[4] == 'T');
+ CPPUNIT_ASSERT(*labels[5] == 'Y');
+
+}
+
+void UniqueTest::uniqcpy1()
+{
+ int numbers[8] = { 0, 1, 1, 2, 2, 2, 3, 4 };
+ int result[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ unique_copy((int*)numbers, (int*)numbers + 8, (int*)result);
+
+ // 0 1 2 3 4 0 0 0
+ CPPUNIT_ASSERT(result[0]==0);
+ CPPUNIT_ASSERT(result[1]==1);
+ CPPUNIT_ASSERT(result[2]==2);
+ CPPUNIT_ASSERT(result[3]==3);
+ CPPUNIT_ASSERT(result[4]==4);
+ CPPUNIT_ASSERT(result[5]==0);
+ CPPUNIT_ASSERT(result[6]==0);
+ CPPUNIT_ASSERT(result[7]==0);
+}
+
+void UniqueTest::uniqcpy2()
+{
+ const char* labels[] = {"Q", "Q", "W", "W", "E", "E", "R", "T", "T", "Y", "Y"};
+ const char **plabels = (const char**)labels;
+
+ const size_t count = sizeof(labels) / sizeof(labels[0]);
+ const char* uCopy[count];
+ const char **puCopy = &uCopy[0];
+ fill(puCopy, puCopy + count, "");
+
+ unique_copy(plabels, plabels + count, puCopy, str_equal);
+
+ //QWERTY
+ CPPUNIT_ASSERT(*uCopy[0] == 'Q');
+ CPPUNIT_ASSERT(*uCopy[1] == 'W');
+ CPPUNIT_ASSERT(*uCopy[2] == 'E');
+ CPPUNIT_ASSERT(*uCopy[3] == 'R');
+ CPPUNIT_ASSERT(*uCopy[4] == 'T');
+ CPPUNIT_ASSERT(*uCopy[5] == 'Y');
+}
diff --git a/test/unit/unordered_test.cpp b/test/unit/unordered_test.cpp
new file mode 100644
index 0000000..8d47ca7
--- /dev/null
+++ b/test/unit/unordered_test.cpp
@@ -0,0 +1,676 @@
+#include <vector>
+#include <algorithm>
+#include <string>
+#if defined (STLPORT)
+# include <unordered_map>
+# include <unordered_set>
+#endif
+
+//#include <iostream>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+# if defined (STLPORT)
+using namespace std::tr1;
+# endif
+#endif
+
+//
+// TestCase class
+//
+class UnorderedTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(UnorderedTest);
+#if !defined (STLPORT)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(uset);
+ CPPUNIT_TEST(umultiset);
+ CPPUNIT_TEST(umap);
+ CPPUNIT_TEST(umultimap);
+ CPPUNIT_TEST(user_case);
+ CPPUNIT_TEST(hash_policy);
+ CPPUNIT_TEST(buckets);
+ CPPUNIT_TEST(equal_range);
+ CPPUNIT_EXPLICIT_TEST(benchmark1);
+ CPPUNIT_EXPLICIT_TEST(benchmark2);
+#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(template_methods);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void uset();
+ void umultiset();
+ void umap();
+ void umultimap();
+ void user_case();
+ void hash_policy();
+ void buckets();
+ void equal_range();
+ void benchmark1();
+ void benchmark2();
+ void template_methods();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(UnorderedTest);
+
+const int NB_ELEMS = 2000;
+
+//
+// tests implementation
+//
+void UnorderedTest::uset()
+{
+#if defined (STLPORT)
+ typedef unordered_set<int, hash<int>, equal_to<int> > usettype;
+ usettype us;
+
+ //Small compilation check of the copy constructor:
+ usettype us2(us);
+ //And assignment operator
+ us = us2;
+
+ int i;
+ pair<usettype::iterator, bool> ret;
+ for (i = 0; i < NB_ELEMS; ++i) {
+ ret = us.insert(i);
+ CPPUNIT_ASSERT( ret.second );
+ CPPUNIT_ASSERT( *ret.first == i );
+
+ ret = us.insert(i);
+ CPPUNIT_ASSERT( !ret.second );
+ CPPUNIT_ASSERT( *ret.first == i );
+ }
+
+ vector<int> us_val;
+
+ usettype::local_iterator lit, litEnd;
+ for (i = 0; i < NB_ELEMS; ++i) {
+ lit = us.begin(us.bucket(i));
+ litEnd = us.end(us.bucket(i));
+
+ usettype::size_type bucket_pos = us.bucket(*lit);
+ for (; lit != litEnd; ++lit) {
+ CPPUNIT_ASSERT( us.bucket(*lit) == bucket_pos );
+ us_val.push_back(*lit);
+ }
+ }
+
+ //A compilation time check to uncomment from time to time
+ {
+ //usettype::iterator it;
+ //CPPUNIT_ASSERT( it != lit );
+ }
+
+ sort(us_val.begin(), us_val.end());
+ for (i = 0; i < NB_ELEMS; ++i) {
+ CPPUNIT_ASSERT( us_val[i] == i );
+ }
+#endif
+}
+
+void UnorderedTest::umultiset()
+{
+#if defined (STLPORT)
+ typedef unordered_multiset<int, hash<int>, equal_to<int> > usettype;
+ usettype us;
+
+ int i;
+ usettype::iterator ret;
+ for (i = 0; i < NB_ELEMS; ++i) {
+ ret = us.insert(i);
+ CPPUNIT_ASSERT( *ret == i );
+
+ ret = us.insert(i);
+ CPPUNIT_ASSERT( *ret == i );
+ }
+
+ CPPUNIT_ASSERT( us.size() == 2 * NB_ELEMS );
+ vector<int> us_val;
+
+ usettype::local_iterator lit, litEnd;
+ for (i = 0; i < NB_ELEMS; ++i) {
+ lit = us.begin(us.bucket(i));
+ litEnd = us.end(us.bucket(i));
+
+ usettype::size_type bucket_pos = us.bucket(*lit);
+ for (; lit != litEnd; ++lit) {
+ CPPUNIT_ASSERT( us.bucket(*lit) == bucket_pos );
+ us_val.push_back(*lit);
+ }
+ }
+
+ sort(us_val.begin(), us_val.end());
+ for (i = 0; i < NB_ELEMS; ++i) {
+ CPPUNIT_ASSERT( us_val[2 * i] == i );
+ CPPUNIT_ASSERT( us_val[2 * i + 1] == i );
+ }
+#endif
+}
+
+void UnorderedTest::umap()
+{
+#if defined (STLPORT)
+ typedef unordered_map<int, int, hash<int>, equal_to<int> > umaptype;
+ umaptype us;
+
+ //Compilation check of the [] operator:
+ umaptype us2;
+ us[0] = us2[0];
+ us.clear();
+
+ {
+ //An other compilation check
+ typedef unordered_map<int, umaptype> uumaptype;
+ uumaptype uus;
+ umaptype const& uref = uus[0];
+ umaptype ucopy = uus[0];
+ ucopy = uref;
+ //Avoids warning:
+ //(void*)&uref;
+ }
+
+ int i;
+ pair<umaptype::iterator, bool> ret;
+ for (i = 0; i < NB_ELEMS; ++i) {
+ umaptype::value_type p1(i, i);
+ ret = us.insert(p1);
+ CPPUNIT_ASSERT( ret.second );
+ CPPUNIT_ASSERT( *ret.first == p1 );
+
+ umaptype::value_type p2(i, i + 1);
+ ret = us.insert(p2);
+ CPPUNIT_ASSERT( !ret.second );
+ CPPUNIT_ASSERT( *ret.first == p1 );
+ }
+
+ {
+ //Lets look for some values to see if everything is normal:
+ umaptype::iterator umit;
+ for (int j = 0; j < NB_ELEMS; j += NB_ELEMS / 100) {
+ umit = us.find(j);
+
+ CPPUNIT_ASSERT( umit != us.end() );
+ CPPUNIT_ASSERT( (*umit).second == j );
+ }
+ }
+
+ CPPUNIT_ASSERT( us.size() == (size_t)NB_ELEMS );
+ vector<pair<int, int> > us_val;
+
+ umaptype::local_iterator lit, litEnd;
+ for (i = 0; i < NB_ELEMS; ++i) {
+ lit = us.begin(us.bucket(i));
+ litEnd = us.end(us.bucket(i));
+
+ umaptype::size_type bucket_pos = us.bucket((*lit).first);
+ for (; lit != litEnd; ++lit) {
+ CPPUNIT_ASSERT( us.bucket((*lit).first) == bucket_pos );
+ us_val.push_back(make_pair((*lit).first, (*lit).second));
+ }
+ }
+
+ sort(us_val.begin(), us_val.end());
+ for (i = 0; i < NB_ELEMS; ++i) {
+ CPPUNIT_ASSERT( us_val[i] == make_pair(i, i) );
+ }
+#endif
+}
+
+void UnorderedTest::umultimap()
+{
+#if defined (STLPORT)
+ typedef unordered_multimap<int, int, hash<int>, equal_to<int> > umaptype;
+ umaptype us;
+
+ int i;
+ umaptype::iterator ret;
+ for (i = 0; i < NB_ELEMS; ++i) {
+ umaptype::value_type p(i, i);
+ ret = us.insert(p);
+ CPPUNIT_ASSERT( *ret == p );
+
+ ret = us.insert(p);
+ CPPUNIT_ASSERT( *ret == p );
+ }
+
+ CPPUNIT_ASSERT( us.size() == 2 * NB_ELEMS );
+ typedef pair<int, int> ptype;
+ vector<ptype> us_val;
+
+ umaptype::local_iterator lit, litEnd;
+ for (i = 0; i < NB_ELEMS; ++i) {
+ lit = us.begin(us.bucket(i));
+ litEnd = us.end(us.bucket(i));
+
+ umaptype::size_type bucket_pos = us.bucket((*lit).first);
+ for (; lit != litEnd; ++lit) {
+ CPPUNIT_ASSERT( us.bucket((*lit).first) == bucket_pos );
+ us_val.push_back(ptype((*lit).first, (*lit).second));
+ }
+ }
+
+ sort(us_val.begin(), us_val.end());
+ for (i = 0; i < NB_ELEMS; ++i) {
+ ptype p(i, i);
+ CPPUNIT_ASSERT( us_val[i * 2] == p );
+ CPPUNIT_ASSERT( us_val[i * 2 + 1] == p );
+ }
+#endif
+}
+
+void UnorderedTest::user_case()
+{
+#if defined (STLPORT)
+ typedef unordered_map<int, string> UnorderedMap1;
+ typedef unordered_map<int, UnorderedMap1> UnorderedMap2;
+
+ UnorderedMap1 foo;
+ UnorderedMap2 bar;
+
+ foo.insert(UnorderedMap1::value_type(1, string("test1")));
+ foo.insert(UnorderedMap1::value_type(2, string("test2")));
+ foo.insert(UnorderedMap1::value_type(3, string("test3")));
+ foo.insert(UnorderedMap1::value_type(4, string("test4")));
+ foo.insert(UnorderedMap1::value_type(5, string("test5")));
+
+ bar.insert(UnorderedMap2::value_type(0, foo));
+ UnorderedMap2::iterator it = bar.find(0);
+ CPPUNIT_ASSERT( it != bar.end() );
+
+ UnorderedMap1 &body = it->second;
+ UnorderedMap1::iterator cur = body.find(3);
+ CPPUNIT_ASSERT( cur != body.end() );
+
+ body.erase(body.begin(), body.end());
+ CPPUNIT_ASSERT( body.empty() );
+#endif
+}
+
+void UnorderedTest::hash_policy()
+{
+#if defined (STLPORT)
+ unordered_set<int> int_uset;
+
+ CPPUNIT_ASSERT( int_uset.max_load_factor() == 1.0f );
+ CPPUNIT_ASSERT( int_uset.load_factor() == 0.0f );
+
+ size_t nbInserts = int_uset.bucket_count() - 1;
+ for (int i = 0; (size_t)i < nbInserts; ++i) {
+ int_uset.insert(i);
+ }
+ CPPUNIT_ASSERT( int_uset.size() == nbInserts );
+
+ int_uset.max_load_factor(0.5f);
+ int_uset.rehash(0);
+ CPPUNIT_ASSERT( int_uset.load_factor() < int_uset.max_load_factor() );
+
+ size_t bucketsHint = int_uset.bucket_count() + 1;
+ int_uset.rehash(bucketsHint);
+ CPPUNIT_ASSERT( int_uset.bucket_count() >= bucketsHint );
+
+ CPPUNIT_ASSERT( int_uset.key_eq()(10, 10) );
+ CPPUNIT_ASSERT( int_uset.hash_function()(10) == 10 );
+#endif
+}
+
+void UnorderedTest::buckets()
+{
+#if defined (STLPORT)
+ unordered_set<int> int_uset;
+
+ CPPUNIT_ASSERT( int_uset.bucket_count() < int_uset.max_bucket_count() );
+
+ int i;
+ size_t nbBuckets = int_uset.bucket_count();
+ size_t nbInserts = int_uset.bucket_count() - 1;
+ for (i = 0; (size_t)i < nbInserts; ++i) {
+ int_uset.insert(i);
+ }
+ CPPUNIT_ASSERT( nbBuckets == int_uset.bucket_count() );
+
+ size_t bucketSizes = 0;
+ for (i = 0; (size_t)i < nbBuckets; ++i) {
+ bucketSizes += int_uset.bucket_size(i);
+ }
+ CPPUNIT_ASSERT( bucketSizes == int_uset.size() );
+#endif
+}
+
+void UnorderedTest::equal_range()
+{
+#if defined (STLPORT)
+ typedef unordered_multiset<size_t> umset;
+ {
+ //General test
+ umset iumset;
+ iumset.max_load_factor(10.0f);
+
+ size_t nbBuckets = iumset.bucket_count();
+
+ for (size_t i = 0; i < nbBuckets; ++i) {
+ iumset.insert(i);
+ iumset.insert(i + nbBuckets);
+ iumset.insert(i + 2 * nbBuckets);
+ iumset.insert(i + 3 * nbBuckets);
+ iumset.insert(i + 4 * nbBuckets);
+ }
+
+ CPPUNIT_ASSERT( nbBuckets == iumset.bucket_count() );
+ CPPUNIT_ASSERT( iumset.size() == 5 * nbBuckets );
+
+ pair<umset::iterator, umset::iterator> p = iumset.equal_range(1);
+ CPPUNIT_ASSERT( p.first != p.second );
+
+ size_t nbElems = iumset.size();
+ nbElems -= distance(p.first, p.second);
+ for (umset::iterator j = p.first; j != p.second;) {
+ iumset.erase(j++);
+ }
+
+ CPPUNIT_ASSERT( nbElems == iumset.size() );
+
+ p = iumset.equal_range(2);
+ CPPUNIT_ASSERT( p.first != p.second );
+ nbElems -= distance(p.first, p.second);
+ iumset.erase(p.first, p.second);
+ CPPUNIT_ASSERT( nbElems == iumset.size() );
+ }
+
+ {
+ //More specific test that tries to put many values in the same bucket
+ umset iumset;
+
+ size_t i;
+ //We are going to add at least 20 values, to get a stable hash container while doing that
+ //we force a large number of buckets:
+ iumset.rehash(193);
+
+ size_t nbBuckets = iumset.bucket_count();
+ const size_t targetedBucket = nbBuckets / 2;
+
+ //Lets put 10 values in the targeted bucket:
+ for (i = 0; i < 10; ++i) {
+ iumset.insert(targetedBucket + (i * nbBuckets));
+ }
+
+ //We put again 10 values in the targeted bucket and in reverse order:
+ for (i = 9; i <= 10; --i) {
+ iumset.insert(targetedBucket + (i * nbBuckets));
+ }
+
+ //Now we put some more elements until hash container is resized:
+ i = 0;
+ while (iumset.bucket_count() == nbBuckets) {
+ iumset.insert(i++);
+ }
+
+ //CPPUNIT_ASSERT( iumset.bucket_size(targetedBucket) == 21 );
+
+ pair<umset::iterator, umset::iterator> p = iumset.equal_range(targetedBucket);
+ CPPUNIT_ASSERT( p.first != p.second );
+ CPPUNIT_ASSERT( distance(p.first, p.second) == 3 );
+
+ // Now we remove some elements until hash container is resized:
+ nbBuckets = iumset.bucket_count();
+ while (iumset.bucket_count() == nbBuckets &&
+ !iumset.empty()) {
+ iumset.erase(iumset.begin());
+ }
+ CPPUNIT_ASSERT( iumset.load_factor() <= iumset.max_load_factor() );
+
+ // Adding an element back shouldn't change number of buckets:
+ nbBuckets = iumset.bucket_count();
+ iumset.insert(0);
+ CPPUNIT_ASSERT( iumset.bucket_count() == nbBuckets );
+ }
+
+ {
+ srand(0);
+ for (int runs = 0; runs < 2; ++runs) {
+ size_t magic = rand();
+ umset hum;
+ size_t c = 0;
+ for (int i = 0; i < 10000; ++i) {
+ if ((rand() % 500) == 0) {
+ hum.insert(magic);
+ ++c;
+ }
+ else {
+ size_t r;
+ while ((r = rand()) == magic)
+ ;
+ hum.insert(r);
+ }
+
+ /*
+ if ((float)(hum.size() + 1) / (float)hum.bucket_count() > hum.max_load_factor()) {
+ cout << "Hash container dump: Nb elems: " << hum.size() << ", Nb buckets: " << hum.bucket_count() << "\n";
+ for (size_t b = 0; b < hum.bucket_count(); ++b) {
+ if (hum.bucket_size(b) != 0) {
+ umset::local_iterator litBegin(hum.begin(b)), litEnd(hum.end(b));
+ cout << "B" << b << ": ";
+ for (umset::local_iterator lit = litBegin; lit != litEnd; ++lit) {
+ if (lit != litBegin) {
+ cout << " - ";
+ }
+ cout << *lit;
+ }
+ cout << "\n";
+ }
+ }
+ cout << endl;
+ }
+ */
+ }
+ CPPUNIT_ASSERT( hum.count(magic) == c );
+ }
+ }
+#endif
+}
+
+void UnorderedTest::benchmark1()
+{
+#if defined (STLPORT)
+ typedef unordered_multiset<size_t> umset;
+
+ const size_t target = 500000;
+ umset iumset;
+ iumset.max_load_factor(10);
+ size_t i;
+ for (i = 0; i < target; ++i) {
+ iumset.insert(i);
+ }
+
+ for (i = 0; i < target; ++i) {
+ iumset.erase(i);
+ }
+#endif
+}
+
+void UnorderedTest::benchmark2()
+{
+#if defined (STLPORT)
+ typedef unordered_multiset<size_t> umset;
+
+ const size_t target = 500000;
+ umset iumset;
+ iumset.max_load_factor(10);
+ size_t i;
+ for (i = 0; i < target; ++i) {
+ iumset.insert(target - i);
+ }
+
+ for (i = 0; i < target; ++i) {
+ iumset.erase(target - i);
+ }
+#endif
+}
+
+struct Key
+{
+ Key() : m_data(0) {}
+ explicit Key(int data) : m_data(data) {}
+
+ int m_data;
+
+#if defined (__DMC__) // slist<_Tp,_Alloc>::remove error
+ bool operator==(const Key&) const;
+#endif
+};
+
+struct KeyHash
+{
+ size_t operator () (Key key) const
+ { return (size_t)key.m_data; }
+
+ size_t operator () (int data) const
+ { return (size_t)data; }
+};
+
+struct KeyEqual
+{
+ bool operator () (Key lhs, Key rhs) const
+ { return lhs.m_data == rhs.m_data; }
+
+ bool operator () (Key lhs, int rhs) const
+ { return lhs.m_data == rhs; }
+
+ bool operator () (int lhs, Key rhs) const
+ { return lhs == rhs.m_data; }
+};
+
+struct KeyHashPtr
+{
+ size_t operator () (Key const volatile *key) const
+ { return (size_t)key->m_data; }
+
+ size_t operator () (int data) const
+ { return (size_t)data; }
+};
+
+struct KeyEqualPtr
+{
+ bool operator () (Key const volatile *lhs, Key const volatile *rhs) const
+ { return lhs->m_data == rhs->m_data; }
+
+ bool operator () (Key const volatile *lhs, int rhs) const
+ { return lhs->m_data == rhs; }
+
+ bool operator () (int lhs, Key const volatile *rhs) const
+ { return lhs == rhs->m_data; }
+};
+
+void UnorderedTest::template_methods()
+{
+#if defined (STLPORT) && defined (_STLP_USE_CONTAINERS_EXTENSION)
+ {
+ typedef unordered_set<Key, KeyHash, KeyEqual> Container;
+ Container cont;
+ cont.insert(Key(1));
+ cont.insert(Key(2));
+ cont.insert(Key(3));
+ cont.insert(Key(4));
+
+ CPPUNIT_ASSERT( cont.count(Key(1)) == 1 );
+ CPPUNIT_ASSERT( cont.count(1) == 1 );
+ CPPUNIT_ASSERT( cont.count(5) == 0 );
+
+ CPPUNIT_ASSERT( cont.find(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) );
+
+ Container const& ccont = cont;
+ CPPUNIT_ASSERT( ccont.find(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.bucket(2) == ccont.bucket(2) );
+ CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.begin(), ccont.end()) );
+ }
+
+ {
+ typedef unordered_set<Key*, KeyHashPtr, KeyEqualPtr> Container;
+ Container cont;
+ Key key1(1), key2(2), key3(3), key4(4);
+ cont.insert(&key1);
+ cont.insert(&key2);
+ cont.insert(&key3);
+ cont.insert(&key4);
+
+ CPPUNIT_ASSERT( cont.count(1) == 1 );
+ CPPUNIT_ASSERT( cont.count(5) == 0 );
+
+ CPPUNIT_ASSERT( cont.find(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) );
+
+ Container const& ccont = cont;
+ CPPUNIT_ASSERT( ccont.find(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.bucket(2) == ccont.bucket(2) );
+ CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.begin(), ccont.end()) );
+ }
+ {
+ typedef unordered_multiset<Key, KeyHash, KeyEqual> Container;
+ Container cont;
+ cont.insert(Key(1));
+ cont.insert(Key(2));
+ cont.insert(Key(1));
+ cont.insert(Key(2));
+
+ CPPUNIT_ASSERT( cont.count(Key(1)) == 2 );
+ CPPUNIT_ASSERT( cont.count(1) == 2 );
+ CPPUNIT_ASSERT( cont.count(5) == 0 );
+
+ CPPUNIT_ASSERT( cont.find(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.equal_range(1) != make_pair(cont.end(), cont.end()) );
+
+ Container const& ccont = cont;
+ CPPUNIT_ASSERT( ccont.find(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.bucket(2) == ccont.bucket(2) );
+ CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.end(), ccont.end()) );
+ }
+
+ {
+ typedef unordered_multiset<Key const volatile*, KeyHashPtr, KeyEqualPtr> Container;
+ Container cont;
+ Key key1(1), key2(2), key3(3), key4(4);
+ cont.insert(&key1);
+ cont.insert(&key2);
+ cont.insert(&key3);
+ cont.insert(&key4);
+
+ CPPUNIT_ASSERT( cont.count(1) == 1 );
+ CPPUNIT_ASSERT( cont.count(5) == 0 );
+
+ CPPUNIT_ASSERT( cont.find(2) != cont.end() );
+ CPPUNIT_ASSERT( cont.equal_range(2) != make_pair(cont.begin(), cont.end()) );
+
+ Container const& ccont = cont;
+ CPPUNIT_ASSERT( ccont.find(2) != ccont.end() );
+ CPPUNIT_ASSERT( ccont.bucket(2) == ccont.bucket(2) );
+ CPPUNIT_ASSERT( ccont.equal_range(2) != make_pair(ccont.begin(), ccont.end()) );
+ }
+#endif
+}
+
+#if defined (STLPORT) && \
+ (!defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION))
+# if !defined (__DMC__)
+/* Simple compilation test: Check that nested types like iterator
+ * can be access even if type used to instanciate container is not
+ * yet completely defined.
+ */
+class IncompleteClass
+{
+ unordered_set<IncompleteClass> usinstances;
+ typedef unordered_set<IncompleteClass>::iterator usit;
+ unordered_multiset<IncompleteClass> usminstances;
+ typedef unordered_multiset<IncompleteClass>::iterator usmit;
+
+ unordered_map<IncompleteClass, IncompleteClass> uminstances;
+ typedef unordered_map<IncompleteClass, IncompleteClass>::iterator umit;
+ unordered_multimap<IncompleteClass, IncompleteClass> umminstances;
+ typedef unordered_multimap<IncompleteClass, IncompleteClass>::iterator ummit;
+};
+# endif
+#endif
diff --git a/test/unit/utility_header_test.cpp b/test/unit/utility_header_test.cpp
new file mode 100644
index 0000000..78d67fb
--- /dev/null
+++ b/test/unit/utility_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <utility>
diff --git a/test/unit/valarray_header_test.cpp b/test/unit/valarray_header_test.cpp
new file mode 100644
index 0000000..f736264
--- /dev/null
+++ b/test/unit/valarray_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <valarray>
diff --git a/test/unit/valarray_test.cpp b/test/unit/valarray_test.cpp
new file mode 100644
index 0000000..87ee3dc
--- /dev/null
+++ b/test/unit/valarray_test.cpp
@@ -0,0 +1,121 @@
+#include <valarray>
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class ValarrayTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(ValarrayTest);
+ CPPUNIT_TEST(transcendentals);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void transcendentals();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ValarrayTest);
+
+//
+// tests implementation
+//
+// For the moment this test is just a complitation test
+// everyone is welcome to do a real good unit test for
+// valarray functionality.
+void ValarrayTest::transcendentals()
+{
+#ifdef __SUNPRO_CC
+ using std::abs;
+#endif
+ {
+ valarray<double> darray;
+ valarray<double> tmp;
+ tmp = abs(darray);
+ tmp = acos(darray);
+ tmp = asin(darray);
+ tmp = atan(darray);
+ tmp = atan2(darray, tmp);
+ tmp = atan2(1.0, darray);
+ tmp = atan2(darray, 1.0);
+ tmp = cos(darray);
+ tmp = cosh(darray);
+ tmp = sin(darray);
+ tmp = sinh(darray);
+ tmp = tan(darray);
+#if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64)
+ tmp = tanh(darray);
+#endif
+ tmp = exp(darray);
+ tmp = log(darray);
+ tmp = log10(darray);
+ tmp = pow(darray, tmp);
+ tmp = pow(1.0, darray);
+ tmp = pow(darray, 1.0);
+ tmp = sqrt(darray);
+ }
+ {
+ valarray<float> farray;
+ valarray<float> tmp;
+ tmp = abs(farray);
+ tmp = acos(farray);
+ tmp = asin(farray);
+ tmp = atan(farray);
+ tmp = atan2(farray, tmp);
+ tmp = atan2(1.0f, farray);
+ tmp = atan2(farray, 1.0f);
+ tmp = cos(farray);
+ tmp = cosh(farray);
+ tmp = sin(farray);
+ tmp = sinh(farray);
+ tmp = tan(farray);
+#if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64)
+ tmp = tanh(farray);
+#endif
+ tmp = exp(farray);
+ tmp = log(farray);
+ tmp = log10(farray);
+ tmp = pow(farray, tmp);
+ tmp = pow(1.0f, farray);
+ tmp = pow(farray, 1.0f);
+ tmp = sqrt(farray);
+ }
+#if !defined (STLPORT) || !defined (_STLP_NO_LONG_DOUBLE)
+ {
+ valarray<long double> ldarray;
+ valarray<long double> tmp;
+ tmp = abs(ldarray);
+ tmp = acos(ldarray);
+ tmp = asin(ldarray);
+ tmp = atan(ldarray);
+ tmp = atan2(ldarray, tmp);
+ tmp = atan2(1.0l, ldarray);
+ tmp = atan2(ldarray, 1.0l);
+ tmp = cos(ldarray);
+ tmp = cosh(ldarray);
+ tmp = sin(ldarray);
+ tmp = sinh(ldarray);
+ tmp = tan(ldarray);
+# if !defined (STLPORT) || !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_M_AMD64)
+ tmp = tanh(ldarray);
+# endif
+ tmp = exp(ldarray);
+ tmp = log(ldarray);
+ tmp = log10(ldarray);
+ tmp = pow(ldarray, tmp);
+ tmp = pow(1.0l, ldarray);
+ tmp = pow(ldarray, 1.0l);
+ tmp = sqrt(ldarray);
+ }
+#endif
+ valarray<double> v0(2, 10);
+ valarray<double> v1(v0[slice(0, 1, 5)]);
+ v0[slice(0, 1, 5)] = 5;
+ valarray<double> v2(v0[gslice()]);
+ //valarray<double> v3(v0[valarray<bool>()]);
+ valarray<double> v4(v0[valarray<size_t>()]);
+}
diff --git a/test/unit/vector_header_test.cpp b/test/unit/vector_header_test.cpp
new file mode 100644
index 0000000..69d2bfa
--- /dev/null
+++ b/test/unit/vector_header_test.cpp
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <vector>
diff --git a/test/unit/vector_test.cpp b/test/unit/vector_test.cpp
new file mode 100644
index 0000000..a23ba1d
--- /dev/null
+++ b/test/unit/vector_test.cpp
@@ -0,0 +1,553 @@
+//Has to be first for StackAllocator swap overload to be taken
+//into account (at least using GCC 4.0.1)
+#include "stack_allocator.h"
+
+#include <vector>
+#include <algorithm>
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+# include <stdexcept>
+#endif
+
+#include "cppunit/cppunit_proxy.h"
+
+#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
+using namespace std;
+#endif
+
+//
+// TestCase class
+//
+class VectorTest : public CPPUNIT_NS::TestCase
+{
+ CPPUNIT_TEST_SUITE(VectorTest);
+ CPPUNIT_TEST(vec_test_1);
+ CPPUNIT_TEST(vec_test_2);
+ CPPUNIT_TEST(vec_test_3);
+ CPPUNIT_TEST(vec_test_4);
+ CPPUNIT_TEST(vec_test_5);
+ CPPUNIT_TEST(vec_test_6);
+ CPPUNIT_TEST(vec_test_7);
+ CPPUNIT_TEST(capacity);
+ CPPUNIT_TEST(at);
+ CPPUNIT_TEST(pointer);
+ CPPUNIT_TEST(auto_ref);
+ CPPUNIT_TEST(allocator_with_state);
+ CPPUNIT_TEST(iterators);
+#if defined (STLPORT) && defined (_STLP_NO_MEMBER_TEMPLATES)
+ CPPUNIT_IGNORE;
+#endif
+ CPPUNIT_TEST(optimizations_check);
+ CPPUNIT_TEST(assign_check);
+ CPPUNIT_STOP_IGNORE;
+ CPPUNIT_TEST(ebo);
+ CPPUNIT_TEST_SUITE_END();
+
+protected:
+ void vec_test_1();
+ void vec_test_2();
+ void vec_test_3();
+ void vec_test_4();
+ void vec_test_5();
+ void vec_test_6();
+ void vec_test_7();
+ void capacity();
+ void at();
+ void pointer();
+ void auto_ref();
+ void allocator_with_state();
+ void iterators();
+ void optimizations_check();
+ void assign_check();
+ void ebo();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(VectorTest);
+
+//
+// tests implementation
+//
+void VectorTest::vec_test_1()
+{
+ vector<int> v1; // Empty vector of integers.
+
+ CPPUNIT_ASSERT( v1.empty() == true );
+ CPPUNIT_ASSERT( v1.size() == 0 );
+
+ // CPPUNIT_ASSERT( v1.max_size() == INT_MAX / sizeof(int) );
+ // cout << "max_size = " << v1.max_size() << endl;
+ v1.push_back(42); // Add an integer to the vector.
+
+ CPPUNIT_ASSERT( v1.size() == 1 );
+
+ CPPUNIT_ASSERT( v1[0] == 42 );
+
+ {
+ vector<vector<int> > vect(10);
+ vector<vector<int> >::iterator it(vect.begin()), end(vect.end());
+ for (; it != end; ++it) {
+ CPPUNIT_ASSERT( (*it).empty() );
+ CPPUNIT_ASSERT( (*it).size() == 0 );
+ CPPUNIT_ASSERT( (*it).capacity() == 0 );
+ CPPUNIT_ASSERT( (*it).begin() == (*it).end() );
+ }
+ }
+}
+
+void VectorTest::vec_test_2()
+{
+ vector<double> v1; // Empty vector of doubles.
+ v1.push_back(32.1);
+ v1.push_back(40.5);
+ vector<double> v2; // Another empty vector of doubles.
+ v2.push_back(3.56);
+
+ CPPUNIT_ASSERT( v1.size() == 2 );
+ CPPUNIT_ASSERT( v1[0] == 32.1 );
+ CPPUNIT_ASSERT( v1[1] == 40.5 );
+
+ CPPUNIT_ASSERT( v2.size() == 1 );
+ CPPUNIT_ASSERT( v2[0] == 3.56 );
+ size_t v1Cap = v1.capacity();
+ size_t v2Cap = v2.capacity();
+
+ v1.swap(v2); // Swap the vector's contents.
+
+ CPPUNIT_ASSERT( v1.size() == 1 );
+ CPPUNIT_ASSERT( v1.capacity() == v2Cap );
+ CPPUNIT_ASSERT( v1[0] == 3.56 );
+
+ CPPUNIT_ASSERT( v2.size() == 2 );
+ CPPUNIT_ASSERT( v2.capacity() == v1Cap );
+ CPPUNIT_ASSERT( v2[0] == 32.1 );
+ CPPUNIT_ASSERT( v2[1] == 40.5 );
+
+ v2 = v1; // Assign one vector to another.
+
+ CPPUNIT_ASSERT( v2.size() == 1 );
+ CPPUNIT_ASSERT( v2[0] == 3.56 );
+}
+
+void VectorTest::vec_test_3()
+{
+ typedef vector<char> vec_type;
+
+ vec_type v1; // Empty vector of characters.
+ v1.push_back('h');
+ v1.push_back('i');
+
+ CPPUNIT_ASSERT( v1.size() == 2 );
+ CPPUNIT_ASSERT( v1[0] == 'h' );
+ CPPUNIT_ASSERT( v1[1] == 'i' );
+
+ vec_type v2(v1.begin(), v1.end());
+ v2[1] = 'o'; // Replace second character.
+
+ CPPUNIT_ASSERT( v2.size() == 2 );
+ CPPUNIT_ASSERT( v2[0] == 'h' );
+ CPPUNIT_ASSERT( v2[1] == 'o' );
+
+ CPPUNIT_ASSERT( (v1 == v2) == false );
+
+ CPPUNIT_ASSERT( (v1 < v2) == true );
+}
+
+void VectorTest::vec_test_4()
+{
+ vector<int> v(4);
+
+ v[0] = 1;
+ v[1] = 4;
+ v[2] = 9;
+ v[3] = 16;
+
+ CPPUNIT_ASSERT( v.front() == 1 );
+ CPPUNIT_ASSERT( v.back() == 16 );
+
+ v.push_back(25);
+
+ CPPUNIT_ASSERT( v.back() == 25 );
+ CPPUNIT_ASSERT( v.size() == 5 );
+
+ v.pop_back();
+
+ CPPUNIT_ASSERT( v.back() == 16 );
+ CPPUNIT_ASSERT( v.size() == 4 );
+}
+
+void VectorTest::vec_test_5()
+{
+ int array [] = { 1, 4, 9, 16 };
+
+ vector<int> v(array, array + 4);
+
+ CPPUNIT_ASSERT( v.size() == 4 );
+
+ CPPUNIT_ASSERT( v[0] == 1 );
+ CPPUNIT_ASSERT( v[1] == 4 );
+ CPPUNIT_ASSERT( v[2] == 9 );
+ CPPUNIT_ASSERT( v[3] == 16 );
+}
+
+void VectorTest::vec_test_6()
+{
+ int array [] = { 1, 4, 9, 16, 25, 36 };
+
+ vector<int> v(array, array + 6);
+ vector<int>::iterator vit;
+
+ CPPUNIT_ASSERT( v.size() == 6 );
+ CPPUNIT_ASSERT( v[0] == 1 );
+ CPPUNIT_ASSERT( v[1] == 4 );
+ CPPUNIT_ASSERT( v[2] == 9 );
+ CPPUNIT_ASSERT( v[3] == 16 );
+ CPPUNIT_ASSERT( v[4] == 25 );
+ CPPUNIT_ASSERT( v[5] == 36 );
+
+ vit = v.erase( v.begin() ); // Erase first element.
+ CPPUNIT_ASSERT( *vit == 4 );
+
+ CPPUNIT_ASSERT( v.size() == 5 );
+ CPPUNIT_ASSERT( v[0] == 4 );
+ CPPUNIT_ASSERT( v[1] == 9 );
+ CPPUNIT_ASSERT( v[2] == 16 );
+ CPPUNIT_ASSERT( v[3] == 25 );
+ CPPUNIT_ASSERT( v[4] == 36 );
+
+ vit = v.erase(v.end() - 1); // Erase last element.
+ CPPUNIT_ASSERT( vit == v.end() );
+
+ CPPUNIT_ASSERT( v.size() == 4 );
+ CPPUNIT_ASSERT( v[0] == 4 );
+ CPPUNIT_ASSERT( v[1] == 9 );
+ CPPUNIT_ASSERT( v[2] == 16 );
+ CPPUNIT_ASSERT( v[3] == 25 );
+
+
+ v.erase(v.begin() + 1, v.end() - 1); // Erase all but first and last.
+
+ CPPUNIT_ASSERT( v.size() == 2 );
+ CPPUNIT_ASSERT( v[0] == 4 );
+ CPPUNIT_ASSERT( v[1] == 25 );
+
+}
+
+void VectorTest::vec_test_7()
+{
+ int array1 [] = { 1, 4, 25 };
+ int array2 [] = { 9, 16 };
+
+ vector<int> v(array1, array1 + 3);
+ vector<int>::iterator vit;
+ vit = v.insert(v.begin(), 0); // Insert before first element.
+ CPPUNIT_ASSERT( *vit == 0 );
+
+ vit = v.insert(v.end(), 36); // Insert after last element.
+ CPPUNIT_ASSERT( *vit == 36 );
+
+ CPPUNIT_ASSERT( v.size() == 5 );
+ CPPUNIT_ASSERT( v[0] == 0 );
+ CPPUNIT_ASSERT( v[1] == 1 );
+ CPPUNIT_ASSERT( v[2] == 4 );
+ CPPUNIT_ASSERT( v[3] == 25 );
+ CPPUNIT_ASSERT( v[4] == 36 );
+
+ // Insert contents of array2 before fourth element.
+ v.insert(v.begin() + 3, array2, array2 + 2);
+
+ CPPUNIT_ASSERT( v.size() == 7 );
+
+ CPPUNIT_ASSERT( v[0] == 0 );
+ CPPUNIT_ASSERT( v[1] == 1 );
+ CPPUNIT_ASSERT( v[2] == 4 );
+ CPPUNIT_ASSERT( v[3] == 9 );
+ CPPUNIT_ASSERT( v[4] == 16 );
+ CPPUNIT_ASSERT( v[5] == 25 );
+ CPPUNIT_ASSERT( v[6] == 36 );
+
+ v.clear();
+ CPPUNIT_ASSERT( v.empty() );
+
+ v.insert(v.begin(), 5, 10);
+ CPPUNIT_ASSERT( v.size() == 5 );
+ CPPUNIT_ASSERT( v[0] == 10 );
+ CPPUNIT_ASSERT( v[1] == 10 );
+ CPPUNIT_ASSERT( v[2] == 10 );
+ CPPUNIT_ASSERT( v[3] == 10 );
+ CPPUNIT_ASSERT( v[4] == 10 );
+
+ /*
+ {
+ vector<float> vf(2.0f, 3.0f);
+ CPPUNIT_ASSERT( vf.size() == 2 );
+ CPPUNIT_ASSERT( vf.front() == 3.0f );
+ CPPUNIT_ASSERT( vf.back() == 3.0f );
+ }
+ */
+}
+
+struct TestStruct
+{
+ unsigned int a[3];
+};
+
+void VectorTest::capacity()
+{
+ {
+ vector<int> v;
+
+ CPPUNIT_ASSERT( v.capacity() == 0 );
+ v.push_back(42);
+ CPPUNIT_ASSERT( v.capacity() >= 1 );
+ v.reserve(5000);
+ CPPUNIT_ASSERT( v.capacity() >= 5000 );
+ }
+
+ {
+ //Test that used to generate an assertion when using __debug_alloc.
+ vector<TestStruct> va;
+ va.reserve(1);
+ va.reserve(2);
+ }
+}
+
+void VectorTest::at() {
+ vector<int> v;
+ vector<int> const& cv = v;
+
+ v.push_back(10);
+ CPPUNIT_ASSERT( v.at(0) == 10 );
+ v.at(0) = 20;
+ CPPUNIT_ASSERT( cv.at(0) == 20 );
+
+#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
+ try {
+ v.at(1) = 20;
+ CPPUNIT_FAIL;
+ }
+ catch (out_of_range const&) {
+ }
+ catch (...) {
+ CPPUNIT_FAIL;
+ }
+#endif
+}
+
+void VectorTest::pointer()
+{
+ vector<int *> v1;
+ vector<int *> v2 = v1;
+ vector<int *> v3;
+
+ v3.insert( v3.end(), v1.begin(), v1.end() );
+}
+
+void VectorTest::auto_ref()
+{
+ vector<int> ref;
+ for (int i = 0; i < 5; ++i) {
+ ref.push_back(i);
+ }
+
+ vector<vector<int> > v_v_int(1, ref);
+ v_v_int.push_back(v_v_int[0]);
+ v_v_int.push_back(ref);
+ v_v_int.push_back(v_v_int[0]);
+ v_v_int.push_back(v_v_int[0]);
+ v_v_int.push_back(ref);
+
+ vector<vector<int> >::iterator vvit(v_v_int.begin()), vvitEnd(v_v_int.end());
+ for (; vvit != vvitEnd; ++vvit) {
+ CPPUNIT_ASSERT( *vvit == ref );
+ }
+
+ /*
+ * Forbidden by the Standard:
+ v_v_int.insert(v_v_int.end(), v_v_int.begin(), v_v_int.end());
+ for (vvit = v_v_int.begin(), vvitEnd = v_v_int.end();
+ vvit != vvitEnd; ++vvit) {
+ CPPUNIT_ASSERT( *vvit == ref );
+ }
+ */
+}
+
+void VectorTest::allocator_with_state()
+ {
+ char buf1[1024];
+ StackAllocator<int> stack1(buf1, buf1 + sizeof(buf1));
+
+ char buf2[1024];
+ StackAllocator<int> stack2(buf2, buf2 + sizeof(buf2));
+
+ {
+ typedef vector<int, StackAllocator<int> > VectorInt;
+ VectorInt vint1(10, 0, stack1);
+ VectorInt vint1Cpy(vint1);
+
+ VectorInt vint2(10, 1, stack2);
+ VectorInt vint2Cpy(vint2);
+
+ vint1.swap(vint2);
+
+ CPPUNIT_ASSERT( vint1.get_allocator().swaped() );
+ CPPUNIT_ASSERT( vint2.get_allocator().swaped() );
+
+ CPPUNIT_ASSERT( vint1 == vint2Cpy );
+ CPPUNIT_ASSERT( vint2 == vint1Cpy );
+ CPPUNIT_ASSERT( vint1.get_allocator() == stack2 );
+ CPPUNIT_ASSERT( vint2.get_allocator() == stack1 );
+ }
+ CPPUNIT_ASSERT( stack1.ok() );
+ CPPUNIT_ASSERT( stack2.ok() );
+ }
+
+struct Point {
+ int x, y;
+};
+
+struct PointEx : public Point {
+ PointEx() : builtFromBase(false) {}
+ PointEx(const Point&) : builtFromBase(true) {}
+
+ bool builtFromBase;
+};
+
+#if defined (STLPORT)
+# if defined (_STLP_USE_NAMESPACES)
+namespace std {
+# endif
+ _STLP_TEMPLATE_NULL
+ struct __type_traits<PointEx> {
+ typedef __false_type has_trivial_default_constructor;
+ typedef __true_type has_trivial_copy_constructor;
+ typedef __true_type has_trivial_assignment_operator;
+ typedef __true_type has_trivial_destructor;
+ typedef __true_type is_POD_type;
+ };
+# if defined (_STLP_USE_NAMESPACES)
+}
+# endif
+#endif
+
+//This test check that vector implementation do not over optimize
+//operation as PointEx copy constructor is trivial
+void VectorTest::optimizations_check()
+{
+#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES)
+ vector<Point> v1(1);
+ CPPUNIT_ASSERT( v1.size() == 1 );
+
+ vector<PointEx> v2(v1.begin(), v1.end());
+ CPPUNIT_ASSERT( v2.size() == 1 );
+ CPPUNIT_ASSERT( v2[0].builtFromBase == true );
+#endif
+}
+
+void VectorTest::assign_check()
+{
+#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES)
+ vector<int> v(3,1);
+ int array[] = { 1, 2, 3, 4, 5 };
+
+ v.assign( array, array + 5 );
+ CPPUNIT_CHECK( v[4] == 5 );
+ CPPUNIT_CHECK( v[0] == 1 );
+ CPPUNIT_CHECK( v[1] == 2 );
+#endif
+}
+
+void VectorTest::iterators()
+{
+ vector<int> vint(10, 0);
+ vector<int> const& crvint = vint;
+
+ CPPUNIT_ASSERT( vint.begin() == vint.begin() );
+ CPPUNIT_ASSERT( crvint.begin() == vint.begin() );
+ CPPUNIT_ASSERT( vint.begin() == crvint.begin() );
+ CPPUNIT_ASSERT( crvint.begin() == crvint.begin() );
+
+ CPPUNIT_ASSERT( vint.begin() != vint.end() );
+ CPPUNIT_ASSERT( crvint.begin() != vint.end() );
+ CPPUNIT_ASSERT( vint.begin() != crvint.end() );
+ CPPUNIT_ASSERT( crvint.begin() != crvint.end() );
+
+ CPPUNIT_ASSERT( vint.rbegin() == vint.rbegin() );
+ // Not Standard:
+ //CPPUNIT_ASSERT( vint.rbegin() == crvint.rbegin() );
+ //CPPUNIT_ASSERT( crvint.rbegin() == vint.rbegin() );
+ CPPUNIT_ASSERT( crvint.rbegin() == crvint.rbegin() );
+
+ CPPUNIT_ASSERT( vint.rbegin() != vint.rend() );
+ // Not Standard:
+ //CPPUNIT_ASSERT( vint.rbegin() != crvint.rend() );
+ //CPPUNIT_ASSERT( crvint.rbegin() != vint.rend() );
+ CPPUNIT_ASSERT( crvint.rbegin() != crvint.rend() );
+}
+
+
+#if !defined (STLPORT) || \
+ !defined (_STLP_USE_PTR_SPECIALIZATIONS) || defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
+/* Simple compilation test: Check that nested types like iterator
+ * can be access even if type used to instanciate container is not
+ * yet completely defined.
+ */
+class IncompleteClass
+{
+ vector<IncompleteClass> instances;
+ typedef vector<IncompleteClass>::iterator it;
+};
+#endif
+
+#if defined (STLPORT)
+# define NOTHROW _STLP_NOTHROW
+#else
+# define NOTHROW throw()
+#endif
+
+/* This allocator implementation purpose is simply to break some
+ * internal STLport mecanism specific to the STLport own allocator
+ * implementation. */
+template <class _Tp>
+struct NotSTLportAllocator : public allocator<_Tp> {
+#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATE_CLASSES)
+ template <class _Tp1> struct rebind {
+ typedef NotSTLportAllocator<_Tp1> other;
+ };
+#endif
+ NotSTLportAllocator() NOTHROW {}
+#if !defined (STLPORT) || defined (_STLP_MEMBER_TEMPLATES)
+ template <class _Tp1> NotSTLportAllocator(const NotSTLportAllocator<_Tp1>&) NOTHROW {}
+#endif
+ NotSTLportAllocator(const NotSTLportAllocator<_Tp>&) NOTHROW {}
+ ~NotSTLportAllocator() NOTHROW {}
+};
+
+/* This test check a potential issue with empty base class
+ * optimization. Some compilers (VC6) do not implement it
+ * correctly resulting ina wrong behavior. */
+void VectorTest::ebo()
+{
+ // We use heap memory as test failure can corrupt vector internal
+ // representation making executable crash on vector destructor invocation.
+ // We prefer a simple memory leak, internal corruption should be reveal
+ // by size or capacity checks.
+ typedef vector<int, NotSTLportAllocator<int> > V;
+ V *pv1 = new V(1, 1);
+ V *pv2 = new V(10, 2);
+
+ size_t v1Capacity = pv1->capacity();
+ size_t v2Capacity = pv2->capacity();
+
+ pv1->swap(*pv2);
+
+ CPPUNIT_ASSERT( pv1->size() == 10 );
+ CPPUNIT_ASSERT( pv1->capacity() == v2Capacity );
+ CPPUNIT_ASSERT( (*pv1)[5] == 2 );
+
+ CPPUNIT_ASSERT( pv2->size() == 1 );
+ CPPUNIT_ASSERT( pv2->capacity() == v1Capacity );
+ CPPUNIT_ASSERT( (*pv2)[0] == 1 );
+
+ delete pv2;
+ delete pv1;
+}
+
diff --git a/test/unit/wchar_header_test.c b/test/unit/wchar_header_test.c
new file mode 100644
index 0000000..36376fe
--- /dev/null
+++ b/test/unit/wchar_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <wchar.h>
diff --git a/test/unit/wctype_header_test.c b/test/unit/wctype_header_test.c
new file mode 100644
index 0000000..639878c
--- /dev/null
+++ b/test/unit/wctype_header_test.c
@@ -0,0 +1,8 @@
+/* This test purpose is simply to check Standard header independancy that
+ * is to say that the header can be included alone without any previous
+ * include.
+ * Additionnaly, for C Standard headers that STLport expose, it can also be
+ * used to check that files included by those headers are compatible with
+ * pure C compilers.
+ */
+#include <wctype.h>
diff --git a/time.h b/time.h
deleted file mode 100644
index 8d10bfc..0000000
--- a/time.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x272
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x272) && ! defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-#ifdef _STLP_WCE_EVC3
-// only show message when directly including this file in a non-library build
-# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x272)
-# pragma message("eMbedded Visual C++ 3 doesn't have a time.h header; STLport won't include native time.h here")
-# endif
-#else
-# include _STLP_NATIVE_C_HEADER(time.h)
-#endif
-
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x272)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-#endif
-
-/* Local Variables:
- * mode:C++
- * End:
- */
diff --git a/typeinfo b/typeinfo
deleted file mode 100644
index ffa51a7..0000000
--- a/typeinfo
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_TYPEINFO
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x473
-# define _STLP_TYPEINFO
-# include <stl/_prolog.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID != 0x473)
-# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo)
-#else
-# ifndef _STLP_INTERNAL_TYPEINFO
-# include <stl/_typeinfo.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x473)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/typeinfo.h b/typeinfo.h
deleted file mode 100644
index 1b565af..0000000
--- a/typeinfo.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_OLDSTD_typeinfo
-#define _STLP_OLDSTD_typeinfo
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x874
-# include <stl/_prolog.h>
-#endif
-
-#ifndef _STLP_NO_TYPEINFO
-
-# if defined (__GNUC__)
-# undef _STLP_OLDSTD_typeinfo
-# include <typeinfo>
-# define _STLP_OLDSTD_typeinfo
-# else
-# if !defined (__BORLANDC__) || (__BORLANDC__ < 0x580)
-# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo.h)
-# else
-# include _STLP_NATIVE_CPP_C_HEADER(typeinfo.h)
-# endif
-# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x580) || \
- defined (__DMC__)
-using std::type_info;
-using std::bad_typeid;
-using std::bad_cast;
-# endif
-# endif
-
-// if <typeinfo> already included, do not import anything
-
-# if defined (_STLP_USE_OWN_NAMESPACE) && !(defined (_STLP_TYPEINFO) && !defined (_STLP_NO_NEW_NEW_HEADER))
-
-_STLP_BEGIN_NAMESPACE
-
-using /*_STLP_VENDOR_EXCEPT_STD */ :: type_info;
-# if !(defined(__MRC__) || (defined(__SC__) && !defined(__DMC__)))
-using /* _STLP_VENDOR_EXCEPT_STD */ :: bad_typeid;
-# endif
-
-using /* _STLP_VENDOR_EXCEPT_STD */ :: bad_cast;
-
-_STLP_END_NAMESPACE
-
-# endif /* _STLP_OWN_NAMESPACE */
-
-#endif /* _STLP_NO_TYPEINFO */
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x874)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_OLDSTD_typeinfo */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/using/cstring b/using/cstring
deleted file mode 100644
index 7580638..0000000
--- a/using/cstring
+++ /dev/null
@@ -1,59 +0,0 @@
-using _STLP_VENDOR_CSTD::size_t;
-
-#if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
-# if defined (__MSL__) && __MC68K__ && !_No_BlockMove && __dest_os == __mac_os
-# undef memcpy
-# undef memmove
-inline void* memcpy(void* dst, const void* src, size_t len)
-{ return _STLP_VENDOR_CSTD::__memcpy(dst, src, len); }
-inline void* memmove(void* dst, const void* src, size_t len)
-{ return _STLP_VENDOR_CSTD::__memmove(dst, src, len); }
-# else
-using _STLP_VENDOR_CSTD::memmove;
-using _STLP_VENDOR_CSTD::memcpy;
-# endif
-
-# if !defined (_STLP_WCE)
-// these functions just don't exist on Windows CE
-# if !defined (ANDROID)
-// and these functions just don't exist on Android
-using _STLP_VENDOR_CSTD::strcoll;
-using _STLP_VENDOR_CSTD::strxfrm;
-# endif
-using _STLP_VENDOR_CSTD::strerror;
-# endif
-
-# if defined (__BORLANDC__)
-extern "C++" {
-# endif
-using _STLP_VENDOR_CSTD::memchr;
-using _STLP_VENDOR_CSTD::strchr;
-using _STLP_VENDOR_CSTD::strpbrk;
-using _STLP_VENDOR_CSTD::strrchr;
-using _STLP_VENDOR_CSTD::strstr;
-# if defined (__BORLANDC__)
-}
-# endif
-
-using _STLP_VENDOR_CSTD::memcmp;
-using _STLP_VENDOR_CSTD::memset;
-
-using _STLP_VENDOR_CSTD::strcat;
-
-# if !defined (strcmp)
-using _STLP_VENDOR_CSTD::strcmp;
-# endif
-
-# if !defined (strcpy)
-using _STLP_VENDOR_CSTD::strcpy;
-# endif
-using _STLP_VENDOR_CSTD::strcspn;
-using _STLP_VENDOR_CSTD::strlen;
-using _STLP_VENDOR_CSTD::strncat;
-using _STLP_VENDOR_CSTD::strncmp;
-
-using _STLP_VENDOR_CSTD::strncpy;
-using _STLP_VENDOR_CSTD::strspn;
-
-using _STLP_VENDOR_CSTD::strtok;
-#endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
diff --git a/utility b/utility
deleted file mode 100644
index 323fe1e..0000000
--- a/utility
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_UTILITY
-#define _STLP_UTILITY
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x75
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#ifndef __TYPE_TRAITS_H
-# include <stl/type_traits.h>
-#endif
-
-#if !defined (_STLP_DEBUG_H) && (defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS))
-# include <stl/debug/_debug.h>
-#endif
-
-#ifndef _STLP_INTERNAL_PAIR_H
-# include <stl/_pair.h>
-#endif
-
-#if defined (_STLP_IMPORT_VENDOR_STD)
-# include _STLP_NATIVE_HEADER(utility)
-#else
-# if defined (_STLP_MSVC) && !defined (_STLP_INTERNAL_ITERATOR_H)
-# include <stl/_iterator.h>
-# endif
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x75)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_UTILITY */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/valarray b/valarray
deleted file mode 100644
index 3cf71f3..0000000
--- a/valarray
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_VALARRAY
-#define _STLP_VALARRAY
-
-#ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x76
-# include <stl/_prolog.h>
-#endif
-
-#ifdef _STLP_PRAGMA_ONCE
-# pragma once
-#endif
-
-#include <stl/_valarray.h>
-
-#if defined (_STLP_IMPORT_VENDOR_STD)
-# include _STLP_NATIVE_HEADER(valarray)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x76)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-#endif
-
-#endif /* _STLP_VALARRAY */
-
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/vector b/vector
deleted file mode 100644
index 7583b9f..0000000
--- a/vector
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#ifndef _STLP_VECTOR
-#define _STLP_VECTOR
-
-# ifndef _STLP_OUTERMOST_HEADER_ID
-# define _STLP_OUTERMOST_HEADER_ID 0x77
-# include <stl/_prolog.h>
-# endif
-
-# ifdef _STLP_PRAGMA_ONCE
-# pragma once
-# endif
-
-# ifndef _STLP_INTERNAL_ALGOBASE_H
-# include <stl/_algobase.h>
-# endif
-
-#ifndef _STLP_INTERNAL_VECTOR_H
-# include <stl/_vector.h>
-#endif
-
-#if defined (_STLP_IMPORT_VENDOR_STD) && ! defined (_STLP_MINIMUM_IMPORT_STD)
-# include _STLP_NATIVE_HEADER(vector)
-#endif
-
-# if (_STLP_OUTERMOST_HEADER_ID == 0x77)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# endif
-
-#endif /* _STLP_VECTOR */
-
-// Local Variables:
-// mode:C++
-// End:
-
diff --git a/wchar.h b/wchar.h
deleted file mode 100644
index 7b49c5d..0000000
--- a/wchar.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x278
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x278) && !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-#if !defined (_STLP_WCE_EVC3) && !defined (_STLP_NO_WCHAR_T)
-
-# if defined (__BORLANDC__)
-/*
-# include <cstring>
-*/
-# include _STLP_NATIVE_CPP_C_HEADER(_str.h)
-# ifdef __cplusplus
-using _STLP_VENDOR_CSTD::strlen;
-using _STLP_VENDOR_CSTD::strspn;
-# endif
-# endif
-
-# if (((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))) && defined (__APPLE__)) || defined (__OpenBSD__)
-# include _STLP_NATIVE_C_HEADER(stddef.h)
-# elif defined(__MWERKS__) && defined(N_PLAT_NLM)
-/*
- * MSL library has wrong definition of wint_t (with -wchar_t on) in wchar_t.h header.
- * IMHO the best way is to comment line
- * typedef wchar_t wint_t;
- * (I use this way).
- *
- * Another solution is to define _WINT_T (to avoid conflict with wint_t definitions in
- * Novell SDK headers, _WCHAR_T defined in nlm_prefix.h). But you should define one
- * before include any header from Novell's SDK, so this isn't too good choice.
- *
- * And third solution is don't use anyware (even here) wchar_t.h
- *
- * - ptr, 2003 and 2005-05-07
- */
-/*
-#if __option(wchar_type)
-# define _WINT_T
-#endif
-*/
-# include _STLP_NATIVE_CPP_C_HEADER(wchar_t.h)
-# include _STLP_NATIVE_C_HEADER(stddef.h)
-# include _STLP_NATIVE_C_HEADER(stdio.h)
-# include <unicode.h>
-int wcslen( const wchar_t *_wc );
-int wcscmp( const wchar_t *_wc1, const wchar_t *_wc2 );
-int wcsncmp( const wchar_t *_wc1, const wchar_t *_wc2, size_t n );
-wchar_t *wcsstr( const wchar_t *_wc1, const wchar_t *_wc2 );
-wchar_t *wcschr( const wchar_t *_wc1, wchar_t _wc2 );
-wchar_t *wcsrchr( const wchar_t *_wc1, wchar_t _wc2 );
-wchar_t *wcscpy( wchar_t *_wc1, const wchar_t *_wc2 );
-wchar_t *wcsncpy( wchar_t *_wc1, const wchar_t *_wc2, size_t n );
-wchar_t *wcspbrk( const wchar_t *_wc, const wchar_t *_wc2 );
-# else
-# include _STLP_NATIVE_C_HEADER(wchar.h)
-# endif
-#endif /* !defined (_STLP_WCE_EVC3) && !defined (_STLP_NO_WCHAR_T) */
-
-#ifndef _STLP_INTERNAL_MBSTATE_T
-# include <stl/_mbstate_t.h>
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x278)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-#endif
-
-/*
- Local Variables:
- mode:C++
- End:
-*/
diff --git a/wctype.h b/wctype.h
deleted file mode 100644
index 365f0d3..0000000
--- a/wctype.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1999
- * Boris Fomitchev
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted
- * without fee, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-
-#if !defined (_STLP_OUTERMOST_HEADER_ID)
-# define _STLP_OUTERMOST_HEADER_ID 0x279
-# include <stl/_prolog.h>
-#elif (_STLP_OUTERMOST_HEADER_ID == 0x279) && !defined (_STLP_DONT_POP_HEADER_ID)
-# define _STLP_DONT_POP_HEADER_ID
-#endif
-
-/* evc3 doesn't have wctype.h */
-#if !defined(_STLP_WCE_EVC3) && !defined(N_PLAT_NLM)
-# include _STLP_NATIVE_C_HEADER(wctype.h)
-#endif
-
-#if (_STLP_OUTERMOST_HEADER_ID == 0x279)
-# if ! defined (_STLP_DONT_POP_HEADER_ID)
-# include <stl/_epilog.h>
-# undef _STLP_OUTERMOST_HEADER_ID
-# else
-# undef _STLP_DONT_POP_HEADER_ID
-# endif
-#endif
-
-/* Local Variables:
- * mode:C++
- * End:
- */