home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / mac / SiteBldr / AMOVIE / SDK / _SETUP / COMMON.Z / assert.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-26  |  1.4 KB  |  42 lines

  1. //==========================================================================;
  2. //
  3. //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. //  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. //  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. //  PURPOSE.
  7. //
  8. //  Copyright (c) 1992 - 1996  Microsoft Corporation.  All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11.  
  12. #include "stdwin.h"
  13.  
  14. /* Displays a message box if the condition evaluated to FALSE */
  15.  
  16. void DbgAssert(const char *pCondition, const char *pFileName, int iLine)
  17. {   int MsgId;
  18.     char szInfo[1024];
  19.  
  20.     wsprintf(szInfo, TEXT("%s \nAt line %d of %s"),
  21.              pCondition, iLine, pFileName);
  22.  
  23.     MsgId = MessageBox(NULL, szInfo, TEXT("ASSERT Failed"),
  24.                            MB_SYSTEMMODAL |
  25.                            MB_ICONHAND |
  26.                            MB_ABORTRETRYIGNORE);
  27.     switch (MsgId)
  28.     {
  29.         case IDABORT:           /* Kill the application */
  30.  
  31.             FatalAppExit(FALSE, TEXT("Application terminated"));
  32.             break;
  33.  
  34.         case IDRETRY:           /* Break into the debugger */
  35.             DebugBreak();
  36.             break;
  37.  
  38.         case IDIGNORE:          /* Ignore assertion continue executing */
  39.             break;
  40.         }
  41. }
  42.