1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cppstdlib/stl/src/dll_main.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,315 @@
1.4 + /*
1.5 + *
1.6 + * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.7 + *
1.8 + * Copyright (c) 1994
1.9 + * Hewlett-Packard Company
1.10 + *
1.11 + * Copyright (c) 1996,1997
1.12 + * Silicon Graphics Computer Systems, Inc.
1.13 + *
1.14 + * Copyright (c) 1997
1.15 + * Moscow Center for SPARC Technology
1.16 + *
1.17 + * Copyright (c) 1999
1.18 + * Boris Fomitchev
1.19 + *
1.20 + * This material is provided "as is", with absolutely no warranty expressed
1.21 + * or implied. Any use is at your own risk.
1.22 + *
1.23 + * Permission to use or copy this software for any purpose is hereby granted
1.24 + * without fee, provided the above notices are retained on all copies.
1.25 + * Permission to modify the code and to distribute modified code is granted,
1.26 + * provided the above notices are retained, and a notice that the code was
1.27 + * modified is included with the above copyright notice.
1.28 + *
1.29 + */
1.30 +
1.31 +#define __PUT_STATIC_DATA_MEMBERS_HERE
1.32 +#define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
1.33 +
1.34 +#include "stlport_prefix.h"
1.35 +
1.36 +#if !defined (_STLP_DEBUG) && ! defined (_STLP_ASSERTIONS)
1.37 +# if !defined (__APPLE__) || !defined (__GNUC__) || (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
1.38 +/* dums: Please if the following code was being uncommented please explain why
1.39 + * as for the moment it only looks like a source of inconsistency in the way
1.40 + * STLport different translation units are compiled.
1.41 + */
1.42 +//# define _STLP_ASSERTIONS 1
1.43 +# endif
1.44 +#endif
1.45 +
1.46 +#include <utility>
1.47 +#include <memory>
1.48 +#include <vector>
1.49 +#include <set>
1.50 +#include <list>
1.51 +#include <slist>
1.52 +#include <deque>
1.53 +#include <hash_map>
1.54 +#include <limits>
1.55 +#include <string>
1.56 +#include <stdexcept>
1.57 +#include <bitset>
1.58 +#include <locale>
1.59 +
1.60 +#if (_STLP_STATIC_TEMPLATE_DATA < 1) || defined (__DMC__)
1.61 +// for rope static members
1.62 +# include <rope>
1.63 +#endif
1.64 +
1.65 +// boris : this piece of code duplicated from _range_errors.h
1.66 +#undef _STLP_THROW_MSG
1.67 +#if defined(_STLP_THROW_RANGE_ERRORS)
1.68 +# ifndef _STLP_STDEXCEPT
1.69 +# include <stdexcept>
1.70 +# endif
1.71 +# ifndef _STLP_STRING
1.72 +# include <string>
1.73 +# endif
1.74 +# define _STLP_THROW_MSG(ex,msg) throw ex(string(msg))
1.75 +#else
1.76 +# if defined (_STLP_RTTI_BUG)
1.77 +# define _STLP_THROW_MSG(ex,msg) TerminateProcess(GetCurrentProcess(), 0)
1.78 +# else
1.79 +# include <cstdlib>
1.80 +# include <cstdio>
1.81 +# define _STLP_THROW_MSG(ex,msg) puts(msg),_STLP_ABORT()
1.82 +# endif
1.83 +#endif
1.84 +
1.85 +#if defined (_STLP_MSVC) && (_STLP_MSVC < 1310)
1.86 +# pragma optimize("g", off)
1.87 +#endif
1.88 +
1.89 +_STLP_BEGIN_NAMESPACE
1.90 +
1.91 +void _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg)
1.92 +{ _STLP_THROW_MSG(runtime_error, __msg); }
1.93 +
1.94 +void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg)
1.95 +{ _STLP_THROW_MSG(range_error, __msg); }
1.96 +
1.97 +void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg)
1.98 +{ _STLP_THROW_MSG(out_of_range, __msg); }
1.99 +
1.100 +void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg)
1.101 +{ _STLP_THROW_MSG(length_error, __msg); }
1.102 +
1.103 +void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg)
1.104 +{ _STLP_THROW_MSG(invalid_argument, __msg); }
1.105 +
1.106 +void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg)
1.107 +{ _STLP_THROW_MSG(overflow_error, __msg); }
1.108 +
1.109 +#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
1.110 +exception::exception() _STLP_NOTHROW {}
1.111 +exception::~exception() _STLP_NOTHROW {}
1.112 +bad_exception::bad_exception() _STLP_NOTHROW {}
1.113 +bad_exception::~bad_exception() _STLP_NOTHROW {}
1.114 +const char* exception::what() const _STLP_NOTHROW { return "class exception"; }
1.115 +const char* bad_exception::what() const _STLP_NOTHROW { return "class bad_exception"; }
1.116 +#endif
1.117 +
1.118 +#if defined (_STLP_OWN_STDEXCEPT)
1.119 +_STLP_DECLSPEC __Named_exception::__Named_exception(const string& __str) {
1.120 +#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
1.121 + strncpy(_M_name, __str.c_str(), _S_bufsize);
1.122 + _M_name[_S_bufsize - 1] = '\0';
1.123 +#else
1.124 + strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), __str.c_str(), _TRUNCATE);
1.125 +#endif
1.126 +}
1.127 +
1.128 +_STLP_DECLSPEC const char* __Named_exception::what() const _STLP_NOTHROW_INHERENTLY { return _M_name; }
1.129 +
1.130 +// boris : those are needed to force typeinfo nodes to be created in here only
1.131 +_STLP_DECLSPEC __Named_exception::~__Named_exception() _STLP_NOTHROW_INHERENTLY {}
1.132 +
1.133 +_STLP_DECLSPEC logic_error::~logic_error() _STLP_NOTHROW_INHERENTLY {}
1.134 +_STLP_DECLSPEC runtime_error::~runtime_error() _STLP_NOTHROW_INHERENTLY {}
1.135 +_STLP_DECLSPEC domain_error::~domain_error() _STLP_NOTHROW_INHERENTLY {}
1.136 +_STLP_DECLSPEC invalid_argument::~invalid_argument() _STLP_NOTHROW_INHERENTLY {}
1.137 +_STLP_DECLSPEC length_error::~length_error() _STLP_NOTHROW_INHERENTLY {}
1.138 +_STLP_DECLSPEC out_of_range::~out_of_range() _STLP_NOTHROW_INHERENTLY {}
1.139 +_STLP_DECLSPEC range_error::~range_error() _STLP_NOTHROW_INHERENTLY {}
1.140 +_STLP_DECLSPEC overflow_error::~overflow_error() _STLP_NOTHROW_INHERENTLY {}
1.141 +_STLP_DECLSPEC underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {}
1.142 +
1.143 +#endif /* _STLP_OWN_STDEXCEPT */
1.144 +
1.145 +#if !defined(_STLP_WCE_EVC3)
1.146 +# if defined (_STLP_NO_BAD_ALLOC)
1.147 +const nothrow_t nothrow /* = {} */;
1.148 +# endif
1.149 +#endif
1.150 +
1.151 +#if !defined (_STLP_NO_FORCE_INSTANTIATE)
1.152 +
1.153 +# if defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS)
1.154 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.155 +template struct _STLP_CLASS_DECLSPEC __stl_debug_engine<bool>;
1.156 +_STLP_MOVE_TO_STD_NAMESPACE
1.157 +# endif
1.158 +
1.159 +template class _STLP_CLASS_DECLSPEC __debug_alloc<__node_alloc>;
1.160 +template class _STLP_CLASS_DECLSPEC __debug_alloc<__new_alloc>;
1.161 +
1.162 +//Export of the types used to represent buckets in the hashtable implementation.
1.163 +/*
1.164 + * For the vector class we do not use any MSVC6 workaround even if we export it from
1.165 + * the STLport dynamic libraries because we know what methods are called and none is
1.166 + * a template method. Moreover the exported class is an instanciation of vector with
1.167 + * _Slist_node_base struct that is an internal STLport class that no user should ever
1.168 + * use.
1.169 + */
1.170 +# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
1.171 +template class _STLP_CLASS_DECLSPEC allocator<_STLP_PRIV _Slist_node_base*>;
1.172 +
1.173 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.174 +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
1.175 + allocator<_Slist_node_base*> >;
1.176 +template class _STLP_CLASS_DECLSPEC _Vector_base<_Slist_node_base*,
1.177 + allocator<_Slist_node_base*> >;
1.178 +_STLP_MOVE_TO_STD_NAMESPACE
1.179 +# endif
1.180 +
1.181 +# if defined (_STLP_DEBUG)
1.182 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.183 +template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_NAME(vector)<_Slist_node_base*,
1.184 + allocator<_Slist_node_base*> >;
1.185 +_STLP_MOVE_TO_STD_NAMESPACE
1.186 +# endif
1.187 +
1.188 +template class _STLP_CLASS_DECLSPEC vector<_STLP_PRIV _Slist_node_base*,
1.189 + allocator<_STLP_PRIV _Slist_node_base*> >;
1.190 +//End of hashtable bucket types export.
1.191 +
1.192 +//Export of _Locale_impl facets container:
1.193 +# if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
1.194 +template class _STLP_CLASS_DECLSPEC allocator<locale::facet*>;
1.195 +
1.196 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.197 +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
1.198 +template class _STLP_CLASS_DECLSPEC _Vector_base<locale::facet*, allocator<locale::facet*> >;
1.199 +_STLP_MOVE_TO_STD_NAMESPACE
1.200 +
1.201 +# endif
1.202 +# if defined (_STLP_DEBUG)
1.203 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.204 +# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
1.205 +template class _STLP_CLASS_DECLSPEC __construct_checker<_STLP_PRIV _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
1.206 +template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >;
1.207 +# undef _STLP_NON_DBG_VECTOR
1.208 +_STLP_MOVE_TO_STD_NAMESPACE
1.209 +# endif
1.210 +
1.211 +template class _STLP_CLASS_DECLSPEC vector<locale::facet*, allocator<locale::facet*> >;
1.212 +//End of export of _Locale_impl facets container.
1.213 +
1.214 +# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
1.215 +template class _STLP_CLASS_DECLSPEC allocator<void*>;
1.216 +
1.217 +typedef _STLP_PRIV _List_node<void*> _VoidPtr_Node;
1.218 +template class _STLP_CLASS_DECLSPEC allocator<_VoidPtr_Node>;
1.219 +
1.220 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.221 +
1.222 +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void**, void*, allocator<void*> >;
1.223 +template class _STLP_CLASS_DECLSPEC _Vector_base<void*, allocator<void*> >;
1.224 +template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(vector)<void*, allocator<void*> >;
1.225 +
1.226 +template class _STLP_CLASS_DECLSPEC _List_node<void*>;
1.227 +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_List_node_base, _VoidPtr_Node, allocator<_VoidPtr_Node> >;
1.228 +template class _STLP_CLASS_DECLSPEC _List_base<void*, allocator<void*> >;
1.229 +template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(list)<void*, allocator<void*> >;
1.230 +
1.231 +template class _STLP_CLASS_DECLSPEC _Slist_node<void*>;
1.232 +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base, _Slist_node<void*>, allocator<_Slist_node<void*> > >;
1.233 +template class _STLP_CLASS_DECLSPEC _Slist_base<void*, allocator<void*> >;
1.234 +template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(slist)<void*, allocator<void*> >;
1.235 +
1.236 +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
1.237 +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void***, void**, allocator<void**> >;
1.238 +template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
1.239 +template class _STLP_CLASS_DECLSPEC _Deque_base<void*, allocator<void*> >;
1.240 +template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(deque)<void*, allocator<void*> >;
1.241 +
1.242 +_STLP_MOVE_TO_STD_NAMESPACE
1.243 +
1.244 +# endif /* _STLP_USE_PTR_SPECIALIZATIONS */
1.245 +
1.246 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.247 +
1.248 +template class _STLP_CLASS_DECLSPEC _Rb_global<bool>;
1.249 +template class _STLP_CLASS_DECLSPEC _List_global<bool>;
1.250 +
1.251 +template class _STLP_CLASS_DECLSPEC _Sl_global<bool>;
1.252 +template class _STLP_CLASS_DECLSPEC _Stl_prime<bool>;
1.253 +
1.254 +template class _STLP_CLASS_DECLSPEC _LimG<bool>;
1.255 +
1.256 +_STLP_MOVE_TO_STD_NAMESPACE
1.257 +
1.258 +#endif /* _STLP_NO_FORCE_INSTANTIATE */
1.259 +
1.260 +_STLP_END_NAMESPACE
1.261 +
1.262 +#define FORCE_SYMBOL extern
1.263 +
1.264 +#if defined (_WIN32) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_USE_STATIC_LIB) && !defined __SYMBIAN32__
1.265 +// stlportmt.cpp : Defines the entry point for the DLL application.
1.266 +//
1.267 +# define WIN32_LEAN_AND_MEAN
1.268 +# include <windows.h>
1.269 +
1.270 +# undef FORCE_SYMBOL
1.271 +# define FORCE_SYMBOL APIENTRY
1.272 +
1.273 +extern "C" {
1.274 +
1.275 +BOOL APIENTRY DllMain( HANDLE hModule,
1.276 + DWORD ul_reason_for_call,
1.277 + LPVOID) {
1.278 + switch (ul_reason_for_call) {
1.279 + case DLL_PROCESS_ATTACH:
1.280 + DisableThreadLibraryCalls((HINSTANCE)hModule);
1.281 + case DLL_THREAD_ATTACH:
1.282 + case DLL_THREAD_DETACH:
1.283 + case DLL_PROCESS_DETACH:
1.284 + break;
1.285 + }
1.286 + return TRUE;
1.287 +}
1.288 +
1.289 +} /* extern "C" */
1.290 +
1.291 +#if !defined (_STLP_MSVC) && !defined (__MINGW32__)
1.292 +_STLP_BEGIN_NAMESPACE
1.293 +
1.294 +static void FORCE_SYMBOL
1.295 +force_link() {
1.296 + set<int>::iterator iter;
1.297 + // _M_increment; _M_decrement instantiation
1.298 + ++iter;
1.299 + --iter;
1.300 +}
1.301 +
1.302 +_STLP_END_NAMESPACE
1.303 +#endif
1.304 +
1.305 +#endif /* _WIN32 */
1.306 +
1.307 +#if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
1.308 +# undef std
1.309 +
1.310 +namespace std
1.311 +{
1.312 + void _STLP_CALL unexpected() {
1.313 + unexpected_handler hdl;
1.314 + set_unexpected(hdl = set_unexpected((unexpected_handler)0));
1.315 + hdl();
1.316 + }
1.317 +}
1.318 +#endif