Annotation of mstools/mfc/src/assert.cpp, revision 1.1.1.2

1.1       root        1: // This is a part of the Microsoft Foundation Classes C++ library. 
                      2: // Copyright (C) 1992 Microsoft Corporation 
                      3: // All rights reserved. 
                      4: //  
                      5: // This source code is only intended as a supplement to the 
                      6: // Microsoft Foundation Classes Reference and Microsoft 
                      7: // QuickHelp documentation provided with the library. 
                      8: // See these sources for detailed information regarding the 
                      9: // Microsoft Foundation Classes product. 
                     10: 
                     11: #ifdef _WINDOWS
                     12: #include "afxwin.h"
                     13: #else
                     14: #include "afx.h"
                     15: #endif
                     16: #pragma hdrstop
                     17: 
                     18: #ifdef AFX_CORE_SEG
                     19: #pragma code_seg(AFX_CORE_SEG)
                     20: #endif
                     21: 
                     22: 
                     23: /*
                     24:  *  NOTE: in separate module so it can replaced if needed
                     25:  */
                     26: 
                     27: #ifdef _DEBUG
                     28: #undef THIS_FILE
                     29: static char BASED_CODE THIS_FILE[] = __FILE__;
                     30: #endif
                     31: 
                     32: #ifdef _DEBUG
                     33: int afxIgnoreAssertCount = 0;               // for testing diagnostics
                     34: #endif
                     35: 
                     36: #pragma optimize("q", off)
                     37: 
                     38: extern "C"
                     39: void PASCAL AfxAssertFailedLine(const char FAR* lpszFileName, int nLine)
                     40: {
                     41: #ifdef _DEBUG
                     42:        if (afxIgnoreAssertCount > 0)
                     43:        {
                     44:                afxIgnoreAssertCount--;
                     45:                return;
                     46:        }
                     47: 
                     48: #ifdef _WINDOWS
                     49:        char sz[255];
                     50:        static char BASED_CODE szTitle[] = "Assertion Failed!";
                     51:        static char BASED_CODE szMessage[] = "%s: File %s, Line %d";
                     52:        static char BASED_CODE szUnknown[] = "<unknown application>";
                     53: 
                     54:        wsprintf(sz, (LPCSTR)szMessage, 
                     55:                AfxGetApp() == NULL ? (LPCSTR)szUnknown : (LPCSTR)AfxGetAppName(), 
                     56:                lpszFileName, 
                     57:                nLine);
                     58: 
                     59:        if (afxTraceEnabled)
                     60:        {
                     61:                // assume the debugger or auxiliary port
                     62:                ::OutputDebugString(szTitle);
                     63:                ::OutputDebugString("\n\r");
                     64:                ::OutputDebugString(sz);
                     65:                ::OutputDebugString("\n\r");
1.1.1.2 ! root       66: #ifdef _NTWIN
        !            67:                DebugBreak();
        !            68: #else
1.1       root       69:                _asm { int 3 };
1.1.1.2 ! root       70: #endif
1.1       root       71:        }
                     72: 
                     73:        ::MessageBox(NULL, sz, szTitle, MB_SYSTEMMODAL | MB_ICONHAND | MB_OK);
                     74: #else
                     75:        static char szMessage[] = "Assertion Failed: file %Fs, line %d\r\n";
                     76:        fprintf(stderr, szMessage, lpszFileName, nLine);
                     77: #endif // _WINDOWS
                     78: 
                     79: #else
                     80:        // parameters not used if non-debug
                     81:        (void)lpszFileName;
                     82:        (void)nLine;
                     83: #endif // _DEBUG
                     84: 
                     85:        AfxAbort();
                     86: }
                     87: 
                     88: #pragma optimize("", on)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.