home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / source / devnews / vol1 / sample1 / pmassert.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-10  |  636 b   |  21 lines

  1.  
  2. //-------------------------------------------------------------------
  3. // pmassert.h
  4. #ifndef NDEBUG
  5. #define pmassert(hab,exp)\
  6. {\
  7. if(!(exp)) {\
  8.   char ebuff[ 64 ]; unsigned long errorid; unsigned short shortrc;\
  9.   errorid = WinGetLastError( hab ); \
  10.   sprintf( ebuff, "Line %d\nFile %s\nLast Error %p\nExpression %s\n",\
  11.                  __LINE__, __FILE__, errorid, #exp );\
  12.   shortrc = WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, ebuff,\
  13.                  "Assertion failed. Continue?", 0, MB_YESNO  );\
  14.   if( shortrc == MBID_NO ) exit( 1 );\
  15. }\
  16. }
  17. #else
  18.   #define pmassert(hab,exp)
  19. #endif
  20. // end of file pmassert.h
  21.