]> git.saurik.com Git - wxWidgets.git/blame - src/common/log.cpp
use a smaller tip font for MSW
[wxWidgets.git] / src / common / log.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: log.cpp
3// Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs)
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 29/01/98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
dd85fc6b 19
c801d85f
KB
20#ifdef __GNUG__
21 #pragma implementation "log.h"
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
28 #pragma hdrstop
29#endif
30
31// wxWindows
32#ifndef WX_PRECOMP
e90c1d2a
VZ
33 #include "wx/string.h"
34 #include "wx/intl.h"
35 #include "wx/app.h"
36
37 #if wxUSE_GUI
38 #include "wx/window.h"
39 #ifdef __WXMSW__
40 #include "wx/msw/private.h"
41 #endif
42 #include "wx/msgdlg.h"
43 #endif
9ef3052c 44#endif //WX_PRECOMP
c801d85f 45
dbf3cd7a
RR
46#include "wx/file.h"
47#include "wx/textfile.h"
48#include "wx/utils.h"
a324a7bc 49#include "wx/wxchar.h"
dbf3cd7a 50#include "wx/log.h"
c801d85f
KB
51
52// other standard headers
53#include <errno.h>
54#include <stdlib.h>
55#include <time.h>
56
2049ba38 57#ifdef __WXMSW__
9ef3052c 58 #include <windows.h>
a0a302dc
JS
59 // Redefines OutputDebugString if necessary
60 #include "wx/msw/private.h"
3078c3a6
VZ
61#else //Unix
62 #include <signal.h>
63#endif //Win/Unix
c801d85f
KB
64
65// ----------------------------------------------------------------------------
66// non member functions
67// ----------------------------------------------------------------------------
68
69// define this to enable wrapping of log messages
70//#define LOG_PRETTY_WRAP
71
9ef3052c 72#ifdef LOG_PRETTY_WRAP
c801d85f
KB
73 static void wxLogWrap(FILE *f, const char *pszPrefix, const char *psz);
74#endif
75
76// ============================================================================
77// implementation
78// ============================================================================
79
80// ----------------------------------------------------------------------------
81// implementation of Log functions
82//
83// NB: unfortunately we need all these distinct functions, we can't make them
84// macros and not all compilers inline vararg functions.
85// ----------------------------------------------------------------------------
86
87// log functions can't allocate memory (LogError("out of memory...") should
88// work!), so we use a static buffer for all log messages
89#define LOG_BUFFER_SIZE (4096)
90
0fb67cd1 91// static buffer for error messages (FIXME MT-unsafe)
50920146 92static wxChar s_szBuf[LOG_BUFFER_SIZE];
c801d85f
KB
93
94// generic log function
50920146 95void wxLogGeneric(wxLogLevel level, const wxChar *szFormat, ...)
c801d85f 96{
9ef3052c
VZ
97 if ( wxLog::GetActiveTarget() != NULL ) {
98 va_list argptr;
7502ba29 99 va_start(argptr, szFormat);
378b05f7 100 wxVsnprintf(s_szBuf, WXSIZEOF(s_szBuf), szFormat, argptr);
9ef3052c
VZ
101 va_end(argptr);
102
0fb67cd1 103 wxLog::OnLog(level, s_szBuf, time(NULL));
9ef3052c 104 }
c801d85f
KB
105}
106
107#define IMPLEMENT_LOG_FUNCTION(level) \
50920146 108 void wxLog##level(const wxChar *szFormat, ...) \
c801d85f
KB
109 { \
110 if ( wxLog::GetActiveTarget() != NULL ) { \
111 va_list argptr; \
7502ba29 112 va_start(argptr, szFormat); \
378b05f7 113 wxVsnprintf(s_szBuf, WXSIZEOF(s_szBuf), szFormat, argptr); \
c801d85f
KB
114 va_end(argptr); \
115 \
0fb67cd1 116 wxLog::OnLog(wxLOG_##level, s_szBuf, time(NULL)); \
c801d85f
KB
117 } \
118 }
119
120IMPLEMENT_LOG_FUNCTION(FatalError)
121IMPLEMENT_LOG_FUNCTION(Error)
122IMPLEMENT_LOG_FUNCTION(Warning)
123IMPLEMENT_LOG_FUNCTION(Message)
124IMPLEMENT_LOG_FUNCTION(Info)
125IMPLEMENT_LOG_FUNCTION(Status)
126
9ef3052c 127// same as info, but only if 'verbose' mode is on
50920146 128void wxLogVerbose(const wxChar *szFormat, ...)
9ef3052c
VZ
129{
130 wxLog *pLog = wxLog::GetActiveTarget();
131 if ( pLog != NULL && pLog->GetVerbose() ) {
132 va_list argptr;
7502ba29 133 va_start(argptr, szFormat);
378b05f7 134 wxVsnprintf(s_szBuf, WXSIZEOF(s_szBuf), szFormat, argptr);
9ef3052c
VZ
135 va_end(argptr);
136
0fb67cd1 137 wxLog::OnLog(wxLOG_Info, s_szBuf, time(NULL));
9ef3052c
VZ
138 }
139}
140
141// debug functions
b2aef89b 142#ifdef __WXDEBUG__
9ef3052c 143#define IMPLEMENT_LOG_DEBUG_FUNCTION(level) \
50920146 144 void wxLog##level(const wxChar *szFormat, ...) \
c801d85f
KB
145 { \
146 if ( wxLog::GetActiveTarget() != NULL ) { \
147 va_list argptr; \
148 va_start(argptr, szFormat); \
378b05f7 149 wxVsnprintf(s_szBuf, WXSIZEOF(s_szBuf), szFormat, argptr); \
c801d85f
KB
150 va_end(argptr); \
151 \
0fb67cd1 152 wxLog::OnLog(wxLOG_##level, s_szBuf, time(NULL)); \
c801d85f
KB
153 } \
154 }
155
50920146 156 void wxLogTrace(const wxChar *mask, const wxChar *szFormat, ...)
0fb67cd1
VZ
157 {
158 wxLog *pLog = wxLog::GetActiveTarget();
159
160 if ( pLog != NULL && wxLog::IsAllowedTraceMask(mask) ) {
161 va_list argptr;
162 va_start(argptr, szFormat);
378b05f7 163 wxVsnprintf(s_szBuf, WXSIZEOF(s_szBuf), szFormat, argptr);
0fb67cd1
VZ
164 va_end(argptr);
165
166 wxLog::OnLog(wxLOG_Trace, s_szBuf, time(NULL));
167 }
168 }
169
50920146 170 void wxLogTrace(wxTraceMask mask, const wxChar *szFormat, ...)
9ef3052c
VZ
171 {
172 wxLog *pLog = wxLog::GetActiveTarget();
c801d85f 173
9ef3052c
VZ
174 // we check that all of mask bits are set in the current mask, so
175 // that wxLogTrace(wxTraceRefCount | wxTraceOle) will only do something
176 // if both bits are set.
d93f63db 177 if ( pLog != NULL && ((pLog->GetTraceMask() & mask) == mask) ) {
9ef3052c
VZ
178 va_list argptr;
179 va_start(argptr, szFormat);
378b05f7 180 wxVsnprintf(s_szBuf, WXSIZEOF(s_szBuf), szFormat, argptr);
9ef3052c
VZ
181 va_end(argptr);
182
0fb67cd1 183 wxLog::OnLog(wxLOG_Trace, s_szBuf, time(NULL));
9ef3052c
VZ
184 }
185 }
186
187#else // release
188 #define IMPLEMENT_LOG_DEBUG_FUNCTION(level)
189#endif
190
191IMPLEMENT_LOG_DEBUG_FUNCTION(Debug)
192IMPLEMENT_LOG_DEBUG_FUNCTION(Trace)
193
194// wxLogSysError: one uses the last error code, for other you must give it
195// explicitly
196
197// common part of both wxLogSysError
198void wxLogSysErrorHelper(long lErrCode)
c801d85f 199{
50920146 200 wxChar szErrMsg[LOG_BUFFER_SIZE / 2];
378b05f7
VZ
201 wxSnprintf(szErrMsg, WXSIZEOF(szErrMsg),
202 _(" (error %ld: %s)"), lErrCode, wxSysErrorMsg(lErrCode));
50920146 203 wxStrncat(s_szBuf, szErrMsg, WXSIZEOF(s_szBuf) - wxStrlen(s_szBuf));
c801d85f 204
0fb67cd1 205 wxLog::OnLog(wxLOG_Error, s_szBuf, time(NULL));
9ef3052c 206}
c801d85f 207
50920146 208void WXDLLEXPORT wxLogSysError(const wxChar *szFormat, ...)
9ef3052c 209{
0fb67cd1
VZ
210 va_list argptr;
211 va_start(argptr, szFormat);
378b05f7 212 wxVsnprintf(s_szBuf, WXSIZEOF(s_szBuf), szFormat, argptr);
0fb67cd1 213 va_end(argptr);
9ef3052c 214
0fb67cd1 215 wxLogSysErrorHelper(wxSysErrorCode());
c801d85f
KB
216}
217
50920146 218void WXDLLEXPORT wxLogSysError(long lErrCode, const wxChar *szFormat, ...)
c801d85f 219{
0fb67cd1
VZ
220 va_list argptr;
221 va_start(argptr, szFormat);
378b05f7 222 wxVsnprintf(s_szBuf, WXSIZEOF(s_szBuf), szFormat, argptr);
0fb67cd1 223 va_end(argptr);
c801d85f 224
0fb67cd1 225 wxLogSysErrorHelper(lErrCode);
c801d85f
KB
226}
227
228// ----------------------------------------------------------------------------
229// wxLog class implementation
230// ----------------------------------------------------------------------------
231
232wxLog::wxLog()
233{
0fb67cd1 234 m_bHasMessages = FALSE;
a2ace6ff 235
0fb67cd1 236 // enable verbose messages by default in the debug builds
a2ace6ff 237#ifdef __WXDEBUG__
0fb67cd1 238 m_bVerbose = TRUE;
a2ace6ff 239#else // release
0fb67cd1 240 m_bVerbose = FALSE;
a2ace6ff 241#endif // debug/release
c801d85f
KB
242}
243
9ec05cc9
VZ
244wxLog *wxLog::GetActiveTarget()
245{
0fb67cd1
VZ
246 if ( ms_bAutoCreate && ms_pLogger == NULL ) {
247 // prevent infinite recursion if someone calls wxLogXXX() from
248 // wxApp::CreateLogTarget()
249 static bool s_bInGetActiveTarget = FALSE;
250 if ( !s_bInGetActiveTarget ) {
251 s_bInGetActiveTarget = TRUE;
252
0fb67cd1
VZ
253 // ask the application to create a log target for us
254 if ( wxTheApp != NULL )
255 ms_pLogger = wxTheApp->CreateLogTarget();
256 else
257 ms_pLogger = new wxLogStderr;
0fb67cd1
VZ
258
259 s_bInGetActiveTarget = FALSE;
260
261 // do nothing if it fails - what can we do?
262 }
275bf4c1 263 }
c801d85f 264
0fb67cd1 265 return ms_pLogger;
c801d85f
KB
266}
267
c085e333 268wxLog *wxLog::SetActiveTarget(wxLog *pLogger)
9ec05cc9 269{
0fb67cd1
VZ
270 if ( ms_pLogger != NULL ) {
271 // flush the old messages before changing because otherwise they might
272 // get lost later if this target is not restored
273 ms_pLogger->Flush();
274 }
c801d85f 275
0fb67cd1
VZ
276 wxLog *pOldLogger = ms_pLogger;
277 ms_pLogger = pLogger;
c085e333 278
0fb67cd1 279 return pOldLogger;
c801d85f
KB
280}
281
0fb67cd1 282void wxLog::RemoveTraceMask(const wxString& str)
c801d85f 283{
0fb67cd1
VZ
284 int index = ms_aTraceMasks.Index(str);
285 if ( index != wxNOT_FOUND )
286 ms_aTraceMasks.Remove((size_t)index);
287}
c801d85f 288
d2e1ef19
VZ
289void wxLog::TimeStamp(wxString *str)
290{
291 if ( ms_timestamp )
292 {
293 wxChar buf[256];
294 time_t timeNow;
295 (void)time(&timeNow);
c49245f8 296 wxStrftime(buf, WXSIZEOF(buf), ms_timestamp, localtime(&timeNow));
d2e1ef19
VZ
297
298 str->Empty();
223d09f6 299 *str << buf << wxT(": ");
d2e1ef19
VZ
300 }
301}
302
50920146 303void wxLog::DoLog(wxLogLevel level, const wxChar *szString, time_t t)
0fb67cd1 304{
0fb67cd1
VZ
305 switch ( level ) {
306 case wxLOG_FatalError:
786855a1 307 DoLogString(wxString(_("Fatal error: ")) + szString, t);
0fb67cd1
VZ
308 DoLogString(_("Program aborted."), t);
309 Flush();
310 abort();
311 break;
312
313 case wxLOG_Error:
786855a1 314 DoLogString(wxString(_("Error: ")) + szString, t);
0fb67cd1
VZ
315 break;
316
317 case wxLOG_Warning:
786855a1 318 DoLogString(wxString(_("Warning: ")) + szString, t);
0fb67cd1
VZ
319 break;
320
321 case wxLOG_Info:
0fb67cd1 322 if ( GetVerbose() )
37278984 323 case wxLOG_Message:
87a1e308 324 case wxLOG_Status:
786855a1
VZ
325 default: // log unknown log levels too
326 DoLogString(szString, t);
0fb67cd1
VZ
327 break;
328
329 case wxLOG_Trace:
330 case wxLOG_Debug:
331#ifdef __WXDEBUG__
332 DoLogString(szString, t);
333#endif
0fb67cd1 334 break;
0fb67cd1 335 }
c801d85f
KB
336}
337
74e3313b 338void wxLog::DoLogString(const wxChar *WXUNUSED(szString), time_t WXUNUSED(t))
c801d85f 339{
223d09f6 340 wxFAIL_MSG(wxT("DoLogString must be overriden if it's called."));
c801d85f
KB
341}
342
343void wxLog::Flush()
344{
0fb67cd1 345 // do nothing
c801d85f
KB
346}
347
348// ----------------------------------------------------------------------------
349// wxLogStderr class implementation
350// ----------------------------------------------------------------------------
351
352wxLogStderr::wxLogStderr(FILE *fp)
353{
0fb67cd1
VZ
354 if ( fp == NULL )
355 m_fp = stderr;
356 else
357 m_fp = fp;
c801d85f
KB
358}
359
74e3313b 360void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t))
c801d85f 361{
d2e1ef19
VZ
362 wxString str;
363 TimeStamp(&str);
223d09f6 364 str << szString << wxT('\n');
1e8a4bc2 365
50920146 366 fputs(str.mb_str(), m_fp);
0fb67cd1 367 fflush(m_fp);
1e8a4bc2 368
378b05f7 369 // under Windows, programs usually don't have stderr at all, so show the
0fb67cd1 370 // messages also under debugger
1e8a4bc2 371#ifdef __WXMSW__
223d09f6 372 OutputDebugString(str + wxT('\r'));
1e8a4bc2 373#endif // MSW
c801d85f
KB
374}
375
376// ----------------------------------------------------------------------------
377// wxLogStream implementation
378// ----------------------------------------------------------------------------
379
4bf78aae 380#if wxUSE_STD_IOSTREAM
c801d85f
KB
381wxLogStream::wxLogStream(ostream *ostr)
382{
0fb67cd1
VZ
383 if ( ostr == NULL )
384 m_ostr = &cerr;
385 else
386 m_ostr = ostr;
c801d85f
KB
387}
388
74e3313b 389void wxLogStream::DoLogString(const wxChar *szString, time_t WXUNUSED(t))
c801d85f 390{
e90c1d2a 391 (*m_ostr) << wxConvertWX2MB(szString) << endl;
c801d85f 392}
0fb67cd1 393#endif // wxUSE_STD_IOSTREAM
c801d85f 394
c801d85f
KB
395// ============================================================================
396// Global functions/variables
397// ============================================================================
398
399// ----------------------------------------------------------------------------
400// static variables
401// ----------------------------------------------------------------------------
0fb67cd1
VZ
402
403wxLog *wxLog::ms_pLogger = (wxLog *)NULL;
404bool wxLog::ms_doLog = TRUE;
405bool wxLog::ms_bAutoCreate = TRUE;
d2e1ef19 406
223d09f6 407const wxChar *wxLog::ms_timestamp = wxT("%X"); // time only, no date
d2e1ef19 408
0fb67cd1
VZ
409wxTraceMask wxLog::ms_ulTraceMask = (wxTraceMask)0;
410wxArrayString wxLog::ms_aTraceMasks;
c801d85f
KB
411
412// ----------------------------------------------------------------------------
413// stdout error logging helper
414// ----------------------------------------------------------------------------
415
416// helper function: wraps the message and justifies it under given position
417// (looks more pretty on the terminal). Also adds newline at the end.
418//
0fb67cd1
VZ
419// TODO this is now disabled until I find a portable way of determining the
420// terminal window size (ok, I found it but does anybody really cares?)
421#ifdef LOG_PRETTY_WRAP
c801d85f
KB
422static void wxLogWrap(FILE *f, const char *pszPrefix, const char *psz)
423{
0fb67cd1
VZ
424 size_t nMax = 80; // FIXME
425 size_t nStart = strlen(pszPrefix);
426 fputs(pszPrefix, f);
427
428 size_t n;
429 while ( *psz != '\0' ) {
430 for ( n = nStart; (n < nMax) && (*psz != '\0'); n++ )
431 putc(*psz++, f);
432
433 // wrapped?
434 if ( *psz != '\0' ) {
435 /*putc('\n', f);*/
436 for ( n = 0; n < nStart; n++ )
437 putc(' ', f);
438
439 // as we wrapped, squeeze all white space
440 while ( isspace(*psz) )
441 psz++;
442 }
c801d85f 443 }
c801d85f 444
0fb67cd1 445 putc('\n', f);
c801d85f
KB
446}
447#endif //LOG_PRETTY_WRAP
448
449// ----------------------------------------------------------------------------
450// error code/error message retrieval functions
451// ----------------------------------------------------------------------------
452
453// get error code from syste
454unsigned long wxSysErrorCode()
455{
0fb67cd1
VZ
456#ifdef __WXMSW__
457#ifdef __WIN32__
458 return ::GetLastError();
459#else //WIN16
460 // TODO what to do on Windows 3.1?
461 return 0;
462#endif //WIN16/32
463#else //Unix
c801d85f 464 return errno;
0fb67cd1 465#endif //Win/Unix
c801d85f
KB
466}
467
468// get error message from system
50920146 469const wxChar *wxSysErrorMsg(unsigned long nErrCode)
c801d85f 470{
0fb67cd1
VZ
471 if ( nErrCode == 0 )
472 nErrCode = wxSysErrorCode();
473
474#ifdef __WXMSW__
475#ifdef __WIN32__
50920146 476 static wxChar s_szBuf[LOG_BUFFER_SIZE / 2];
0fb67cd1
VZ
477
478 // get error message from system
479 LPVOID lpMsgBuf;
480 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
481 NULL, nErrCode,
482 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
483 (LPTSTR)&lpMsgBuf,
484 0, NULL);
485
486 // copy it to our buffer and free memory
50920146 487 wxStrncpy(s_szBuf, (const wxChar *)lpMsgBuf, WXSIZEOF(s_szBuf) - 1);
223d09f6 488 s_szBuf[WXSIZEOF(s_szBuf) - 1] = wxT('\0');
0fb67cd1
VZ
489 LocalFree(lpMsgBuf);
490
491 // returned string is capitalized and ended with '\r\n' - bad
50920146
OK
492 s_szBuf[0] = (wxChar)wxTolower(s_szBuf[0]);
493 size_t len = wxStrlen(s_szBuf);
0fb67cd1 494 if ( len > 0 ) {
9ef3052c 495 // truncate string
223d09f6
KB
496 if ( s_szBuf[len - 2] == wxT('\r') )
497 s_szBuf[len - 2] = wxT('\0');
0fb67cd1
VZ
498 }
499
500 return s_szBuf;
501#else //Win16
502 // TODO
503 return NULL;
504#endif // Win16/32
505#else // Unix
50920146
OK
506#if wxUSE_UNICODE
507 static wxChar s_szBuf[LOG_BUFFER_SIZE / 2];
dcf924a3 508 wxConvCurrent->MB2WC(s_szBuf, strerror(nErrCode), WXSIZEOF(s_szBuf) -1);
50920146
OK
509 return s_szBuf;
510#else
9ef3052c 511 return strerror(nErrCode);
50920146 512#endif
0fb67cd1 513#endif // Win/Unix
c801d85f
KB
514}
515
516// ----------------------------------------------------------------------------
517// debug helper
518// ----------------------------------------------------------------------------
519
b2aef89b 520#ifdef __WXDEBUG__
c801d85f 521
0fb67cd1 522// break into the debugger
7502ba29
VZ
523void Trap()
524{
0fb67cd1 525#ifdef __WXMSW__
7502ba29 526 DebugBreak();
0fb67cd1
VZ
527#elif defined(__WXMAC__)
528#if __powerc
17dff81c 529 Debugger();
0fb67cd1 530#else
17dff81c 531 SysBreak();
0fb67cd1
VZ
532#endif
533#elif defined(__UNIX__)
7502ba29 534 raise(SIGTRAP);
0fb67cd1
VZ
535#else
536 // TODO
537#endif // Win/Unix
7502ba29
VZ
538}
539
c801d85f 540// this function is called when an assert fails
6f9eb452 541void wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg)
c801d85f 542{
0fb67cd1
VZ
543 // this variable can be set to true to suppress "assert failure" messages
544 static bool s_bNoAsserts = FALSE;
545 static bool s_bInAssert = FALSE; // FIXME MT-unsafe
7502ba29 546
0fb67cd1
VZ
547 if ( s_bInAssert ) {
548 // He-e-e-e-elp!! we're trapped in endless loop
549 Trap();
c085e333 550
0fb67cd1 551 s_bInAssert = FALSE;
1e8a4bc2 552
0fb67cd1
VZ
553 return;
554 }
7502ba29 555
0fb67cd1 556 s_bInAssert = TRUE;
c801d85f 557
50920146 558 wxChar szBuf[LOG_BUFFER_SIZE];
c263077e 559
0fb67cd1
VZ
560 // make life easier for people using VC++ IDE: clicking on the message
561 // will take us immediately to the place of the failed assert
378b05f7 562 wxSnprintf(szBuf, WXSIZEOF(szBuf),
3f4a0c5b 563#ifdef __VISUALC__
378b05f7 564 wxT("%s(%d): assert failed"),
c263077e 565#else // !VC++
0fb67cd1 566 // make the error message more clear for all the others
378b05f7 567 wxT("Assert failed in file %s at line %d"),
c263077e 568#endif // VC/!VC
378b05f7 569 szFile, nLine);
c263077e 570
0fb67cd1 571 if ( szMsg != NULL ) {
223d09f6 572 wxStrcat(szBuf, wxT(": "));
50920146 573 wxStrcat(szBuf, szMsg);
0fb67cd1
VZ
574 }
575 else {
223d09f6 576 wxStrcat(szBuf, wxT("."));
0fb67cd1 577 }
c801d85f 578
0fb67cd1
VZ
579 if ( !s_bNoAsserts ) {
580 // send it to the normal log destination
581 wxLogDebug(szBuf);
7502ba29 582
e90c1d2a 583#if wxUSE_GUI
0fb67cd1
VZ
584 // this message is intentionally not translated - it is for
585 // developpers only
223d09f6 586 wxStrcat(szBuf, wxT("\nDo you want to stop the program?"
0fb67cd1 587 "\nYou can also choose [Cancel] to suppress "
50920146 588 "further warnings."));
0fb67cd1
VZ
589
590 switch ( wxMessageBox(szBuf, _("Debug"),
591 wxYES_NO | wxCANCEL | wxICON_STOP ) ) {
592 case wxYES:
593 Trap();
594 break;
595
596 case wxCANCEL:
597 s_bNoAsserts = TRUE;
598 break;
599
600 //case wxNO: nothing to do
601 }
e90c1d2a
VZ
602#else // !GUI
603 Trap();
604#endif // GUI/!GUI
0fb67cd1
VZ
605 }
606
607 s_bInAssert = FALSE;
c801d85f
KB
608}
609
b2aef89b 610#endif //WXDEBUG
c801d85f 611