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

📄 _debug.c

📁 改进版本的c++类模版库和其原代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/* * * Copyright (c) 1997 * Moscow Center for SPARC Technology * * Copyright (c) 1999  * Boris Fomitchev * * This material is provided "as is", with absolutely no warranty expressed * or implied. Any use is at your own risk. * * Permission to use or copy this software for any purpose is hereby granted  * without fee, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */# ifndef _STLP_DEBUG_C#  define  _STLP_DEBUG_C#if defined ( _STLP_DEBUG )# ifdef _STLP_THREADS#  ifndef _STLP_NEED_MUTABLE #   define _STLP_ACQUIRE_LOCK(_Lock) _Lock._M_acquire_lock();#   define _STLP_RELEASE_LOCK(_Lock) _Lock._M_release_lock();#  else#   define _STLP_ACQUIRE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_acquire_lock();#   define _STLP_RELEASE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_release_lock();#  endif /* _STLP_NEED_MUTABLE */# else#  define _STLP_ACQUIRE_LOCK(_Lock)#  define _STLP_RELEASE_LOCK(_Lock)# endif /* _STLP_THREADS */_STLP_BEGIN_NAMESPACE//==========================================================//  global non-inline functions//==========================================================// [ i1, i2)template <class _Iterator>inline bool  _STLP_CALL__in_range_aux(const _Iterator& __it, const _Iterator& __first,               const _Iterator& __last, const random_access_iterator_tag &) {    return ( __it >= __first &&              __it < __last);}template <class _Iterator1, class _Iterator># if defined (_STLP_MSVC) && (_STLP_MSVC >= 1100)inline bool _STLP_CALL  __in_range_aux(_Iterator1 __it, const _Iterator& __first,# elseinline bool _STLP_CALL  __in_range_aux(const _Iterator1& __it, const _Iterator& __first,# endif                                       const _Iterator& __last, const forward_iterator_tag &) {    _Iterator1 __i(__first);    for (;  __i != __last && __i != __it; ++__i);    return (__i!=__last);}# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)template <class _Iterator1, class _Iterator>inline bool  _STLP_CALL__in_range_aux(const _Iterator1& __it, const _Iterator& __first,               const _Iterator& __last, const bidirectional_iterator_tag &) {    _Iterator1 __i(__first);    for (;  __i != __last && __i != __it; ++__i);    return (__i !=__last);}# endiftemplate <class _Iterator>bool _STLP_CALL  __check_range(const _Iterator& __first, const _Iterator& __last) {    _STLP_VERBOSE_RETURN(__valid_range(__first,__last), _StlMsg_INVALID_RANGE )    return true;}template <class _Iterator>bool _STLP_CALL  __check_range(const _Iterator& __it,                                const _Iterator& __start, const _Iterator& __finish) {    _STLP_VERBOSE_RETURN(__in_range(__it,__start, __finish),                          _StlMsg_NOT_IN_RANGE_1)    return true;}template <class _Iterator>bool _STLP_CALL  __check_range(const _Iterator& __first, const _Iterator& __last,                                const _Iterator& __start, const _Iterator& __finish) {    _STLP_VERBOSE_RETURN(__in_range(__first, __last, __start, __finish),                          _StlMsg_NOT_IN_RANGE_2)    return true;}//===============================================================template <class _Iterator>void  _STLP_CALL __invalidate_range(const __owned_list* __base,                                     const _Iterator& __first,                                    const _Iterator& __last){    typedef _Iterator* _Safe_iterator_ptr;    typedef __owned_link _L_type;    _STLP_ACQUIRE_LOCK(__base->_M_lock)    _L_type* __pos;    _L_type* __prev;    for (__prev = (_L_type*)&__base->_M_node, __pos= (_L_type*)__prev->_M_next;          __pos!=0;) {	            if ((!(&__first == (_Iterator*)__pos || &__last == (_Iterator*)__pos))            &&  __in_range_aux(			       ((_Iterator*)__pos)->_M_iterator,			       __first._M_iterator,			       __last._M_iterator,			       _STLP_ITERATOR_CATEGORY(__first, _Iterator))) {	  __pos->_M_owner = 0;	  __pos = (_L_type*) (__prev->_M_next = __pos->_M_next);	}	else {	  __prev = __pos;	  __pos=(_L_type*)__pos->_M_next;	}    }    _STLP_RELEASE_LOCK(__base->_M_lock)    }template <class _Iterator>void  _STLP_CALL __invalidate_iterator(const __owned_list* __base,                                        const _Iterator& __it){    typedef __owned_link   _L_type;    _L_type*  __position, *__prev;    _STLP_ACQUIRE_LOCK(__base->_M_lock)    for (__prev = (_L_type*)&__base->_M_node, __position = (_L_type*)__prev->_M_next;          __position!= 0;) {      // this requires safe iterators to be derived from __owned_link       if ((__position != (_L_type*)&__it) && ((_Iterator*)__position)->_M_iterator ==__it._M_iterator) {	    __position->_M_owner = 0;	    __position = (_L_type*) (__prev->_M_next = __position->_M_next);        }       else {	 __prev = __position;	 __position=(_L_type*)__position->_M_next;       }    }    _STLP_RELEASE_LOCK(__base->_M_lock)}_STLP_END_NAMESPACE# endif /* _STLP_DEBUG */# if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)// dwa 12/26/99 -- for abort#  if defined (_STLP_USE_NEW_C_HEADERS)#   include <cstdlib>#  else#   include <stdlib.h>#  endif# if defined (_STLP_WIN32)#  include <stl/_threads.h># endif//==========================================================// .c section//  owned_list non-inline methods and global functions //==========================================================#if defined ( _STLP_ASSERTIONS )_STLP_BEGIN_NAMESPACE# ifndef _STLP_STRING_LITERAL# define _STLP_STRING_LITERAL(__x) __x# endif# ifdef _STLP_WINCE#  define _STLP_PERCENT_S "%hs" # else#  define _STLP_PERCENT_S "%s" # endif# define _STLP_MESSAGE_TABLE_BODY = { \_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error: %s\n"), \_STLP_STRING_LITERAL(_STLP_PERCENT_S "(%d): STL assertion failure : " _STLP_PERCENT_S "\n" _STLP_ASSERT_MSG_TRAILER), \_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error : " _STLP_PERCENT_S "\n" _STLP_PERCENT_S "(%d): STL assertion failure:     " _STLP_PERCENT_S " \n" _STLP_ASSERT_MSG_TRAILER), \_STLP_STRING_LITERAL("Invalid argument to operation (see operation documentation)"),                  \_STLP_STRING_LITERAL("Taking an iterator out of destroyed (or otherwise corrupted) container"),       \_STLP_STRING_LITERAL("Trying to extract an object out from empty container"),\_STLP_STRING_LITERAL("Past-the-end iterator could not be erased"),  \_STLP_STRING_LITERAL("Index out of bounds"),  \_STLP_STRING_LITERAL("Container doesn't own the iterator"),  \_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) iterator used"),  \_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) lefthand iterator in expression"),  \_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) righthand iterator in expression"),  \_STLP_STRING_LITERAL("Iterators used in expression are from different owners"),  \_STLP_STRING_LITERAL("Iterator could not be dereferenced (past-the-end ?)"),  \_STLP_STRING_LITERAL("Range [first,last) is invalid"),  \_STLP_STRING_LITERAL("Iterator is not in range [first,last)"),  \_STLP_STRING_LITERAL("Range [first,last) is not in range [start,finish)"),  \_STLP_STRING_LITERAL("The advance would produce invalid iterator"),  \_STLP_STRING_LITERAL("Iterator is singular (advanced beyond the bounds ?)"),  \_STLP_STRING_LITERAL("Memory block deallocated twice"),  \_STLP_STRING_LITERAL("Deallocating a block that was never allocated"),  \_STLP_STRING_LITERAL("Deallocating a memory block allocated for another type"),  \_STLP_STRING_LITERAL("Size of block passed to deallocate() doesn't match block size"),  \_STLP_STRING_LITERAL("Pointer underrun - safety margin at front of memory block overwritten"),  \_STLP_STRING_LITERAL("Pointer overrrun - safety margin at back of memory block overwritten"),   \_STLP_STRING_LITERAL("Attempt to dereference null pointer returned by auto_ptr::get()"),   \_STLP_STRING_LITERAL("Unknown problem") \  }# if ( _STLP_STATIC_TEMPLATE_DATA > 0 )template <class _Dummy>const char* __stl_debug_engine<_Dummy>::_Message_table[_StlMsg_MAX]  _STLP_MESSAGE_TABLE_BODY;# else__DECLARE_INSTANCE(const char*, __stl_debug_engine<bool>::_Message_table[_StlMsg_MAX],		   _STLP_MESSAGE_TABLE_BODY);# endif# undef _STLP_STRING_LITERAL# undef _STLP_PERCENT_S_STLP_END_NAMESPACE// abort()#    include <cstdlib>#  if !defined( _STLP_DEBUG_MESSAGE )#    include <cstdarg>#    include <cstdio>_STLP_BEGIN_NAMESPACEtemplate <class _Dummy>void _STLP_CALL  __stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...){	STLPORT_CSTD::va_list __args;

⌨️ 快捷键说明

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