00001 #ifndef CODE_SPOT_CO_ZA_DEBUG_H
00002 #define CODE_SPOT_CO_ZA_DEBUG_H
00003
00004 #include "macro_util.h"
00005
00006 #define UNREACHABLE 0
00007 #define NOT_IMPLEMENTED 0
00008
00009 #ifdef CODE_SPOT_CO_ZA_DEBUG
00010 #include <iostream>
00011
00012 #define CODE_SPOT_CO_ZA_SKIP_EXIT
00013
00014 #ifdef CODE_SPOT_CO_ZA_SKIP_EXIT
00015
00016
00017
00018 #ifdef assert
00019 #undef assert
00020 #endif //assert
00021
00022 inline void break_to_debugger()
00023 {
00024 __asm int 3;
00025 }
00026
00027 #define assert(cond) \
00028 MULTI_LINE_MACRO_BEGIN \
00029 if (!(cond)) \
00030 { \
00031 std::cerr << "ERROR: Assertion Failed in " << __FILE__ << " line: " << __LINE__ << std::endl; \
00032 std::cerr << std::endl; \
00033 __debugbreak(); \
00034 } \
00035 MULTI_LINE_MACRO_END
00036 #else
00037 MULTI_LINE_MACRO_BEGIN \
00038 if (!(cond)) \
00039 { \
00040 std::cerr << "ERROR: Assertion Failed in " << __FILE__ << " line: " << __LINE__ << std::endl; \
00041 std::cerr << std::endl;\
00042 std::cerr << "Application will exit. Press <ENTER>..." << std::endl;\
00043 getchar(); \
00044 exit(1);\
00045 }\
00046 MULTI_LINE_MACRO_END
00047 #endif // CODE_SPOT_CO_ZA_SKIP_EXIT
00048
00049 #define bugpr(message) std::cerr << "BUG: " << (message) << " in " << __FILE__ << " line: " << __LINE__ << std::endl;
00050
00051 #else //CODE_SPOT_CO_ZA_DEBUG
00052
00053 #ifndef assert
00054 #define assert(cond) //((void) sizeof(cond))
00055 #endif
00056
00057 #endif //CODE_SPOT_CO_ZA_DEBUG
00058 #endif //CODE_SPOT_CO_ZA_DEBUG_H