Home | History | Annotate | Download | only in src
      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)
     64 exception::exception() _STLP_NOTHROW {}
     65 exception::~exception() _STLP_NOTHROW {}
     66 bad_exception::bad_exception() _STLP_NOTHROW {}
     67 bad_exception::~bad_exception() _STLP_NOTHROW {}
     68 const char* exception::what() const _STLP_NOTHROW { return "class exception"; }
     69 const 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
     76 logic_error::~logic_error() _STLP_NOTHROW_INHERENTLY {}
     77 runtime_error::~runtime_error() _STLP_NOTHROW_INHERENTLY {}
     78 domain_error::~domain_error() _STLP_NOTHROW_INHERENTLY {}
     79 invalid_argument::~invalid_argument() _STLP_NOTHROW_INHERENTLY {}
     80 length_error::~length_error() _STLP_NOTHROW_INHERENTLY {}
     81 out_of_range::~out_of_range() _STLP_NOTHROW_INHERENTLY {}
     82 range_error::~range_error() _STLP_NOTHROW_INHERENTLY {}
     83 overflow_error::~overflow_error() _STLP_NOTHROW_INHERENTLY {}
     84 underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {}
     85 
     86 #endif
     87 
     88 #if !defined(_STLP_WCE_EVC3)
     89 #  if defined (_STLP_NO_BAD_ALLOC)
     90 const 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
     98 template class _STLP_CLASS_DECLSPEC __stl_debug_engine<bool>;
     99 _STLP_MOVE_TO_STD_NAMESPACE
    100 #  endif
    101 
    102 template class _STLP_CLASS_DECLSPEC __debug_alloc<__node_alloc>;
    103 template 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)
    114 template class _STLP_CLASS_DECLSPEC allocator<_STLP_PRIV _Slist_node_base*>;
    115 
    116 _STLP_MOVE_TO_PRIV_NAMESPACE
    117 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
    118                                                       allocator<_Slist_node_base*> >;
    119 template 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
    126 template 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 
    131 template 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)
    137 template class _STLP_CLASS_DECLSPEC allocator<locale::facet*>;
    138 
    139 _STLP_MOVE_TO_PRIV_NAMESPACE
    140 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
    141 template 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)
    148 template class _STLP_CLASS_DECLSPEC __construct_checker<_STLP_PRIV _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
    149 template 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 
    154 template 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)
    158 template class _STLP_CLASS_DECLSPEC allocator<void*>;
    159 
    160 typedef _STLP_PRIV _List_node<void*> _VoidPtr_Node;
    161 template class _STLP_CLASS_DECLSPEC allocator<_VoidPtr_Node>;
    162 
    163 _STLP_MOVE_TO_PRIV_NAMESPACE
    164 
    165 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void**, void*, allocator<void*> >;
    166 template class _STLP_CLASS_DECLSPEC _Vector_base<void*, allocator<void*> >;
    167 template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(vector)<void*, allocator<void*> >;
    168 
    169 template class _STLP_CLASS_DECLSPEC _List_node<void*>;
    170 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_List_node_base, _VoidPtr_Node, allocator<_VoidPtr_Node> >;
    171 template class _STLP_CLASS_DECLSPEC _List_base<void*, allocator<void*> >;
    172 template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(list)<void*, allocator<void*> >;
    173 
    174 template class _STLP_CLASS_DECLSPEC _Slist_node<void*>;
    175 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base, _Slist_node<void*>, allocator<_Slist_node<void*> > >;
    176 template class _STLP_CLASS_DECLSPEC _Slist_base<void*, allocator<void*> >;
    177 template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(slist)<void*, allocator<void*> >;
    178 
    179 template class  _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
    180 template class  _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void***, void**, allocator<void**> >;
    181 template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
    182 template class  _STLP_CLASS_DECLSPEC _Deque_base<void*, allocator<void*> >;
    183 template 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 
    191 template class _STLP_CLASS_DECLSPEC _Rb_global<bool>;
    192 template class _STLP_CLASS_DECLSPEC _List_global<bool>;
    193 
    194 template class _STLP_CLASS_DECLSPEC _Sl_global<bool>;
    195 template class _STLP_CLASS_DECLSPEC _Stl_prime<bool>;
    196 
    197 template 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)
    206 extern "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 
    217 extern "C" {
    218 
    219 BOOL 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 
    238 static void FORCE_SYMBOL
    239 force_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 
    254 namespace 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