home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / graphics / icm20 / icmview / debug.h < prev    next >
C/C++ Source or Header  |  1997-09-07  |  3KB  |  86 lines

  1. //THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. //ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. //THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright  1994-1997  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. //  FILE:
  9. //    DEBUG.H
  10. //
  11. //  PURPOSE:
  12. //    Include file for DEBUG.C
  13. //
  14. //  PLATFORMS:
  15. //    Windows 95, Windows NT
  16. //
  17. //  SPECIAL INSTRUCTIONS: N/A
  18. //
  19. #ifndef _ICM_H_
  20.     #include "icm.h"
  21. #endif
  22.  
  23. #ifdef DBG
  24.     #define _DEBUG
  25. #endif
  26.  
  27. // General pre-processor macros
  28. // Constants used by ICM_Debug functions
  29. #define MAX_DEBUG_STRING    256
  30.  
  31. // Constants used to set unitialized values
  32. #define UNINIT_BYTE     0x17
  33. #define UNINIT_DWORD    0x17171717
  34.  
  35. // ASSERT macro to display problem information in DEBUG build
  36. #ifdef _DEBUG
  37.     #define ASSERT(exp)               \
  38.     if(exp)                           \
  39.     {                                 \
  40.       NULL;                           \
  41.     }                                 \
  42.     else                              \
  43.     {                                 \
  44.       _Assert(__FILE__, __LINE__);    \
  45.     }
  46. #else
  47.     #define ASSERT(exp)   NULL
  48. #endif
  49.  
  50. #ifdef DEBUG_MEMORY
  51.     #ifndef I_AM_DEBUG
  52.         #define GlobalFree(hMem)   SafeFree(__FILE__, __LINE__, hMem)
  53.         #define GlobalUnlock(hMem) SafeUnlock(__FILE__, __LINE__, hMem)
  54.         #define GlobalLock(hMem)   SafeLock(__FILE__, __LINE__, hMem)
  55.     #endif
  56. #endif
  57.  
  58. // Used by FormatLastError to determine if string should be allocated
  59. // and returned or just displayed and freed.
  60. #define LASTERROR_ALLOC      1
  61. #define LASTERROR_NOALLOC    2
  62.  
  63. #define DISPLAY_LASTERROR(ui,dw) FormatLastError(__FILE__, __LINE__, ui, dw)
  64.  
  65.  
  66. // General STRUCTS && TYPEDEFS
  67.  
  68. // Function prototypes
  69. void    _Assert(LPSTR lpszFile, UINT uLine);
  70. void    DebugMsg (LPTSTR sz,...);
  71. void    DebugMsgA (LPSTR lpszMessage,...);
  72. int     ErrMsg (HWND hwndOwner, LPTSTR sz,...);
  73. void    DumpMemory(LPBYTE lpbMem, UINT uiElementSize, UINT uiNumElements);
  74. void    DumpRectangle(LPTSTR lpszDesc, LPRECT lpRect);
  75. void    DumpProfile(PPROFILE pProfile);
  76. void    DumpBmpHeader(LPVOID lpvBmpHeader);
  77. void    DumpBITMAPFILEHEADER(LPBITMAPFILEHEADER lpBmpFileHeader);
  78. void    DumpLogColorSpace(LPLOGCOLORSPACE pColorSpace);
  79. void    DumpCOLORMATCHSETUP(LPCOLORMATCHSETUP lpCM);
  80. HGLOBAL SafeFree(LPTSTR lpszFile, UINT uLine, HGLOBAL hMemory);
  81. BOOL    SafeUnlock(LPTSTR lpszFile, UINT uLine, HGLOBAL hMemory);
  82. LPVOID  SafeLock(LPTSTR lpszFile, UINT uiLine, HGLOBAL hMemory);
  83. LPSTR   FormatLastError(LPSTR lpszFile, UINT uiLine, UINT uiOutput, DWORD dwLastError);
  84.  
  85.  
  86.