/project/jni/stlport/src/dll_main.cpp

https://github.com/aichunyu/FFPlayer · C++ · 313 lines · 207 code · 60 blank · 46 comment · 25 complexity · bf9c1e9b3ee0ff037e0abf6f889c6bf7 MD5 · raw file

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