1 /*
2 *
3 * Copyright (c) 1994
4 * Hewlett-Packard Company
5 *
6 * Copyright (c) 1996,1997
7 * Silicon Graphics Computer Systems, Inc.
8 *
9 * Copyright (c) 1997
10 * Moscow Center for SPARC Technology
11 *
12 * Copyright (c) 1999
13 * Boris Fomitchev
14 *
15 * This material is provided "as is", with absolutely no warranty expressed
16 * or implied. Any use is at your own risk.
17 *
18 * Permission to use or copy this software for any purpose is hereby granted
19 * without fee, provided the above notices are retained on all copies.
20 * Permission to modify the code and to distribute modified code is granted,
21 * provided the above notices are retained, and a notice that the code was
22 * modified is included with the above copyright notice.
23 *
24 */
25
26#define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
27
28#include "stlport_prefix.h"
29
30#if !defined (_STLP_DEBUG) && ! defined (_STLP_ASSERTIONS)
31#  if !defined (__APPLE__) || !defined (__GNUC__) || (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
32/* dums: Please if the following code was being uncommented please explain why
33 * as for the moment it only looks like a source of inconsistency in the way
34 * STLport different translation units are compiled.
35 */
36//#    define _STLP_ASSERTIONS 1
37#  endif
38#endif
39
40#include <utility>
41#include <memory>
42#include <vector>
43#include <set>
44#include <list>
45#include <slist>
46#include <deque>
47#include <hash_map>
48#include <limits>
49#include <string>
50#include <stdexcept>
51#include <bitset>
52#include <locale>
53
54#if defined (__DMC__)
55// for rope static members
56#  include <rope>
57#endif
58
59#include <stl/_range_errors.c>
60
61_STLP_BEGIN_NAMESPACE
62
63#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
64exception::exception() _STLP_NOTHROW {}
65exception::~exception() _STLP_NOTHROW {}
66bad_exception::bad_exception() _STLP_NOTHROW {}
67bad_exception::~bad_exception() _STLP_NOTHROW {}
68const char* exception::what() const _STLP_NOTHROW { return "class exception"; }
69const char* bad_exception::what() const _STLP_NOTHROW { return "class bad_exception"; }
70#endif
71
72#if defined (_STLP_OWN_STDEXCEPT)
73#  include <stl/_stdexcept_base.c>
74
75// boris : those are needed to force typeinfo nodes to be created in here only
76logic_error::~logic_error() _STLP_NOTHROW_INHERENTLY {}
77runtime_error::~runtime_error() _STLP_NOTHROW_INHERENTLY {}
78domain_error::~domain_error() _STLP_NOTHROW_INHERENTLY {}
79invalid_argument::~invalid_argument() _STLP_NOTHROW_INHERENTLY {}
80length_error::~length_error() _STLP_NOTHROW_INHERENTLY {}
81out_of_range::~out_of_range() _STLP_NOTHROW_INHERENTLY {}
82range_error::~range_error() _STLP_NOTHROW_INHERENTLY {}
83overflow_error::~overflow_error() _STLP_NOTHROW_INHERENTLY {}
84underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {}
85
86#endif
87
88#if !defined(_STLP_WCE_EVC3)
89#  if defined (_STLP_NO_BAD_ALLOC)
90const nothrow_t nothrow /* = {} */;
91#  endif
92#endif
93
94#if !defined (_STLP_NO_FORCE_INSTANTIATE)
95
96#  if defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS)
97_STLP_MOVE_TO_PRIV_NAMESPACE
98template class _STLP_CLASS_DECLSPEC __stl_debug_engine<bool>;
99_STLP_MOVE_TO_STD_NAMESPACE
100#  endif
101
102template class _STLP_CLASS_DECLSPEC __debug_alloc<__node_alloc>;
103template class _STLP_CLASS_DECLSPEC __debug_alloc<__new_alloc>;
104
105//Export of the types used to represent buckets in the hashtable implementation.
106/*
107 * For the vector class we do not use any MSVC6 workaround even if we export it from
108 * the STLport dynamic libraries because we know what methods are called and none is
109 * a template method. Moreover the exported class is an instanciation of vector with
110 * _Slist_node_base struct that is an internal STLport class that no user should ever
111 * use.
112 */
113#  if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
114template class _STLP_CLASS_DECLSPEC allocator<_STLP_PRIV _Slist_node_base*>;
115
116_STLP_MOVE_TO_PRIV_NAMESPACE
117template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
118                                                      allocator<_Slist_node_base*> >;
119template class _STLP_CLASS_DECLSPEC _Vector_base<_Slist_node_base*,
120                                                 allocator<_Slist_node_base*> >;
121_STLP_MOVE_TO_STD_NAMESPACE
122#  endif
123
124#  if defined (_STLP_DEBUG)
125_STLP_MOVE_TO_PRIV_NAMESPACE
126template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_NAME(vector)<_Slist_node_base*,
127                                                               allocator<_Slist_node_base*> >;
128_STLP_MOVE_TO_STD_NAMESPACE
129#  endif
130
131template class _STLP_CLASS_DECLSPEC vector<_STLP_PRIV _Slist_node_base*,
132                                           allocator<_STLP_PRIV _Slist_node_base*> >;
133//End of hashtable bucket types export.
134
135//Export of _Locale_impl facets container:
136#  if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
137template class _STLP_CLASS_DECLSPEC allocator<locale::facet*>;
138
139_STLP_MOVE_TO_PRIV_NAMESPACE
140template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
141template class _STLP_CLASS_DECLSPEC _Vector_base<locale::facet*, allocator<locale::facet*> >;
142_STLP_MOVE_TO_STD_NAMESPACE
143
144#  endif
145#  if defined (_STLP_DEBUG)
146_STLP_MOVE_TO_PRIV_NAMESPACE
147#    define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
148template class _STLP_CLASS_DECLSPEC __construct_checker<_STLP_PRIV _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
149template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >;
150#    undef _STLP_NON_DBG_VECTOR
151_STLP_MOVE_TO_STD_NAMESPACE
152#  endif
153
154template class _STLP_CLASS_DECLSPEC vector<locale::facet*, allocator<locale::facet*> >;
155//End of export of _Locale_impl facets container.
156
157#  if defined (_STLP_USE_PTR_SPECIALIZATIONS)
158template class _STLP_CLASS_DECLSPEC allocator<void*>;
159
160typedef _STLP_PRIV _List_node<void*> _VoidPtr_Node;
161template class _STLP_CLASS_DECLSPEC allocator<_VoidPtr_Node>;
162
163_STLP_MOVE_TO_PRIV_NAMESPACE
164
165template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void**, void*, allocator<void*> >;
166template class _STLP_CLASS_DECLSPEC _Vector_base<void*, allocator<void*> >;
167template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(vector)<void*, allocator<void*> >;
168
169template class _STLP_CLASS_DECLSPEC _List_node<void*>;
170template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_List_node_base, _VoidPtr_Node, allocator<_VoidPtr_Node> >;
171template class _STLP_CLASS_DECLSPEC _List_base<void*, allocator<void*> >;
172template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(list)<void*, allocator<void*> >;
173
174template class _STLP_CLASS_DECLSPEC _Slist_node<void*>;
175template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base, _Slist_node<void*>, allocator<_Slist_node<void*> > >;
176template class _STLP_CLASS_DECLSPEC _Slist_base<void*, allocator<void*> >;
177template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(slist)<void*, allocator<void*> >;
178
179template class  _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
180template class  _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void***, void**, allocator<void**> >;
181template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
182template class  _STLP_CLASS_DECLSPEC _Deque_base<void*, allocator<void*> >;
183template class  _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(deque)<void*, allocator<void*> >;
184
185_STLP_MOVE_TO_STD_NAMESPACE
186
187#  endif /* _STLP_USE_PTR_SPECIALIZATIONS */
188
189_STLP_MOVE_TO_PRIV_NAMESPACE
190
191template class _STLP_CLASS_DECLSPEC _Rb_global<bool>;
192template class _STLP_CLASS_DECLSPEC _List_global<bool>;
193
194template class _STLP_CLASS_DECLSPEC _Sl_global<bool>;
195template class _STLP_CLASS_DECLSPEC _Stl_prime<bool>;
196
197template class _STLP_CLASS_DECLSPEC _LimG<bool>;
198
199_STLP_MOVE_TO_STD_NAMESPACE
200
201#endif /* _STLP_NO_FORCE_INSTANTIATE */
202
203_STLP_END_NAMESPACE
204
205#if defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY)
206extern "C" void _STLP_DECLSPEC _STLP_CALL _STLP_SIGNAL_RUNTIME_COMPATIBILITY() {}
207#endif
208
209#define FORCE_SYMBOL extern
210
211#if defined (_WIN32) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_USE_STATIC_LIB)
212// stlportmt.cpp : Defines the entry point for the DLL application.
213//
214#  undef FORCE_SYMBOL
215#  define FORCE_SYMBOL APIENTRY
216
217extern "C" {
218
219BOOL APIENTRY DllMain( HANDLE hModule,
220                       DWORD  ul_reason_for_call,
221                       LPVOID) {
222  switch (ul_reason_for_call) {
223    case DLL_PROCESS_ATTACH:
224      DisableThreadLibraryCalls((HINSTANCE)hModule);
225    case DLL_THREAD_ATTACH:
226    case DLL_THREAD_DETACH:
227    case DLL_PROCESS_DETACH:
228      break;
229    }
230  return TRUE;
231}
232
233} /* extern "C" */
234
235#if !defined (_STLP_MSVC) && !defined (__MINGW32__)
236_STLP_BEGIN_NAMESPACE
237
238static void FORCE_SYMBOL
239force_link() {
240  set<int>::iterator iter;
241  // _M_increment; _M_decrement instantiation
242  ++iter;
243  --iter;
244}
245
246_STLP_END_NAMESPACE
247#endif
248
249#endif /* _WIN32 */
250
251#if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
252#  undef std
253
254namespace std
255{
256  void _STLP_CALL unexpected() {
257    unexpected_handler hdl;
258    set_unexpected(hdl = set_unexpected((unexpected_handler)0));
259    hdl();
260  }
261}
262#endif
263