|
1 /* |
|
2 * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved. |
|
3 * |
|
4 * Copyright (c) 1994 |
|
5 * Hewlett-Packard Company |
|
6 * |
|
7 * Copyright (c) 1996,1997 |
|
8 * Silicon Graphics Computer Systems, Inc. |
|
9 * |
|
10 * Copyright (c) 1997 |
|
11 * Moscow Center for SPARC Technology |
|
12 * |
|
13 * Copyright (c) 1999 |
|
14 * Boris Fomitchev |
|
15 * |
|
16 * This material is provided "as is", with absolutely no warranty expressed |
|
17 * or implied. Any use is at your own risk. |
|
18 * |
|
19 * Permission to use or copy this software for any purpose is hereby granted |
|
20 * without fee, provided the above notices are retained on all copies. |
|
21 * Permission to modify the code and to distribute modified code is granted, |
|
22 * provided the above notices are retained, and a notice that the code was |
|
23 * modified is included with the above copyright notice. |
|
24 * |
|
25 */ |
|
26 |
|
27 # define __PUT_STATIC_DATA_MEMBERS_HERE |
|
28 # define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION |
|
29 |
|
30 # include "stlport_prefix.h" |
|
31 |
|
32 # if !defined(_STLP_DEBUG) && ! defined (_STLP_ASSERTIONS) |
|
33 # define _STLP_ASSERTIONS 1 |
|
34 # endif |
|
35 |
|
36 #include <utility> |
|
37 |
|
38 #include <stl/debug/_debug.h> |
|
39 #include <memory> |
|
40 #include <vector> |
|
41 #include <set> |
|
42 #include <list> |
|
43 #include <slist> |
|
44 #include <stl/_hashtable.h> |
|
45 #include <limits> |
|
46 #include <string> |
|
47 #include <stdexcept> |
|
48 #include <bitset> |
|
49 |
|
50 # if ( _STLP_STATIC_TEMPLATE_DATA < 1 ) |
|
51 // for rope, locale static members |
|
52 # include <rope> |
|
53 # include <locale> |
|
54 # endif |
|
55 |
|
56 # if defined (_STLP_UNIX) |
|
57 # define _STLP_HAS_PERTHREAD_ALLOCATOR |
|
58 # include <stl/_pthread_alloc.h> |
|
59 # endif |
|
60 |
|
61 // boris : this piece of code duplicated from _range_errors.h |
|
62 #undef _STLP_THROW_MSG |
|
63 #if defined(_STLP_THROW_RANGE_ERRORS) |
|
64 # ifndef _STLP_STDEXCEPT |
|
65 # include <stdexcept> |
|
66 # endif |
|
67 # ifndef _STLP_STRING |
|
68 # include <string> |
|
69 # endif |
|
70 # define _STLP_THROW_MSG(ex,msg) throw ex(string(msg)) |
|
71 #else |
|
72 # if defined (_STLP_WINCE) |
|
73 # define _STLP_THROW_MSG(ex,msg) TerminateProcess(GetCurrentProcess(), 0) |
|
74 # else |
|
75 # include <cstdlib> |
|
76 # include <cstdio> |
|
77 # define _STLP_THROW_MSG(ex,msg) puts(msg),_STLP_ABORT() |
|
78 # endif |
|
79 #endif |
|
80 |
|
81 #ifdef _STLP_MSVC |
|
82 #pragma optimize("g",off) |
|
83 #endif |
|
84 |
|
85 _STLP_BEGIN_NAMESPACE |
|
86 |
|
87 _STLP_EXP_DECLSPEC void _STLP_CALL __stl_throw_range_error(const char* __msg) { |
|
88 _STLP_THROW_MSG(range_error, __msg); |
|
89 } |
|
90 |
|
91 _STLP_EXP_DECLSPEC void _STLP_CALL __stl_throw_out_of_range(const char* __msg) { |
|
92 _STLP_THROW_MSG(out_of_range, __msg); |
|
93 } |
|
94 |
|
95 _STLP_EXP_DECLSPEC void _STLP_CALL __stl_throw_length_error(const char* __msg) { |
|
96 _STLP_THROW_MSG(length_error, __msg); |
|
97 } |
|
98 |
|
99 _STLP_EXP_DECLSPEC void _STLP_CALL __stl_throw_invalid_argument(const char* __msg) { |
|
100 _STLP_THROW_MSG(invalid_argument, __msg); |
|
101 } |
|
102 |
|
103 _STLP_EXP_DECLSPEC void _STLP_CALL __stl_throw_overflow_error(const char* __msg) { |
|
104 _STLP_THROW_MSG(overflow_error, __msg); |
|
105 } |
|
106 |
|
107 _STLP_EXP_DECLSPEC const char* _STLP_CALL |
|
108 __get_c_string(const string& __str) { |
|
109 return __str.c_str(); |
|
110 } |
|
111 |
|
112 |
|
113 # if defined (_STLP_NO_EXCEPTION_HEADER) || defined(_STLP_BROKEN_EXCEPTION_CLASS) |
|
114 _STLP_EXP_DECLSPEC exception::exception() _STLP_NOTHROW {} |
|
115 _STLP_EXP_DECLSPEC exception::~exception() _STLP_NOTHROW {} |
|
116 _STLP_EXP_DECLSPEC bad_exception::bad_exception() _STLP_NOTHROW {} |
|
117 _STLP_EXP_DECLSPEC bad_exception::~bad_exception() _STLP_NOTHROW {} |
|
118 _STLP_EXP_DECLSPEC const char* exception::what() const _STLP_NOTHROW {return "class exception";} |
|
119 _STLP_EXP_DECLSPEC const char* bad_exception::what() const _STLP_NOTHROW {return "class bad_exception";} |
|
120 # endif |
|
121 |
|
122 # ifdef _STLP_OWN_STDEXCEPT |
|
123 _STLP_EXP_DECLSPEC __Named_exception::__Named_exception(const string& __str) { |
|
124 strncpy(_M_name, __get_c_string(__str), _S_bufsize); |
|
125 _M_name[_S_bufsize - 1] = '\0'; |
|
126 } |
|
127 |
|
128 _STLP_EXP_DECLSPEC const char* __Named_exception::what() const _STLP_NOTHROW_INHERENTLY { return _M_name; } |
|
129 |
|
130 // boris : those are needed to force typeinfo nodes to be created in here only |
|
131 _STLP_EXP_DECLSPEC __Named_exception::~__Named_exception() _STLP_NOTHROW_INHERENTLY {} |
|
132 |
|
133 _STLP_EXP_DECLSPEC logic_error::logic_error(const string& __s) : __Named_exception(__s) {} |
|
134 _STLP_EXP_DECLSPEC logic_error::~logic_error() _STLP_NOTHROW_INHERENTLY {} |
|
135 |
|
136 _STLP_EXP_DECLSPEC runtime_error::runtime_error(const string& __s) : __Named_exception(__s) {} |
|
137 _STLP_EXP_DECLSPEC runtime_error::~runtime_error() _STLP_NOTHROW_INHERENTLY {} |
|
138 |
|
139 _STLP_EXP_DECLSPEC domain_error::domain_error(const string& __arg) : logic_error(__arg) {} |
|
140 _STLP_EXP_DECLSPEC domain_error::~domain_error() _STLP_NOTHROW_INHERENTLY {} |
|
141 |
|
142 _STLP_EXP_DECLSPEC invalid_argument::invalid_argument(const string& __arg) |
|
143 : logic_error(__arg) {} |
|
144 _STLP_EXP_DECLSPEC invalid_argument::~invalid_argument() _STLP_NOTHROW_INHERENTLY {} |
|
145 |
|
146 _STLP_EXP_DECLSPEC length_error::length_error(const string& __arg) : logic_error(__arg) {} |
|
147 _STLP_EXP_DECLSPEC length_error::~length_error() _STLP_NOTHROW_INHERENTLY {} |
|
148 |
|
149 _STLP_EXP_DECLSPEC out_of_range::out_of_range(const string& __arg) : logic_error(__arg) {} |
|
150 _STLP_EXP_DECLSPEC out_of_range::~out_of_range() _STLP_NOTHROW_INHERENTLY {} |
|
151 |
|
152 _STLP_EXP_DECLSPEC range_error::range_error(const string& __arg) : runtime_error(__arg) {} |
|
153 _STLP_EXP_DECLSPEC range_error::~range_error() _STLP_NOTHROW_INHERENTLY {} |
|
154 |
|
155 _STLP_EXP_DECLSPEC overflow_error::overflow_error(const string& __arg) : runtime_error(__arg) {} |
|
156 _STLP_EXP_DECLSPEC overflow_error::~overflow_error() _STLP_NOTHROW_INHERENTLY {} |
|
157 |
|
158 _STLP_EXP_DECLSPEC underflow_error::underflow_error(const string& __arg) : runtime_error(__arg) {} |
|
159 _STLP_EXP_DECLSPEC underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {} |
|
160 |
|
161 # endif |
|
162 |
|
163 # ifdef _STLP_NO_BAD_ALLOC |
|
164 #ifdef __WINSCW__ |
|
165 const nothrow_t nothrowObj /* = {} */; |
|
166 _STLP_EXP_DECLSPEC const nothrow_t& GetNoThrowObj() |
|
167 { |
|
168 return nothrowObj; |
|
169 } |
|
170 |
|
171 #endif |
|
172 # endif |
|
173 |
|
174 # ifndef _STLP_NO_FORCE_INSTANTIATE |
|
175 |
|
176 # if defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS) |
|
177 template struct _STLP_CLASS_DECLSPEC __stl_debug_engine<bool>; |
|
178 # endif |
|
179 |
|
180 #ifndef __SYMBIAN32__ |
|
181 template class _STLP_CLASS_DECLSPEC __node_alloc<false,0>; |
|
182 template class _STLP_CLASS_DECLSPEC __node_alloc<true,0>; |
|
183 template class _STLP_CLASS_DECLSPEC __debug_alloc< __node_alloc<true,0> >; |
|
184 template class _STLP_CLASS_DECLSPEC __debug_alloc< __node_alloc<false,0> >; |
|
185 template class _STLP_CLASS_DECLSPEC __debug_alloc<__new_alloc>; |
|
186 template class _STLP_CLASS_DECLSPEC __malloc_alloc<0>; |
|
187 #endif |
|
188 |
|
189 # if defined (_STLP_THREADS) && ! defined ( _STLP_ATOMIC_EXCHANGE ) && (defined(_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS)) |
|
190 template class _STLP_CLASS_DECLSPEC _Swap_lock_struct<0>; |
|
191 # endif |
|
192 |
|
193 template class allocator<void*>; |
|
194 template class _STLP_alloc_proxy<void**, void*, allocator<void*> >; |
|
195 template class _Vector_base<void*,allocator<void*> >; |
|
196 # if defined (_STLP_DEBUG) && ! defined (__SUNPRO_CC) |
|
197 template class __WORKAROUND_DBG_RENAME(vector) <void*,allocator<void*> >; |
|
198 # endif |
|
199 template class __vector__<void*,allocator<void*> >; |
|
200 |
|
201 template class _Rb_global<bool>; |
|
202 template class _List_global<bool>; |
|
203 template class _Sl_global<bool>; |
|
204 template class _Stl_prime<bool>; |
|
205 template class _LimG<bool>; |
|
206 template class _Bs_G<bool>; |
|
207 |
|
208 template class _STLP_CLASS_DECLSPEC allocator<char>; |
|
209 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<char *,char, allocator<char> >; |
|
210 template class _STLP_CLASS_DECLSPEC _String_base<char, allocator<char> >; |
|
211 |
|
212 # if defined (_STLP_DEBUG) && ! defined (__SUNPRO_CC) |
|
213 template class _STLP_CLASS_DECLSPEC _Nondebug_string<char, char_traits<char>, allocator<char> >; |
|
214 # endif |
|
215 |
|
216 template class basic_string<char, char_traits<char>, allocator<char> >; |
|
217 # endif |
|
218 |
|
219 _STLP_END_NAMESPACE |
|
220 |
|
221 #define FORCE_SYMBOL extern |
|
222 |
|
223 # if defined (_WIN32) && defined (_STLP_USE_DECLSPEC) && ! defined (_STLP_USE_STATIC_LIB) && ! defined (_STLP_USE_STATICX_LIB) && !defined (__SYMBIAN32__) |
|
224 // stlportmt.cpp : Defines the entry point for the DLL application. |
|
225 // |
|
226 #define WIN32_LEAN_AND_MEAN |
|
227 #include <windows.h> |
|
228 |
|
229 #undef FORCE_SYMBOL |
|
230 #define FORCE_SYMBOL APIENTRY |
|
231 |
|
232 extern "C" { |
|
233 |
|
234 BOOL APIENTRY DllMain( HANDLE hModule, |
|
235 DWORD ul_reason_for_call, |
|
236 LPVOID lpReserved |
|
237 ) |
|
238 { |
|
239 switch (ul_reason_for_call) |
|
240 { |
|
241 case DLL_PROCESS_ATTACH: |
|
242 DisableThreadLibraryCalls((HINSTANCE)hModule); |
|
243 case DLL_THREAD_ATTACH: |
|
244 case DLL_THREAD_DETACH: |
|
245 case DLL_PROCESS_DETACH: |
|
246 break; |
|
247 } |
|
248 return TRUE; |
|
249 } |
|
250 |
|
251 } /* extern "C" */ |
|
252 |
|
253 _STLP_BEGIN_NAMESPACE |
|
254 |
|
255 void FORCE_SYMBOL |
|
256 force_link() |
|
257 { |
|
258 float f; |
|
259 f = numeric_limits<float>::infinity(); |
|
260 f = numeric_limits<float>::quiet_NaN(); |
|
261 f = numeric_limits<float>::signaling_NaN(); |
|
262 double d; |
|
263 d = numeric_limits<double>::infinity(); |
|
264 d = numeric_limits<double>::quiet_NaN(); |
|
265 d = numeric_limits<double>::signaling_NaN(); |
|
266 #ifndef _STLP_NO_LONG_DOUBLE |
|
267 long double ld; |
|
268 ld = numeric_limits<long double>::infinity(); |
|
269 ld = numeric_limits<long double>::quiet_NaN(); |
|
270 ld = numeric_limits<long double>::signaling_NaN(); |
|
271 #endif |
|
272 |
|
273 set<int>::iterator iter; |
|
274 // _M_increment; _M_decrement instantiation |
|
275 ++iter; |
|
276 --iter; |
|
277 |
|
278 // force bitset globals to be instantiated |
|
279 unsigned char uc = _Bs_G<bool>::_S_bit_count[0]; |
|
280 uc += _Bs_G<bool>::_S_first_one[0]; |
|
281 } |
|
282 |
|
283 _STLP_END_NAMESPACE |
|
284 |
|
285 |
|
286 # endif |