home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PRINTERR.ZIP / PRINTERR.H < prev    next >
Text File  |  1990-02-15  |  1KB  |  45 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. VOID far pascal printerr (  PSZ szFilename, USHORT usLineNo, HAB hab );
  38.  
  39. #ifndef NDEBUG
  40.   #define pmassert(exp,hab) {if(!(exp)) printerr (__FILE__,__LINE__,hab);}
  41. #else
  42.   #define pmassert(exp,hab)
  43. #endif
  44.  
  45.