⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _debug.c

📁 symbian 上的stl_port进过编译的。
💻 C
📖 第 1 页 / 共 2 页
字号:
#    undef _STLP_STRING_LITERAL#    undef _STLP_PERCENT_S_STLP_MOVE_TO_STD_NAMESPACE_STLP_END_NAMESPACE// abort()#  ifndef _STLP_INTERNAL_CSTDLIB#    include <stl/_cstdlib.h>#  endif#  if !defined (_STLP_DEBUG_MESSAGE)#    ifndef _STLP_INTERNAL_CSTDARG#      include <stl/_cstdarg.h>#    endif#    ifndef _STLP_INTERNAL_CSTDIO#      include <stl/_cstdio.h>#    endif#    if defined (_STLP_DEBUG_MODE_THROWS) && !defined (_STLP_RANGE_ERRORS_H)#      include <stl/_range_errors.h>#    endif_STLP_BEGIN_NAMESPACE_STLP_MOVE_TO_PRIV_NAMESPACEtemplate <class _Dummy>void _STLP_CALL__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...) {  STLPORT_CSTD::va_list __args;  va_start( __args, __format_str );#      if !defined (_STLP_DEBUG_MODE_THROWS)#        if defined (_STLP_USE_WIDE_INTERFACE)  TCHAR __buffer[512];  int _convert = strlen(__format_str) + 1;  LPWSTR _lpw = (LPWSTR)alloca(_convert * sizeof(wchar_t));  _lpw[0] = '\0';  MultiByteToWideChar(GetACP(), 0, __format_str, -1, _lpw, _convert);  wvsprintf(__buffer, _lpw, __args);  _STLP_WINCE_TRACE(__buffer);#        elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL))  char __buffer [4096];#          if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)  vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args);#          else  vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args);#          endif  OutputDebugStringA(__buffer);#        elif defined (__amigaos__)  STLPORT_CSTD::vfprintf(stderr, __format_str, (char *)__args);#        else  STLPORT_CSTD::vfprintf(stderr, __format_str, __args);#        endif#      else  char __buffer[4096];#        if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)  vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args);#        elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL))  vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args);#        else  vsprintf(__buffer, __format_str, __args);#        endif#      endif#      ifdef _STLP_DEBUG_MESSAGE_POST  _STLP_DEBUG_MESSAGE_POST#      endif  va_end(__args);#      if defined (_STLP_DEBUG_MODE_THROWS)  __stl_throw_runtime_error(__buffer);#      endif}_STLP_MOVE_TO_STD_NAMESPACE_STLP_END_NAMESPACE#    else_STLP_BEGIN_NAMESPACE_STLP_MOVE_TO_PRIV_NAMESPACEtemplate <class _Dummy>void _STLP_CALL__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...){}_STLP_MOVE_TO_STD_NAMESPACE_STLP_END_NAMESPACE#    endif /* _STLP_DEBUG_MESSAGE */_STLP_BEGIN_NAMESPACE_STLP_MOVE_TO_PRIV_NAMESPACEtemplate <class _Dummy>void _STLP_CALL__stl_debug_engine<_Dummy>::_IndexedError(int __error_ind, const char* __f, int __l) {  __stl_debug_message(_Message_table[_StlFormat_ERROR_RETURN],                      __f, __l, _Message_table[__error_ind]);}template <class _Dummy>void _STLP_CALL__stl_debug_engine<_Dummy>::_VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l) {  __stl_debug_message(_Message_table[_StlFormat_VERBOSE_ASSERTION_FAILURE],                      __f, __l, _Message_table[__error_ind], __f, __l, __expr);  __stl_debug_terminate();}template <class _Dummy>void _STLP_CALL__stl_debug_engine<_Dummy>::_Assert(const char* __expr, const char* __f, int __l) {  __stl_debug_message(_Message_table[_StlFormat_ASSERTION_FAILURE],__f, __l, __expr);  __stl_debug_terminate();}// if exceptions are present, sends unique exception// if not, calls abort() to terminatetemplate <class _Dummy>void _STLP_CALL__stl_debug_engine<_Dummy>::_Terminate(){ _STLP_ABORT(); }_STLP_MOVE_TO_STD_NAMESPACE_STLP_END_NAMESPACE#  endif /* _STLP_ASSERTIONS */#  if defined (_STLP_DEBUG)_STLP_BEGIN_NAMESPACE_STLP_MOVE_TO_PRIV_NAMESPACE//==========================================================//  owned_list non-inline methods//==========================================================template <class _Dummy>void  _STLP_CALL__stl_debug_engine<_Dummy>::_Invalidate_all(__owned_list* __l) {  _STLP_ACQUIRE_LOCK(__l->_M_lock);  _Stamp_all(__l, 0);  __l->_M_node._M_next =0;  _STLP_RELEASE_LOCK(__l->_M_lock);}// boris : this is unasafe routine; should be used from within critical section only !template <class _Dummy>void  _STLP_CALL__stl_debug_engine<_Dummy>::_Stamp_all(__owned_list* __l, __owned_list* __o) {  // crucial  if (__l->_M_node._M_owner) {    for (__owned_link*  __pos = (__owned_link*)__l->_M_node._M_next;      __pos != 0; __pos = (__owned_link*)__pos->_M_next) {      _STLP_ASSERT(__pos->_Owner()== __l)      __pos->_M_owner=__o;    }  }}template <class _Dummy>void  _STLP_CALL__stl_debug_engine<_Dummy>::_Verify(const __owned_list* __l) {  _STLP_ACQUIRE_LOCK(__l->_M_lock);  if (__l) {    _STLP_ASSERT(__l->_M_node._Owner() != 0)    for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next;         __pos != 0; __pos = (__owned_link*)__pos->_M_next) {      _STLP_ASSERT(__pos->_Owner()== __l)    }  }  _STLP_RELEASE_LOCK(__l->_M_lock);}template <class _Dummy>void _STLP_CALL__stl_debug_engine<_Dummy>::_Swap_owners(__owned_list& __x, __owned_list& __y) {  /*   *  according to the standard : --no swap() function invalidates any references,   *  pointers,  or  iterators referring to the elements of the containers being swapped.   */  __owned_link* __tmp;  /*   * boris : there is a deadlock potential situation here if we lock two containers sequentially.   * As user is supposed to provide its own synchronization around swap() ( it is unsafe to do any container/iterator access   * in parallel with swap()), we just do not use any locking at all -- that behaviour is closer to non-debug version   */  __tmp = __x._M_node._M_next;  _Stamp_all(&__x, &__y);  _Stamp_all(&__y, &__x);  __x._M_node._M_next = __y._M_node._M_next;  __y._M_node._M_next = __tmp;}template <class _Dummy>void _STLP_CALL__stl_debug_engine<_Dummy>::_Set_owner(__owned_list& __src, __owned_list& __dst) {  if (&__src == &__dst)    return;  // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here  typedef __owned_link _L_type;  _L_type* __prev = &__src._M_node;  _L_type* __pos = __prev->_M_next;  while (__pos != 0) {    __pos->_M_owner = &__dst;    __prev = __pos;    __pos = __prev->_M_next;  }  __prev->_M_next = __dst._M_node._M_next;  __dst._M_node._M_next = __src._M_node._M_next;  __src._M_node._M_next = 0;}template <class _Dummy>void _STLP_CALL__stl_debug_engine<_Dummy>::_M_detach(__owned_list* __l, __owned_link* __c_node) {  if (__l  != 0) {    _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER)    _STLP_ACQUIRE_LOCK(__l->_M_lock)      // boris : re-test the condition in case someone else already deleted us      if(__c_node->_M_owner != 0) {        __owned_link* __prev, *__next;        for (__prev = &__l->_M_node; (__next = __prev->_M_next) != __c_node;             __prev = __next) {          _STLP_ASSERT(__next && __next->_Owner() == __l)            }        __prev->_M_next = __c_node->_M_next;        __c_node->_M_owner=0;      }    _STLP_RELEASE_LOCK(__l->_M_lock)  }}template <class _Dummy>void _STLP_CALL__stl_debug_engine<_Dummy>::_M_attach(__owned_list* __l, __owned_link* __c_node) {  if (__l ==0) {    (__c_node)->_M_owner = 0;  } else {    _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER)    _STLP_ACQUIRE_LOCK(__l->_M_lock)    __c_node->_M_owner = __l;    __c_node->_M_next = __l->_M_node._M_next;    __l->_M_node._M_next = __c_node;    _STLP_RELEASE_LOCK(__l->_M_lock)  }}template <class _Dummy>void* _STLP_CALL__stl_debug_engine<_Dummy>::_Get_container_ptr(const __owned_link* __l) {  const __owned_list* __owner    = __l->_Owner();  _STLP_VERBOSE_RETURN_0(__owner != 0, _StlMsg_INVALID_ITERATOR)  void* __ret = __CONST_CAST(void*,__owner->_Owner());  _STLP_VERBOSE_RETURN_0(__ret !=0, _StlMsg_INVALID_CONTAINER)  return __ret;}template <class _Dummy>bool _STLP_CALL__stl_debug_engine<_Dummy>::_Check_same_owner(const __owned_link& __i1,                                              const __owned_link& __i2) {  _STLP_VERBOSE_RETURN(__i1._Valid(), _StlMsg_INVALID_LEFTHAND_ITERATOR)  _STLP_VERBOSE_RETURN(__i2._Valid(), _StlMsg_INVALID_RIGHTHAND_ITERATOR)  _STLP_VERBOSE_RETURN((__i1._Owner() == __i2._Owner()), _StlMsg_DIFFERENT_OWNERS)  return true;}template <class _Dummy>bool _STLP_CALL__stl_debug_engine<_Dummy>::_Check_same_or_null_owner(const __owned_link& __i1,                                                      const __owned_link& __i2) {  _STLP_VERBOSE_RETURN(__i1._Owner() == __i2._Owner(), _StlMsg_DIFFERENT_OWNERS)  return true;}template <class _Dummy>bool _STLP_CALL__stl_debug_engine<_Dummy>::_Check_if_owner( const __owned_list * __l, const __owned_link& __it) {  const __owned_list* __owner_ptr = __it._Owner();  _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR)  _STLP_VERBOSE_RETURN(__l == __owner_ptr, _StlMsg_NOT_OWNER)  return true;}template <class _Dummy>bool _STLP_CALL__stl_debug_engine<_Dummy>::_Check_if_not_owner( const __owned_list * __l, const __owned_link& __it) {  const __owned_list* __owner_ptr = __it._Owner();  _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR)  _STLP_VERBOSE_RETURN(__l != __owner_ptr, _StlMsg_SHOULD_NOT_OWNER)  return true;}_STLP_MOVE_TO_STD_NAMESPACE_STLP_END_NAMESPACE#  endif /* _STLP_DEBUG */#endif /* if defined (EXPOSE_GLOBALS_IMPLEMENTATION) */#endif /* header guard */// Local Variables:// mode:C++// End:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -