home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / bitmap1.zip / PRINTERR.H < prev    next >
Text File  |  1993-07-15  |  2KB  |  53 lines

  1. // printerr.h
  2.  
  3. // this file defines a macro to display error messages based on
  4. // the "assert" macro in the standard C library.  However, this
  5. // macro works in the Presentation Manager environment to display
  6. // a message box that looks like:
  7. //
  8. //       +------------------------------+
  9. //       |  Error in line xx of file yy |
  10. //       +------------------------------+
  11. //       |  PM error message from the   |
  12. //       |  WinGetErrInfo API           |
  13. //       +------------------------------+
  14. //
  15. // the general form of the macro is:
  16. //
  17. //       pmassert ( expression, hab );
  18. //
  19. // the macro only expands if the expression evaluates to 0
  20. //
  21. //  you can use it to check the value returned by a PM API
  22. //  for example:
  23. //
  24. //       hwndFrame = WinQueryWindow (hwnd,QW_PARENT,FALSE);
  25. //       pmassert(hwndFrame, hab);   // display msg if hwndFrame==NULL
  26. //
  27.  
  28. // to remove the code generated by this macro when you want to produce
  29. // a final version of your program with no error checking, define this
  30. // symbol before including this header:
  31. //
  32. //  #define  NDEBUG
  33.  
  34. // Here is the function prototype for routine that displays message box.
  35. // This routine is defined in PRINTERR.C and is contained in PRINTERR.DLL
  36.  
  37. #if ( defined (__IBMC__) || defined ( __IBMCPP__ ) )
  38. extern "C" VOID printerr (  PSZ szFilename, USHORT usLineNo, HAB hab );
  39. #elif ( defined (__BORLANDC__) )
  40. extern "C" VOID pascal printerr (  PSZ szFilename, USHORT usLineNo, HAB hab );
  41. #else
  42. extern "C" VOID far pascal printerr (  PSZ szFilename, USHORT usLineNo, HAB hab );
  43. #endif
  44.  
  45. //extern "C" VOID printerr (  char *szFilename, USHORT usLineNo, HAB hab );
  46.  
  47. #ifndef NDEBUG
  48.   #define pmassert(exp,hab) if(!(exp)) printerr (__FILE__,__LINE__-1,hab)
  49. #else
  50.   #define pmassert(exp,hab)
  51. #endif
  52.  
  53.