Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.9 KiB

  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 - 1998 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //==========================================================================;
  11. #ifndef __CODDEBUG_H
  12. #define __CODDEBUG_H
  13. #if DBG
  14. #define DEBUG 1
  15. #endif //DBG
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif // __cplusplus
  19. //======================================================;
  20. // Interfaces provided by this file:
  21. //
  22. // All interfaces provided by this file only exist and generate
  23. // code when DEBUG is defined. No code or data are generated when
  24. // DEBUG is not defined.
  25. //
  26. // CDEBUG_BREAK()
  27. // Causes a trap #3, which hopefully will put you
  28. // in your debugger.
  29. //
  30. // CASSERT(exp)
  31. // If <exp> evaluates to false, prints a failure message
  32. // and calls CDEBUG_BREAK()
  33. //
  34. // CdebugPrint(level, (printf_args));
  35. // If <level> is >= _CDebugLevel, then calls
  36. // DbgPrint(printf_args)
  37. //
  38. //======================================================;
  39. #ifdef DEBUG
  40. # if _X86_
  41. # define CDEBUG_BREAK() { __asm { int 3 }; }
  42. # else
  43. # define CDEBUG_BREAK() DbgBreakPoint()
  44. # endif
  45. extern char _CDebugAssertFail[];
  46. # define CASSERT(exp) {\
  47. if ( !(exp) ) {\
  48. DbgPrint(_CDebugAssertFail, #exp, __FILE__, __LINE__); \
  49. CDEBUG_BREAK(); \
  50. }\
  51. }
  52. extern enum STREAM_DEBUG_LEVEL _CDebugLevel;
  53. # define CDebugPrint(level, args) { if (level <= _CDebugLevel) DbgPrint args; }
  54. #else /*DEBUG*/
  55. # define CDEBUG_BREAK() {}
  56. # define CASSERT(exp) {}
  57. # define CDebugPrint(level, args) {}
  58. #endif /*DEBUG*/
  59. #ifdef __cplusplus
  60. }
  61. #endif // __cplusplus
  62. #endif // #ifndef __CODDEBUG_H