hlassert.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef HLASSERT_H__
  2. #define HLASSERT_H__
  3. #if _MSC_VER >= 1000
  4. #pragma once
  5. #endif
  6. #ifdef SYSTEM_WIN32
  7. #ifdef _DEBUG
  8. #include "log.h"
  9. #define assume(exp, message) {if (!(exp)) {Log("\n***** ERROR *****\nAssume '%s' failed\n at %s:%d\n %s\n\n", #exp, __FILE__, __LINE__, message); __asm{int 3} }}
  10. #define hlassert(exp) assume(exp, "")
  11. #else // _DEBUG
  12. #define assume(exp, message) {if (!(exp)) {Error("\nAssume '%s' failed\n at %s:%d\n %s\n\n", #exp, __FILE__, __LINE__, message);}}
  13. #define hlassert(exp)
  14. #endif // _DEBUG
  15. #endif // SYSTEM_WIN32
  16. #ifdef SYSTEM_POSIX
  17. #ifdef _DEBUG
  18. #include "log.h"
  19. #define assume(exp, message) {if (!(exp)) {Log("\n***** ERROR *****\nAssume '%s' failed\n at %s:%d\n %s\n\n", #exp, __FILE__, __LINE__, message); exit(-1); }}
  20. #define hlassert(exp) assume(exp, "")
  21. #else // _DEBUG
  22. #define assume(exp, message) {if (!(exp)) {Error("\nAssume '%s' failed\n\n", #exp, __FILE__, __LINE__, message);}}
  23. #define hlassert(exp)
  24. #endif // _DEBUG
  25. #endif // SYSTEM_POSIX
  26. #endif // SYSTEM_POSIX HLASSERT_H__