Leaked source code of windows server 2003
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.

44 lines
1.2 KiB

  1. #ifndef _DEBUG_H
  2. #define _DEBUG_H
  3. void _coreASSERT(const char *filename, int line, const char *errMst, void (*cleanup)());
  4. void dumpOnBuild();
  5. #ifdef _ASSERT
  6. #undef _ASSERT
  7. #endif
  8. // DESCRIPTION:
  9. // macro useful for run-time debugging
  10. // it tels exactly which source and which line an error occured.
  11. // it also calls a user-supplied clean-up function, if available
  12. // and exits the program.
  13. // PARAMETERS:
  14. // (in)b - boolean condition that has to be checked
  15. // (in)s - error message string to be displayed if assertion fails
  16. // (in)f - user-defined function to be called for cleanup before exiting
  17. #define _ASSERT(b,s,f) \
  18. { \
  19. if (!(b)) \
  20. { \
  21. _coreASSERT(__FILE__, __LINE__, (s), (f)); \
  22. exit(-1); \
  23. } \
  24. }
  25. // DESCRIPTION
  26. // macro useful for parameter checking.
  27. // PARAMETERS
  28. // (in)b - boolean condition that has to be checked
  29. // (in)v - value to be returned if condition fails
  30. #define _VERIFY(b,v) \
  31. { \
  32. if (!(b)) \
  33. { \
  34. _coreASSERT(__FILE__, __LINE__, " _VERIFY failure ", NULL); \
  35. return v; \
  36. } \
  37. }
  38. #endif