Go to the documentation of this file.00001
00002
00003
00004 #ifndef debug_hh
00005 #define debug_hh
00006
00007 #ifdef DEBUG
00008
00009 #include <iostream>
00010 #include <iomanip>
00011 #include <cstring>
00012 #include <sys/types.h>
00013
00014 #if defined (__GNUC__) || defined(__SUNPRO_CC)
00015
00016
00017
00018 # define DEBUG_FUNCTION __func__
00019
00020 #else
00021 # define __PRETTY_FUNCTION__ "(unknown)"
00022 # define DEBUG_FUNCTION __PRETTY_FUNCTION__
00023 #endif
00024
00025 namespace concepts {
00026 char* shorten(const char* FILE);
00027 }
00028
00029 #define DEBUGL(doit, msg)\
00030 DPL(doit, "[34m[" << concepts::shorten(__FILE__) << ':' << std::setw(4) \
00031 << __LINE__ << "][m " << DEBUG_FUNCTION << " --", msg)
00032
00033 #define DPL(doit, msg, var)\
00034 if(doit!=0) std::cout << msg << " " << var << std::endl;
00035
00036 #define DP(doit, msg, var)\
00037 if(doit!=0) std::cout << msg << " " << var;
00038
00039 #else
00040 # define DEBUGL(doit, msg)
00041 # define DP(doit, msg, var)
00042 # define DPL(doit, msg, var)
00043 # ifndef NDEBUG
00044 # define NDEBUG // discard assertions
00045 # endif
00046 #endif
00047
00048 #include <cassert>
00049 #include <iomanip>
00050
00051 #endif // debug_hh
00052