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.

90 lines
2.0 KiB

  1. //
  2. // Systrack - System resource tracking
  3. // Copyright (c) Microsoft Corporation, 1997
  4. //
  5. //
  6. // header: assert.hxx
  7. // author: silviuc
  8. // created: Wed Nov 11 12:46:52 1998
  9. //
  10. #ifndef _ASSERT_HXX_INCLUDED_
  11. #define _ASSERT_HXX_INCLUDED_
  12. //
  13. // Required include headers.
  14. //
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include <windows.h>
  18. //
  19. // Macro:
  20. //
  21. // assert_ (exp)
  22. //
  23. // Description:
  24. //
  25. // Custom defined assertion macro. It is active, unless
  26. // ASSERT_DISABLED macro is defined. We take care to protect
  27. // it from multiple definitions by enclosing it in
  28. // `#ifndef assert_ .. #endif'.
  29. //
  30. #ifndef ASSERT_DISABLED
  31. #ifndef assert_
  32. #define assert_(exp) \
  33. do \
  34. { \
  35. if ((exp) == 0) \
  36. { \
  37. fprintf (stderr, "`assert_' failed: %s (%d): \n %s", \
  38. __FILE__, __LINE__, #exp); \
  39. exit (1); \
  40. } \
  41. } \
  42. while (0)
  43. #endif // #ifndef assert_
  44. #else
  45. #define assert_(exp)
  46. #endif // #ifndef ASSERT_DISABLED
  47. //
  48. // Macro:
  49. //
  50. // trace_ (exp)
  51. //
  52. // Description:
  53. //
  54. // Macro used for spying during debugging. The final code should
  55. // not contain calls to this macro.
  56. //
  57. #define trace_(exp) printf("trace - %s \n", exp)
  58. //
  59. // Macro:
  60. //
  61. // dump_ (exp)
  62. //
  63. // Description:
  64. //
  65. // Macro used for spying during debugging. The final code should
  66. // not contain calls to this macro.
  67. //
  68. #define dump_(exp) printf ("dump - %s: %u (%08X)\n", #exp, (exp), (exp))
  69. // ...
  70. #endif // #ifndef _ASSERT_HXX_INCLUDED_
  71. //
  72. // end of header: assert.hxx
  73. //