src/common

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-06-09 16:34:54 +00:00
parent c8f144761c
commit 749b01f037
2 changed files with 34 additions and 5 deletions

View File

@@ -1979,6 +1979,20 @@ This function is now obsolete, replaced by \helpref{Log functions}{logfunctions}
<wx/memory.h> <wx/memory.h>
\membersection{::wxTrap}\label{wxtrap}
\func{void}{wxTrap}{\void}
In debug mode (when {\tt \_\_WXDEBUG\_\_} is defined) this function generates a
debugger exception meaning that the control is passed to the debugger if one is
attached to the process. Otherwise the program just terminates abnormally.
In release mode this function does nothing.
\wxheading{Include files}
<wx/debug.h>
\membersection{::wxUsleep}\label{wxusleep} \membersection{::wxUsleep}\label{wxusleep}
\func{void}{wxUsleep}{\param{unsigned long}{ milliseconds}} \func{void}{wxUsleep}{\param{unsigned long}{ milliseconds}}

View File

@@ -51,7 +51,13 @@ WXDLLEXPORT_DATA(extern const bool) wxFalse;
szFile and nLine - file name and line number of the ASSERT szFile and nLine - file name and line number of the ASSERT
szMsg - optional message explaining the reason szMsg - optional message explaining the reason
*/ */
void WXDLLEXPORT wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg = (const wxChar *) NULL); extern void WXDLLEXPORT wxOnAssert(const wxChar *szFile,
int nLine,
const wxChar *szMsg = NULL);
// call this function to break into the debugger uncodnitionally (assuming
// the program is running under debugger, of course)
extern void WXDLLEXPORT wxTrap();
/* /*
notice the usage of else at the end of wxASSERT macro: this ensures that notice the usage of else at the end of wxASSERT macro: this ensures that
@@ -72,7 +78,15 @@ WXDLLEXPORT_DATA(extern const bool) wxFalse;
// assert with additional message explaining it's cause // assert with additional message explaining it's cause
#define wxASSERT_MSG(cond, msg) \ #define wxASSERT_MSG(cond, msg) \
if ( !(cond) ) wxOnAssert(__TFILE__, __LINE__, msg); else if ( !(cond) ) wxOnAssert(__TFILE__, __LINE__, msg); else
// an assert helper used to avoid warning when testing constant expressions,
// i.e. wxASSERT( sizeof(int) == 4 ) can generate a compiler warning about
// expression being always true, but not using
// wxASSERT( wxAssertIsEqual(sizeof(int), 4) )
extern bool WXDLLEXPORT wxAssertIsEqual(int x, int y);
#else #else
#define wxTrap()
// nothing to do in release modes (hopefully at this moment there are // nothing to do in release modes (hopefully at this moment there are
// no more bugs ;-) // no more bugs ;-)
#define wxASSERT(cond) #define wxASSERT(cond)
@@ -107,10 +121,11 @@ WXDLLEXPORT_DATA(extern const bool) wxFalse;
#define wxCHECK2_MSG(x, op, msg) if (!(x)) {wxFAIL_MSG(msg); op; } #define wxCHECK2_MSG(x, op, msg) if (!(x)) {wxFAIL_MSG(msg); op; }
// special form of wxCHECK2: as wxCHECK, but for use in void functions // special form of wxCHECK2: as wxCHECK, but for use in void functions
// NB: there is only one form (with msg parameter) and it's intentional: //
// there is no other way to tell the caller what exactly went wrong // NB: there is only one form (with msg parameter) and it's intentional:
// from the void function (of course, the function shouldn't be void // there is no other way to tell the caller what exactly went wrong
// to begin with...) // from the void function (of course, the function shouldn't be void
// to begin with...)
#define wxCHECK_RET(x, msg) if (!(x)) {wxFAIL_MSG(msg); return; } #define wxCHECK_RET(x, msg) if (!(x)) {wxFAIL_MSG(msg); return; }
#endif // _WX_DEBUG_H_ #endif // _WX_DEBUG_H_