dll_main.cpp 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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. #define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
  26. #include "stlport_prefix.h"
  27. #if !defined (_STLP_DEBUG) && ! defined (_STLP_ASSERTIONS)
  28. # if !defined (__APPLE__) || !defined (__GNUC__) || (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
  29. /* dums: Please if the following code was being uncommented please explain why
  30. * as for the moment it only looks like a source of inconsistency in the way
  31. * STLport different translation units are compiled.
  32. */
  33. //# define _STLP_ASSERTIONS 1
  34. # endif
  35. #endif
  36. #include <utility>
  37. #include <memory>
  38. #include <vector>
  39. #include <set>
  40. #include <list>
  41. #include <slist>
  42. #include <deque>
  43. #include <hash_map>
  44. #include <limits>
  45. #include <string>
  46. #include <stdexcept>
  47. #include <bitset>
  48. #include <locale>
  49. #if defined (__DMC__)
  50. // for rope static members
  51. # include <rope>
  52. #endif
  53. #include <stl/_range_errors.c>
  54. _STLP_BEGIN_NAMESPACE
  55. #if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
  56. exception::exception() _STLP_NOTHROW {}
  57. exception::~exception() _STLP_NOTHROW {}
  58. bad_exception::bad_exception() _STLP_NOTHROW {}
  59. bad_exception::~bad_exception() _STLP_NOTHROW {}
  60. const char* exception::what() const _STLP_NOTHROW { return "class exception"; }
  61. const char* bad_exception::what() const _STLP_NOTHROW { return "class bad_exception"; }
  62. #endif
  63. #if defined (_STLP_OWN_STDEXCEPT)
  64. # include <stl/_stdexcept_base.c>
  65. // boris : those are needed to force typeinfo nodes to be created in here only
  66. logic_error::~logic_error() _STLP_NOTHROW_INHERENTLY {}
  67. runtime_error::~runtime_error() _STLP_NOTHROW_INHERENTLY {}
  68. domain_error::~domain_error() _STLP_NOTHROW_INHERENTLY {}
  69. invalid_argument::~invalid_argument() _STLP_NOTHROW_INHERENTLY {}
  70. length_error::~length_error() _STLP_NOTHROW_INHERENTLY {}
  71. out_of_range::~out_of_range() _STLP_NOTHROW_INHERENTLY {}
  72. range_error::~range_error() _STLP_NOTHROW_INHERENTLY {}
  73. overflow_error::~overflow_error() _STLP_NOTHROW_INHERENTLY {}
  74. underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {}
  75. #endif
  76. #if !defined(_STLP_WCE_EVC3)
  77. # if defined (_STLP_NO_BAD_ALLOC)
  78. const nothrow_t nothrow /* = {} */;
  79. # endif
  80. #endif
  81. #if !defined (_STLP_NO_FORCE_INSTANTIATE)
  82. # if defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS)
  83. _STLP_MOVE_TO_PRIV_NAMESPACE
  84. template class _STLP_CLASS_DECLSPEC __stl_debug_engine<bool>;
  85. _STLP_MOVE_TO_STD_NAMESPACE
  86. # endif
  87. template class _STLP_CLASS_DECLSPEC __debug_alloc<__node_alloc>;
  88. template class _STLP_CLASS_DECLSPEC __debug_alloc<__new_alloc>;
  89. //Export of the types used to represent buckets in the hashtable implementation.
  90. /*
  91. * For the vector class we do not use any MSVC6 workaround even if we export it from
  92. * the STLport dynamic libraries because we know what methods are called and none is
  93. * a template method. Moreover the exported class is an instanciation of vector with
  94. * _Slist_node_base struct that is an internal STLport class that no user should ever
  95. * use.
  96. */
  97. # if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
  98. template class _STLP_CLASS_DECLSPEC allocator<_STLP_PRIV _Slist_node_base*>;
  99. _STLP_MOVE_TO_PRIV_NAMESPACE
  100. template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
  101. allocator<_Slist_node_base*> >;
  102. template class _STLP_CLASS_DECLSPEC _Vector_base<_Slist_node_base*,
  103. allocator<_Slist_node_base*> >;
  104. _STLP_MOVE_TO_STD_NAMESPACE
  105. # endif
  106. # if defined (_STLP_DEBUG)
  107. _STLP_MOVE_TO_PRIV_NAMESPACE
  108. template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_NAME(vector)<_Slist_node_base*,
  109. allocator<_Slist_node_base*> >;
  110. _STLP_MOVE_TO_STD_NAMESPACE
  111. # endif
  112. template class _STLP_CLASS_DECLSPEC vector<_STLP_PRIV _Slist_node_base*,
  113. allocator<_STLP_PRIV _Slist_node_base*> >;
  114. //End of hashtable bucket types export.
  115. //Export of _Locale_impl facets container:
  116. # if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
  117. template class _STLP_CLASS_DECLSPEC allocator<locale::facet*>;
  118. _STLP_MOVE_TO_PRIV_NAMESPACE
  119. template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
  120. template class _STLP_CLASS_DECLSPEC _Vector_base<locale::facet*, allocator<locale::facet*> >;
  121. _STLP_MOVE_TO_STD_NAMESPACE
  122. # endif
  123. # if defined (_STLP_DEBUG)
  124. _STLP_MOVE_TO_PRIV_NAMESPACE
  125. # define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
  126. template class _STLP_CLASS_DECLSPEC __construct_checker<_STLP_PRIV _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
  127. template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >;
  128. # undef _STLP_NON_DBG_VECTOR
  129. _STLP_MOVE_TO_STD_NAMESPACE
  130. # endif
  131. template class _STLP_CLASS_DECLSPEC vector<locale::facet*, allocator<locale::facet*> >;
  132. //End of export of _Locale_impl facets container.
  133. # if defined (_STLP_USE_PTR_SPECIALIZATIONS)
  134. template class _STLP_CLASS_DECLSPEC allocator<void*>;
  135. typedef _STLP_PRIV _List_node<void*> _VoidPtr_Node;
  136. template class _STLP_CLASS_DECLSPEC allocator<_VoidPtr_Node>;
  137. _STLP_MOVE_TO_PRIV_NAMESPACE
  138. template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void**, void*, allocator<void*> >;
  139. template class _STLP_CLASS_DECLSPEC _Vector_base<void*, allocator<void*> >;
  140. template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(vector)<void*, allocator<void*> >;
  141. template class _STLP_CLASS_DECLSPEC _List_node<void*>;
  142. template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_List_node_base, _VoidPtr_Node, allocator<_VoidPtr_Node> >;
  143. template class _STLP_CLASS_DECLSPEC _List_base<void*, allocator<void*> >;
  144. template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(list)<void*, allocator<void*> >;
  145. template class _STLP_CLASS_DECLSPEC _Slist_node<void*>;
  146. template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base, _Slist_node<void*>, allocator<_Slist_node<void*> > >;
  147. template class _STLP_CLASS_DECLSPEC _Slist_base<void*, allocator<void*> >;
  148. template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(slist)<void*, allocator<void*> >;
  149. template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
  150. template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void***, void**, allocator<void**> >;
  151. template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
  152. template class _STLP_CLASS_DECLSPEC _Deque_base<void*, allocator<void*> >;
  153. template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(deque)<void*, allocator<void*> >;
  154. _STLP_MOVE_TO_STD_NAMESPACE
  155. # endif /* _STLP_USE_PTR_SPECIALIZATIONS */
  156. _STLP_MOVE_TO_PRIV_NAMESPACE
  157. template class _STLP_CLASS_DECLSPEC _Rb_global<bool>;
  158. template class _STLP_CLASS_DECLSPEC _List_global<bool>;
  159. template class _STLP_CLASS_DECLSPEC _Sl_global<bool>;
  160. template class _STLP_CLASS_DECLSPEC _Stl_prime<bool>;
  161. template class _STLP_CLASS_DECLSPEC _LimG<bool>;
  162. _STLP_MOVE_TO_STD_NAMESPACE
  163. #endif /* _STLP_NO_FORCE_INSTANTIATE */
  164. _STLP_END_NAMESPACE
  165. #if defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY)
  166. extern "C" void _STLP_DECLSPEC _STLP_CALL _STLP_SIGNAL_RUNTIME_COMPATIBILITY() {}
  167. #endif
  168. #define FORCE_SYMBOL extern
  169. #if defined (_WIN32) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_USE_STATIC_LIB)
  170. // stlportmt.cpp : Defines the entry point for the DLL application.
  171. //
  172. # undef FORCE_SYMBOL
  173. # define FORCE_SYMBOL APIENTRY
  174. extern "C" {
  175. BOOL APIENTRY DllMain( HANDLE hModule,
  176. DWORD ul_reason_for_call,
  177. LPVOID) {
  178. switch (ul_reason_for_call) {
  179. case DLL_PROCESS_ATTACH:
  180. DisableThreadLibraryCalls((HINSTANCE)hModule);
  181. case DLL_THREAD_ATTACH:
  182. case DLL_THREAD_DETACH:
  183. case DLL_PROCESS_DETACH:
  184. break;
  185. }
  186. return TRUE;
  187. }
  188. } /* extern "C" */
  189. #if !defined (_STLP_MSVC) && !defined (__MINGW32__)
  190. _STLP_BEGIN_NAMESPACE
  191. static void FORCE_SYMBOL
  192. force_link() {
  193. set<int>::iterator iter;
  194. // _M_increment; _M_decrement instantiation
  195. ++iter;
  196. --iter;
  197. }
  198. _STLP_END_NAMESPACE
  199. #endif
  200. #endif /* _WIN32 */
  201. #if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
  202. # undef std
  203. namespace std
  204. {
  205. void _STLP_CALL unexpected() {
  206. unexpected_handler hdl;
  207. set_unexpected(hdl = set_unexpected((unexpected_handler)0));
  208. hdl();
  209. }
  210. }
  211. #endif