- if ( s_szBuf[len - 2] == '\r' )
- s_szBuf[len - 2] = '\0';
- }
-
- return s_szBuf;
- #else //Win16
- // TODO @@@@
- return NULL;
- #endif // Win16/32
- #else // Unix
- return strerror(nErrCode);
- #endif // Win/Unix
-}
-
-// ----------------------------------------------------------------------------
-// debug helper
-// ----------------------------------------------------------------------------
-
-#ifdef __WXDEBUG__
-
-void Trap()
-{
- #ifdef __WXMSW__
- DebugBreak();
- #else // Unix
- raise(SIGTRAP);
- #endif // Win/Unix
-}
-
-// this function is called when an assert fails
-void wxOnAssert(const char *szFile, int nLine, const char *szMsg)
-{
- // this variable can be set to true to suppress "assert failure" messages
- static bool s_bNoAsserts = FALSE;
- static bool s_bInAssert = FALSE;
-
- if ( s_bInAssert ) {
- // He-e-e-e-elp!! we're trapped in endless loop
- Trap();
- }
-
- s_bInAssert = TRUE;
-
- char szBuf[LOG_BUFFER_SIZE];
- sprintf(szBuf, _("Assert failed in file %s at line %d"), szFile, nLine);
- if ( szMsg != NULL ) {
- strcat(szBuf, ": ");
- strcat(szBuf, szMsg);
- }
- else {
- strcat(szBuf, ".");
- }
-
- if ( !s_bNoAsserts ) {
- // send it to the normal log destination
- wxLogDebug(szBuf);
-
- strcat(szBuf, _("\nDo you want to stop the program?"
- "\nYou can also choose [Cancel] to suppress "
- "further warnings."));
-
- switch ( wxMessageBox(szBuf, _("Debug"),
- wxYES_NO | wxCANCEL | wxICON_STOP ) ) {
- case wxYES:
- Trap();
- break;
-
- case wxCANCEL:
- s_bNoAsserts = TRUE;
- break;
-
- //case wxNO: nothing to do